Move get_server_or_ip method to common class
Moved to common class duplicate part of code for "get server or IP"
which used in few scenario tests.
Change-Id: I6368c24764e2515dc8bbcd82d1b0623c24bc77cd
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 3b38888..0e366e9 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -78,24 +78,17 @@
server = self.create_server(image=CONF.compute.image_ref,
create_kwargs=create_kwargs)
- if CONF.compute.use_floatingip_for_ssh:
- floating_ip = self.create_floating_ip(server)['ip']
- timestamp = self.create_timestamp(
- floating_ip, private_key=keypair['private_key'])
- else:
- timestamp = self.create_timestamp(
- server, private_key=keypair['private_key'])
+ instance_ip = self.get_server_or_ip(server)
+ timestamp = self.create_timestamp(instance_ip,
+ private_key=keypair['private_key'])
# Prevent bug #1257594 from coming back
# Unshelve used to boot the instance with the original image, not
# with the instance snapshot
self._shelve_then_unshelve_server(server)
- if CONF.compute.use_floatingip_for_ssh:
- timestamp2 = self.get_timestamp(floating_ip,
- private_key=keypair['private_key'])
- else:
- timestamp2 = self.get_timestamp(server,
- private_key=keypair['private_key'])
+
+ timestamp2 = self.get_timestamp(instance_ip,
+ private_key=keypair['private_key'])
self.assertEqual(timestamp, timestamp2)
@test.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')