]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Rename function '_update_port_down'
authorshihanzhang <shihanzhang@huawei.com>
Wed, 12 Aug 2015 09:12:27 +0000 (17:12 +0800)
committershihanzhang <shihanzhang@huawei.com>
Mon, 17 Aug 2015 10:51:53 +0000 (10:51 +0000)
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
neutron/tests/unit/plugins/ml2/drivers/l2pop/test_mech_driver.py

index 5420e827a7c11584697488bd4055e3e192512dd8..a584b213adb0be4b6bb8a5f64fc0ca50bf171b14 100644 (file)
@@ -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
index 647ca2b99e2147eacb2a5f1310b79b56484bd29b..dd40deae7fa75715247580b08a49c2449095d697 100644 (file)
@@ -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'):