When bind port to multiple logical switches with
vlan and without vlan tag rules are generated without
priority. Rule without tag is more generic and matches
all trafic by in_port selector.
Since both rules has same priority first rule wins.
This patch adds priority to vlan based rule as 200
and 100 for rule without vlan to make sure rules with
vlan checked first.

Signed-off-by: Vasyl Saienko <vsaie...@mirantis.com>
---
 vtep/ovs-vtep.in | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/vtep/ovs-vtep.in b/vtep/ovs-vtep.in
index 0ee23b119..20476f89f 100755
--- a/vtep/ovs-vtep.in
+++ b/vtep/ovs-vtep.in
@@ -538,14 +538,16 @@ def add_binding(binding, ls):
     patch_no = ovs_vsctl("get Interface %s ofport" % pbinding)
     vlan_ = vlan.lstrip('0')
     if vlan_:
-        ovs_ofctl("add-flow %s in_port=%s,dl_vlan=%s,action=strip_vlan,%s"
+        ovs_ofctl("add-flow %s priority=200,in_port=%s,dl_vlan=%s,"
+                  "action=strip_vlan,%s"
                   % (ps_name, port_no, vlan_, patch_no))
-        ovs_ofctl("add-flow %s in_port=%s,action=mod_vlan_vid:%s,%s"
+        ovs_ofctl("add-flow %s priority=200,in_port=%s,"
+                  "action=mod_vlan_vid:%s,%s"
                   % (ps_name, patch_no, vlan_, port_no))
     else:
-        ovs_ofctl("add-flow %s in_port=%s,action=%s"
+        ovs_ofctl("add-flow %s priority=100,in_port=%s,action=%s"
                   % (ps_name, port_no, patch_no))
-        ovs_ofctl("add-flow %s in_port=%s,action=%s"
+        ovs_ofctl("add-flow %s priority=100,in_port=%s,action=%s"
                   % (ps_name, patch_no, port_no))
 
     # Create a logical_bindings_stats record.
@@ -570,12 +572,15 @@ def del_binding(binding, ls):
     patch_no = ovs_vsctl("get Interface %s ofport" % pbinding)
     vlan_ = vlan.lstrip('0')
     if vlan_:
-        ovs_ofctl("del-flows %s in_port=%s,dl_vlan=%s"
+        ovs_ofctl("del-flows %s priority=200,in_port=%s,dl_vlan=%s"
                   % (ps_name, port_no, vlan_))
-        ovs_ofctl("del-flows %s in_port=%s" % (ps_name, patch_no))
+        ovs_ofctl("del-flows %s priority=200,in_port=%s"
+                  % (ps_name, patch_no))
     else:
-        ovs_ofctl("--strict del-flows %s in_port=%s" % (ps_name, port_no))
-        ovs_ofctl("--strict del-flows %s in_port=%s" % (ps_name, patch_no))
+        ovs_ofctl("--strict del-flows %s priority=100,in_port=%s"
+                  % (ps_name, port_no))
+        ovs_ofctl("--strict del-flows %s priority=100,in_port=%s"
+                  % (ps_name, patch_no))
 
     ls.del_lbinding(lbinding)
 
-- 
2.43.0

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to