Merge "DVR: Fix router_update failure when agent restarts"

This commit is contained in:
Jenkins 2017-08-11 01:15:50 +00:00 committed by Gerrit Code Review
commit a04f8fd049
2 changed files with 17 additions and 2 deletions

View File

@ -474,8 +474,11 @@ class IpRuleCommand(IpCommandBase):
ip_version = common_utils.get_ip_version(ip)
# In case if we need to add in a rule based on incoming
# interface we don't need to pass in the ip.
if not kwargs.get('iif'):
# interface, pass the "any" IP address, for example, 0.0.0.0/0,
# else pass the given IP.
if kwargs.get('iif'):
kwargs.update({'from': constants.IP_ANY[ip_version]})
else:
kwargs.update({'from': ip})
canonical_kwargs = self._make_canonical(ip_version, kwargs)

View File

@ -767,6 +767,18 @@ class TestDvrRouter(framework.L3AgentTestFramework):
self._assert_dvr_snat_gateway(router1)
self.assertTrue(self._namespace_exists(fip_ns))
def test_dvr_router_update_on_restarted_agent_sets_rtr_fip_connect(self):
self.agent.conf.agent_mode = 'dvr_snat'
router_info = self.generate_dvr_router_info()
router1 = self.manage_router(self.agent, router_info)
self.assertTrue(router1.rtr_fip_connect)
fip_ns = router1.fip_ns.get_name()
self.assertTrue(self._namespace_exists(fip_ns))
restarted_agent = neutron_l3_agent.L3NATAgentWithStateReport(
self.agent.host, self.agent.conf)
router_updated = self.manage_router(restarted_agent, router1.router)
self.assertTrue(router_updated.rtr_fip_connect)
def test_dvr_router_add_fips_on_restarted_agent(self):
self.agent.conf.agent_mode = 'dvr'
router_info = self.generate_dvr_router_info()