Enhancement: EC2 added create route with networkInterfaceId (#3063)
* Enhancement:EC2- create route with network interfcaeID * modifying existing test case * Linting Co-authored-by: usmankb <usman@krazybee.com> Co-authored-by: Bert Blommers <info@bertblommers.nl>
This commit is contained in:
parent
80a3571ff4
commit
475f022b78
2 changed files with 47 additions and 16 deletions
|
|
@ -3639,26 +3639,31 @@ class RouteBackend(object):
|
|||
interface_id=None,
|
||||
vpc_peering_connection_id=None,
|
||||
):
|
||||
gateway = None
|
||||
nat_gateway = None
|
||||
|
||||
route_table = self.get_route_table(route_table_id)
|
||||
|
||||
if interface_id:
|
||||
self.raise_not_implemented_error("CreateRoute to NetworkInterfaceId")
|
||||
# for validating interface Id whether it is valid or not.
|
||||
self.get_network_interface(interface_id)
|
||||
|
||||
gateway = None
|
||||
if gateway_id:
|
||||
if EC2_RESOURCE_TO_PREFIX["vpn-gateway"] in gateway_id:
|
||||
gateway = self.get_vpn_gateway(gateway_id)
|
||||
elif EC2_RESOURCE_TO_PREFIX["internet-gateway"] in gateway_id:
|
||||
gateway = self.get_internet_gateway(gateway_id)
|
||||
else:
|
||||
if gateway_id:
|
||||
if EC2_RESOURCE_TO_PREFIX["vpn-gateway"] in gateway_id:
|
||||
gateway = self.get_vpn_gateway(gateway_id)
|
||||
elif EC2_RESOURCE_TO_PREFIX["internet-gateway"] in gateway_id:
|
||||
gateway = self.get_internet_gateway(gateway_id)
|
||||
|
||||
try:
|
||||
ipaddress.IPv4Network(six.text_type(destination_cidr_block), strict=False)
|
||||
except ValueError:
|
||||
raise InvalidDestinationCIDRBlockParameterError(destination_cidr_block)
|
||||
try:
|
||||
ipaddress.IPv4Network(
|
||||
six.text_type(destination_cidr_block), strict=False
|
||||
)
|
||||
except ValueError:
|
||||
raise InvalidDestinationCIDRBlockParameterError(destination_cidr_block)
|
||||
|
||||
nat_gateway = None
|
||||
if nat_gateway_id is not None:
|
||||
nat_gateway = self.nat_gateways.get(nat_gateway_id)
|
||||
if nat_gateway_id is not None:
|
||||
nat_gateway = self.nat_gateways.get(nat_gateway_id)
|
||||
|
||||
route = Route(
|
||||
route_table,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue