@Test public void testRemoveForwardingForEndpoint() throws Exception { String clientIp = "1.1.1.1"; String clientMac = "10:00:00:00:00:01"; String clientIfaceName = "client1"; String bdNameOnVpp = "bdRed"; AbsoluteLocation clientLocation = DtoFactory.absoluteLocation(DtoFactory.VPP_NODE_1_IID, bdNameOnVpp, 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, bdNameOnVpp, 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.deleteBridgeDomainFromInterface(Mockito.eq(firstAddrEpWithLoc))) .thenReturn(Futures.immediateFuture(null)); fwdManager.removeForwardingForEndpoint(firstRendererEp.getKey(), policyCtx); Mockito.verify(ifaceManager).deleteBridgeDomainFromInterface(Matchers.eq(firstAddrEpWithLoc)); }
void removeForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processDeleteEndpoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.deleteStaticRoutingEntry(rEp); } } if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { return; } if (!Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { try { ifaceManager.deleteBridgeDomainFromInterface(rEp).get(); LOG.debug("bridge-domain was deleted from interface for endpoint {}", rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("bridge-domain was not deleted from interface for endpoint {}", rEp, e); } } else { LOG.debug("Forwarding is not removed - Location of renderer endpoint does not contain " + "external-node therefore VPP renderer assumes that interface for endpoint is not " + "assigned to bridge-domain representing external-node. {}", rEp); } }
ForwardingManager { void removeForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processDeleteEndpoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.deleteStaticRoutingEntry(rEp); } } if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { return; } if (!Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { try { ifaceManager.deleteBridgeDomainFromInterface(rEp).get(); LOG.debug("bridge-domain was deleted from interface for endpoint {}", rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("bridge-domain was not deleted from interface for endpoint {}", rEp, e); } } else { LOG.debug("Forwarding is not removed - Location of renderer endpoint does not contain " + "external-node therefore VPP renderer assumes that interface for endpoint is not " + "assigned to bridge-domain representing external-node. {}", rEp); } } }
ForwardingManager { void removeForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processDeleteEndpoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.deleteStaticRoutingEntry(rEp); } } if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { return; } if (!Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { try { ifaceManager.deleteBridgeDomainFromInterface(rEp).get(); LOG.debug("bridge-domain was deleted from interface for endpoint {}", rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("bridge-domain was not deleted from interface for endpoint {}", rEp, e); } } else { LOG.debug("Forwarding is not removed - Location of renderer endpoint does not contain " + "external-node therefore VPP renderer assumes that interface for endpoint is not " + "assigned to 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 removeForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processDeleteEndpoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.deleteStaticRoutingEntry(rEp); } } if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { return; } if (!Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { try { ifaceManager.deleteBridgeDomainFromInterface(rEp).get(); LOG.debug("bridge-domain was deleted from interface for endpoint {}", rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("bridge-domain was not deleted from interface for endpoint {}", rEp, e); } } else { LOG.debug("Forwarding is not removed - Location of renderer endpoint does not contain " + "external-node therefore VPP renderer assumes that interface for endpoint is not " + "assigned to 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 removeForwardingForEndpoint(RendererEndpointKey rEpKey, PolicyContext policyCtx) { AddressEndpointWithLocation rEp = policyCtx.getAddrEpByKey().get(KeyFactory.addressEndpointKey(rEpKey)); ExternalLocationCase rEpLoc = resolveAndValidateLocation(rEp); if (ConfigUtil.getInstance().isLispOverlayEnabled()) { lispStateManager.processDeleteEndpoint(rEp); if (ConfigUtil.getInstance().isL3FlatEnabled()) { flatOverlayManager.deleteStaticRoutingEntry(rEp); } } if (rEpLoc == null || Strings.isNullOrEmpty(rEpLoc.getExternalNodeConnector())) { return; } if (!Strings.isNullOrEmpty(rEpLoc.getExternalNode())) { try { ifaceManager.deleteBridgeDomainFromInterface(rEp).get(); LOG.debug("bridge-domain was deleted from interface for endpoint {}", rEp); } catch (InterruptedException | ExecutionException e) { LOG.warn("bridge-domain was not deleted from interface for endpoint {}", rEp, e); } } else { LOG.debug("Forwarding is not removed - Location of renderer endpoint does not contain " + "external-node therefore VPP renderer assumes that interface for endpoint is not " + "assigned to 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);  }