Merge "Image create v1/v2 compatible in compute test_images_rbac"
diff --git a/doc/source/conf.py b/doc/source/conf.py
index ddb1d45..88c1bea 100755
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -22,10 +22,15 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
- #'sphinx.ext.intersphinx',
- 'openstackdocstheme'
+ 'sphinx.ext.todo',
+ 'sphinx.ext.viewcode',
+ 'openstackdocstheme',
+ 'oslo_config.sphinxconfiggen',
]
+config_generator_config_file = '../../etc/config-generator.patrole.conf'
+sample_config_basename = '_static/patrole'
+
# autodoc generation is a bit aggressive and a nuisance when doing heavy
# text edit cycles.
# execute "export SPHINX_DEBUG=1" in your terminal to disable
@@ -55,7 +60,7 @@
# The theme to use for HTML and HTML Help pages. Major themes that come with
# Sphinx are currently 'default' and 'sphinxdoc'.
# html_theme_path = ["."]
-# html_static_path = ['static']
+html_static_path = ['_static']
html_theme = 'openstackdocs'
# openstackdocstheme options
diff --git a/doc/source/sampleconf.rst b/doc/source/sampleconf.rst
index 94ebc4d..ee848b5 100644
--- a/doc/source/sampleconf.rst
+++ b/doc/source/sampleconf.rst
@@ -3,49 +3,16 @@
Sample Configuration File
==========================
-The following is a sample Patrole configuration for adaptation and use.
+The following is a sample Patrole configuration for adaptation and use. It is
+auto-generated from Patrole when this documentation is built, so
+if you are having issues with an option, please compare your version of
+Patrole with the version of this documentation.
-.. code-block:: ini
+Note that the Patrole configuration options actually live inside the Tempest
+configuration file; at runtime, Tempest populates its own configuration
+file with Patrole groups and options, assuming that Patrole is correctly
+installed and recognized as a plugin.
- [patrole]
+The sample configuration can also be viewed in `file form <_static/patrole.conf.sample>`_.
- # The role that you want the RBAC tests to use for RBAC testing
- # This needs to be edited to run the test as a different role.
- rbac_test_role = Member
-
- # Enables RBAC Tempest tests if set to True. Otherwise, they are
- # skipped.
- enable_rbac = True
-
- # If set to True, tests throw a RbacParsingException for policies
- # not found in the policy file. Otherwise, they throw a skipException.
- strict_policy_check = False
-
- # List of the paths to search for policy files. Each policy path assumes that
- # the service name is included in the path once. Also assumes Patrole is on the
- # same host as the policy files. The paths should be ordered by precedence,
- # with high-priority paths before low-priority paths. The first path that is
- # found to contain the service's policy file will be used.
- custom_policy_files = /etc/nova/policy.json,/etc/neutron/policy.json
-
- # This option determines whether Patrole should run against a
- # `custom_requirements_file` which defines RBAC requirements. The
- # purpose of setting this flag to True is to verify that RBAC policy
- # is in accordance to requirements. The idea is that the
- # `custom_requirements_file` perfectly defines what the RBAC requirements
- # are.
- test_custom_requirements = False
-
- # File path of the yaml file that defines your RBAC requirements. This
- # file must be located on the same host that Patrole runs on. The yaml
- # file should be written as follows:
- custom_requirements_file = patrole/requirements.txt
-
- # DEPRECATED: The following config options set the location of the service's
- # policy file. For services that have their policy in code (e.g., Nova),
- # this would be the location of a custom policy.json, if one exists.
- cinder_policy_file = /etc/cinder/policy.json
- glance_policy_file = /etc/glance/policy.json
- keystone_policy_file = /etc/keystone/policy.json
- neutron_policy_file = /etc/neutron/policy.json
- nova_policy_file = /etc/nova/policy.json
+.. literalinclude:: _static/patrole.conf.sample
diff --git a/etc/config-generator.patrole.conf b/etc/config-generator.patrole.conf
new file mode 100644
index 0000000..8988ae0
--- /dev/null
+++ b/etc/config-generator.patrole.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+output_file = etc/patrole.conf.sample
+namespace = patrole.config
diff --git a/etc/patrole.conf.sample b/etc/patrole.conf.sample
new file mode 100644
index 0000000..370ca8d
--- /dev/null
+++ b/etc/patrole.conf.sample
@@ -0,0 +1,276 @@
+[DEFAULT]
+
+
+[patrole]
+
+#
+# From patrole.config
+#
+
+# The current RBAC role against which to run Patrole
+# tests. (string value)
+#rbac_test_role = admin
+
+# Enables RBAC tests. (boolean value)
+#enable_rbac = true
+
+# If true, throws RbacParsingException for policies which
+# don't exist or are not included in the service's policy file. If
+# false, throws
+# skipException. (boolean value)
+#strict_policy_check = false
+
+# List of the paths to search for policy files. Each
+# policy path assumes that the service name is included in the path
+# once. Also
+# assumes Patrole is on the same host as the policy files. The paths
+# should be
+# ordered by precedence, with high-priority paths before low-priority
+# paths. The
+# first path that is found to contain the service's policy file will
+# be used.
+# (list value)
+#custom_policy_files = /etc/%s/policy.json
+
+# DEPRECATED: Location of the Cinder policy file. Assumed to be on
+# the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#cinder_policy_file = /etc/cinder/policy.json
+
+# DEPRECATED: Location of the Glance policy file. Assumed to be on
+# the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#glance_policy_file = /etc/glance/policy.json
+
+# DEPRECATED: Location of the custom Keystone policy file. Assumed to
+# be on the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#keystone_policy_file = /etc/keystone/policy.json
+
+# DEPRECATED: Location of the Neutron policy file. Assumed to be on
+# the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#neutron_policy_file = /etc/neutron/policy.json
+
+# DEPRECATED: Location of the custom Nova policy file. Assumed to be
+# on the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#nova_policy_file = /etc/nova/policy.json
+
+#
+# This option determines whether Patrole should run against a
+# `custom_requirements_file` which defines RBAC requirements. The
+# purpose of setting this flag to True is to verify that RBAC policy
+# is in accordance to requirements. The idea is that the
+# `custom_requirements_file` perfectly defines what the RBAC
+# requirements are.
+#
+# Here are the possible outcomes when running the Patrole tests
+# against
+# a `custom_requirements_file`:
+#
+# YAML definition: allowed
+# test run: allowed
+# test result: pass
+#
+# YAML definition: allowed
+# test run: not allowed
+# test result: fail (under-permission)
+#
+# YAML definition: not allowed
+# test run: allowed
+# test result: fail (over-permission)
+# (boolean value)
+#test_custom_requirements = false
+
+#
+# File path of the yaml file that defines your RBAC requirements. This
+# file must be located on the same host that Patrole runs on. The yaml
+# file should be written as follows:
+#
+# ```
+# <service>:
+# <api_action>:
+# - <allowed_role>
+# - <allowed_role>
+# - <allowed_role>
+# <api_action>:
+# - <allowed_role>
+# - <allowed_role>
+# <service>
+# <api_action>:
+# - <allowed_role>
+# ```
+# Where:
+# service = the service that is being tested (cinder, nova, etc)
+# api_action = the policy action that is being tested. Examples:
+# - volume:create
+# - os_compute_api:servers:start
+# - add_image
+# allowed_role = the Keystone role that is allowed to perform the API
+# (string value)
+#custom_requirements_file = <None>
+
+
+[patrole_log]
+
+#
+# From patrole.config
+#
+
+# Enables reporting on RBAC expected and actual test results for each
+# Patrole test (boolean value)
+#enable_reporting = false
+
+# Name of file where output from 'enable_reporting' is logged. Note
+# that this file is recreated on each invocation of patrole (string
+# value)
+#report_log_name = patrole.log
+
+# Path (relative or absolute) where the output from 'enable_reporting'
+# is logged. This is combined withreport_log_name to generate the full
+# path. (string value)
+#report_log_path = .
+
+
+[rbac]
+# This group is deprecated and will be removed in the next release.
+# Use the [patrole] group instead.
+
+#
+# From patrole.config
+#
+
+# The current RBAC role against which to run Patrole
+# tests. (string value)
+#rbac_test_role = admin
+
+# Enables RBAC tests. (boolean value)
+#enable_rbac = true
+
+# If true, throws RbacParsingException for policies which
+# don't exist or are not included in the service's policy file. If
+# false, throws
+# skipException. (boolean value)
+#strict_policy_check = false
+
+# List of the paths to search for policy files. Each
+# policy path assumes that the service name is included in the path
+# once. Also
+# assumes Patrole is on the same host as the policy files. The paths
+# should be
+# ordered by precedence, with high-priority paths before low-priority
+# paths. The
+# first path that is found to contain the service's policy file will
+# be used.
+# (list value)
+#custom_policy_files = /etc/%s/policy.json
+
+# DEPRECATED: Location of the Cinder policy file. Assumed to be on
+# the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#cinder_policy_file = /etc/cinder/policy.json
+
+# DEPRECATED: Location of the Glance policy file. Assumed to be on
+# the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#glance_policy_file = /etc/glance/policy.json
+
+# DEPRECATED: Location of the custom Keystone policy file. Assumed to
+# be on the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#keystone_policy_file = /etc/keystone/policy.json
+
+# DEPRECATED: Location of the Neutron policy file. Assumed to be on
+# the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#neutron_policy_file = /etc/neutron/policy.json
+
+# DEPRECATED: Location of the custom Nova policy file. Assumed to be
+# on the same host as Patrole. (string value)
+# This option is deprecated for removal.
+# Its value may be silently ignored in the future.
+# Reason: It is better to use `custom_policy_files` which supports any
+# OpenStack service.
+#nova_policy_file = /etc/nova/policy.json
+
+#
+# This option determines whether Patrole should run against a
+# `custom_requirements_file` which defines RBAC requirements. The
+# purpose of setting this flag to True is to verify that RBAC policy
+# is in accordance to requirements. The idea is that the
+# `custom_requirements_file` perfectly defines what the RBAC
+# requirements are.
+#
+# Here are the possible outcomes when running the Patrole tests
+# against
+# a `custom_requirements_file`:
+#
+# YAML definition: allowed
+# test run: allowed
+# test result: pass
+#
+# YAML definition: allowed
+# test run: not allowed
+# test result: fail (under-permission)
+#
+# YAML definition: not allowed
+# test run: allowed
+# test result: fail (over-permission)
+# (boolean value)
+#test_custom_requirements = false
+
+#
+# File path of the yaml file that defines your RBAC requirements. This
+# file must be located on the same host that Patrole runs on. The yaml
+# file should be written as follows:
+#
+# ```
+# <service>:
+# <api_action>:
+# - <allowed_role>
+# - <allowed_role>
+# - <allowed_role>
+# <api_action>:
+# - <allowed_role>
+# - <allowed_role>
+# <service>
+# <api_action>:
+# - <allowed_role>
+# ```
+# Where:
+# service = the service that is being tested (cinder, nova, etc)
+# api_action = the policy action that is being tested. Examples:
+# - volume:create
+# - os_compute_api:servers:start
+# - add_image
+# allowed_role = the Keystone role that is allowed to perform the API
+# (string value)
+#custom_requirements_file = <None>
diff --git a/patrole_tempest_plugin/config.py b/patrole_tempest_plugin/config.py
index fcf29af..200da85 100644
--- a/patrole_tempest_plugin/config.py
+++ b/patrole_tempest_plugin/config.py
@@ -167,3 +167,18 @@
"'enable_reporting' is logged. This is combined with"
"report_log_name to generate the full path."),
]
+
+
+def list_opts():
+ """Return a list of oslo.config options available.
+
+ The purpose of this is to allow tools like the Oslo sample config file
+ generator to discover the options exposed to users.
+ """
+ opt_list = [
+ (patrole_group, PatroleGroup),
+ (patrole_log_group, PatroleLogGroup),
+ (rbac_group, PatroleGroup)
+ ]
+
+ return opt_list
diff --git a/patrole_tempest_plugin/policy_authority.py b/patrole_tempest_plugin/policy_authority.py
index d2d07c0..0a1aa13 100644
--- a/patrole_tempest_plugin/policy_authority.py
+++ b/patrole_tempest_plugin/policy_authority.py
@@ -225,7 +225,7 @@
try:
policy_data = json.dumps(policy_data)
- except ValueError:
+ except (TypeError, ValueError):
error_message = 'Policy file for {0} service is invalid.'.format(
service)
raise rbac_exceptions.RbacParsingException(error_message)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py
index 4712ed0..cbe8d01 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_agents_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -27,7 +27,7 @@
@classmethod
def skip_checks(cls):
super(AgentsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-agents', 'compute'):
+ if not utils.is_extension_enabled('os-agents', 'compute'):
raise cls.skipException(
'%s skipped as os-agents not enabled' % cls.__name__)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_aggregates_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_aggregates_rbac.py
index eec4030..261fded 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_aggregates_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_aggregates_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -27,7 +27,7 @@
@classmethod
def skip_checks(cls):
super(AggregatesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-aggregates', 'compute'):
+ if not utils.is_extension_enabled('os-aggregates', 'compute'):
msg = "%s skipped as os-aggregates not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_availability_zone_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_availability_zone_rbac.py
index 2ce9176..2a8a6ae 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_availability_zone_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_availability_zone_rbac.py
@@ -11,8 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -23,7 +23,7 @@
@classmethod
def skip_checks(cls):
super(NovaAvailabilityZoneRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-availability-zone', 'compute'):
+ if not utils.is_extension_enabled('os-availability-zone', 'compute'):
msg = ("%s skipped as os-availability-zone not "
"enabled." % cls.__name__)
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py
index 1cced71..2d60e09 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_flavor_extra_specs_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -27,7 +27,7 @@
@classmethod
def skip_checks(cls):
super(FlavorExtraSpecsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-flavor-extra-specs', 'compute'):
+ if not utils.is_extension_enabled('os-flavor-extra-specs', 'compute'):
msg = "os-flavor-extra-specs extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_flavor_manage_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_flavor_manage_rbac.py
index 519a55a..afe5013 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_flavor_manage_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_flavor_manage_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -29,7 +29,7 @@
@classmethod
def skip_checks(cls):
super(FlavorManageRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
+ if not utils.is_extension_enabled('OS-FLV-EXT-DATA', 'compute'):
msg = "OS-FLV-EXT-DATA extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py
index 7340689..b530cbf 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_flavor_rxtx_rbac.py
@@ -13,16 +13,15 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_config import cfg
-
+from tempest.common import utils
+from tempest import config
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
-CONF = cfg.CONF
+CONF = config.CONF
class FlavorRxtxRbacTest(rbac_base.BaseV2ComputeRbacTest):
@@ -30,7 +29,7 @@
@classmethod
def skip_checks(cls):
super(FlavorRxtxRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-flavor-rxtx', 'compute'):
+ if not utils.is_extension_enabled('os-flavor-rxtx', 'compute'):
msg = "os-flavor-rxtx extension not enabled."
raise cls.skipException(msg)
@@ -40,7 +39,6 @@
rule="os_compute_api:os-flavor-rxtx")
def test_list_flavors_details_rxtx(self):
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
- # Enforces os_compute_api:os-flavor-rxtx
result = self.flavors_client.list_flavors(detail=True)['flavors']
if 'rxtx_factor' not in result[0]:
raise rbac_exceptions.RbacMalformedResponse(
@@ -52,9 +50,8 @@
rule="os_compute_api:os-flavor-rxtx")
def test_get_flavor_rxtx(self):
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
- # Enforces os_compute_api:os-flavor-rxtx
- result =\
- self.flavors_client.show_flavor(CONF.compute.flavor_ref)['flavor']
+ result = self.flavors_client.show_flavor(
+ CONF.compute.flavor_ref)['flavor']
if 'rxtx_factor' not in result:
raise rbac_exceptions.RbacMalformedResponse(
attribute='rxtx_factor')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_floating_ip_pools_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_floating_ip_pools_rbac.py
index 7b35525..15891d7 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_floating_ip_pools_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_floating_ip_pools_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest import config
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -38,10 +38,12 @@
@classmethod
def skip_checks(cls):
super(FloatingIpPoolsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-floating-ip-pools', 'compute'):
+ if not utils.is_extension_enabled('os-floating-ip-pools', 'compute'):
msg = "%s skipped as os-floating-ip-pools extension not enabled." \
% cls.__name__
raise cls.skipException(msg)
+ if not CONF.network_feature_enabled.floating_ips:
+ raise cls.skipException("Floating ips are not available")
@decorators.idempotent_id('c1a17153-b25d-4444-a721-5897d7737482')
@rbac_rule_validation.action(
diff --git a/patrole_tempest_plugin/tests/api/compute/test_floating_ips_bulk_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_floating_ips_bulk_rbac.py
index cceccd4..e149bf2 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_floating_ips_bulk_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_floating_ips_bulk_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest import config
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -38,10 +38,12 @@
@classmethod
def skip_checks(cls):
super(FloatingIpsBulkRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-floating-ips-bulk', 'compute'):
+ if not utils.is_extension_enabled('os-floating-ips-bulk', 'compute'):
msg = "%s skipped as os-floating-ips-bulk extension not enabled." \
% cls.__name__
raise cls.skipException(msg)
+ if not CONF.network_feature_enabled.floating_ips:
+ raise cls.skipException("Floating ips are not available")
@decorators.idempotent_id('3b5c8a02-005d-4256-8a95-6fa2f389c6cf')
@rbac_rule_validation.action(
diff --git a/patrole_tempest_plugin/tests/api/compute/test_floating_ips_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_floating_ips_rbac.py
index 764d165..8ab5a51 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_floating_ips_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_floating_ips_rbac.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest import config
+from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -33,10 +34,12 @@
@classmethod
def skip_checks(cls):
super(FloatingIpsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-floating-ips', 'compute'):
+ if not utils.is_extension_enabled('os-floating-ips', 'compute'):
msg = "%s skipped as os-floating-ips extension not enabled." \
% cls.__name__
raise cls.skipException(msg)
+ if not CONF.network_feature_enabled.floating_ips:
+ raise cls.skipException("Floating ips are not available")
@decorators.idempotent_id('ac1b3053-f755-4cda-85a0-30e88b88d7ba')
@rbac_rule_validation.action(
@@ -45,3 +48,39 @@
def test_list_floating_ips(self):
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.floating_ips_client.list_floating_ips()['floating_ips']
+
+ @decorators.idempotent_id('bebe52b3-5269-4e72-80c8-5a4a39c3bfa6')
+ @rbac_rule_validation.action(
+ service="nova",
+ rule="os_compute_api:os-floating-ips")
+ def test_show_floating_ip(self):
+ body = self.floating_ips_client.create_floating_ip(
+ pool=CONF.network.floating_network_name)['floating_ip']
+ self.addCleanup(
+ self.floating_ips_client.delete_floating_ip, body['id'])
+ self.rbac_utils.switch_role(self, toggle_rbac_role=True)
+ self.floating_ips_client.show_floating_ip(body['id'])['floating_ip']
+
+ @decorators.idempotent_id('2bfb8745-c329-4ee9-95f6-c165a1989dbf')
+ @rbac_rule_validation.action(
+ service="nova",
+ rule="os_compute_api:os-floating-ips")
+ def test_create_floating_ips(self):
+ self.rbac_utils.switch_role(self, toggle_rbac_role=True)
+ body = self.floating_ips_client.create_floating_ip(
+ pool=CONF.network.floating_network_name)['floating_ip']
+ self.addCleanup(
+ self.floating_ips_client.delete_floating_ip, body['id'])
+
+ @decorators.idempotent_id('d3028373-5027-4e7a-b761-01c515403ecb')
+ @rbac_rule_validation.action(
+ service="nova",
+ rule="os_compute_api:os-floating-ips")
+ def test_delete_floating_ip(self):
+ body = self.floating_ips_client.create_floating_ip(
+ pool=CONF.network.floating_network_name)['floating_ip']
+ self.addCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ self.floating_ips_client.delete_floating_ip, body['id'])
+ self.rbac_utils.switch_role(self, toggle_rbac_role=True)
+ self.floating_ips_client.delete_floating_ip(body['id'])
diff --git a/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py
index 2a6b171..f10744c 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_hosts_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(HostsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-hosts', 'compute'):
+ if not utils.is_extension_enabled('os-hosts', 'compute'):
msg = "%s skipped as os-hosts not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
index e687fb4..c07ab24 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_hypervisor_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(HypervisorRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-hypervisors', 'compute'):
+ if not utils.is_extension_enabled('os-hypervisors', 'compute'):
msg = "%s skipped as os-hypervisors extension not enabled." \
% cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py
index 90a9e10..5fc4c3b 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_instance_usages_audit_log_rbac.py
@@ -17,8 +17,8 @@
from six.moves.urllib import parse as urllib
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -29,8 +29,8 @@
@classmethod
def skip_checks(cls):
super(InstanceUsagesAuditLogRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-instance-usage-audit-log',
- 'compute'):
+ if not utils.is_extension_enabled('os-instance-usage-audit-log',
+ 'compute'):
msg = "os-instance-usage-audit-log extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_limits_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_limits_rbac.py
index 2f19d13..ad2c5ba 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_limits_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_limits_rbac.py
@@ -11,8 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -23,7 +23,7 @@
@classmethod
def skip_checks(cls):
super(LimitsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-limits', 'compute'):
+ if not utils.is_extension_enabled('os-limits', 'compute'):
msg = "%s skipped as os-limits not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py
index dc2bdf6..1bf46a1 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_migrations_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(MigrationsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-migrations', 'compute'):
+ if not utils.is_extension_enabled('os-migrations', 'compute'):
msg = "%s skipped as os-migrations not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_quota_class_sets_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_quota_class_sets_rbac.py
index 97650ab..162c003 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_quota_class_sets_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_quota_class_sets_rbac.py
@@ -14,9 +14,9 @@
# under the License.
from tempest.common import tempest_fixtures as fixtures
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -33,7 +33,7 @@
@classmethod
def skip_checks(cls):
super(QuotaClassesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-quota-class-sets', 'compute'):
+ if not utils.is_extension_enabled('os-quota-class-sets', 'compute'):
msg = "%s skipped as os-quota-class-sets extension not enabled."\
% cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_quota_sets_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_quota_sets_rbac.py
index a4527c3..6052150 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_quota_sets_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_quota_sets_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -32,7 +32,7 @@
@classmethod
def skip_checks(cls):
super(QuotaSetsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-quota-sets', 'compute'):
+ if not utils.is_extension_enabled('os-quota-sets', 'compute'):
msg = "%s skipped as os-quota-sets extension not enabled."\
% cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_security_groups_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_security_groups_rbac.py
index 36d8c2c..43d48c9 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_security_groups_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_security_groups_rbac.py
@@ -33,12 +33,12 @@
super(SecurtiyGroupsRbacTest, cls).skip_checks()
# All the tests below require the network service.
# NOTE(gmann) Currently 'network' service is always True in
- # test.get_service_list() So below check is not much of use.
+ # utils.get_service_list() So below check is not much of use.
# Commenting the below check as Tempest is moving the get_service_list
# from test.py to utils.
# If we want to check 'network' service availability, then
# get_service_list can be used from new location.
- # if not test.get_service_list()['network']:
+ # if not utils.get_service_list()['network']:
# raise cls.skipException(
# 'Skipped because the network service is not available')
@@ -103,12 +103,12 @@
super(SecurityGroupsRbacMaxV235Test, cls).skip_checks()
# All the tests below require the network service.
# NOTE(gmann) Currently 'network' service is always True in
- # test.get_service_list() So below check is not much of use.
+ # utils.get_service_list() So below check is not much of use.
# Commenting the below check as Tempest is moving the get_service_list
# from test.py to utils.
# If we want to check 'network' service availability, then
# get_service_list can be used from new location.
- # if not test.get_service_list()['network']:
+ # if not utils.get_service_list()['network']:
# raise cls.skipException(
# 'Skipped because the network service is not available')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py
index 6aa202c..f28bf3c 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py
@@ -15,6 +15,7 @@
import testtools
+from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common import api_version_utils
@@ -22,7 +23,6 @@
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -54,8 +54,8 @@
server = self.create_test_server(wait_until='ACTIVE')
self.__class__.server_id = server['id']
except Exception:
- # Rebuilding the server in case something happened during a test
- self.__class__.server_id = self.rebuild_server(self.server_id)
+ # Recreating the server in case something happened during a test
+ self.__class__.server_id = self.recreate_server(self.server_id)
def _stop_server(self):
self.servers_client.stop_server(self.server_id)
@@ -194,7 +194,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.show_server(self.server_id)
- @test.services('image')
+ @utils.services('image')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:servers:create_image")
@@ -205,7 +205,7 @@
# This function will also call show image
self.create_image_from_server(self.server_id, wait_until='ACTIVE')
- @test.services('image', 'volume')
+ @utils.services('image', 'volume')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:servers:create_image:allow_volume_backed")
@@ -231,7 +231,7 @@
@decorators.idempotent_id('9fdd4630-731c-4f7c-bce5-69fa3792c52a')
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
'Snapshotting not available, backup not possible.')
- @test.services('image')
+ @utils.services('image')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-create-backup")
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_groups_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_groups_rbac.py
index f9b065c..be24569 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_groups_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_groups_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(ServerGroupsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-server-groups', 'compute'):
+ if not utils.is_extension_enabled('os-server-groups', 'compute'):
msg = "%s skipped as os-server-groups not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_misc_policy_actions_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_misc_policy_actions_rbac.py
index 6e62029..f15dd78 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_misc_policy_actions_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_misc_policy_actions_rbac.py
@@ -15,13 +15,13 @@
import testtools
+from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -76,7 +76,7 @@
return self.create_test_server(
wait_until='ACTIVE', adminPass=self.password)
- @test.requires_ext(extension='os-admin-actions', service='compute')
+ @utils.requires_ext(extension='os-admin-actions', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-admin-actions:reset_state")
@@ -88,7 +88,7 @@
self.addCleanup(self.servers_client.reset_state, self.server['id'],
state='active')
- @test.requires_ext(extension='os-admin-actions', service='compute')
+ @utils.requires_ext(extension='os-admin-actions', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-admin-actions:inject_network_info")
@@ -98,7 +98,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.inject_network_info(self.server['id'])
- @test.requires_ext(extension='os-admin-actions', service='compute')
+ @utils.requires_ext(extension='os-admin-actions', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-admin-actions:reset_network")
@@ -127,7 +127,7 @@
waiters.wait_for_server_status(
self.os_admin.servers_client, self.server['id'], 'ACTIVE')
- @test.requires_ext(extension='os-config-drive', service='compute')
+ @utils.requires_ext(extension='os-config-drive', service='compute')
@decorators.idempotent_id('2c82e819-382d-4d6f-87f0-a45954cbbc64')
@rbac_rule_validation.action(
service="nova",
@@ -142,7 +142,7 @@
raise rbac_exceptions.RbacMalformedResponse(
attribute=expected_attr)
- @test.requires_ext(extension='os-config-drive', service='compute')
+ @utils.requires_ext(extension='os-config-drive', service='compute')
@decorators.idempotent_id('55c62ef7-b72b-4970-acc6-05b0a4316e5d')
@rbac_rule_validation.action(
service="nova",
@@ -157,7 +157,7 @@
raise rbac_exceptions.RbacMalformedResponse(
attribute=expected_attr)
- @test.requires_ext(extension='os-deferred-delete', service='compute')
+ @utils.requires_ext(extension='os-deferred-delete', service='compute')
@decorators.idempotent_id('189bfed4-1e6d-475c-bb8c-d57e60895391')
@rbac_rule_validation.action(
service="nova",
@@ -169,7 +169,7 @@
self.servers_client.force_delete_server(self.server['id'])
@decorators.idempotent_id('d873740a-7b10-40a9-943d-7cc18115370e')
- @test.requires_ext(extension='OS-EXT-AZ', service='compute')
+ @utils.requires_ext(extension='OS-EXT-AZ', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-availability-zone")
@@ -185,7 +185,7 @@
attribute=expected_attr)
@decorators.idempotent_id('727e5360-770a-4b9c-8015-513a40216635')
- @test.requires_ext(extension='OS-EXT-AZ', service='compute')
+ @utils.requires_ext(extension='OS-EXT-AZ', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-availability-zone")
@@ -200,7 +200,7 @@
attribute=expected_attr)
@decorators.idempotent_id('4aa5d93e-4887-468a-8eb4-b6eca0ca6437')
- @test.requires_ext(extension='OS-EXT-SRV-ATTR', service='compute')
+ @utils.requires_ext(extension='OS-EXT-SRV-ATTR', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-server-attributes")
@@ -222,7 +222,7 @@
attribute=whole_attr)
@decorators.idempotent_id('2ed7aee2-94b2-4a9f-ae63-a51b7f94fe30')
- @test.requires_ext(extension='OS-EXT-SRV-ATTR', service='compute')
+ @utils.requires_ext(extension='OS-EXT-SRV-ATTR', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-server-attributes")
@@ -244,7 +244,7 @@
attribute=whole_attr)
@decorators.idempotent_id('82053c27-3134-4003-9b55-bc9fafdb0e3b')
- @test.requires_ext(extension='OS-EXT-STS', service='compute')
+ @utils.requires_ext(extension='OS-EXT-STS', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-status")
@@ -261,7 +261,7 @@
attribute=attr)
@decorators.idempotent_id('7d2620a5-eea1-4a8b-96ea-86ad77a73fc8')
- @test.requires_ext(extension='OS-EXT-STS', service='compute')
+ @utils.requires_ext(extension='OS-EXT-STS', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-status")
@@ -278,7 +278,7 @@
attribute=attr)
@decorators.idempotent_id('21e39cbe-6c32-48fc-80dd-3e1fece6053f')
- @test.requires_ext(extension='os-extended-volumes', service='compute')
+ @utils.requires_ext(extension='os-extended-volumes', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-volumes")
@@ -295,7 +295,7 @@
attribute=expected_attr)
@decorators.idempotent_id('7f163708-0d25-4138-8512-dfdd72a92989')
- @test.requires_ext(extension='os-extended-volumes', service='compute')
+ @utils.requires_ext(extension='os-extended-volumes', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-extended-volumes")
@@ -311,7 +311,7 @@
raise rbac_exceptions.RbacMalformedResponse(
attribute=expected_attr)
- @test.requires_ext(extension='os-instance-actions', service='compute')
+ @utils.requires_ext(extension='os-instance-actions', service='compute')
@decorators.idempotent_id('9d1b131d-407e-4fa3-8eef-eb2c4526f1da')
@rbac_rule_validation.action(
service="nova",
@@ -321,7 +321,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.list_instance_actions(self.server['id'])
- @test.requires_ext(extension='os-instance-actions', service='compute')
+ @utils.requires_ext(extension='os-instance-actions', service='compute')
@decorators.idempotent_id('eb04c439-4215-4029-9ccb-5b3c041bfc25')
@rbac_rule_validation.action(
service="nova",
@@ -409,7 +409,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.unlock_server(self.server['id'])
- @test.requires_ext(extension='os-rescue', service='compute')
+ @utils.requires_ext(extension='os-rescue', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-rescue")
@@ -419,7 +419,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.rescue_server(self.server['id'])
- @test.requires_ext(extension='os-server-diagnostics', service='compute')
+ @utils.requires_ext(extension='os-server-diagnostics', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-server-diagnostics")
@@ -429,7 +429,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.show_server_diagnostics(self.server['id'])
- @test.requires_ext(extension='os-server-password', service='compute')
+ @utils.requires_ext(extension='os-server-password', service='compute')
@decorators.idempotent_id('aaf43f78-c178-4581-ac18-14afd3f1f6ba')
@rbac_rule_validation.action(
service="nova",
@@ -439,7 +439,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.delete_password(self.server['id'])
- @test.requires_ext(extension='os-server-password', service='compute')
+ @utils.requires_ext(extension='os-server-password', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-server-password")
@@ -449,7 +449,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.show_password(self.server['id'])
- @test.requires_ext(extension='OS-SRV-USG', service='compute')
+ @utils.requires_ext(extension='OS-SRV-USG', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-server-usage")
@@ -463,7 +463,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.servers_client.show_server(self.server['id'])
- @test.requires_ext(extension='os-simple-tenant-usage', service='compute')
+ @utils.requires_ext(extension='os-simple-tenant-usage', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-simple-tenant-usage:list")
@@ -473,7 +473,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.tenant_usages_client.list_tenant_usages()
- @test.requires_ext(extension='os-simple-tenant-usage', service='compute')
+ @utils.requires_ext(extension='os-simple-tenant-usage', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:os-simple-tenant-usage:show")
@@ -560,7 +560,7 @@
@testtools.skipUnless(CONF.compute_feature_enabled.interface_attach,
"Interface attachment is not available.")
- @test.requires_ext(extension='os-attach-interfaces', service='compute')
+ @utils.requires_ext(extension='os-attach-interfaces', service='compute')
@decorators.idempotent_id('ddf53cb6-4a0a-4e5a-91e3-6c32aaa3b9b6')
@rbac_rule_validation.action(
service="nova",
@@ -571,9 +571,23 @@
self.interfaces_client.list_interfaces(
self.server['id'])['interfaceAttachments']
+ @decorators.idempotent_id('1b9cf7db-dc50-48a2-8eb9-8c25af5e934a')
@testtools.skipUnless(CONF.compute_feature_enabled.interface_attach,
"Interface attachment is not available.")
- @test.requires_ext(extension='os-attach-interfaces', service='compute')
+ @utils.requires_ext(extension='os-attach-interfaces', service='compute')
+ @rbac_rule_validation.action(
+ service="nova",
+ rule="os_compute_api:os-attach-interfaces")
+ def test_show_interface(self):
+ """Test show interfaces, part of os-attach-interfaces."""
+ interface = self._attach_interface_to_server()
+ self.rbac_utils.switch_role(self, toggle_rbac_role=True)
+ self.interfaces_client.show_interface(
+ self.server['id'], interface['port_id'])['interfaceAttachment']
+
+ @testtools.skipUnless(CONF.compute_feature_enabled.interface_attach,
+ "Interface attachment is not available.")
+ @utils.requires_ext(extension='os-attach-interfaces', service='compute')
@decorators.idempotent_id('d2d3a24d-4738-4bce-a287-36d664746cde')
@rbac_rule_validation.action(
service="nova",
@@ -585,7 +599,7 @@
@testtools.skipUnless(CONF.compute_feature_enabled.interface_attach,
"Interface attachment is not available.")
- @test.requires_ext(extension='os-attach-interfaces', service='compute')
+ @utils.requires_ext(extension='os-attach-interfaces', service='compute')
@decorators.idempotent_id('55b05692-ed44-4608-a84c-cd4219c82799')
@rbac_rule_validation.action(
service="nova",
@@ -599,7 +613,7 @@
interface['port_id'])
@decorators.idempotent_id('6886d360-0d86-4760-b1a3-882d81fbebcc')
- @test.requires_ext(extension='os-ips', service='compute')
+ @utils.requires_ext(extension='os-ips', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:ips:index")
@@ -609,7 +623,7 @@
self.servers_client.list_addresses(self.server['id'])['addresses']
@decorators.idempotent_id('fa43e7e5-0db9-48eb-9c6b-c11eb766b8e4')
- @test.requires_ext(extension='os-ips', service='compute')
+ @utils.requires_ext(extension='os-ips', service='compute')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:ips:show")
@@ -625,7 +639,7 @@
@testtools.skipUnless(CONF.compute_feature_enabled.interface_attach,
"Interface attachment is not available.")
- @test.requires_ext(extension='os-multinic', service='compute')
+ @utils.requires_ext(extension='os-multinic', service='compute')
@rbac_rule_validation.action(
service="nova", rule="os_compute_api:os-multinic")
@decorators.idempotent_id('bd3e2c74-130a-40f0-8085-124d93fe67da')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
index 5248023..0fe92a9 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
@@ -15,13 +15,13 @@
from oslo_log import log
+from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
from tempest.lib import exceptions
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -76,7 +76,7 @@
self.create_test_server(wait_until='ACTIVE',
availability_zone=availability_zone)
- @test.services('volume')
+ @utils.services('volume')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:servers:create:attach_volume")
@@ -110,7 +110,7 @@
self.servers_client, server['id'])
self.addCleanup(self.delete_server, server['id'])
- @test.services('network')
+ @utils.services('network')
@rbac_rule_validation.action(
service="nova",
rule="os_compute_api:servers:create:attach_network")
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_tags_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_tags_rbac.py
index d3576d6..0f49095 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_tags_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_tags_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -29,7 +29,7 @@
@classmethod
def skip_checks(cls):
super(ServerTagsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-server-tags', 'compute'):
+ if not utils.is_extension_enabled('os-server-tags', 'compute'):
msg = "os-server-tags extension is not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py
index 94d094c..316da00 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_services_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(ServicesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-services', 'compute'):
+ if not utils.is_extension_enabled('os-services', 'compute'):
raise cls.skipException(
'%s skipped as os-services not enabled' % cls.__name__)
diff --git a/patrole_tempest_plugin/tests/api/compute/test_tenant_networks_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_tenant_networks_rbac.py
index 9313943..830e19a 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_tenant_networks_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_tenant_networks_rbac.py
@@ -15,8 +15,8 @@
from oslo_config import cfg
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -40,7 +40,7 @@
@classmethod
def skip_checks(cls):
super(TenantNetworksRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-tenant-networks', 'compute'):
+ if not utils.is_extension_enabled('os-tenant-networks', 'compute'):
msg = "os-tenant-networks extension not enabled."
raise cls.skipException(msg)
if not CONF.service_available.neutron:
diff --git a/patrole_tempest_plugin/tests/api/identity/rbac_base.py b/patrole_tempest_plugin/tests/api/identity/rbac_base.py
index 8273022..a99365d 100644
--- a/patrole_tempest_plugin/tests/api/identity/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/identity/rbac_base.py
@@ -41,34 +41,6 @@
cls.rbac_utils = rbac_utils.RbacUtils(cls)
@classmethod
- def resource_setup(cls):
- super(BaseIdentityRbacTest, cls).resource_setup()
- cls.endpoints = []
- cls.roles = []
- cls.services = []
- cls.users = []
-
- @classmethod
- def resource_cleanup(cls):
- for endpoint in cls.endpoints:
- test_utils.call_and_ignore_notfound_exc(
- cls.endpoints_client.delete_endpoint, endpoint['id'])
-
- for role in cls.roles:
- test_utils.call_and_ignore_notfound_exc(
- cls.roles_client.delete_role, role['id'])
-
- for service in cls.services:
- test_utils.call_and_ignore_notfound_exc(
- cls.services_client.delete_service, service['id'])
-
- for user in cls.users:
- test_utils.call_and_ignore_notfound_exc(
- cls.users_client.delete_user, user['id'])
-
- super(BaseIdentityRbacTest, cls).resource_cleanup()
-
- @classmethod
def setup_test_endpoint(cls, service=None):
"""Creates a service and an endpoint for test."""
interface = 'public'
@@ -89,7 +61,9 @@
params['url'] = url
endpoint = cls.endpoints_client.create_endpoint(**params)['endpoint']
- cls.endpoints.append(endpoint)
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.endpoints_client.delete_endpoint, endpoint['id'])
return endpoint
@@ -98,7 +72,9 @@
"""Set up a test role."""
name = data_utils.rand_name(cls.__name__ + '-test_role')
role = cls.roles_client.create_role(name=name)['role']
- cls.roles.append(role)
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.roles_client.delete_role, role['id'])
return role
@@ -119,7 +95,9 @@
elif cls.identity_version == 'v3':
service = service['service']
- cls.services.append(service)
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.services_client.delete_service, service['id'])
return service
@@ -134,7 +112,9 @@
email=email,
password=password,
**kwargs)['user']
- cls.users.append(user)
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.users_client.delete_user, user['id'])
return user
diff --git a/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py b/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py
index 8e2bc49..ecf2ec2 100644
--- a/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/test_image_namespace_tags_rbac.py
@@ -39,11 +39,9 @@
cls.namespace = cls.namespaces_client.create_namespace(
namespace=data_utils.rand_name(
cls.__name__ + '-namespace'))['namespace']
-
- @classmethod
- def resource_cleanup(cls):
- cls.namespaces_client.delete_namespace(cls.namespace)
- super(NamespaceTagsRbacTest, cls).resource_cleanup()
+ cls.addClassResourceCleanup(
+ cls.namespaces_client.delete_namespace,
+ cls.namespace)
def _create_namespace_tag(self, multiple=False):
tag_count = 2 if multiple else 1
diff --git a/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py b/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py
index 456e10b..701e345 100644
--- a/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/test_image_resource_types_rbac.py
@@ -31,13 +31,9 @@
cls.namespaces_client.create_namespace(
namespace=cls.namespace_name,
protected=False)
-
- @classmethod
- def resource_cleanup(cls):
- test_utils.call_and_ignore_notfound_exc(
- cls.namespaces_client.delete_namespace,
- cls.namespace_name)
- super(ImageResourceTypesRbacTest, cls).resource_cleanup()
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.namespaces_client.delete_namespace, cls.namespace_name)
@rbac_rule_validation.action(service="glance",
rule="list_metadef_resource_types")
diff --git a/patrole_tempest_plugin/tests/api/network/test_agents_rbac.py b/patrole_tempest_plugin/tests/api/network/test_agents_rbac.py
index 506dd5b..fb747d6 100644
--- a/patrole_tempest_plugin/tests/api/network/test_agents_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_agents_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.network import rbac_base as base
@@ -26,7 +26,7 @@
@classmethod
def skip_checks(cls):
super(AgentsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('agent', 'network'):
+ if not utils.is_extension_enabled('agent', 'network'):
msg = "agent extension not enabled."
raise cls.skipException(msg)
@@ -70,7 +70,7 @@
@classmethod
def skip_checks(cls):
super(L3AgentSchedulerRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('l3_agent_scheduler', 'network'):
+ if not utils.is_extension_enabled('l3_agent_scheduler', 'network'):
msg = "l3_agent_scheduler extension not enabled."
raise cls.skipException(msg)
@@ -149,7 +149,7 @@
@classmethod
def skip_checks(cls):
super(DHCPAgentSchedulersRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('dhcp_agent_scheduler', 'network'):
+ if not utils.is_extension_enabled('dhcp_agent_scheduler', 'network'):
msg = "dhcp_agent_scheduler extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/network/test_floating_ips_rbac.py b/patrole_tempest_plugin/tests/api/network/test_floating_ips_rbac.py
index 67b32a2..dc674d1 100644
--- a/patrole_tempest_plugin/tests/api/network/test_floating_ips_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_floating_ips_rbac.py
@@ -30,10 +30,15 @@
@classmethod
def resource_setup(cls):
super(FloatingIpsRbacTest, cls).resource_setup()
-
- # Create an external network for floating ip creation
+ # Create an external network for floating ip creation.
cls.fip_extnet = cls.create_network(**{'router:external': True})
+ # Update router:external attribute to False for proper subnet resource
+ # cleanup by base class.
cls.fip_extnet_id = cls.fip_extnet['id']
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.networks_client.update_network, cls.fip_extnet_id,
+ **{'router:external': False})
# Create a subnet for the external network
cls.cidr = netaddr.IPNetwork(CONF.network.project_network_cidr)
@@ -41,14 +46,6 @@
cidr=cls.cidr,
mask_bits=24)
- @classmethod
- def resource_cleanup(cls):
- # Update router:external attribute to False for proper subnet resource
- # cleanup by base class
- cls.networks_client.update_network(cls.fip_extnet_id,
- **{'router:external': False})
- super(FloatingIpsRbacTest, cls).resource_cleanup()
-
def _create_floatingip(self, floating_ip_address=None):
if floating_ip_address is not None:
body = self.floating_ips_client.create_floatingip(
diff --git a/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py b/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py
index 3c74c07..5ffc966 100644
--- a/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_metering_label_rules_rbac.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.network import rbac_base as base
@@ -30,7 +30,7 @@
@classmethod
def skip_checks(cls):
super(MeteringLabelRulesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('metering', 'network'):
+ if not utils.is_extension_enabled('metering', 'network'):
msg = "metering extension not enabled."
raise cls.skipException(msg)
@@ -44,15 +44,11 @@
@classmethod
def resource_setup(cls):
super(MeteringLabelRulesRbacTest, cls).resource_setup()
-
body = cls.metering_labels_client.create_metering_label(
name=data_utils.rand_name(cls.__name__))
cls.label = body['metering_label']
-
- @classmethod
- def resource_cleanup(cls):
- cls.metering_labels_client.delete_metering_label(cls.label['id'])
- super(MeteringLabelRulesRbacTest, cls).resource_cleanup()
+ cls.addClassResourceCleanup(
+ cls.metering_labels_client.delete_metering_label, cls.label['id'])
def _create_metering_label_rule(self, label):
body = self.metering_label_rules_client.create_metering_label_rule(
diff --git a/patrole_tempest_plugin/tests/api/network/test_metering_labels_rbac.py b/patrole_tempest_plugin/tests/api/network/test_metering_labels_rbac.py
index 89c6870..64df7c5 100644
--- a/patrole_tempest_plugin/tests/api/network/test_metering_labels_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_metering_labels_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.network import rbac_base as base
@@ -27,7 +27,7 @@
@classmethod
def skip_checks(cls):
super(MeteringLabelsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('metering', 'network'):
+ if not utils.is_extension_enabled('metering', 'network'):
msg = "metering extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/network/test_networks_multiprovider_rbac.py b/patrole_tempest_plugin/tests/api/network/test_networks_multiprovider_rbac.py
index 9d2b67a..7c7395b 100644
--- a/patrole_tempest_plugin/tests/api/network/test_networks_multiprovider_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_networks_multiprovider_rbac.py
@@ -14,10 +14,10 @@
# under the License.
from oslo_log import log
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -31,7 +31,7 @@
@classmethod
def skip_checks(cls):
super(NetworksMultiProviderRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('multi-provider', 'network'):
+ if not utils.is_extension_enabled('multi-provider', 'network'):
msg = "multi-provider extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/network/test_networks_rbac.py b/patrole_tempest_plugin/tests/api/network/test_networks_rbac.py
index 148804e..e0cf098 100644
--- a/patrole_tempest_plugin/tests/api/network/test_networks_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_networks_rbac.py
@@ -15,10 +15,10 @@
import netaddr
+from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -110,7 +110,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self._create_network(shared=True)
- @test.requires_ext(extension='external-net', service='network')
+ @utils.requires_ext(extension='external-net', service='network')
@rbac_rule_validation.action(service="neutron",
rule="create_network:router:external")
@decorators.idempotent_id('51adf2a7-739c-41e0-8857-3b4c460cbd24')
@@ -123,7 +123,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self._create_network(router_external=True)
- @test.requires_ext(extension='provider', service='network')
+ @utils.requires_ext(extension='provider', service='network')
@rbac_rule_validation.action(service="neutron",
rule="create_network:provider:network_type")
@decorators.idempotent_id('3c42f7b8-b80c-44ef-8fa4-69ec4b1836bc')
@@ -136,7 +136,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self._create_network(provider_network_type='vxlan')
- @test.requires_ext(extension='provider', service='network')
+ @utils.requires_ext(extension='provider', service='network')
@rbac_rule_validation.action(
service="neutron",
rule="create_network:provider:segmentation_id")
@@ -179,7 +179,7 @@
self._update_network(shared_network=True)
self.addCleanup(self._update_network, shared_network=False)
- @test.requires_ext(extension='external-net', service='network')
+ @utils.requires_ext(extension='external-net', service='network')
@rbac_rule_validation.action(service="neutron",
rule="update_network:router:external")
@decorators.idempotent_id('34884c22-499b-4960-97f1-e2ed8522a9c9')
@@ -205,7 +205,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.networks_client.show_network(self.network['id'])
- @test.requires_ext(extension='external-net', service='network')
+ @utils.requires_ext(extension='external-net', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_network:router:external")
@decorators.idempotent_id('529e4814-22e9-413f-af48-8fefcd637344')
@@ -221,7 +221,7 @@
self.networks_client.show_network(self.network['id'],
**kwargs)
- @test.requires_ext(extension='provider', service='network')
+ @utils.requires_ext(extension='provider', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_network:provider:network_type")
@decorators.idempotent_id('6521dd60-0950-458b-8491-09d3c84ac0f4')
@@ -240,7 +240,7 @@
if len(retrieved_network) == 0:
raise rbac_exceptions.RbacMalformedResponse(True)
- @test.requires_ext(extension='provider', service='network')
+ @utils.requires_ext(extension='provider', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_network:provider:physical_network")
@decorators.idempotent_id('c049f11a-240c-4a85-ad43-a4d3fd0a5e39')
@@ -259,7 +259,7 @@
if len(retrieved_network) == 0:
raise rbac_exceptions.RbacMalformedResponse(empty=True)
- @test.requires_ext(extension='provider', service='network')
+ @utils.requires_ext(extension='provider', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_network:provider:segmentation_id")
@decorators.idempotent_id('38d9f085-6365-4f81-bac9-c53c294d727e')
@@ -351,7 +351,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.subnets_client.delete_subnet(subnet['id'])
- @test.requires_ext(extension='dhcp_agent_scheduler', service='network')
+ @utils.requires_ext(extension='dhcp_agent_scheduler', service='network')
@decorators.idempotent_id('b524f19f-fbb4-4d11-a85d-03bfae17bf0e')
@rbac_rule_validation.action(service="neutron",
rule="get_dhcp-agents")
diff --git a/patrole_tempest_plugin/tests/api/network/test_ports_rbac.py b/patrole_tempest_plugin/tests/api/network/test_ports_rbac.py
index 888f879..2fb26f8 100644
--- a/patrole_tempest_plugin/tests/api/network/test_ports_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_ports_rbac.py
@@ -16,11 +16,11 @@
import netaddr
+from tempest.common import utils
from tempest.common.utils import net_utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -79,7 +79,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.create_port(self.network, port_security_enabled=True)
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="create_port:binding:host_id")
@decorators.idempotent_id('a54bd6b8-a7eb-4101-bfe8-093930b0d660')
@@ -91,7 +91,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.create_port(**post_body)
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="create_port:binding:profile")
@decorators.idempotent_id('98fa38ab-c2ed-46a0-99f0-59f18cbd257a')
@@ -154,7 +154,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.ports_client.show_port(self.port['id'])
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_port:binding:vif_type")
@decorators.idempotent_id('125aff0b-8fed-4f8e-8410-338616594b06')
@@ -173,7 +173,7 @@
raise rbac_exceptions.RbacMalformedResponse(
attribute='binding:vif_type')
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_port:binding:vif_details")
@decorators.idempotent_id('e42bfd77-fcce-45ee-9728-3424300f0d6f')
@@ -192,7 +192,7 @@
raise rbac_exceptions.RbacMalformedResponse(
attribute='binding:vif_details')
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_port:binding:host_id")
@decorators.idempotent_id('8e61bcdc-6f81-443c-833e-44410266551e')
@@ -213,7 +213,7 @@
raise rbac_exceptions.RbacMalformedResponse(
attribute='binding:host_id')
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_port:binding:profile")
@decorators.idempotent_id('d497cea9-c4ad-42e0-acc9-8d257d6b01fc')
@@ -290,7 +290,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.ports_client.update_port(self.port['id'], security_groups=[])
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="update_port:binding:host_id")
@decorators.idempotent_id('24206a72-0d90-4712-918c-5c9a1ebef64d')
@@ -306,7 +306,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self.ports_client.update_port(**updated_body)
- @test.requires_ext(extension='binding', service='network')
+ @utils.requires_ext(extension='binding', service='network')
@rbac_rule_validation.action(service="neutron",
rule="update_port:binding:profile")
@decorators.idempotent_id('990ea8d1-9257-4f71-a3bf-d6d0914625c5')
diff --git a/patrole_tempest_plugin/tests/api/network/test_routers_rbac.py b/patrole_tempest_plugin/tests/api/network/test_routers_rbac.py
index 45a5cda..c3ed9e1 100644
--- a/patrole_tempest_plugin/tests/api/network/test_routers_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_routers_rbac.py
@@ -15,11 +15,11 @@
import netaddr
+from tempest.common import utils
from tempest.common.utils import net_utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_exceptions
from patrole_tempest_plugin import rbac_rule_validation
@@ -30,7 +30,7 @@
@classmethod
def skip_checks(cls):
super(RouterRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('router', 'network'):
+ if not utils.is_extension_enabled('router', 'network'):
msg = "router extension not enabled."
raise cls.skipException(msg)
@@ -69,7 +69,7 @@
router['router']['id'])
@decorators.idempotent_id('6139eb97-95c0-40d8-a109-99de11ab2e5e')
- @test.requires_ext(extension='l3-ha', service='network')
+ @utils.requires_ext(extension='l3-ha', service='network')
@rbac_rule_validation.action(service="neutron",
rule="create_router:ha")
def test_create_high_availability_router(self):
@@ -83,7 +83,7 @@
router['router']['id'])
@decorators.idempotent_id('c6254ca6-2728-412d-803d-d4aa3935e56d')
- @test.requires_ext(extension='dvr', service='network')
+ @utils.requires_ext(extension='dvr', service='network')
@rbac_rule_validation.action(service="neutron",
rule="create_router:distributed")
def test_create_distributed_router(self):
@@ -96,7 +96,7 @@
self.addCleanup(self.routers_client.delete_router,
router['router']['id'])
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @utils.requires_ext(extension='ext-gw-mode', service='network')
@rbac_rule_validation.action(
service="neutron",
rule="create_router:external_gateway_info:enable_snat")
@@ -156,7 +156,7 @@
self.routers_client.show_router(self.router['id'], fields=['id'])
@decorators.idempotent_id('3ed26ea2-b419-410c-b4b5-576c1edafa06')
- @test.requires_ext(extension='dvr', service='network')
+ @utils.requires_ext(extension='dvr', service='network')
@rbac_rule_validation.action(service="neutron",
rule="get_router:distributed")
def test_show_distributed_router(self):
@@ -221,7 +221,7 @@
self.router['id'],
external_gateway_info=None)
- @test.requires_ext(extension='ext-gw-mode', service='network')
+ @utils.requires_ext(extension='ext-gw-mode', service='network')
@rbac_rule_validation.action(
service="neutron",
rule="update_router:external_gateway_info:enable_snat")
@@ -268,7 +268,7 @@
external_gateway_info=None)
@decorators.idempotent_id('ddc20731-dea1-4321-9abf-8772bf0b5977')
- @test.requires_ext(extension='l3-ha', service='network')
+ @utils.requires_ext(extension='l3-ha', service='network')
@rbac_rule_validation.action(service="neutron",
rule="update_router:ha")
def test_update_high_availability_router(self):
@@ -282,7 +282,7 @@
ha=False)
@decorators.idempotent_id('e1932c19-8f73-41cd-b5d2-84c7ae5d530c')
- @test.requires_ext(extension='dvr', service='network')
+ @utils.requires_ext(extension='dvr', service='network')
@rbac_rule_validation.action(service="neutron",
rule="update_router:distributed")
def test_update_distributed_router(self):
diff --git a/patrole_tempest_plugin/tests/api/network/test_security_groups_rbac.py b/patrole_tempest_plugin/tests/api/network/test_security_groups_rbac.py
index 2672b57..3ed23fd 100644
--- a/patrole_tempest_plugin/tests/api/network/test_security_groups_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_security_groups_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.network import rbac_base as base
@@ -27,7 +27,7 @@
@classmethod
def skip_checks(cls):
super(SecGroupRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('security-group', 'network'):
+ if not utils.is_extension_enabled('security-group', 'network'):
msg = "security-group extension not enabled."
raise cls.skipException(msg)
@@ -37,14 +37,9 @@
secgroup_name = data_utils.rand_name(cls.__name__ + '-secgroup')
cls.secgroup = cls.security_groups_client.create_security_group(
name=secgroup_name)['security_group']
-
- @classmethod
- def resource_cleanup(cls):
- # Clean up security group
- test_utils.call_and_ignore_notfound_exc(
+ cls.addClassResourceCleanup(
cls.security_groups_client.delete_security_group,
cls.secgroup['id'])
- super(SecGroupRbacTest, cls).resource_cleanup()
def _create_security_group(self):
# Create a security group
diff --git a/patrole_tempest_plugin/tests/api/network/test_subnetpools_rbac.py b/patrole_tempest_plugin/tests/api/network/test_subnetpools_rbac.py
index 44f6be4..9231c15 100644
--- a/patrole_tempest_plugin/tests/api/network/test_subnetpools_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_subnetpools_rbac.py
@@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.network import rbac_base as base
@@ -30,7 +30,7 @@
@classmethod
def skip_checks(cls):
super(SubnetPoolsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('subnet_allocation', 'network'):
+ if not utils.is_extension_enabled('subnet_allocation', 'network'):
msg = "subnet_allocation extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/network/test_subnets_rbac.py b/patrole_tempest_plugin/tests/api/network/test_subnets_rbac.py
index 68f5156..23f11cf 100644
--- a/patrole_tempest_plugin/tests/api/network/test_subnets_rbac.py
+++ b/patrole_tempest_plugin/tests/api/network/test_subnets_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.network import rbac_base as base
@@ -26,7 +26,7 @@
@classmethod
def skip_checks(cls):
super(SubnetsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('subnet_allocation', 'network'):
+ if not utils.is_extension_enabled('subnet_allocation', 'network'):
msg = "subnet_allocation extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/rbac_base.py b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
index 6db364e..f4531df 100644
--- a/patrole_tempest_plugin/tests/api/volume/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
@@ -41,24 +41,17 @@
cls.group_types_client = cls.os_primary.group_types_v3_client
@classmethod
- def resource_setup(cls):
- super(BaseVolumeRbacTest, cls).resource_setup()
- cls.volume_types = []
-
- @classmethod
- def resource_cleanup(cls):
- super(BaseVolumeRbacTest, cls).resource_cleanup()
- # Allow volumes to be cleared first, so only clear volume types
- # after super's resource_cleanup.
- cls.clear_volume_types()
-
- @classmethod
def create_volume_type(cls, name=None, **kwargs):
"""Create a test volume-type"""
name = name or data_utils.rand_name(cls.__name__ + '-volume-type')
volume_type = cls.volume_types_client.create_volume_type(
name=name, **kwargs)['volume_type']
- cls.volume_types.append(volume_type)
+ cls.addClassResourceCleanup(
+ cls.volume_types_client.wait_for_resource_deletion,
+ volume_type['id'])
+ cls.addClassResourceCleanup(
+ test_utils.call_and_ignore_notfound_exc,
+ cls.volume_types_client.delete_volume_type, volume_type['id'])
return volume_type
def create_group_type(self, name=None, ignore_notfound=False, **kwargs):
@@ -77,14 +70,3 @@
group_type['id'])
return group_type
-
- @classmethod
- def clear_volume_types(cls):
- for vol_type in cls.volume_types:
- test_utils.call_and_ignore_notfound_exc(
- cls.volume_types_client.delete_volume_type, vol_type['id'])
-
- for vol_type in cls.volume_types:
- test_utils.call_and_ignore_notfound_exc(
- cls.volume_types_client.wait_for_resource_deletion,
- vol_type['id'])
diff --git a/patrole_tempest_plugin/tests/api/volume/test_capabilities_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_capabilities_rbac.py
index 45b1660..74ffe60 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_capabilities_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_capabilities_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(CapabilitiesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('capabilities', 'volume'):
+ if not utils.is_extension_enabled('capabilities', 'volume'):
msg = "%s skipped as capabilities not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_encryption_types_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_encryption_types_rbac.py
index f11ef03..2cae0bd 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_encryption_types_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_encryption_types_rbac.py
@@ -12,8 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -24,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(EncryptionTypesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('encryption', 'volume'):
+ if not utils.is_extension_enabled('encryption', 'volume'):
msg = "%s skipped as encryption not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_quota_classes_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_quota_classes_rbac.py
index 1518ef4..d016498 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_quota_classes_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_quota_classes_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -26,7 +26,7 @@
@classmethod
def skip_checks(cls):
super(QuotaClassesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-quota-class-sets', 'volume'):
+ if not utils.is_extension_enabled('os-quota-class-sets', 'volume'):
msg = ("%s skipped as os-quota-class-sets not enabled."
% cls.__name__)
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_scheduler_stats_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_scheduler_stats_rbac.py
index dd423d1..25562e8 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_scheduler_stats_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_scheduler_stats_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -25,7 +25,7 @@
@classmethod
def skip_checks(cls):
super(SchedulerStatsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('scheduler-stats', 'volume'):
+ if not utils.is_extension_enabled('scheduler-stats', 'volume'):
msg = "%s skipped as scheduler-stats not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py
index 209821e..466fb0c 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py
@@ -14,12 +14,12 @@
# under the License.
from tempest.common import compute
+from tempest.common import utils
from tempest.common import waiters
from tempest import config
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -68,7 +68,7 @@
waiters.wait_for_volume_resource_status(
self.admin_volumes_client, volume_id, 'available')
- @test.services('compute')
+ @utils.services('compute')
@rbac_rule_validation.action(service="cinder", rule="volume:attach")
@decorators.idempotent_id('f97b10e4-2eed-4f8b-8632-71c02cb9fe42')
def test_attach_volume_to_instance(self):
@@ -76,7 +76,7 @@
self.rbac_utils.switch_role(self, toggle_rbac_role=True)
self._attach_volume(server)
- @test.services('compute')
+ @utils.services('compute')
@decorators.attr(type='slow')
@rbac_rule_validation.action(service="cinder", rule="volume:detach")
@decorators.idempotent_id('5a042f6a-688b-42e6-a02e-fe5c47b89b07')
@@ -88,7 +88,7 @@
self._detach_volume()
@decorators.attr(type=["slow"])
- @test.services('image')
+ @utils.services('image')
@rbac_rule_validation.action(
service="cinder",
rule="volume_extension:volume_actions:upload_image")
@@ -189,7 +189,7 @@
self.volumes_client.wait_for_resource_deletion(volume['id'])
@decorators.idempotent_id('48bd302b-950a-4830-840c-3158246ecdcc')
- @test.services('compute')
+ @utils.services('compute')
@rbac_rule_validation.action(
service="cinder",
rule="volume_extension:volume_admin_actions:force_detach")
@@ -229,7 +229,7 @@
cls.admin_volumes_client = cls.os_admin.volumes_client_latest
@decorators.attr(type=["slow"])
- @test.services('image')
+ @utils.services('image')
@rbac_rule_validation.action(
service="cinder",
rule="volume_extension:volume_actions:upload_public")
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volume_services_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volume_services_rbac.py
index ac6d2ce..63978aa 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volume_services_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volume_services_rbac.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -29,7 +29,7 @@
@classmethod
def skip_checks(cls):
super(VolumeServicesRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-services', 'volume'):
+ if not utils.is_extension_enabled('os-services', 'volume'):
msg = "%s skipped as os-services not enabled." % cls.__name__
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volume_types_access_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volume_types_access_rbac.py
index af9994c..773df2b 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volume_types_access_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volume_types_access_rbac.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -27,7 +27,7 @@
@classmethod
def skip_checks(cls):
super(VolumeTypesAccessRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-volume-type-access', 'volume'):
+ if not utils.is_extension_enabled('os-volume-type-access', 'volume'):
msg = "os-volume-type-access extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volume_types_extra_specs_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volume_types_extra_specs_rbac.py
index 210901c..aa02316 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volume_types_extra_specs_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volume_types_extra_specs_rbac.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest.common import utils
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
-from tempest import test
from patrole_tempest_plugin import rbac_rule_validation
from patrole_tempest_plugin.tests.api.volume import rbac_base
@@ -28,7 +28,7 @@
@classmethod
def skip_checks(cls):
super(VolumeTypesExtraSpecsRbacTest, cls).skip_checks()
- if not test.is_extension_enabled('os-types-extra-specs', 'volume'):
+ if not utils.is_extension_enabled('os-types-extra-specs', 'volume'):
msg = "os-types-extra-specs extension not enabled."
raise cls.skipException(msg)
diff --git a/patrole_tempest_plugin/tests/unit/test_hacking.py b/patrole_tempest_plugin/tests/unit/test_hacking.py
index 021602b..6096c24 100644
--- a/patrole_tempest_plugin/tests/unit/test_hacking.py
+++ b/patrole_tempest_plugin/tests/unit/test_hacking.py
@@ -70,10 +70,10 @@
def test_service_tags_not_in_module_path(self):
self.assertTrue(checks.service_tags_not_in_module_path(
- "@test.services('volume')",
+ "@utils.services('volume')",
"./patrole_tempest_plugin/tests/api/volume/fake_test_rbac.py"))
self.assertFalse(checks.service_tags_not_in_module_path(
- "@test.services('image')",
+ "@utils.services('image')",
"./patrole_tempest_plugin/tests/api/volume/fake_test_rbac.py"))
def test_no_hyphen_at_end_of_rand_name(self):
@@ -138,7 +138,7 @@
other_decorators = [
"@decorators.idempotent_id(123)",
"@decorators.attr(type=['slow'])",
- "@test.requires_ext(extension='ext', service='svc')"
+ "@utils.requires_ext(extension='ext', service='svc')"
]
if with_other_decorators:
diff --git a/setup.cfg b/setup.cfg
index b3f4312..d805f62 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -54,3 +54,5 @@
[entry_points]
tempest.test_plugins =
patrole_tempest_plugin = patrole_tempest_plugin.plugin:PatroleTempestPlugin
+oslo.config.opts =
+ patrole.config = patrole_tempest_plugin.config:list_opts
diff --git a/tox.ini b/tox.ini
index 320eb4e..e95cadf 100644
--- a/tox.ini
+++ b/tox.ini
@@ -55,6 +55,9 @@
[testenv:debug]
commands = oslo_debug_helper -t patrole_tempest_plugin/tests {posargs}
+[testenv:genconfig]
+commands = oslo-config-generator --config-file etc/config-generator.patrole.conf
+
[flake8]
# [H106] Don’t put vim configuration in source files.
# [H203] Use assertIs(Not)None to check for None.