From eacd16a8477a3ec89cf979009c40cfd4bceafe06 Mon Sep 17 00:00:00 2001 From: Roman Safronov Date: Mon, 17 Jun 2024 15:22:35 +0300 Subject: [PATCH] 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 --- whitebox_neutron_tempest_plugin/tests/scenario/base.py | 6 ++++-- .../tests/scenario/test_multicast.py | 6 ++++-- whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py | 5 +++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/base.py b/whitebox_neutron_tempest_plugin/tests/scenario/base.py index bef3320..72ff8ad 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/base.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/base.py @@ -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() diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/test_multicast.py b/whitebox_neutron_tempest_plugin/tests/scenario/test_multicast.py index 6cd2c0e..ab5a738 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/test_multicast.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/test_multicast.py @@ -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) diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py b/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py index f83c937..7472286 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/test_qos.py @@ -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)