diff --git a/neutron/agent/linux/ovs_lib.py b/neutron/agent/linux/ovs_lib.py index 2c2bd9d8b5..98ad2a195f 100644 --- a/neutron/agent/linux/ovs_lib.py +++ b/neutron/agent/linux/ovs_lib.py @@ -142,7 +142,7 @@ class OVSBridge: proto = 'proto' in kwargs and ",%s" % kwargs['proto'] or '' ip = ('nw_src' in kwargs or 'nw_dst' in kwargs) and ',ip' or '' match = (table + in_port + dl_type + dl_vlan + dl_src + dl_dst + - (ip or proto) + nw_src + nw_dst + tun_id) + (proto or ip) + nw_src + nw_dst + tun_id) if match: match = match[1:] # strip leading comma flow_expr_arr.append(match) diff --git a/neutron/tests/unit/openvswitch/test_ovs_lib.py b/neutron/tests/unit/openvswitch/test_ovs_lib.py index 1b9486affe..d0c8f33620 100644 --- a/neutron/tests/unit/openvswitch/test_ovs_lib.py +++ b/neutron/tests/unit/openvswitch/test_ovs_lib.py @@ -91,6 +91,7 @@ class OVS_Lib_Test(base.BaseTestCase): ofport = "99" vid = 4000 lsw_id = 18 + cidr = '192.168.1.0/24' utils.execute(["ovs-ofctl", "add-flow", self.BR_NAME, "hard_timeout=0,idle_timeout=0," "priority=2,dl_src=ca:fe:de:ad:be:ef" @@ -119,6 +120,10 @@ class OVS_Lib_Test(base.BaseTestCase): "priority=3,tun_id=%s,actions=" "mod_vlan_vid:%s,output:%s" % (lsw_id, vid, ofport)], root_helper=self.root_helper) + utils.execute(["ovs-ofctl", "add-flow", self.BR_NAME, + "hard_timeout=0,idle_timeout=0," + "priority=4,arp,nw_src=%s,actions=drop" % cidr], + root_helper=self.root_helper) self.mox.ReplayAll() self.br.add_flow(priority=2, dl_src="ca:fe:de:ad:be:ef", @@ -133,6 +138,7 @@ class OVS_Lib_Test(base.BaseTestCase): self.br.add_flow(priority=3, tun_id=lsw_id, actions="mod_vlan_vid:%s,output:%s" % (vid, ofport)) + self.br.add_flow(priority=4, proto='arp', nw_src=cidr, actions='drop') self.mox.VerifyAll() def test_get_port_ofport(self):