Merge "Added Test Case for BaremetalNodesClient"
diff --git a/REVIEWING.rst b/REVIEWING.rst
index 12ccb75..f7334ad 100644
--- a/REVIEWING.rst
+++ b/REVIEWING.rst
@@ -51,6 +51,19 @@
 whether to skip or not.
 
 
+Configuration Options
+---------------------
+With the introduction of the tempest external test plugin interface we needed
+to provide a stable contract for tempest's configuration options. This means
+we can no longer simply remove a configuration option when it's no longer used.
+Patches proposed that remove options without a deprecation cycle should not
+be approved. Similarly when changing default values with configuration we need
+to similarly be careful that we don't break existing functionality. Also, when
+adding options, just as before, we need to weigh the benefit of adding an
+additional option against the complexity and maintenance overhead having it
+costs.
+
+
 Test Documentation
 ------------------
 When a new test is being added refer to the :ref:`TestDocumentation` section in
diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py
index c8ca938..e979616 100644
--- a/tempest/api/compute/admin/test_floating_ips_bulk.py
+++ b/tempest/api/compute/admin/test_floating_ips_bulk.py
@@ -80,5 +80,6 @@
         self.assertNotEqual(0, len(ips_list))
         for ip in netaddr.IPNetwork(self.ip_range).iter_hosts():
             self.assertIn(str(ip), map(lambda x: x['address'], ips_list))
-        body = self.client.delete_floating_ips_bulk(self.ip_range)
-        self.assertEqual(self.ip_range, body.data)
+        body = (self.client.delete_floating_ips_bulk(self.ip_range)
+                ['floating_ips_bulk_delete'])
+        self.assertEqual(self.ip_range, body)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 2624fca..1f53f9a 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -75,7 +75,6 @@
         cls.networks_client = cls.os.networks_client
         cls.limits_client = cls.os.limits_client
         cls.volumes_extensions_client = cls.os.volumes_extensions_client
-        cls.volumes_client = cls.os.volumes_client
         cls.interfaces_client = cls.os.interfaces_client
         cls.fixed_ips_client = cls.os.fixed_ips_client
         cls.availability_zone_client = cls.os.availability_zone_client
@@ -91,6 +90,11 @@
             cls.os.security_group_default_rules_client)
         cls.versions_client = cls.os.compute_versions_client
 
+        if CONF.volume_feature_enabled.api_v1:
+            cls.volumes_client = cls.os.volumes_client
+        else:
+            cls.volumes_client = cls.os.volumes_v2_client
+
     @classmethod
     def resource_setup(cls):
         super(BaseComputeTest, cls).resource_setup()
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 71a00c9..31eff9d 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -22,13 +22,6 @@
 
 class TelemetryNotificationAPITestJSON(base.BaseTelemetryTest):
 
-    @classmethod
-    def skip_checks(cls):
-        super(TelemetryNotificationAPITestJSON, cls).skip_checks()
-        if CONF.telemetry.too_slow_to_test:
-            raise cls.skipException("Ceilometer feature for fast work mysql "
-                                    "is disabled")
-
     @test.idempotent_id('d7f8c1c8-d470-4731-8604-315d3956caad')
     @test.services('compute')
     def test_check_nova_notification(self):
@@ -75,13 +68,6 @@
 
 class TelemetryNotificationAdminAPITestJSON(base.BaseTelemetryAdminTest):
 
-    @classmethod
-    def skip_checks(cls):
-        super(TelemetryNotificationAdminAPITestJSON, cls).skip_checks()
-        if CONF.telemetry.too_slow_to_test:
-            raise cls.skipException("Ceilometer feature for fast work mysql "
-                                    "is disabled")
-
     @test.idempotent_id('29604198-8b45-4fc0-8af8-1cae4f94ebe9')
     @test.services('compute')
     @decorators.skip_because(bug='1480490')
diff --git a/tempest/api/volume/admin/test_volume_quotas.py b/tempest/api/volume/admin/test_volume_quotas.py
index 1a48204..f9117ed 100644
--- a/tempest/api/volume/admin/test_volume_quotas.py
+++ b/tempest/api/volume/admin/test_volume_quotas.py
@@ -32,14 +32,15 @@
 
     @test.idempotent_id('59eada70-403c-4cef-a2a3-a8ce2f1b07a0')
     def test_list_quotas(self):
