Merge "Remove all usage of six library"
diff --git a/manila_tempest_tests/common/remote_client.py b/manila_tempest_tests/common/remote_client.py
index 9970b0b..30e64c7 100644
--- a/manila_tempest_tests/common/remote_client.py
+++ b/manila_tempest_tests/common/remote_client.py
@@ -13,7 +13,6 @@
 import sys
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib.common import ssh
 from tempest.lib.common.utils import test_utils
@@ -47,7 +46,7 @@
                             msg = 'Could not get console_log for server %s'
                             LOG.debug(msg, self.server['id'])
                 # re-raise the original ssh timeout exception
-                six.reraise(*original_exception)
+                raise original_exception
             finally:
                 # Delete the traceback to avoid circular references
                 _, _, trace = original_exception
diff --git a/manila_tempest_tests/common/waiters.py b/manila_tempest_tests/common/waiters.py
index 5d8d344..056dab6 100644
--- a/manila_tempest_tests/common/waiters.py
+++ b/manila_tempest_tests/common/waiters.py
@@ -15,7 +15,6 @@
 
 import time
 
-import six
 from tempest import config
 from tempest.lib import exceptions
 
@@ -137,7 +136,7 @@
                            'dest': dest_host,
                            'share_id': share['id'],
                            'timeout': client.build_timeout,
-                           'status': six.text_type(statuses),
+                           'status': str(statuses),
                        })
             raise exceptions.TimeoutException(message)
     return share
diff --git a/manila_tempest_tests/services/share/json/shares_client.py b/manila_tempest_tests/services/share/json/shares_client.py
index 770bbb9..3413387 100644
--- a/manila_tempest_tests/services/share/json/shares_client.py
+++ b/manila_tempest_tests/services/share/json/shares_client.py
@@ -15,9 +15,8 @@
 
 import json
 import time
+from urllib import parse as urlparse
 
-import six
-from six.moves.urllib import parse as urlparse
 from tempest import config
 from tempest.lib.common import rest_client
 from tempest.lib.common.utils import data_utils
@@ -322,7 +321,7 @@
                 self.show_share_server, kwargs.get("server_id"))
         else:
             raise share_exceptions.InvalidResource(
-                message=six.text_type(kwargs))
+                message=str(kwargs))
 
     def _is_resource_deleted(self, func, res_id, **kwargs):
         try:
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 01028cd..23edf7a 100644
--- a/manila_tempest_tests/services/share/v2/json/shares_client.py
+++ b/manila_tempest_tests/services/share/v2/json/shares_client.py
@@ -16,8 +16,8 @@
 import json
 import re
 import time
+from urllib import parse
 
-from six.moves.urllib import parse
 from tempest import config
 from tempest.lib.common import rest_client
 from tempest.lib.common.utils import data_utils
@@ -1523,8 +1523,6 @@
                                version=version)
         return rest_client.ResponseBody(resp, body)
 
-################
-
     def create_share_replica(self, share_id, availability_zone=None,
                              version=LATEST_MICROVERSION):
         """Add a share replica of an existing share."""
diff --git a/manila_tempest_tests/tests/api/admin/test_export_locations.py b/manila_tempest_tests/tests/api/admin/test_export_locations.py
index 7d09f69..db382f2 100644
--- a/manila_tempest_tests/tests/api/admin/test_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_export_locations.py
@@ -16,7 +16,6 @@
 import ddt
 from oslo_utils import timeutils
 from oslo_utils import uuidutils
-import six
 from tempest import config
 from tempest.lib import decorators
 from testtools import testcase as tc
@@ -91,7 +90,7 @@
             # Check the format of ever-present summary keys
             self.assertTrue(uuidutils.is_uuid_like(export_location['id']))
             self.assertIsInstance(export_location['path'],
-                                  six.string_types)
+                                  str)
 
             if utils.is_microversion_ge(version, '2.14'):
                 self.assertIn(export_location['preferred'], (True, False))
