@Test public void testCreateForwardingForEndpoint() throws Exception { String clientIp = "1.1.1.1"; String clientMac = "10:00:00:00:00:01"; String clientIfaceName = "client1"; AbsoluteLocation clientLocation = DtoFactory.absoluteLocation(DtoFactory.VPP_NODE_1_IID, null, clientIfaceName); AddressEndpointWithLocation clientEp = DtoFactory.createEndpoint(clientIp, clientMac, DtoFactory.L2FD_CTX.getValue(), clientLocation); String webIp = "2.2.2.2"; String webMac = "20:00:00:00:00:02"; String webIfaceName = "web1"; AbsoluteLocation webLocation = DtoFactory.absoluteLocation(DtoFactory.VPP_NODE_1_IID, null, webIfaceName); AddressEndpointWithLocation webEp = DtoFactory.createEndpoint(webIp, webMac, DtoFactory.L2FD_CTX.getValue(), webLocation); Configuration configuration = DtoFactory.createConfiguration(Arrays.asList(clientEp), Arrays.asList(webEp)); RendererPolicy rendererPolicy = new RendererPolicyBuilder().setVersion(1L).setConfiguration(configuration).build(); PolicyContext policyCtx = new PolicyContext(rendererPolicy); RendererEndpoint firstRendererEp = configuration.getRendererEndpoints().getRendererEndpoint().get(0); AddressEndpointWithLocation firstAddrEpWithLoc = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(firstRendererEp.getKey())); Mockito .when(ifaceManager.addBridgeDomainToInterface(Mockito.eq(DtoFactory.L2FD_CTX.getValue()), Mockito.eq(firstAddrEpWithLoc), Mockito.anyListOf(AccessListWrapper.class), Mockito.eq(IS_BVI))) .thenReturn(Futures.immediateFuture(null)); fwdManager.createForwardingForEndpoint(firstRendererEp.getKey(), policyCtx); Mockito.verify(ifaceManager).addBridgeDomainToInterface(Matchers.eq(DtoFactory.L2FD_CTX.getValue()), Matchers.eq(firstAddrEpWithLoc), Mockito.anyListOf(AccessListWrapper.class), Mockito.eq(IS_BVI)); }
void createForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processCreateEndPoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.configureEndpointForFlatOverlay(rEp); loopbackManager.createSimpleLoopbackIfNeeded(rEp); } } ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { LOG.info("Renderer endpoint does not have external-node-connector therefore it is ignored {}", rEp); return; } if (Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { java.util.Optional<String> optL2FloodDomain = resolveL2FloodDomain(rEp, policyCtx); if (!optL2FloodDomain.isPresent()) { LOG.info("Renderer endpoint does not have l2FloodDomain as network containment {}", rEp); return; } if (!ConfigUtil.getInstance().isL3FlatEnabled()) { String l2FloodDomain = optL2FloodDomain.get(); try { ifaceManager.addBridgeDomainToInterface(l2FloodDomain, rEp, aclManager.resolveAclsOnInterface( rEpKey, policyCtx).get(), isBviForEndpoint(rEp)).get(); LOG.debug("Interface added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("Interface was not added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp, e); } } } else { LOG.debug("Forwarding is not created - Location of renderer endpoint contains " + "external-node therefore VPP renderer assumes that interface for endpoint is " + "already assigned in bridge-domain representing external-node. {}", rEp); } }
ForwardingManager { void createForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processCreateEndPoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.configureEndpointForFlatOverlay(rEp); loopbackManager.createSimpleLoopbackIfNeeded(rEp); } } ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { LOG.info("Renderer endpoint does not have external-node-connector therefore it is ignored {}", rEp); return; } if (Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { java.util.Optional<String> optL2FloodDomain = resolveL2FloodDomain(rEp, policyCtx); if (!optL2FloodDomain.isPresent()) { LOG.info("Renderer endpoint does not have l2FloodDomain as network containment {}", rEp); return; } if (!ConfigUtil.getInstance().isL3FlatEnabled()) { String l2FloodDomain = optL2FloodDomain.get(); try { ifaceManager.addBridgeDomainToInterface(l2FloodDomain, rEp, aclManager.resolveAclsOnInterface( rEpKey, policyCtx).get(), isBviForEndpoint(rEp)).get(); LOG.debug("Interface added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("Interface was not added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp, e); } } } else { LOG.debug("Forwarding is not created - Location of renderer endpoint contains " + "external-node therefore VPP renderer assumes that interface for endpoint is " + "already assigned in bridge-domain representing external-node. {}", rEp); } } }
ForwardingManager { void createForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processCreateEndPoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.configureEndpointForFlatOverlay(rEp); loopbackManager.createSimpleLoopbackIfNeeded(rEp); } } ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { LOG.info("Renderer endpoint does not have external-node-connector therefore it is ignored {}", rEp); return; } if (Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { java.util.Optional<String> optL2FloodDomain = resolveL2FloodDomain(rEp, policyCtx); if (!optL2FloodDomain.isPresent()) { LOG.info("Renderer endpoint does not have l2FloodDomain as network containment {}", rEp); return; } if (!ConfigUtil.getInstance().isL3FlatEnabled()) { String l2FloodDomain = optL2FloodDomain.get(); try { ifaceManager.addBridgeDomainToInterface(l2FloodDomain, rEp, aclManager.resolveAclsOnInterface( rEpKey, policyCtx).get(), isBviForEndpoint(rEp)).get(); LOG.debug("Interface added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("Interface was not added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp, e); } } } else { LOG.debug("Forwarding is not created - Location of renderer endpoint contains " + "external-node therefore VPP renderer assumes that interface for endpoint is " + "already assigned in bridge-domain representing external-node. {}", rEp); } } ForwardingManager(@Nonnull InterfaceManager ifaceManager, @Nonnull AclManager aclManager,
                             @Nonnull NatManager natManager, @Nonnull RoutingManager routingManager,
                             @Nonnull BridgeDomainManager bdManager, @Nonnull LispStateManager lispStateManager,
                             @Nonnull LoopbackManager loopbackManager, @Nonnull FlatOverlayManager flatOverlayManager,
                             @Nonnull DhcpRelayHandler dhcpRelayHandler, @Nonnull DataBroker dataBroker); }
