Merge "Change manila_tempest_tests to use credentials_factory"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 22a2e3c..63b3211 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -36,7 +36,7 @@
                help="The minimum api microversion is configured to be the "
                     "value of the minimum microversion supported by Manila."),
     cfg.StrOpt("max_api_microversion",
-               default="2.6",
+               default="2.7",
                help="The maximum api microversion is configured to be the "
                     "value of the latest microversion supported by Manila."),
     cfg.StrOpt("region",
diff --git a/manila_tempest_tests/services/share/v2/json/shares_client.py b/manila_tempest_tests/services/share/v2/json/shares_client.py
index b61d526..877a82f 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -96,14 +96,20 @@
         return super(SharesV2Client, self).copy(url, headers=headers)
 
     def reset_state(self, s_id, status="error", s_type="shares",
-                    headers=None, version=LATEST_MICROVERSION):
+                    headers=None, version=LATEST_MICROVERSION,
+                    action_name=None):
         """Resets the state of a share, snapshot, cg, or a cgsnapshot.
 
         status: available, error, creating, deleting, error_deleting
         s_type: shares, share_instances, snapshots, consistency-groups,
             cgsnapshots.
         """
-        body = {"os-reset_status": {"status": status}}
+        if action_name is None:
+            if float(version) > 2.6:
+                action_name = 'reset_status'
+            else:
+                action_name = 'os-reset_status'
+        body = {action_name: {"status": status}}
         body = json.dumps(body)
         resp, body = self.post("%s/%s/action" % (s_type, s_id), body,
                                headers=headers, extra_headers=True,
@@ -112,12 +118,17 @@
         return body
 
     def force_delete(self, s_id, s_type="shares", headers=None,
-                     version=LATEST_MICROVERSION):
+                     version=LATEST_MICROVERSION, action_name=None):
         """Force delete share or snapshot.
 
         s_type: shares, snapshots
         """
