Merge "Test case for database limits"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 3ade411..949302f 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -816,7 +816,7 @@
 
 # Number of seconds to time on waiting for a container to container
 # synchronization complete. (integer value)
-#container_sync_timeout = 120
+#container_sync_timeout = 600
 
 # Number of seconds to wait while looping to check the status of a
 # container to container synchronization (integer value)
@@ -829,6 +829,16 @@
 # User role that has reseller admin (string value)
 #reseller_admin_role = ResellerAdmin
 
+# Name of sync realm. A sync realm is a set of clusters that have
+# agreed to allow container syncing with each other. Set the same
+# realm name as Swift's container-sync-realms.conf (string value)
+#realm_name = realm1
+
+# One name of cluster which is set in the realm whose name is set in
+# 'realm_name' item in this file. Set the same cluster name as Swift's
+# container-sync-realms.conf (string value)
+#cluster_name = name1
+
 
 [object-storage-feature-enabled]
 
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index e3477f1..5210077 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -79,6 +79,24 @@
         self.assertIn(self.s2_name, servers_name)
 
     @test.attr(type='gate')
+    def test_list_servers_by_admin_with_specified_tenant(self):
+        # In nova v2, tenant_id is ignored unless all_tenants is specified
+
+        # List the primary tenant but get nothing due to odd specified behavior
+        tenant_id = self.non_admin_client.tenant_id
+        params = {'tenant_id': tenant_id}
+        resp, body = self.client.list_servers_with_detail(params)
+        servers = body['servers']
+        self.assertEqual([], servers)
+
+        # List the admin tenant which has no servers
+        admin_tenant_id = self.client.tenant_id
+        params = {'all_tenants': '', 'tenant_id': admin_tenant_id}
+        resp, body = self.client.list_servers_with_detail(params)
+        servers = body['servers']
+        self.assertEqual([], servers)
+
+    @test.attr(type='gate')
     def test_list_servers_filter_by_exist_host(self):
         # Filter the list of servers by existent host
         name = data_utils.rand_name('server')
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 1c4dc59..13ec045 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -173,12 +173,17 @@
 
         _, addresses = self.client.list_addresses(server_multi_nics['id'])
 
-        expected_addr = ['19.80.0.2', '19.86.0.2']
-
+        # We can't predict the ip addresses assigned to the server on networks.
+        # Sometimes the assigned addresses are ['19.80.0.2', '19.86.0.2'], at
+        # other times ['19.80.0.3', '19.86.0.3']. So we check if the first
+        # address is in first network, similarly second address is in second
+        # network.
         addr = [addresses[name_net1][0]['addr'],
                 addresses[name_net2][0]['addr']]
-
-        self.assertEqual(expected_addr, addr)
+        networks = [netaddr.IPNetwork('19.80.0.0/24'),
+                    netaddr.IPNetwork('19.86.0.0/24')]
+        for address, network in zip(addr, networks):
+            self.assertIn(address, network)
 
 
 class ServersWithSpecificFlavorTestJSON(base.BaseV2ComputeAdminTest):
diff --git a/tempest/api/compute/test_live_block_migration.py b/tempest/api/compute/test_live_block_migration.py
index e04439f..180dffd 100644
--- a/tempest/api/compute/test_live_block_migration.py
+++ b/tempest/api/compute/test_live_block_migration.py
@@ -115,8 +115,7 @@
         actual_host = self._get_host_for_server(server_id)
         target_host = self._get_host_other_than(actual_host)
 
-        resp, volume = self.volumes_client.create_volume(1,
-                                                         display_name='test')
+        volume = self.volumes_client.create_volume(1, display_name='test')
 
         self.volumes_client.wait_for_volume_status(volume['id'],
                                                    'available')
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 6ce1216..1257699 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -327,12 +327,11 @@
                                    subnet["allocation_pools"][0]["end"])
         ip = netaddr.IPAddress(random.randrange(
             ip_range.last + 1, ip_range.last + 10)).format()
