Merge "Correct the usage on listing neutron ports"

This commit is contained in:
Zuul 2018-07-24 18:52:43 +00:00 committed by Gerrit Code Review
commit 3dc8f79c86
1 changed files with 7 additions and 2 deletions

View File

@ -504,8 +504,13 @@ class NetworkScenarioTest(ScenarioTest):
return network
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
ports = self.os_admin.ports_client.list_ports(
device_id=server['id'], fixed_ip=ip_addr)['ports']
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']
# 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