diff options
| author | Slawek Kaplonski <skaplons@redhat.com> | 2021-05-26 12:26:40 +0200 |
|---|---|---|
| committer | Slawek Kaplonski <skaplons@redhat.com> | 2021-05-27 10:13:56 +0000 |
| commit | a2375b878785d739b4fdc49f563c00208a6d18ae (patch) | |
| tree | 3d27132ee9efc6abdbc06ffe2d4823cf885fa45f /openstackclient/tests/functional/network | |
| parent | 84a606be675902d75a60efaf46305f670f26548f (diff) | |
| download | python-openstackclient-a2375b878785d739b4fdc49f563c00208a6d18ae.tar.gz | |
Make functional Neutron tests running fine on ML2/OVN environments
Devstack recently switched default Neutron's backend from ML2/OVS to
ML2/OVN. As OVN backend has some parity gaps and differences in some
APIs, functional tests job was failing with ML2/OVN as some tests
weren't properly skipped in case of missing some Neutron API extensions.
This patch fixes that by doing some small changes in the functional
tests:
- skip DHCP/L3 agent tests when dhcp/l3 agent scheduler extensions
aren't available,
- skip updating neutron agent as OVN agents don't allows that,
- skip service providers tests when there is no Neutron L3 agent
available,
- skip setting router as distributed as OVN backend don't supports that
router's attribute at all.
Depends-On: https://review.opendev.org/c/openstack/neutron/+/793141
Change-Id: I29a8db202086b0b49fed865409fa8ca244b98439
Diffstat (limited to 'openstackclient/tests/functional/network')
4 files changed, 45 insertions, 13 deletions
diff --git a/openstackclient/tests/functional/network/v2/test_network.py b/openstackclient/tests/functional/network/v2/test_network.py index 71b533ed..f68b3143 100644 --- a/openstackclient/tests/functional/network/v2/test_network.py +++ b/openstackclient/tests/functional/network/v2/test_network.py @@ -335,6 +335,8 @@ class NetworkTests(common.NetworkTagTests): def test_network_dhcp_agent(self): if not self.haz_network: self.skipTest("No Network service present") + if not self.is_extension_enabled("dhcp_agent_scheduler"): + self.skipTest("No dhcp_agent_scheduler extension present") name1 = uuid.uuid4().hex cmd_output1 = json.loads(self.openstack( diff --git a/openstackclient/tests/functional/network/v2/test_network_agent.py b/openstackclient/tests/functional/network/v2/test_network_agent.py index 963227de..e5580945 100644 --- a/openstackclient/tests/functional/network/v2/test_network_agent.py +++ b/openstackclient/tests/functional/network/v2/test_network_agent.py @@ -49,6 +49,11 @@ class NetworkAgentTests(common.NetworkTests): cmd_output['id'], ) + if 'ovn' in agent_list[0]['Agent Type'].lower(): + # NOTE(slaweq): OVN Neutron agents can't be updated so test can be + # finished here + return + # agent set raw_output = self.openstack( 'network agent set --disable %s' % agent_ids[0] @@ -89,6 +94,9 @@ class NetworkAgentListTests(common.NetworkTests): def test_network_dhcp_agent_list(self): """Test network agent list""" + if not self.is_extension_enabled("dhcp_agent_scheduler"): + self.skipTest("No dhcp_agent_scheduler extension present") + name1 = uuid.uuid4().hex cmd_output1 = json.loads(self.openstack( 'network create -f json --description aaaa %s' % name1 @@ -131,6 +139,10 @@ class NetworkAgentListTests(common.NetworkTests): def test_network_agent_list_routers(self): """Add agent to router, list agents on router, delete.""" + + if not self.is_extension_enabled("l3_agent_scheduler"): + self.skipTest("No l3_agent_scheduler extension present") + name = uuid.uuid4().hex cmd_output = json.loads(self.openstack( 'router create -f json %s' % name)) diff --git a/openstackclient/tests/functional/network/v2/test_network_service_provider.py b/openstackclient/tests/functional/network/v2/test_network_service_provider.py index 999b7eb7..c571a756 100644 --- a/openstackclient/tests/functional/network/v2/test_network_service_provider.py +++ b/openstackclient/tests/functional/network/v2/test_network_service_provider.py @@ -26,6 +26,14 @@ class TestNetworkServiceProvider(common.NetworkTests): # Nothing in this class works with Nova Network if not self.haz_network: self.skipTest("No Network service present") + # NOTE(slaweq): + # that tests should works only when "standard" Neutron L3 agent is + # used, as e.g. OVN L3 plugin don't supports that. + l3_agent_list = json.loads(self.openstack( + 'network agent list -f json --agent-type l3 -c ID' + )) + if not l3_agent_list: + self.skipTest("No Neutron L3 Agents present") def test_network_service_provider_list(self): cmd_output = json.loads(self.openstack( diff --git a/openstackclient/tests/functional/network/v2/test_router.py b/openstackclient/tests/functional/network/v2/test_router.py index 0769dca6..2464b681 100644 --- a/openstackclient/tests/functional/network/v2/test_router.py +++ b/openstackclient/tests/functional/network/v2/test_router.py @@ -155,6 +155,10 @@ class RouterTests(common.NetworkTagTests): def test_router_list_l3_agent(self): """Tests create router, add l3 agent, list, delete""" + + if not self.is_extension_enabled("l3_agent_scheduler"): + self.skipTest("No l3_agent_scheduler extension present") + name = uuid.uuid4().hex cmd_output = json.loads(self.openstack( 'router create -f json ' + name)) @@ -235,32 +239,38 @@ class RouterTests(common.NetworkTagTests): ) # Test set --ha --distributed + self._test_set_router_distributed(new_name) + + # Test unset cmd_output = self.openstack( - 'router set ' + - '--distributed ' + - '--external-gateway public ' + + 'router unset ' + + '--external-gateway ' + new_name ) - self.assertOutput('', cmd_output) - cmd_output = json.loads(self.openstack( 'router show -f json ' + new_name )) - self.assertTrue(cmd_output["distributed"]) - self.assertIsNotNone(cmd_output["external_gateway_info"]) + self.assertIsNone(cmd_output["external_gateway_info"]) + + def _test_set_router_distributed(self, router_name): + if not self.is_extension_enabled("dvr"): + return - # Test unset cmd_output = self.openstack( - 'router unset ' + - '--external-gateway ' + - new_name + 'router set ' + + '--distributed ' + + '--external-gateway public ' + + router_name ) + self.assertOutput('', cmd_output) + cmd_output = json.loads(self.openstack( 'router show -f json ' + - new_name + router_name )) - self.assertIsNone(cmd_output["external_gateway_info"]) + self.assertTrue(cmd_output["distributed"]) + self.assertIsNotNone(cmd_output["external_gateway_info"]) def test_router_add_remove_route(self): network_name = uuid.uuid4().hex |