-        self.assertRaisesRegexp(exceptions.BadRequest,
-                                "not a valid IP for the defined subnet",
-                                self.create_port,
-                                self.network,
-                                fixed_ips=[{'subnet_id': subnet['id'],
-                                            'ip_address': ip}])
+        self.assertRaises(exceptions.BadRequest,
+                          self.create_port,
+                          self.network,
+                          fixed_ips=[{'subnet_id': subnet['id'],
+                                      'ip_address': ip}])
 
     def test_dhcp_stateful_fixedips_duplicate(self):
         """When port gets IP address from fixed IP range it
diff --git a/tempest/api/object_storage/test_container_sync.py b/tempest/api/object_storage/test_container_sync.py
index a50e392..7f8cb8b 100644
--- a/tempest/api/object_storage/test_container_sync.py
+++ b/tempest/api/object_storage/test_container_sync.py
@@ -44,10 +44,9 @@
         cls.local_ip = '127.0.0.1'
 
         # Must be configure according to container-sync interval
-        container_sync_timeout = \
-            int(CONF.object_storage.container_sync_timeout)
+        container_sync_timeout = CONF.object_storage.container_sync_timeout
         cls.container_sync_interval = \
-            int(CONF.object_storage.container_sync_interval)
+            CONF.object_storage.container_sync_interval
         cls.attempts = \
             int(container_sync_timeout / cls.container_sync_interval)
 
@@ -66,12 +65,7 @@
             cls.delete_containers(cls.containers, client[0], client[1])
         super(ContainerSyncTest, cls).resource_cleanup()
 
-    @test.attr(type='slow')
-    @test.skip_because(bug='1317133')
-    @testtools.skipIf(
-        not CONF.object_storage_feature_enabled.container_sync,
-        'Old-style container sync function is disabled')
-    def test_container_synchronization(self):
+    def _test_container_synchronization(self, make_headers):
         # container to container synchronization
         # to allow/accept sync requests to/from other accounts
 
@@ -79,15 +73,7 @@
         for cont in (self.containers, self.containers[::-1]):
             cont_client = [self.clients[c][0] for c in cont]
             obj_client = [self.clients[c][1] for c in cont]
-            # tell first container to synchronize to a second
-            client_proxy_ip = \
-                urlparse.urlparse(cont_client[1].base_url).netloc.split(':')[0]
-            client_base_url = \
-                cont_client[1].base_url.replace(client_proxy_ip,
-                                                self.local_ip)
-            headers = {'X-Container-Sync-Key': 'sync_key',
-                       'X-Container-Sync-To': "%s/%s" %
-                       (client_base_url, str(cont[1]))}
+            headers = make_headers(cont[1], cont_client[1])
             resp, body = \
                 cont_client[0].put(str(cont[0]), body=None, headers=headers)
             # create object in container
@@ -101,21 +87,19 @@
         params = {'format': 'json'}
         while self.attempts > 0:
             object_lists = []
-            for client_index in (0, 1):
-                resp, object_list = \
-                    cont_client[client_index].\
-                    list_container_contents(self.containers[client_index],
-                                            params=params)
+            for c_client, cont in zip(cont_client, self.containers):
+                resp, object_list = c_client.list_container_contents(
+                    cont, params=params)
                 object_lists.append(dict(
                     (obj['name'], obj) for obj in object_list))
             # check that containers are not empty and have equal keys()
             # or wait for next attempt
-            if not object_lists[0] or not object_lists[1] or \
-                    set(object_lists[0].keys()) != set(object_lists[1].keys()):
+            if object_lists[0] and object_lists[1] and \
+                    set(object_lists[0].keys()) == set(object_lists[1].keys()):
+                break
+            else:
                 time.sleep(self.container_sync_interval)
                 self.attempts -= 1
-            else:
-                break
 
         self.assertEqual(object_lists[0], object_lists[1],
                          'Different object lists in containers.')
@@ -126,3 +110,22 @@
             for obj_name in object_lists[0]:
                 resp, object_content = obj_client.get_object(cont, obj_name)
                 self.assertEqual(object_content, obj_name[::-1])
+
+    @test.attr(type='slow')
+    @test.skip_because(bug='1317133')
+    @testtools.skipIf(
+        not CONF.object_storage_feature_enabled.container_sync,
+        'Old-style container sync function is disabled')
+    def test_container_synchronization(self):
+        def make_headers(cont, cont_client):
+            # tell first container to synchronize to a second
+            client_proxy_ip = \
+                urlparse.urlparse(cont_client.base_url).netloc.split(':')[0]
+            client_base_url = \
+                cont_client.base_url.replace(client_proxy_ip,
+                                             self.local_ip)
+            headers = {'X-Container-Sync-Key': 'sync_key',
+                       'X-Container-Sync-To': "%s/%s" %
+                       (client_base_url, str(cont))}
+            return headers
+        self._test_container_synchronization(make_headers)
diff --git a/tempest/api/object_storage/test_container_sync_middleware.py b/tempest/api/object_storage/test_container_sync_middleware.py
new file mode 100644
index 0000000..41509a0
--- /dev/null
+++ b/tempest/api/object_storage/test_container_sync_middleware.py
@@ -0,0 +1,51 @@
+# Copyright(c)2015 NTT corp. 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.api.object_storage import test_container_sync
+from tempest import config
+from tempest import test
+
+CONF = config.CONF
+
+
+# This test can be quite long to run due to its
+# dependency on container-sync process running interval.
+# You can obviously reduce the container-sync interval in the
+# container-server configuration.
+
+
+class ContainerSyncMiddlewareTest(test_container_sync.ContainerSyncTest):
+
+    @classmethod
+    def resource_setup(cls):
+        super(ContainerSyncMiddlewareTest, cls).resource_setup()
+
+        # Set container-sync-realms.conf info
+        cls.realm_name = CONF.object_storage.realm_name
+        cls.key = 'sync_key'
+        cls.cluster_name = CONF.object_storage.cluster_name
+
+    @test.attr(type='slow')
+    @test.requires_ext(extension='container_sync', service='object')
+    def test_container_synchronization(self):
+        def make_headers(cont, cont_client):
+            # tell first container to synchronize to a second
+            account_name = cont_client.base_url.split('/')[-1]
+
+            headers = {'X-Container-Sync-Key': "%s" % (self.key),
+                       'X-Container-Sync-To': "//%s/%s/%s/%s" %
+                       (self.realm_name, self.cluster_name,
+                        str(account_name), str(cont))}
+            return headers
+        self._test_container_synchronization(make_headers)
diff --git a/tempest/clients.py b/tempest/clients.py
index ef50664..723e7b5 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -20,7 +20,8 @@
 from tempest import config
 from tempest import manager
 from tempest.openstack.common import log as logging
-from tempest.services.baremetal.v1.client_json import BaremetalClientJSON
+from tempest.services.baremetal.v1.json.baremetal_client import \
+    BaremetalClientJSON
 from tempest.services import botoclients
 from tempest.services.compute.json.agents_client import \
     AgentsClientJSON
@@ -164,7 +165,12 @@
         self._set_volume_clients()
         self._set_object_storage_clients()
 
-        self.baremetal_client = BaremetalClientJSON(self.auth_provider)
+        self.baremetal_client = BaremetalClientJSON(
+            self.auth_provider,
+            CONF.baremetal.catalog_type,
+            CONF.identity.region,
+            endpoint_type=CONF.baremetal.endpoint_type,
+            **self.default_params_with_timeout_values)
         self.network_client = NetworkClientJSON(
             self.auth_provider,
             CONF.network.catalog_type,
@@ -180,17 +186,11 @@
             **self.default_params_with_timeout_values)
         if CONF.service_available.ceilometer:
             self.telemetry_client = TelemetryClientJSON(
-                self.auth_provider)
-        self.negative_client = negative_rest_client.NegativeRestClient(
-            self.auth_provider, service)
-
-        # TODO(andreaf) EC2 client still do their auth, v2 only
-        ec2_client_args = (self.credentials.username,
-                           self.credentials.password,
-                           CONF.identity.uri,
-                           self.credentials.tenant_name)
-
-        # common clients
+                self.auth_provider,
+                CONF.telemetry.catalog_type,
+                CONF.identity.region,
+                endpoint_type=CONF.telemetry.endpoint_type,
+                **self.default_params_with_timeout_values)
         if CONF.service_available.glance:
             self.image_client = ImageClientJSON(self.auth_provider)
             self.image_client_v2 = ImageClientV2JSON(self.auth_provider)
@@ -202,7 +202,14 @@
             build_interval=CONF.orchestration.build_interval,
             build_timeout=CONF.orchestration.build_timeout,
             **self.default_params)
+        self.negative_client = negative_rest_client.NegativeRestClient(
+            self.auth_provider, service)
 
+        # TODO(andreaf) EC2 client still do their auth, v2 only
+        ec2_client_args = (self.credentials.username,
+                           self.credentials.password,
+                           CONF.identity.uri,
+                           self.credentials.tenant_name)
         self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
         self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
         self.data_processing_client = DataProcessingClient(
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 6c72ca9..9fb982c 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -150,6 +150,12 @@
             'ca_certs': CONF.identity.ca_certificates_file,
             'trace_requests': CONF.debug.trace_requests
         }
+        default_params_with_timeout_values = {
+            'build_interval': CONF.compute.build_interval,
+            'build_timeout': CONF.compute.build_timeout
+        }
+        default_params_with_timeout_values.update(default_params)
+
         compute_params = {
             'service': CONF.compute.catalog_type,
             'region': CONF.compute.region or CONF.identity.region,
@@ -183,7 +189,12 @@
         self.containers = container_client.ContainerClient(
             _auth, **object_storage_params)
         self.images = image_client.ImageClientV2JSON(_auth)
-        self.telemetry = telemetry_client.TelemetryClientJSON(_auth)
+        self.telemetry = telemetry_client.TelemetryClientJSON(
+            _auth,
+            CONF.telemetry.catalog_type,
+            CONF.identity.region,
+            endpoint_type=CONF.telemetry.endpoint_type,
+            **default_params_with_timeout_values)
         self.volumes = volumes_client.VolumesClientJSON(_auth)
         self.networks = network_client.NetworkClientJSON(
             _auth,
diff --git a/tempest/common/negative_rest_client.py b/tempest/common/negative_rest_client.py
index d9842e6..a02e494 100644
--- a/tempest/common/negative_rest_client.py
+++ b/tempest/common/negative_rest_client.py
@@ -15,18 +15,16 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from tempest_lib.common import rest_client
-
+from tempest.common import service_client
 from tempest import config
 
 CONF = config.CONF
 
 
-class NegativeRestClient(rest_client.RestClient):
+class NegativeRestClient(service_client.ServiceClient):
     """
     Version of RestClient that does not raise exceptions.
     """
-
     def __init__(self, auth_provider, service):
         region = self._get_region(service)
         super(NegativeRestClient, self).__init__(auth_provider,
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index d2f67e3..c0a7133 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -81,8 +81,6 @@
             raise exceptions.NotImplemented(ex)
         except lib_exceptions.ServerFault as ex:
             raise exceptions.ServerFault(ex)
-        except lib_exceptions.UnexpectedResponseCode as ex:
-            raise exceptions.UnexpectedResponseCode(ex)
         # TODO(oomichi): This is just a workaround for failing gate tests
         # when separating Forbidden from Unauthorized in tempest-lib.
         # We will need to remove this translation and replace negative tests
diff --git a/tempest/config.py b/tempest/config.py
index 1b6ec62..70f972f 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -601,7 +601,7 @@
                         'publicURL', 'adminURL', 'internalURL'],
                help="The endpoint type to use for the object-store service."),
     cfg.IntOpt('container_sync_timeout',
-               default=120,
+               default=600,
                help="Number of seconds to time on waiting for a container "
                     "to container synchronization complete."),
     cfg.IntOpt('container_sync_interval',
@@ -615,6 +615,17 @@
     cfg.StrOpt('reseller_admin_role',
                default='ResellerAdmin',
                help="User role that has reseller admin"),
+    cfg.StrOpt('realm_name',
+               default='realm1',
+               help="Name of sync realm. A sync realm is a set of clusters "
+                    "that have agreed to allow container syncing with each "
+                    "other. Set the same realm name as Swift's "
+                    "container-sync-realms.conf"),
+    cfg.StrOpt('cluster_name',
+               default='name1',
+               help="One name of cluster which is set in the realm whose name "
+                    "is set in 'realm_name' item in this file. Set the "
+                    "same cluster name as Swift's container-sync-realms.conf"),
 ]
 
 object_storage_feature_group = cfg.OptGroup(
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 86f488a..f265186 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -209,10 +209,6 @@
     message = "Invalid content type provided"
 
 
-class UnexpectedResponseCode(RestClientException):
-    message = "Unexpected response code received"
-
-
 class InvalidStructure(TempestException):
     message = "Invalid structure of table with details"
 
diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py
index a0ffd28..4c6a5bf 100644
--- a/tempest/services/baremetal/base.py
+++ b/tempest/services/baremetal/base.py
@@ -17,9 +17,6 @@
 import six
 
 from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
 
 
 def handle_errors(f):
@@ -48,23 +45,17 @@
 
     """
 
