]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
ofagent: Add a missing normalized_port_name
authorYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Mon, 28 Jul 2014 07:20:40 +0000 (16:20 +0900)
committerYAMAMOTO Takashi <yamamoto@valinux.co.jp>
Wed, 6 Aug 2014 17:03:58 +0000 (17:03 +0000)
Otherwise port_unbound can not find Port for non "tap" prefixed ports.

Closes-Bug: #1349898
Change-Id: I9ac7cc1e35205bddc64e7865c45e801df8cd6b33

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

index 4e09075afe9614808524df5f7006d8314aab21ab..dc74f5f480b94e7ef2c018fff4212fdf107aedf3 100644 (file)
@@ -695,7 +695,7 @@ class OFANeutronAgent(n_rpc.RpcCallback,
             self.provision_local_vlan(net_uuid, network_type,
                                       physical_network, segmentation_id)
         lvm = self.local_vlan_map[net_uuid]
-        lvm.vif_ports[port.port_name] = port
+        lvm.vif_ports[port.normalized_port_name()] = port
         # Do not bind a port if it's already bound
         cur_tag = self.int_br.db_get_val("Port", port.port_name, "tag")
         if cur_tag != str(lvm.vlan):
index 99892b11a3a9f2382fc77b8a1e0787a6f2792bd6..18e10dda13635d6ff556bc47498df9a8ebe9dbdf 100644 (file)
@@ -234,7 +234,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase):
 
     def _mock_port_bound(self, ofport=None, new_local_vlan=None,
                          old_local_vlan=None):
-        port = mock.Mock()
+        port_name = 'tap96408df7-16'
+        port = _mock_port(True, port_name)
         port.ofport = ofport
         net_uuid = 'my-net-uuid'
         ofp = self.agent.int_br.datapath.ofproto
@@ -270,6 +271,8 @@ class TestOFANeutronAgent(ofa_test_base.OFAAgentTestBase):
         else:
             self.assertFalse(set_ovs_db_func.called)
             self.assertFalse(ryu_send_msg_func.called)
+        self.assertTrue(self.agent.local_vlan_map[net_uuid].
+                        vif_ports[port_name] is port)
 
     def test_port_bound_deletes_flows_for_valid_ofport(self):
         self._mock_port_bound(ofport=1, new_local_vlan=1)