tests: basic VLAN test

Set up two jails connected by an epair. Create VLAN interfaces in both
jails and check connectivity.

This is a very basic test, but exposed panics during the network stack
epoch work, so this is worth testing.
This commit is contained in:
Kristof Provost 2019-10-15 04:50:08 +00:00
parent 638f867814
commit fcd69db27d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=353542
2 changed files with 43 additions and 0 deletions

View File

@ -8,6 +8,7 @@ BINDIR= ${TESTSDIR}
ATF_TESTS_SH+= if_lagg_test
ATF_TESTS_SH+= if_clone_test
ATF_TESTS_SH+= if_tun_test
ATF_TESTS_SH+= if_vlan
# The tests are written to be run in parallel, but doing so leads to random
# panics. I think it's because the kernel's list of interfaces isn't properly

42
tests/sys/net/if_vlan.sh Executable file
View File

@ -0,0 +1,42 @@
# $FreeBSD$
. $(atf_get_srcdir)/../common/vnet.subr
atf_test_case "basic" "cleanup"
basic_head()
{
atf_set descr 'Basic VLAN test'
atf_set require.user root
}
basic_body()
{
vnet_init
epair_vlan=$(vnet_mkepair)
vnet_mkjail alcatraz ${epair_vlan}a
vnet_mkjail singsing ${epair_vlan}b
vlan0=$(jexec alcatraz ifconfig vlan create vlandev ${epair_vlan}a \
vlan 42)
jexec alcatraz ifconfig ${epair_vlan}a up
jexec alcatraz ifconfig ${vlan0} 10.0.0.1/24 up
vlan1=$(jexec singsing ifconfig vlan create vlandev ${epair_vlan}b \
vlan 42)
jexec singsing ifconfig ${epair_vlan}b up
jexec singsing ifconfig ${vlan1} 10.0.0.2/24 up
atf_check -s exit:0 -o ignore jexec singsing ping -c 1 10.0.0.1
}
basic_cleanup()
{
vnet_cleanup
}
atf_init_test_cases()
{
atf_add_test_case "basic"
}