Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/net/if_lagg added test cases for lagg(4) on l2tp(4)



details:   https://anonhg.NetBSD.org/src/rev/31597f5db19b
branches:  trunk
changeset: 989895:31597f5db19b
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Tue Oct 19 07:57:15 2021 +0000

description:
added test cases for lagg(4) on l2tp(4)

diffstat:

 tests/net/if_lagg/t_lagg.sh |  392 +++++++++++++++++++++++++++++++++++--------
 1 files changed, 316 insertions(+), 76 deletions(-)

diffs (truncated from 629 to 300 lines):

diff -r 68262bc53ac7 -r 31597f5db19b tests/net/if_lagg/t_lagg.sh
--- a/tests/net/if_lagg/t_lagg.sh       Tue Oct 19 07:52:33 2021 +0000
+++ b/tests/net/if_lagg/t_lagg.sh       Tue Oct 19 07:57:15 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_lagg.sh,v 1.2 2021/05/25 00:38:30 yamaguchi Exp $
+#      $NetBSD: t_lagg.sh,v 1.3 2021/10/19 07:57:15 yamaguchi Exp $
 #
 # Copyright (c) 2021 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -85,6 +85,59 @@
            rump.ifconfig ${if_lagg}
 }
 
+setup_l2tp_ipv4tunnel()
+{
+       local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
+
+       local a_addr0=10.0.0.1
+       local a_addr1=10.0.0.2
+       local b_addr0=10.0.1.1
+       local b_addr1=10.0.1.2
+       local c_addr0=10.0.2.1
+       local c_addr1=10.0.2.2
+
+       local a_session0=1001
+       local a_session1=1002
+       local b_session0=1011
+       local b_session1=1012
+       local c_session0=1021
+       local c_session1=1022
+
+       rump_server_add_iface $SOCK_HOST0 l2tp0
+       rump_server_add_iface $SOCK_HOST0 l2tp1
+       rump_server_add_iface $SOCK_HOST0 l2tp2
+       rump_server_add_iface $SOCK_HOST1 l2tp0
+       rump_server_add_iface $SOCK_HOST1 l2tp1
+       rump_server_add_iface $SOCK_HOST1 l2tp2
+
+
+       export RUMP_SERVER=$SOCK_HOST0
+       $atf_ifconfig shmif0 $a_addr0/24
+       $atf_ifconfig l2tp0  tunnel  $a_addr0    $a_addr1
+       $atf_ifconfig l2tp0  session $a_session0 $a_session1
+
+       $atf_ifconfig shmif1 $b_addr0/24
+       $atf_ifconfig l2tp1  tunnel  $b_addr0    $b_addr1
+       $atf_ifconfig l2tp1  session $b_session0 $b_session1
+
+       $atf_ifconfig shmif2 $c_addr0/24
+       $atf_ifconfig l2tp2  tunnel  $c_addr0    $c_addr1
+       $atf_ifconfig l2tp2  session $c_session0 $c_session1
+
+       export RUMP_SERVER=$SOCK_HOST1
+       $atf_ifconfig shmif0 $a_addr1/24
+       $atf_ifconfig l2tp0  tunnel  $a_addr1    $a_addr0
+       $atf_ifconfig l2tp0  session $a_session1 $a_session0
+
+       $atf_ifconfig shmif1 $b_addr1/24
+       $atf_ifconfig l2tp1  tunnel  $b_addr1    $b_addr0
+       $atf_ifconfig l2tp1  session $b_session1 $b_session0
+
+       $atf_ifconfig shmif2 $c_addr1/24
+       $atf_ifconfig l2tp2  tunnel  $c_addr1    $c_addr0
+       $atf_ifconfig l2tp2  session $c_session1 $c_session0
+}
+
 atf_test_case lagg_ifconfig cleanup
 lagg_ifconfig_head()
 {
@@ -403,6 +456,7 @@
        local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
 
        local af=$1
+       local l2proto=$2
        local atf_ping="atf_check -s exit:0 -o ignore rump.ping -c 1"
        local ping=rump.ping
        local rumplib=""
@@ -423,6 +477,20 @@
                ;;
        esac
 
+       case $l2proto in
+       "ether")
+               iface0=shmif0
+               iface1=shmif1
+               iface2=shmif2
+               ;;
+       "l2tp")
+               rumplib="$rumplib l2tp"
+               iface0=l2tp0
+               iface1=l2tp1
+               iface2=l2tp2
+               ;;
+       esac
+
        rump_server_start $SOCK_HOST0 lagg $rumplib
        rump_server_start $SOCK_HOST1 lagg $rumplib
 
