api-tests: Common way to define required extensions
As some tests require extensions to be enabled on the server, this patch
introduces a new class attribute to the API base class. If any extension
defined in test class is not enabled on the server, then all tests in
the test class will be skipped.
Change-Id: I0629153f973daeb3bef3a6968360cbc2d427f9ad
diff --git a/neutron/tests/tempest/api/base.py b/neutron/tests/tempest/api/base.py
index 55ad355..8213277 100644
--- a/neutron/tests/tempest/api/base.py
+++ b/neutron/tests/tempest/api/base.py
@@ -76,6 +76,10 @@
raise cls.skipException("Neutron support is required")
if cls._ip_version == 6 and not CONF.network_feature_enabled.ipv6:
raise cls.skipException("IPv6 Tests are disabled.")
+ for req_ext in getattr(cls, 'required_extensions', []):
+ if not test.is_extension_enabled(req_ext, 'network'):
+ msg = "%s extension not enabled." % req_ext
+ raise cls.skipException(msg)
@classmethod
def setup_credentials(cls):