Add skip funtion for checking enabled extensions in the l3 agent
This function check the extension configured in the l3 network agent
and if the extension is no enabled the test is skipped
That validation should not be applied when the l3 agent does not exist,
e.g.: OVN configurations
Change-Id: Icbc379d6b8ab0d720d2ae242d79949fb4dd9d27c
diff --git a/neutron_tempest_plugin/scenario/base.py b/neutron_tempest_plugin/scenario/base.py
index 127701c..6910c11 100644
--- a/neutron_tempest_plugin/scenario/base.py
+++ b/neutron_tempest_plugin/scenario/base.py
@@ -207,6 +207,21 @@
LOG.debug("Created router %s", router['name'])
return router
+ @classmethod
+ def skip_if_no_extension_enabled_in_l3_agents(cls, extension):
+ l3_agents = cls.os_admin.network_client.list_agents(
+ binary='neutron-l3-agent')['agents']
+ if not l3_agents:
+ # the tests should not be skipped when neutron-l3-agent does not
+ # exist (this validation doesn't apply to the setups like
+ # e.g. ML2/OVN)
+ return
+ for agent in l3_agents:
+ if extension in agent['configurations'].get('extensions', []):
+ return
+ raise cls.skipTest("No L3 agent with '%s' extension enabled found." %
+ extension)
+
@removals.remove(version='Stein',
message="Please use create_floatingip method instead of "
"create_and_associate_floatingip.")