Fix sporadic failure for test_bgpvpn_migration
Use different network settings for test test_bgpvpn_livemigration.
In case of parallel running some tests fail due to networks overlaping.
Related-prod: PRODX-28007
Change-Id: I868b7490ebd7f70d5a19fffd15a20f5026450419
(cherry picked from commit 3f4c401d8a9c6e35cb607bce715e73ab424056b0)
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/manager.py b/neutron_tempest_plugin/bgpvpn/scenario/manager.py
index b342bc6..21ba60d 100644
--- a/neutron_tempest_plugin/bgpvpn/scenario/manager.py
+++ b/neutron_tempest_plugin/bgpvpn/scenario/manager.py
@@ -1008,9 +1008,10 @@
def _create_servers(self, ports_config=None, port_security=True):
keypair = self.create_keypair()
security_group_ids = [self.security_group['id']]
- if ports_config is None:
+ if not ports_config:
ports_config = [[self.networks[NET_A], IP_A_S1_1],
[self.networks[NET_B], IP_B_S1_1]]
+
for (i, port_config) in enumerate(ports_config):
network = port_config[0]
server = self._create_server(
@@ -1124,8 +1125,13 @@
to_server_ip, from_server_ip, msg)
raise
- def _associate_fip_and_check_l3_bgpvpn(self, should_succeed=True):
- subnet = self.subnets[NET_A][0]
+ def _associate_fip_and_check_l3_bgpvpn(self, subnet=None,
+ should_succeed=True):
+ if not subnet:
+ subnet = self.subnets[NET_A][0]
+ else:
+ subnet = self.subnets[subnet][0]
+
self.router = self._create_router_and_associate_fip(0, subnet)
self._check_l3_bgpvpn(should_succeed=should_succeed)
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py
index f565ba4..24f99dd 100644
--- a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py
+++ b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py
@@ -30,13 +30,18 @@
CONF = config.CONF
LOG = logging.getLogger(__name__)
+NET_D = 'D'
+NET_E = 'E'
+NET_F = 'F'
+
+
if "SUBNETPOOL_PREFIX_V4" in os.environ:
subnet_base = netaddr.IPNetwork(os.environ['SUBNETPOOL_PREFIX_V4'])
if subnet_base.prefixlen > 21:
raise Exception("if SUBNETPOOL_PREFIX_V4 is set, it needs to offer "
"space for at least 8 /24 subnets")
else:
- subnet_base = netaddr.IPNetwork("10.100.0.0/16")
+ subnet_base = netaddr.IPNetwork("10.200.0.0/16")
def assign_24(idx):
@@ -46,6 +51,17 @@
subnet_base[range_size * idx:range_size * (idx + 1)])[0]
+S1D = assign_24(1)
+S1E = assign_24(4)
+S1F = assign_24(6)
+NET_D_S1 = str(S1D)
+NET_E_S1 = str(S1E)
+NET_F_S1 = str(S1F)
+IP_D_S1_1 = str(S1D[10])
+IP_E_S1_1 = str(S1E[20])
+IP_F_S1_1 = str(S1F[30])
+
+
class TestBGPVPNMigration(base.BaseBgpvpnTest, manager.NetworkScenarioTest,
base2.BaseV2ComputeAdminTest):
block_migration = None
@@ -60,7 +76,7 @@
@lockutils.synchronized('bgpvpn')
def new_rt(cls):
cls._rt_index += 1
- return "64512:%d" % cls._rt_index
+ return "64513:%d" % cls._rt_index
def setUp(self):
super(TestBGPVPNMigration, self).setUp()
@@ -81,11 +97,11 @@
after live migration
- 1. Create networks A and B with their respective subnets
- 2. Associate network A and network B to a given L3 BGPVPN
- 3. Start up server 1 in network A
- 4. Start up server 2 in network B
- 5. Create router and connect it to network A
+ 1. Create networks D, E and F with their respective subnets
+ 2. Associate network D, E and network F to a given L3 BGPVPN
+ 3. Start up server 1 in network D
+ 4. Start up server 2 in network E
+ 5. Create router and connect it to network D
6. Give a FIP to server 1
7. Check that server 1 can ping server 2
8. Live migrate server 1
@@ -93,11 +109,17 @@
10. Live migrate server 2
11. Check that server 1 can ping server 2
"""
- self._create_networks_and_subnets()
+ self._create_networks_and_subnets(names=[NET_D, NET_E, NET_F],
+ subnet_cidrs=[[NET_D_S1], [NET_E_S1],
+ [NET_F_S1]])
self._create_l3_bgpvpn()
self._associate_all_nets_to_bgpvpn()
- self._create_servers()
- self._associate_fip_and_check_l3_bgpvpn()
+ self._create_servers(ports_config=[
+ [self.networks[NET_D], IP_D_S1_1],
+ [self.networks[NET_E], IP_E_S1_1],
+ [self.networks[NET_F], IP_F_S1_1]
+ ])
+ self._associate_fip_and_check_l3_bgpvpn(subnet=NET_D)
# Migrate both VMs one by one and check connection
for i in range(2):
source_host = self.get_host_for_server(self.servers[i]['id'])