Merge "Fix ovs_lib's issue of parsing flow proto field"
This commit is contained in:
commit
a45caa2824
@ -145,7 +145,7 @@ class OVSBridge:
|
|||||||
proto = 'proto' in kwargs and ",%s" % kwargs['proto'] or ''
|
proto = 'proto' in kwargs and ",%s" % kwargs['proto'] or ''
|
||||||
ip = ('nw_src' in kwargs or 'nw_dst' in kwargs) and ',ip' 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 +
|
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:
|
if match:
|
||||||
match = match[1:] # strip leading comma
|
match = match[1:] # strip leading comma
|
||||||
flow_expr_arr.append(match)
|
flow_expr_arr.append(match)
|
||||||
|
@ -91,6 +91,7 @@ class OVS_Lib_Test(base.BaseTestCase):
|
|||||||
ofport = "99"
|
ofport = "99"
|
||||||
vid = 4000
|
vid = 4000
|
||||||
lsw_id = 18
|
lsw_id = 18
|
||||||
|
cidr = '192.168.1.0/24'
|
||||||
utils.execute(["ovs-ofctl", "add-flow", self.BR_NAME,
|
utils.execute(["ovs-ofctl", "add-flow", self.BR_NAME,
|
||||||
"hard_timeout=0,idle_timeout=0,"
|
"hard_timeout=0,idle_timeout=0,"
|
||||||
"priority=2,dl_src=ca:fe:de:ad:be:ef"
|
"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="
|
"priority=3,tun_id=%s,actions="
|
||||||
"mod_vlan_vid:%s,output:%s"
|
"mod_vlan_vid:%s,output:%s"
|
||||||
% (lsw_id, vid, ofport)], root_helper=self.root_helper)
|
% (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.mox.ReplayAll()
|
||||||
|
|
||||||
self.br.add_flow(priority=2, dl_src="ca:fe:de:ad:be:ef",
|
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,
|
self.br.add_flow(priority=3, tun_id=lsw_id,
|
||||||
actions="mod_vlan_vid:%s,output:%s" %
|
actions="mod_vlan_vid:%s,output:%s" %
|
||||||
(vid, ofport))
|
(vid, ofport))
|
||||||
|
self.br.add_flow(priority=4, proto='arp', nw_src=cidr, actions='drop')
|
||||||
self.mox.VerifyAll()
|
self.mox.VerifyAll()
|
||||||
|
|
||||||
def test_get_port_ofport(self):
|
def test_get_port_ofport(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user