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 Add tests for MTU of lagg(4)



details:   https://anonhg.NetBSD.org/src/rev/201b9528a405
branches:  trunk
changeset: 364608:201b9528a405
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Thu Mar 31 03:26:33 2022 +0000

description:
Add tests for MTU of lagg(4)

diffstat:

 tests/net/if_lagg/t_lagg.sh |  87 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 86 insertions(+), 1 deletions(-)

diffs (108 lines):

diff -r a1f9dd59bca7 -r 201b9528a405 tests/net/if_lagg/t_lagg.sh
--- a/tests/net/if_lagg/t_lagg.sh       Thu Mar 31 03:21:33 2022 +0000
+++ b/tests/net/if_lagg/t_lagg.sh       Thu Mar 31 03:26:33 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_lagg.sh,v 1.7 2022/03/31 03:09:03 yamaguchi Exp $
+#      $NetBSD: t_lagg.sh,v 1.8 2022/03/31 03:26:33 yamaguchi Exp $
 #
 # Copyright (c) 2021 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -357,6 +357,90 @@
        cleanup
 }
 
+atf_test_case lagg_mtu cleanup
+lagg_mtu_head()
+{
+       atf_set "descr" "tests for MTU"
+       atf_set "require.progs" "rump_server"
+}
+
+lagg_mtu_body()
+{
+       local atf_ifconfig="atf_check -s exit:0 rump.ifconfig"
+       local mtu_1st=1450
+       local mtu_big=1460
+       local mtu_small=1440
+
+       rump_server_start $SOCK_HOST0 lagg
+
+       export RUMP_SERVER=$SOCK_HOST0
+       rump_server_add_iface $SOCK_HOST0 shmif0 $BUS0
+       rump_server_add_iface $SOCK_HOST0 shmif1 $BUS1
+       rump_server_add_iface $SOCK_HOST0 shmif2 $BUS2
+       $atf_ifconfig lagg0 create
+       $atf_ifconfig lagg0 laggproto lacp
+
+       $atf_ifconfig shmif0 mtu $mtu_1st
+       $atf_ifconfig shmif1 mtu $mtu_big
+       $atf_ifconfig shmif2 mtu $mtu_small
+
+       atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+       atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1
+       atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2
+
+       # copy MTU from 1st port
+       $atf_ifconfig lagg0 laggport shmif0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+
+       # copy MTU to added port
+       $atf_ifconfig lagg0 laggport shmif1
+       $atf_ifconfig lagg0 laggport shmif2
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif1
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif2
+
+       # reset MTU after detaching from lagg0
+       $atf_ifconfig lagg0 -laggport shmif2
+       atf_check -s exit:0 -o match:"mtu *$mtu_small" rump.ifconfig shmif2
+
+       # change MTU of lagg0
+       $atf_ifconfig lagg0 mtu 1500
+       atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0
+       atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif0
+       atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig shmif1
+
+       # reset MTU after detching from lagg0
+       $atf_ifconfig lagg0 -laggport shmif0
+       $atf_ifconfig lagg0 -laggport shmif1
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+       atf_check -s exit:0 -o match:"mtu *$mtu_big" rump.ifconfig shmif1
+
+       # MTU should not be changed
+       atf_check -s exit:0 -o match:"mtu *1500" rump.ifconfig lagg0
+
+       # copy MTU from 1st port even when MTU of lagg0 is changhed
+       $atf_ifconfig lagg0 mtu 1400
+       atf_check -s exit:0 -o match:"mtu *1400" rump.ifconfig lagg0
+       $atf_ifconfig lagg0 laggport shmif0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+
+       # MTU of lagg0 need not reset
+       $atf_ifconfig lagg0 -laggport shmif0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig lagg0
+       atf_check -s exit:0 -o match:"mtu *$mtu_1st" rump.ifconfig shmif0
+}
+
+lagg_mtu_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
 atf_test_case lagg_lacp_basic cleanup
 lagg_lacp_basic_head()
 {
@@ -1376,6 +1460,7 @@
        atf_add_test_case lagg_ifconfig
        atf_add_test_case lagg_macaddr
        atf_add_test_case lagg_ipv6lla
+       atf_add_test_case lagg_mtu
        atf_add_test_case lagg_lacp_basic
        atf_add_test_case lagg_lacp_ipv4
        atf_add_test_case lagg_lacp_ipv6



Home | Main Index | Thread Index | Old Index