Merge "Floating IP test enhancements"
diff --git a/tempest/api/network/admin/test_floating_ips_admin_actions.py b/tempest/api/network/admin/test_floating_ips_admin_actions.py
index ee3b0bb..e7d4c06 100644
--- a/tempest/api/network/admin/test_floating_ips_admin_actions.py
+++ b/tempest/api/network/admin/test_floating_ips_admin_actions.py
@@ -15,6 +15,7 @@
 
 from tempest.api.network import base
 from tempest import clients
+from tempest.common.utils import data_utils
 from tempest import config
 from tempest import test
 
@@ -32,6 +33,12 @@
         cls.floating_ip = cls.create_floatingip(cls.ext_net_id)
         cls.alt_manager = clients.Manager(cls.isolated_creds.get_alt_creds())
         cls.alt_client = cls.alt_manager.network_client
+        cls.network = cls.create_network()
+        cls.subnet = cls.create_subnet(cls.network)
+        cls.router = cls.create_router(data_utils.rand_name('router-'),
+                                       external_network_id=cls.ext_net_id)
+        cls.create_router_interface(cls.router['id'], cls.subnet['id'])
+        cls.port = cls.create_port(cls.network)
 
     @test.attr(type='smoke')
     def test_list_floating_ips_from_admin_and_nonadmin(self):
@@ -63,3 +70,39 @@
         self.assertNotIn(floating_ip_admin['floatingip']['id'],
                          floating_ip_ids)
         self.assertNotIn(floating_ip_alt['id'], floating_ip_ids)
+
+    @test.attr(type='smoke')
+    def test_create_list_show_floating_ip_with_tenant_id_by_admin(self):
+        # Creates a floating IP
+        body = self.admin_client.create_floatingip(
+            floating_network_id=self.ext_net_id,
+            tenant_id=self.network['tenant_id'],
+            port_id=self.port['id'])
+        created_floating_ip = body['floatingip']
+        self.addCleanup(self.client.delete_floatingip,
+                        created_floating_ip['id'])
+        self.assertIsNotNone(created_floating_ip['id'])
+        self.assertIsNotNone(created_floating_ip['tenant_id'])
+        self.assertIsNotNone(created_floating_ip['floating_ip_address'])
+        self.assertEqual(created_floating_ip['port_id'], self.port['id'])
+        self.assertEqual(created_floating_ip['floating_network_id'],
+                         self.ext_net_id)
+        port = self.port['fixed_ips']
+        self.assertEqual(created_floating_ip['fixed_ip_address'],
+                         port[0]['ip_address'])
+        # Verifies the details of a floating_ip
+        floating_ip = self.admin_client.show_floatingip(
+            created_floating_ip['id'])
+        shown_floating_ip = floating_ip['floatingip']
+        self.assertEqual(shown_floating_ip['id'], created_floating_ip['id'])
+        self.assertEqual(shown_floating_ip['floating_network_id'],
+                         self.ext_net_id)
+        self.assertEqual(shown_floating_ip['tenant_id'],
+                         self.network['tenant_id'])
+        self.assertEqual(shown_floating_ip['floating_ip_address'],
+                         created_floating_ip['floating_ip_address'])
+        self.assertEqual(shown_floating_ip['port_id'], self.port['id'])
+        # Verify the floating ip exists in the list of all floating_ips
+        floating_ips = self.admin_client.list_floatingips()
+        floatingip_id_list = [f['id'] for f in floating_ips['floatingips']]
+        self.assertIn(created_floating_ip['id'], floatingip_id_list)