From 57b49e5f93235e446c109c1d5ee7c3e2b738d556 Mon Sep 17 00:00:00 2001 From: shihanzhang Date: Wed, 12 Aug 2015 17:12:27 +0800 Subject: [PATCH] Rename function '_update_port_down' The function _update_port_down is renamed to _get_agent_fdb because it generates the fdb entries which are send to related l2 agents, but the old name is hard to understand. Change-Id: Ibd5447311361b62a18195a958cbdeb64fc685b24 --- neutron/plugins/ml2/drivers/l2pop/mech_driver.py | 10 +++++----- .../unit/plugins/ml2/drivers/l2pop/test_mech_driver.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py index 5420e827a..a584b213a 100644 --- a/neutron/plugins/ml2/drivers/l2pop/mech_driver.py +++ b/neutron/plugins/ml2/drivers/l2pop/mech_driver.py @@ -50,7 +50,7 @@ class L2populationMechanismDriver(api.MechanismDriver, port = context.current agent_host = context.host - fdb_entries = self._update_port_down(context, port, agent_host) + fdb_entries = self._get_agent_fdb(context, port, agent_host) self.L2populationAgentNotify.remove_fdb_entries(self.rpc_ctx, fdb_entries) @@ -116,7 +116,7 @@ class L2populationMechanismDriver(api.MechanismDriver, self._update_port_up(context) if context.status == const.PORT_STATUS_DOWN: agent_host = context.host - fdb_entries = self._update_port_down( + fdb_entries = self._get_agent_fdb( context, port, agent_host) self.L2populationAgentNotify.remove_fdb_entries( self.rpc_ctx, fdb_entries) @@ -132,7 +132,7 @@ class L2populationMechanismDriver(api.MechanismDriver, if context.status == const.PORT_STATUS_ACTIVE: self._update_port_up(context) elif context.status == const.PORT_STATUS_DOWN: - fdb_entries = self._update_port_down( + fdb_entries = self._get_agent_fdb( context, port, context.host) self.L2populationAgentNotify.remove_fdb_entries( self.rpc_ctx, fdb_entries) @@ -142,7 +142,7 @@ class L2populationMechanismDriver(api.MechanismDriver, original_port = orig[0] original_host = orig[1] # this port has been migrated: remove its entries from fdb - fdb_entries = self._update_port_down( + fdb_entries = self._get_agent_fdb( context, original_port, original_host) self.L2populationAgentNotify.remove_fdb_entries( self.rpc_ctx, fdb_entries) @@ -259,7 +259,7 @@ class L2populationMechanismDriver(api.MechanismDriver, self.L2populationAgentNotify.add_fdb_entries(self.rpc_ctx, other_fdb_entries) - def _update_port_down(self, context, port, agent_host): + def _get_agent_fdb(self, context, port, agent_host): port_infos = self._get_port_infos(context, port, agent_host) if not port_infos: return 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 647ca2b99..dd40deae7 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 @@ -785,7 +785,7 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase): l2pop_mech.L2PopulationAgentNotify = mock.Mock() l2pop_mech.rpc_ctx = mock.Mock() with mock.patch.object(l2pop_mech, - '_update_port_down', + '_get_agent_fdb', return_value=None) as upd_port_down,\ mock.patch.object(l2pop_mech.L2PopulationAgentNotify, 'remove_fdb_entries'): -- 2.45.2