-    def __init__(self, auth_provider):
-        super(BaremetalClient, self).__init__(
-            auth_provider,
-            CONF.baremetal.catalog_type,
-            CONF.identity.region,
-            endpoint_type=CONF.baremetal.endpoint_type)
-        self.uri_prefix = ''
+    uri_prefix = ''
 
-    def serialize(self, object_type, object_dict):
+    def serialize(self, object_dict):
         """Serialize an Ironic object."""
 
-        raise NotImplementedError
+        return json.dumps(object_dict)
 
     def deserialize(self, object_str):
         """Deserialize an Ironic object."""
 
-        raise NotImplementedError
+        return json.loads(object_str)
 
     def _get_uri(self, resource_name, uuid=None, permanent=False):
         """
@@ -147,7 +138,7 @@
 
         return resp, self.deserialize(body)
 
-    def _create_request(self, resource, object_type, object_dict):
+    def _create_request(self, resource, object_dict):
         """
         Create an object of the specified type.
 
@@ -158,7 +149,7 @@
                  object.
 
         """
-        body = self.serialize(object_type, object_dict)
+        body = self.serialize(object_dict)
         uri = self._get_uri(resource)
 
         resp, body = self.post(uri, body=body)
diff --git a/tempest/services/baremetal/v1/client_json.py b/tempest/services/baremetal/v1/client_json.py
deleted file mode 100644
index c9dc874..0000000
--- a/tempest/services/baremetal/v1/client_json.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#    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.
-
-import json
-
-from tempest.services.baremetal.v1 import base_v1
-
-
-class BaremetalClientJSON(base_v1.BaremetalClientV1):
-    """Tempest REST client for Ironic JSON API v1."""
-
-    def __init__(self, auth_provider):
-        super(BaremetalClientJSON, self).__init__(auth_provider)
-
-        self.serialize = lambda obj_type, obj_body: json.dumps(obj_body)
-        self.deserialize = json.loads
diff --git a/tempest/services/baremetal/v1/json/__init__.py b/tempest/services/baremetal/v1/json/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tempest/services/baremetal/v1/json/__init__.py
diff --git a/tempest/services/baremetal/v1/base_v1.py b/tempest/services/baremetal/v1/json/baremetal_client.py
similarity index 95%
rename from tempest/services/baremetal/v1/base_v1.py
rename to tempest/services/baremetal/v1/json/baremetal_client.py
index 9435dbf..1c72a2b 100644
--- a/tempest/services/baremetal/v1/base_v1.py
+++ b/tempest/services/baremetal/v1/json/baremetal_client.py
@@ -13,18 +13,12 @@
 from tempest.services.baremetal import base
 
 
-class BaremetalClientV1(base.BaremetalClient):
+class BaremetalClientJSON(base.BaremetalClient):
     """
     Base Tempest REST client for Ironic API v1.
