@Test public void createL3PrefixFlow_externalExceptionCaught() { EndpointBuilder gatewayEpBuilder = buildEndpoint(IPV4_0, MAC_0, CONNECTOR_0); OfOverlayContextBuilder ofOverlayContextBuilder = new OfOverlayContextBuilder(); ofOverlayContextBuilder.setNodeConnectorId(new NodeConnectorId(CONNECTOR_1)); gatewayEpBuilder.addAugmentation(OfOverlayContext.class, ofOverlayContextBuilder.build()); gatewayEpBuilder.setEndpointGroup(ENDPOINT_GROUP_0); TenantBuilder tenantBuilder = new TenantBuilder(getTestIndexedTenant().getTenant()); List<ExternalImplicitGroup> externalImplicitGroups = new ArrayList<>(); ExternalImplicitGroupBuilder externalImplicitGroupBuilder = new ExternalImplicitGroupBuilder(); externalImplicitGroupBuilder.setId(ENDPOINT_GROUP_0); externalImplicitGroups.add(externalImplicitGroupBuilder.build()); tenantBuilder.setPolicy(new PolicyBuilder().setExternalImplicitGroup(externalImplicitGroups).build()); IndexedTenant tenant = new IndexedTenant(tenantBuilder.build()); SubnetBuilder localSubnetBuilder = new SubnetBuilder(); localSubnetBuilder.setId(SUBNET_1); localSubnetBuilder.setVirtualRouterIp(new IpAddress(IPV4_0)); localSubnetBuilder.setParent(L2FD_ID); Subnet localSubnet = localSubnetBuilder.build(); Set<NodeConnectorId> externalPorts = new HashSet<>(); externalPorts.add(new NodeConnectorId(CONNECTOR_0)); externalPorts.add(new NodeConnectorId(CONNECTOR_1)); flows.createL3PrefixFlow(tableId, 30, gatewayEpBuilder.build(), null, tenant, localSubnet, externalPorts, ofWriter); verifyZeroInteractions(ofWriter); }
void createL3PrefixFlow(short goToTable, int priority, Endpoint gatewayEp, EndpointL3Prefix l3Prefix, IndexedTenant tenant, Subnet localSubnet, Set<NodeConnectorId> externalPorts, OfWriter ofWriter) { L3Context l3Context = utils.getL3ContextForSubnet(tenant, localSubnet); if (l3Context != null && localSubnet.getVirtualRouterIp() != null) { MacAddress matcherMacAddress = utils.routerPortMac(l3Context, localSubnet.getVirtualRouterIp(), tenant.getTenant().getId()); OfOverlayContext context = gatewayEp.getAugmentation(OfOverlayContext.class); if (EndpointManager.isInternal(gatewayEp, tenant.getExternalImplicitGroups())) { Preconditions.checkNotNull(context.getNodeConnectorId()); try { Long port = getOfPortNum(context.getNodeConnectorId()); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId()); } } else { for (NodeConnectorId externalPort : externalPorts) { try { Long port = getOfPortNum(externalPort); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", externalPort); } } } } }
DestinationMapperFlows { void createL3PrefixFlow(short goToTable, int priority, Endpoint gatewayEp, EndpointL3Prefix l3Prefix, IndexedTenant tenant, Subnet localSubnet, Set<NodeConnectorId> externalPorts, OfWriter ofWriter) { L3Context l3Context = utils.getL3ContextForSubnet(tenant, localSubnet); if (l3Context != null && localSubnet.getVirtualRouterIp() != null) { MacAddress matcherMacAddress = utils.routerPortMac(l3Context, localSubnet.getVirtualRouterIp(), tenant.getTenant().getId()); OfOverlayContext context = gatewayEp.getAugmentation(OfOverlayContext.class); if (EndpointManager.isInternal(gatewayEp, tenant.getExternalImplicitGroups())) { Preconditions.checkNotNull(context.getNodeConnectorId()); try { Long port = getOfPortNum(context.getNodeConnectorId()); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId()); } } else { for (NodeConnectorId externalPort : externalPorts) { try { Long port = getOfPortNum(externalPort); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", externalPort); } } } } } }
DestinationMapperFlows { void createL3PrefixFlow(short goToTable, int priority, Endpoint gatewayEp, EndpointL3Prefix l3Prefix, IndexedTenant tenant, Subnet localSubnet, Set<NodeConnectorId> externalPorts, OfWriter ofWriter) { L3Context l3Context = utils.getL3ContextForSubnet(tenant, localSubnet); if (l3Context != null && localSubnet.getVirtualRouterIp() != null) { MacAddress matcherMacAddress = utils.routerPortMac(l3Context, localSubnet.getVirtualRouterIp(), tenant.getTenant().getId()); OfOverlayContext context = gatewayEp.getAugmentation(OfOverlayContext.class); if (EndpointManager.isInternal(gatewayEp, tenant.getExternalImplicitGroups())) { Preconditions.checkNotNull(context.getNodeConnectorId()); try { Long port = getOfPortNum(context.getNodeConnectorId()); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId()); } } else { for (NodeConnectorId externalPort : externalPorts) { try { Long port = getOfPortNum(externalPort); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", externalPort); } } } } } DestinationMapperFlows(DestinationMapperUtils utils, NodeId nodeId, short tableId); }
DestinationMapperFlows { void createL3PrefixFlow(short goToTable, int priority, Endpoint gatewayEp, EndpointL3Prefix l3Prefix, IndexedTenant tenant, Subnet localSubnet, Set<NodeConnectorId> externalPorts, OfWriter ofWriter) { L3Context l3Context = utils.getL3ContextForSubnet(tenant, localSubnet); if (l3Context != null && localSubnet.getVirtualRouterIp() != null) { MacAddress matcherMacAddress = utils.routerPortMac(l3Context, localSubnet.getVirtualRouterIp(), tenant.getTenant().getId()); OfOverlayContext context = gatewayEp.getAugmentation(OfOverlayContext.class); if (EndpointManager.isInternal(gatewayEp, tenant.getExternalImplicitGroups())) { Preconditions.checkNotNull(context.getNodeConnectorId()); try { Long port = getOfPortNum(context.getNodeConnectorId()); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId()); } } else { for (NodeConnectorId externalPort : externalPorts) { try { Long port = getOfPortNum(externalPort); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", externalPort); } } } } } DestinationMapperFlows(DestinationMapperUtils utils, NodeId nodeId, short tableId);  }
DestinationMapperFlows { void createL3PrefixFlow(short goToTable, int priority, Endpoint gatewayEp, EndpointL3Prefix l3Prefix, IndexedTenant tenant, Subnet localSubnet, Set<NodeConnectorId> externalPorts, OfWriter ofWriter) { L3Context l3Context = utils.getL3ContextForSubnet(tenant, localSubnet); if (l3Context != null && localSubnet.getVirtualRouterIp() != null) { MacAddress matcherMacAddress = utils.routerPortMac(l3Context, localSubnet.getVirtualRouterIp(), tenant.getTenant().getId()); OfOverlayContext context = gatewayEp.getAugmentation(OfOverlayContext.class); if (EndpointManager.isInternal(gatewayEp, tenant.getExternalImplicitGroups())) { Preconditions.checkNotNull(context.getNodeConnectorId()); try { Long port = getOfPortNum(context.getNodeConnectorId()); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", context.getNodeConnectorId()); } } else { for (NodeConnectorId externalPort : externalPorts) { try { Long port = getOfPortNum(externalPort); if(matcherMacAddress != null) { writeL3PrefixFlow(priority, goToTable, gatewayEp, l3Prefix, port, matcherMacAddress, ofWriter); } } catch (NumberFormatException e) { LOG.warn("Could not parse port number {}", externalPort); } } } } } DestinationMapperFlows(DestinationMapperUtils utils, NodeId nodeId, short tableId);   }