LB vip route advertisement fix

- bug id 2391970

Change-Id: I442a9543d734719e572f9f4641205159e0fbbd21
This commit is contained in:
shubhamk 2019-07-26 08:15:02 +00:00 committed by Shubham Kadam
parent 36965d655a
commit 3a016fc5f8

View File

@ -89,10 +89,13 @@ class TestLBVipRoute(feature_manager.FeatureManager):
"""
kwargs = {"enable_snat": True}
router_state_1 = self.create_topology_router(set_gateway=True,
routers_client=self.
cmgr_adm.routers_client,
**kwargs)
network_lbaas_1 = self.create_topology_network("network_lbaas")
sec_rule_client = self.manager.security_group_rules_client
sec_client = self.manager.security_groups_client
network_lbaas_1 = self.create_topology_network(
"network_lbaas", networks_client=self.cmgr_adm.networks_client)
sec_rule_client = self.cmgr_adm.security_group_rules_client
sec_client = self.cmgr_adm.security_groups_client
kwargs = dict(tenant_id=network_lbaas_1['tenant_id'],
security_group_rules_client=sec_rule_client,
security_groups_client=sec_client)
@ -103,24 +106,52 @@ class TestLBVipRoute(feature_manager.FeatureManager):
dict(direction='ingress', protocol='tcp',
port_range_min=443, port_range_max=443, )]
for rule in lbaas_rules:
self.add_security_group_rule(self.sg, rule)
self.add_security_group_rule(self.sg, rule,
ruleclient=sec_rule_client,
secclient=sec_client)
subnet_lbaas = self.create_topology_subnet(
"subnet_lbaas", network_lbaas_1, router_id=router_state_1["id"])
"subnet_lbaas", network_lbaas_1, router_id=router_state_1["id"],
routers_client=self.cmgr_adm.routers_client,
subnets_client=self.cmgr_adm.subnets_client)
no_of_servers = 2
image_id = self.get_glance_image_id(["cirros", "esx"])
for instance in range(0, no_of_servers):
self.create_topology_instance(
"server_lbaas_%s" % instance, [network_lbaas_1],
security_groups=[{'name': self.sg['name']}],
image_id=image_id, create_floating_ip=False)
lb_resource = self.create_project_lbaas(protocol_type="HTTP",
protocol_port="80",
vip_subnet_id=subnet_lbaas[
'id'],
lb_algorithm="ROUND_ROBIN",
hm_type='PING',
create_fip=False,
clean_up=True)
image_id=image_id, create_floating_ip=False,
clients=self.cmgr_adm)
loadbalancer = self.load_balancers_admin_client.\
create_load_balancer(name='test-lb',
vip_subnet_id=subnet_lbaas['id']
)['loadbalancer']
self.load_balancers_admin_client.\
wait_for_load_balancer_status(loadbalancer['id'])
listener = self.listeners_admin_client.create_listener(
loadbalancer_id=loadbalancer['id'], protocol='HTTP',
protocol_port='80', name='test_listener')['listener']
self.load_balancers_admin_client.\
wait_for_load_balancer_status(loadbalancer['id'])
pool = self.pools_admin_client.create_pool(
listener_id=listener['id'],
lb_algorithm='ROUND_ROBIN', protocol='HTTP')['pool']
self.load_balancers_admin_client.\
wait_for_load_balancer_status(loadbalancer['id'])
self.health_monitors_admin_client.create_health_monitor(
pool_id=pool['id'], type='PING',
delay='5', max_retries='3',
timeout='5')
self.load_balancers_admin_client.\
wait_for_load_balancer_status(loadbalancer['id'])
self.members_admin_client.create_member(
pool['id'], subnet_id=subnet_lbaas['id'],
address="127.0.0.1",
protocol_port=80)['member']
self.load_balancers_admin_client.\
wait_for_load_balancer_status(loadbalancer['id'])
lb_resource = {}
lb_resource['vip_ip'] = loadbalancer['vip_address']
lb_resource['lb_id'] = loadbalancer['id']
time.sleep(30)
nsx_router_nat_rules = self.nsx.get_logical_router_nat_rule_ips(
router_state_1['name'], router_state_1['id'])
@ -135,9 +166,9 @@ class TestLBVipRoute(feature_manager.FeatureManager):
route_present = True
self.assertEqual(False, route_present, 'Lb vip route is advertised')
vip_fip = self.create_floatingip(
self.loadbalancer,
loadbalancer,
client=self.cmgr_adm.floating_ips_client,
port_id=self.loadbalancer['vip_port_id'])
port_id=loadbalancer['vip_port_id'])
self.vip_ip_address = vip_fip['floating_ip_address']
time.sleep(30)
nsx_router_nat_rules = self.nsx.get_logical_router_nat_rule_ips(
@ -169,7 +200,7 @@ class TestLBVipRoute(feature_manager.FeatureManager):
advertised_net['networks'][0]['advertiseAllow']:
route_present = True
self.assertEqual(False, route_present, 'Lb vip route is advertised')
self.delete_loadbalancer_resources(lb_resource['lb_id'])
self.delete_loadbalancer_resources(lb_resource['lb_id'], admin=True)
time.sleep(30)
nsx_router_nat_rules = self.nsx.get_logical_router_nat_rule_ips(
router_state_1['name'], router_state_1['id'])