self._populate_subnets_for_ports(context, port_list)
return port_list
- def dvr_vmarp_table_update(self, context, port_dict, action):
- """Notify L3 agents of VM ARP table changes.
+ def update_arp_entry_for_dvr_service_port(
+ self, context, port_dict, action):
+ """Notify L3 agents of ARP table entry for dvr service port.
- When a VM goes up or down, look for one DVR router on the port's
- subnet, and send the VM's ARP details to all L3 agents hosting the
- router.
+ When a dvr service port goes up or down, look for the DVR
+ router on the port's subnet, and send the ARP details to all
+ L3 agents hosting the router.
"""
# Check this is a valid VM or service port
service_constants.L3_ROUTER_NAT)
context = kwargs['context']
l3plugin.dvr_handle_new_service_port(context, port)
- l3plugin.dvr_vmarp_table_update(context, port, "add")
+ l3plugin.update_arp_entry_for_dvr_service_port(context, port, "add")
def _notify_port_delete(event, resource, trigger, **kwargs):
removed_routers = kwargs['removed_routers']
l3plugin = manager.NeutronManager.get_service_plugins().get(
service_constants.L3_ROUTER_NAT)
- l3plugin.dvr_vmarp_table_update(context, port, "del")
+ l3plugin.update_arp_entry_for_dvr_service_port(context, port, "del")
for router in removed_routers:
l3plugin.remove_router_from_l3_agent(
context, router['agent_id'], router['router_id'])
if (is_new_port_binding_changed and
n_utils.is_dvr_serviced(new_device_owner)):
l3plugin.dvr_handle_new_service_port(context, new_port)
- l3plugin.dvr_vmarp_table_update(context, new_port, "add")
+ l3plugin.update_arp_entry_for_dvr_service_port(
+ context, new_port, "add")
elif kwargs.get('mac_address_updated'):
- l3plugin.dvr_vmarp_table_update(context, new_port, "add")
+ l3plugin.update_arp_entry_for_dvr_service_port(
+ context, new_port, "add")
def subscribe():
mock_notify.assert_called_once_with(
'router', 'before_update', self.mixin, **kwargs)
- def _test_dvr_vmarp_table_update(self, device_owner, action):
+ def _test_update_arp_entry_for_dvr_service_port(
+ self, device_owner, action):
with mock.patch.object(manager.NeutronManager, 'get_plugin') as gp,\
mock.patch.object(self.mixin, '_get_router') as grtr:
plugin = mock.Mock()
plugin.get_ports.return_value = [port, dvr_port]
grtr.return_value = dvr_router
dvr_router.extra_attributes.distributed = True
- self.mixin.dvr_vmarp_table_update(self.ctx, port, action)
+ self.mixin.update_arp_entry_for_dvr_service_port(
+ self.ctx, port, action)
if action == 'add':
self.assertTrue(l3_notify.add_arp_entry.called)
elif action == 'del':
self.assertTrue(l3_notify.del_arp_entry.called)
- def test_dvr_vmarp_table_update_with_service_port_added(self):
+ def test_update_arp_entry_for_dvr_service_port_added(self):
action = 'add'
device_owner = l3_const.DEVICE_OWNER_LOADBALANCER
- self._test_dvr_vmarp_table_update(device_owner, action)
+ self._test_update_arp_entry_for_dvr_service_port(device_owner, action)
- def test_dvr_vmarp_table_update_with_service_port_deleted(self):
+ def test_update_arp_entry_for_dvr_service_port_deleted(self):
action = 'del'
device_owner = l3_const.DEVICE_OWNER_LOADBALANCER
- self._test_dvr_vmarp_table_update(device_owner, action)
+ self._test_update_arp_entry_for_dvr_service_port(device_owner, action)
def test_add_router_interface_csnat_ports_failure(self):
router_dict = {'name': 'test_router', 'admin_state_up': True,
return_value={'L3_ROUTER_NAT': l3plugin}):
l3_dvrscheduler_db._notify_l3_agent_port_update(
'port', 'after_update', plugin, **kwargs)
- self.assertFalse(l3plugin.dvr_vmarp_table_update.called)
+ self.assertFalse(
+ l3plugin.update_arp_entry_for_dvr_service_port.called)
self.assertFalse(
l3plugin.dvr_handle_new_service_port.called)
self.assertFalse(l3plugin.remove_router_from_l3_agent.called)
return_value={'L3_ROUTER_NAT': l3plugin}):
l3_dvrscheduler_db._notify_l3_agent_new_port(
'port', 'after_create', mock.ANY, **kwargs)
- l3plugin.dvr_vmarp_table_update.assert_called_once_with(
- self.adminContext, kwargs.get('port'), 'add')
+ l3plugin.update_arp_entry_for_dvr_service_port.\
+ assert_called_once_with(
+ self.adminContext, kwargs.get('port'), 'add')
l3plugin.dvr_handle_new_service_port.assert_called_once_with(
self.adminContext, kwargs.get('port'))
return_value={'L3_ROUTER_NAT': l3plugin}):
l3_dvrscheduler_db._notify_l3_agent_new_port(
'port', 'after_create', mock.ANY, **kwargs)
- self.assertFalse(l3plugin.dvr_vmarp_table_update.called)
+ self.assertFalse(
+ l3plugin.update_arp_entry_for_dvr_service_port.called)
self.assertFalse(
l3plugin.dvr_handle_new_service_port.called)
l3_dvrscheduler_db._notify_l3_agent_port_update(
'port', 'after_update', mock.ANY, **kwargs)
- self.assertFalse(l3plugin.dvr_vmarp_table_update.called)
+ self.assertFalse(
+ l3plugin.update_arp_entry_for_dvr_service_port.called)
self.assertFalse(
l3plugin.dvr_handle_new_service_port.called)
self.assertFalse(l3plugin.remove_router_from_l3_agent.called)
l3_dvrscheduler_db._notify_l3_agent_port_update(
'port', 'after_update', mock.ANY, **kwargs)
- l3plugin.dvr_vmarp_table_update.assert_called_once_with(
- self.adminContext, kwargs.get('port'), 'add')
+ l3plugin.update_arp_entry_for_dvr_service_port.\
+ assert_called_once_with(
+ self.adminContext, kwargs.get('port'), 'add')
self.assertFalse(l3plugin.dvr_handle_new_service_port.called)
def test__notify_l3_agent_update_port_with_port_binding_change(self):
'port', 'after_update', mock.ANY, **kwargs)
l3plugin.remove_router_from_l3_agent.assert_called_once_with(
self.adminContext, 'foo_agent', 'foo_id')
- self.assertEqual(2, l3plugin.dvr_vmarp_table_update.call_count)
+ self.assertEqual(
+ 2, l3plugin.update_arp_entry_for_dvr_service_port.call_count)
l3plugin.dvr_handle_new_service_port.assert_called_once_with(
self.adminContext, kwargs.get('port'))
l3_dvrscheduler_db._notify_l3_agent_port_update(
'port', 'after_update', plugin, **kwargs)
- self.assertEqual(1, l3plugin.dvr_vmarp_table_update.call_count)
- l3plugin.dvr_vmarp_table_update.assert_called_once_with(
- self.adminContext, mock.ANY, 'del')
+ self.assertEqual(
+ 1, l3plugin.update_arp_entry_for_dvr_service_port.call_count)
+ l3plugin.update_arp_entry_for_dvr_service_port.\
+ assert_called_once_with(
+ self.adminContext, mock.ANY, 'del')
self.assertFalse(
l3plugin.dvr_handle_new_service_port.called)
}
l3_dvrscheduler_db._notify_port_delete(
'port', 'after_delete', plugin, **kwargs)
- l3plugin.dvr_vmarp_table_update.assert_called_once_with(
- self.adminContext, mock.ANY, 'del')
+ l3plugin.update_arp_entry_for_dvr_service_port.\
+ assert_called_once_with(
+ self.adminContext, mock.ANY, 'del')
l3plugin.remove_router_from_l3_agent.assert_called_once_with(
self.adminContext, 'foo_agent', 'foo_id')