Merge "Fix deprecation warnings"
diff --git a/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml b/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml
index dc4ed27..1ae251c 100644
--- a/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml
+++ b/releasenotes/notes/deprecate-compute-images-client-in-volume-tests-92b6dd55fcaba620.yaml
@@ -6,5 +6,5 @@
     compute_images_client and Glance v1 APIs are removed in volume tests.
 upgrade:
   - |
-    Swith to use Glance v2 APIs in volume tests, by adding the Glance v2 client
-    images_client.
+    Switch to use Glance v2 APIs in volume tests, by adding the Glance v2
+    client images_client.
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 8808510..76b9c44 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -168,6 +168,9 @@
 
     @decorators.idempotent_id('aaa6cdf3-55a7-461a-add9-1c8596b9a07c')
     def test_rebuild_server(self):
+        # Get the IPs the server has before rebuilding it
+        original_addresses = (self.client.show_server(self.server_id)['server']
+                              ['addresses'])
         # The server should be rebuilt using the provided image and data
         meta = {'rebuild': 'server'}
         new_name = data_utils.rand_name(self.__class__.__name__ + '-server')
@@ -197,6 +200,7 @@
         rebuilt_image_id = server['image']['id']
         self.assertTrue(self.image_ref_alt.endswith(rebuilt_image_id))
         self.assertEqual(new_name, server['name'])
+        self.assertEqual(original_addresses, server['addresses'])
 
         if CONF.validation.run_validation:
             # Authentication is attempted in the following order of priority:
diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py
index 3b41775..42e13bd 100644
--- a/tempest/api/compute/test_extensions.py
+++ b/tempest/api/compute/test_extensions.py
@@ -35,16 +35,18 @@
             raise self.skipException('There are not any extensions configured')
         extensions = self.extensions_client.list_extensions()['extensions']
         ext = CONF.compute_feature_enabled.api_extensions[0]
-        if ext == 'all':
-            self.assertIn('Hosts', map(lambda x: x['name'], extensions))
-        elif ext:
-            self.assertIn(ext, map(lambda x: x['alias'], extensions))
-        else:
-            raise self.skipException('There are not any extensions configured')
+
         # Log extensions list
         extension_list = map(lambda x: x['alias'], extensions)
         LOG.debug("Nova extensions: %s", ','.join(extension_list))
 
+        if ext == 'all':
+            self.assertIn('Hosts', map(lambda x: x['name'], extensions))
+        elif ext:
+            self.assertIn(ext, extension_list)
+        else:
+            raise self.skipException('There are not any extensions configured')
+
     @decorators.idempotent_id('05762f39-bdfa-4cdb-9b46-b78f8e78e2fd')
     @test.requires_ext(extension='os-consoles', service='compute')
     def test_get_extension(self):
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index b0a6622..11517cc 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -113,51 +113,35 @@
     def test_list_get_volume_attachments(self):
         # List volume attachment of the server
         server = self._create_server()
-        volume = self.create_volume()
-        attachment = self.attach_volume(server, volume,
-                                        device=('/dev/%s' % self.device))
+        volume_1st = self.create_volume()
+        attachment_1st = self.attach_volume(server, volume_1st,
+                                            device=('/dev/%s' % self.device))
         body = self.servers_client.list_volume_attachments(
             server['id'])['volumeAttachments']
         self.assertEqual(1, len(body))
-        self.assertIn(attachment, body)
+        self.assertIn(attachment_1st, body)
 
         # Get volume attachment of the server
         body = self.servers_client.show_volume_attachment(
             server['id'],
-            attachment['id'])['volumeAttachment']
+            attachment_1st['id'])['volumeAttachment']
         self.assertEqual(server['id'], body['serverId'])
-        self.assertEqual(volume['id'], body['volumeId'])
-        self.assertEqual(attachment['id'], body['id'])
+        self.assertEqual(volume_1st['id'], body['volumeId'])
+        self.assertEqual(attachment_1st['id'], body['id'])
 
-    @decorators.idempotent_id('757d488b-a951-4bc7-b3cd-f417028da08a')
-    def test_list_get_two_volume_attachments(self):
-        # NOTE: This test is using the volume device auto-assignment
-        # without specifying the device ("/dev/sdb", etc). The feature
-        # is supported since Nova Liberty release or later. So this should
-        # be skipped on older clouds.
-        server = self._create_server()
-        volume_1st = self.create_volume()
+        # attach one more volume to server
         volume_2nd = self.create_volume()
-        attachment_1st = self.attach_volume(server, volume_1st)
         attachment_2nd = self.attach_volume(server, volume_2nd)
-
         body = self.servers_client.list_volume_attachments(
             server['id'])['volumeAttachments']
         self.assertEqual(2, len(body))
 
-        body = self.servers_client.show_volume_attachment(
-            server['id'],
-            attachment_1st['id'])['volumeAttachment']
-        self.assertEqual(server['id'], body['serverId'])
-        self.assertEqual(attachment_1st['volumeId'], body['volumeId'])
-        self.assertEqual(attachment_1st['id'], body['id'])
-
-        body = self.servers_client.show_volume_attachment(
-            server['id'],
-            attachment_2nd['id'])['volumeAttachment']
-        self.assertEqual(server['id'], body['serverId'])
-        self.assertEqual(attachment_2nd['volumeId'], body['volumeId'])
-        self.assertEqual(attachment_2nd['id'], body['id'])
+        for attachment in [attachment_1st, attachment_2nd]:
+            body = self.servers_client.show_volume_attachment(
+                server['id'], attachment['id'])['volumeAttachment']
+            self.assertEqual(server['id'], body['serverId'])
+            self.assertEqual(attachment['volumeId'], body['volumeId'])
+            self.assertEqual(attachment['id'], body['id'])
 
 
 class AttachVolumeShelveTestJSON(AttachVolumeTestJSON):
diff --git a/tempest/api/network/base_routers.py b/tempest/api/network/base_routers.py
index f6fd871..6d4e756 100644
--- a/tempest/api/network/base_routers.py
+++ b/tempest/api/network/base_routers.py
@@ -33,15 +33,6 @@
         self.addCleanup(self._cleanup_router, router)
         return router
 
-    def _delete_router(self, router_id, routers_client=None):
-        client = routers_client or self.routers_client
-        client.delete_router(router_id)
-        # Asserting that the router is not found in the list
-        # after deletion
-        list_body = client.list_routers()
-        routers_list = [router['id'] for router in list_body['routers']]
-        self.assertNotIn(router_id, routers_list)
-
     def _add_router_interface_with_subnet_id(self, router_id, subnet_id):
         interface = self.routers_client.add_router_interface(
             router_id, subnet_id=subnet_id)