}
FixedIps portIpWithSubnet = potentialPortIpWithSubnet.get();
ContextId routerL3Context = new ContextId(port.getDeviceId());
- // 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();
ReadWriteTransaction rwTx = dataProvider.newReadWriteTransaction();
- 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);
AddressEndpointKey addrEpKey = new AddressEndpointKey(port.getMacAddress().getValue(),
- MacAddressType.class, new ContextId(port.getNetworkId().getValue()), MappingUtils.L2_BRDIGE_DOMAIN);
+ MacAddressType.class, new ContextId(port.getNetworkId().getValue()), MappingUtils.L2_BRDIGE_DOMAIN);
UniqueId portId = new UniqueId(port.getUuid().getValue());
addBaseEndpointMappings(addrEpKey, portId, rwTx);
- // does the same for tenant forwarding domains
- processTenantForwarding(routerPortSubnet, routerL3Context, portIpWithSubnet, tenantId, rwTx);
-
- // Add Qrouter port as Endpoint
+ // Add Qrouter and VPProuter port as Endpoint
if (port.getAugmentation(PortBindingExtension.class) != null &&
PortUtils.DEVICE_VIF_TYPE.equals(port.getAugmentation(PortBindingExtension.class).getVifType())) {
LOG.trace("Port is QRouter port: {}", port.getUuid().getValue());
epInBuilder =
createEndpointRegFromPort(
port, ipWithSubnet, networkContainment, epgsFromSecGroups, neutron);
-
registerBaseEndpointAndStoreMapping(
ImmutableList.of(l2BaseEp.build(), l3BaseEp.build()), port, rwTx);
registerEndpointAndStoreMapping(epInBuilder.build(), port, rwTx);
}
+ // 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);
+
DataStoreHelper.submitToDs(rwTx);
} else if (PortUtils.isDhcpPort(port)) {
// process as normal port but put it to DHCP group
Set<Port> portsInSameSubnet = PortUtils.findPortsBySubnet(subnetUuid, neutron.getPorts());
for (Port portInSameSubnet : portsInSameSubnet) {
if (PortUtils.isNormalPort(portInSameSubnet) || PortUtils.isDhcpPort(portInSameSubnet)
- || PortUtils.isQrouterPort(portInSameSubnet)) {
+ || PortUtils.isQrouterOrVppRouterPort(portInSameSubnet)) {
// endpoints are created only from neutron normal port or DHCP port
Optional<FixedIps> firstFixedIps = PortUtils.resolveFirstFixedIps(portInSameSubnet);
if (firstFixedIps.isPresent()) {
// endpoint has only one network containment therefore only first IP is used
FixedIps ipWithSubnet = firstFixedIps.get();
List<EndpointGroupId> endpointGroupIds = new ArrayList<>();
- if (PortUtils.isDhcpPort(portInSameSubnet)) {
+ if (PortUtils.isDhcpPort(portInSameSubnet) || PortUtils.isQrouterOrVppRouterPort(portInSameSubnet)) {
endpointGroupIds.add(NetworkService.EPG_ID);
} else if (PortUtils.isNormalPort(portInSameSubnet)) {
endpointGroupIds.add(NetworkClient.EPG_ID);
.setContextType(l3BaseEp.getContextType())
.build();
epRegistrator.unregisterEndpoint(addrEpUnreg);
- epRegistrator.registerEndpoint(l3BaseEp.build());
+ RegisterEndpointInput regBaseEpInput = new RegisterEndpointInputBuilder()
+ .setAddressEndpointReg(ImmutableList.of(l2BaseEp.build(), l3BaseEp.build())).build();
+ epRegistrator.registerEndpoint(regBaseEpInput);
modifyL3ContextForEndpoints(portInSameSubnet, ipWithSubnet, l3BaseEp.getContextId());
}