-
-    Specific implementations must implement serialize and deserialize
-    methods in order to send requests to Ironic.
-
     """
-    def __init__(self, auth_provider):
-        super(BaremetalClientV1, self).__init__(auth_provider)
-        self.version = '1'
-        self.uri_prefix = 'v%s' % self.version
+    version = '1'
+    uri_prefix = 'v1'
 
     @base.handle_errors
     def list_nodes(self, **kwargs):
@@ -156,7 +150,7 @@
                                'memory': kwargs.get('memory', 4096)},
                 'driver': kwargs.get('driver', 'fake')}
 
-        return self._create_request('nodes', 'node', node)
+        return self._create_request('nodes', node)
 
     @base.handle_errors
     def create_chassis(self, **kwargs):
@@ -170,7 +164,7 @@
         """
         chassis = {'description': kwargs.get('description', 'test-chassis')}
 
-        return self._create_request('chassis', 'chassis', chassis)
+        return self._create_request('chassis', chassis)
 
     @base.handle_errors
     def create_port(self, node_id, **kwargs):
@@ -193,7 +187,7 @@
         if kwargs['address'] is not None:
             port['address'] = kwargs['address']
 
-        return self._create_request('ports', 'port', port)
+        return self._create_request('ports', port)
 
     @base.handle_errors
     def delete_node(self, uuid):
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index 2bbd88d..2967cfa 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -16,22 +16,13 @@
 import urllib
 
 from tempest.common import service_client
