[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
(cherry picked from commit bf9f20238de21422881a28075349c4eae2851952)
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 02faa59..65e1181 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -245,6 +245,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: