From e14b52a9f6ff455ccc0c8e6616ab474baa14643f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 11 Nov 2020 17:32:34 -0800 Subject: [PATCH] tests: Improve "ARP/ND request broadcast limiting" test. This test wasn't entirely reliable because sometimes more than one packet could get sent, but it only checked for exactly "n_packets=1". This fixes the problem and improves the debuggability by producing more output on failure. Signed-off-by: Ben Pfaff Acked-by: Dumitru Ceara --- tests/ovn.at | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index ad1ae935be..c0219bbd47 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -19719,18 +19719,22 @@ match_arp_req="priority=80.*${match_sw_metadata}.*arp_tpa=10.0.0.1,arp_op=1" match_send_rtr1="load:0x${r1_tnl_key}->NXM_NX_REG15" match_send_rtr2="load:0x${r2_tnl_key}->NXM_NX_REG15" +for var in sw_dp_uuid sw_dp_key sw1_dp_key r1_dp_key r1_tnl_key r2_tnl_key \ + match_arp_req match_send_rtr1 match_send_rtr2; do + AS_VAR_COPY([value], [$var]) + echo "$var=$value" +done + as hv1 -OVS_WAIT_UNTIL([ - pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \ - grep -E "${match_arp_req}" | grep "${match_send_rtr1}" | \ - grep n_packets=1 -c) - test "1" = "${pkts_to_rtr1}" -]) -OVS_WAIT_UNTIL([ - pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \ - grep -E "${match_arp_req}" | grep "${match_send_rtr2}" | \ - grep n_packets=1 -c) - test "0" = "${pkts_to_rtr2}" +AT_CAPTURE_FILE([offlows]) +OVS_WAIT_FOR_OUTPUT([ + ovs-ofctl dump-flows br-int > offlows + for match in "$match_send_rtr1" "$match_send_rtr2"; do + grep -E "$match_arp_req.*$match" offlows | grep -c 'n_packets=[[1-9]]' + done + : +], [0], [1 +0 ]) # Inject ND_NS for ofirst router owned IP address. @@ -19742,17 +19746,14 @@ send_nd_ns 1 0 ${src_mac} ${src_ipv6} ${dst_ipv6} 751d match_nd_ns="priority=80.*${match_sw_metadata}.*icmp_type=135.*nd_target=10::1" as hv1 -OVS_WAIT_UNTIL([ - pkts_to_rtr1=$(ovs-ofctl dump-flows br-int | \ - grep -E "${match_nd_ns}" | grep "${match_send_rtr1}" | \ - grep n_packets=1 -c) - test "1" = "${pkts_to_rtr1}" -]) -OVS_WAIT_UNTIL([ - pkts_to_rtr2=$(ovs-ofctl dump-flows br-int | \ - grep -E "${match_nd_ns}" | grep "${match_send_rtr2}" | \ - grep n_packets=1 -c) - test "0" = "${pkts_to_rtr2}" +OVS_WAIT_FOR_OUTPUT([ + ovs-ofctl dump-flows br-int > offlows + for match in "$match_send_rtr1" "$match_send_rtr2"; do + grep -E "$match_nd_ns.*$match" offlows | grep -c 'n_packets=[[1-9]]' + done + : +], [0], [1 +0 ]) # Configure load balancing on both routers.