-        quotas = self.quotas_client.show_quota_set(self.demo_tenant_id)
+        quotas = (self.quotas_client.show_quota_set(self.demo_tenant_id)
+                  ['quota_set'])
         for key in QUOTA_KEYS:
             self.assertIn(key, quotas)
 
     @test.idempotent_id('2be020a2-5fdd-423d-8d35-a7ffbc36e9f7')
     def test_list_default_quotas(self):
         quotas = self.quotas_client.show_default_quota_set(
-            self.demo_tenant_id)
+            self.demo_tenant_id)['quota_set']
         for key in QUOTA_KEYS:
             self.assertIn(key, quotas)
 
@@ -47,7 +48,7 @@
     def test_update_all_quota_resources_for_tenant(self):
         # Admin can update all the resource quota limits for a tenant
         default_quota_set = self.quotas_client.show_default_quota_set(
-            self.demo_tenant_id)
+            self.demo_tenant_id)['quota_set']
         new_quota_set = {'gigabytes': 1009,
                          'volumes': 11,
                          'snapshots': 11}
@@ -55,7 +56,7 @@
         # Update limits for all quota resources
         quota_set = self.quotas_client.update_quota_set(
             self.demo_tenant_id,
-            **new_quota_set)
+            **new_quota_set)['quota_set']
 
         cleanup_quota_set = dict(
             (k, v) for k, v in six.iteritems(default_quota_set)
@@ -70,7 +71,7 @@
     @test.idempotent_id('18c51ae9-cb03-48fc-b234-14a19374dbed')
     def test_show_quota_usage(self):
         quota_usage = self.quotas_client.show_quota_usage(
-            self.os_adm.credentials.tenant_id)
+            self.os_adm.credentials.tenant_id)['quota_set']
         for key in QUOTA_KEYS:
             self.assertIn(key, quota_usage)
             for usage_key in QUOTA_USAGE_KEYS:
@@ -79,14 +80,14 @@
     @test.idempotent_id('ae8b6091-48ad-4bfa-a188-bbf5cc02115f')
     def test_quota_usage(self):
         quota_usage = self.quotas_client.show_quota_usage(
-            self.demo_tenant_id)
+            self.demo_tenant_id)['quota_set']
 
         volume = self.create_volume()
         self.addCleanup(self.admin_volume_client.delete_volume,
                         volume['id'])
 
         new_quota_usage = self.quotas_client.show_quota_usage(
-            self.demo_tenant_id)
+            self.demo_tenant_id)['quota_set']
 
         self.assertEqual(quota_usage['volumes']['in_use'] + 1,
                          new_quota_usage['volumes']['in_use'])
@@ -104,14 +105,15 @@
         tenant_id = tenant['id']
         self.addCleanup(identity_client.delete_tenant, tenant_id)
         quota_set_default = self.quotas_client.show_default_quota_set(
-            tenant_id)
+            tenant_id)['quota_set']
         volume_default = quota_set_default['volumes']
 
         self.quotas_client.update_quota_set(tenant_id,
                                             volumes=(int(volume_default) + 5))
 
         self.quotas_client.delete_quota_set(tenant_id)
-        quota_set_new = self.quotas_client.show_quota_set(tenant_id)
+        quota_set_new = (self.quotas_client.show_quota_set(tenant_id)
+                         ['quota_set'])
         self.assertEqual(volume_default, quota_set_new['volumes'])
 
 
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 8c4687b..6d4e3a9 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -353,7 +353,7 @@
             LOG.exception("Delete Volume Quotas exception.")
 
     def dry_run(self):
-        quotas = self.client.show_quota_usage(self.tenant_id)
+        quotas = self.client.show_quota_usage(self.tenant_id)['quota_set']
         self.data['volume_quotas'] = quotas
 
 
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 9e7d894..6d53b59 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -144,6 +144,12 @@
         'neutron': os.network_client,
         'swift': os.account_client,
     }
