Added apis to scenario manager

Tempest plugins do use associate_floating_ip() and
disassociate_floating_ip() api but scenario-
manager doesn't implement it.
The plugins using these apis are manila-tempest-
plugin, tap, vmware-nsx and neutron-tempest-plugin.
Hence, added it to the scenario manager

Implements: blueprint tempest-scenario-manager-stable
Signed-off by: Soniya Vyas<svyas@redhat.com>
Change-Id: I41792bdc3478f5f290a6b3b7172ef3f6b4c62c19
This commit is contained in:
Soniya Vyas 2020-09-23 18:40:25 +05:30
parent 60429ddd04
commit ed66447aae
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
features:
- |
Added associate_floating_ip() and dissociate_floating_ip() methods
to the scenario manager.

View File

@ -1137,6 +1137,32 @@ class NetworkScenarioTest(ScenarioTest):
floating_ip['id'])
return floating_ip
def associate_floating_ip(self, floating_ip, server):
"""Associate floating ip
This wrapper utility attaches the floating_ip for
the respective port_id of server
"""
port_id, _ = self._get_server_port_id_and_ip4(server)
kwargs = dict(port_id=port_id)
floating_ip = self.floating_ips_client.update_floatingip(
floating_ip['id'], **kwargs)['floatingip']
self.assertEqual(port_id, floating_ip['port_id'])
return floating_ip
def disassociate_floating_ip(self, floating_ip):
"""Disassociates floating ip
This wrapper utility disassociates given floating ip.
:param floating_ip: a dict which is a return value of
floating_ips_client.create_floatingip method
"""
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):
"""Verifies floatingip reaches the given status