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
|
|
@ -462,7 +462,7 @@ def test_routes_not_supported():
|
|||
# Create
|
||||
conn.create_route.when.called_with(
|
||||
main_route_table.id, ROUTE_CIDR, interface_id="eni-1234abcd"
|
||||
).should.throw(NotImplementedError)
|
||||
).should.throw("InvalidNetworkInterfaceID.NotFound")
|
||||
|
||||
# Replace
|
||||
igw = conn.create_internet_gateway()
|
||||
|
|
@ -583,6 +583,32 @@ def test_create_route_with_invalid_destination_cidr_block_parameter():
|
|||
)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_create_route_with_network_interface_id():
|
||||
ec2 = boto3.resource("ec2", region_name="us-west-2")
|
||||
ec2_client = boto3.client("ec2", region_name="us-west-2")
|
||||
|
||||
vpc = ec2.create_vpc(CidrBlock="10.0.0.0/16")
|
||||
subnet = ec2.create_subnet(
|
||||
VpcId=vpc.id, CidrBlock="10.0.0.0/24", AvailabilityZone="us-west-2a"
|
||||
)
|
||||
|
||||
route_table = ec2_client.create_route_table(VpcId=vpc.id)
|
||||
|
||||
route_table_id = route_table["RouteTable"]["RouteTableId"]
|
||||
|
||||
eni1 = ec2_client.create_network_interface(
|
||||
SubnetId=subnet.id, PrivateIpAddress="10.0.10.5"
|
||||
)
|
||||
|
||||
route = ec2_client.create_route(
|
||||
NetworkInterfaceId=eni1["NetworkInterface"]["NetworkInterfaceId"],
|
||||
RouteTableId=route_table_id,
|
||||
)
|
||||
|
||||
route["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_describe_route_tables_with_nat_gateway():
|
||||
ec2 = boto3.client("ec2", region_name="us-west-1")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue