On 5/10/23 13:41, Ales Musil wrote:
> The test expected that the packet statistics will be
> immediately reflected after packet inject, however that
> might not be true on slower systems. Use OVS_WAIT_UNTIL
> instead to ensure that the packet really went through.
> Also align the IPv4 and IPv6 variant and fix some checks
> that were suggesting flow statistics check, but checked
> logical flows instead.
> 
> Signed-off-by: Ales Musil <[email protected]>
> ---
> v2: Address comments from Xavier:
>     Remove the additional sleep.
>     Make sure that all statistics checks are done through
>     OVS_WAIT_UNTIL.
> ---

Thanks, Ales and Xavier!

I applied this patch to the main branch and backported it to all stable
branches down to 22.03 LTS.

I folded in the incremental change posted below.  It replaces "wc -l"
with "-c" as argument to "grep".

Regards,
Dumitru

diff --git a/tests/ovn.at b/tests/ovn.at
index efd37658f2..2ef370c26d 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -7823,7 +7823,7 @@ OVS_WAIT_UNTIL([as pbr-hv ovs-appctl -t ovn-controller 
inject-pkt "$packet"])
 # Check if packet hit the drop policy
 OVS_WAIT_UNTIL([test "1" = "$(ovs-ofctl dump-flows br-int | \
     grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24 actions=drop" | \
-    grep "priority=10" | grep "n_packets=1" | wc -l)"])
+    grep "priority=10" | grep "n_packets=1" -c)"])
 
 # Expected to drop the packet.
 $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" pbr-hv/vif2-tx.pcap > vif2.packets
@@ -7834,7 +7834,7 @@ AT_FAIL_IF([test "$rcvd_packet" != ""])
 check ovn-nbctl --wait=hv lr-policy-add R1 20 "ip4.src==192.168.1.0/24 && 
ip4.dst==172.16.1.0/24" allow
 
 # Check logical flow
-AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" | wc 
-l], [0], [dnl
+AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" -c], 
[0], [dnl
 2
 ])
 
@@ -7847,7 +7847,7 @@ OVS_WAIT_UNTIL([as pbr-hv ovs-appctl -t ovn-controller 
inject-pkt "$packet"])
 # Check if packet hit the allow policy
 OVS_WAIT_UNTIL([test "1" = "$(ovs-ofctl dump-flows br-int | \
     grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24" | \
-    grep "priority=20" | grep "n_packets=1" | wc -l)"])
+    grep "priority=20" | grep "n_packets=1" -c)"])
 
 # Expected packet has TTL decreased by 1
 expected="eth.src==$ls2_ro_mac && eth.dst==$ls2_p1_mac &&
@@ -7863,7 +7863,7 @@ check ovn-nbctl --wait=hv lr-policy-add R1 30 
"ip4.src==192.168.1.0/24 && ip4.ds
 # Check logical flow
 AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \
     grep "192.168.1.0" | \
-    grep "priority=30" | wc -l], [0], [dnl
+    grep "priority=30" -c], [0], [dnl
 1
 ])
 
@@ -7876,7 +7876,7 @@ OVS_WAIT_UNTIL([as pbr-hv ovs-appctl -t ovn-controller 
inject-pkt "$packet"])
 # Check if packet hit the allow policy
 OVS_WAIT_UNTIL([test "1" = "$(ovs-ofctl dump-flows br-int | \
     grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24" | \
-    grep "priority=30" | grep "n_packets=1" | wc -l)"])
+    grep "priority=30" | grep "n_packets=1" -c)"])
 echo "packet hit reroute policy"
 
 # Expected packet has TTL decreased by 1
@@ -7979,7 +7979,7 @@ ls3_p1_mac=00:00:00:01:02:05
 check ovn-nbctl --wait=sb lr-policy-add R1 10 "ip6.src==2001::/64 && 
ip6.dst==2002::/64" drop
 
 # Check logical flow
-AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l], 
[0], [dnl
+AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" -c], [0], [dnl
 1
 ])
 
@@ -7993,7 +7993,7 @@ OVS_WAIT_UNTIL([as pbr-hv ovs-appctl -t ovn-controller 
inject-pkt "$packet"])
 # Check if packet hit the drop policy
 OVS_WAIT_UNTIL([test "1" = "$(ovs-ofctl dump-flows br-int | \
     grep "ipv6_src=2001::/64,ipv6_dst=2002::/64 actions=drop" | \
-    grep "priority=10" | grep "n_packets=1" | wc -l)"])
+    grep "priority=10" | grep "n_packets=1" -c)"])
 
 # Expected to drop the packet.
 $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" pbr-hv/vif2-tx.pcap > vif2.packets
@@ -8003,7 +8003,7 @@ AT_FAIL_IF([test -s vif2.packets])
 check ovn-nbctl --wait=sb lr-policy-add R1 20 "ip6.src==2001::/64 && 
ip6.dst==2002::/64" allow
 
 # Check logical flow
-AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l], 
[0], [dnl
+AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" -c], [0], [dnl
 2
 ])
 
@@ -8016,7 +8016,7 @@ OVS_WAIT_UNTIL([as pbr-hv ovs-appctl -t ovn-controller 
inject-pkt "$packet"])
 # Check if packet hit the allow policy
 OVS_WAIT_UNTIL([test "1" = "$(ovs-ofctl dump-flows br-int | \
     grep "ipv6_src=2001::/64,ipv6_dst=2002::/64"  | \
-    grep "priority=20" | grep "n_packets=1" | wc -l)"])
+    grep "priority=20" | grep "n_packets=1" -c)"])
 
 # Expected packet has TTL decreased by 1
 expected="eth.src==$ls2_ro_mac && eth.dst==$ls2_p1_mac &&
@@ -8032,7 +8032,7 @@ check ovn-nbctl --wait=sb lr-policy-add R1 30 
"ip6.src==2001::/64 && ip6.dst==20
 # Check logical flow
 AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \
     grep "2001" | \
-    grep "priority=30" | wc -l], [0], [dnl
+    grep "priority=30" -c], [0], [dnl
 1
 ])
 
@@ -8045,7 +8045,7 @@ OVS_WAIT_UNTIL([as pbr-hv ovs-appctl -t ovn-controller 
inject-pkt "$packet"])
 # Check if packet hit the allow policy
 OVS_WAIT_UNTIL([test "1" = "$(ovs-ofctl dump-flows br-int | \
     grep "ipv6_src=2001::/64,ipv6_dst=2002::/64"  | \
-    grep "priority=30" | grep "n_packets=1" | wc -l)"])
+    grep "priority=30" | grep "n_packets=1" -c)"])
 
 # Expected packet has TTL decreased by 1
 expected="eth.src==$ls3_ro_mac && eth.dst==$ls3_p1_mac &&

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to