-        body = {"os-force_delete": None}
+        if action_name is None:
+            if float(version) > 2.6:
+                action_name = 'force_delete'
+            else:
+                action_name = 'os-force_delete'
+        body = {action_name: None}
         body = json.dumps(body)
         resp, body = self.post("%s/%s/action" % (s_type, s_id), body,
                                headers=headers, extra_headers=True,
@@ -278,6 +289,267 @@
 
 ###############
 
+    def extend_share(self, share_id, new_size, version=LATEST_MICROVERSION,
+                     action_name=None):
+        if action_name is None:
+            action_name = 'extend' if float(version) > 2.6 else 'os-extend'
+        post_body = {
+            action_name: {
+                "new_size": new_size,
+            }
+        }
+        body = json.dumps(post_body)
+        resp, body = self.post(
+            "shares/%s/action" % share_id, body, version=version)
+        self.expected_success(202, resp.status)
+        return body
+
+    def shrink_share(self, share_id, new_size, version=LATEST_MICROVERSION,
+                     action_name=None):
+        if action_name is None:
+            action_name = 'shrink' if float(version) > 2.6 else 'os-shrnk'
+        post_body = {
+            action_name: {
+                "new_size": new_size,
+            }
+        }
+        body = json.dumps(post_body)
+        resp, body = self.post(
+            "shares/%s/action" % share_id, body, version=version)
+        self.expected_success(202, resp.status)
+        return body
+
+###############
+
+    def manage_share(self, service_host, protocol, export_path,
+                     share_type_id, name=None, description=None,
+                     version=LATEST_MICROVERSION, url=None):
+        post_body = {
+            "share": {
+                "export_path": export_path,
+                "service_host": service_host,
+                "protocol": protocol,
+                "share_type": share_type_id,
+                "name": name,
+                "description": description,
+            }
+        }
+        if url is None:
+            if float(version) > 2.6:
+                url = 'shares/manage'
+            else:
+                url = 'os-share-manage'
+        body = json.dumps(post_body)
+        resp, body = self.post(url, body, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def unmanage_share(self, share_id, version=LATEST_MICROVERSION, url=None,
+                       action_name=None, body=None):
+        if url is None:
+            url = 'shares' if float(version) > 2.6 else 'os-share-unmanage'
+        if action_name is None:
+            action_name = 'action' if float(version) > 2.6 else 'unmanage'
+        if body is None and float(version) > 2.6:
+            body = json.dumps({'unmanage': {}})
+        resp, body = self.post(
+            "%(url)s/%(share_id)s/%(action_name)s" % {
+                'url': url, 'share_id': share_id, 'action_name': action_name},
+            body,
+            version=version)
+        self.expected_success(202, resp.status)
+        return body
+
+###############
+
+    def _get_access_action_name(self, version):
+        if float(version) > 2.6:
+            return 'allow_access'
+        return 'os-allow_access'
+
+    def create_access_rule(self, share_id, access_type="ip",
+                           access_to="0.0.0.0", access_level=None,
+                           version=LATEST_MICROVERSION, action_name=None):
+        post_body = {
+            self._get_access_action_name(version): {
+                "access_type": access_type,
+                "access_to": access_to,
+                "access_level": access_level,
+            }
+        }
+        body = json.dumps(post_body)
+        resp, body = self.post(
+            "shares/%s/action" % share_id, body, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def list_access_rules(self, share_id, version=LATEST_MICROVERSION,
+                          action_name=None):
+        body = {self._get_access_action_name(version): None}
+        resp, body = self.post(
+            "shares/%s/action" % share_id, json.dumps(body), version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def delete_access_rule(self, share_id, rule_id,
+                           version=LATEST_MICROVERSION, action_name=None):
+        post_body = {
+            self._get_access_action_name(version): {
+                "access_id": rule_id,
+            }
+        }
+        body = json.dumps(post_body)
+        resp, body = self.post(
+            "shares/%s/action" % share_id, body, version=version)
+        self.expected_success(202, resp.status)
+        return body
+
+###############
+
+    def list_availability_zones(self, url='availability-zones',
+                                version=LATEST_MICROVERSION):
+        """Get list of availability zones."""
+        if url is None:
+            if float(version) > 2.6:
+                url = 'availability-zones'
+            else:
+                url = 'os-availability-zone'
+        resp, body = self.get(url, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+###############
+
+    def list_services(self, params=None, url=None,
+                      version=LATEST_MICROVERSION):
+        """List services."""
+        if url is None:
+            url = 'services' if float(version) > 2.6 else 'os-services'
+        if params:
+            url += '?%s' % urllib.urlencode(params)
+        resp, body = self.get(url, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+###############
+
+    def list_share_types(self, params=None, version=LATEST_MICROVERSION):
+        uri = 'types'
+        if params is not None:
+            uri += '?%s' % urllib.urlencode(params)
+        resp, body = self.get(uri, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def create_share_type(self, name, is_public=True,
+                          version=LATEST_MICROVERSION, **kwargs):
+        if float(version) > 2.6:
+            is_public_keyname = 'share_type_access:is_public'
+        else:
+            is_public_keyname = 'os-share-type-access:is_public'
+        post_body = {
+            'name': name,
+            'extra_specs': kwargs.get('extra_specs'),
+            is_public_keyname: is_public,
+        }
+        post_body = json.dumps({'share_type': post_body})
+        resp, body = self.post('types', post_body, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def delete_share_type(self, share_type_id, version=LATEST_MICROVERSION):
+        resp, body = self.delete("types/%s" % share_type_id, version=version)
+        self.expected_success(202, resp.status)
+        return body
+
+    def get_share_type(self, share_type_id, version=LATEST_MICROVERSION):
+        resp, body = self.get("types/%s" % share_type_id, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def list_access_to_share_type(self, share_type_id,
+                                  version=LATEST_MICROVERSION,
+                                  action_name=None):
+        if action_name is None:
+            if float(version) > 2.6:
+                action_name = 'share_type_access'
+            else:
+                action_name = 'os-share-type-access'
+        url = 'types/%(st_id)s/%(action_name)s' % {
+            'st_id': share_type_id, 'action_name': action_name}
+        resp, body = self.get(url, version=version)
+        # [{"share_type_id": "%st_id%", "project_id": "%project_id%"}, ]
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+###############
+
+    def _get_quotas_url(self, version):
+        if float(version) > 2.6:
+            return 'quota-sets'
+        return 'os-quota-sets'
+
+    def default_quotas(self, tenant_id, url=None, version=LATEST_MICROVERSION):
+        if url is None:
+            url = self._get_quotas_url(version)
+        url += '/%s' % tenant_id
+        resp, body = self.get("%s/defaults" % url, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def show_quotas(self, tenant_id, user_id=None, url=None,
+                    version=LATEST_MICROVERSION):
+        if url is None:
+            url = self._get_quotas_url(version)
+        url += '/%s' % tenant_id
+        if user_id is not None:
+            url += "?user_id=%s" % user_id
+        resp, body = self.get(url, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+    def reset_quotas(self, tenant_id, user_id=None, url=None,
+                     version=LATEST_MICROVERSION):
+        if url is None:
+            url = self._get_quotas_url(version)
+        url += '/%s' % tenant_id
+        if user_id is not None:
+            url += "?user_id=%s" % user_id
+        resp, body = self.delete(url, version=version)
+        self.expected_success(202, resp.status)
+        return body
+
+    def update_quotas(self, tenant_id, user_id=None, shares=None,
+                      snapshots=None, gigabytes=None, snapshot_gigabytes=None,
+                      share_networks=None, force=True, url=None,
+                      version=LATEST_MICROVERSION):
+        if url is None:
+            url = self._get_quotas_url(version)
+        url += '/%s' % tenant_id
+        if user_id is not None:
+            url += "?user_id=%s" % user_id
+
+        put_body = {"tenant_id": tenant_id}
+        if force:
+            put_body["force"] = "true"
+        if shares is not None:
+            put_body["shares"] = shares
+        if snapshots is not None:
+            put_body["snapshots"] = snapshots
+        if gigabytes is not None:
+            put_body["gigabytes"] = gigabytes
+        if snapshot_gigabytes is not None:
+            put_body["snapshot_gigabytes"] = snapshot_gigabytes
+        if share_networks is not None:
+            put_body["share_networks"] = share_networks
+        put_body = json.dumps({"quota_set": put_body})
+
+        resp, body = self.put(url, put_body, version=version)
+        self.expected_success(200, resp.status)
+        return self._parse_resp(body)
+
+###############
+
     def create_consistency_group(self, name=None, description=None,
                                  share_type_ids=(), share_network_id=None,
                                  source_cgsnapshot_id=None,
@@ -481,9 +753,15 @@
 
 ###############
 
-    def migrate_share(self, share_id, host, version=LATEST_MICROVERSION):
+    def migrate_share(self, share_id, host, version=LATEST_MICROVERSION,
+                      action_name=None):
+        if action_name is None:
+            if float(version) > 2.6:
+                action_name = 'migrate_share'
+            else:
+                action_name = 'os-migrate_share'
         post_body = {
-            'os-migrate_share': {
+            action_name: {
                 'host': host,
             }
         }
diff --git a/manila_tempest_tests/tests/api/admin/test_consistency_group_actions.py b/manila_tempest_tests/tests/api/admin/test_consistency_group_actions.py
index d5142b6..c057c36 100644
--- a/manila_tempest_tests/tests/api/admin/test_consistency_group_actions.py
+++ b/manila_tempest_tests/tests/api/admin/test_consistency_group_actions.py
@@ -70,31 +70,16 @@
     def test_create_cg_from_multi_typed_populated_cgsnapshot_v2_4(self):
         share_name = data_utils.rand_name("tempest-share-name")
         share_desc = data_utils.rand_name("tempest-share-description")
-        share_size = 1
-        share = self.create_share(
-            cleanup_in_class=False,
-            name=share_name,
-            description=share_desc,
-            size=share_size,
-            consistency_group_id=self.consistency_group['id'],
-            share_type_id=self.share_type['id'],
-            client=self.shares_v2_client,
-            version='2.4',
-        )
 
-        share_name2 = data_utils.rand_name("tempest-share-name")
-        share_desc2 = data_utils.rand_name("tempest-share-description")
-        share_size2 = 1
-        share2 = self.create_share(
-            cleanup_in_class=False,
-            name=share_name2,
-            description=share_desc2,
-            size=share_size2,
-            consistency_group_id=self.consistency_group['id'],
-            share_type_id=self.share_type2['id'],
-            client=self.shares_v2_client,
-            version='2.4',
-        )
+        shares = self.create_shares([
+            {'kwargs': {
+                'cleanup_in_class': False,
+                'name': share_name,
+                'description': share_desc,
+                'consistency_group_id': self.consistency_group['id'],
+                'share_type_id': st_id,
+            }} for st_id in (self.share_type['id'], self.share_type2['id'])
+        ])
 
         cg_shares = self.shares_v2_client.list_shares(
             detailed=True,
@@ -103,7 +88,7 @@
         )
 
         cg_share_ids = [s['id'] for s in cg_shares]
-        for share_id in [share['id'], share2['id']]:
+        for share_id in (shares[0]['id'], shares[1]['id']):
             self.assertIn(share_id, cg_share_ids, 'Share %s not in '
                                                   'consistency group %s.' %
                           (share_id, self.consistency_group['id']))
diff --git a/manila_tempest_tests/tests/api/admin/test_quotas.py b/manila_tempest_tests/tests/api/admin/test_quotas.py
index dd7164e..d8aa4d6 100644
--- a/manila_tempest_tests/tests/api/admin/test_quotas.py
+++ b/manila_tempest_tests/tests/api/admin/test_quotas.py
@@ -28,12 +28,12 @@
     def resource_setup(cls):
         cls.os = clients.AdminManager()
         super(SharesAdminQuotasTest, cls).resource_setup()
-        cls.user_id = cls.shares_client.user_id
-        cls.tenant_id = cls.shares_client.tenant_id
+        cls.user_id = cls.shares_v2_client.user_id
+        cls.tenant_id = cls.shares_v2_client.tenant_id
 
     @test.attr(type=["gate", "smoke", ])
     def test_default_quotas(self):
-        quotas = self.shares_client.default_quotas(self.tenant_id)
+        quotas = self.shares_v2_client.default_quotas(self.tenant_id)
         self.assertGreater(int(quotas["gigabytes"]), -2)
         self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
         self.assertGreater(int(quotas["shares"]), -2)
@@ -42,7 +42,7 @@
 
     @test.attr(type=["gate", "smoke", ])
     def test_show_quotas(self):
-        quotas = self.shares_client.show_quotas(self.tenant_id)
+        quotas = self.shares_v2_client.show_quotas(self.tenant_id)
         self.assertGreater(int(quotas["gigabytes"]), -2)
         self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
         self.assertGreater(int(quotas["shares"]), -2)
@@ -51,7 +51,8 @@
 
     @test.attr(type=["gate", "smoke", ])
     def test_show_quotas_for_user(self):
-        quotas = self.shares_client.show_quotas(self.tenant_id, self.user_id)
+        quotas = self.shares_v2_client.show_quotas(
+            self.tenant_id, self.user_id)
         self.assertGreater(int(quotas["gigabytes"]), -2)
         self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
         self.assertGreater(int(quotas["shares"]), -2)
@@ -62,159 +63,145 @@
 class SharesAdminQuotasUpdateTest(base.BaseSharesAdminTest):
 
     force_tenant_isolation = True
+    client_version = '2'
+
+    def setUp(self):
+        super(self.__class__, self).setUp()
+        self.client = self.get_client_with_isolated_creds(
+            client_version=self.client_version)
+        self.tenant_id = self.client.tenant_id
+        self.user_id = self.client.user_id
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_tenant_quota_shares(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
         new_quota = int(quotas["shares"]) + 2
 
         # set new quota for shares
-        updated = client.update_quotas(client.tenant_id, shares=new_quota)
+        updated = self.client.update_quotas(self.tenant_id, shares=new_quota)
         self.assertEqual(int(updated["shares"]), new_quota)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_user_quota_shares(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
         new_quota = int(quotas["shares"]) - 1
 
         # set new quota for shares
-        updated = client.update_quotas(
-            client.tenant_id, client.user_id, shares=new_quota)
+        updated = self.client.update_quotas(
+            self.tenant_id, self.user_id, shares=new_quota)
         self.assertEqual(int(updated["shares"]), new_quota)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_tenant_quota_snapshots(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
         new_quota = int(quotas["snapshots"]) + 2
 
         # set new quota for snapshots
-        updated = client.update_quotas(client.tenant_id, snapshots=new_quota)
+        updated = self.client.update_quotas(
+            self.tenant_id, snapshots=new_quota)
         self.assertEqual(int(updated["snapshots"]), new_quota)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_user_quota_snapshots(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
         new_quota = int(quotas["snapshots"]) - 1
 
         # set new quota for snapshots
-        updated = client.update_quotas(
-            client.tenant_id, client.user_id, snapshots=new_quota)
+        updated = self.client.update_quotas(
+            self.tenant_id, self.user_id, snapshots=new_quota)
         self.assertEqual(int(updated["snapshots"]), new_quota)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_tenant_quota_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        custom = client.show_quotas(client.tenant_id)
+        custom = self.client.show_quotas(self.tenant_id)
 
         # make quotas for update
         gigabytes = int(custom["gigabytes"]) + 2
 
         # set new quota for shares
-        updated = client.update_quotas(
-            client.tenant_id, gigabytes=gigabytes)
+        updated = self.client.update_quotas(
+            self.tenant_id, gigabytes=gigabytes)
         self.assertEqual(int(updated["gigabytes"]), gigabytes)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_tenant_quota_snapshot_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        custom = client.show_quotas(client.tenant_id)
+        custom = self.client.show_quotas(self.tenant_id)
 
         # make quotas for update
         snapshot_gigabytes = int(custom["snapshot_gigabytes"]) + 2
 
         # set new quota for shares
-        updated = client.update_quotas(
-            client.tenant_id,
+        updated = self.client.update_quotas(
+            self.tenant_id,
             snapshot_gigabytes=snapshot_gigabytes)
         self.assertEqual(
             int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_user_quota_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        custom = client.show_quotas(client.tenant_id, client.user_id)
+        custom = self.client.show_quotas(self.tenant_id, self.user_id)
 
         # make quotas for update
         gigabytes = int(custom["gigabytes"]) - 1
 
         # set new quota for shares
-        updated = client.update_quotas(
-            client.tenant_id, client.user_id,
-            gigabytes=gigabytes)
+        updated = self.client.update_quotas(
+            self.tenant_id, self.user_id, gigabytes=gigabytes)
         self.assertEqual(int(updated["gigabytes"]), gigabytes)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_user_quota_snapshot_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        custom = client.show_quotas(client.tenant_id, client.user_id)
+        custom = self.client.show_quotas(self.tenant_id, self.user_id)
 
         # make quotas for update
         snapshot_gigabytes = int(custom["snapshot_gigabytes"]) - 1
 
         # set new quota for shares
-        updated = client.update_quotas(
-            client.tenant_id, client.user_id,
+        updated = self.client.update_quotas(
+            self.tenant_id, self.user_id,
             snapshot_gigabytes=snapshot_gigabytes)
         self.assertEqual(
             int(updated["snapshot_gigabytes"]), snapshot_gigabytes)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_tenant_quota_share_networks(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
         new_quota = int(quotas["share_networks"]) + 2
 
         # set new quota for share-networks
-        updated = client.update_quotas(
-            client.tenant_id, share_networks=new_quota)
+        updated = self.client.update_quotas(
+            self.tenant_id, share_networks=new_quota)
         self.assertEqual(int(updated["share_networks"]), new_quota)
 
     @test.attr(type=["gate", "smoke", ])
     def test_update_user_quota_share_networks(self):
-        client = self.get_client_with_isolated_creds()
-
         # get current quotas
-        quotas = client.show_quotas(
-            client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(
+            self.tenant_id, self.user_id)
         new_quota = int(quotas["share_networks"]) - 1
 
         # set new quota for share-networks
-        updated = client.update_quotas(
-            client.tenant_id, client.user_id,
+        updated = self.client.update_quotas(
+            self.tenant_id, self.user_id,
             share_networks=new_quota)
         self.assertEqual(int(updated["share_networks"]), new_quota)
 
     @test.attr(type=["gate", "smoke", ])
     def test_reset_tenant_quotas(self):
-        client = self.get_client_with_isolated_creds()
-
         # get default_quotas
-        default = client.default_quotas(client.tenant_id)
+        default = self.client.default_quotas(self.tenant_id)
 
         # get current quotas
-        custom = client.show_quotas(client.tenant_id)
+        custom = self.client.show_quotas(self.tenant_id)
 
         # make quotas for update
         shares = int(custom["shares"]) + 2
@@ -224,8 +211,8 @@
         share_networks = int(custom["share_networks"]) + 2
 
         # set new quota
-        updated = client.update_quotas(
-            client.tenant_id,
+        updated = self.client.update_quotas(
+            self.tenant_id,
             shares=shares,
             snapshots=snapshots,
             gigabytes=gigabytes,
@@ -239,10 +226,10 @@
         self.assertEqual(int(updated["share_networks"]), share_networks)
 
         # reset customized quotas
-        client.reset_quotas(client.tenant_id)
+        self.client.reset_quotas(self.tenant_id)
 
         # verify quotas
-        reseted = client.show_quotas(client.tenant_id)
+        reseted = self.client.show_quotas(self.tenant_id)
         self.assertEqual(int(reseted["shares"]), int(default["shares"]))
         self.assertEqual(int(reseted["snapshots"]), int(default["snapshots"]))
         self.assertEqual(int(reseted["gigabytes"]), int(default["gigabytes"]))
@@ -251,101 +238,86 @@
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_quota_for_shares(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(client.tenant_id, shares=-1)
+        self.client.update_quotas(self.tenant_id, shares=-1)
 
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
 
         self.assertEqual(-1, quotas.get('shares'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_user_quota_for_shares(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(
-            client.tenant_id, client.user_id,
-            shares=-1)
+        self.client.update_quotas(
+            self.tenant_id, self.user_id, shares=-1)
 
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
 
         self.assertEqual(-1, quotas.get('shares'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_quota_for_snapshots(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(client.tenant_id, snapshots=-1)
+        self.client.update_quotas(self.tenant_id, snapshots=-1)
 
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
 
         self.assertEqual(-1, quotas.get('snapshots'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_user_quota_for_snapshots(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(
-            client.tenant_id, client.user_id,
-            snapshots=-1)
+        self.client.update_quotas(
+            self.tenant_id, self.user_id, snapshots=-1)
 
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
 
         self.assertEqual(-1, quotas.get('snapshots'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_quota_for_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(client.tenant_id, gigabytes=-1)
+        self.client.update_quotas(self.tenant_id, gigabytes=-1)
 
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
 
         self.assertEqual(-1, quotas.get('gigabytes'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_quota_for_snapshot_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(
-            client.tenant_id, snapshot_gigabytes=-1)
+        self.client.update_quotas(
+            self.tenant_id, snapshot_gigabytes=-1)
 
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
 
         self.assertEqual(-1, quotas.get('snapshot_gigabytes'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_user_quota_for_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(
-            client.tenant_id, client.user_id,
-            gigabytes=-1)
+        self.client.update_quotas(
+            self.tenant_id, self.user_id, gigabytes=-1)
 
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
 
         self.assertEqual(-1, quotas.get('gigabytes'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_user_quota_for_snapshot_gigabytes(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(
-            client.tenant_id, client.user_id,
-            snapshot_gigabytes=-1)
+        self.client.update_quotas(
+            self.tenant_id, self.user_id, snapshot_gigabytes=-1)
 
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
 
         self.assertEqual(-1, quotas.get('snapshot_gigabytes'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_quota_for_share_networks(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(client.tenant_id, share_networks=-1)
+        self.client.update_quotas(self.tenant_id, share_networks=-1)
 
-        quotas = client.show_quotas(client.tenant_id)
+        quotas = self.client.show_quotas(self.tenant_id)
 
         self.assertEqual(-1, quotas.get('share_networks'))
 
     @test.attr(type=["gate", "smoke", ])
     def test_unlimited_user_quota_for_share_networks(self):
-        client = self.get_client_with_isolated_creds()
-        client.update_quotas(
-            client.tenant_id, client.user_id,
-            share_networks=-1)
+        self.client.update_quotas(
+            self.tenant_id, self.user_id, share_networks=-1)
 
-        quotas = client.show_quotas(client.tenant_id, client.user_id)
+        quotas = self.client.show_quotas(self.tenant_id, self.user_id)
 
         self.assertEqual(-1, quotas.get('share_networks'))
diff --git a/manila_tempest_tests/tests/api/admin/test_services.py b/manila_tempest_tests/tests/api/admin/test_services.py
index 4b4085c..10df866 100644
--- a/manila_tempest_tests/tests/api/admin/test_services.py
+++ b/manila_tempest_tests/tests/api/admin/test_services.py
@@ -13,11 +13,13 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from tempest import test  # noqa
+import ddt
+from tempest import test
 
 from manila_tempest_tests.tests.api import base
 
 
+@ddt.ddt
 class ServicesAdminTest(base.BaseSharesAdminTest):
 
     def setUp(self):
@@ -25,60 +27,67 @@
         self.services = self.shares_client.list_services()
 
     @test.attr(type=["gate", "smoke", ])
-    def test_list_services(self):
-        services = self.shares_client.list_services()
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_list_services(self, client_name):
+        services = getattr(self, client_name).list_services()
         self.assertNotEqual(0, len(services))
 
         for service in services:
             self.assertIsNotNone(service['id'])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_get_services_by_host_name(self):
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_get_services_by_host_name(self, client_name):
         host = self.services[0]["host"]
         params = {"host": host}
-        services = self.shares_client.list_services(params)
+        services = getattr(self, client_name).list_services(params)
         self.assertNotEqual(0, len(services))
         for service in services:
             self.assertEqual(host, service["host"])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_get_services_by_binary_name(self):
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_get_services_by_binary_name(self, client_name):
         binary = self.services[0]["binary"]
         params = {"binary": binary, }
-        services = self.shares_client.list_services(params)
+        services = getattr(self, client_name).list_services(params)
         self.assertNotEqual(0, len(services))
         for service in services:
             self.assertEqual(binary, service["binary"])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_get_services_by_availability_zone(self):
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_get_services_by_availability_zone(self, client_name):
         zone = self.services[0]["zone"]
         params = {"zone": zone, }
-        services = self.shares_client.list_services(params)
+        services = getattr(self, client_name).list_services(params)
         self.assertNotEqual(0, len(services))
         for service in services:
             self.assertEqual(zone, service["zone"])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_get_services_by_status(self):
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_get_services_by_status(self, client_name):
         status = self.services[0]["status"]
         params = {"status": status, }
-        services = self.shares_client.list_services(params)
+        services = getattr(self, client_name).list_services(params)
         self.assertNotEqual(0, len(services))
         for service in services:
             self.assertEqual(status, service["status"])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_get_services_by_state(self):
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_get_services_by_state(self, client_name):
         state = self.services[0]["state"]
         params = {"state": state, }
-        services = self.shares_client.list_services(params)
+        services = getattr(self, client_name).list_services(params)
         self.assertNotEqual(0, len(services))
         for service in services:
             self.assertEqual(state, service["state"])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_get_services_by_all_filters(self):
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_get_services_by_all_filters(self, client_name):
         params = {
             "host": self.services[0]["host"],
             "binary": self.services[0]["binary"],
@@ -86,7 +95,7 @@
             "status": self.services[0]["status"],
             "state": self.services[0]["state"],
         }
-        services = self.shares_client.list_services(params)
+        services = getattr(self, client_name).list_services(params)
         self.assertNotEqual(0, len(services))
         for service in services:
             self.assertEqual(params["host"], service["host"])
diff --git a/manila_tempest_tests/tests/api/admin/test_services_negative.py b/manila_tempest_tests/tests/api/admin/test_services_negative.py
index 6ed0c05..07914d3 100644
--- a/manila_tempest_tests/tests/api/admin/test_services_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_services_negative.py
@@ -13,13 +13,15 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from tempest import test  # noqa
-from tempest_lib import exceptions as lib_exc  # noqa
+import ddt
+from tempest import test
+from tempest_lib import exceptions as lib_exc
 
 from manila_tempest_tests import clients_share as clients
 from manila_tempest_tests.tests.api import base
 
 
+@ddt.ddt
 class ServicesAdminNegativeTest(base.BaseSharesAdminTest):
 
     @classmethod
@@ -76,3 +78,18 @@
         params = {'state': 'fake_state'}
         services_fake = self.shares_client.list_services(params)
         self.assertEqual(0, len(services_fake))
+
+    @test.attr(type=["gate", "smoke", "negative", ])
+    @ddt.data(
+        ('os-services', '2.7'),
+        ('services', '2.6'),
+        ('services', '2.0'),
+    )
+    @ddt.unpack
+    @base.skip_if_microversion_not_supported("2.7")
+    def test_list_services_with_wrong_versions(self, url, version):
+        self.assertRaises(
+            lib_exc.NotFound,
+            self.shares_v2_client.list_services,
+            version=version, url=url,
+        )
diff --git a/manila_tempest_tests/tests/api/admin/test_share_manage.py b/manila_tempest_tests/tests/api/admin/test_share_manage.py
index bb04dc7..78255ca 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_manage.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_manage.py
@@ -79,14 +79,13 @@
         cls.shares = cls.create_shares([creation_data, creation_data])
 
         # Load all share data (host, etc.)
-        cls.share1 = cls.shares_client.get_share(cls.shares[0]['id'])
-        cls.share2 = cls.shares_client.get_share(cls.shares[1]['id'])
+        cls.share1 = cls.shares_v2_client.get_share(cls.shares[0]['id'])
+        cls.share2 = cls.shares_v2_client.get_share(cls.shares[1]['id'])
 
         # Unmanage shares from manila
-        cls.shares_client.unmanage_share(cls.share1['id'])
-        cls.shares_client.wait_for_resource_deletion(share_id=cls.share1['id'])
-        cls.shares_client.unmanage_share(cls.share2['id'])
-        cls.shares_client.wait_for_resource_deletion(share_id=cls.share2['id'])
+        for share_id in (cls.share1['id'], cls.share2['id']):
+            cls.shares_v2_client.unmanage_share(share_id)
+            cls.shares_v2_client.wait_for_resource_deletion(share_id=share_id)
 
     @test.attr(type=["gate", "smoke"])
     def test_manage(self):
@@ -94,7 +93,7 @@
         description = "Description for 'managed' share"
 
         # Manage share
-        share = self.shares_client.manage_share(
+        share = self.shares_v2_client.manage_share(
             service_host=self.share1['host'],
             export_path=self.share1['export_locations'][0],
             protocol=self.share1['share_proto'],
@@ -109,7 +108,7 @@
                 'client': self.shares_client})
 
         # Wait for success
-        self.shares_client.wait_for_share_status(share['id'], 'available')
+        self.shares_v2_client.wait_for_share_status(share['id'], 'available')
 
         # Verify data of managed share
         get = self.shares_v2_client.get_share(share['id'], version="2.5")
@@ -123,10 +122,10 @@
         self.assertEqual(self.st['share_type']['id'], get['share_type'])
 
         # Delete share
-        self.shares_client.delete_share(share['id'])
-        self.shares_client.wait_for_resource_deletion(share_id=share['id'])
+        self.shares_v2_client.delete_share(share['id'])
+        self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
         self.assertRaises(lib_exc.NotFound,
-                          self.shares_client.get_share,
+                          self.shares_v2_client.get_share,
                           share['id'])
 
     @test.attr(type=["gate", "smoke"])
@@ -137,7 +136,7 @@
                       (self.st['share_type']['id'], 'available')]
 
         for share_type_id, status in parameters:
-            share = self.shares_client.manage_share(
+            share = self.shares_v2_client.manage_share(
                 service_host=self.share2['host'],
                 export_path=self.share2['export_locations'][0],
                 protocol=self.share2['share_proto'],
@@ -146,16 +145,16 @@
             # Add managed share to cleanup queue
             self.method_resources.insert(
                 0, {'type': 'share', 'id': share['id'],
-                    'client': self.shares_client})
+                    'client': self.shares_v2_client})
 
             # Wait for success
-            self.shares_client.wait_for_share_status(share['id'], status)
+            self.shares_v2_client.wait_for_share_status(share['id'], status)
 
         # Delete share
-        self.shares_client.delete_share(share['id'])
-        self.shares_client.wait_for_resource_deletion(share_id=share['id'])
+        self.shares_v2_client.delete_share(share['id'])
+        self.shares_v2_client.wait_for_resource_deletion(share_id=share['id'])
         self.assertRaises(lib_exc.NotFound,
-                          self.shares_client.get_share,
+                          self.shares_v2_client.get_share,
                           share['id'])
 
 
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types.py b/manila_tempest_tests/tests/api/admin/test_share_types.py
index ceed68b..d58c61c 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types.py
@@ -13,6 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import ddt
 from tempest import config  # noqa
 from tempest import test  # noqa
 from tempest_lib.common.utils import data_utils  # noqa
@@ -24,6 +25,7 @@
 CONF = config.CONF
 
 
+@ddt.ddt
 class ShareTypesAdminTest(base.BaseSharesAdminTest):
 
     @test.attr(type=["gate", "smoke", ])
@@ -32,53 +34,76 @@
         extra_specs = self.add_required_extra_specs_to_dict()
 
         # Create share type
-        st_create = self.shares_client.create_share_type(
+        st_create = self.shares_v2_client.create_share_type(
             name, extra_specs=extra_specs)
         self.assertEqual(name, st_create['share_type']['name'])
         st_id = st_create['share_type']['id']
 
         # Delete share type
-        self.shares_client.delete_share_type(st_id)
+        self.shares_v2_client.delete_share_type(st_id)
 
         # Verify deletion of share type
-        self.shares_client.wait_for_resource_deletion(st_id=st_id)
+        self.shares_v2_client.wait_for_resource_deletion(st_id=st_id)
         self.assertRaises(lib_exc.NotFound,
-                          self.shares_client.get_share_type,
+                          self.shares_v2_client.get_share_type,
                           st_id)
 
+    def _verify_is_public_key_name(self, share_type, version):
+        old_key_name = 'os-share-type-access:is_public'
+        new_key_name = 'share_type_access:is_public'
+        if float(version) > 2.6:
+            self.assertIn(new_key_name, share_type)
+            self.assertNotIn(old_key_name, share_type)
+        else:
+            self.assertIn(old_key_name, share_type)
+            self.assertNotIn(new_key_name, share_type)
+
     @test.attr(type=["gate", "smoke", ])
-    def test_share_type_create_get(self):
+    @ddt.data('2.0', '2.6', '2.7')
+    def test_share_type_create_get(self, version):
+        self.skip_if_microversion_not_supported(version)
+
         name = data_utils.rand_name("tempest-manila")
         extra_specs = self.add_required_extra_specs_to_dict({"key": "value", })
 
         # Create share type
-        st_create = self.create_share_type(name, extra_specs=extra_specs)
+        st_create = self.create_share_type(
+            name, extra_specs=extra_specs, version=version)
         self.assertEqual(name, st_create['share_type']['name'])
+        self._verify_is_public_key_name(st_create['share_type'], version)
         st_id = st_create["share_type"]["id"]
 
         # Get share type
-        get = self.shares_client.get_share_type(st_id)
+        get = self.shares_v2_client.get_share_type(st_id, version=version)
         self.assertEqual(name, get["share_type"]["name"])
         self.assertEqual(st_id, get["share_type"]["id"])
         self.assertEqual(extra_specs, get["share_type"]["extra_specs"])
+        self._verify_is_public_key_name(get['share_type'], version)
 
         # Check that backwards compatibility didn't break
         self.assertDictMatch(get["volume_type"], get["share_type"])
 
     @test.attr(type=["gate", "smoke", ])
-    def test_share_type_create_list(self):
+    @ddt.data('2.0', '2.6', '2.7')
+    def test_share_type_create_list(self, version):
+        self.skip_if_microversion_not_supported(version)
+
         name = data_utils.rand_name("tempest-manila")
         extra_specs = self.add_required_extra_specs_to_dict()
 
         # Create share type
-        st_create = self.create_share_type(name, extra_specs=extra_specs)
+        st_create = self.create_share_type(
+            name, extra_specs=extra_specs, version=version)
+        self._verify_is_public_key_name(st_create['share_type'], version)
         st_id = st_create["share_type"]["id"]
 
         # list share types
-        st_list = self.shares_client.list_share_types()
+        st_list = self.shares_v2_client.list_share_types(version=version)
         sts = st_list["share_types"]
         self.assertTrue(len(sts) >= 1)
         self.assertTrue(any(st_id in st["id"] for st in sts))
+        for st in sts:
+            self._verify_is_public_key_name(st, version)
 
         # Check that backwards compatibility didn't break
         vts = st_list["volume_types"]
@@ -128,16 +153,16 @@
         st_id = st_create["share_type"]["id"]
 
         # It should not be listed without access
-        st_list = self.shares_client.list_share_types()
+        st_list = self.shares_v2_client.list_share_types()
         sts = st_list["share_types"]
         self.assertFalse(any(st_id in st["id"] for st in sts))
 
         # List projects that have access for share type - none expected
-        access = self.shares_client.list_access_to_share_type(st_id)
+        access = self.shares_v2_client.list_access_to_share_type(st_id)
         self.assertEqual([], access)
 
         # Add project access to share type
-        access = self.shares_client.add_access_to_share_type(
+        access = self.shares_v2_client.add_access_to_share_type(
             st_id, project_id)
 
         # Now it should be listed
@@ -146,12 +171,12 @@
         self.assertTrue(any(st_id in st["id"] for st in sts))
 
         # List projects that have access for share type - one expected
-        access = self.shares_client.list_access_to_share_type(st_id)
+        access = self.shares_v2_client.list_access_to_share_type(st_id)
         expected = [{'share_type_id': st_id, 'project_id': project_id}, ]
         self.assertEqual(expected, access)
 
         # Remove project access from share type
-        access = self.shares_client.remove_access_from_share_type(
+        access = self.shares_v2_client.remove_access_from_share_type(
             st_id, project_id)
 
         # It should not be listed without access
@@ -160,5 +185,5 @@
         self.assertFalse(any(st_id in st["id"] for st in sts))
 
         # List projects that have access for share type - none expected
-        access = self.shares_client.list_access_to_share_type(st_id)
+        access = self.shares_v2_client.list_access_to_share_type(st_id)
         self.assertEqual([], access)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index 1fe3a4d..be56719 100644
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -27,6 +27,7 @@
 from tempest import test
 from tempest_lib.common.utils import data_utils
 from tempest_lib import exceptions
+import testtools
 
 from manila_tempest_tests import clients_share as clients
 from manila_tempest_tests import share_exceptions
@@ -90,6 +91,21 @@
     return wrapped_func
 
 
+def is_microversion_supported(microversion):
+    if (float(microversion) > float(CONF.share.max_api_microversion) or
+            float(microversion) < float(CONF.share.min_api_microversion)):
+        return False
+    return True
+
+
+def skip_if_microversion_not_supported(microversion):
+    """Decorator for tests that are microversion-specific."""
+    if not is_microversion_supported(microversion):
+        reason = ("Skipped. Test requires microversion '%s'." % microversion)
+        return testtools.skip(reason)
+    return lambda f: f
+
+
 class BaseSharesTest(test.BaseTestCase):
     """Base test case class for all Manila API tests."""
 
@@ -108,6 +124,11 @@
     # Will be cleaned up in tearDown method
     method_isolated_creds = []
 
+    def skip_if_microversion_not_supported(self, microversion):
+        if not is_microversion_supported(microversion):
+            raise self.skipException(
+                "Microversion '%s' is not supported." % microversion)
+
     @classmethod
     def get_client_with_isolated_creds(cls,
                                        name=None,
@@ -529,7 +550,7 @@
     def create_share_type(cls, name, is_public=True, client=None,
                           cleanup_in_class=True, **kwargs):
         if client is None:
-            client = cls.shares_client
+            client = cls.shares_v2_client
         share_type = client.create_share_type(name, is_public, **kwargs)
         resource = {
             "type": "share_type",
diff --git a/manila_tempest_tests/tests/api/test_availability_zones.py b/manila_tempest_tests/tests/api/test_availability_zones.py
index 9176683..8230157 100644
--- a/manila_tempest_tests/tests/api/test_availability_zones.py
+++ b/manila_tempest_tests/tests/api/test_availability_zones.py
@@ -29,8 +29,23 @@
                 self.assertIn(key, az)
 
     @test.attr(type=["smoke", "gate"])
-    def test_list_availability_zones_extension_url(self):
+    def test_list_availability_zones_legacy_url_api_v1(self):
         # NOTE(vponomaryov): remove this test with removal of availability zone
         # extension url support.
         azs = self.shares_client.list_availability_zones()
         self._list_availability_zones_assertions(azs)
+
+    @test.attr(type=["smoke", "gate"])
+    @base.skip_if_microversion_not_supported("2.6")
+    def test_list_availability_zones_legacy_url_api_v2(self):
+        # NOTE(vponomaryov): remove this test with removal of availability zone
+        # extension url support.
+        azs = self.shares_v2_client.list_availability_zones(
+            url='os-availability-zone', version='2.6')
+        self._list_availability_zones_assertions(azs)
+
+    @test.attr(type=["smoke", "gate"])
+    @base.skip_if_microversion_not_supported("2.7")
+    def test_list_availability_zones(self):
+        azs = self.shares_v2_client.list_availability_zones(version='2.7')
+        self._list_availability_zones_assertions(azs)
diff --git a/manila_tempest_tests/tests/api/test_availability_zones_negative.py b/manila_tempest_tests/tests/api/test_availability_zones_negative.py
new file mode 100644
index 0000000..0a562c6
--- /dev/null
+++ b/manila_tempest_tests/tests/api/test_availability_zones_negative.py
@@ -0,0 +1,43 @@
+# Copyright 2015 Mirantis Inc.
+# All Rights Reserved.
+#
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
+#    not use this file except in compliance with the License. You may obtain
+#    a copy of the License at
+#
+#         http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+#    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 import test
+from tempest_lib import exceptions as lib_exc
+
+from manila_tempest_tests.tests.api import base
+
+
+@base.skip_if_microversion_not_supported("2.7")
+class AvailabilityZonesNegativeTest(base.BaseSharesTest):
+
+    @test.attr(type=["smoke", "gate"])
+    def test_list_availability_zones_api_not_found_with_legacy_url(self):
+        # NOTE(vponomaryov): remove this test with removal of availability zone
+        # extension url support.
+        self.assertRaises(
+            lib_exc.NotFound,
+            self.shares_v2_client.list_availability_zones,
+            url='os-availability-zone',
+            version='2.7',
+        )
+
+    @test.attr(type=["smoke", "gate"])
+    def test_list_availability_zones_api_not_found(self):
+        self.assertRaises(
+            lib_exc.NotFound,
+            self.shares_v2_client.list_availability_zones,
+            url='availability-zones',
+            version='2.6',
+        )
diff --git a/manila_tempest_tests/tests/api/test_consistency_group_actions.py b/manila_tempest_tests/tests/api/test_consistency_group_actions.py
index 0bf6e58..a932fdf 100644
--- a/manila_tempest_tests/tests/api/test_consistency_group_actions.py
+++ b/manila_tempest_tests/tests/api/test_consistency_group_actions.py
@@ -39,78 +39,52 @@
     @classmethod
     def resource_setup(cls):
         super(ConsistencyGroupActionsTest, cls).resource_setup()
-        # Create consistency group
+
+        # Create first consistency group
         cls.cg_name = data_utils.rand_name("tempest-cg-name")
         cls.cg_desc = data_utils.rand_name("tempest-cg-description")
-        cls.consistency_group = cls.create_consistency_group(
-            name=cls.cg_name,
-            description=cls.cg_desc,
-        )
-
-        # Create 2 shares inside consistency group
-        cls.share_name = data_utils.rand_name("tempest-share-name")
-        cls.share_desc = data_utils.rand_name("tempest-share-description")
-        cls.share_size = 1
-        cls.share = cls.create_share(
-            name=cls.share_name,
-            description=cls.share_desc,
-            size=cls.share_size,
-            consistency_group_id=cls.consistency_group['id'],
-            metadata={'key': 'value'},
-            client=cls.shares_v2_client,
-        )
-
-        cls.share_name2 = data_utils.rand_name("tempest-share-name")
-        cls.share_desc2 = data_utils.rand_name("tempest-share-description")
-        cls.share_size2 = 2
-        cls.share2 = cls.create_share(
-            name=cls.share_name2,
-            description=cls.share_desc2,
-            size=cls.share_size2,
-            consistency_group_id=cls.consistency_group['id'],
-            client=cls.shares_v2_client,
-        )
-
-        cls.cgsnap_name = data_utils.rand_name("tempest-cgsnap-name")
-        cls.cgsnap_desc = data_utils.rand_name("tempest-cgsnap-description")
-        cls.cgsnapshot = cls.create_cgsnapshot_wait_for_active(
-            cls.consistency_group["id"],
-            name=cls.cgsnap_name,
-            description=cls.cgsnap_desc)
+        cls.cg = cls.create_consistency_group(
+            name=cls.cg_name, description=cls.cg_desc)
 
         # Create second consistency group for purposes of sorting and snapshot
         # filtering
-        cls.cg_name2 = data_utils.rand_name("tempest-cg-name")
-        cls.cg_desc2 = data_utils.rand_name("tempest-cg-description")
-        cls.consistency_group2 = cls.create_consistency_group(
-            name=cls.cg_name2,
-            description=cls.cg_desc2,
-        )
+        cls.cg2 = cls.create_consistency_group(
+            name=cls.cg_name, description=cls.cg_desc)
 
-        # Create 1 share in second consistency group
-        cls.share_name3 = data_utils.rand_name("tempest-share-name")
-        cls.share_desc3 = data_utils.rand_name("tempest-share-description")
-        cls.share3 = cls.create_share(
-            name=cls.share_name3,
-            description=cls.share_desc3,
-            size=cls.share_size,
-            consistency_group_id=cls.consistency_group2['id'],
-            client=cls.shares_v2_client,
-        )
+        # Create 2 shares inside first CG and 1 inside second CG
+        cls.share_name = data_utils.rand_name("tempest-share-name")
+        cls.share_desc = data_utils.rand_name("tempest-share-description")
+        cls.share_size = 1
+        cls.share_size2 = 2
+        cls.shares = cls.create_shares([
+            {'kwargs': {
+                'name': cls.share_name,
+                'description': cls.share_desc,
+                'size': size,
+                'consistency_group_id': cg_id,
+            }} for size, cg_id in ((cls.share_size, cls.cg['id']),
+                                   (cls.share_size2, cls.cg['id']),
+                                   (cls.share_size, cls.cg2['id']))
+        ])
 
-        cls.cgsnap_name2 = data_utils.rand_name("tempest-cgsnap-name")
-        cls.cgsnap_desc2 = data_utils.rand_name("tempest-cgsnap-description")
+        # Create CG snapshots
+        cls.cgsnap_name = data_utils.rand_name("tempest-cgsnap-name")
+        cls.cgsnap_desc = data_utils.rand_name("tempest-cgsnap-description")
+
+        cls.cgsnapshot = cls.create_cgsnapshot_wait_for_active(
+            cls.cg["id"],
+            name=cls.cgsnap_name,
+            description=cls.cgsnap_desc)
+
         cls.cgsnapshot2 = cls.create_cgsnapshot_wait_for_active(
-            cls.consistency_group2['id'],
-            name=cls.cgsnap_name2,
-            description=cls.cgsnap_desc2)
+            cls.cg2['id'], name=cls.cgsnap_name, description=cls.cgsnap_desc)
 
     @test.attr(type=["gate", ])
     def test_get_consistency_group_v2_4(self):
 
         # Get consistency group
         consistency_group = self.shares_v2_client.get_consistency_group(
-            self.consistency_group['id'], version='2.4')
+            self.cg['id'], version='2.4')
 
         # Verify keys
         actual_keys = set(consistency_group.keys())
@@ -135,7 +109,7 @@
     def test_get_share_v2_4(self):
 
         # Get share
-        share = self.shares_v2_client.get_share(self.share['id'],
+        share = self.shares_v2_client.get_share(self.shares[0]['id'],
                                                 version='2.4')
 
         # Verify keys
@@ -164,9 +138,8 @@
         self.assertEqual(self.share_size, int(share["size"]), msg)
 
         msg = "Expected consistency_group_id: '%s', actual value: '%s'" % (
-            self.consistency_group["id"], share["consistency_group_id"])
-        self.assertEqual(
-            self.consistency_group["id"], share["consistency_group_id"], msg)
+            self.cg["id"], share["consistency_group_id"])
+        self.assertEqual(self.cg["id"], share["consistency_group_id"], msg)
 
     @test.attr(type=["gate", ])
     def test_list_consistency_groups_v2_4(self):
@@ -180,8 +153,7 @@
          consistency_groups]
 
         # Consistency group ids are in list exactly once
-        for cg_id in [self.consistency_group["id"],
-                      self.consistency_group2["id"]]:
+        for cg_id in (self.cg["id"], self.cg2["id"]):
             gen = [cgid["id"] for cgid in consistency_groups
                    if cgid["id"] == cg_id]
             msg = ("Expected id %s exactly once in consistency group list" %
@@ -200,8 +172,7 @@
          for cg in consistency_groups]
 
         # Consistency group ids are in list exactly once
-        for cg_id in [self.consistency_group["id"],
-                      self.consistency_group2["id"]]:
+        for cg_id in (self.cg["id"], self.cg2["id"]):
             gen = [cgid["id"] for cgid in consistency_groups
                    if cgid["id"] == cg_id]
             msg = ("Expected id %s exactly once in consistency group list" %
@@ -213,7 +184,7 @@
 
         shares = self.shares_v2_client.list_shares(
             detailed=True,
-            params={'consistency_group_id': self.consistency_group['id']},
+            params={'consistency_group_id': self.cg['id']},
             version='2.4'
         )
 
@@ -222,18 +193,19 @@
         self.assertEqual(2, len(shares),
                          'Incorrect number of shares returned. Expected 2, '
                          'got %s' % len(shares))
-        self.assertIn(self.share['id'], share_ids,
+        self.assertIn(self.shares[0]['id'], share_ids,
                       'Share %s expected in returned list, but got %s'
-                      % (self.share['id'], share_ids))
-        self.assertIn(self.share2['id'], share_ids,
+                      % (self.shares[0]['id'], share_ids))
+        self.assertIn(self.shares[1]['id'], share_ids,
                       'Share %s expected in returned list, but got %s'
-                      % (self.share['id'], share_ids))
+                      % (self.shares[0]['id'], share_ids))
 
     @test.attr(type=["gate", ])
     def test_get_cgsnapshot_v2_4(self):
+
         # Get consistency group
         consistency_group = self.shares_v2_client.get_consistency_group(
-            self.consistency_group['id'], version='2.4')
+            self.cg['id'], version='2.4')
 
         # Verify keys
         actual_keys = set(consistency_group.keys())
@@ -265,11 +237,11 @@
                          'Unexpected number of cgsnapshot members. Expected '
                          '2, got %s.' % len(cgsnapshot_members))
         # Verify each share is represented in the cgsnapshot appropriately
-        for share_id in [self.share['id'], self.share2['id']]:
+        for share_id in (self.shares[0]['id'], self.shares[1]['id']):
             self.assertIn(share_id, member_share_ids,
                           'Share missing %s missing from cgsnapshot. Found %s.'
                           % (share_id, member_share_ids))
-        for share in [self.share, self.share2]:
+        for share in (self.shares[0], self.shares[1]):
             for member in cgsnapshot_members:
                 if share['id'] == member['share_id']:
                     self.assertEqual(share['size'], member['size'])
diff --git a/manila_tempest_tests/tests/api/test_quotas.py b/manila_tempest_tests/tests/api/test_quotas.py
index af5885a..da6dcce 100644
--- a/manila_tempest_tests/tests/api/test_quotas.py
+++ b/manila_tempest_tests/tests/api/test_quotas.py
@@ -13,22 +13,25 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import ddt
 from tempest import test  # noqa
 
 from manila_tempest_tests.tests.api import base
 
 
+@ddt.data
 class SharesQuotasTest(base.BaseSharesTest):
 
     @classmethod
     def resource_setup(cls):
         super(SharesQuotasTest, cls).resource_setup()
-        cls.user_id = cls.shares_client.user_id
-        cls.tenant_id = cls.shares_client.tenant_id
+        cls.user_id = cls.shares_v2_client.user_id
+        cls.tenant_id = cls.shares_v2_client.tenant_id
 
     @test.attr(type=["gate", "smoke", ])
-    def test_default_quotas(self):
-        quotas = self.shares_client.default_quotas(self.tenant_id)
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_default_quotas(self, client_name):
+        quotas = getattr(self, client_name).default_quotas(self.tenant_id)
         self.assertGreater(int(quotas["gigabytes"]), -2)
         self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
         self.assertGreater(int(quotas["shares"]), -2)
@@ -36,8 +39,9 @@
         self.assertGreater(int(quotas["share_networks"]), -2)
 
     @test.attr(type=["gate", "smoke", ])
-    def test_show_quotas(self):
-        quotas = self.shares_client.show_quotas(self.tenant_id)
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_show_quotas(self, client_name):
+        quotas = getattr(self, client_name).show_quotas(self.tenant_id)
         self.assertGreater(int(quotas["gigabytes"]), -2)
         self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
         self.assertGreater(int(quotas["shares"]), -2)
@@ -45,8 +49,9 @@
         self.assertGreater(int(quotas["share_networks"]), -2)
 
     @test.attr(type=["gate", "smoke", ])
-    def test_show_quotas_for_user(self):
-        quotas = self.shares_client.show_quotas(
+    @ddt.data('shares_client', 'shares_v2_client')
+    def test_show_quotas_for_user(self, client_name):
+        quotas = getattr(self, client_name).show_quotas(
             self.tenant_id, self.user_id)
         self.assertGreater(int(quotas["gigabytes"]), -2)
         self.assertGreater(int(quotas["snapshot_gigabytes"]), -2)
diff --git a/manila_tempest_tests/tests/api/test_quotas_negative.py b/manila_tempest_tests/tests/api/test_quotas_negative.py
index 0736b98..e2d2c37 100644
--- a/manila_tempest_tests/tests/api/test_quotas_negative.py
+++ b/manila_tempest_tests/tests/api/test_quotas_negative.py
@@ -13,29 +13,55 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from tempest import test  # noqa
-from tempest_lib import exceptions as lib_exc  # noqa
-import testtools  # noqa
+import ddt
+from tempest import test
+from tempest_lib import exceptions as lib_exc
 
 from manila_tempest_tests.tests.api import base
 
 
+@ddt.ddt
 class SharesQuotasNegativeTest(base.BaseSharesTest):
 
     @test.attr(type=["gate", "smoke", "negative"])
     def test_get_quotas_with_empty_tenant_id(self):
         self.assertRaises(lib_exc.NotFound,
-                          self.shares_client.show_quotas, "")
+                          self.shares_v2_client.show_quotas, "")
 
     @test.attr(type=["gate", "smoke", "negative", ])
     def test_try_reset_quotas_with_user(self):
         self.assertRaises(lib_exc.Forbidden,
-                          self.shares_client.reset_quotas,
-                          self.shares_client.tenant_id)
+                          self.shares_v2_client.reset_quotas,
+                          self.shares_v2_client.tenant_id)
 
     @test.attr(type=["gate", "smoke", "negative", ])
     def test_try_update_quotas_with_user(self):
         self.assertRaises(lib_exc.Forbidden,
-                          self.shares_client.update_quotas,
-                          self.shares_client.tenant_id,
+                          self.shares_v2_client.update_quotas,
+                          self.shares_v2_client.tenant_id,
                           shares=9)
+
+    @ddt.data(
+        ('services', '2.0', 'show_quotas'),
+        ('services', '2.0', 'default_quotas'),
+        ('services', '2.0', 'reset_quotas'),
+        ('services', '2.0', 'update_quotas'),
+        ('services', '2.6', 'show_quotas'),
+        ('services', '2.6', 'default_quotas'),
+        ('services', '2.6', 'reset_quotas'),
+        ('services', '2.6', 'update_quotas'),
+        ('os-services', '2.7', 'show_quotas'),
+        ('os-services', '2.7', 'default_quotas'),
+        ('os-services', '2.7', 'reset_quotas'),
+        ('os-services', '2.7', 'update_quotas'),
+    )
+    @ddt.unpack
+    @test.attr(type=["gate", "smoke", "negative", ])
+    @base.skip_if_microversion_not_supported("2.7")
+    def test_show_quotas_with_wrong_versions(self, url, version, method_name):
+        self.assertRaises(
+            lib_exc.NotFound,
+            getattr(self.shares_v2_client, method_name),
+            self.shares_v2_client.tenant_id,
+            version=version, url=url,
+        )