Remove _get_network_by_name, _disassociate_floating_ip methods

As tempest.scenario.manager was announced stable interface in Tempest 27.0.0[1] it can be now reused in plugins.

Replaced methods:
	* _get_network_by_name
	* _disassociate_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: Id5d9b1f74e2d9df56a320587b9ceb8b12f91963b
This commit is contained in:
Roman Popelka 2022-03-10 10:30:48 +01:00
parent 92c87c3a7c
commit 383c58fdae
1 changed files with 2 additions and 17 deletions

View File

@ -284,7 +284,7 @@ class ScenarioTest(manager.ScenarioTest):
raise raise
class NetworkScenarioTest(ScenarioTest): class NetworkScenarioTest(manager.NetworkScenarioTest):
"""Base class for network scenario tests. """Base class for network scenario tests.
This class provide helpers for network scenario tests, using the neutron This class provide helpers for network scenario tests, using the neutron
@ -426,13 +426,6 @@ class NetworkScenarioTest(ScenarioTest):
% port_map) % port_map)
return port_map[0] return port_map[0]
def _get_network_by_name(self, network_name):
net = self.os_admin.networks_client.list_networks(
name=network_name)['networks']
self.assertNotEqual(len(net), 0,
"Unable to get network by name: %s" % network_name)
return net[0]
def create_floating_ip(self, thing, external_network_id=None, def create_floating_ip(self, thing, external_network_id=None,
port_id=None, client=None): port_id=None, client=None):
"""Create a floating IP and associates to a resource/port on Neutron""" """Create a floating IP and associates to a resource/port on Neutron"""
@ -464,14 +457,6 @@ class NetworkScenarioTest(ScenarioTest):
self.assertEqual(port_id, floating_ip['port_id']) self.assertEqual(port_id, floating_ip['port_id'])
return floating_ip return floating_ip
def _disassociate_floating_ip(self, floating_ip):
""":param floating_ip: floating_ips_client.create_floatingip"""
kwargs = dict(port_id=None)
floating_ip = self.floating_ips_client.update_floatingip(
floating_ip['id'], **kwargs)['floatingip']
self.assertIsNone(floating_ip['port_id'])
return floating_ip
def check_floating_ip_status(self, floating_ip, status): def check_floating_ip_status(self, floating_ip, status):
"""Verifies floatingip reaches the given status """Verifies floatingip reaches the given status
@ -798,7 +783,7 @@ class NetworkScenarioTest(ScenarioTest):
if not CONF.compute.fixed_network_name: if not CONF.compute.fixed_network_name:
m = 'fixed_network_name must be specified in config' m = 'fixed_network_name must be specified in config'
raise lib_exc.InvalidConfiguration(m) raise lib_exc.InvalidConfiguration(m)
network = cls._get_network_by_name( network = cls.get_network_by_name(
CONF.compute.fixed_network_name) CONF.compute.fixed_network_name)
router = None router = None
subnet = None subnet = None