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

Conversation

@kevin-zhonghao
Copy link
Contributor

@kevin-zhonghao kevin-zhonghao commented Nov 10, 2020

The implementation of Sub-level programming mainly includes the following features:

  1. Update of route rule, including VPC route rule and this Subnet route rule;
  2. Integration of route manager and PM
  3. Integration of route manager and DPM
  4. Fixed issues related to gateway IP update (tracked by Issue [Microservice] Port Mgr Support L3 Routing with Routing Rules #446)

Test scenarios:

  1. Create a VPC (success)
  2. Create a Subnet. Subnet get gateway port from PM (comment the step of sending info to DPM) (success)
  3. Create a Port (success)
  4. SM Path: Create/Update/Delete subnet routing rule -> Create/Update/Delete subnet routetable in RM. (success)
  5. RM Path - For Neutron Router,Add/Remove extra routes -> Update/Delete HostRoute in SubnetEntity in SM (success)
  6. RM Path - For VPC router, Create/Update/Delete subnet routetable -> Create/Update/Delete HostRoute in SubnetEntity in SM (pending)

Comment on lines +520 to +532
public void deleteSubnetRoutingRuleInRM(String projectId, String subnetId) throws SubnetIdIsNull {

if (subnetId == null) {
throw new SubnetIdIsNull();
}

String routeManagerServiceUrl = routeUrl + "project/" + projectId + "/subnets/" + subnetId + "/routetable";
restTemplate.delete(routeManagerServiceUrl, ResponseId.class);

}

@Override
public void updateSubnetRoutingRuleInRM(String projectId, String subnetId, SubnetEntity subnetEntity) throws SubnetIdIsNull {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deleteSubnetRoutingRuleInRM, updateSubnetRoutingRuleInRM, and createSubnetRoutingRuleInRM three functions are doing pretty similar task, should we consider to consolidate them into one function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually they should call different rest API and the same thing is to construct RouteTable in updateSubnetRoutingRuleInRM, createSubnetRoutingRuleInRM. We could put this process in one method, but I think sperate these three method is okay. What do you think?


for (int i = 0 ; i < hostRoutes.size(); i ++) {
HostRoute hostRoute = hostRoutes.get(i);
String subnetDestination = hostRoute.getDestination();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it costs too much to iterate all routes for each UPDATE route?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HostRoute dont have its own repo, so I think we could do in this way, I think subnet dont have many hostRoutes, right?

Comment on lines 496 to 502
Iterator<HostRoute> iterator = hostRoutes.iterator();
while (iterator.hasNext()) {
HostRoute hostRoute = iterator.next();
String subnetDestination = hostRoute.getDestination();
if (subnetDestination == null) {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment above, can we lookup hostRoute by destination?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the response above

# Conflicts:
#	services/data_plane_manager/src/main/java/com/futurewei/alcor/dataplane/service/ovs/DataPlaneServiceImplNew.java
@codecov-io
Copy link

codecov-io commented Nov 19, 2020

Codecov Report

Merging #468 (c61733f) into master (ff19c6b) will decrease coverage by 0.89%.
The diff coverage is 23.04%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #468      +/-   ##
============================================
- Coverage     36.59%   35.69%   -0.90%     
- Complexity     1162     1166       +4     
============================================
  Files           453      467      +14     
  Lines         10869    11311     +442     
  Branches       1393     1456      +63     
============================================
+ Hits           3977     4037      +60     
- Misses         6350     6721     +371     
- Partials        542      553      +11     
Impacted Files Coverage Δ Complexity Δ
...r/route/exception/CanNotFindRouteTableByOwner.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../alcor/route/exception/DPMFailedHandleRequest.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ewei/alcor/route/exception/DestinationInvalid.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...lcor/route/exception/HostRoutesToSubnetIsNull.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...te/exception/OwnerInNeutronRouteTableNotFound.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ption/PortWebBulkJsonOrPortEntitiesListIsNull.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...route/exception/PortWebJsonOrPortEntityIsNull.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...wei/alcor/route/exception/RouteTableNotUnique.java 0.00% <0.00%> (ø) 0.00 <0.00> (?)
...ute/service/Impl/VpcRouterToSubnetServiceImpl.java 14.28% <0.00%> (-5.72%) 1.00 <0.00> (ø)
.../futurewei/alcor/route/utils/RouteManagerUtil.java 50.72% <0.00%> (-4.84%) 9.00 <0.00> (ø)
... and 37 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff19c6b...c61733f. Read the comment docs.

@xieus xieus added enhancement New feature or request feature feature development labels Nov 21, 2020
@xieus xieus added this to the Version 1.0.2020.11.30 milestone Nov 21, 2020
routingRuleExtraInfo.setDestinationType(VpcRouteTarget.LOCAL);

if (route == null) {
internalRoutingRule.setId(route.getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that possible for route == null, that's mean existing route doesn't exist?
If it's null, how can you getId() from a null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, route == null is possible I think. And the two lines of code here are indeed in reverse order

Comment on lines +638 to +641
if (newRouteRequest != null) {
internalRoutingRule.setDestination(newRouteRequest.getDestination());
} else {
internalRoutingRule.setDestination(route.getDestination());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just set these properties based on the operation type?
if (operationType == CREATE), the routing rule's properties use new route's properties.
if (operationType == UPDATE), only nexthop use new route's property, others use existing route's properties.
if (operationType == DELETE), use existing route's properties.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it is same as the logic here, since we have to set RouteEntry route and NewRoutesRequest newRouteRequest in params

Comment on lines 44 to 46
for (String gatewayPortId : gatewayPorts) {
String portManagerServiceUrl = portUrl + "/project/" + projectid + "/ports/" + gatewayPortId;
PortWebJson portResponse = restTemplate.getForObject(portManagerServiceUrl, PortWebJson.class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does PM has bulk create/query by a list of IP addresses?
If there is, we can just make an API call and do a batch process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, PM has bulk create/query API. But here we query PortEntity by port id, right?

Copy link
Contributor

@xieus xieus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +300 to +302
if (portEntity.isGatewayPort()) {
continue;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments.

}

getSubnetAndRoute(context, new ArrayList<>(subnetIds));
//getSubnetAndRoute(context, new ArrayList<>(subnetIds));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chenpiaoping Could you pls review this change? I raised a question on Slack channel regarding why we need to reevaluate subnet and route after allocating IP address.

Copy link
Contributor

@xieus xieus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR includes quite a few fundamental changes in Route Manager, Subnet Manager and Web Entities. The new features added by this PR get in an important piece of puzzle for Alcor and enable more comprehensive routing support. 👍

Thank you @kevin-zhonghao and @cj-chung

Comment on lines +224 to +236
// CompletableFuture<MacStateJson> macFuture = CompletableFuture.supplyAsync(() -> {
// try {
// return this.subnetService.allocateMacAddressForGatewayPort(projectId, vpcId, portId);
// } catch (Exception e) {
// throw new CompletionException(e);
// }
// }, ThreadPoolExecutorUtils.SELECT_POOL_EXECUTOR).handle((s, e) -> {
// macResponseAtomic.set(s);
// if (e != null) {
// throw new CompletionException(e);
// }
// return s;
// });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove and cleanup the commented codes. @kevin-zhonghao

Comment on lines +295 to +298
// MacState macState = macResponse.getMacState();
// if (macState != null) {
// inSubnetEntity.setGatewayMacAddress(macState.getMacAddress());
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

#####Microservice url configuration######
microservices.subnet.service.url=http://localhost:9002
microservices.vpc.service.url=http://localhost:9001
microservices.dpm.service.url=http://localhost:9010
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the new configurations in RM and SM, don't forget to add them in K8s yaml file :-)

@xieus xieus changed the title [Fundamental] Sub-level programming through Subnet Manager and Route Manager [Fundamental] Sub-level programming through Subnet and Route Mgr Dec 2, 2020
@xieus xieus merged commit c6011f3 into futurewei-cloud:master Dec 2, 2020
@xieus
Copy link
Contributor

xieus commented Dec 3, 2020

Item 4 resolves Issue #407.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request feature feature development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants