Use correct netmask for router interfaces in ASR1k

Change-Id: Ic843d34f0f5825a708177f15ef930cb2724662dd
Closes-bug: #1674331
This commit is contained in:
Bob Melander 2017-03-20 14:31:57 +01:00
parent 5d93dafd7c
commit 9d13d885de
11 changed files with 57 additions and 54 deletions

View File

@ -913,7 +913,10 @@ class ConfigSyncer(object):
if found is False:
LOG.info(_LI("Subintf real IP is incorrect, deleting"))
return False
target_net = netaddr.IPNetwork(gw_port['subnets'][i]['cidr'])
subnet_id = gw_port['fixed_ips'][i]['subnet_id']
subnet = next(
sn for sn in gw_port['subnets'] if sn['id'] == subnet_id)
target_net = netaddr.IPNetwork(subnet['cidr'])
if netmask != str(target_net.netmask):
LOG.info(_LI("Subintf has incorrect netmask, deleting"))
return False

View File

@ -1144,13 +1144,12 @@ class RoutingServiceHelper(object):
@staticmethod
def _set_subnet_info(port, subnet_id, is_primary=True):
ips = [i['ip_address'] for i in port['fixed_ips']
if i['subnet_id'] == subnet_id]
if not ips:
ip = next((i['ip_address'] for i in port['fixed_ips']
if i['subnet_id'] == subnet_id), None)
if ip is None:
raise IPAddressMissingException(port_id=port['id'],
subnet_id=subnet_id)
subnet = port['subnets'][0]
subnet = next(sn for sn in port['subnets'] if sn['id'] == subnet_id)
prefixlen = netaddr.IPNetwork(subnet['cidr']).prefixlen
port['ip_info'] = {'subnet_id': subnet_id, 'is_primary': is_primary,
'ip_cidr': "%s/%s" % (ips[0], prefixlen)}
'ip_cidr': "%s/%s" % (ip, prefixlen)}

View File

@ -3,7 +3,7 @@
| id | name | subnets |
+--------------------------------------+---------+-----------------------------------------------------+
| 9d81f2da-eb8b-4c61-b247-ca3fe85a7838 | public | 7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41 172.16.6.32/27 |
| | | 05509041-00e0-45c3-bf38-c603911c1ea4 172.17.7.32/27 |
| | | 05509041-00e0-45c3-bf38-c603911c1ea4 172.17.7.32/28 |
| 02232008-c78c-46b2-b712-678d85def46a | private | 54074049-aaf1-44d2-9843-99cdb10e3212 10.0.3.0/24 |
+--------------------------------------+---------+-----------------------------------------------------+
(neutron) subnet-list
@ -12,7 +12,7 @@
+--------------------------------------+-----------------+----------------+------------------------------------------------+
| 7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41 | public-subnet | 172.16.6.32/27 | {"start": "172.16.6.34", "end": "172.16.6.62"} |
| 54074049-aaf1-44d2-9843-99cdb10e3212 | private-subnet | 10.0.3.0/24 | {"start": "10.0.3.2", "end": "10.0.3.254"} |
| 05509041-00e0-45c3-bf38-c603911c1ea4 | public-subnet-2 | 172.17.7.32/27 | {"start": "172.17.7.34", "end": "172.17.7.62"} |
| 05509041-00e0-45c3-bf38-c603911c1ea4 | public-subnet-2 | 172.17.7.32/28 | {"start": "172.17.7.34", "end": "172.17.7.46"} |
+--------------------------------------+-----------------+----------------+------------------------------------------------+
(neutron) router-list
+--------------------------------------+---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+

View File

