Also calculate external subnets when check cidr whether in use
The external network be shared by all tenant. When it associated to a tenant router the cidr of it's subnets cannot overlap with tenant subnets', otherwise it will lead to bug #1903433. The related fix patch: https://review.opendev.org/761829 So, in tempest, the external subnets need was considered when check cidr whether in use. Related-Bug: #1903433 Change-Id: Ief84251adb0368533570d9e9f6630de92e27c5c3
This commit is contained in:
parent
5364a9a789
commit
4ad346e649
|
@ -1067,12 +1067,19 @@ class NetworkScenarioTest(ScenarioTest):
|
|||
def cidr_in_use(cidr, project_id):
|
||||
"""Check cidr existence
|
||||
|
||||
:returns: True if subnet with cidr already exist in tenant
|
||||
False else
|
||||
:returns: True if subnet with cidr already exist in tenant or
|
||||
external False else
|
||||
"""
|
||||
cidr_in_use = self.os_admin.subnets_client.list_subnets(
|
||||
tenant_subnets = self.os_admin.subnets_client.list_subnets(
|
||||
project_id=project_id, cidr=cidr)['subnets']
|
||||
return len(cidr_in_use) != 0
|
||||
external_nets = self.os_admin.networks_client.list_networks(
|
||||
**{"router:external": True})['networks']
|
||||
external_subnets = []
|
||||
for ext_net in external_nets:
|
||||
external_subnets.extend(
|
||||
self.os_admin.subnets_client.list_subnets(
|
||||
network_id=ext_net['id'], cidr=cidr)['subnets'])
|
||||
return len(tenant_subnets + external_subnets) != 0
|
||||
|
||||
ip_version = kwargs.pop('ip_version', 4)
|
||||
|
||||
|
|
Loading…
Reference in New Issue