Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
[Port Mgr] Fix L3 Routing Issues for Unassociated Subnets (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liguang Xie authored Oct 29, 2020
1 parent 0cb6ff0 commit e09d070
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ private void buildL2Neighbors(PortContext context, InternalPortEntity internalPo
List<NeighborInfo> l2Neighbors = new ArrayList<>();
NeighborInfo localNeighborInfo = null;
for (NeighborInfo neighborInfo : neighborInfos) {
if (neighborInfo.getPortId().equals(fixedIp.getIpAddress())) {
if (neighborInfo.getPortIp().equals(fixedIp.getIpAddress())) {
localNeighborInfo = neighborInfo;
} else if (neighborInfo.getSubnetId().equals(fixedIp.getSubnetId())) {
l2Neighbors.add(neighborInfo);
Expand All @@ -146,16 +146,17 @@ private void setNeighborInfos(PortContext context, InternalPortEntity internalPo
}

for (PortEntity.FixedIp fixedIp : internalPortEntity.getFixedIps()) {

List<SubnetEntity> routerSubnetEntities = context.getRouterSubnetEntities(internalPortEntity.getVpcId());
if (routerSubnetEntities != null) {
if (routerSubnetEntities != null && routerSubnetEntities.size() > 0) {
List<String> routerSubnetIds = new ArrayList<>();
for (SubnetEntity entity : routerSubnetEntities) routerSubnetIds.add(entity.getId());
if (routerSubnetIds.contains(fixedIp.getSubnetId())) {
buildL3Neighbors(context, internalPortEntity, fixedIp, routerSubnetIds);
}

buildL2Neighbors(context, internalPortEntity, fixedIp);
}

buildL2Neighbors(context, internalPortEntity, fixedIp);
}
}

Expand All @@ -181,14 +182,16 @@ private void setTheMissingFields(PortContext context, List<PortEntity> portEntit

List<VpcEntity> vpcEntities = context.getNetworkConfig().getVpcEntities();
for (VpcEntity vpcEntity : vpcEntities) {
InternalRouterInfo router = context.getRouterByVpcOrSubnetId(vpcEntity.getId());
if (router == null || router.getRouterConfiguration() == null) continue;

// Set router information
// NOTE: This implementation support Neutron scenario only
InternalRouterInfo router = context.getRouterByVpcOrSubnetId(vpcEntity.getId());
context.getNetworkConfig().addRouterEntry(router);

// Add associated subnet entities
List<SubnetEntity> associatedSubnetEntities = context.getRouterSubnetEntities(vpcEntity.getId());
for(SubnetEntity entity: associatedSubnetEntities){
for (SubnetEntity entity : associatedSubnetEntities) {
InternalSubnetEntity internalEntity = new InternalSubnetEntity(entity, Long.MAX_VALUE);
context.getNetworkConfig().addSubnetEntity(internalEntity);
}
Expand Down

0 comments on commit e09d070

Please sign in to comment.