Make external network shared when needed

For podified environments some tests will temporary enable 'shared'
parameter for external network. This is because it was decided that
on podified environments external network should not be shared
by default for some tempest api tests to work properly, see [1].
Podified environment should run all the tests that modify external
network one by one, in a single tempest thread.

[1] https://github.com/openstack-k8s-operators/ci-framework/pull/1862

Change-Id: Icea7d64b1d24593135938a4f7dc242ea9a2820ff
This commit is contained in:
Roman Safronov 2024-06-17 15:22:35 +03:00
parent b1d9d275af
commit eacd16a847
3 changed files with 13 additions and 4 deletions

View File

@ -642,8 +642,10 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
external_network = self.client.show_network(
CONF.network.public_network_id)['network']
if not external_network['shared']:
skip_reason = "External network is not shared"
self.skipTest(skip_reason)
self.addCleanup(self.os_admin.network_client.update_network,
external_network['id'], shared=False)
self.os_admin.network_client.update_network(
external_network['id'], shared=True)
src_network = external_network
else:
src_network = _create_local_network()

View File

@ -313,8 +313,10 @@ class BaseMulticastTest(object):
# when using SR-IOV environement and therefore only external network
if topology == 'external' or topology == 'north-south':
if not self.external_network['shared']:
skip_reason = "External network is not shared"
self.skipTest(skip_reason)
self.addCleanup(self.os_admin.network_client.update_network,
self.external_network['id'], shared=False)
self.os_admin.network_client.update_network(
self.external_network['id'], shared=True)
sender = self._create_server_for_topology(
network_id=self.external_network['id'],
port_type=port_type)

View File

@ -988,6 +988,11 @@ class QosTestExternalNetwork(QosBaseTest):
super(QosTestExternalNetwork, self).setUp()
self.external_network = self.client.show_network(
CONF.network.public_network_id)['network']
if not self.external_network['shared']:
self.addCleanup(self.os_admin.network_client.update_network,
self.external_network['id'], shared=False)
self.os_admin.network_client.update_network(
self.external_network['id'], shared=True)
ext_vm = self._create_server(
network=self.external_network,
create_floating_ip=False)