Skip HA router tests when not meant for OVN driver
Change is needed to check "l3-ha" extension with OVN router flavors.
This change allows to check if OVN backend or not, and add test skips
accordingly.
The tests used to run only against OVS driver, a subset of them was
found useful also with OVN, for instance this bug noticed by altered
tests:
https://bugzilla.redhat.com/show_bug.cgi?id=2263225
Fixes-Bug: PRODX-42818
Change-Id: I7c2c2f23417b3b43a2788b3c4bca2f8b532b7974
diff --git a/neutron_tempest_plugin/api/admin/test_routers_ha.py b/neutron_tempest_plugin/api/admin/test_routers_ha.py
index b717a10..2b18728 100644
--- a/neutron_tempest_plugin/api/admin/test_routers_ha.py
+++ b/neutron_tempest_plugin/api/admin/test_routers_ha.py
@@ -64,6 +64,9 @@
set to False, thus making it a "Single Failure Router"
as opposed to a "High Availability Router"
"""
+ # OVN driver doesn't accept ha=False (all OVN routers support HA)
+ if self.is_driver_ovn:
+ raise self.skipException("Test not meant for OVN driver")
name = data_utils.rand_name('router')
router = self._create_admin_router(name, ha=False)
self.assertFalse(router['ha'])
@@ -81,6 +84,9 @@
set to False. Once the router is updated, the ha
attribute will be set to True
"""
+ # OVN driver doesn't accept ha=False (all OVN routers support HA)
+ if self.is_driver_ovn:
+ raise self.skipException("Test not meant for OVN driver")
name = data_utils.rand_name('router')
# router needs to be in admin state down in order to be upgraded to HA
router = self._create_admin_router(name, ha=False,
@@ -101,6 +107,10 @@
deleted, those segmentation data are kept in HA network. This tests
regression of https://bugs.launchpad.net/neutron/+bug/1732543.
"""
+ # Test not meant for OVN implementation of HA
+ if self.is_driver_ovn:
+ raise self.skipException(
+ "Test not meant for OVN implementation of HA")
for i in range(2):
router = self._create_admin_router(
data_utils.rand_name('router%d' % i),
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index 33a403f..f5bb911 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -68,6 +68,21 @@
external_network_id = CONF.network.public_network_id
+ __is_driver_ovn = None
+
+ @classmethod
+ def _is_driver_ovn(cls):
+ ovn_agents = cls.os_admin.network_client.list_agents(
+ binary='ovn-controller')['agents']
+ return len(ovn_agents) > 0
+
+ @property
+ def is_driver_ovn(self):
+ if self.__is_driver_ovn is None:
+ if hasattr(self, 'os_admin'):
+ self.__is_driver_ovn = self._is_driver_ovn()
+ return self.__is_driver_ovn
+
@classmethod
def get_client_manager(cls, credential_type=None, roles=None,
force_new=None):
diff --git a/neutron_tempest_plugin/api/test_revisions.py b/neutron_tempest_plugin/api/test_revisions.py
index 0d590f6..6009611 100644
--- a/neutron_tempest_plugin/api/test_revisions.py
+++ b/neutron_tempest_plugin/api/test_revisions.py
@@ -342,6 +342,9 @@
@utils.requires_ext(extension="router", service="network")
@utils.requires_ext(extension="l3-ha", service="network")
def test_update_router_extra_attributes_bumps_revision(self):
+ # OVN driver doesn't accept ha=False (all OVN routers support HA)
+ if self.is_driver_ovn:
+ raise self.skipException("Test not meant for OVN driver")
# updates from CVR to CVR-HA are supported on every release,
# but only the admin can forcibly create a non-HA router
router_args = {'tenant_id': self.client.tenant_id,