+ // change L3Context for all EPs with same subnet as router port
+ changeL3ContextForEpsInSubnet(portIpWithSubnet.getSubnetId(), neutron);
+ // set L3Context as parent for bridge domain which is parent of subnet
+ TenantId tenantId = new TenantId(port.getTenantId().getValue());
+ Optional<Subnet> potentialRouterPortSubnet = SubnetUtils.findSubnet(portIpWithSubnet.getSubnetId(), neutron.getSubnets());
+ if (!potentialRouterPortSubnet.isPresent()) {
+ LOG.warn("Illegal state - router interface port is in subnet which does not exist. {}",
+ port);
+ return;
+ }
+ Subnet routerPortSubnet = potentialRouterPortSubnet.get();
+ ContextId l2BdId = new ContextId(routerPortSubnet.getNetworkId().getValue());
+ ForwardingContext l2Bd = new ForwardingContextBuilder().setContextId(l2BdId)
+ .setContextType(MappingUtils.L2_BRDIGE_DOMAIN)
+ .setParent(MappingUtils.createParent(routerL3Context, MappingUtils.L3_CONTEXT))
+ .build();
+ rwTx.merge(LogicalDatastoreType.CONFIGURATION, L2L3IidFactory.l2BridgeDomainIid(tenantId, l2BdId), l2Bd, true);
+ // set virtual router IP for subnet
+ NetworkDomain subnetDomain = NeutronSubnetAware.createSubnet(
+ routerPortSubnet, portIpWithSubnet.getIpAddress());
+ rwTx.merge(LogicalDatastoreType.CONFIGURATION, L2L3IidFactory.subnetIid(tenantId, subnetDomain.getNetworkDomainId()), subnetDomain);
+
+ // does the same for tenant forwarding domains
+ processTenantForwarding(routerPortSubnet, routerL3Context, portIpWithSubnet, tenantId, rwTx);
+