Add support for specifying fixed IP address in floating IP association
This patch enhances the floating IP association process by allowing the
fixed IP address to be explicitly passed. This provides greater control
and ensures the correct port is targeted when associating a floating IP,
resolving ambiguity when multiple ports are present.
Change-Id: I829703a63397a1116360a768dbccdb1f237be87c
Related-Bug: #2089798
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index be2b2d6..57bc2e9 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -1199,14 +1199,15 @@
except (KeyError, IndexError):
return None
- def associate_floating_ip(self, floating_ip, server):
+ def associate_floating_ip(self, floating_ip, server, ip_addr=None,
+ **kwargs):
"""Associate floating ip to server
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)
+ port_id, _ = self.get_server_port_id_and_ip4(server, ip_addr=ip_addr)
+ kwargs.update({"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'])