From 3595f5fa9f7fa93eed83e6bcf08901e47564a239 Mon Sep 17 00:00:00 2001 From: Roman Popelka Date: Thu, 14 Apr 2022 16:13:23 +0200 Subject: [PATCH] Remove get_server_ip & create_floating_ip As tempest.scenario.manager was announced stable interface in Tempest 27.0.0[1] it can be now reused in plugins. Replaced methods: * get_server_ip * create_floating_ip Etherpad concerning this effort: https://etherpad.opendev.org/p/tempest-scenario-manager-cleanup [1] https://docs.openstack.org/releasenotes/tempest/v27.0.0.html#release-notes-27-0-0 Change-Id: Iaaa144d0480ba61d56ad5f0faeaafc7969770bf7 --- .../tests/scenario/manager.py | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/novajoin_tempest_plugin/tests/scenario/manager.py b/novajoin_tempest_plugin/tests/scenario/manager.py index fc533f9..0807c8f 100644 --- a/novajoin_tempest_plugin/tests/scenario/manager.py +++ b/novajoin_tempest_plugin/tests/scenario/manager.py @@ -21,7 +21,6 @@ from tempest.common import image as common_image from tempest.common.utils.linux import remote_client from tempest.common import waiters from tempest import config -from tempest import exceptions from tempest.lib.common.utils import data_utils from tempest.lib.common.utils import test_utils from tempest.lib import exceptions as lib_exc @@ -151,51 +150,6 @@ class ScenarioTest(tempest.scenario.manager.ScenarioTest): self.image_client.store_image_file(image['id'], image_file) return image['id'] - def create_floating_ip(self, thing, pool_name=None): - """Create a floating IP and associates to a server on Nova""" - - if not pool_name: - pool_name = CONF.network.floating_network_name - floating_ip = (self.compute_floating_ips_client. - create_floating_ip(pool=pool_name)['floating_ip']) - self.addCleanup(test_utils.call_and_ignore_notfound_exc, - self.compute_floating_ips_client.delete_floating_ip, - floating_ip['id']) - self.compute_floating_ips_client.associate_floating_ip_to_server( - floating_ip['ip'], thing['id']) - return floating_ip - - def get_server_ip(self, server): - """Get the server fixed or floating IP. - - Based on the configuration we're in, return a correct ip - address for validating that a guest is up. - """ - if CONF.validation.connect_method == 'floating': - # The tests calling this method don't have a floating IP - # and can't make use of the validation resources. So the - # method is creating the floating IP there. - return self.create_floating_ip(server)['ip'] - elif CONF.validation.connect_method == 'fixed': - # Determine the network name to look for based on config or creds - # provider network resources. - if CONF.validation.network_for_ssh: - addresses = server['addresses'][ - CONF.validation.network_for_ssh] - else: - creds_provider = self._get_credentials_provider() - net_creds = creds_provider.get_primary_creds() - network = getattr(net_creds, 'network', None) - addresses = (server['addresses'][network['name']] - if network else []) - for addr in addresses: - if (addr['version'] == CONF.validation.ip_version_for_ssh and - addr['OS-EXT-IPS:type'] == 'fixed'): - return addr['addr'] - raise exceptions.ServerUnreachable(server_id=server['id']) - else: - raise lib_exc.InvalidConfiguration() - def get_remote_client(self, ip_address, username=None, private_key=None): """Get a SSH client to a remote server