+    # NOTE (e0ne): Use Cinder API v2 by default because v1 is deprecated
+    if CONF.volume_feature_enabled.api_v2:
+        extensions_client['cinder'] = os.volumes_v2_extension_client
+    else:
+        extensions_client['cinder'] = os.volumes_extension_client
+
     if service not in extensions_client:
         print('No tempest extensions client for %s' % service)
         exit(1)
diff --git a/tempest/config.py b/tempest/config.py
index b6daa2e..5721c27 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -860,6 +860,7 @@
                help="The endpoint type to use for the telemetry service."),
     cfg.BoolOpt('too_slow_to_test',
                 default=True,
+                deprecated_for_removal=True,
                 help="This variable is used as flag to enable "
                      "notification tests")
 ]
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 644e551..4f113d3 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -58,14 +58,19 @@
         cls.security_group_rules_client = (
             cls.manager.security_group_rules_client)
         cls.servers_client = cls.manager.servers_client
-        cls.volumes_client = cls.manager.volumes_client
-        cls.snapshots_client = cls.manager.snapshots_client
         cls.interface_client = cls.manager.interfaces_client
         # Neutron network client
         cls.network_client = cls.manager.network_client
         # Heat client
         cls.orchestration_client = cls.manager.orchestration_client
 
+        if CONF.volume_feature_enabled.api_v1:
+            cls.volumes_client = cls.manager.volumes_client
+            cls.snapshots_client = cls.manager.snapshots_client
+        else:
+            cls.volumes_client = cls.manager.volumes_v2_client
+            cls.snapshots_client = cls.manager.snapshots_v2_client
+
     # ## Methods to handle sync and async deletes
 
     def setUp(self):
@@ -216,7 +221,11 @@
                 cleanup_callable=self.delete_wrapper,
                 cleanup_args=[self.volumes_client.delete_volume, volume['id']])
 
-        self.assertEqual(name, volume['display_name'])
+        # NOTE(e0ne): Cinder API v2 uses name instead of display_name
+        if 'display_name' in volume:
+            self.assertEqual(name, volume['display_name'])
+        else:
+            self.assertEqual(name, volume['name'])
         self.volumes_client.wait_for_volume_status(volume['id'], 'available')
         # The volume retrieved on creation has a non-up-to-date status.
         # Retrieval after it becomes active ensures correct details.
@@ -1291,7 +1300,10 @@
     @classmethod
     def setup_clients(cls):
         super(EncryptionScenarioTest, cls).setup_clients()
-        cls.admin_volume_types_client = cls.os_adm.volume_types_client
+        if CONF.volume_feature_enabled.api_v1:
+            cls.admin_volume_types_client = cls.os_adm.volume_types_client
+        else:
+            cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
 
     def _wait_for_volume_status(self, status):
         self.status_timeout(
diff --git a/tempest/scenario/test_swift_telemetry_middleware.py b/tempest/scenario/test_swift_telemetry_middleware.py
index 29ce1a0..c5a0e7c 100644
--- a/tempest/scenario/test_swift_telemetry_middleware.py
+++ b/tempest/scenario/test_swift_telemetry_middleware.py
@@ -50,9 +50,6 @@
             skip_msg = ("%s skipped as ceilometer is not available" %
                         cls.__name__)
             raise cls.skipException(skip_msg)
-        elif CONF.telemetry.too_slow_to_test:
-            skip_msg = "Ceilometer feature for fast work mysql is disabled"
-            raise cls.skipException(skip_msg)
 
     @classmethod
     def setup_clients(cls):
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 82f8b4c..ba419a6 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -83,7 +83,13 @@
             self.snapshots_client.wait_for_resource_deletion, snap['id'])
         self.addCleanup(self.snapshots_client.delete_snapshot, snap['id'])
         self.snapshots_client.wait_for_snapshot_status(snap['id'], 'available')
-        self.assertEqual(snap_name, snap['display_name'])
+
+        # NOTE(e0ne): Cinder API v2 uses name instead of display_name
+        if 'display_name' in snap:
+            self.assertEqual(snap_name, snap['display_name'])
+        else:
+            self.assertEqual(snap_name, snap['name'])
+
         return snap
 
     def _create_volume_from_snapshot(self, snap_id):
