diff --git a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py index d4befda6aab..185324188c8 100644 --- a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py +++ b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py @@ -76,7 +76,7 @@ class L2populationMechanismDriver(api.MechanismDriver): fdb_entries = self._get_agent_fdb( plugin_context, context.bottom_bound_segment, port, agent_host) if fdb_entries and l3_hamode_db.is_ha_router_port( - context, port['device_owner'], port['device_id']): + plugin_context, port['device_owner'], port['device_id']): session = db_api.get_reader_session() network_id = port['network_id'] other_fdb_ports = self._get_ha_port_agents_fdb( diff --git a/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py index a0149468d86..25aff7cc146 100644 --- a/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py +++ b/neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py @@ -1146,6 +1146,14 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase): self.driver.get_network( self.context, p['port']['network_id']), models.PortBinding(), bindings) + fdbs = { + p['port']['network_id']: { + 'segment_id': 'fakeid', + 'ports': {}, + } + } + mock.patch.object( + l2pop_mech, '_get_agent_fdb', return_value=fdbs).start() # The point is to provide coverage and to assert that # no exceptions are raised. l2pop_mech.delete_port_postcommit(port_context)