Merge "DVR-HA: Configure extra routes on router namespace in dvr_snat node"

This commit is contained in:
Zuul 2018-10-18 17:47:57 +00:00 committed by Gerrit Code Review
commit f253d676b8
2 changed files with 11 additions and 3 deletions

View File

@ -240,6 +240,7 @@ class HaRouter(router.RouterInfo):
keepalived.KeepalivedVirtualRoute(
route['destination'], route['nexthop'])
for route in new_routes]
super(HaRouter, self).routes_updated(old_routes, new_routes)
def _add_default_gw_virtual_route(self, ex_gw_port, interface_name):
gateway_ips = self._get_external_gw_ips(ex_gw_port)

View File

@ -1501,10 +1501,12 @@ class TestDvrRouter(framework.L3AgentTestFramework):
self.assertFalse(r2_chsfr.called)
def _setup_dvr_router_static_routes(
self, router_namespace=True, check_fpr_int_rule_delete=False):
self, router_namespace=True,
check_fpr_int_rule_delete=False, enable_ha=False):
"""Test to validate the extra routes on dvr routers."""
self.agent.conf.agent_mode = 'dvr_snat'
router_info = self.generate_dvr_router_info(enable_snat=True)
router_info = self.generate_dvr_router_info(
enable_snat=True, enable_ha=enable_ha)
router1 = self.manage_router(self.agent, router_info)
self.assertTrue(self._namespace_exists(router1.ns_name))
self._assert_snat_namespace_exists(router1)
@ -1523,7 +1525,9 @@ class TestDvrRouter(framework.L3AgentTestFramework):
router_updated = self.agent.router_info[router_info['id']]
if router_namespace:
self._assert_extra_routes(router_updated)
self._assert_extra_routes(router_updated, namespace=snat_ns_name)
if not enable_ha:
self._assert_extra_routes(router_updated,
namespace=snat_ns_name)
else:
rtr_2_fip, fip_2_rtr = router_updated.rtr_fip_subnet.get_pair()
# Now get the table index based on the fpr-interface ip.
@ -1613,6 +1617,9 @@ class TestDvrRouter(framework.L3AgentTestFramework):
self):
self._setup_dvr_router_static_routes()
def test_dvr_ha_rtr_static_routes_in_rtr_namespace(self):
self._setup_dvr_router_static_routes(enable_ha=True)
def test_dvr_router_rule_and_route_table_cleared_when_fip_removed(
self):
self._setup_dvr_router_static_routes(