-from tempest import config
 from tempest.openstack.common import jsonutils as json
 
-CONF = config.CONF
-
 
 class TelemetryClientJSON(service_client.ServiceClient):
 
-    def __init__(self, auth_provider):
-        super(TelemetryClientJSON, self).__init__(
-            auth_provider,
-            CONF.telemetry.catalog_type,
-            CONF.identity.region,
-            endpoint_type=CONF.telemetry.endpoint_type)
-        self.version = '2'
-        self.uri_prefix = "v%s" % self.version
+    version = '2'
+    uri_prefix = "v2"
 
     def deserialize(self, body):
         return json.loads(body.replace("\n", ""))
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index d8a5ec5..8a2782d 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -16,6 +16,7 @@
 import random
 import six
 
+from tempest.services.baremetal.v1.json import baremetal_client
 from tempest.services.compute.json import agents_client
 from tempest.services.compute.json import aggregates_client
 from tempest.services.compute.json import availability_zone_client
@@ -49,6 +50,7 @@
 from tempest.services.object_storage import container_client
 from tempest.services.object_storage import object_client
 from tempest.services.orchestration.json import orchestration_client
+from tempest.services.telemetry.json import telemetry_client
 from tempest.tests import base
 
 
@@ -57,6 +59,7 @@
     @mock.patch('tempest_lib.common.rest_client.RestClient.__init__')
     def test_service_client_creations_with_specified_args(self, mock_init):
         test_clients = [
+            baremetal_client.BaremetalClientJSON,
             agents_client.AgentsClientJSON,
             aggregates_client.AggregatesClientJSON,
             availability_zone_client.AvailabilityZoneClientJSON,
@@ -89,7 +92,8 @@
             account_client.AccountClient,
             container_client.ContainerClient,
             object_client.ObjectClient,
-            orchestration_client.OrchestrationClient]
+            orchestration_client.OrchestrationClient,
+            telemetry_client.TelemetryClientJSON]
 
         for client in test_clients:
             fake_string = six.text_type(random.randint(1, 0x7fffffff))