diff --git a/manila_tempest_tests/tests/api/admin/test_share_servers.py b/manila_tempest_tests/tests/api/admin/test_share_servers.py
index fd553ff..b406a92 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_servers.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_servers.py
@@ -16,7 +16,6 @@
 import re
 
 import ddt
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -120,7 +119,7 @@
         else:
             msg = ("Appropriate server was not found. Its share_network_data"
                    ": '%s'. List of servers: '%s'.") % (self.sn_name_and_id,
-                                                        six.text_type(servers))
+                                                        str(servers))
             raise lib_exc.NotFound(message=msg)
         search_opts = {"host": host}
         servers = self.shares_v2_client.list_share_servers(
@@ -226,8 +225,8 @@
 
         # If details are present they and their values should be only strings
         for k, v in details.items():
-            self.assertIsInstance(k, six.string_types)
-            self.assertIsInstance(v, six.string_types)
+            self.assertIsInstance(k, str)
+            self.assertIsInstance(v, str)
 
     @decorators.idempotent_id('2fdf8d29-3ab8-4424-b684-6253f45b9666')
     @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
index fca92c7..1c6a9b7 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_export_locations.py
@@ -15,7 +15,6 @@
 
 import ddt
 from oslo_utils import uuidutils
-import six
 from tempest import config
 from tempest.lib import decorators
 from testtools import testcase as tc
@@ -94,7 +93,7 @@
             # Check the format of ever-present summary keys
             self.assertTrue(uuidutils.is_uuid_like(export_location['id']))
             self.assertIsInstance(export_location['path'],
-                                  six.string_types)
+                                  str)
 
             if role == 'admin':
                 self.assertIn(export_location['is_admin_only'], (True, False))
diff --git a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
index f2fb48f..36ddf7e 100644
--- a/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_snapshot_manage_negative.py
@@ -13,7 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import six
+
 from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib import decorators
@@ -51,7 +51,7 @@
         cls.extra_specs = {
             'storage_protocol': CONF.share.capability_storage_protocol,
             'driver_handles_share_servers': CONF.share.multitenancy_enabled,
-            'snapshot_support': six.text_type(
+            'snapshot_support': str(
                 CONF.share.capability_snapshot_support),
         }
 
diff --git a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
index 197b883..e675387 100644
--- a/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
+++ b/manila_tempest_tests/tests/api/admin/test_user_messages_negative.py
@@ -10,7 +10,6 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 from oslo_utils import uuidutils
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -47,7 +46,7 @@
     def test_show_nonexistent_message(self):
         self.assertRaises(lib_exc.NotFound,
                           self.shares_v2_client.get_message,
-                          six.text_type(uuidutils.generate_uuid()))
+                          str(uuidutils.generate_uuid()))
 
     @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
     @decorators.idempotent_id('2f5be1aa-974b-4f6a-ae3a-084578e64f82')
@@ -61,7 +60,7 @@
     def test_delete_nonexistent_message(self):
         self.assertRaises(lib_exc.NotFound,
                           self.shares_v2_client.delete_message,
-                          six.text_type(uuidutils.generate_uuid()))
+                          str(uuidutils.generate_uuid()))
 
     @decorators.attr(type=[base.TAG_NEGATIVE, base.TAG_API])
     @utils.skip_if_microversion_not_supported(QUERY_BY_TIMESTAMP_MICROVERSION)
diff --git a/manila_tempest_tests/tests/api/base.py b/manila_tempest_tests/tests/api/base.py
index dd25062..648c9f8 100755
--- a/manila_tempest_tests/tests/api/base.py
+++ b/manila_tempest_tests/tests/api/base.py
@@ -18,7 +18,6 @@
 import traceback
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib.common import cred_client
 from tempest.lib.common.utils import data_utils
