Merge "List hypervisors with details rbac test"
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 d44dbac..7b35525 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
@@ -28,7 +28,6 @@
     # Tests will fail with a 404 starting from microversion 2.36:
     # See the following link for details:
     # https://developer.openstack.org/api-ref/compute/#floating-ip-pools-os-floating-ip-pools-deprecated
-    min_microversion = '2.10'
     max_microversion = '2.35'
 
     @classmethod
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 7adc161..cceccd4 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
@@ -28,7 +28,6 @@
     # Tests will fail with a 404 starting from microversion 2.36:
     # See the following link for details:
     # https://developer.openstack.org/api-ref/compute/#floating-ips-bulk-os-floating-ips-bulk-deprecated
-    min_microversion = '2.10'
     max_microversion = '2.35'
 
     @classmethod
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 e6de908..764d165 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
@@ -28,7 +28,6 @@
     # Tests will fail with a 404 starting from microversion 2.36:
     # See the following link for details:
     # https://developer.openstack.org/api-ref/compute/#floating-ips-os-floating-ips-deprecated
-    min_microversion = '2.10'
     max_microversion = '2.35'
 
     @classmethod
diff --git a/patrole_tempest_plugin/tests/api/compute/test_images_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_images_rbac.py
index 39a87ed..3d66f2e 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_images_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_images_rbac.py
@@ -17,6 +17,7 @@
 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 patrole_tempest_plugin import rbac_rule_validation
 from patrole_tempest_plugin.tests.api.compute import rbac_base
@@ -24,7 +25,7 @@
 CONF = config.CONF
 
 
-class ImagesV235RbacTest(rbac_base.BaseV2ComputeRbacTest):
+class ImagesRbacTest(rbac_base.BaseV2ComputeRbacTest):
     """RBAC tests for the Nova images client.
 
     These APIs are proxy calls to the Image service. Consequently, no nova
@@ -34,31 +35,39 @@
     """
 
     # These tests will fail with a 404 starting from microversion 2.36.
-    min_microversion = '2.10'
+    # See the following link for details:
+    # https://developer.openstack.org/api-ref/compute/#images-deprecated
     max_microversion = '2.35'
 
     @classmethod
     def skip_checks(cls):
-        super(ImagesV235RbacTest, cls).skip_checks()
+        super(ImagesRbacTest, cls).skip_checks()
         if not CONF.service_available.glance:
             skip_msg = ("%s skipped as glance is not available" % cls.__name__)
             raise cls.skipException(skip_msg)
 
     @classmethod
     def setup_clients(cls):
-        super(ImagesV235RbacTest, cls).setup_clients()
-        cls.glance_image_client = cls.os_primary.image_client_v2
+        super(ImagesRbacTest, cls).setup_clients()
+        if CONF.image_feature_enabled.api_v1:
+            cls.glance_image_client = cls.os_primary.image_client
+        elif CONF.image_feature_enabled.api_v2:
+            cls.glance_image_client = cls.os_primary.image_client_v2
+        else:
+            raise lib_exc.InvalidConfiguration(
+                'Either api_v1 or api_v2 must be True in '
+                '[image-feature-enabled].')
 
     @classmethod
     def resource_setup(cls):
-        super(ImagesV235RbacTest, cls).resource_setup()
+        super(ImagesRbacTest, cls).resource_setup()
         cls.image = cls.glance_image_client.create_image(
             name=data_utils.rand_name(cls.__name__ + '-image'))
 
     @classmethod
     def resource_cleanup(cls):
         cls.glance_image_client.delete_image(cls.image['id'])
-        super(ImagesV235RbacTest, cls).resource_cleanup()
+        super(ImagesRbacTest, cls).resource_cleanup()
 
     @decorators.idempotent_id('b861f302-b72b-4055-81db-c62ff30b136d')
     @rbac_rule_validation.action(
diff --git a/patrole_tempest_plugin/tests/api/compute/test_multinic_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_multinic_rbac.py
index ca0ee26..e409269 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_multinic_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_multinic_rbac.py
@@ -22,14 +22,11 @@
 CONF = config.CONF
 
 
-class MultinicV210RbacTest(rbac_base.BaseV2ComputeRbacTest):
-
-    min_microversion = '2.10'
-    max_microversion = '2.36'
+class MultinicRbacTest(rbac_base.BaseV2ComputeRbacTest):
 
     @classmethod
     def skip_checks(cls):
-        super(MultinicV210RbacTest, cls).skip_checks()
+        super(MultinicRbacTest, cls).skip_checks()
         if not CONF.service_available.neutron:
             raise cls.skipException("Neutron is required")
         if not CONF.compute_feature_enabled.interface_attach:
@@ -39,11 +36,11 @@
     def setup_credentials(cls):
         # This test class requires network and subnet
         cls.set_network_resources(network=True, subnet=True)
-        super(MultinicV210RbacTest, cls).setup_credentials()
+        super(MultinicRbacTest, cls).setup_credentials()
 
     @classmethod
     def resource_setup(cls):
-        super(MultinicV210RbacTest, cls).resource_setup()
+        super(MultinicRbacTest, cls).resource_setup()
         cls.server = cls.create_test_server(wait_until='ACTIVE')
 
     @rbac_rule_validation.action(
diff --git a/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py
index 505ec18..a2ae8e5 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py
@@ -13,6 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+from tempest.common import waiters
 from tempest.lib import decorators
 
 from patrole_tempest_plugin import rbac_rule_validation
@@ -40,8 +41,12 @@
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         volume = self.volumes_extensions_client.create_volume(
             size=CONF.volume.volume_size)['volume']
-        self.addCleanup(self.volumes_extensions_client.delete_volume,
-                        volume['id'])
+        # Use the admin volumes client to wait, because waiting involves
+        # calling show API action which enforces a different policy.
+        waiters.wait_for_volume_resource_status(self.os_admin.volumes_client,
+                                                volume['id'], 'available')
+        # Use non-deprecated volumes_client for deletion.
+        self.addCleanup(self.volumes_client.delete_volume, volume['id'])
 
     @decorators.idempotent_id('69b3888c-dff2-47b0-9fa4-0672619c9054')
     @rbac_rule_validation.action(
diff --git a/requirements.txt b/requirements.txt
index 6d2c7f1..6871057 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,5 +6,6 @@
 urllib3>=1.15.1 # MIT
 oslo.log>=3.11.0 # Apache-2.0
 oslo.config>=3.22.0  # Apache-2.0
+oslo.policy>=1.17.0  # Apache-2.0
 tempest>=14.0.0  # Apache-2.0
 stevedore>=1.20.0  # Apache-2.0