Merge "Decrease overall run time when identity auth is set to v3."
diff --git a/patrole_tempest_plugin/tests/api/compute/rbac_base.py b/patrole_tempest_plugin/tests/api/compute/rbac_base.py
index 4243bdd..625b5cf 100644
--- a/patrole_tempest_plugin/tests/api/compute/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/compute/rbac_base.py
@@ -36,9 +36,9 @@
     @classmethod
     def setup_clients(cls):
         super(BaseV2ComputeRbacTest, cls).setup_clients()
-        cls.admin_client = cls.os_admin.agents_client
         cls.auth_provider = cls.os.auth_provider
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
 
 class BaseV2ComputeAdminRbacTest(compute_base.BaseV2ComputeAdminTest):
@@ -55,9 +55,9 @@
     @classmethod
     def setup_clients(cls):
         super(BaseV2ComputeAdminRbacTest, cls).setup_clients()
-        cls.admin_client = cls.os_admin.agents_client
         cls.auth_provider = cls.os.auth_provider
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
     @classmethod
     def resource_setup(cls):
diff --git a/patrole_tempest_plugin/tests/api/compute/test_instance_actions.py b/patrole_tempest_plugin/tests/api/compute/test_instance_actions_rbac.py
similarity index 87%
rename from patrole_tempest_plugin/tests/api/compute/test_instance_actions.py
rename to patrole_tempest_plugin/tests/api/compute/test_instance_actions_rbac.py
index a1f12d6..e35f60c 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_instance_actions.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_instance_actions_rbac.py
@@ -13,14 +13,12 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-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
 
-CONF = config.CONF
-
 
 class InstanceActionsRbacTest(rbac_base.BaseV2ComputeRbacTest):
 
@@ -32,9 +30,9 @@
     @classmethod
     def skip_checks(cls):
         super(InstanceActionsRbacTest, cls).skip_checks()
-        if not CONF.compute_feature_enabled.api_extensions:
+        if not test.is_extension_enabled('os-instance-actions', 'compute'):
             raise cls.skipException(
-                '%s skipped as no compute extensions enabled' % cls.__name__)
+                '%s skipped as os-instance-actions not enabled' % cls.__name__)
 
     @classmethod
     def resource_setup(cls):
@@ -51,6 +49,7 @@
         service="nova",
         rule="os_compute_api:os-instance-actions")
     def test_list_instance_actions(self):
+        self.rbac_utils.switch_role(self, switchToRbacRole=True)
         self.client.list_instance_actions(self.server['id'])
 
     @decorators.idempotent_id('eb04c439-4215-4029-9ccb-5b3c041bfc25')
@@ -58,5 +57,6 @@
         service="nova",
         rule="os_compute_api:os-instance-actions:events")
     def test_get_instance_action(self):
+        self.rbac_utils.switch_role(self, switchToRbacRole=True)
         self.client.show_instance_action(
             self.server['id'], self.request_id)['instanceAction']
diff --git a/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py b/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py
index 77afed5..ffee5c0 100644
--- a/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/identity/v2/rbac_base.py
@@ -38,10 +38,10 @@
     def setup_clients(cls):
         super(BaseIdentityV2AdminRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.identity_client
         cls.tenants_client = cls.os.tenants_client
         cls.users_client = cls.os.users_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
     def _create_service(self):
         name = data_utils.rand_name('service')
diff --git a/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py b/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
index bad53b3..7a67459 100644
--- a/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/identity/v3/rbac_base.py
@@ -38,13 +38,13 @@
     def setup_clients(cls):
         super(BaseIdentityV3RbacAdminTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.identity_v3_client
         cls.creds_client = cls.os.credentials_client
         cls.services_client = cls.os.identity_services_v3_client
         cls.endpoints_client = cls.os.endpoints_v3_client
         cls.groups_client = cls.os.groups_client
         cls.policies_client = cls.os.policies_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
     def _create_service(self):
         """Creates a service for test."""
diff --git a/patrole_tempest_plugin/tests/api/image/rbac_base.py b/patrole_tempest_plugin/tests/api/image/rbac_base.py
index 3570b81..b4fed7d 100644
--- a/patrole_tempest_plugin/tests/api/image/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/image/rbac_base.py
@@ -34,8 +34,8 @@
     def setup_clients(cls):
         super(BaseV1ImageRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.image_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
 
 class BaseV2ImageRbacTest(image_base.BaseV2ImageTest):
@@ -53,5 +53,5 @@
     def setup_clients(cls):
         super(BaseV2ImageRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.image_client_v2
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
diff --git a/patrole_tempest_plugin/tests/api/network/rbac_base.py b/patrole_tempest_plugin/tests/api/network/rbac_base.py
index 5beedc2..de5ed88 100644
--- a/patrole_tempest_plugin/tests/api/network/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/network/rbac_base.py
@@ -36,5 +36,5 @@
     def setup_clients(cls):
         super(BaseNetworkRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.agents_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
diff --git a/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py b/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py
index e892a02..f90decc 100644
--- a/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/orchestration/rbac_base.py
@@ -34,8 +34,8 @@
     def setup_clients(cls):
         super(BaseOrchestrationRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.orchestration_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
     def tearDown(self):
         self.rbac_utils.switch_role(self, switchToRbacRole=False)
diff --git a/patrole_tempest_plugin/tests/api/volume/admin/test_qos_rbac.py b/patrole_tempest_plugin/tests/api/volume/admin/test_qos_rbac.py
index 0d59f77..6e879f8 100644
--- a/patrole_tempest_plugin/tests/api/volume/admin/test_qos_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/admin/test_qos_rbac.py
@@ -28,7 +28,6 @@
     @classmethod
     def setup_clients(cls):
         super(VolumeQOSRbacTest, cls).setup_clients()
-        cls.admin_client = cls.os_adm.volume_qos_client
         cls.auth_provider = cls.os.auth_provider
         cls.client = cls.admin_volume_qos_client
 
diff --git a/patrole_tempest_plugin/tests/api/volume/rbac_base.py b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
index 6d1ad16..c762473 100644
--- a/patrole_tempest_plugin/tests/api/volume/rbac_base.py
+++ b/patrole_tempest_plugin/tests/api/volume/rbac_base.py
@@ -34,8 +34,8 @@
     def setup_clients(cls):
         super(BaseVolumeRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.volumes_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
 
 
 class BaseVolumeAdminRbacTest(vol_base.BaseVolumeAdminTest):
@@ -53,8 +53,8 @@
     def setup_clients(cls):
         super(BaseVolumeAdminRbacTest, cls).setup_clients()
         cls.auth_provider = cls.os.auth_provider
-        cls.admin_client = cls.os_adm.volumes_client
         cls.rbac_utils = rbac_utils()
+        cls.rbac_utils.switch_role(cls, switchToRbacRole=False)
         version_checker = {
             1: [cls.os.volume_hosts_client, cls.os.volume_types_client],
             2: [cls.os.volume_hosts_v2_client, cls.os.volume_types_v2_client]