@@ -636,8 +635,8 @@
         extra_specs = {}
         for k, v in share_type['extra_specs'].items():
             extra_specs[k] = (
-                True if six.text_type(v).lower() == 'true'
-                else False if six.text_type(v).lower() == 'false' else v
+                True if str(v).lower() == 'true'
+                else False if str(v).lower() == 'false' else v
             )
         return [
             pool for pool in pools if all(y in pool['capabilities'].items()
@@ -1077,7 +1076,7 @@
     @staticmethod
     def add_extra_specs_to_dict(extra_specs=None):
         """Add any required extra-specs to share type dictionary"""
-        dhss = six.text_type(CONF.share.multitenancy_enabled)
+        dhss = str(CONF.share.multitenancy_enabled)
         extra_specs_dict = {"driver_handles_share_servers": dhss}
         if extra_specs:
             extra_specs_dict.update(extra_specs)
diff --git a/manila_tempest_tests/tests/api/test_security_services.py b/manila_tempest_tests/tests/api/test_security_services.py
index 5bfbc2e..24d8bad 100644
--- a/manila_tempest_tests/tests/api/test_security_services.py
+++ b/manila_tempest_tests/tests/api/test_security_services.py
@@ -15,7 +15,6 @@
 
 import ddt
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib import decorators
 import testtools
@@ -252,7 +251,7 @@
             LOG.warning("Caught exception. It is expected in case backend "
                         "fails having security-service with improper data "
                         "that leads to share-server creation error. "
-                        "%s", six.text_type(e))
+                        "%s", str(e))
 
         update_data = {
             "name": "name",
diff --git a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
index 9aaf20b..d0bb321 100644
--- a/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_mapping_negative.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -136,7 +135,7 @@
             LOG.warning("Caught exception. It is expected in case backend "
                         "fails having security-service with improper data "
                         "that leads to share-server creation error. "
-                        "%s", six.text_type(e))
+                        "%s", str(e))
 
         self.assertRaises(lib_exc.Forbidden,
                           self.cl.remove_sec_service_from_share_network,
diff --git a/manila_tempest_tests/tests/api/test_security_services_negative.py b/manila_tempest_tests/tests/api/test_security_services_negative.py
index 3895fa9..08e3c7b 100644
--- a/manila_tempest_tests/tests/api/test_security_services_negative.py
+++ b/manila_tempest_tests/tests/api/test_security_services_negative.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 from oslo_log import log
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
@@ -120,7 +119,7 @@
             LOG.warning("Caught exception. It is expected in case backend "
                         "fails having security-service with improper data "
                         "that leads to share-server creation error. "
-                        "%s", six.text_type(e))
+                        "%s", str(e))
 
         self.assertRaises(lib_exc.Forbidden,
                           self.shares_client.update_security_service,
diff --git a/manila_tempest_tests/tests/api/test_shares_actions.py b/manila_tempest_tests/tests/api/test_shares_actions.py
index 4cdc70d..3232d50 100644
--- a/manila_tempest_tests/tests/api/test_shares_actions.py
+++ b/manila_tempest_tests/tests/api/test_shares_actions.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 import ddt
-import six
 from tempest import config
 from tempest.lib.common.utils import data_utils
 from tempest.lib import decorators
@@ -93,7 +92,7 @@
 
         # get share
         share = self.shares_v2_client.get_share(
-            self.shares[0]['id'], version=six.text_type(version))['share']
+            self.shares[0]['id'], version=str(version))['share']
 
         # verify keys
         expected_keys = [
@@ -125,13 +124,13 @@
         # verify values
         msg = "Expected name: '%s', actual name: '%s'" % (self.share_name,
                                                           share["name"])
-        self.assertEqual(self.share_name, six.text_type(share["name"]), msg)
+        self.assertEqual(self.share_name, str(share["name"]), msg)
 
         msg = ("Expected description: '%s', "
                "actual description: '%s'" % (self.share_desc,
                                              share["description"]))
         self.assertEqual(
-            self.share_desc, six.text_type(share["description"]), msg)
+            self.share_desc, str(share["description"]), msg)
 
         msg = "Expected size: '%s', actual size: '%s'" % (
             CONF.share.share_size, share["size"])
@@ -211,7 +210,7 @@
 
         # list shares
         shares = self.shares_v2_client.list_shares_with_detail(
-            version=six.text_type(version))['shares']
+            version=str(version))['shares']
 
         # verify keys
         keys = [
diff --git a/manila_tempest_tests/tests/api/test_snapshot_rules.py b/manila_tempest_tests/tests/api/test_snapshot_rules.py
index 541e861..74d5221 100644
--- a/manila_tempest_tests/tests/api/test_snapshot_rules.py
+++ b/manila_tempest_tests/tests/api/test_snapshot_rules.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 import ddt
-import six
 from tempest import config
 from tempest.lib import decorators
 from testtools import testcase as tc
@@ -54,7 +53,7 @@
             access_to)['snapshot_access']
 
         for key in ('deleted', 'deleted_at', 'instance_mappings'):
