Merge "Pass identity_version into get_credentials"
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 0997c9f..a00296c 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -150,7 +150,7 @@
         """
         size = random.randint(1024, 4096)
         image_file = StringIO.StringIO(data_utils.random_bytes(size))
-        name = data_utils.rand_name('image-')
+        name = data_utils.rand_name('image')
         body = cls.create_image(name=name,
                                 container_format=container_format,
                                 disk_format=disk_format,
diff --git a/tempest/api/image/v2/test_images_tags.py b/tempest/api/image/v2/test_images_tags.py
index bdb1679..8c71db7 100644
--- a/tempest/api/image/v2/test_images_tags.py
+++ b/tempest/api/image/v2/test_images_tags.py
@@ -27,7 +27,7 @@
                                  disk_format='raw',
                                  visibility='private')
         image_id = body['id']
-        tag = data_utils.rand_name('tag-')
+        tag = data_utils.rand_name('tag')
         self.addCleanup(self.client.delete_image, image_id)
 
         # Creating image tag and verify it.
diff --git a/tempest/api/image/v2/test_images_tags_negative.py b/tempest/api/image/v2/test_images_tags_negative.py
index 13ef27d..227d35f 100644
--- a/tempest/api/image/v2/test_images_tags_negative.py
+++ b/tempest/api/image/v2/test_images_tags_negative.py
@@ -27,7 +27,7 @@
     @test.idempotent_id('8cd30f82-6f9a-4c6e-8034-c1b51fba43d9')
     def test_update_tags_for_non_existing_image(self):
         # Update tag with non existing image.
-        tag = data_utils.rand_name('tag-')
+        tag = data_utils.rand_name('tag')
         non_exist_image = str(uuid.uuid4())
         self.assertRaises(lib_exc.NotFound, self.client.add_image_tag,
                           non_exist_image, tag)
@@ -41,7 +41,7 @@
                                  visibility='private'
                                  )
         image_id = body['id']
-        tag = data_utils.rand_name('non-exist-tag-')
+        tag = data_utils.rand_name('non-exist-tag')
         self.addCleanup(self.client.delete_image, image_id)
         self.assertRaises(lib_exc.NotFound, self.client.delete_image_tag,
                           image_id, tag)
diff --git a/tempest/api/volume/admin/test_snapshots_actions.py b/tempest/api/volume/admin/test_snapshots_actions.py
index cb55869..db026c1 100644
--- a/tempest/api/volume/admin/test_snapshots_actions.py
+++ b/tempest/api/volume/admin/test_snapshots_actions.py
@@ -31,7 +31,7 @@
         super(SnapshotsActionsV2Test, cls).resource_setup()
 
         # Create a test shared volume for tests
-        vol_name = data_utils.rand_name(cls.__name__ + '-Volume-')
+        vol_name = data_utils.rand_name(cls.__name__ + '-Volume')
         cls.name_field = cls.special_fields['name_field']
         params = {cls.name_field: vol_name}
         cls.volume = \
@@ -40,7 +40,7 @@
                                                   'available')
 
         # Create a test shared snapshot for tests
-        snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot-')
+        snap_name = data_utils.rand_name(cls.__name__ + '-Snapshot')
         params = {cls.name_field: snap_name}
         cls.snapshot = \
             cls.client.create_snapshot(cls.volume['id'], **params)
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 4669e0e..681a48a 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -43,7 +43,7 @@
     def test_volume_crud_with_volume_type_and_extra_specs(self):
         # Create/update/get/delete volume with volume_type and extra spec.
         volume_types = list()
-        vol_name = data_utils.rand_name("volume-")
+        vol_name = data_utils.rand_name("volume")
         self.name_field = self.special_fields['name_field']
         proto = CONF.volume.storage_protocol
         vendor = CONF.volume.vendor_name
@@ -51,7 +51,7 @@
                        "vendor_name": vendor}
         # Create two volume_types
         for i in range(2):
-            vol_type_name = data_utils.rand_name("volume-type-")
+            vol_type_name = data_utils.rand_name("volume-type")
             vol_type = self.volume_types_client.create_volume_type(
                 vol_type_name,
                 extra_specs=extra_specs)
@@ -94,7 +94,7 @@
     def test_volume_type_create_get_delete(self):
         # Create/get volume type.
         body = {}
-        name = data_utils.rand_name("volume-type-")
+        name = data_utils.rand_name("volume-type")
         proto = CONF.volume.storage_protocol
         vendor = CONF.volume.vendor_name
         extra_specs = {"storage_protocol": proto,
@@ -128,7 +128,7 @@
         # Create/get/delete encryption type.
         provider = "LuksEncryptor"
         control_location = "front-end"
-        name = data_utils.rand_name("volume-type-")
+        name = data_utils.rand_name("volume-type")
         body = self.volume_types_client.create_volume_type(name)
         self.addCleanup(self._delete_volume_type, body['id'])
 
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index a1b80ce..f382a67 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -24,7 +24,7 @@
     @classmethod
     def resource_setup(cls):
         super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
-        vol_type_name = data_utils.rand_name('Volume-type-')
+        vol_type_name = data_utils.rand_name('Volume-type')
         cls.volume_type = cls.volume_types_client.create_volume_type(
             vol_type_name)
 
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index 1eed800..7775025 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -27,7 +27,7 @@
     @classmethod
     def resource_setup(cls):
         super(ExtraSpecsNegativeV2Test, cls).resource_setup()
-        vol_type_name = data_utils.rand_name('Volume-type-')
+        vol_type_name = data_utils.rand_name('Volume-type')
         cls.extra_specs = {"spec1": "val1"}
         cls.volume_type = cls.volume_types_client.create_volume_type(
             vol_type_name,
diff --git a/tempest/api/volume/admin/test_volumes_actions.py b/tempest/api/volume/admin/test_volumes_actions.py
index 29de04d..1b69549 100644
--- a/tempest/api/volume/admin/test_volumes_actions.py
+++ b/tempest/api/volume/admin/test_volumes_actions.py
@@ -31,7 +31,7 @@
         super(VolumesActionsV2Test, cls).resource_setup()
 
         # Create a test shared volume for tests
-        vol_name = utils.rand_name(cls.__name__ + '-Volume-')
+        vol_name = utils.rand_name(cls.__name__ + '-Volume')
         cls.name_field = cls.special_fields['name_field']
         params = {cls.name_field: vol_name}
 
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 7771300..3de5021 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -35,7 +35,7 @@
         super(VolumesV2ActionsTest, cls).resource_setup()
 
         # Create a test shared instance
-        srv_name = data_utils.rand_name(cls.__name__ + '-Instance-')
+        srv_name = data_utils.rand_name(cls.__name__ + '-Instance')
         cls.server = cls.servers_client.create_server(srv_name,
                                                       cls.image_ref,
                                                       cls.flavor_ref)
@@ -104,7 +104,7 @@
         # it is shared with the other tests. After it is uploaded in Glance,
         # there is no way to delete it from Cinder, so we delete it from Glance
         # using the Glance image_client and from Cinder via tearDownClass.
-        image_name = data_utils.rand_name('Image-')
+        image_name = data_utils.rand_name('Image')
         body = self.client.upload_volume(self.volume['id'],
                                          image_name,
                                          CONF.volume.disk_format)
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index b59a313..af6e24e 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -58,7 +58,7 @@
     def test_create_volume_with_invalid_size(self):
         # Should not be able to create volume with invalid size
         # in request
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
                           size='#$%', display_name=v_name, metadata=metadata)
@@ -68,7 +68,7 @@
     def test_create_volume_with_out_passing_size(self):
         # Should not be able to create volume without passing size
         # in request
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
                           size='', display_name=v_name, metadata=metadata)
@@ -77,7 +77,7 @@
     @test.idempotent_id('41331caa-eaf4-4001-869d-bc18c1869360')
     def test_create_volume_with_size_zero(self):
         # Should not be able to create volume with size zero
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
                           size='0', display_name=v_name, metadata=metadata)
@@ -86,7 +86,7 @@
     @test.idempotent_id('8b472729-9eba-446e-a83b-916bdb34bef7')
     def test_create_volume_with_size_negative(self):
         # Should not be able to create volume with size negative
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.BadRequest, self.client.create_volume,
                           size='-1', display_name=v_name, metadata=metadata)
@@ -95,7 +95,7 @@
     @test.idempotent_id('10254ed8-3849-454e-862e-3ab8e6aa01d2')
     def test_create_volume_with_nonexistent_volume_type(self):
         # Should not be able to create volume with non-existent volume type
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.NotFound, self.client.create_volume,
                           size='1', volume_type=str(uuid.uuid4()),
@@ -105,7 +105,7 @@
     @test.idempotent_id('0c36f6ae-4604-4017-b0a9-34fdc63096f9')
     def test_create_volume_with_nonexistent_snapshot_id(self):
         # Should not be able to create volume with non-existent snapshot
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.NotFound, self.client.create_volume,
                           size='1', snapshot_id=str(uuid.uuid4()),
@@ -115,7 +115,7 @@
     @test.idempotent_id('47c73e08-4be8-45bb-bfdf-0c4e79b88344')
     def test_create_volume_with_nonexistent_source_volid(self):
         # Should not be able to create volume with non-existent source volume
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.NotFound, self.client.create_volume,
                           size='1', source_volid=str(uuid.uuid4()),
@@ -124,7 +124,7 @@
     @test.attr(type=['negative', 'gate'])
     @test.idempotent_id('0186422c-999a-480e-a026-6a665744c30c')
     def test_update_volume_with_nonexistent_volume_id(self):
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.NotFound, self.client.update_volume,
                           volume_id=str(uuid.uuid4()), display_name=v_name,
@@ -133,7 +133,7 @@
     @test.attr(type=['negative', 'gate'])
     @test.idempotent_id('e66e40d6-65e6-4e75-bdc7-636792fa152d')
     def test_update_volume_with_invalid_volume_id(self):
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.NotFound, self.client.update_volume,
                           volume_id='#$%%&^&^', display_name=v_name,
@@ -142,7 +142,7 @@
     @test.attr(type=['negative', 'gate'])
     @test.idempotent_id('72aeca85-57a5-4c1f-9057-f320f9ea575b')
     def test_update_volume_with_empty_volume_id(self):
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         metadata = {'Type': 'work'}
         self.assertRaises(lib_exc.NotFound, self.client.update_volume,
                           volume_id='', display_name=v_name,
@@ -178,7 +178,7 @@
     @test.idempotent_id('f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6')
     @test.services('compute')
     def test_attach_volumes_with_nonexistent_volume_id(self):
-        srv_name = data_utils.rand_name('Instance-')
+        srv_name = data_utils.rand_name('Instance')
         server = self.servers_client.create_server(srv_name,
                                                    self.image_ref,
                                                    self.flavor_ref)
@@ -266,7 +266,7 @@
     @test.attr(type=['negative', 'gate'])
     @test.idempotent_id('0f4aa809-8c7b-418f-8fb3-84c7a5dfc52f')
     def test_list_volumes_with_nonexistent_name(self):
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         params = {self.name_field: v_name}
         fetched_volume = self.client.list_volumes(params)
         self.assertEqual(0, len(fetched_volume))
@@ -274,7 +274,7 @@
     @test.attr(type=['negative', 'gate'])
     @test.idempotent_id('9ca17820-a0e7-4cbd-a7fa-f4468735e359')
     def test_list_volumes_detail_with_nonexistent_name(self):
-        v_name = data_utils.rand_name('Volume-')
+        v_name = data_utils.rand_name('Volume')
         params = {self.name_field: v_name}
         fetched_volume = \
             self.client.list_volumes_with_detail(params)
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 955fbcf..2b6339a 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -68,7 +68,7 @@
     def test_snapshot_create_with_volume_in_use(self):
         # Create a snapshot when volume status is in-use
         # Create a test instance
-        server_name = data_utils.rand_name('instance-')
+        server_name = data_utils.rand_name('instance')
         server = self.servers_client.create_server(server_name,
                                                    self.image_ref,
                                                    self.flavor_ref)
diff --git a/tempest/api_schema/response/compute/v2_1/floating_ips.py b/tempest/api_schema/response/compute/v2_1/floating_ips.py
index 7250773..7369bec 100644
--- a/tempest/api_schema/response/compute/v2_1/floating_ips.py
+++ b/tempest/api_schema/response/compute/v2_1/floating_ips.py
@@ -12,6 +12,28 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+common_floating_ip_info = {
+    'type': 'object',
+    'properties': {
+        # NOTE: Now the type of 'id' is integer, but
+        # here allows 'string' also because we will be
+        # able to change it to 'uuid' in the future.
+        'id': {'type': ['integer', 'string']},
+        'pool': {'type': ['string', 'null']},
+        'instance_id': {'type': ['string', 'null']},
+        'ip': {
+            'type': 'string',
+            'format': 'ip-address'
+        },
+        'fixed_ip': {
+            'type': ['string', 'null'],
+            'format': 'ip-address'
+        }
+    },
+    'required': ['id', 'pool', 'instance_id',
+                 'ip', 'fixed_ip'],
+
+}
 list_floating_ips = {
     'status_code': [200],
     'response_body': {
@@ -19,29 +41,10 @@
         'properties': {
             'floating_ips': {
                 'type': 'array',
-                'items': {
-                    'type': 'object',
-                    'properties': {
-                        # NOTE: Now the type of 'id' is integer, but
-                        # here allows 'string' also because we will be
-                        # able to change it to 'uuid' in the future.
-                        'id': {'type': ['integer', 'string']},
-                        'pool': {'type': ['string', 'null']},
-                        'instance_id': {'type': ['string', 'null']},
-                        'ip': {
-                            'type': 'string',
-                            'format': 'ip-address'
-                        },
-                        'fixed_ip': {
-                            'type': ['string', 'null'],
-                            'format': 'ip-address'
-                        }
-                    },
-                    'required': ['id', 'pool', 'instance_id', 'ip', 'fixed_ip']
-                }
-            }
+                'items': common_floating_ip_info
+            },
         },
-        'required': ['floating_ips']
+        'required': ['floating_ips'],
     }
 }
 
@@ -50,28 +53,9 @@
     'response_body': {
         'type': 'object',
         'properties': {
-            'floating_ip': {
-                'type': 'object',
-                'properties': {
-                    # NOTE: Now the type of 'id' is integer, but here allows
-                    # 'string' also because we will be able to change it to
-                    # 'uuid' in the future.
-                    'id': {'type': ['integer', 'string']},
-                    'pool': {'type': ['string', 'null']},
-                    'instance_id': {'type': ['string', 'null']},
-                    'ip': {
-                        'type': 'string',
-                        'format': 'ip-address'
-                    },
-                    'fixed_ip': {
-                        'type': ['string', 'null'],
-                        'format': 'ip-address'
-                    }
-                },
-                'required': ['id', 'pool', 'instance_id', 'ip', 'fixed_ip']
-            }
+            'floating_ip': common_floating_ip_info
         },
-        'required': ['floating_ip']
+        'required': ['floating_ip'],
     }
 }
 
@@ -87,11 +71,11 @@
                     'properties': {
                         'name': {'type': 'string'}
                     },
-                    'required': ['name']
+                    'required': ['name'],
                 }
             }
         },
-        'required': ['floating_ip_pools']
+        'required': ['floating_ip_pools'],
     }
 }
 
@@ -111,10 +95,10 @@
                     'ip_range': {'type': 'string'},
                     'pool': {'type': ['string', 'null']},
                 },
-                'required': ['interface', 'ip_range', 'pool']
+                'required': ['interface', 'ip_range', 'pool'],
             }
         },
-        'required': ['floating_ips_bulk_create']
+        'required': ['floating_ips_bulk_create'],
     }
 }
 
@@ -125,7 +109,7 @@
         'properties': {
             'floating_ips_bulk_delete': {'type': 'string'}
         },
-        'required': ['floating_ips_bulk_delete']
+        'required': ['floating_ips_bulk_delete'],
     }
 }
 
@@ -155,10 +139,10 @@
                     # NOTE: fixed_ip is introduced after JUNO release,
                     # So it is not defined as 'required'.
                     'required': ['address', 'instance_uuid', 'interface',
-                                 'pool', 'project_id']
+                                 'pool', 'project_id'],
                 }
             }
         },
-        'required': ['floating_ip_info']
+        'required': ['floating_ip_info'],
     }
 }
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 1f1414f..b19faef 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -145,7 +145,7 @@
 
     def _renew_lease_dhclient(self, fixed_ip=None):
         """Renews DHCP lease via dhclient client. """
-        cmd = "sudo /sbin/dhclient -r && /sbin/dhclient"
+        cmd = "sudo /sbin/dhclient -r && sudo /sbin/dhclient"
         self.exec_command(cmd)
 
     def renew_lease(self, fixed_ip=None):
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 35ac42b..3e259b0 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -119,7 +119,7 @@
         return ssh_client.exec_command('cat /tmp/text')
 
     def _write_text(self, ssh_client):
-        text = data_utils.rand_name('text-')
+        text = data_utils.rand_name('text')
         ssh_client.exec_command('echo "%s" > /tmp/text; sync' % (text))
 
         return self._get_content(ssh_client)
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 0baf2de..c8d9f06 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -53,8 +53,8 @@
 
     def _create_sec_group(self):
         sec_grp_cli = self.manager.security_groups_client
-        s_name = data_utils.rand_name('sec_grp-')
-        s_description = data_utils.rand_name('desc-')
+        s_name = data_utils.rand_name('sec_grp')
+        s_description = data_utils.rand_name('desc')
         self.sec_grp = sec_grp_cli.create_security_group(s_name,
                                                          s_description)
         create_rule = sec_grp_cli.create_security_group_rule