Add a test case for CARP on IPv6
The test case fails expectedly because the implementation of CARP on IPv6 is incomplete yet.
This commit is contained in:
parent
4be80cf347
commit
d547401b55
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: t_basic.sh,v 1.1 2017/01/16 08:18:11 ozaki-r Exp $
|
||||
# $NetBSD: t_basic.sh,v 1.2 2017/02/27 07:24:26 ozaki-r Exp $
|
||||
#
|
||||
# Copyright (c) 2017 Internet Initiative Japan Inc.
|
||||
# All rights reserved.
|
||||
|
@ -29,14 +29,9 @@ SOCK_CLIENT=unix://carp_client
|
|||
SOCK_MASTER=unix://carp_master
|
||||
SOCK_BACKUP=unix://carp_backup
|
||||
BUS=bus_carp
|
||||
IP_CLIENT=10.1.1.240
|
||||
IP_MASTER=10.1.1.1
|
||||
IP_BACKUP=10.1.1.2
|
||||
IP_CARP=10.1.1.100
|
||||
TIMEOUT=3
|
||||
|
||||
atf_test_case carp_handover cleanup
|
||||
|
||||
carp_handover_head()
|
||||
{
|
||||
|
||||
|
@ -44,6 +39,11 @@ carp_handover_head()
|
|||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
IP_CLIENT=10.1.1.240
|
||||
IP_MASTER=10.1.1.1
|
||||
IP_BACKUP=10.1.1.2
|
||||
IP_CARP=10.1.1.100
|
||||
|
||||
setup_carp()
|
||||
{
|
||||
local sock=$1
|
||||
|
@ -61,6 +61,10 @@ setup_carp()
|
|||
fi
|
||||
|
||||
export RUMP_SERVER=$sock
|
||||
if $DEBUG; then
|
||||
atf_check -s exit:0 -o match:'0.->.1' \
|
||||
rump.sysctl -w net.inet.carp.log=1
|
||||
fi
|
||||
atf_check -s exit:0 rump.ifconfig $carpif create
|
||||
atf_check -s exit:0 rump.ifconfig shmif0 $ip/24 up
|
||||
atf_check -s exit:0 rump.ifconfig $carpif \
|
||||
|
@ -158,8 +162,141 @@ carp_handover_cleanup()
|
|||
cleanup
|
||||
}
|
||||
|
||||
atf_test_case carp6_handover cleanup
|
||||
carp6_handover_head()
|
||||
{
|
||||
|
||||
atf_set "descr" "Tests for CARP handover (IPv6)"
|
||||
atf_set "require.progs" "rump_server"
|
||||
}
|
||||
|
||||
IP6_CLIENT=fd00:1::240
|
||||
IP6_MASTER=fd00:1::1
|
||||
IP6_BACKUP=fd00:1::2
|
||||
IP6_CARP=fd00:1::100
|
||||
|
||||
setup_carp6()
|
||||
{
|
||||
local sock=$1
|
||||
local master=$2
|
||||
local carpif= ip= advskew=
|
||||
|
||||
if $master; then
|
||||
carpif=carp0
|
||||
ip=$IP6_MASTER
|
||||
advskew=0
|
||||
else
|
||||
carpif=carp1
|
||||
ip=$IP6_BACKUP
|
||||
advskew=200
|
||||
fi
|
||||
|
||||
export RUMP_SERVER=$sock
|
||||
if $DEBUG; then
|
||||
atf_check -s exit:0 -o match:'0.->.1' \
|
||||
rump.sysctl -w net.inet.carp.log=1
|
||||
fi
|
||||
atf_check -s exit:0 rump.ifconfig $carpif create
|
||||
atf_check -s exit:0 rump.ifconfig shmif0 inet6 $ip up
|
||||
atf_check -s exit:0 rump.ifconfig $carpif inet6 \
|
||||
vhid 175 advskew $advskew advbase 1 pass s3cret $IP6_CARP
|
||||
atf_check -s exit:0 rump.ifconfig -w 10
|
||||
}
|
||||
|
||||
wait_carp6_handover()
|
||||
{
|
||||
local i=0
|
||||
|
||||
export RUMP_SERVER=$SOCK_CLIENT
|
||||
|
||||
while [ $i -ne 5 ]; do
|
||||
$DEBUG && echo "Trying ping6 $IP6_CARP"
|
||||
rump.ping6 -n -X 1 -c 1 $IP6_CARP >/dev/null
|
||||
if [ $? = 0 ]; then
|
||||
$DEBUG && echo "Passed ping $IP6_CARP"
|
||||
break;
|
||||
fi
|
||||
$DEBUG && echo "Failed ping6 $IP6_CARP"
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
if [ $i -eq 5 ]; then
|
||||
atf_fail "Failed to failover (5 sec)"
|
||||
fi
|
||||
}
|
||||
|
||||
carp6_handover_body()
|
||||
{
|
||||
|
||||
atf_expect_fail 'The implementation of CARP on IPv6 is incomplete yet.'
|
||||
|
||||
rump_server_start $SOCK_CLIENT netinet6
|
||||
rump_server_start $SOCK_MASTER netinet6
|
||||
rump_server_start $SOCK_BACKUP netinet6
|
||||
|
||||
rump_server_add_iface $SOCK_CLIENT shmif0 $BUS
|
||||
rump_server_add_iface $SOCK_MASTER shmif0 $BUS
|
||||
rump_server_add_iface $SOCK_BACKUP shmif0 $BUS
|
||||
|
||||
setup_carp6 $SOCK_MASTER true
|
||||
setup_carp6 $SOCK_BACKUP false
|
||||
|
||||
export RUMP_SERVER=$SOCK_CLIENT
|
||||
atf_check -s exit:0 rump.ifconfig shmif0 inet6 $IP6_CLIENT up
|
||||
atf_check -s exit:0 rump.ifconfig -w 10
|
||||
|
||||
# Check that the primary addresses are up
|
||||
atf_check -s exit:0 -o ignore \
|
||||
rump.ping6 -n -X $TIMEOUT -c 1 $IP6_MASTER
|
||||
atf_check -s exit:0 -o ignore \
|
||||
rump.ping6 -n -X $TIMEOUT -c 1 $IP6_BACKUP
|
||||
|
||||
# Give carp a while to croak
|
||||
sleep 4
|
||||
|
||||
# Check state
|
||||
export RUMP_SERVER=$SOCK_MASTER
|
||||
$DEBUG && rump.ifconfig
|
||||
atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
|
||||
rump.ifconfig carp0
|
||||
export RUMP_SERVER=$SOCK_BACKUP
|
||||
$DEBUG && rump.ifconfig
|
||||
atf_check -s exit:0 -o match:'carp: BACKUP carpdev shmif0' \
|
||||
rump.ifconfig carp1
|
||||
export RUMP_SERVER=$SOCK_CLIENT
|
||||
|
||||
# Check that the shared IP works
|
||||
atf_check -s exit:0 -o ignore \
|
||||
rump.ping6 -n -X $TIMEOUT -c 1 $IP6_CARP
|
||||
|
||||
# KILLING SPREE
|
||||
env RUMP_SERVER=$SOCK_MASTER rump.halt
|
||||
sleep 1
|
||||
|
||||
# Check that primary is now dead
|
||||
atf_check -s not-exit:0 -o ignore \
|
||||
rump.ping6 -n -X $TIMEOUT -c 1 $IP6_MASTER
|
||||
|
||||
# Do it in installments. carp will cluck meanwhile
|
||||
wait_carp6_handover
|
||||
|
||||
# Check state
|
||||
export RUMP_SERVER=$SOCK_BACKUP
|
||||
$DEBUG && rump.ifconfig
|
||||
atf_check -s exit:0 -o match:'carp: MASTER carpdev shmif0' \
|
||||
rump.ifconfig carp1
|
||||
}
|
||||
|
||||
carp6_handover_cleanup()
|
||||
{
|
||||
|
||||
$DEBUG && dump
|
||||
cleanup
|
||||
}
|
||||
|
||||
atf_init_test_cases()
|
||||
{
|
||||
|
||||
atf_add_test_case carp_handover
|
||||
atf_add_test_case carp6_handover
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue