Skip to content

Commit

Permalink
Merge branch 'selftests-forwarding-Two-enhancements'
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed May 3, 2018
2 parents 5f11089 + 0eb8053 commit 41f4054
Show file tree
Hide file tree
Showing 15 changed files with 220 additions and 64 deletions.
26 changes: 22 additions & 4 deletions tools/testing/selftests/net/forwarding/bridge_vlan_aware.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
26 changes: 22 additions & 4 deletions tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
9 changes: 9 additions & 0 deletions tools/testing/selftests/net/forwarding/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 29 additions & 7 deletions tools/testing/selftests/net/forwarding/mirror_gre.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -100,22 +108,36 @@ test_two_spans()
log_test "two simultaneously configured mirrors ($tcflags)"
}

test_all()
test_gretap()
{
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"
}

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 gt6 ingress ipv6 "mirror to ip6gretap"
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_two_spans
test_all()
{
slow_path_trap_install $swp1 ingress
slow_path_trap_install $swp1 egress

tests_run

slow_path_trap_uninstall $swp1 egress
slow_path_trap_uninstall $swp1 ingress
Expand Down
23 changes: 18 additions & 5 deletions tools/testing/selftests/net/forwarding/mirror_gre_bound.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -178,18 +183,26 @@ 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

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
Expand Down
29 changes: 25 additions & 4 deletions tools/testing/selftests/net/forwarding/mirror_gre_changes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -155,22 +162,36 @@ test_span_gre_remote_ip()
log_test "$what: remote address change ($tcflags)"
}

test_all()
test_ttl()
{
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_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

tests_run

slow_path_trap_uninstall $swp1 egress
slow_path_trap_uninstall $swp1 ingress
Expand Down
23 changes: 18 additions & 5 deletions tools/testing/selftests/net/forwarding/mirror_gre_flower.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -81,18 +86,26 @@ 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

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
Expand Down
22 changes: 18 additions & 4 deletions tools/testing/selftests/net/forwarding/mirror_gre_neigh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -69,15 +74,24 @@ test_span_gre_neigh()
log_test "$direction $what: neighbor change ($tcflags)"
}

test_all()
test_gretap()
{
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_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

tests_run

slow_path_trap_uninstall $swp1 egress
slow_path_trap_uninstall $swp1 ingress
Expand Down
8 changes: 6 additions & 2 deletions tools/testing/selftests/net/forwarding/mirror_gre_nh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading

0 comments on commit 41f4054

Please sign in to comment.