ifupdown-ng/tests/linux/vrf_test
2020-08-18 16:28:34 -06:00

34 lines
950 B
Text
Executable file

#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/vrf"
tests_init \
leader_bringup \
leader_teardown \
member_bringup
leader_bringup_body() {
export MOCK=echo IFACE=vrf-red PHASE=pre-up IF_VRF_TABLE=1 IF_VRF_MEMBER=
atf_check -s exit:0 \
-o match:'ip link add vrf-red type vrf table 1' \
-o match:'ip rule add iif vrf-red table 1' \
-o match:'ip rule add oif vrf-red table 1' \
${EXECUTOR}
}
leader_teardown_body() {
export MOCK=echo IFACE=vrf-red PHASE=post-down IF_VRF_TABLE=1 IF_VRF_MEMBER=
atf_check -s exit:0 \
-o match:'ip link del vrf-red type vrf table 1' \
-o match:'ip rule del iif vrf-red table 1' \
-o match:'ip rule del oif vrf-red table 1' \
${EXECUTOR}
}
member_bringup_body() {
export MOCK=echo IFACE=eth0 PHASE=pre-up IF_VRF_MEMBER=vrf-red IF_VRF_TABLE=
atf_check -s exit:0 \
-o match:'ip link set eth0 master vrf-red' \
${EXECUTOR}
}