]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ofagent: Remove network_delete method
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Mon, 28 Jul 2014 08:43:10 +0000 (17:43 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Fri, 8 Aug 2014 15:38:41 +0000 (15:38 +0000)
Removing local_vlan_map entry here makes later port_unbound no-op.
While it isn't a problem right now, it will be when per-port cleanup
is introduced.
This commit simply removes network_delete method.  The local_vlan_map
will be cleaned up when the last port on the network is removed.

Related: blueprint ofagent-merge-bridges
Change-Id: Ib1f1ee16e0178d0362ff2b731957f1f52dd9a596

neutron/plugins/ofagent/agent/ofa_neutron_agent.py
neutron/tests/unit/ofagent/test_ofa_neutron_agent.py

index dc74f5f480b94e7ef2c018fff4212fdf107aedf3..b815575024d7370290416ebb3fadf801c4e466f9 100644 (file)
@@ -298,7 +298,6 @@ class OFANeutronAgent(n_rpc.RpcCallback,
         self.endpoints = [self]
         # Define the listening consumers for the agent
         consumers = [[topics.PORT, topics.UPDATE],
-                     [topics.NETWORK, topics.DELETE],
                      [topics.SECURITY_GROUP, topics.UPDATE],
                      [topics.L2POPULATION, topics.UPDATE, cfg.CONF.host]]
         self.connection = agent_rpc.create_consumers(self.endpoints,
@@ -332,16 +331,6 @@ class OFANeutronAgent(n_rpc.RpcCallback,
             if vif_id in vlan_mapping.vif_ports:
                 return network_id
 
-    def network_delete(self, context, **kwargs):
-        network_id = kwargs.get('network_id')
-        LOG.debug(_("network_delete received network %s"), network_id)
-        # The network may not be defined on this agent
-        lvm = self.local_vlan_map.get(network_id)
-        if lvm:
-            self.reclaim_local_vlan(network_id)
-        else:
-            LOG.debug(_("Network %s not used on agent."), network_id)
-
     def port_update(self, context, **kwargs):
         port = kwargs.get('port')
         # Put the port identifier in the updated_ports set.
index 18e10dda13635d6ff556bc47498df9a8ebe9dbdf..9336611a2d2e094d0add784f3a3888b9f446f9c4 100644 (file)
@@ -544,20 +544,6 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase):
                 self.agent.int_br_device_count
             )
 
-    def test_network_delete(self):
-        with contextlib.nested(
-            mock.patch.object(self.agent, "reclaim_local_vlan"),
-            mock.patch.object(self.agent.tun_br, "cleanup_tunnel_port")
-        ) as (recl_fn, clean_tun_fn):
-            self.agent.network_delete("unused_context",
-                                      network_id="123")
-            self.assertFalse(recl_fn.called)
-            self.agent.local_vlan_map["123"] = "LVM object"
-            self.agent.network_delete("unused_context",
-                                      network_id="123")
-            self.assertFalse(clean_tun_fn.called)
-            recl_fn.assert_called_with("123")
-
     def test_port_update(self):
         port = {"id": "b1981919-f516-11e3-a8f4-08606e7f74e7",
                 "network_id": "124",