Skip to content

Commit

Permalink
tests: Improve "ARP/ND request broadcast limiting" test.
Browse files Browse the repository at this point in the history
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 <blp@ovn.org>
Acked-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
blp committed Nov 12, 2020
1 parent 909cf04 commit e14b52a
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down

0 comments on commit e14b52a

Please sign in to comment.