Merge "Modify scenario tests"
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index c0b82b6..ed691ac 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -107,13 +107,6 @@
             return None
         return int(ephemeral)
 
-    def add_floating_ip(self):
-        floating_ip = (self.floating_ips_client.create_floating_ip()
-                       ['floating_ip'])
-        self.floating_ips_client.associate_floating_ip_to_server(
-            floating_ip['ip'], self.instance['id'])
-        return floating_ip['ip']
-
     def validate_ports(self):
         for port in self.get_ports(self.node['uuid']):
             n_port_id = port['extra']['vif_port_id']
@@ -131,7 +124,7 @@
         self.validate_ports()
         self.verify_connectivity()
         if CONF.compute.ssh_connect_method == 'floating':
-            floating_ip = self.add_floating_ip()
+            floating_ip = self.create_floating_ip(self.instance)['ip']
             self.verify_connectivity(ip=floating_ip)
 
         vm_client = self.get_remote_client(self.instance)
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index e2f8adb..c55cff6 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -89,17 +89,10 @@
     def verify_ssh(self):
         if self.run_ssh:
             # Obtain a floating IP
-            self.floating_ip = (self.floating_ips_client.create_floating_ip()
-                                ['floating_ip'])
-            self.addCleanup(self.delete_wrapper,
-                            self.floating_ips_client.delete_floating_ip,
-                            self.floating_ip['id'])
-            # Attach a floating IP
-            self.floating_ips_client.associate_floating_ip_to_server(
-                self.floating_ip['ip'], self.instance['id'])
+            self.fip = self.create_floating_ip(self.instance)['ip']
             # Check ssh
             self.ssh_client = self.get_remote_client(
-                server_or_ip=self.floating_ip['ip'],
+                server_or_ip=self.fip,
                 username=self.image_utils.ssh_user(self.image_ref),
                 private_key=self.keypair['private_key'])
 
@@ -110,12 +103,11 @@
 
             def exec_cmd_and_verify_output():
                 cmd = 'curl ' + md_url
-                floating_ip = self.floating_ip['ip']
                 result = self.ssh_client.exec_command(cmd)
                 if result:
                     msg = ('Failed while verifying metadata on server. Result '
-                           'of command "%s" is NOT "%s".' % (cmd, floating_ip))
-                    self.assertEqual(floating_ip, result, msg)
+                           'of command "%s" is NOT "%s".' % (cmd, self.fip))
+                    self.assertEqual(self.fip, result, msg)
                     return 'Verification is successful!'
 
             if not test.call_until_true(exec_cmd_and_verify_output,
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index bc80412..3b38888 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -79,15 +79,9 @@
                                         create_kwargs=create_kwargs)
 
         if CONF.compute.use_floatingip_for_ssh:
-            floating_ip = (self.floating_ips_client.create_floating_ip()
-                           ['floating_ip'])
-            self.addCleanup(self.delete_wrapper,
-                            self.floating_ips_client.delete_floating_ip,
-                            floating_ip['id'])
-            self.floating_ips_client.associate_floating_ip_to_server(
-                floating_ip['ip'], server['id'])
+            floating_ip = self.create_floating_ip(server)['ip']
             timestamp = self.create_timestamp(
-                floating_ip['ip'], private_key=keypair['private_key'])
+                floating_ip, private_key=keypair['private_key'])
         else:
             timestamp = self.create_timestamp(
                 server, private_key=keypair['private_key'])
@@ -97,7 +91,7 @@
         # with the instance snapshot
         self._shelve_then_unshelve_server(server)
         if CONF.compute.use_floatingip_for_ssh:
-            timestamp2 = self.get_timestamp(floating_ip['ip'],
+            timestamp2 = self.get_timestamp(floating_ip,
                                             private_key=keypair['private_key'])
         else:
             timestamp2 = self.get_timestamp(server,