Make sure only one port_id is given.
It could happen by mistake that both port_id and port parameters are
passed to create_floating_ip method. In such case verify they are
the same port to avoid undetected problems.
Change-Id: I4ebdbca21a2f8285cf22f57f55e52892c9feb34d
diff --git a/neutron_tempest_plugin/api/base.py b/neutron_tempest_plugin/api/base.py
index 028d901..b200761 100644
--- a/neutron_tempest_plugin/api/base.py
+++ b/neutron_tempest_plugin/api/base.py
@@ -613,7 +613,11 @@
cls.external_network_id)
if port:
- kwargs['port_id'] = port['id']
+ port_id = kwargs.setdefault('port_id', port['id'])
+ if port_id != port['id']:
+ message = "Port ID specified twice: {!s} != {!s}".format(
+ port_id, port['id'])
+ raise ValueError(message)
fip = client.create_floatingip(external_network_id,
**kwargs)['floatingip']