From d2b58ba48641139e3aa9b9e51bcd5396aca09510 Mon Sep 17 00:00:00 2001 From: Aaron Rosen Date: Thu, 5 Jul 2012 19:31:51 -0400 Subject: [PATCH] OVS plugin tunnel bridges never learn This patch installs a flow_mod to handle each vm with the normal action which allows OVS to do mac learning. Fixes bug 1011467 Change-Id: Ib6500813d4111ae42675459fac64dfb2e9c40d91 --- quantum/plugins/openvswitch/agent/ovs_quantum_agent.py | 10 +++++++--- quantum/plugins/openvswitch/tests/unit/test_tunnel.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py index 9e89be82b..cf0f6d16f 100755 --- a/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py +++ b/quantum/plugins/openvswitch/agent/ovs_quantum_agent.py @@ -478,10 +478,10 @@ class OVSQuantumTunnelAgent(object): # outbound self.tun_br.add_flow(priority=4, in_port=self.patch_int_ofport, dl_vlan=lvid, - actions="strip_vlan,set_tunnel:%s,normal" % - (lsw_id)) - # inbound + actions="set_tunnel:%s,normal" % lsw_id) + # inbound bcast/mcast self.tun_br.add_flow(priority=3, tun_id=lsw_id, + dl_dst="01:00:00:00:00:00/01:00:00:00:00:00", actions="mod_vlan_vid:%s,output:%s" % (lvid, self.patch_int_ofport)) @@ -510,6 +510,10 @@ class OVSQuantumTunnelAgent(object): lvm = self.local_vlan_map[net_uuid] lvm.vif_ids.append(port.vif_id) + # inbound unicast + self.tun_br.add_flow(priority=3, tun_id=lsw_id, dl_dst=port.vif_mac, + actions="mod_vlan_vid:%s,normal" % lvm.vlan) + self.int_br.set_db_attribute("Port", port.port_name, "tag", str(lvm.vlan)) if int(port.ofport) != -1: diff --git a/quantum/plugins/openvswitch/tests/unit/test_tunnel.py b/quantum/plugins/openvswitch/tests/unit/test_tunnel.py index 58563a03b..8a0eeb3db 100644 --- a/quantum/plugins/openvswitch/tests/unit/test_tunnel.py +++ b/quantum/plugins/openvswitch/tests/unit/test_tunnel.py @@ -34,6 +34,7 @@ VIF_MAC = '3c:09:24:1e:78:23' OFPORT_NUM = 1 VIF_PORT = ovs_lib.VifPort('port', OFPORT_NUM, VIF_ID, VIF_MAC, 'switch') +BCAST_MAC = "01:00:00:00:00:00/01:00:00:00:00:00" class DummyPort: @@ -85,13 +86,13 @@ class TunnelTest(unittest.TestCase): self.mox.VerifyAll() def testProvisionLocalVlan(self): - action_string = 'strip_vlan,set_tunnel:%s,normal' % LS_ID + action_string = 'set_tunnel:%s,normal' % LS_ID self.mock_tun_bridge.add_flow(priority=4, in_port=self.INT_OFPORT, dl_vlan=LV_ID, actions=action_string) action_string = 'mod_vlan_vid:%s,output:%s' % (LV_ID, self.INT_OFPORT) self.mock_tun_bridge.add_flow(priority=3, tun_id=LS_ID, - actions=action_string) + dl_dst=BCAST_MAC, actions=action_string) self.mox.ReplayAll() @@ -124,6 +125,11 @@ class TunnelTest(unittest.TestCase): 'tag', str(LVM.vlan)) self.mock_int_bridge.delete_flows(in_port=VIF_PORT.ofport) + action_string = 'mod_vlan_vid:%s,normal' % LV_ID + self.mock_tun_bridge.add_flow(priority=3, tun_id=LS_ID, + dl_dst=VIF_PORT.vif_mac, + actions=action_string) + self.mox.ReplayAll() a = ovs_quantum_agent.OVSQuantumTunnelAgent(self.INT_BRIDGE, self.TUN_BRIDGE, -- 2.45.2