VPC IPv4 validation (#2026)

* Implemented throwing invalid subnet range error and fixed breaking tests.

* Implemented throwing invalid CIDR block parameter error for vpcs and subnets.

* Implemented throwing invalid destination CIDR block error.

* IPv6 addresses not accepted, strict checking disabled.

* Implemented throwing invalid subnet conflict error and fixed breaking tests.

* Implemented throwing invalid VPC range error and fixed breaking tests.

* Fixed accidentally removed ).

* Fixed test case trying to create two subnets with the same CIDR range.
This commit is contained in:
Bendegúz Ács 2019-05-25 19:35:07 +02:00 committed by Terry Cain
commit f408709ef9
14 changed files with 215 additions and 45 deletions

View file

@ -1045,9 +1045,9 @@ def test_create_database_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet1 = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
subnet2 = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/26')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.2.0/24')['Subnet']
subnet_ids = [subnet1['SubnetId'], subnet2['SubnetId']]
conn = boto3.client('rds', region_name='us-west-2')
@ -1069,7 +1069,7 @@ def test_create_database_in_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
conn = boto3.client('rds', region_name='us-west-2')
conn.create_db_subnet_group(DBSubnetGroupName='db_subnet1',
@ -1094,7 +1094,7 @@ def test_describe_database_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
conn = boto3.client('rds', region_name='us-west-2')
conn.create_db_subnet_group(DBSubnetGroupName="db_subnet1",
@ -1123,7 +1123,7 @@ def test_delete_database_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
conn = boto3.client('rds', region_name='us-west-2')
result = conn.describe_db_subnet_groups()
@ -1149,7 +1149,7 @@ def test_list_tags_database_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
conn = boto3.client('rds', region_name='us-west-2')
result = conn.describe_db_subnet_groups()
@ -1176,7 +1176,7 @@ def test_add_tags_database_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
conn = boto3.client('rds', region_name='us-west-2')
result = conn.describe_db_subnet_groups()
@ -1207,7 +1207,7 @@ def test_remove_tags_database_subnet_group():
vpc_conn = boto3.client('ec2', 'us-west-2')
vpc = vpc_conn.create_vpc(CidrBlock='10.0.0.0/16')['Vpc']
subnet = vpc_conn.create_subnet(
VpcId=vpc['VpcId'], CidrBlock='10.1.0.0/24')['Subnet']
VpcId=vpc['VpcId'], CidrBlock='10.0.1.0/24')['Subnet']
conn = boto3.client('rds', region_name='us-west-2')
result = conn.describe_db_subnet_groups()