-            self.assertNotIn(key, list(six.iterkeys(rule)))
+            self.assertNotIn(key, list(rule.keys()))
 
         waiters.wait_for_resource_status(
             self.shares_v2_client, self.snapshot['id'], 'active',
diff --git a/manila_tempest_tests/tests/scenario/manager.py b/manila_tempest_tests/tests/scenario/manager.py
index 1fa03f4..947d0e6 100644
--- a/manila_tempest_tests/tests/scenario/manager.py
+++ b/manila_tempest_tests/tests/scenario/manager.py
@@ -20,7 +20,6 @@
 from oslo_log import log
 from oslo_utils import netutils
 from oslo_utils import uuidutils
-import six
 from tempest.common import compute
 from tempest.common import image as common_image
 from tempest.common.utils.linux import remote_client
@@ -630,7 +629,7 @@
             try:
                 return subnets_client.create_subnet(**subnet)
             except lib_exc.Conflict as e:
-                if 'overlaps with another subnet' not in six.text_type(e):
+                if 'overlaps with another subnet' not in str(e):
                     raise
 
         result = None
diff --git a/manila_tempest_tests/tests/scenario/manager_share.py b/manila_tempest_tests/tests/scenario/manager_share.py
index d68ab04..657b1f1 100644
--- a/manila_tempest_tests/tests/scenario/manager_share.py
+++ b/manila_tempest_tests/tests/scenario/manager_share.py
@@ -14,10 +14,9 @@
 #    under the License.
 
 from tempfile import mkstemp
+from urllib.request import urlopen
 
 from oslo_log import log
-import six
-from six.moves.urllib.request import urlopen
 from tempest.common import waiters
 from tempest import config
 from tempest.lib.common.utils import data_utils
@@ -288,7 +287,7 @@
         # original implementation depends on CONF.compute.ssh_auth_method
         # option.
         server_or_ip = kwargs['server_or_ip']
-        if isinstance(server_or_ip, six.string_types):
+        if isinstance(server_or_ip, str):
             ip = server_or_ip
         else:
             addr = server_or_ip['addresses'][
diff --git a/manila_tempest_tests/tests/scenario/test_share_extend.py b/manila_tempest_tests/tests/scenario/test_share_extend.py
index f4dce61..d6a23d0 100644
--- a/manila_tempest_tests/tests/scenario/test_share_extend.py
+++ b/manila_tempest_tests/tests/scenario/test_share_extend.py
@@ -13,7 +13,6 @@
 import ddt
 from oslo_log import log as logging
 from oslo_utils import units
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions
@@ -133,7 +132,7 @@
                                                       block_count,
                                                       '/dev/urandom')
         except exceptions.SSHExecCommandFailed as e:
-            if 'stale file handle' in six.text_type(e).lower():
+            if 'stale file handle' in str(e).lower():
                 LOG.warning("Client was disconnected during extend process")
                 self.unmount_share(remote_client)
                 self.mount_share(mount_location, remote_client)
diff --git a/manila_tempest_tests/tests/scenario/test_share_shrink.py b/manila_tempest_tests/tests/scenario/test_share_shrink.py
index b4bfcd5..a4e59e8 100644
--- a/manila_tempest_tests/tests/scenario/test_share_shrink.py
+++ b/manila_tempest_tests/tests/scenario/test_share_shrink.py
@@ -13,7 +13,6 @@
 import time
 
 from oslo_log import log as logging
-import six
 from tempest import config
 from tempest.lib import decorators
 from tempest.lib import exceptions
@@ -146,7 +145,7 @@
                                                        new_size=new_size)
                 except exceptions.BadRequest as e:
                     if ('New size for shrink must be less than current size'
-                            in six.text_type(e)):
+                            in str(e)):
                         break
 
             time.sleep(check_interval)
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index 7625460..d0860f0 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -18,7 +18,6 @@
 import re
 
 from netaddr import ip
-import six
 from tempest import config
 import testtools
 
@@ -110,12 +109,12 @@
     conflicts in real-world testing.
     """
     test_net_3 = '203.0.113.'
-    address = test_net_3 + six.text_type(random.randint(0, 255))
+    address = test_net_3 + str(random.randint(0, 255))
     if network:
-        mask_length = six.text_type(random.randint(24, 32))
+        mask_length = str(random.randint(24, 32))
         address = '/'.join((address, mask_length))
         ip_network = ip.IPNetwork(address)
-        return '/'.join((six.text_type(ip_network.network), mask_length))
+        return '/'.join((str(ip_network.network), mask_length))
     return address
 
 
@@ -124,10 +123,10 @@
     ran_add = ["%x" % random.randrange(0, 16 ** 4) for i in range(6)]
     address = "2001:0DB8:" + ":".join(ran_add)
     if network:
-        mask_length = six.text_type(random.randint(32, 128))
+        mask_length = str(random.randint(32, 128))
         address = '/'.join((address, mask_length))
         ip_network = ip.IPNetwork(address)
-        return '/'.join((six.text_type(ip_network.network), mask_length))
+        return '/'.join((str(ip_network.network), mask_length))
     return address
 
 
@@ -135,8 +134,8 @@
     extra_specs = {}
     # fix extra specs with string values instead of boolean
     for k, v in share_type['extra_specs'].items():
-        extra_specs[k] = (True if six.text_type(v).lower() == 'true'
-                          else False if six.text_type(v).lower() == 'false'
+        extra_specs[k] = (True if str(v).lower() == 'true'
+                          else False if str(v).lower() == 'false'
                           else v)
     selected_pool = next(
         (x for x in pools if (x['name'] != share['host'] and all(