ifupdown-ng/tests/linux/link_test
Maximilian Wilhelm 4a05010539 tests: Fix vlan_explicit_depend_body.
Signed-off-by: Maximilian Wilhelm <max@sdn.clinic>
2020-09-05 00:24:40 +02:00

79 lines
1.9 KiB
Text
Executable file

#!/usr/bin/env atf-sh
. $(atf_get_srcdir)/../test_env.sh
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/link"
tests_init \
up \
down \
mtu \
hwaddress \
vlan_explicit_pre_up \
vlan_explicit_post_down \
vlan_guessed_pre_up \
vlan_guessed_post_down \
vlan_explicit_depend \
vlan_guessed_depend
up_body() {
export IFACE=lo PHASE=up MOCK=echo
atf_check -s exit:0 -o match:'ip link set up dev lo' \
${EXECUTOR}
}
down_body() {
export IFACE=lo PHASE=down MOCK=echo
atf_check -s exit:0 -o match:'ip link set down dev lo' \
${EXECUTOR}
}
mtu_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_MTU=1492
atf_check -s exit:0 -o match:'ip link set up dev eth0 mtu 1492' \
${EXECUTOR}
}
hwaddress_body() {
export IFACE=eth0 PHASE=up MOCK=echo IF_HWADDRESS=12:34:56:78:90:ab
atf_check -s exit:0 -o match:'ip link set up dev eth0 address 12:34:56:78:90:ab' \
${EXECUTOR}
}
vlan_explicit_pre_up_body() {
export IFACE=servers PHASE=pre-up MOCK=echo \
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
atf_check -s exit:0 -o match:'ip link add link eth0 name servers type vlan id 123' \
${EXECUTOR}
}
vlan_explicit_post_down_body() {
export IFACE=servers PHASE=post-down MOCK=echo \
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
atf_check -s exit:0 -o match:'ip link del servers' \
${EXECUTOR}
}
vlan_guessed_pre_up_body() {
export IFACE=eth0.8 PHASE=pre-up MOCK=echo
atf_check -s exit:0 -o match:'ip link add link eth0 name eth0.8 type vlan id 8' \
${EXECUTOR}
}
vlan_guessed_post_down_body() {
export IFACE=eth0.8 PHASE=post-down MOCK=echo
atf_check -s exit:0 -o match:'ip link del eth0.8' \
${EXECUTOR}
}
vlan_explicit_depend_body() {
export IFACE=servers PHASE=depend \
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
atf_check -s exit:0 -o match:'eth0' \
${EXECUTOR}
}
vlan_guessed_depend_body() {
export IFACE=eth0.8 PHASE=depend
atf_check -s exit:0 -o match:'eth0' \
${EXECUTOR}
}