Add assumption for dvr tests
Add dvr_snat agent mode assumption for dvr related
scenario tests.
Closes-Bug: #1731857
Change-Id: I22455aa851e2878de54a6f83f900b417485122bb
diff --git a/neutron_tempest_plugin/config.py b/neutron_tempest_plugin/config.py
index d6db315..65282cf 100644
--- a/neutron_tempest_plugin/config.py
+++ b/neutron_tempest_plugin/config.py
@@ -43,6 +43,10 @@
help='Max number of networks per project. '
'Configure this only when project is limited with real '
'vlans in deployment.'),
+ cfg.StrOpt('l3_agent_mode',
+ help='The agent mode for L3 agents in the deployment. '
+ 'Configure this only when the single value is used by '
+ 'all agents in the deployment.'),
]
# TODO(amuller): Redo configuration options registration as part of the planned
diff --git a/neutron_tempest_plugin/scenario/test_dvr.py b/neutron_tempest_plugin/scenario/test_dvr.py
index b1cba5a..fa2e9d4 100644
--- a/neutron_tempest_plugin/scenario/test_dvr.py
+++ b/neutron_tempest_plugin/scenario/test_dvr.py
@@ -14,6 +14,7 @@
# under the License.
from tempest.common import utils
from tempest.lib import decorators
+import testtools
from neutron_lib import constants
from neutron_tempest_plugin import config
@@ -54,6 +55,9 @@
super(NetworkDvrTest, cls).skip_checks()
@decorators.idempotent_id('3d73ec1a-2ec6-45a9-b0f8-04a283d9d344')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_vm_reachable_through_compute(self):
"""Check that the VM is reachable through compute node.
diff --git a/neutron_tempest_plugin/scenario/test_migration.py b/neutron_tempest_plugin/scenario/test_migration.py
index 62c3642..4f9c0f3 100644
--- a/neutron_tempest_plugin/scenario/test_migration.py
+++ b/neutron_tempest_plugin/scenario/test_migration.py
@@ -19,11 +19,15 @@
from neutron_lib import constants as const
from tempest.common import utils
from tempest.lib import decorators
+import testtools
from neutron_tempest_plugin.common import utils as common_utils
+from neutron_tempest_plugin import config
from neutron_tempest_plugin.scenario import base
from neutron_tempest_plugin.scenario import test_dvr
+CONF = config.CONF
+
class NetworkMigrationTestBase(base.BaseTempestTestCase,
test_dvr.NetworkTestMixin):
@@ -131,6 +135,9 @@
class NetworkMigrationFromLegacy(NetworkMigrationTestBase):
@decorators.idempotent_id('23724222-483a-4129-bc15-7a9278f3828b')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_legacy_to_dvr(self):
self._test_migration(before_dvr=False, before_ha=False,
after_dvr=True, after_ha=False)
@@ -141,6 +148,9 @@
after_dvr=False, after_ha=True)
@decorators.idempotent_id('fe169f2c-6ed3-4eb0-8afe-2d540c4b49e2')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_legacy_to_dvr_ha(self):
self._test_migration(before_dvr=False, before_ha=False,
after_dvr=True, after_ha=True)
@@ -154,11 +164,17 @@
after_dvr=False, after_ha=False)
@decorators.idempotent_id('42260eea-5d56-4d30-b62a-a62694dfe4d5')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_ha_to_dvr(self):
self._test_migration(before_dvr=False, before_ha=True,
after_dvr=True, after_ha=False)
@decorators.idempotent_id('e4149576-248b-43fa-9d0b-a5c2f51967ce')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_ha_to_dvr_ha(self):
self._test_migration(before_dvr=False, before_ha=True,
after_dvr=True, after_ha=True)
@@ -167,16 +183,25 @@
class NetworkMigrationFromDVR(NetworkMigrationTestBase):
@decorators.idempotent_id('e5cac02c-248d-4aac-bd5e-9d47c5197307')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_dvr_to_legacy(self):
self._test_migration(before_dvr=True, before_ha=False,
after_dvr=False, after_ha=False)
@decorators.idempotent_id('a00d5ad7-8509-4bb0-bdd2-7f1ee052d1cd')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_dvr_to_ha(self):
self._test_migration(before_dvr=True, before_ha=False,
after_dvr=False, after_ha=True)
@decorators.idempotent_id('25304a51-93a8-4cf3-9523-bce8b4eaecf8')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_dvr_to_dvr_ha(self):
self._test_migration(before_dvr=True, before_ha=False,
after_dvr=True, after_ha=True)
@@ -185,16 +210,25 @@
class NetworkMigrationFromDVRHA(NetworkMigrationTestBase):
@decorators.idempotent_id('1be9b2e2-379c-40a4-a269-6687b81df691')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_dvr_ha_to_legacy(self):
self._test_migration(before_dvr=True, before_ha=True,
after_dvr=False, after_ha=False)
@decorators.idempotent_id('55957267-4e84-4314-a2f7-7cd36a2df04b')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_dvr_ha_to_ha(self):
self._test_migration(before_dvr=True, before_ha=True,
after_dvr=False, after_ha=True)
@decorators.idempotent_id('d6bedff1-72be-4a9a-8ea2-dc037cd838e0')
+ @testtools.skipUnless(
+ CONF.neutron_plugin_options.l3_agent_mode == 'dvr_snat',
+ "Need dvr_snat agent mode assumption.")
def test_from_dvr_ha_to_dvr(self):
self._test_migration(before_dvr=True, before_ha=True,
after_dvr=True, after_ha=False)