Fix VIP IPv6 subnet discovery order

Code was assuming the subnet existed already and only after creating one
if not. On environments where the subnet does not exist, it raises an
IndexError exception as there are no elements in priv_ipv6_subnet. This
patch fixes the order of the code to first create the subnet if ones
does not exist yet.

Story: 2006280
Task: 35982

Change-Id: I9fa9d7e16f32f516592bf155045d4f4e6a15ed6c
This commit is contained in:
Carlos Goncalves 2019-07-25 15:51:30 +02:00
parent b6fb3d1993
commit 84af48c0f0
1 changed files with 4 additions and 3 deletions

View File

@ -309,10 +309,10 @@ class LoadBalancerBaseTest(test.BaseTestCase):
name='ipv6-private-subnet')['subnets']
cls.lb_member_vip_ipv6_subnet_stateful = False
if (priv_ipv6_subnet[0]['ipv6_address_mode'] ==
'dhcpv6-stateful'):
cls.lb_member_vip_ipv6_subnet_stateful = True
if len(priv_ipv6_subnet) == 1:
if (priv_ipv6_subnet[0]['ipv6_address_mode'] ==
'dhcpv6-stateful'):
cls.lb_member_vip_ipv6_subnet_stateful = True
cls.lb_member_vip_ipv6_subnet = priv_ipv6_subnet[0]
cls.lb_member_vip_ipv6_net = {
'id': priv_ipv6_subnet[0]['network_id']}
@ -331,6 +331,7 @@ class LoadBalancerBaseTest(test.BaseTestCase):
cls._logging_delete_subnet,
cls.lb_mem_subnet_client.show_subnet,
cls.lb_member_vip_ipv6_subnet['id'])
LOG.info('lb_member_vip_ipv6_subnet: {}'.format(
cls.lb_member_vip_ipv6_subnet))