Fix _verify_gateway_port() in multiple subnets

The original code asserts that gw port's fixed_ips allocated from
the first subnet of external network. This will fails if external
network have multiple subnets.

Change-Id: I1a2d433b36a0cb72fc3e6dc3b377e0ca56fc6f7a
Closes-Bug: #1714007
This commit is contained in:
Dongcan Ye 2017-09-26 11:52:35 +08:00
parent 0376f8fbf2
commit 3d1b33633f
1 changed files with 4 additions and 3 deletions

View File

@ -100,9 +100,10 @@ class RoutersTest(base_routers.BaseRouterTest):
self.assertGreaterEqual(len(fixed_ips), 1)
public_net_body = self.admin_client.show_network(
CONF.network.public_network_id)
public_subnet_id = public_net_body['network']['subnets'][0]
self.assertIn(public_subnet_id,
[x['subnet_id'] for x in fixed_ips])
public_subnet_ids = public_net_body['network']['subnets']
for fixed_ip in fixed_ips:
self.assertIn(fixed_ip['subnet_id'],
public_subnet_ids)
@decorators.idempotent_id('b386c111-3b21-466d-880c-5e72b01e1a33')
@tutils.requires_ext(extension='ext-gw-mode', service='network')