diff --git a/tempest/services/compute/json/floating_ips_bulk_client.py b/tempest/services/compute/json/floating_ips_bulk_client.py
index cabeeb1..dfe69f0 100644
--- a/tempest/services/compute/json/floating_ips_bulk_client.py
+++ b/tempest/services/compute/json/floating_ips_bulk_client.py
@@ -47,5 +47,4 @@
         resp, body = self.put('os-floating-ips-bulk/delete', post_body)
         body = json.loads(body)
         self.validate_response(schema.delete_floating_ips_bulk, resp, body)
-        data = body['floating_ips_bulk_delete']
-        return service_client.ResponseBodyData(resp, data)
+        return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index c5aa41a..6cad746 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -71,7 +71,8 @@
                                    "-json-patch"}
         resp, body = self.patch('v2/images/%s' % image_id, data, headers)
         self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, self._parse_resp(body))
+        body = json.loads(body)
+        return service_client.ResponseBody(resp, body)
 
     def create_image(self, name, container_format, disk_format, **kwargs):
         params = {
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index a979523..207554d 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -31,7 +31,8 @@
         url = 'os-quota-sets/%s/defaults' % tenant_id
         resp, body = self.get(url)
         self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, self._parse_resp(body))
+        body = jsonutils.loads(body)
+        return service_client.ResponseBody(resp, body)
 
     def show_quota_set(self, tenant_id, params=None):
         """List the quota set for a tenant."""
@@ -42,7 +43,8 @@
 
         resp, body = self.get(url)
         self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, self._parse_resp(body))
+        body = jsonutils.loads(body)
+        return service_client.ResponseBody(resp, body)
 
     def show_quota_usage(self, tenant_id):
         """List the quota set for a tenant."""
@@ -66,7 +68,8 @@
         post_body = jsonutils.dumps({'quota_set': post_body})
         resp, body = self.put('os-quota-sets/%s' % tenant_id, post_body)
         self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, self._parse_resp(body))
+        body = jsonutils.loads(body)
+        return service_client.ResponseBody(resp, body)
 
     def delete_quota_set(self, tenant_id):
         """Delete the tenant's quota set."""
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 6bc96f2..2de5802 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -240,7 +240,10 @@
                                    {'alias': 'fake2'},
                                    {'alias': 'not_fake'}]}
         fake_os = mock.MagicMock()
+        # NOTE (e0ne): mock both v1 and v2 APIs
         fake_os.volumes_extension_client.list_extensions = fake_list_extensions
+        fake_os.volumes_v2_extension_client.list_extensions = (
+            fake_list_extensions)
         self.useFixture(mockpatch.PatchObject(
             verify_tempest_config, 'get_enabled_extensions',
             return_value=(['fake1', 'fake2', 'fake3'])))
@@ -262,7 +265,10 @@
                                    {'alias': 'fake2'},
                                    {'alias': 'not_fake'}]}
         fake_os = mock.MagicMock()
+        # NOTE (e0ne): mock both v1 and v2 APIs
         fake_os.volumes_extension_client.list_extensions = fake_list_extensions
+        fake_os.volumes_v2_extension_client.list_extensions = (
+            fake_list_extensions)
         self.useFixture(mockpatch.PatchObject(
             verify_tempest_config, 'get_enabled_extensions',
             return_value=(['all'])))
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index 1acef8a..9bf8059 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -41,7 +41,7 @@
         self.useFixture(fake_config.ConfigFixture())
         self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
         self.fake_http = fake_http.fake_httplib2(return_type=200)