@@ -434,18 +502,22 @@
        rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
        rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
 
+       if [ x"$l2proto" = x"l2tp" ];then
+               setup_l2tp_ipv4tunnel
+       fi
+
        export RUMP_SERVER=$SOCK_HOST0
        $atf_ifconfig lagg0 create
-       $atf_ifconfig lagg0 laggproto lacp laggport shmif0
+       $atf_ifconfig lagg0 laggproto lacp laggport $iface0
        $atf_ifconfig lagg0 $af $addr_host0/$pfx
-       $atf_ifconfig shmif0 up
+       $atf_ifconfig $iface0 up
        $atf_ifconfig lagg0 up
 
        export RUMP_SERVER=$SOCK_HOST1
        $atf_ifconfig lagg0 create
-       $atf_ifconfig lagg0 laggproto lacp laggport shmif0
+       $atf_ifconfig lagg0 laggproto lacp laggport $iface0
        $atf_ifconfig lagg0 $af $addr_host1/$pfx
-       $atf_ifconfig shmif0 up
+       $atf_ifconfig $iface0 up
        $atf_ifconfig lagg0 up
 
        export RUMP_SERVER=$SOCK_HOST0
@@ -459,22 +531,22 @@
        $atf_ping $addr_host0
 
        export RUMP_SERVER=$SOCK_HOST0
-       $atf_ifconfig shmif1 up
-       $atf_ifconfig lagg0 laggport shmif1 laggport shmif2
-       $atf_ifconfig shmif2 up
+       $atf_ifconfig $iface1 up
+       $atf_ifconfig lagg0 laggport $iface1 laggport $iface2
+       $atf_ifconfig $iface2 up
 
        export RUMP_SERVER=$SOCK_HOST1
-       $atf_ifconfig shmif1 up
-       $atf_ifconfig lagg0 laggport shmif1 laggport shmif2
-       $atf_ifconfig shmif2 up
+       $atf_ifconfig $iface1 up
+       $atf_ifconfig lagg0 laggport $iface1 laggport $iface2
+       $atf_ifconfig $iface2 up
 
        export RUMP_SERVER=$SOCK_HOST0
-       wait_for_distributing lagg0 shmif1
-       wait_for_distributing lagg0 shmif2
+       wait_for_distributing lagg0 $iface1
+       wait_for_distributing lagg0 $iface2
 
        export RUMP_SERVER=$SOCK_HOST1
-       wait_for_distributing lagg0 shmif1
-       wait_for_distributing lagg0 shmif2
+       wait_for_distributing lagg0 $iface1
+       wait_for_distributing lagg0 $iface2
 
        $atf_ping $addr_host0
 }
@@ -490,7 +562,7 @@
 lagg_lacp_ipv4_body()
 {
 
-       lagg_lacp_ping "inet"
+       lagg_lacp_ping "inet" "ether"
 }
 
 lagg_lacp_ipv4_cleanup()
@@ -511,7 +583,7 @@
 lagg_lacp_ipv6_body()
 {
 
-       lagg_lacp_ping "inet6"
+       lagg_lacp_ping "inet6" "ether"
 }
 
 lagg_lacp_ipv6_cleanup()
@@ -521,6 +593,48 @@
        cleanup
 }
 
