diff mbox series

[ovs-dev] tests: Improve test "IGMP snoop/querier/relay".

Message ID 20210426093447.30825-1-dceara@redhat.com
State Accepted
Headers show
Series [ovs-dev] tests: Improve test "IGMP snoop/querier/relay". | expand

Commit Message

Dumitru Ceara April 26, 2021, 9:34 a.m. UTC
Commit b38e10f4b1bf ("tests: Miscellaneous improvements.") improved the
"MLD snoop/querier/relay" test case making it less likely to fail due
to test issues.  Apply the same fixes to the "IGMP snoop/querier/relay"
test case.

Reported-at: https://bugzilla.redhat.com/1941067
Fixes: 605535f9adf2 ("OVN: Add ovn-northd IGMP support")
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
---
 tests/ovn.at | 76 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 43 insertions(+), 33 deletions(-)

Comments

Numan Siddique April 26, 2021, 12:13 p.m. UTC | #1
On Mon, Apr 26, 2021 at 5:35 AM Dumitru Ceara <dceara@redhat.com> wrote:
>
> Commit b38e10f4b1bf ("tests: Miscellaneous improvements.") improved the
> "MLD snoop/querier/relay" test case making it less likely to fail due
> to test issues.  Apply the same fixes to the "IGMP snoop/querier/relay"
> test case.
>
> Reported-at: https://bugzilla.redhat.com/1941067
> Fixes: 605535f9adf2 ("OVN: Add ovn-northd IGMP support")
> Signed-off-by: Dumitru Ceara <dceara@redhat.com>

Thanks. I applied this patch to the main branch.

Numan

