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

Conversation

@DavidLiu506
Copy link
Contributor

Router controller:

getOrCreateVPCRouter
-> rename as 'getVPCRoutercreate', and delete 'create' operation related part
-> Add a new API 'createVPCRouter'

getOrCreateSubnetRouteTable
-> rename as 'getSubnetRouteTable', and delete 'create' operation related part

createNeutronSubnetRouteTable
-> rename as 'createSubnetRouteTable'

getOrCreateVpcRouteTable
-> rename as 'getVpcRouteTable', and delete 'create' operation related part

-> Add a new API 'createVpcRouteTable'

@DavidLiu506 DavidLiu506 requested review from cj-chung and xieus June 29, 2021 19:18
@xieus xieus added the bug Something isn't working label Jun 29, 2021
@xieus xieus added this to the Version 0.17.2021.07.30 milestone Jun 29, 2021
@cj-chung cj-chung changed the title Update router manager api [RM] Separate getOrCreateVPCRouter into GET and POST two APIs Jun 29, 2021
public RouteTablesWebJson getVpcRouteTables(@PathVariable String projectid, @PathVariable String vpcid) throws Exception {

List<RouteTable> routetables = new ArrayList<>();
List<RouteTable> routetables = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

@DavidLiu506 If you set this as null and this function cannot find vpcroutetables, line 299 in this code will get NPE (null point exception).

Also, please uncomment line 309 in this file. We need to send internalRouterInfo to DPM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

line send internalRouterInfo to DPM uncomment.

updateVpcRouteTable in RouterController will not get NPE because updateVpcRouteTable in RouterServiceImpl already handle it.

Copy link
Contributor

Choose a reason for hiding this comment

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

@DavidLiu506 I didn't see you have handled if this function return null in updateVpcRouteTable:

        List<RouteTable> vpcRouteTables = router.getVpcRouteTables();
        for (RouteTable vpcRouteTable : vpcRouteTables) {
            String routeTableType = vpcRouteTable.getRouteTableType();
            if (RouteTableType.VPC.getRouteTableType().equals(routeTableType)) {
                return vpcRouteTable;
            }
        }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, you are right. Fixed.

value = {"/project/{projectid}/subnets/{subnetid}/routetable"})
@DurationStatistics
public RouteTableWebJson createNeutronSubnetRouteTable(@PathVariable String projectid, @PathVariable String subnetid, @RequestBody RouteTableWebJson resource) throws Exception {
public RouteTableWebJson createSubnetRouteTable(@PathVariable String projectid, @PathVariable String subnetid, @RequestBody RouteTableWebJson resource) throws Exception {
Copy link
Contributor

@cj-chung cj-chung Jun 30, 2021

Choose a reason for hiding this comment

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

@kevin-zhonghao Did you also modify this function? Is that ok to rename this function?
@DavidLiu506 Please check PR#657

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Merged


@Override
public RouteTable getSubnetRouteTable(String projectId, String subnetId) throws CacheException, OwnMultipleSubnetRouteTablesException, DatabasePersistenceException, ResourceNotFoundException, ResourcePersistenceException, CanNotFindSubnet, OwnMultipleVpcRouterException, CanNotFindVpc {
public RouteTable getSubnetRouteTable(String projectId, String subnetId) throws CacheException, CanNotFindRouteTableByOwner, OwnMultipleSubnetRouteTablesException {
Copy link
Contributor

Choose a reason for hiding this comment

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

@kevin-zhonghao Did you also update this function? Please confirm!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Merged

value = {"/project/{projectid}/subnets/{subnetid}/routetable"})
@DurationStatistics
public RouteTableWebJson getOrCreateSubnetRouteTable(@PathVariable String projectid, @PathVariable String subnetid) throws Exception {
public RouteTableWebJson getSubnetRouteTable(@PathVariable String projectid, @PathVariable String subnetid) throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

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

@kevin-zhonghao Please check if you also modify this function in your PR.
@DavidLiu506 Please check PR#657

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Merged

Comment on lines 345 to 349
if (routetables == null)
{
throw new RouterUnavailable();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

@DavidLiu506 Is this a RouterUnavailable or RouteTableUnavailable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

routes.add(defaultRoute);

routeTable = this.routerService.createNeutronSubnetRouteTable(projectid, subnetid, resource, routes);
routeTable = this.routerService.createSubnetRouteTable(projectid, subnetid, resource, routes);
Copy link
Contributor

Choose a reason for hiding this comment

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

@DavidLiu506 We need to remove line#454~#456 defaultRoute setting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Contributor

@cj-chung cj-chung left a comment

Choose a reason for hiding this comment

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

LGTM

@kevin-zhonghao
Copy link
Contributor

LGTM.

PS: Have reviewed PR #655 and #655 has already covered all change in PR #657.
So close the PR #657.

@xieus xieus merged commit 799ee03 into futurewei-cloud:master Jul 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

4 participants