+atf_test_case lagg_lacp_l2tp_ipv4 cleanup
+lagg_lacp_l2tp_ipv4_head()
+{
+
+       atf_set "descr" "tests for LACP over l2tp by using IPv4"
+       atf_set "require.progs" "rump_server"
+}
+
+lagg_lacp_l2tp_ipv4_body()
+{
+
+       lagg_lacp_ping "inet" "l2tp"
+}
+
+lagg_lacp_l2tp_ipv4_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
+atf_test_case lagg_lacp_l2tp_ipv6 cleanup
+lagg_lacp_l2tp_ipv6_head()
+{
+
+       atf_set "descr" "tests for LACP over l2tp using IPv6"
+       atf_set "require.progs" "rump_server"
+}
+
+lagg_lacp_l2tp_ipv6_body()
+{
+
+       lagg_lacp_ping "inet6" "l2tp"
+}
+
+lagg_lacp_l2tp_ipv6_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
 lagg_lacp_vlan()
 {
        local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
@@ -757,6 +871,7 @@
        local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
 
        local af=$1
+       local l2proto=$2
        local ping="rump.ping -c 1"
        local rumplib=""
        local pfx=24
@@ -776,6 +891,20 @@
                ;;
        esac
 
+       case $l2proto in
+       "ether")
+               iface0="shmif0"
+               iface1="shmif1"
+               iface2="shmif2"
+               ;;
+       "l2tp")
+               rumplib="$rumplib l2tp"
+               iface0="l2tp0"
+               iface1="l2tp1"
+               iface2="l2tp2"
+               ;;
+       esac
+
        local atf_ping="atf_check -s exit:0 -o ignore ${ping}"
 
        rump_server_start $SOCK_HOST0 lagg $rumplib
@@ -789,73 +918,77 @@
        rump_server_add_iface $SOCK_HOST1 shmif1 $BUS1
        rump_server_add_iface $SOCK_HOST1 shmif2 $BUS2
 
+       if [ x"$l2proto" = x"l2tp" ]; then
+               setup_l2tp_ipv4tunnel
+       fi
+
        export RUMP_SERVER=$SOCK_HOST0
        $atf_ifconfig lagg0 create
        $atf_ifconfig lagg0 laggproto failover
 
-       $atf_ifconfig lagg0 laggport shmif0 pri 1000
-       $atf_ifconfig lagg0 laggport shmif1 pri 2000
-       $atf_ifconfig lagg0 laggport shmif2 pri 3000
+       $atf_ifconfig lagg0 laggport $iface0 pri 1000
+       $atf_ifconfig lagg0 laggport $iface1 pri 2000
+       $atf_ifconfig lagg0 laggport $iface2 pri 3000
        $atf_ifconfig lagg0 $af $addr_host0/$pfx
 
        export RUMP_SERVER=$SOCK_HOST1
        $atf_ifconfig lagg0 create
        $atf_ifconfig lagg0 laggproto failover
 
-       $atf_ifconfig lagg0 laggport shmif0 pri 1000
-       $atf_ifconfig lagg0 laggport shmif1 pri 3000
-       $atf_ifconfig lagg0 laggport shmif2 pri 2000
+       $atf_ifconfig lagg0 laggport $iface0 pri 1000
+       $atf_ifconfig lagg0 laggport $iface1 pri 3000
+       $atf_ifconfig lagg0 laggport $iface2 pri 2000
        $atf_ifconfig lagg0 $af $addr_host1/$pfx
 
        export RUMP_SERVER=$SOCK_HOST0
-       $atf_ifconfig shmif0 up
-       $atf_ifconfig shmif1 up
-       $atf_ifconfig shmif2 up
+       $atf_ifconfig $iface0 up
+       $atf_ifconfig $iface1 up
+       $atf_ifconfig $iface2 up
        $atf_ifconfig lagg0 up
 
        export RUMP_SERVER=$SOCK_HOST1
-       $atf_ifconfig shmif0 up
-       $atf_ifconfig shmif1 up
-       $atf_ifconfig shmif2 up
+       $atf_ifconfig $iface0 up



Home | Main Index | Thread Index | Old Index