@ -112,7 +112,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.34",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -135,7 +135,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.34",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "780a2d1a-6cae-4b2e-919e-bb5fb0ee0395",
"mac_address": "fa:16:3e:37:e3:d7",
@ -151,7 +151,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -182,7 +182,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -239,7 +239,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.37",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -262,7 +262,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.36",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "3fdf36c5-34a7-4aa3-8508-66b258377a68",
"mac_address": "fa:16:3e:00:d7:f2",
@ -272,7 +272,7 @@
"port_security_enabled": false,
"security_groups": [],
"status": "DOWN",
"subnets": [{"cidr": "172.17.7.32/27",
"subnets": [{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -309,7 +309,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -476,7 +476,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.35",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -499,7 +499,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.34",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "780a2d1a-6cae-4b2e-919e-bb5fb0ee0395",
"mac_address": "fa:16:3e:37:e3:d7",
@ -515,7 +515,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -546,7 +546,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -603,7 +603,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.38",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -626,7 +626,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.36",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "3fdf36c5-34a7-4aa3-8508-66b258377a68",
"mac_address": "fa:16:3e:00:d7:f2",
@ -642,7 +642,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -673,7 +673,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",

View File

@ -34,7 +34,7 @@ interface GigabitEthernet/2/0/3.1056
description OPENSTACK_NEUTRON_EXTERNAL_INTF
encapsulation dot1Q 1056
ip address 172.16.6.47 255.255.255.224 secondary
ip address 172.17.7.37 255.255.255.224
ip address 172.17.7.37 255.255.255.240
ip nat outside
standby 1064 ip 172.16.6.46 secondary
standby 1064 ip 172.17.7.36
@ -54,7 +54,7 @@ ip access-list standard neutron_acl_1086_121bf217
!
ip nat inside source list neutron_acl_1086_121bf217 pool nrouter-085eba_nat_pool vrf nrouter-085eba overload
ip nat pool nrouter-085eba_nat_pool 172.16.6.44 172.16.6.44 netmask 255.255.255.224
ip nat pool nrouter-085eba_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.224
ip nat pool nrouter-085eba_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.240
!
ip route vrf nrouter-085eba 0.0.0.0 0.0.0.0 GigabitEthernet/2/0/3.1056 172.16.6.33
ip route vrf nrouter-085eba 0.0.0.0 0.0.0.0 GigabitEthernet/2/0/3.1056 172.17.7.33

View File

@ -34,7 +34,7 @@ interface GigabitEthernet/1/0/5.1056
description OPENSTACK_NEUTRON_EXTERNAL_INTF
encapsulation dot1Q 1056
ip address 172.16.6.48 255.255.255.224 secondary
ip address 172.17.7.38 255.255.255.224
ip address 172.17.7.38 255.255.255.240
ip nat outside
standby 1064 ip 172.16.6.46 secondary
standby 1064 ip 172.17.7.36
@ -54,7 +54,7 @@ ip access-list standard neutron_acl_1086_0b9c4564
!
ip nat inside source list neutron_acl_1086_0b9c4564 pool nrouter-5dd41c_nat_pool vrf nrouter-5dd41c overload
ip nat pool nrouter-5dd41c_nat_pool 172.16.6.44 172.16.6.44 netmask 255.255.255.224
ip nat pool nrouter-5dd41c_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.224
ip nat pool nrouter-5dd41c_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.240
!
ip route vrf nrouter-5dd41c 0.0.0.0 0.0.0.0 GigabitEthernet/1/0/5.1056 172.16.6.33
ip route vrf nrouter-5dd41c 0.0.0.0 0.0.0.0 GigabitEthernet/1/0/5.1056 172.17.7.33

View File

@ -5,7 +5,7 @@
| 02232008-c78c-46b2-b712-678d85def46a | private | 54074049-aaf1-44d2-9843-99cdb10e3212 10.0.3.0/24 |
| 7a382985-4c58-4912-beb3-84fcf7d7af77 | public-2 | 7459de26-e9e2-491a-b174-db9f4d7313b8 172.17.8.32/27 |
| 9d81f2da-eb8b-4c61-b247-ca3fe85a7838 | public | 7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41 172.16.6.32/27 |
| | | 05509041-00e0-45c3-bf38-c603911c1ea4 172.17.7.32/27 |
| | | 05509041-00e0-45c3-bf38-c603911c1ea4 172.17.7.32/28 |
| cd04cc62-1799-4727-8f54-a2b4ec1a8bd2 | private-2 | 1af47d42-149e-423f-883f-5369ab11a9a0 10.0.4.0/24 |
+--------------------------------------+-----------+-----------------------------------------------------+
(neutron) subnet-list
@ -15,7 +15,7 @@
| 7459de26-e9e2-491a-b174-db9f4d7313b8 | public-2-subnet | 172.17.8.32/27 | {"start": "172.17.8.34", "end": "172.17.8.62"} |
| 1af47d42-149e-423f-883f-5369ab11a9a0 | private-2-subnet | 10.0.4.0/24 | {"start": "10.0.4.2", "end": "10.0.4.254"} |
| 54074049-aaf1-44d2-9843-99cdb10e3212 | private-subnet | 10.0.3.0/24 | {"start": "10.0.3.2", "end": "10.0.3.254"} |
| 05509041-00e0-45c3-bf38-c603911c1ea4 | public-subnet-2 | 172.17.7.32/27 | {"start": "172.17.7.34", "end": "172.17.7.62"} |
| 05509041-00e0-45c3-bf38-c603911c1ea4 | public-subnet-2 | 172.17.7.32/28 | {"start": "172.17.7.34", "end": "172.17.7.46"} |
| 7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41 | public-subnet | 172.16.6.32/27 | {"start": "172.16.6.34", "end": "172.16.6.62"} |
+--------------------------------------+------------------+----------------+------------------------------------------------+
(neutron) router-list

View File

@ -112,7 +112,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.34",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -135,7 +135,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.34",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "780a2d1a-6cae-4b2e-919e-bb5fb0ee0395",
"mac_address": "fa:16:3e:37:e3:d7",
@ -145,7 +145,7 @@
"port_security_enabled": false,
"security_groups": [],
"status": "ACTIVE",
"subnets": [{"cidr": "172.17.7.32/27",
"subnets": [{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -182,7 +182,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -536,7 +536,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.35",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -559,7 +559,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.34",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "780a2d1a-6cae-4b2e-919e-bb5fb0ee0395",
"mac_address": "fa:16:3e:37:e3:d7",
@ -575,7 +575,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -600,7 +600,7 @@
"port_security_enabled": false,
"security_groups": [],
"status": "ACTIVE",
"subnets": [{"cidr": "172.17.7.32/27",
"subnets": [{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -742,7 +742,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.38",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -765,7 +765,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.36",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "3fdf36c5-34a7-4aa3-8508-66b258377a68",
"mac_address": "fa:16:3e:00:d7:f2",
@ -781,7 +781,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -806,7 +806,7 @@
"port_security_enabled": false,
"security_groups": [],
"status": "ACTIVE",
"subnets": [{"cidr": "172.17.7.32/27",
"subnets": [{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -884,7 +884,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.37",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"ha_info": {"group": "1064",
"ha_port": {"address_scopes": {"4": null,
@ -907,7 +907,7 @@
"prefixlen": 27,
"subnet_id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41"},
{"ip_address": "172.17.7.36",
"prefixlen": 27,
"prefixlen": 28,
"subnet_id": "05509041-00e0-45c3-bf38-c603911c1ea4"}],
"id": "3fdf36c5-34a7-4aa3-8508-66b258377a68",
"mac_address": "fa:16:3e:00:d7:f2",
@ -923,7 +923,7 @@
"id": "7b3f7882-867e-4e6c-a9b3-a8f6ce3abd41",
"ipv6_ra_mode": null,
"subnetpool_id": null},
{"cidr": "172.17.7.32/27",
{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",
@ -948,7 +948,7 @@
"port_security_enabled": false,
"security_groups": [],
"status": "ACTIVE",
"subnets": [{"cidr": "172.17.7.32/27",
"subnets": [{"cidr": "172.17.7.32/28",
"dns_nameservers": [],
"gateway_ip": "172.17.7.33",
"id": "05509041-00e0-45c3-bf38-c603911c1ea4",

View File

@ -73,7 +73,7 @@ interface GigabitEthernet/2/0/3.1056
description OPENSTACK_NEUTRON_EXTERNAL_INTF
encapsulation dot1Q 1056
ip address 172.16.6.47 255.255.255.224 secondary
ip address 172.17.7.37 255.255.255.224
ip address 172.17.7.37 255.255.255.240
ip nat outside
standby 1064 ip 172.16.6.46 secondary
standby 1064 ip 172.17.7.36
@ -96,7 +96,7 @@ ip access-list standard neutron_acl_1086_121bf217
ip nat inside source list neutron_acl_1050_8850d162 pool nrouter-b1e18b_nat_pool vrf nrouter-b1e18b overload
ip nat inside source list neutron_acl_1086_121bf217 pool nrouter-085eba_nat_pool vrf nrouter-085eba overload
ip nat pool nrouter-085eba_nat_pool 172.16.6.44 172.16.6.44 netmask 255.255.255.224
ip nat pool nrouter-085eba_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.224
ip nat pool nrouter-085eba_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.240
ip nat pool nrouter-b1e18b_nat_pool 172.17.8.36 172.17.8.36 netmask 255.255.255.224
!
ip route vrf Mgmt - intf 0.0.0.0 0.0.0.0 10.0.100.1

View File

@ -73,7 +73,7 @@ interface GigabitEthernet/1/0/5.1056
description OPENSTACK_NEUTRON_EXTERNAL_INTF
encapsulation dot1Q 1056
ip address 172.16.6.48 255.255.255.224 secondary
ip address 172.17.7.38 255.255.255.224
ip address 172.17.7.38 255.255.255.240
ip nat outside
standby 1064 ip 172.16.6.46 secondary
standby 1064 ip 172.17.7.36
@ -96,7 +96,7 @@ ip access-list standard neutron_acl_1086_0b9c4564
ip nat inside source list neutron_acl_1050_e626fe6a pool nrouter-718107_nat_pool vrf nrouter-718107 overload
ip nat inside source list neutron_acl_1086_0b9c4564 pool nrouter-5dd41c_nat_pool vrf nrouter-5dd41c overload
ip nat pool nrouter-5dd41c_nat_pool 172.16.6.44 172.16.6.44 netmask 255.255.255.224
ip nat pool nrouter-5dd41c_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.224
ip nat pool nrouter-5dd41c_nat_pool 172.17.7.34 172.17.7.34 netmask 255.255.255.240
ip nat pool nrouter-718107_nat_pool 172.17.8.36 172.17.8.36 netmask 255.255.255.224
!
ip route vrf Mgmt - intf 0.0.0.0 0.0.0.0 10.0.100.1

View File

@ -45,9 +45,10 @@ def prepare_router_data(enable_snat=None, num_internal_ports=1,
sn_ids = sorted([_uuid() for i in range(num_subnets)])
for i in range(num_subnets):
sn_id = sn_ids[i]
prfxlen = 28 if i == 0 else 27
ext_fixed_ips.append({'ip_address': '19.4.%s.4' % i,
'subnet_id': sn_id})
ext_subnets.append({'id': sn_id, 'cidr': '19.4.%s.0/24' % i,
ext_subnets.append({'id': sn_id, 'cidr': '19.4.%s.0/%s' % (i, prfxlen),
'gateway_ip': '19.4.%s.1' % i})
ex_gw_port = {'id': _uuid(),
'network_id': _uuid(),
@ -303,10 +304,10 @@ class TestBasicRoutingOperations(base.BaseTestCase):
def _verify_ip_info(the_mock):
self.assertEqual(num_ext_subnets, len(the_mock.ip_infos))
self.assertTrue(the_mock.ip_infos[0]['is_primary'])
self.assertEqual('19.4.0.4/24', the_mock.ip_infos[0]['ip_cidr'])
self.assertEqual('19.4.0.4/28', the_mock.ip_infos[0]['ip_cidr'])
for i in range(1, num_ext_subnets):
self.assertFalse(the_mock.ip_infos[i]['is_primary'])
self.assertEqual('19.4.%s.4/24' % i,
self.assertEqual('19.4.%s.4/27' % i,
the_mock.ip_infos[i]['ip_cidr'])
# need these helpers to verify that ip_info is correct