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

Extra routes are not configured on Router namespaces in dvr_snat
node with DVR-HA configuration.
This patch fixes the problem.

Change-Id: If620b23564479042aa6f58640bcd6705e5eb52cf
Closes-Bug: #1797037
(cherry picked from commit 81652cd939)
This commit is contained in:
Swaminathan Vasudevan 2018-10-09 23:19:20 -07:00
parent 026d911832
commit 114752c581
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

@ -1497,10 +1497,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)
@ -1519,7 +1521,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.
@ -1609,6 +1613,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(