Allow kwargs in _get_server_port_id_and_ip4
As a part of the scenario/manager.py stabilization tracked by
the below BP the patch adds kwargs argument for
_get_server_port_id_and_ip4 method so that the consumers
are able to pass additional parameters if needed.
Change-Id: Ib5f51c7899cc81f76b247474e332f43583658875
Implements: blueprint tempest-scenario-manager-stable
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index ff860d5..9e4d0ed 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -1063,14 +1063,13 @@
return subnet
- def _get_server_port_id_and_ip4(self, server, ip_addr=None):
- if ip_addr:
- ports = self.os_admin.ports_client.list_ports(
- device_id=server['id'],
- fixed_ips='ip_address=%s' % ip_addr)['ports']
- else:
- ports = self.os_admin.ports_client.list_ports(
- device_id=server['id'])['ports']
+ def _get_server_port_id_and_ip4(self, server, ip_addr=None, **kwargs):
+
+ if ip_addr and not kwargs.get('fixed_ips'):
+ kwargs['fixed_ips'] = 'ip_address=%s' % ip_addr
+ ports = self.os_admin.ports_client.list_ports(
+ device_id=server['id'], **kwargs)['ports']
+
# A port can have more than one IP address in some cases.
# If the network is dual-stack (IPv4 + IPv6), this port is associated
# with 2 subnets