network/virt: new FOU and GUE tests
cover network/virt: new FOU and GUE tests
The first patch adds IPv6 flag '-6' to the library, which will be used by the two new tests in this patch series too.
The rest are adding two similar tests for UDP tunneling.
Alexey Kodanev (3):
lib/tst_test.sh: add TST_IPV6_FLAG ('-6') network/virt: new test for generic udp encapsulation (gue) network/virt: new foo over udp (fou) tunneling test
runtest/net.features | 6 +++ testcases/lib/tst_net.sh | 4 +- testcases/lib/tst_test.sh | 2 +- testcases/network/stress/route/route-lib.sh | 15 +++---- testcases/network/virt/fou01.sh | 48 +++++++++++++++++++++ testcases/network/virt/gue01.sh | 45 +++++++++++++++++++ testcases/network/virt/virt_lib.sh | 24 ++++++++++- 7 files changed, 132 insertions(+), 12 deletions(-) create mode 100755 testcases/network/virt/fou01.sh create mode 100755 testcases/network/virt/gue01.sh
Signature · 1 line
2.25.1
PATCH 1/3 lib/tst_test.sh: add TST_IPV6_FLAG ('-6')
Move the flag from route_lib.sh, it will also be used in the other net tests.
It's set to blank for IPv4 and to '-6' for IPv6.
--- testcases/lib/tst_net.sh | 4 +++- testcases/lib/tst_test.sh | 2 +- testcases/network/stress/route/route-lib.sh | 15 +++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-)
testcases/lib/tst_net.sh +3 -1
@@ -18,11 +18,13 @@ TST_SETUP="tst_net_setup" # Blank for an IPV4 test; 6 for an IPV6 test. TST_IPV6=${TST_IPV6:-} TST_IPVER=${TST_IPV6:-4} +# Blank for IPv4, '-6' for IPv6 test. +TST_IPV6_FLAG=${TST_IPV6_FLAG:-} tst_net_parse_args() { case $1 in - 6) TST_IPV6=6 TST_IPVER=6;; + 6) TST_IPV6=6 TST_IPVER=6 TST_IPV6_FLAG="-6";; *) [ "$TST_PARSE_ARGS_CALLER" ] && $TST_PARSE_ARGS_CALLER "$1" "$2";; esac }
testcases/lib/tst_test.sh +1 -1
@@ -540,7 +540,7 @@ tst_run() NEEDS_ROOT|NEEDS_TMPDIR|TMPDIR|NEEDS_DEVICE|DEVICE);; NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);; NEEDS_DRIVERS|FS_TYPE|MNTPOINT|MNT_PARAMS);; - IPV6|IPVER|TEST_DATA|TEST_DATA_IFS);; + IPV6|IPV6_FLAG|IPVER|TEST_DATA|TEST_DATA_IFS);; RETRY_FUNC|RETRY_FN_EXP_BACKOFF|TIMEOUT);; NET_DATAROOT|NET_MAX_PKT|NET_RHOST_RUN_DEBUG|NETLOAD_CLN_NUMBER);; *) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
testcases/network/stress/route/route-lib.sh +7 -8
@@ -91,20 +91,19 @@ setup_if() test_netlink() { + local opt="-c $ROUTE_CHANGE_NETLINK $TST_IPV6_FLAG -p $ROUTE_RHOST_PORT $ROUTE_CHANGE_NETLINK_PARAMS" + local cmd="route-change-netlink" local ret=0 - local cmd ip_flag - [ "$TST_IPV6" ] && ip_flag="-6" - cmd="route-change-netlink -c $ROUTE_CHANGE_NETLINK $ip_flag -p $ROUTE_RHOST_PORT $ROUTE_CHANGE_NETLINK_PARAMS" - tst_res TINFO "running $cmd" - $cmd || ret=$? + tst_res TINFO "running $cmd $opt" + $cmd $opt || ret=$? if [ "$ret" -ne 0 ]; then [ $((ret & 3)) -ne 0 ] && \ - tst_brk TFAIL "route-change-netlink failed" + tst_brk TFAIL "$cmd failed" [ $((ret & 32)) -ne 0 ] && \ tst_brk TCONF "not supported configuration" [ $((ret & 4)) -ne 0 ] && \ - tst_res TWARN "route-change-netlink has warnings" + tst_res TWARN "$cmd has warnings" fi - tst_res TPASS "route-change-netlink passed" + tst_res TPASS "$cmd passed" }
Signature · 1 line
2.25.1
PATCH 2/3 network/virt: new test for generic udp encapsulation (gue)
In reply to Alexey KodanevThe test sets up sit(IPv4) or ip6tnl(IPv6) virtual device using Generic UDP Encapsulation for each side.
Then, it transmits TCP/UDP/UDP-Lite as inner packets with random size payload in both directions (using virt_netperf_rand_sizes()).
The test will pass if the performance of encapsulation is not significantly worse than without it. This is controlled by VIRT_PERF_THRESHOLD.
--- runtest/net.features | 3 ++ testcases/network/virt/gue01.sh | 45 ++++++++++++++++++++++++++++++ testcases/network/virt/virt_lib.sh | 17 +++++++++-- 3 files changed, 63 insertions(+), 2 deletions(-) create mode 100755 testcases/network/virt/gue01.sh
runtest/net.features +3 -0
@@ -60,6 +60,9 @@ gre_ipv6_01 gre01.sh -6 gre_ipv4_02 gre02.sh gre_ipv6_02 gre02.sh -6 +gue01 gue01.sh +gue01_ipv6 gue01.sh -6 + dctcp_ipv4_01 dctcp01.sh dctcp_ipv6_01 dctcp01.sh -6
testcases/network/virt/gue01.sh new file +45 -0
45 lines not on this page · raw message
testcases/network/virt/virt_lib.sh +15 -2
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2018-2019 Petr Vorel <[email protected]> -# Copyright (c) 2014-2017 Oracle and/or its affiliates. All Rights Reserved. +# Copyright (c) 2014-2021 Oracle and/or its affiliates. All Rights Reserved. # Author: Alexey Kodanev <[email protected]> # # VxLAN
@@ -118,7 +118,7 @@ virt_add() [ -z "$opt" ] && \ opt="remote $(tst_ipaddr rhost) dev $(tst_iface)" ;; - sit) + sit|gue) [ -z "$opt" ] && opt="remote $(tst_ipaddr rhost) local $(tst_ipaddr)" ;; esac
@@ -130,6 +130,12 @@ virt_add() gre|ip6gre) ip -f inet$TST_IPV6 tu add $vname mode $virt_type $opt ;; + gue) + local tnl=sit + + [ -n "$TST_IPV6" ] && tnl="ip6tnl" + ip link add name $vname type $tnl $opt + ;; *) ip li add link $(tst_iface) $vname type $virt_type $opt ;;
@@ -152,6 +158,13 @@ virt_add_rhost() tst_rhost_run -s -c "ip -f inet$TST_IPV6 tu add ltp_v0 \ mode $virt_type $@" ;; + gue) + local tnl=sit + + [ -n "$TST_IPV6" ] && tnl="ip6tnl" + + tst_rhost_run -s -c "ip link add name ltp_v0 type $tnl $@" + ;; *) tst_rhost_run -s -c "ip li add link $(tst_iface rhost) ltp_v0 \ type $virt_type $@"
Signature · 1 line
2.25.1
PATCH 3/3 network/virt: new foo over udp (fou) tunneling test
In reply to Alexey KodanevThe test sets up GRE(IPv4 and IPv6) virtual device using Foo over UDP for each side.
Then, it transmits TCP/UDP/UDP-Lite as inner packets with random size payload in both directions (using virt_netperf_rand_sizes()).
The test will pass if the performance of encapsulation is not significantly worse than without it. This is controlled by VIRT_PERF_THRESHOLD.
--- runtest/net.features | 3 ++ testcases/network/virt/fou01.sh | 48 ++++++++++++++++++++++++++++++ testcases/network/virt/virt_lib.sh | 31 +++++++++++-------- 3 files changed, 70 insertions(+), 12 deletions(-) create mode 100755 testcases/network/virt/fou01.sh
runtest/net.features +3 -0
@@ -63,6 +63,9 @@ gre_ipv6_02 gre02.sh -6 gue01 gue01.sh gue01_ipv6 gue01.sh -6 +fou01 fou01.sh +fou01_ipv6 fou01.sh -6 + dctcp_ipv4_01 dctcp01.sh dctcp_ipv6_01 dctcp01.sh -6
testcases/network/virt/fou01.sh new file +48 -0
48 lines not on this page · raw message
testcases/network/virt/virt_lib.sh +19 -12
@@ -99,6 +99,19 @@ virt_cleanup() virt_cleanup_rmt } +_get_gue_fou_tnl() +{ + local enc_type="$1" + local tnl=sit + + if [ "$enc_type" = "gue" ]; then + [ -n "$TST_IPV6" ] && tnl="ip6tnl" + else + [ -n "$TST_IPV6" ] && tnl="ip6gre" || tnl="gre" + fi + echo "$tnl" +} + virt_add() { local vname=$1
@@ -118,7 +131,7 @@ virt_add() [ -z "$opt" ] && \ opt="remote $(tst_ipaddr rhost) dev $(tst_iface)" ;; - sit|gue) + sit|gue|fou) [ -z "$opt" ] && opt="remote $(tst_ipaddr rhost) local $(tst_ipaddr)" ;; esac
@@ -130,11 +143,8 @@ virt_add() gre|ip6gre) ip -f inet$TST_IPV6 tu add $vname mode $virt_type $opt ;; - gue) - local tnl=sit - - [ -n "$TST_IPV6" ] && tnl="ip6tnl" - ip link add name $vname type $tnl $opt + gue|fou) + ip link add name $vname type $(_get_gue_fou_tnl $virt_type) $opt ;; *) ip li add link $(tst_iface) $vname type $virt_type $opt
@@ -158,12 +168,9 @@ virt_add_rhost() tst_rhost_run -s -c "ip -f inet$TST_IPV6 tu add ltp_v0 \ mode $virt_type $@" ;; - gue) - local tnl=sit - - [ -n "$TST_IPV6" ] && tnl="ip6tnl" - - tst_rhost_run -s -c "ip link add name ltp_v0 type $tnl $@" + gue|fou) + tst_rhost_run -s -c "ip link add name ltp_v0 \ + type $(_get_gue_fou_tnl $virt_type) $@" ;; *) tst_rhost_run -s -c "ip li add link $(tst_iface rhost) ltp_v0 \
Signature · 1 line
2.25.1
cover network/virt: new FOU and GUE tests
In reply to Alexey KodanevHi Alexey,
Quoted 4 lines
The first patch adds IPv6 flag '-6' to the library, which will be used by the two new tests in this patch series too.
The rest are adding two similar tests for UDP tunneling.
fou01.sh and gue01.sh are nearly the same, but I also wouldn't complicate things by putting functions into virt_lib.sh to reduce duplicity.
Thus whole patchset LGTM, thanks!
Kind regards,
Petr
cover network/virt: new FOU and GUE tests
Quoted 5 lines · Petr Vorel
Hi Alexey,
Quoted 2 lines
The first patch adds IPv6 flag '-6' to the library, which will be used by the two new tests in this patch series too.
Quoted 8 lines
Quoted 1 line
The rest are adding two similar tests for UDP tunneling.
fou01.shandgue01.share nearly the same, but I also wouldn't complicate things by putting functions intovirt_lib.shto reduce duplicity.Thus whole patchset LGTM, thanks!
Reviewed-by Petr Vorel <[email protected]>
Hi Petr,
Thanks for the review! I think with test args we could reduce duplication without complicating too much... what about these diffs below (gue01.sh removed)?
runtest/net.features +2 -2
@@ -65,8 +65,8 @@ gre_ipv6_01 gre01.sh -6 gre_ipv4_02 gre02.sh gre_ipv6_02 gre02.sh -6 -gue01 gue01.sh -gue01_ipv6 gue01.sh -6 +gue01 fou01.sh -t gue +gue01_ipv6 fou01.sh -t gue -6 fou01 fou01.sh fou01_ipv6 fou01.sh -6
testcases/network/virt/fou01.sh +18 -5
@@ -6,18 +6,26 @@ TST_TESTFUNC=virt_netperf_rand_sizes TST_SETUP=do_setup TST_CLEANUP=do_cleanup TST_NEEDS_TMPDIR=1 +TST_OPTS="t:" +TST_PARSE_ARGS="parse_args" virt_type="fou" . virt_lib.sh -# GRE IP protocol number -PROTO=47 +GRE_IP_PROTO=47 + +parse_args() +{ + case $1 in + t) virt_type="$2" ;; + esac +} do_cleanup() { if [ "$FOU_PORT" ]; then tst_net_run -l $FOU_PORT -r $FOU_PORT_RMT \ - "ip fou del ipproto $PROTO ${TST_IPV6_FLAG} port" + "ip fou del $FOU_PROTO ${TST_IPV6_FLAG} port" fi virt_cleanup_rmt
@@ -27,11 +35,18 @@ do_cleanup() do_setup() { local get_port_cmd="tst_get_unused_port ipv${TST_IPVER} dgram" - local encap_cmd="encap fou encap-sport auto encap-dport" + local encap_cmd="encap $virt_type encap-sport auto encap-dport" local loc_ip=$(tst_ipaddr) local rmt_ip=$(tst_ipaddr rhost) local fou="fou$TST_IPV6" + case $virt_type in + fou) FOU_PROTO="ipproto $GRE_IP_PROTO";; + gue) FOU_PROTO="gue";; + esac + tst_require_drivers $fou tst_net_run -s modprobe $fou
@@ -39,7 +54,7 @@ do_setup() FOU_PORT_RMT=$(tst_rhost_run -c "$get_port_cmd") tst_net_run -s -l $FOU_PORT -r $FOU_PORT_RMT \ - "ip fou add ipproto $PROTO ${TST_IPV6_FLAG} port" + "ip fou add $FOU_PROTO ${TST_IPV6_FLAG} port" virt_setup "local $loc_ip remote $rmt_ip $encap_cmd $FOU_PORT_RMT" \ "local $rmt_ip remote $loc_ip $encap_cmd $FOU_PORT"
cover network/virt: new FOU and GUE tests
Hi Alexey,
Quoted 5 lines
Hi Petr,
Thanks for the review! I think with test args we could reduce duplication without complicating too much... what about these diffs below (
gue01.shremoved)?
Good idea, thanks for addressing it, LGTM!
Kind regards,
Petr
Alexey Kodanev
Appliedcover network/virt: new FOU and GUE tests
Quoted 10 lines · Petr Vorel
Hi Alexey,
Quoted 5 lines
Hi Petr,
Thanks for the review! I think with test args we could reduce duplication without complicating too much... what about these diffs below (
gue01.shremoved)?Good idea, thanks for addressing it, LGTM!
Applied, thanks Petr!