aee2d45e18
This ensures we wind up with a clean slate for the interface or VRF when taking interfaces/VRFs down. Closes #149.
55 lines
1.7 KiB
Text
Executable file
55 lines
1.7 KiB
Text
Executable file
#!/usr/bin/env atf-sh
|
|
|
|
. $(atf_get_srcdir)/../test_env.sh
|
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/static"
|
|
|
|
tests_init \
|
|
up \
|
|
up_ptp \
|
|
down \
|
|
vrf_up \
|
|
metric_up
|
|
|
|
up_body() {
|
|
export IFACE=eth0 PHASE=up MOCK=echo IF_ADDRESSES="203.0.113.2/24 2001:db8:1000:2::2/64" \
|
|
IF_GATEWAYS="203.0.113.1 2001:db8:1000:2::1"
|
|
atf_check -s exit:0 \
|
|
-o match:'addr add 203.0.113.2/24 dev eth0' \
|
|
-o match:'addr add 2001:db8:1000:2::2/64 dev eth0' \
|
|
-o match:'route add default via 203.0.113.1 metric 1 dev eth0' \
|
|
-o match:'route add default via 2001:db8:1000:2::1 metric 1 dev eth0' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
up_ptp_body() {
|
|
export IFACE=eth0 PHASE=up MOCK=echo IF_ADDRESSES="203.0.113.2/32 2001:db8:1000:2::2/64" \
|
|
IF_GATEWAYS="192.0.2.1 2001:db8:1000:2::1" IF_POINT_TO_POINT="192.0.2.1"
|
|
atf_check -s exit:0 \
|
|
-o match:'addr add 203.0.113.2/32 peer 192.0.2.1 dev eth0' \
|
|
-o match:'route add default via 192.0.2.1 metric 1 dev eth0' \
|
|
-o match:'addr add 2001:db8:1000:2::2/64 dev eth0' \
|
|
-o match:'route add default via 2001:db8:1000:2::1 metric 1 dev eth0' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
down_body() {
|
|
export IFACE=eth0 PHASE=down MOCK=echo IF_ADDRESSES="203.0.113.2/24 2001:db8:1000:2::2/64" \
|
|
IF_GATEWAYS="203.0.113.1 2001:db8:1000:2::1"
|
|
atf_check -s exit:0 \
|
|
-o match:'addr flush dev eth0' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
vrf_up_body() {
|
|
export IFACE=vrf-red PHASE=up MOCK=echo IF_GATEWAYS=203.0.113.2 IF_VRF_TABLE=1
|
|
atf_check -s exit:0 \
|
|
-o match:'route add default via 203.0.113.2 table 1' \
|
|
${EXECUTOR}
|
|
}
|
|
|
|
metric_up_body() {
|
|
export IFACE=vrf-red PHASE=up MOCK=echo IF_GATEWAYS=203.0.113.2 IF_VRF_TABLE=1 IF_METRIC=20
|
|
atf_check -s exit:0 \
|
|
-o match:'route add default via 203.0.113.2 table 1 metric 20' \
|
|
${EXECUTOR}
|
|
}
|