Correct the usage on listing neutron ports
The test case uses 'fixed_ip' as a query parameter, but the usage is not correct. In before, the test passed because neutron server ignored this parameter, and returned all the ports, which happened to make the test pass. This patch fixes the usage of this parameter. If there is no ip_address then not to filter the list using the filter. Otherwise, we use 'fixed_ips' parameter and populate its value correctly. Change-Id: Iac4a6024e12ada515312ae8dd62719ae4351f508
This commit is contained in:
parent
f7a3dce473
commit
73ddf9d5b8
@ -443,8 +443,13 @@ class NetworkScenarioTest(ScenarioTest):
|
|||||||
return subnet
|
return subnet
|
||||||
|
|
||||||
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
|
def _get_server_port_id_and_ip4(self, server, ip_addr=None):
|
||||||
ports = self.os_admin.ports_client.list_ports(
|
if ip_addr:
|
||||||
device_id=server['id'], fixed_ip=ip_addr)['ports']
|
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.
|
# A port can have more than one IP address in some cases.
|
||||||
# If the network is dual-stack (IPv4 + IPv6), this port is associated
|
# If the network is dual-stack (IPv4 + IPv6), this port is associated
|
||||||
# with 2 subnets
|
# with 2 subnets
|
||||||
|
Loading…
Reference in New Issue
Block a user