Update load balancer tests to use allocation pools
Sometimes LB fixed IPs can overlap with IPs which
portprober picked up from the same network.
Using allocation pools and different IP ranges for
static and dynamic IP assignement can solve the problem
Related-prod: PRODX-49726
Change-Id: Ic8246ef4addf8fd1a0d4654f1613d815350c482a
(cherry picked from commit 6c7f20d1875eaa003819b3eccc3f4764f45cdcf3)
diff --git a/octavia_tempest_plugin/tests/test_base.py b/octavia_tempest_plugin/tests/test_base.py
index 19b827c..6b01a3e 100644
--- a/octavia_tempest_plugin/tests/test_base.py
+++ b/octavia_tempest_plugin/tests/test_base.py
@@ -13,6 +13,7 @@
# under the License.
import ipaddress
+import netaddr
import os
import random
import re
@@ -380,12 +381,20 @@
cls.lb_mem_net_client.show_network,
cls.lb_member_vip_net['id'])
+ # Add allocation pool to prevent IP address conflicts with portprober
+ cidr = netaddr.IPNetwork(CONF.load_balancer.vip_subnet_cidr)
+ pool_start = ipaddress.ip_address(str(cidr[101]))
+ pool_end = ipaddress.ip_address(str(cidr[254]))
+ allocation_pools = [{'start': str(pool_start), 'end': str(pool_end)}]
+
# Create tenant VIP subnet
subnet_kwargs = {
'name': data_utils.rand_name("lb_member_vip_subnet"),
'network_id': cls.lb_member_vip_net['id'],
'cidr': CONF.load_balancer.vip_subnet_cidr,
- 'ip_version': 4}
+ 'ip_version': 4,
+ 'allocation_pools': allocation_pools
+ }
result = cls.lb_mem_subnet_client.create_subnet(**subnet_kwargs)
cls.lb_member_vip_subnet = result['subnet']
LOG.info('lb_member_vip_subnet: {}'.format(cls.lb_member_vip_subnet))