Allow visibility of external subnet as shared ones
The Neutron network can have the attribute "external". If a
network is external, can be seen by other projects, same as
when it is shared. However the subnets cannot be seen now.
This issue is being solved in LP#2051831, in [1].
This patch changes the logic implemented in [2], where the
subnets belonging to an external network where hidden to
a non-admin user of other project.
[1]https://review.opendev.org/c/openstack/neutron/+/907313
[2]https://review.opendev.org/c/openstack/tempest/+/484960
Related-Bug: #2051831
Change-Id: I58b2a1ddf9b0fe85d96617863d121aebb7d81e58
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index fd93779..b1fba2d 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -389,17 +389,20 @@
# belong to other tests and their state may have changed during this
# test
body = self.subnets_client.list_subnets(network_id=public_network_id)
+ extensions = [
+ ext['alias'] for ext in
+ self.network_extensions_client.list_extensions()['extensions']]
+ is_sen_ext = 'subnet-external-network' in extensions
# check subnet visibility of external_network
- if external_network['shared']:
- self.assertNotEmpty(body['subnets'], "Subnets should be visible "
- "for shared public network %s"
- % public_network_id)
+ if external_network['shared'] or is_sen_ext:
+ self.assertNotEmpty(body['subnets'],
+ 'Subnets should be visible for shared or '
+ 'external networks %s' % public_network_id)
else:
- self.assertEmpty(body['subnets'], "Subnets should not be visible "
- "for non-shared public "
- "network %s"
- % public_network_id)
+ self.assertEmpty(body['subnets'],
+ 'Subnets should not be visible for non-shared or'
+ 'non-external networks %s' % public_network_id)
@decorators.idempotent_id('c72c1c0c-2193-4aca-ccc4-b1442640bbbb')
@utils.requires_ext(extension="standard-attr-description",