ForwardingManager { void createForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processCreateEndPoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.configureEndpointForFlatOverlay(rEp); loopbackManager.createSimpleLoopbackIfNeeded(rEp); } } ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { LOG.info("Renderer endpoint does not have external-node-connector therefore it is ignored {}", rEp); return; } if (Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { java.util.Optional<String> optL2FloodDomain = resolveL2FloodDomain(rEp, policyCtx); if (!optL2FloodDomain.isPresent()) { LOG.info("Renderer endpoint does not have l2FloodDomain as network containment {}", rEp); return; } if (!ConfigUtil.getInstance().isL3FlatEnabled()) { String l2FloodDomain = optL2FloodDomain.get(); try { ifaceManager.addBridgeDomainToInterface(l2FloodDomain, rEp, aclManager.resolveAclsOnInterface( rEpKey, policyCtx).get(), isBviForEndpoint(rEp)).get(); LOG.debug("Interface added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("Interface was not added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp, e); } } } else { LOG.debug("Forwarding is not created - Location of renderer endpoint contains " + "external-node therefore VPP renderer assumes that interface for endpoint is " + "already assigned in bridge-domain representing external-node. {}", rEp); } } ForwardingManager(@Nonnull InterfaceManager ifaceManager, @Nonnull AclManager aclManager,
                             @Nonnull NatManager natManager, @Nonnull RoutingManager routingManager,
                             @Nonnull BridgeDomainManager bdManager, @Nonnull LispStateManager lispStateManager,
                             @Nonnull LoopbackManager loopbackManager, @Nonnull FlatOverlayManager flatOverlayManager,
                             @Nonnull DhcpRelayHandler dhcpRelayHandler, @Nonnull DataBroker dataBroker); static Optional<IpPrefix> resolveIpPrefix(RendererNetworkDomain rendDomain); }
ForwardingManager { void createForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processCreateEndPoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.configureEndpointForFlatOverlay(rEp); loopbackManager.createSimpleLoopbackIfNeeded(rEp); } } ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { LOG.info("Renderer endpoint does not have external-node-connector therefore it is ignored {}", rEp); return; } if (Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { java.util.Optional<String> optL2FloodDomain = resolveL2FloodDomain(rEp, policyCtx); if (!optL2FloodDomain.isPresent()) { LOG.info("Renderer endpoint does not have l2FloodDomain as network containment {}", rEp); return; } if (!ConfigUtil.getInstance().isL3FlatEnabled()) { String l2FloodDomain = optL2FloodDomain.get(); try { ifaceManager.addBridgeDomainToInterface(l2FloodDomain, rEp, aclManager.resolveAclsOnInterface( rEpKey, policyCtx).get(), isBviForEndpoint(rEp)).get(); LOG.debug("Interface added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("Interface was not added to bridge-domain {} for endpoint {}", l2FloodDomain, rEp, e); } } } else { LOG.debug("Forwarding is not created - Location of renderer endpoint contains " + "external-node therefore VPP renderer assumes that interface for endpoint is " + "already assigned in bridge-domain representing external-node. {}", rEp); } } ForwardingManager(@Nonnull InterfaceManager ifaceManager, @Nonnull AclManager aclManager,
                             @Nonnull NatManager natManager, @Nonnull RoutingManager routingManager,
                             @Nonnull BridgeDomainManager bdManager, @Nonnull LispStateManager lispStateManager,
                             @Nonnull LoopbackManager loopbackManager, @Nonnull FlatOverlayManager flatOverlayManager,
                             @Nonnull DhcpRelayHandler dhcpRelayHandler, @Nonnull DataBroker dataBroker); static Optional<IpPrefix> resolveIpPrefix(RendererNetworkDomain rendDomain);  }