-        self.stubs.Set(token_client.TokenClientJSON, 'raw_request',
+        self.stubs.Set(token_client.TokenClient, 'raw_request',
                        fake_identity._fake_v2_response)
         self.useFixture(lockutils_fixtures.ExternalLockFixture())
         self.test_accounts = [
@@ -86,7 +86,7 @@
         return hash_list
 
     def test_get_hash(self):
-        self.stubs.Set(token_client.TokenClientJSON, 'raw_request',
+        self.stubs.Set(token_client.TokenClient, 'raw_request',
                        fake_identity._fake_v2_response)
         test_account_class = accounts.Accounts('v2', 'test_name')
         hash_list = self._get_hash_list(self.test_accounts)
diff --git a/tempest/tests/common/test_cred_provider.py b/tempest/tests/common/test_cred_provider.py
index ed3f931..1bc7147 100644
--- a/tempest/tests/common/test_cred_provider.py
+++ b/tempest/tests/common/test_cred_provider.py
@@ -36,7 +36,7 @@
 
     identity_response = fake_identity._fake_v2_response
     credentials_class = auth.KeystoneV2Credentials
-    tokenclient_class = v2_client.TokenClientJSON
+    tokenclient_class = v2_client.TokenClient
     identity_version = 'v2'
 
     def setUp(self):
@@ -114,7 +114,7 @@
 
     credentials_class = auth.KeystoneV3Credentials
     identity_response = fake_identity._fake_v3_response
-    tokenclient_class = v3_client.V3TokenClientJSON
+    tokenclient_class = v3_client.V3TokenClient
     identity_version = 'v3'
 
     def setUp(self):
diff --git a/tempest/tests/services/compute/test_certificates_client.py b/tempest/tests/services/compute/test_certificates_client.py
index 51c3e85..c926fce 100644
--- a/tempest/tests/services/compute/test_certificates_client.py
+++ b/tempest/tests/services/compute/test_certificates_client.py
@@ -13,17 +13,13 @@
 #    under the License.
 
 import copy
-import httplib2
-
-from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
 
 from tempest.services.compute.json import certificates_client
-from tempest.tests import base
 from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
 
 
-class TestCertificatesClient(base.TestCase):
+class TestCertificatesClient(base.BaseComputeServiceTest):
 
     FAKE_CERTIFICATE = {
         "certificate": {
@@ -39,16 +35,12 @@
             fake_auth, 'compute', 'regionOne')
 
     def _test_show_certificate(self, bytes_body=False):
-        serialized_body = json.dumps(self.FAKE_CERTIFICATE)
-        if bytes_body:
-            serialized_body = serialized_body.encode('utf-8')
-
-        mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
-        self.useFixture(mockpatch.Patch(
+        self.check_service_client_function(
+            self.client.show_certificate,
             'tempest.common.service_client.ServiceClient.get',
-            return_value=mocked_resp))
-        resp = self.client.show_certificate("fake-id")
-        self.assertEqual(self.FAKE_CERTIFICATE, resp)
+            self.FAKE_CERTIFICATE,
+            bytes_body,
+            certificate_id="fake-id")
 
     def test_show_certificate_with_str_body(self):
         self._test_show_certificate()
@@ -59,16 +51,11 @@
     def _test_create_certificate(self, bytes_body=False):
         cert = copy.deepcopy(self.FAKE_CERTIFICATE)
         cert['certificate']['private_key'] = "my_private_key"
-        serialized_body = json.dumps(cert)
-        if bytes_body:
-            serialized_body = serialized_body.encode('utf-8')
-
-        mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
-        self.useFixture(mockpatch.Patch(
+        self.check_service_client_function(
+            self.client.create_certificate,
             'tempest.common.service_client.ServiceClient.post',
-            return_value=mocked_resp))
-        resp = self.client.create_certificate()
-        self.assertEqual(cert, resp)
+            cert,
+            bytes_body)
 
     def test_create_certificate_with_str_body(self):
         self._test_create_certificate()
diff --git a/tempest/tests/services/compute/test_floating_ip_pools_client.py b/tempest/tests/services/compute/test_floating_ip_pools_client.py
new file mode 100644
index 0000000..0d19b7b
--- /dev/null
+++ b/tempest/tests/services/compute/test_floating_ip_pools_client.py
@@ -0,0 +1,47 @@
+# Copyright 2015 NEC Corporation.  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.services.compute.json import floating_ip_pools_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestFloatingIPPoolsClient(base.BaseComputeServiceTest):
+
+    FAKE_FLOATING_IP_POOLS = {
+        "floating_ip_pools":
+        [
+            {"name": u'\u3042'},
+            {"name": u'\u3044'}
+        ]
+    }
+
+    def setUp(self):
+        super(TestFloatingIPPoolsClient, self).setUp()
+        fake_auth = fake_auth_provider.FakeAuthProvider()
+        self.client = floating_ip_pools_client.FloatingIPPoolsClient(
+            fake_auth, 'compute', 'regionOne')
+
+    def test_list_floating_ip_pools_with_str_body(self):
+        self.check_service_client_function(
+            self.client.list_floating_ip_pools,
+            'tempest.common.service_client.ServiceClient.get',
+            self.FAKE_FLOATING_IP_POOLS)
+
+    def test_list_floating_ip_pools_with_bytes_body(self):
+        self.check_service_client_function(
+            self.client.list_floating_ip_pools,
+            'tempest.common.service_client.ServiceClient.get',
+            self.FAKE_FLOATING_IP_POOLS, to_utf=True)
diff --git a/tempest/tests/services/compute/test_instance_usage_audit_log_client.py b/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
index 07efeca..d4bc889 100644
--- a/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
+++ b/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
@@ -13,17 +13,13 @@
 #    under the License.
 
 import datetime
-import httplib2
-
-from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
 
 from tempest.services.compute.json import instance_usage_audit_log_client
-from tempest.tests import base
 from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
 
 
-class TestInstanceUsagesAuditLogClient(base.TestCase):
+class TestInstanceUsagesAuditLogClient(base.BaseComputeServiceTest):
 
     FAKE_AUDIT_LOG = {
         "hosts_not_run": [
@@ -49,18 +45,11 @@
                                                     'regionOne'))
 
     def _test_list_instance_usage_audit_logs(self, bytes_body=False):
-        serialized_body = json.dumps({"instance_usage_audit_logs":
-                                      self.FAKE_AUDIT_LOG})
-        if bytes_body:
-            serialized_body = serialized_body.encode('utf-8')
-
-        mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
-        self.useFixture(mockpatch.Patch(
+        self.check_service_client_function(
+            self.client.list_instance_usage_audit_logs,
             'tempest.common.service_client.ServiceClient.get',
-            return_value=mocked_resp))
-        resp = self.client.list_instance_usage_audit_logs()
-        self.assertEqual({"instance_usage_audit_logs": self.FAKE_AUDIT_LOG},
-                         resp)
+            {"instance_usage_audit_logs": self.FAKE_AUDIT_LOG},
+            bytes_body)
 
     def test_list_instance_usage_audit_logs_with_str_body(self):
         self._test_list_instance_usage_audit_logs()
@@ -70,18 +59,12 @@
 
     def _test_show_instance_usage_audit_log(self, bytes_body=False):
         before_time = datetime.datetime(2012, 12, 1, 0, 0)
-        serialized_body = json.dumps({"instance_usage_audit_log":
-                                      self.FAKE_AUDIT_LOG})
-        if bytes_body:
-            serialized_body = serialized_body.encode('utf-8')
-
-        mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
-        self.useFixture(mockpatch.Patch(
+        self.check_service_client_function(
+            self.client.show_instance_usage_audit_log,
             'tempest.common.service_client.ServiceClient.get',
-            return_value=mocked_resp))
-        resp = self.client.show_instance_usage_audit_log(before_time)
-        self.assertEqual({"instance_usage_audit_log": self.FAKE_AUDIT_LOG},
-                         resp)
+            {"instance_usage_audit_log": self.FAKE_AUDIT_LOG},
+            bytes_body,
+            time_before=before_time)
 
     def test_show_instance_usage_audit_log_with_str_body(self):
         self._test_show_instance_usage_audit_log()
diff --git a/tempest/tests/services/compute/test_migrations_client.py b/tempest/tests/services/compute/test_migrations_client.py
new file mode 100644
index 0000000..83fe461
--- /dev/null
+++ b/tempest/tests/services/compute/test_migrations_client.py
@@ -0,0 +1,52 @@
+# Copyright 2015 NEC Corporation.  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.services.compute.json import migrations_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestMigrationsClient(base.BaseComputeServiceTest):
+    FAKE_MIGRATION_INFO = {"migrations": [{
+        "created_at": "2012-10-29T13:42:02",
+        "dest_compute": "compute2",
+        "dest_host": "1.2.3.4",
+        "dest_node": "node2",
+        "id": 1234,
+        "instance_uuid": "e9e4fdd7-f956-44ff-bfeb-d654a96ab3a2",
+        "new_instance_type_id": 2,
+        "old_instance_type_id": 1,
+        "source_compute": "compute1",
+        "source_node": "node1",
+        "status": "finished",
+        "updated_at": "2012-10-29T13:42:02"}]}
+
+    def setUp(self):
+        super(TestMigrationsClient, self).setUp()
+        fake_auth = fake_auth_provider.FakeAuthProvider()
+        self.mg_client_obj = migrations_client.MigrationsClient(
+            fake_auth, 'compute', 'regionOne')
+
+    def _test_list_migrations(self, bytes_body=False):
+        self.check_service_client_function(
+            self.mg_client_obj.list_migrations,
+            'tempest.common.service_client.ServiceClient.get',
+            self.FAKE_MIGRATION_INFO,
+            bytes_body)
+
+    def test_list_migration_with_str_body(self):
+        self._test_list_migrations()
+
+    def test_list_migration_with_bytes_body(self):
+        self._test_list_migrations(True)
diff --git a/tempest/tests/services/compute/test_networks_client.py b/tempest/tests/services/compute/test_networks_client.py
index 49a2344..b47430b 100644
--- a/tempest/tests/services/compute/test_networks_client.py
+++ b/tempest/tests/services/compute/test_networks_client.py
@@ -82,7 +82,7 @@
         self.check_service_client_function(
             self.client.show_network,
             'tempest.common.service_client.ServiceClient.get',
-            {"network": self.FAKE_NETWORKS},
+            {"network": self.FAKE_NETWORK},
             bytes_body,
             network_id=self.network_id
             )
diff --git a/tempest/tests/services/compute/test_security_groups_client.py b/tempest/tests/services/compute/test_security_groups_client.py
new file mode 100644
index 0000000..7a39048
--- /dev/null
+++ b/tempest/tests/services/compute/test_security_groups_client.py
@@ -0,0 +1,113 @@
+# Copyright 2015 NEC Corporation.  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 oslotest import mockpatch
+from tempest_lib import exceptions as lib_exc
+
+from tempest.services.compute.json import security_groups_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestSecurityGroupsClient(base.BaseComputeServiceTest):
+
+    FAKE_SECURITY_GROUP_INFO = [{
+        "description": "default",
+        "id": "3fb26eb3-581b-4420-9963-b0879a026506",
+        "name": "default",
+        "rules": [],
+        "tenant_id": "openstack"
+    }]
+
+    def setUp(self):
+        super(TestSecurityGroupsClient, self).setUp()
+        fake_auth = fake_auth_provider.FakeAuthProvider()
+        self.client = security_groups_client.SecurityGroupsClient(
+            fake_auth, 'compute', 'regionOne')
+
+    def _test_list_security_groups(self, bytes_body=False):
+        self.check_service_client_function(
+            self.client.list_security_groups,
+            'tempest.common.service_client.ServiceClient.get',
+            {"security_groups": self.FAKE_SECURITY_GROUP_INFO},
+            to_utf=bytes_body)
+
+    def test_list_security_groups_with_str_body(self):
+        self._test_list_security_groups()
+
+    def test_list_security_groups_with_bytes_body(self):
+        self._test_list_security_groups(bytes_body=True)
+
+    def _test_show_security_group(self, bytes_body=False):
+        self.check_service_client_function(
+            self.client.show_security_group,
+            'tempest.common.service_client.ServiceClient.get',
+            {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
+            to_utf=bytes_body,
+            security_group_id='fake-id')
+
+    def test_show_security_group_with_str_body(self):
+        self._test_show_security_group()
+
+    def test_show_security_group_with_bytes_body(self):
+        self._test_show_security_group(bytes_body=True)
+
+    def _test_create_security_group(self, bytes_body=False):
+        post_body = {"name": "test", "description": "test_group"}
+        self.check_service_client_function(
+            self.client.create_security_group,
+            'tempest.common.service_client.ServiceClient.post',
+            {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
+            to_utf=bytes_body,
+            kwargs=post_body)
+
+    def test_create_security_group_with_str_body(self):
+        self._test_create_security_group()
+
+    def test_create_security_group_with_bytes_body(self):
+        self._test_create_security_group(bytes_body=True)
+
+    def _test_update_security_group(self, bytes_body=False):
+        req_body = {"name": "test", "description": "test_group"}
+        self.check_service_client_function(
+            self.client.update_security_group,
+            'tempest.common.service_client.ServiceClient.put',
+            {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
+            to_utf=bytes_body,
+            security_group_id='fake-id',
+            kwargs=req_body)
+
+    def test_update_security_group_with_str_body(self):
+        self._test_update_security_group()
+
+    def test_update_security_group_with_bytes_body(self):
+        self._test_update_security_group(bytes_body=True)
+
+    def test_delete_security_group(self):
+        self.check_service_client_function(
+            self.client.delete_security_group,
+            'tempest.common.service_client.ServiceClient.delete',
+            {}, status=202, security_group_id='fake-id')
+
+    def test_is_resource_deleted_true(self):
+        mod = ('tempest.services.compute.json.security_groups_client.'
+               'SecurityGroupsClient.show_security_group')
+        self.useFixture(mockpatch.Patch(mod, side_effect=lib_exc.NotFound))
+        self.assertTrue(self.client.is_resource_deleted('fake-id'))
+
+    def test_is_resource_deleted_false(self):
+        mod = ('tempest.services.compute.json.security_groups_client.'
+               'SecurityGroupsClient.show_security_group')
+        self.useFixture(mockpatch.Patch(mod, return_value='success'))
+        self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_tenant_networks_client.py b/tempest/tests/services/compute/test_tenant_networks_client.py
index d7c85f0..dc2de00 100644
--- a/tempest/tests/services/compute/test_tenant_networks_client.py
+++ b/tempest/tests/services/compute/test_tenant_networks_client.py
@@ -12,17 +12,12 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import httplib2
-
-from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
-
 from tempest.services.compute.json import tenant_networks_client
-from tempest.tests import base
 from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
 
 
-class TestTenantNetworksClient(base.TestCase):
+class TestTenantNetworksClient(base.BaseComputeServiceTest):
 
     FAKE_NETWORK = {
         "cidr": "None",
@@ -41,16 +36,11 @@
             fake_auth, 'compute', 'regionOne')
 
     def _test_list_tenant_networks(self, bytes_body=False):
-        serialized_body = json.dumps({"networks": self.FAKE_NETWORKS})
-        if bytes_body:
-            serialized_body = serialized_body.encode('utf-8')
-
-        mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
-        self.useFixture(mockpatch.Patch(
+        self.check_service_client_function(
+            self.client.list_tenant_networks,
             'tempest.common.service_client.ServiceClient.get',
-            return_value=mocked_resp))
-        resp = self.client.list_tenant_networks()
-        self.assertEqual({"networks": self.FAKE_NETWORKS}, resp)
+            {"networks": self.FAKE_NETWORKS},
+            bytes_body)
 
     def test_list_tenant_networks_with_str_body(self):
         self._test_list_tenant_networks()
@@ -59,16 +49,12 @@
         self._test_list_tenant_networks(bytes_body=True)
 
     def _test_show_tenant_network(self, bytes_body=False):
-        serialized_body = json.dumps({"network": self.FAKE_NETWORK})
-        if bytes_body:
-            serialized_body = serialized_body.encode('utf-8')
-
-        mocked_resp = (httplib2.Response({'status': 200}), serialized_body)
-        self.useFixture(mockpatch.Patch(
+        self.check_service_client_function(
+            self.client.show_tenant_network,
             'tempest.common.service_client.ServiceClient.get',
-            return_value=mocked_resp))
-        resp = self.client.show_tenant_network(self.NETWORK_ID)
-        self.assertEqual({"network": self.FAKE_NETWORK}, resp)
+            {"network": self.FAKE_NETWORK},
+            bytes_body,
+            network_id=self.NETWORK_ID)
 
     def test_show_tenant_network_with_str_body(self):
         self._test_show_tenant_network()
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index fa1b6f7..7bdc1d7 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -37,7 +37,7 @@
         self.useFixture(fake_config.ConfigFixture())
         self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
         self.fake_http = fake_http.fake_httplib2(return_type=200)
-        self.stubs.Set(json_token_client.TokenClientJSON, 'raw_request',
+        self.stubs.Set(json_token_client.TokenClient, 'raw_request',
                        fake_identity._fake_v2_response)
         cfg.CONF.set_default('operator_role', 'FakeRole',
                              group='object-storage')