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

[Subnet] add try catch in delete subnet for subnet routing rule deletion if routing table is not exist #660

Merged
merged 3 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ free of charge, to any person obtaining a copy of this software and associated d
import static com.futurewei.alcor.common.constants.CommonConstants.QUERY_ATTR_HEADER;
import static org.springframework.web.bind.annotation.RequestMethod.*;

import org.springframework.web.client.HttpClientErrorException;

@RestController
@ComponentScan(value = "com.futurewei.alcor.common.stats")
public class SubnetController {
Expand Down Expand Up @@ -537,7 +539,11 @@ public ResponseId deleteSubnetState(@PathVariable String projectId, @PathVariabl
}

// delete subnet routing rule in route manager
this.subnetService.deleteSubnetRoutingRuleInRM(projectId, subnetId);
try {
this.subnetService.deleteSubnetRoutingTable(projectId, subnetId);
} catch (HttpClientErrorException.NotFound e) {
logger.warn(e.getMessage());
}

// TODO: delete gateway port in port manager. Temporary solution, need PM fix issue
GatewayPortDetail gatewayPortDetail = subnetEntity.getGatewayPortDetail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void fallbackOperation (AtomicReference<RouteWebJson> routeResponseAtomic
public void updateSubnetHostRoutes (String subnetId, NewHostRoutes resource) throws ResourceNotFoundException, ResourcePersistenceException, DatabasePersistenceException, SubnetEntityNotFound, DestinationOrOperationTypeIsNull;

// delete subnet routing rule in route manager
public void deleteSubnetRoutingRuleInRM (String projectId, String subnetId) throws SubnetIdIsNull;
public void deleteSubnetRoutingTable (String projectId, String subnetId) throws SubnetIdIsNull;

// update subnet routing rule in route manager
public void updateSubnetRoutingRuleInRM (String projectId, String subnetId, SubnetEntity subnetEntity) throws SubnetIdIsNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ public void updateSubnetHostRoutes(String subnetId, NewHostRoutes resource) thro


@Override
public void deleteSubnetRoutingRuleInRM(String projectId, String subnetId) throws SubnetIdIsNull {
public void deleteSubnetRoutingTable(String projectId, String subnetId) throws SubnetIdIsNull {

if (subnetId == null) {
throw new SubnetIdIsNull();
Expand Down