> ---
>  tests/ovn.at | 76 +++++++++++++++++++++++++++++-----------------------
>  1 file changed, 43 insertions(+), 33 deletions(-)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 3d0a7f63f..9f38ec6ec 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -17923,6 +17923,27 @@ check ovs-vsctl -- add-port br-int hv2-vif4 -- \
>      ofport-request=1
>  ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
>
> +AT_CAPTURE_FILE([exp])
> +AT_CAPTURE_FILE([rcv])
> +check_packets() {
> +    > exp
> +    > rcv
> +    if test "$1" = --uniq; then
> +        sort="sort -u"; shift
> +    else
> +        sort=sort
> +    fi
> +    for tuple in "$@"; do
> +        set $tuple; pcap=$1 type=$2
> +        echo "--- $pcap" | tee -a exp >> rcv
> +        $sort "$type" >> exp
> +        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv
> +        echo | tee -a exp >> rcv
> +    done
> +
> +    $at_diff exp rcv >/dev/null
> +}
> +
>  OVN_POPULATE_ARP
>
>  # Enable IGMP snooping on sw1.
> @@ -17939,21 +17960,16 @@ ovn-sbctl dump-flows > sbflows
>  AT_CAPTURE_FILE([expected])
>  AT_CAPTURE_FILE([received])
>  > expected
> -> received
> -for i in 1 2; do
> -    for j in 1 2; do
> -        pcap=hv$i/vif$j-tx.pcap
> -        echo "--- $pcap" | tee -a expected >> received
> -        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> received
> -        echo | tee -a expected >> received
> -    done
> -done
> -check $at_diff -F'^---' expected received
> +OVS_WAIT_UNTIL(
> +  [check_packets 'hv1/vif1-tx.pcap expected' \
> +                 'hv1/vif2-tx.pcap expected' \
> +                 'hv2/vif1-tx.pcap expected' \
> +                 'hv2/vif2-tx.pcap expected'],
> +  [$at_diff -F'^---' exp rcv])
>
>  check ovn-nbctl --wait=hv sync
>
>  AT_CAPTURE_FILE([sbflows2])
> -cp ovn-sb/ovn-sb.db ovn-sb2.db
>  ovn-sbctl dump-flows > sbflows2
>
>  # Inject IGMP Join for 239.0.1.68 on sw1-p11.
> @@ -17971,7 +17987,6 @@ wait_row_count IGMP_Group 2 address=239.0.1.68
>  check ovn-nbctl --wait=hv sync
>
>  AT_CAPTURE_FILE([sbflows3])
> -cp ovn-sb/ovn-sb.db ovn-sb3.db
>  ovn-sbctl dump-flows > sbflows3
>
>  AS_BOX([IGMP traffic test 1])
> @@ -17988,22 +18003,6 @@ store_ip_multicast_pkt \
>      $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
>      e518e518000a3b3a0000 expected
>
> -AT_CAPTURE_FILE([exp])
> -AT_CAPTURE_FILE([rcv])
> -check_packets() {
> -    > exp
> -    > rcv
> -    for tuple in "$@"; do
> -        set $tuple; pcap=$1 type=$2
> -        echo "--- $pcap" | tee -a exp >> rcv
> -        sort "$type" >> exp
> -        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> rcv
> -        echo | tee -a exp >> rcv
> -    done
> -
> -    $at_diff exp rcv >/dev/null
> -}
> -
>  OVS_WAIT_UNTIL(
>    [check_packets 'hv1/vif1-tx.pcap expected' \
>                   'hv2/vif1-tx.pcap expected' \
> @@ -18094,15 +18093,26 @@ check ovn-nbctl set Logical_Switch sw2 \
>      other_config:mcast_ip4_src="20.0.0.254"
>
>  AS_BOX([IGMP traffic test 4])
> -# Wait for 1 query interval (1 sec) and check that two queries are generated.
> +# Check that multiple queries are generated over time.
>  > expected
>  store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected
>  store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected
>
> -OVS_WAIT_UNTIL(
> -  [check_packets 'hv1/vif3-tx.pcap expected' \
> -                 'hv2/vif3-tx.pcap expected'],
> -  [$at_diff -F'^---' exp rcv])
> +for count in 1 2 3; do
> +    as hv1 reset_pcap_file hv1-vif1 hv1/vif1
> +    as hv1 reset_pcap_file hv1-vif2 hv1/vif2
> +    as hv1 reset_pcap_file hv1-vif3 hv1/vif3
> +    as hv1 reset_pcap_file hv1-vif4 hv1/vif4
> +    as hv2 reset_pcap_file hv2-vif1 hv2/vif1
> +    as hv2 reset_pcap_file hv2-vif2 hv2/vif2
> +    as hv2 reset_pcap_file hv2-vif3 hv2/vif3
> +    as hv2 reset_pcap_file hv2-vif4 hv2/vif4
> +    OVS_WAIT_UNTIL(
> +      [check_packets --uniq \
> +                     'hv1/vif3-tx.pcap expected' \
> +                     'hv2/vif3-tx.pcap expected'],
> +      [$at_diff -F'^---' exp rcv])
> +done
>
>  # Disable IGMP querier on sw2.
>  check ovn-nbctl set Logical_Switch sw2 \
> --
> 2.27.0
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/tests/ovn.at b/tests/ovn.at
index 3d0a7f63f..9f38ec6ec 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -17923,6 +17923,27 @@  check ovs-vsctl -- add-port br-int hv2-vif4 -- \
     ofport-request=1
 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
+AT_CAPTURE_FILE([exp])
+AT_CAPTURE_FILE([rcv])
+check_packets() {
+    > exp
+    > rcv
+    if test "$1" = --uniq; then
+        sort="sort -u"; shift
+    else
+        sort=sort
+    fi
+    for tuple in "$@"; do
+        set $tuple; pcap=$1 type=$2
+        echo "--- $pcap" | tee -a exp >> rcv
+        $sort "$type" >> exp
+        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv
+        echo | tee -a exp >> rcv
+    done
+
+    $at_diff exp rcv >/dev/null
+}
+
 OVN_POPULATE_ARP
 
 # Enable IGMP snooping on sw1.
@@ -17939,21 +17960,16 @@  ovn-sbctl dump-flows > sbflows
 AT_CAPTURE_FILE([expected])
 AT_CAPTURE_FILE([received])
 > expected
-> received
-for i in 1 2; do
-    for j in 1 2; do
-        pcap=hv$i/vif$j-tx.pcap
-        echo "--- $pcap" | tee -a expected >> received
-        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> received
-        echo | tee -a expected >> received
-    done
-done
-check $at_diff -F'^---' expected received
+OVS_WAIT_UNTIL(
+  [check_packets 'hv1/vif1-tx.pcap expected' \
+                 'hv1/vif2-tx.pcap expected' \
+                 'hv2/vif1-tx.pcap expected' \
+                 'hv2/vif2-tx.pcap expected'],
+  [$at_diff -F'^---' exp rcv])
 
 check ovn-nbctl --wait=hv sync
 
 AT_CAPTURE_FILE([sbflows2])
-cp ovn-sb/ovn-sb.db ovn-sb2.db
 ovn-sbctl dump-flows > sbflows2
 
 # Inject IGMP Join for 239.0.1.68 on sw1-p11.
@@ -17971,7 +17987,6 @@  wait_row_count IGMP_Group 2 address=239.0.1.68
 check ovn-nbctl --wait=hv sync
 
 AT_CAPTURE_FILE([sbflows3])
-cp ovn-sb/ovn-sb.db ovn-sb3.db
 ovn-sbctl dump-flows > sbflows3
 
 AS_BOX([IGMP traffic test 1])
@@ -17988,22 +18003,6 @@  store_ip_multicast_pkt \
     $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \
     e518e518000a3b3a0000 expected
 
-AT_CAPTURE_FILE([exp])
-AT_CAPTURE_FILE([rcv])
-check_packets() {
-    > exp
-    > rcv
-    for tuple in "$@"; do
-        set $tuple; pcap=$1 type=$2
-        echo "--- $pcap" | tee -a exp >> rcv
-        sort "$type" >> exp
-        $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> rcv
-        echo | tee -a exp >> rcv
-    done
-
-    $at_diff exp rcv >/dev/null
-}
-
 OVS_WAIT_UNTIL(
   [check_packets 'hv1/vif1-tx.pcap expected' \
                  'hv2/vif1-tx.pcap expected' \
@@ -18094,15 +18093,26 @@  check ovn-nbctl set Logical_Switch sw2 \
     other_config:mcast_ip4_src="20.0.0.254"
 
 AS_BOX([IGMP traffic test 4])
-# Wait for 1 query interval (1 sec) and check that two queries are generated.
+# Check that multiple queries are generated over time.
 > expected
 store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected
 store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected
 
-OVS_WAIT_UNTIL(
-  [check_packets 'hv1/vif3-tx.pcap expected' \
-                 'hv2/vif3-tx.pcap expected'],
-  [$at_diff -F'^---' exp rcv])
+for count in 1 2 3; do
+    as hv1 reset_pcap_file hv1-vif1 hv1/vif1
+    as hv1 reset_pcap_file hv1-vif2 hv1/vif2
+    as hv1 reset_pcap_file hv1-vif3 hv1/vif3
+    as hv1 reset_pcap_file hv1-vif4 hv1/vif4
+    as hv2 reset_pcap_file hv2-vif1 hv2/vif1
+    as hv2 reset_pcap_file hv2-vif2 hv2/vif2
+    as hv2 reset_pcap_file hv2-vif3 hv2/vif3
+    as hv2 reset_pcap_file hv2-vif4 hv2/vif4
+    OVS_WAIT_UNTIL(
+      [check_packets --uniq \
+                     'hv1/vif3-tx.pcap expected' \
+                     'hv2/vif3-tx.pcap expected'],
+      [$at_diff -F'^---' exp rcv])
+done
 
 # Disable IGMP querier on sw2.
 check ovn-nbctl set Logical_Switch sw2 \