Merge "Filter by device_owner instead of iterating by all subnet ports"
This commit is contained in:
commit
e0beb2be22
|
@ -684,18 +684,18 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
|
||||||
"""Generates the arp table entry and notifies the l3 agent."""
|
"""Generates the arp table entry and notifies the l3 agent."""
|
||||||
ip_address = fixed_ip['ip_address']
|
ip_address = fixed_ip['ip_address']
|
||||||
subnet = fixed_ip['subnet_id']
|
subnet = fixed_ip['subnet_id']
|
||||||
filters = {'fixed_ips': {'subnet_id': [subnet]}}
|
filters = {'fixed_ips': {'subnet_id': [subnet]},
|
||||||
|
'device_owner': [l3_const.DEVICE_OWNER_DVR_INTERFACE]}
|
||||||
ports = self._core_plugin.get_ports(context, filters=filters)
|
ports = self._core_plugin.get_ports(context, filters=filters)
|
||||||
for port in ports:
|
for port in ports:
|
||||||
if port['device_owner'] == l3_const.DEVICE_OWNER_DVR_INTERFACE:
|
router_id = port['device_id']
|
||||||
router_id = port['device_id']
|
router_dict = self._get_router(context, router_id)
|
||||||
router_dict = self._get_router(context, router_id)
|
if router_dict.extra_attributes.distributed:
|
||||||
if router_dict.extra_attributes.distributed:
|
arp_table = {'ip_address': ip_address,
|
||||||
arp_table = {'ip_address': ip_address,
|
'mac_address': mac_address,
|
||||||
'mac_address': mac_address,
|
'subnet_id': subnet}
|
||||||
'subnet_id': subnet}
|
notifier(context, router_id, arp_table)
|
||||||
notifier(context, router_id, arp_table)
|
return
|
||||||
return
|
|
||||||
|
|
||||||
def update_arp_entry_for_dvr_service_port(
|
def update_arp_entry_for_dvr_service_port(
|
||||||
self, context, port_dict, action):
|
self, context, port_dict, action):
|
||||||
|
|
|
@ -596,7 +596,7 @@ class L3DvrTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
|
||||||
'device_owner': l3_const.DEVICE_OWNER_DVR_INTERFACE,
|
'device_owner': l3_const.DEVICE_OWNER_DVR_INTERFACE,
|
||||||
'device_id': 'dvr_router_id'
|
'device_id': 'dvr_router_id'
|
||||||
}
|
}
|
||||||
plugin.get_ports.return_value = [port, dvr_port]
|
plugin.get_ports.return_value = [dvr_port]
|
||||||
grtr.return_value = dvr_router
|
grtr.return_value = dvr_router
|
||||||
dvr_router.extra_attributes.distributed = True
|
dvr_router.extra_attributes.distributed = True
|
||||||
self.mixin.update_arp_entry_for_dvr_service_port(
|
self.mixin.update_arp_entry_for_dvr_service_port(
|
||||||
|
|
Loading…
Reference in New Issue