On Wed, Sep 07, 2016 at 11:40:12AM +0530, bscha...@redhat.com wrote:
> From: Babu Shanmugam <bscha...@redhat.com>
> 
> This patch adds support for marking qos on IP packets based on arbitrary
> match criteria for a logical switch.
> 
> Signed-off-by: Babu Shanmugam <bscha...@redhat.com>
> Suggested-by: Mickey Spiegel <mickeys....@gmail.com>
> Acked-by: Mickey Spiegel <mickeys....@gmail.com>

I spent a little time with this, but I couldn't make the test pass.  The
first issue seems to be that MFF_LOG_CT_ZONE (in reg13) is
nondeterministic: sometimes I see 0x1, sometimes 0x2.  That's not a
problem with this patch, so I folded in the appended incremental, which
also makes sure that the logical port numbers get assigned in the
expected order, by adding --wait and sync.  But even with that, I get
the following failure, so i think that some more work is needed here.

Thanks,

Ben.

../../tests/ovn.at:5408: get_final_flow
--- -   2016-10-04 11:30:59.714524682 -0700
+++ /home/blp/nicira/ovs/_build/tests/testsuite.dir/at-groups/2262/stdout       
2016-10-04 11:30:59.712152388 -0700
@@ -1,2 +1,2 @@
-Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=192,nw_ecn=0,nw_ttl=0
+Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0

--8<--------------------------cut here-------------------------->8--

diff --git a/tests/ovn.at b/tests/ovn.at
index f17ba26..12fe54d 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -5370,12 +5370,13 @@ ovn_start
 # Configure the Northbound database
 ovn-nbctl ls-add lsw0
 
-ovn-nbctl lsp-add lsw0 lp1
-ovn-nbctl lsp-add lsw0 lp2
+ovn-nbctl --wait=sb lsp-add lsw0 lp1
+ovn-nbctl --wait=sb lsp-add lsw0 lp2
 ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01
 ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02
 ovn-nbctl lsp-set-port-security lp1 f0:00:00:00:00:01
 ovn-nbctl lsp-set-port-security lp2 f0:00:00:00:00:02
+ovn-nbctl --wait=sb sync
 net_add n1
 sim_add hv
 as hv
@@ -5384,37 +5385,43 @@ ovn_attach n1 br-phys 192.168.0.1
 ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 
options:tx_pcap=vif1-tx.pcap options:rxq_pcap=vif1-rx.pcap ofport-request=1
 ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 
options:tx_pcap=vif2-tx.pcap options:rxq_pcap=vif2-rx.pcap ofport-request=2
 
+# Extracts the final flow from ofproto/trace output,
+# removing the irrelevant MFF_LOG_CT_ZONE (reg13) value.
+get_final_flow() {
+    sed -n "/Final flow:/s/reg13=[[^,]]*,//p" stdout
+}
+
 # check at L2
 AT_CHECK([ovs-appctl ofproto/trace br-int 
'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02' -generate], [0], 
[stdout])
-AT_CHECK([grep "Final flow:" stdout], [0],[Final flow: 
reg13=0x2,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x0000
+AT_CHECK([get_final_flow], [0],[Final flow: 
reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x0000
 ])
 
 # check at L3 without dscp marking
 AT_CHECK([ovs-appctl ofproto/trace br-int 
'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'
 -generate], [0], [stdout])
-AT_CHECK([grep "Final flow:" stdout], [0],[Final flow: 
ip,reg13=0x2,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
+AT_CHECK([get_final_flow], [0],[Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
 ])
 
 # Mark DSCP with a valid value
 qos_id=$(ovn-nbctl -- --id=@lp1-qos create QoS priority=100 action=dscp=48 
match="inport\=\=\"lp1\"" direction="from-lport" -- set Logical_Switch lsw0 
qos_rules=@lp1-qos)
 AT_CHECK([ovs-appctl ofproto/trace br-int 
'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'
 -generate], [0], [stdout])
-AT_CHECK([grep "Final flow:" stdout], [0],[Final flow: 
ip,reg13=0x2,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=192,nw_ecn=0,nw_ttl=0
+AT_CHECK([get_final_flow], [0],[Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=192,nw_ecn=0,nw_ttl=0
 ])
 
 # Update the DSCP marking
 ovn-nbctl set QoS $qos_id action=dscp=63
 AT_CHECK([ovs-appctl ofproto/trace br-int 
'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'
 -generate], [0], [stdout])
-AT_CHECK([grep "Final flow:" stdout], [0],[Final flow: 
ip,reg13=0x2,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=252,nw_ecn=0,nw_ttl=0
+AT_CHECK([get_final_flow], [0],[Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=252,nw_ecn=0,nw_ttl=0
 ])
 
 ovn-nbctl set QoS $qos_id match="outport\=\=\"lp2\"" direction="to-lport"
 AT_CHECK([ovs-appctl ofproto/trace br-int 
'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'
 -generate], [0], [stdout])
-AT_CHECK([grep "Final flow:" stdout], [0],[Final flow: 
ip,reg13=0x2,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=252,nw_ecn=0,nw_ttl=0
+AT_CHECK([get_final_flow], [0],[Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=252,nw_ecn=0,nw_ttl=0
 ])
 
 # Disable DSCP marking
 ovn-nbctl clear Logical_Switch lsw0 qos_rules
 AT_CHECK([ovs-appctl ofproto/trace br-int 
'in_port=1,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,dl_type=0x800,nw_src=1.1.1.1,nw_dst=1.1.1.2'
 -generate], [0], [stdout])
-AT_CHECK([grep "Final flow:" stdout], [0],[Final flow: 
ip,reg13=0x2,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
+AT_CHECK([get_final_flow], [0],[Final flow: 
ip,reg14=0x1,reg15=0x2,metadata=0x1,in_port=1,vlan_tci=0x0000,dl_src=f0:00:00:00:00:01,dl_dst=f0:00:00:00:00:02,nw_src=1.1.1.1,nw_dst=1.1.1.2,nw_proto=0,nw_tos=0,nw_ecn=0,nw_ttl=0
 ])
 
 OVN_CLEANUP([hv])

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to