Merge "Rename references to compute security group rules client"
diff --git a/tempest/api/compute/admin/test_agents.py b/tempest/api/compute/admin/test_agents.py
index d2b3a81..9f7bbae 100644
--- a/tempest/api/compute/admin/test_agents.py
+++ b/tempest/api/compute/admin/test_agents.py
@@ -53,7 +53,7 @@
         if rand_key in kwargs:
             # NOTE: The rand_name is for avoiding agent conflicts.
             # If you try to create an agent with the same hypervisor,
-            # os and architecture as an exising agent, Nova will return
+            # os and architecture as an existing agent, Nova will return
             # an HTTPConflict or HTTPServerError.
             kwargs[rand_key] = data_utils.rand_name(kwargs[rand_key])
         return kwargs
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py
index ddd9aa0..1d83fec 100644
--- a/tempest/api/compute/admin/test_aggregates.py
+++ b/tempest/api/compute/admin/test_aggregates.py
@@ -145,7 +145,7 @@
 
     @test.idempotent_id('c8e85064-e79b-4906-9931-c11c24294d02')
     def test_aggregate_add_remove_host(self):
-        # Add an host to the given aggregate and remove.
+        # Add a host to the given aggregate and remove.
         self.useFixture(fixtures.LockFixture('availability_zone'))
         aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
         aggregate = (self.client.create_aggregate(name=aggregate_name)
@@ -168,7 +168,7 @@
 
     @test.idempotent_id('7f6a1cc5-2446-4cdb-9baa-b6ae0a919b72')
     def test_aggregate_add_host_list(self):
-        # Add an host to the given aggregate and list.
+        # Add a host to the given aggregate and list.
         self.useFixture(fixtures.LockFixture('availability_zone'))
         aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
         aggregate = (self.client.create_aggregate(name=aggregate_name)
@@ -188,7 +188,7 @@
 
     @test.idempotent_id('eeef473c-7c52-494d-9f09-2ed7fc8fc036')
     def test_aggregate_add_host_get_details(self):
-        # Add an host to the given aggregate and get details.
+        # Add a host to the given aggregate and get details.
         self.useFixture(fixtures.LockFixture('availability_zone'))
         aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
         aggregate = (self.client.create_aggregate(name=aggregate_name)
@@ -205,7 +205,7 @@
 
     @test.idempotent_id('96be03c7-570d-409c-90f8-e4db3c646996')
     def test_aggregate_add_host_create_server_with_az(self):
-        # Add an host to the given aggregate and create a server.
+        # Add a host to the given aggregate and create a server.
         self.useFixture(fixtures.LockFixture('availability_zone'))
         aggregate_name = data_utils.rand_name(self.aggregate_name_prefix)
         az_name = data_utils.rand_name(self.az_name_prefix)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index bc327da..4c7bab7 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -286,8 +286,8 @@
             # into the delete_volume method as a convenience to the caller.
             volumes_client.wait_for_resource_deletion(volume_id)
         except lib_exc.NotFound:
-            LOG.warn("Unable to delete volume '%s' since it was not found. "
-                     "Maybe it was already deleted?" % volume_id)
+            LOG.warning("Unable to delete volume '%s' since it was not found. "
+                        "Maybe it was already deleted?" % volume_id)
 
     @classmethod
     def prepare_instance_network(cls):
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 24d503f..a6ccdd3 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -47,7 +47,7 @@
         cls.client = cls.os.interfaces_client
 
     def wait_for_interface_status(self, server, port_id, status):
-        """Waits for a interface to reach a given status."""
+        """Waits for an interface to reach a given status."""
         body = (self.client.show_interface(server, port_id)
                 ['interfaceAttachment'])
         interface_status = body['port_state']
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index e022023..21fc62a 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -86,8 +86,7 @@
     def test_list_user_groups(self):
         # create a user
         user = self.client.create_user(
-            data_utils.rand_name('User'),
-            password=data_utils.rand_name('Pass'))['user']
+            data_utils.rand_name('User'), data_utils.rand_password())['user']
         self.addCleanup(self.client.delete_user, user['id'])
         # create two groups, and add user into them
         groups = []
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 2e6c268..04582c6 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -147,7 +147,7 @@
                      for disk_fmt in disk_fmts]
 
         for (container_fmt, disk_fmt) in all_pairs[:6]:
-            LOG.debug("Creating a image"
+            LOG.debug("Creating an image"
                       "(Container format: %s, Disk format: %s).",
                       container_fmt, disk_fmt)
             cls._create_standard_image(container_fmt, disk_fmt)
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index b90ee04..5a2713b 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -201,7 +201,8 @@
         if tenant not in existing:
             tenants_admin.create_tenant(tenant)
         else:
-            LOG.warn("Tenant '%s' already exists in this environment" % tenant)
+            LOG.warning("Tenant '%s' already exists in this environment"
+                        % tenant)
     LOG.info('Tenants created')
     for u in resources['users']:
         try:
@@ -220,8 +221,8 @@
                     enabled=True)
                 break
             else:
-                LOG.warn("User '%s' already exists in this environment. "
-                         "New name generated" % u['name'])
+                LOG.warning("User '%s' already exists in this environment. "
+                            "New name generated" % u['name'])
                 u['name'] = random_user_name(opts.tag, u['prefix'])
 
     LOG.info('Users created')
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index fd35eab..6dfa0a7 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -311,7 +311,8 @@
         if tenant not in existing:
             admin.tenants.create_tenant(tenant)['tenant']
         else:
-            LOG.warn("Tenant '%s' already exists in this environment" % tenant)
+            LOG.warning("Tenant '%s' already exists in this environment"
+                        % tenant)
 
 
 def destroy_tenants(tenants):
@@ -376,8 +377,8 @@
         try:
             identity.get_user_by_username(admin.identity,
                                           tenant['id'], u['name'])
-            LOG.warn("User '%s' already exists in this environment"
-                     % u['name'])
+            LOG.warning("User '%s' already exists in this environment"
+                        % u['name'])
         except lib_exc.NotFound:
             admin.identity.create_user(
                 u['name'], u['pass'], tenant['id'],
@@ -1074,7 +1075,7 @@
     destroy_secgroups(RES['secgroups'])
     destroy_users(RES['users'])
     destroy_tenants(RES['tenants'])
-    LOG.warn("Destroy mode incomplete")
+    LOG.warning("Destroy mode incomplete")
 
 
 def get_options():
diff --git a/tempest/common/api_version_utils.py b/tempest/common/api_version_utils.py
index 6b6364e..ac3322e 100644
--- a/tempest/common/api_version_utils.py
+++ b/tempest/common/api_version_utils.py
@@ -39,7 +39,7 @@
     if ((min_version > max_version) or
        (config_min_version > config_max_version)):
         msg = ("Min version is greater than Max version. Test Class versions "
-               "[%s - %s]. configration versions [%s - %s]."
+               "[%s - %s]. configuration versions [%s - %s]."
                % (min_version.get_string(),
                   max_version.get_string(),
                   config_min_version.get_string(),
@@ -56,7 +56,7 @@
     if (max_version < config_min_version or
         config_max_version < min_version):
         msg = ("The microversion range[%s - %s] of this test is out of the "
-               "configration range[%s - %s]."
+               "configuration range[%s - %s]."
                % (min_version.get_string(),
                   max_version.get_string(),
                   config_min_version.get_string(),
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index 5bbc93c..0af07f0 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -285,24 +285,24 @@
         try:
             net_client.delete_router(router_id)
         except lib_exc.NotFound:
-            LOG.warn('router with name: %s not found for delete' %
-                     router_name)
+            LOG.warning('router with name: %s not found for delete' %
+                        router_name)
 
     def _clear_isolated_subnet(self, subnet_id, subnet_name):
         client = self.subnets_admin_client
         try:
             client.delete_subnet(subnet_id)
         except lib_exc.NotFound:
-            LOG.warn('subnet with name: %s not found for delete' %
-                     subnet_name)
+            LOG.warning('subnet with name: %s not found for delete' %
+                        subnet_name)
 
     def _clear_isolated_network(self, network_id, network_name):
         net_client = self.networks_admin_client
         try:
             net_client.delete_network(network_id)
         except lib_exc.NotFound:
-            LOG.warn('network with name: %s not found for delete' %
-                     network_name)
+            LOG.warning('network with name: %s not found for delete' %
+                        network_name)
 
     def _cleanup_default_secgroup(self, tenant):
         nsg_client = self.security_groups_admin_client
@@ -313,8 +313,8 @@
             try:
                 nsg_client.delete_security_group(secgroup['id'])
             except lib_exc.NotFound:
-                LOG.warn('Security group %s, id %s not found for clean-up' %
-                         (secgroup['name'], secgroup['id']))
+                LOG.warning('Security group %s, id %s not found for clean-up' %
+                            (secgroup['name'], secgroup['id']))
 
     def _clear_isolated_net_resources(self):
         net_client = self.network_admin_client
@@ -333,8 +333,8 @@
                     net_client.remove_router_interface_with_subnet_id(
                         creds.router['id'], creds.subnet['id'])
                 except lib_exc.NotFound:
-                    LOG.warn('router with name: %s not found for delete' %
-                             creds.router['name'])
+                    LOG.warning('router with name: %s not found for delete' %
+                                creds.router['name'])
                 self._clear_isolated_router(creds.router['id'],
                                             creds.router['name'])
             if (not self.network_resources or
@@ -354,15 +354,15 @@
             try:
                 self.creds_client.delete_user(creds.user_id)
             except lib_exc.NotFound:
-                LOG.warn("user with name: %s not found for delete" %
-                         creds.username)
+                LOG.warning("user with name: %s not found for delete" %
+                            creds.username)
             try:
                 if CONF.service_available.neutron:
                     self._cleanup_default_secgroup(creds.tenant_id)
                 self.creds_client.delete_project(creds.tenant_id)
             except lib_exc.NotFound:
-                LOG.warn("tenant with name: %s not found for delete" %
-                         creds.tenant_name)
+                LOG.warning("tenant with name: %s not found for delete" %
+                            creds.tenant_name)
         self._creds = {}
 
     def is_multi_user(self):
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index 56cd331..3fc1365 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -49,13 +49,13 @@
                    name, networks))
         if caller:
             msg = '(%s) %s' % (caller, msg)
-        LOG.warn(msg)
+        LOG.warning(msg)
         raise exceptions.InvalidTestResource(type='network', name=name)
     else:
         msg = "Network with name: %s not found" % name
         if caller:
             msg = '(%s) %s' % (caller, msg)
-        LOG.warn(msg)
+        LOG.warning(msg)
         raise exceptions.InvalidTestResource(type='network', name=name)
     # To be consistent between neutron and nova network always use name even
     # if label is used in the api response. If neither is present than then
@@ -65,7 +65,7 @@
         msg = "Network found from list doesn't contain a valid name or label"
         if caller:
             msg = '(%s) %s' % (caller, msg)
-        LOG.warn(msg)
+        LOG.warning(msg)
         raise exceptions.InvalidTestResource(type='network', name=name)
     network['name'] = name
     return network
@@ -122,6 +122,6 @@
         if 'id' in network.keys():
             params.update({"networks": [{'uuid': network['id']}]})
         else:
-            LOG.warn('The provided network dict: %s was invalid and did not '
-                     ' contain an id' % network)
+            LOG.warning('The provided network dict: %s was invalid and did '
+                        'not contain an id' % network)
     return params
diff --git a/tempest/common/validation_resources.py b/tempest/common/validation_resources.py
index 57a4717..9457a60 100644
--- a/tempest/common/validation_resources.py
+++ b/tempest/common/validation_resources.py
@@ -73,8 +73,8 @@
             try:
                 keypair_client.delete_keypair(keypair_name)
             except lib_exc.NotFound:
-                LOG.warn("Keypair %s is not found when attempting to delete"
-                         % keypair_name)
+                LOG.warning("Keypair %s is not found when attempting to delete"
+                            % keypair_name)
             except Exception as exc:
                 LOG.exception('Exception raised while deleting key %s'
                               % keypair_name)
@@ -87,8 +87,8 @@
                 security_group_client.delete_security_group(sec_id)
                 security_group_client.wait_for_resource_deletion(sec_id)
             except lib_exc.NotFound:
-                LOG.warn("Security group %s is not found when attempting to "
-                         " delete" % sec_id)
+                LOG.warning("Security group %s is not found when attempting "
+                            "to delete" % sec_id)
             except lib_exc.Conflict as exc:
                 LOG.exception('Conflict while deleting security '
                               'group %s VM might not be deleted ' % sec_id)
@@ -105,8 +105,8 @@
             try:
                 floating_client.delete_floating_ip(fip_id)
             except lib_exc.NotFound:
-                LOG.warn('Floating ip %s not found while attempting to delete'
-                         % fip_id)
+                LOG.warning('Floating ip %s not found while attempting to '
+                            'delete' % fip_id)
             except Exception as exc:
                 LOG.exception('Exception raised while deleting ip %s '
                               % fip_id)
diff --git a/tempest/config.py b/tempest/config.py
index 8f2ca4b..1fc55d9 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -737,7 +737,7 @@
                deprecated_for_removal=True),
     cfg.ListOpt('backend_names',
                 default=['BACKEND_1', 'BACKEND_2'],
-                help='A list of backend names seperated by comma .'
+                help='A list of backend names separated by comma. '
                      'The backend name must be declared in cinder.conf',
                 deprecated_opts=[cfg.DeprecatedOpt('BACKEND_1',
                                                    group='volume'),
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 895f775..eb5ea16 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -932,8 +932,8 @@
             try:
                 source.ping_host(dest, nic=nic)
             except lib_exc.SSHExecCommandFailed:
-                LOG.warn('Failed to ping IP: %s via a ssh connection from: %s.'
-                         % (dest, source.ssh_client.host))
+                LOG.warning('Failed to ping IP: %s via a ssh connection '
+                            'from: %s.' % (dest, source.ssh_client.host))
                 return not should_succeed
             return should_succeed
 
diff --git a/tempest/services/compute/json/base.py b/tempest/services/compute/json/base.py
index 02e9f8b..ea1a696 100644
--- a/tempest/services/compute/json/base.py
+++ b/tempest/services/compute/json/base.py
@@ -12,10 +12,10 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from tempest.common import service_client
+from tempest_lib.common import rest_client
 
 
-class BaseComputeClient(service_client.ServiceClient):
+class BaseComputeClient(rest_client.RestClient):
     api_microversion = None
 
     def get_headers(self):
@@ -23,3 +23,6 @@
         if self.api_microversion:
             headers['X-OpenStack-Nova-API-Version'] = self.api_microversion
         return headers
+
+    def set_api_microversion(self, microversion):
+        self.api_microversion = microversion
diff --git a/tempest/stress/driver.py b/tempest/stress/driver.py
index 4dcaab7..a3e1ea3 100644
--- a/tempest/stress/driver.py
+++ b/tempest/stress/driver.py
@@ -106,7 +106,7 @@
         if process['process'].is_alive():
             try:
                 pid = process['process'].pid
-                LOG.warn("Process %d hangs. Send SIGKILL." % pid)
+                LOG.warning("Process %d hangs. Send SIGKILL." % pid)
                 os.kill(pid, signal.SIGKILL)
             except Exception:
                 pass
diff --git a/tempest/test.py b/tempest/test.py
index 339c1a0..aed438c 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -376,8 +376,8 @@
             cls.validation_resources = vresources.create_validation_resources(
                 cls.os, cls.validation_resources)
         else:
-            LOG.warn("Client manager not found, validation resources not"
-                     " created")
+            LOG.warning("Client manager not found, validation resources not"
+                        " created")
 
     @classmethod
     def resource_cleanup(cls):
@@ -392,8 +392,8 @@
                                                       cls.validation_resources)
                 cls.validation_resources = {}
             else:
-                LOG.warn("Client manager not found, validation resources not"
-                         " deleted")
+                LOG.warning("Client manager not found, validation resources "
+                            "not deleted")
 
     def setUp(self):
         super(BaseTestCase, self).setUp()
diff --git a/tempest/tests/services/compute/test_keypairs_client.py b/tempest/tests/services/compute/test_keypairs_client.py
index 8b1a9a8..03aee53 100644
--- a/tempest/tests/services/compute/test_keypairs_client.py
+++ b/tempest/tests/services/compute/test_keypairs_client.py
@@ -38,7 +38,7 @@
     def _test_list_keypairs(self, bytes_body=False):
         self.check_service_client_function(
             self.client.list_keypairs,
-            'tempest.common.service_client.ServiceClient.get',
+            'tempest_lib.common.rest_client.RestClient.get',
             {"keypairs": []},
             bytes_body)
 
@@ -60,7 +60,7 @@
 
         self.check_service_client_function(
             self.client.show_keypair,
-            'tempest.common.service_client.ServiceClient.get',
+            'tempest_lib.common.rest_client.RestClient.get',
             fake_keypair,
             bytes_body,
             keypair_name="test")
@@ -77,7 +77,7 @@
 
         self.check_service_client_function(
             self.client.create_keypair,
-            'tempest.common.service_client.ServiceClient.post',
+            'tempest_lib.common.rest_client.RestClient.post',
             fake_keypair,
             bytes_body,
             name="test")
@@ -91,5 +91,5 @@
     def test_delete_keypair(self):
         self.check_service_client_function(
             self.client.delete_keypair,
-            'tempest.common.service_client.ServiceClient.delete',
+            'tempest_lib.common.rest_client.RestClient.delete',
             {}, status=202, keypair_name='test')
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index ce3eb7e..98b045a 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -140,7 +140,7 @@
                 self.fail('%s is not listed in the valid service tag list'
                           % service)
             except KeyError:
-                # NOTE(mtreinish): This condition is to test for a entry in
+                # NOTE(mtreinish): This condition is to test for an entry in
                 # the outer decorator list but not in the service_list dict.
                 # However, because we're looping over the service_list dict
                 # it's unlikely we'll trigger this. So manual review is still