[test_port_list_filter_by_ip_substr] Check if IP free before use it in the test
The test chooses 2 IPs from test subnet but this IP can be used
by portprober or DHCP servises. It can cause test fail.
This patch adds a check if selected IP is free
Related-Prod: PRODX-41551
Change-Id: Ib216d0df9d1c2716cccb3a98ccae625f06308d1f
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 190f7e0..dc5504d 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -238,6 +238,10 @@
for ip in ip_network:
if ip == ip_network.network_address:
continue
+ if self.ports_client.list_ports(
+ network_id=network['id'],
+ fixed_ips='ip_address=' + str(ip))['ports']:
+ continue
if ip_address_1 is None:
ip_address_1 = str(ip)
else: