Merge "Use allocation pools to prevent IP address conflicts" into mcp/epoxy
diff --git a/tempest/api/compute/servers/test_device_tagging.py b/tempest/api/compute/servers/test_device_tagging.py
index 5f9bb4f..18f9652 100644
--- a/tempest/api/compute/servers/test_device_tagging.py
+++ b/tempest/api/compute/servers/test_device_tagging.py
@@ -165,6 +165,13 @@
subnet2 = self.subnets_client.create_subnet(
network_id=net2['id'],
cidr='10.2.2.0/24',
+ # Add allocation pool to prevent IP address conflicts.
+ allocation_pools=[
+ {
+ "start": "10.2.2.10",
+ "end": "10.2.2.90"
+ }
+ ],
ip_version=4)['subnet']
self.addCleanup(self.subnets_client.delete_subnet, subnet2['id'])
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 65e1181..cca804f 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -237,7 +237,13 @@
"""Test listing ports filtered by part of ip address string"""
# Create network and subnet
network = self._create_network()
- subnet = self._create_subnet(network)
+ address = self.cidr
+ # Add allocation pool to prevent IP address conflicts.
+ pool_start = ipaddress.ip_address(str(address[2]))
+ pool_end = ipaddress.ip_address(str(address[8]))
+ allocation_pools = {'allocation_pools': [{'start': str(pool_start),
+ 'end': str(pool_end)}]}
+ subnet = self._create_subnet(network, **allocation_pools)
# Get two IP addresses
ip_address_1 = None
ip_address_2 = None
@@ -245,9 +251,7 @@
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']:
+ if pool_start <= ip <= pool_end:
continue
if ip_address_1 is None:
ip_address_1 = str(ip)