Merge branch 'selftests-forwarding-Two-enhancements'
Ido Schimmel says: ==================== selftests: forwarding: Two enhancements First patch increases the maximum deviation in the multipath tests which proved to be too low in some cases. Second patch allows user to run only specific tests from each file using the TESTS environment variable. This granularity is needed in setups where not all the tests can pass. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
41f405460a
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding"
|
||||
NUM_NETIFS=4
|
||||
CHECK_TC="yes"
|
||||
source lib.sh
|
||||
|
@ -75,14 +76,31 @@ cleanup()
|
|||
vrf_cleanup
|
||||
}
|
||||
|
||||
ping_ipv4()
|
||||
{
|
||||
ping_test $h1 192.0.2.2
|
||||
}
|
||||
|
||||
ping_ipv6()
|
||||
{
|
||||
ping6_test $h1 2001:db8:1::2
|
||||
}
|
||||
|
||||
learning()
|
||||
{
|
||||
learning_test "br0" $swp1 $h1 $h2
|
||||
}
|
||||
|
||||
flooding()
|
||||
{
|
||||
flood_test $swp2 $h1 $h2
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
ping_test $h1 192.0.2.2
|
||||
ping6_test $h1 2001:db8:1::2
|
||||
learning_test "br0" $swp1 $h1 $h2
|
||||
flood_test $swp2 $h1 $h2
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding"
|
||||
NUM_NETIFS=4
|
||||
source lib.sh
|
||||
|
||||
|
@ -73,14 +74,31 @@ cleanup()
|
|||
vrf_cleanup
|
||||
}
|
||||
|
||||
ping_ipv4()
|
||||
{
|
||||
ping_test $h1 192.0.2.2
|
||||
}
|
||||
|
||||
ping_ipv6()
|
||||
{
|
||||
ping6_test $h1 2001:db8:1::2
|
||||
}
|
||||
|
||||
learning()
|
||||
{
|
||||
learning_test "br0" $swp1 $h1 $h2
|
||||
}
|
||||
|
||||
flooding()
|
||||
{
|
||||
flood_test $swp2 $h1 $h2
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
ping_test $h1 192.0.2.2
|
||||
ping6_test $h1 2001:db8:1::2
|
||||
learning_test "br0" $swp1 $h1 $h2
|
||||
flood_test $swp2 $h1 $h2
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -477,6 +477,15 @@ matchall_sink_create()
|
|||
action drop
|
||||
}
|
||||
|
||||
tests_run()
|
||||
{
|
||||
local current_test
|
||||
|
||||
for current_test in ${TESTS:-$ALL_TESTS}; do
|
||||
$current_test
|
||||
done
|
||||
}
|
||||
|
||||
##############################################################################
|
||||
# Tests
|
||||
|
||||
|
|
|
@ -10,6 +10,14 @@
|
|||
# traffic. Test that the payload is what is expected (ICMP ping request or
|
||||
# reply, depending on test).
|
||||
|
||||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
test_gretap_mac
|
||||
test_ip6gretap_mac
|
||||
test_two_spans
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
|
@ -100,22 +108,36 @@ test_two_spans()
|
|||
log_test "two simultaneously configured mirrors ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
{
|
||||
full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
|
||||
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap()
|
||||
{
|
||||
full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_gretap_mac()
|
||||
{
|
||||
test_span_gre_mac gt4 ingress ip "mirror to gretap"
|
||||
test_span_gre_mac gt4 egress ip "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap_mac()
|
||||
{
|
||||
test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
|
||||
test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap"
|
||||
full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap"
|
||||
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap"
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap"
|
||||
|
||||
test_span_gre_mac gt4 ingress ip "mirror to gretap"
|
||||
test_span_gre_mac gt6 ingress ipv6 "mirror to ip6gretap"
|
||||
test_span_gre_mac gt4 egress ip "mirror to gretap"
|
||||
test_span_gre_mac gt6 egress ipv6 "mirror to ip6gretap"
|
||||
|
||||
test_two_spans
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
|
|
|
@ -42,6 +42,11 @@
|
|||
# underlay manner, i.e. with a bound dummy device that marks underlay VRF where
|
||||
# the encapsulated packed should be routed.
|
||||
|
||||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
|
@ -178,6 +183,18 @@ cleanup()
|
|||
vrf_cleanup
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
{
|
||||
full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap w/ UL"
|
||||
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap w/ UL"
|
||||
}
|
||||
|
||||
test_ip6gretap()
|
||||
{
|
||||
full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap w/ UL"
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap w/ UL"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
RET=0
|
||||
|
@ -185,11 +202,7 @@ test_all()
|
|||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
full_test_span_gre_dir gt4 ingress 8 0 "mirror to gretap w/ UL"
|
||||
full_test_span_gre_dir gt6 ingress 8 0 "mirror to ip6gretap w/ UL"
|
||||
|
||||
full_test_span_gre_dir gt4 egress 0 8 "mirror to gretap w/ UL"
|
||||
full_test_span_gre_dir gt6 egress 0 8 "mirror to ip6gretap w/ UL"
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
|
|
|
@ -7,6 +7,13 @@
|
|||
# Test how mirrors to gretap and ip6gretap react to changes to relevant
|
||||
# configuration.
|
||||
|
||||
ALL_TESTS="
|
||||
test_ttl
|
||||
test_tun_up
|
||||
test_egress_up
|
||||
test_remote_ip
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
|
@ -155,22 +162,36 @@ test_span_gre_remote_ip()
|
|||
log_test "$what: remote address change ($tcflags)"
|
||||
}
|
||||
|
||||
test_ttl()
|
||||
{
|
||||
test_span_gre_ttl gt4 gretap ip "mirror to gretap"
|
||||
test_span_gre_ttl gt6 ip6gretap ipv6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_tun_up()
|
||||
{
|
||||
test_span_gre_tun_up gt4 "mirror to gretap"
|
||||
test_span_gre_tun_up gt6 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_egress_up()
|
||||
{
|
||||
test_span_gre_egress_up gt4 192.0.2.130 "mirror to gretap"
|
||||
test_span_gre_egress_up gt6 2001:db8:2::2 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_remote_ip()
|
||||
{
|
||||
test_span_gre_remote_ip gt4 gretap 192.0.2.130 192.0.2.132 "mirror to gretap"
|
||||
test_span_gre_remote_ip gt6 ip6gretap 2001:db8:2::2 2001:db8:2::4 "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
test_span_gre_ttl gt4 gretap ip "mirror to gretap"
|
||||
test_span_gre_ttl gt6 ip6gretap ipv6 "mirror to ip6gretap"
|
||||
|
||||
test_span_gre_tun_up gt4 "mirror to gretap"
|
||||
test_span_gre_tun_up gt6 "mirror to ip6gretap"
|
||||
|
||||
test_span_gre_egress_up gt4 192.0.2.130 "mirror to gretap"
|
||||
test_span_gre_egress_up gt6 2001:db8:2::2 "mirror to ip6gretap"
|
||||
|
||||
test_span_gre_remote_ip gt4 gretap 192.0.2.130 192.0.2.132 "mirror to gretap"
|
||||
test_span_gre_remote_ip gt6 ip6gretap 2001:db8:2::2 2001:db8:2::4 "mirror to ip6gretap"
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
|
|
|
@ -10,6 +10,11 @@
|
|||
# this address, mirroring takes place, whereas when pinging the other one,
|
||||
# there's no mirroring.
|
||||
|
||||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
|
@ -81,6 +86,18 @@ full_test_span_gre_dir_acl()
|
|||
log_test "$direction $what ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
{
|
||||
full_test_span_gre_dir_acl gt4 ingress 8 0 192.0.2.4 "ACL mirror to gretap"
|
||||
full_test_span_gre_dir_acl gt4 egress 0 8 192.0.2.3 "ACL mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap()
|
||||
{
|
||||
full_test_span_gre_dir_acl gt6 ingress 8 0 192.0.2.4 "ACL mirror to ip6gretap"
|
||||
full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
RET=0
|
||||
|
@ -88,11 +105,7 @@ test_all()
|
|||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
full_test_span_gre_dir_acl gt4 ingress 8 0 192.0.2.4 "ACL mirror to gretap"
|
||||
full_test_span_gre_dir_acl gt6 ingress 8 0 192.0.2.4 "ACL mirror to ip6gretap"
|
||||
|
||||
full_test_span_gre_dir_acl gt4 egress 0 8 192.0.2.3 "ACL mirror to gretap"
|
||||
full_test_span_gre_dir_acl gt6 egress 0 8 192.0.2.3 "ACL mirror to ip6gretap"
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
# is set up. Later on, the neighbor is deleted and it is expected to be
|
||||
# reinitialized using the usual ARP process, and the mirroring offload updated.
|
||||
|
||||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
|
@ -69,15 +74,24 @@ test_span_gre_neigh()
|
|||
log_test "$direction $what: neighbor change ($tcflags)"
|
||||
}
|
||||
|
||||
test_gretap()
|
||||
{
|
||||
test_span_gre_neigh 192.0.2.130 gt4 ingress "mirror to gretap"
|
||||
test_span_gre_neigh 192.0.2.130 gt4 egress "mirror to gretap"
|
||||
}
|
||||
|
||||
test_ip6gretap()
|
||||
{
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 ingress "mirror to ip6gretap"
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 egress "mirror to ip6gretap"
|
||||
}
|
||||
|
||||
test_all()
|
||||
{
|
||||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
test_span_gre_neigh 192.0.2.130 gt4 ingress "mirror to gretap"
|
||||
test_span_gre_neigh 192.0.2.130 gt4 egress "mirror to gretap"
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 ingress "mirror to ip6gretap"
|
||||
test_span_gre_neigh 2001:db8:2::2 gt6 egress "mirror to ip6gretap"
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
# Test that gretap and ip6gretap mirroring works when the other tunnel endpoint
|
||||
# is reachable through a next-hop route (as opposed to directly-attached route).
|
||||
|
||||
ALL_TESTS="
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
"
|
||||
|
||||
NUM_NETIFS=6
|
||||
source lib.sh
|
||||
source mirror_lib.sh
|
||||
|
@ -92,8 +97,7 @@ test_all()
|
|||
slow_path_trap_install $swp1 ingress
|
||||
slow_path_trap_install $swp1 egress
|
||||
|
||||
test_gretap
|
||||
test_ip6gretap
|
||||
tests_run
|
||||
|
||||
slow_path_trap_uninstall $swp1 egress
|
||||
slow_path_trap_uninstall $swp1 ingress
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="ping_ipv4 ping_ipv6"
|
||||
NUM_NETIFS=4
|
||||
source lib.sh
|
||||
|
||||
|
@ -114,12 +115,21 @@ cleanup()
|
|||
vrf_cleanup
|
||||
}
|
||||
|
||||
ping_ipv4()
|
||||
{
|
||||
ping_test $h1 198.51.100.2
|
||||
}
|
||||
|
||||
ping_ipv6()
|
||||
{
|
||||
ping6_test $h1 2001:db8:2::2
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
ping_test $h1 198.51.100.2
|
||||
ping6_test $h1 2001:db8:2::2
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="ping_ipv4 ping_ipv6 multipath_test"
|
||||
NUM_NETIFS=8
|
||||
source lib.sh
|
||||
|
||||
|
@ -191,7 +192,7 @@ multipath_eval()
|
|||
diff=$(echo $weights_ratio - $packets_ratio | bc -l)
|
||||
diff=${diff#-}
|
||||
|
||||
test "$(echo "$diff / $weights_ratio > 0.1" | bc -l)" -eq 0
|
||||
test "$(echo "$diff / $weights_ratio > 0.15" | bc -l)" -eq 0
|
||||
check_err $? "Too large discrepancy between expected and measured ratios"
|
||||
log_test "$desc"
|
||||
log_info "Expected ratio $weights_ratio Measured ratio $packets_ratio"
|
||||
|
@ -364,13 +365,21 @@ cleanup()
|
|||
vrf_cleanup
|
||||
}
|
||||
|
||||
ping_ipv4()
|
||||
{
|
||||
ping_test $h1 198.51.100.2
|
||||
}
|
||||
|
||||
ping_ipv6()
|
||||
{
|
||||
ping6_test $h1 2001:db8:2::2
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
ping_test $h1 198.51.100.2
|
||||
ping6_test $h1 2001:db8:2::2
|
||||
multipath_test
|
||||
tests_run
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="gact_drop_and_ok_test mirred_egress_redirect_test \
|
||||
mirred_egress_mirror_test gact_trap_test"
|
||||
NUM_NETIFS=4
|
||||
source tc_common.sh
|
||||
source lib.sh
|
||||
|
@ -111,6 +113,10 @@ gact_trap_test()
|
|||
{
|
||||
RET=0
|
||||
|
||||
if [[ "$tcflags" != "skip_sw" ]]; then
|
||||
return 0;
|
||||
fi
|
||||
|
||||
tc filter add dev $swp1 ingress protocol ip pref 1 handle 101 flower \
|
||||
skip_hw dst_ip 192.0.2.2 action drop
|
||||
tc filter add dev $swp1 ingress protocol ip pref 3 handle 103 flower \
|
||||
|
@ -179,24 +185,29 @@ cleanup()
|
|||
ip link set $swp1 address $swp1origmac
|
||||
}
|
||||
|
||||
mirred_egress_redirect_test()
|
||||
{
|
||||
mirred_egress_test "redirect"
|
||||
}
|
||||
|
||||
mirred_egress_mirror_test()
|
||||
{
|
||||
mirred_egress_test "mirror"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
gact_drop_and_ok_test
|
||||
mirred_egress_test "redirect"
|
||||
mirred_egress_test "mirror"
|
||||
tests_run
|
||||
|
||||
tc_offload_check
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_info "Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
gact_drop_and_ok_test
|
||||
mirred_egress_test "redirect"
|
||||
mirred_egress_test "mirror"
|
||||
gact_trap_test
|
||||
tests_run
|
||||
fi
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="unreachable_chain_test gact_goto_chain_test"
|
||||
NUM_NETIFS=2
|
||||
source tc_common.sh
|
||||
source lib.sh
|
||||
|
@ -107,16 +108,14 @@ trap cleanup EXIT
|
|||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
unreachable_chain_test
|
||||
gact_goto_chain_test
|
||||
tests_run
|
||||
|
||||
tc_offload_check
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_info "Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
unreachable_chain_test
|
||||
gact_goto_chain_test
|
||||
tests_run
|
||||
fi
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="match_dst_mac_test match_src_mac_test match_dst_ip_test \
|
||||
match_src_ip_test match_ip_flags_test"
|
||||
NUM_NETIFS=2
|
||||
source tc_common.sh
|
||||
source lib.sh
|
||||
|
@ -245,22 +247,14 @@ trap cleanup EXIT
|
|||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
match_dst_mac_test
|
||||
match_src_mac_test
|
||||
match_dst_ip_test
|
||||
match_src_ip_test
|
||||
match_ip_flags_test
|
||||
tests_run
|
||||
|
||||
tc_offload_check
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_info "Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
match_dst_mac_test
|
||||
match_src_mac_test
|
||||
match_dst_ip_test
|
||||
match_src_ip_test
|
||||
match_ip_flags_test
|
||||
tests_run
|
||||
fi
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ALL_TESTS="shared_block_test"
|
||||
NUM_NETIFS=4
|
||||
source tc_common.sh
|
||||
source lib.sh
|
||||
|
@ -109,14 +110,14 @@ trap cleanup EXIT
|
|||
setup_prepare
|
||||
setup_wait
|
||||
|
||||
shared_block_test
|
||||
tests_run
|
||||
|
||||
tc_offload_check
|
||||
if [[ $? -ne 0 ]]; then
|
||||
log_info "Could not test offloaded functionality"
|
||||
else
|
||||
tcflags="skip_sw"
|
||||
shared_block_test
|
||||
tests_run
|
||||
fi
|
||||
|
||||
exit $EXIT_STATUS
|
||||
|
|
Loading…
Reference in New Issue