Merge "Check that router info is set before calling _update_arp_entry"
This commit is contained in:
commit
edcfc40a30
@ -1478,7 +1478,8 @@ class L3NATAgent(firewall_l3_agent.FWaaSL3AgentRpcCallback, manager.Manager):
|
||||
mac = arp_table['mac_address']
|
||||
subnet_id = arp_table['subnet_id']
|
||||
ri = self.router_info.get(router_id)
|
||||
self._update_arp_entry(ri, ip, mac, subnet_id, 'add')
|
||||
if ri:
|
||||
self._update_arp_entry(ri, ip, mac, subnet_id, 'add')
|
||||
|
||||
def del_arp_entry(self, context, payload):
|
||||
"""Delete arp entry from router namespace. Called from RPC."""
|
||||
|
@ -624,6 +624,19 @@ class TestBasicRouterOperations(base.BaseTestCase):
|
||||
self.mock_ip_dev.neigh.add.assert_called_once_with(
|
||||
4, '1.7.23.11', '00:11:22:33:44:55')
|
||||
|
||||
def test_add_arp_entry_no_routerinfo(self):
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
router = prepare_router_data(num_internal_ports=2)
|
||||
subnet_id = _get_subnet_id(router[l3_constants.INTERFACE_KEY][0])
|
||||
arp_table = {'ip_address': '1.7.23.11',
|
||||
'mac_address': '00:11:22:33:44:55',
|
||||
'subnet_id': subnet_id}
|
||||
|
||||
payload = {'arp_table': arp_table, 'router_id': router['id']}
|
||||
agent._update_arp_entry = mock.Mock()
|
||||
agent.add_arp_entry(None, payload)
|
||||
self.assertFalse(agent._update_arp_entry.called)
|
||||
|
||||
def test_del_arp_entry(self):
|
||||
agent = l3_agent.L3NATAgent(HOSTNAME, self.conf)
|
||||
router = prepare_router_data(num_internal_ports=2)
|
||||
|
Loading…
Reference in New Issue
Block a user