2020-07-26 09:48:37 +00:00
|
|
|
#!/usr/bin/env atf-sh
|
|
|
|
|
|
|
|
. $(atf_get_srcdir)/../test_env.sh
|
|
|
|
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/link"
|
|
|
|
|
2020-08-24 08:58:39 +00:00
|
|
|
tests_init \
|
|
|
|
up \
|
|
|
|
down \
|
|
|
|
mtu \
|
2020-08-26 08:22:30 +00:00
|
|
|
hwaddress \
|
2020-09-09 21:36:11 +00:00
|
|
|
vlan_explicit_create \
|
|
|
|
vlan_explicit_destroy \
|
|
|
|
vlan_guessed_create \
|
|
|
|
vlan_guessed_destroy \
|
2020-08-24 09:01:38 +00:00
|
|
|
vlan_explicit_depend \
|
2020-09-04 22:28:12 +00:00
|
|
|
vlan_guessed_depend \
|
2020-09-09 21:36:11 +00:00
|
|
|
dummy_create
|
2020-07-26 09:48:37 +00:00
|
|
|
|
|
|
|
up_body() {
|
2020-08-25 14:16:05 +00:00
|
|
|
export IFACE=lo PHASE=up MOCK=echo
|
2020-07-26 09:48:37 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link set up dev lo' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
|
|
|
down_body() {
|
2020-08-25 14:16:05 +00:00
|
|
|
export IFACE=lo PHASE=down MOCK=echo
|
2020-07-26 09:48:37 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link set down dev lo' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
2020-08-18 21:57:01 +00:00
|
|
|
|
|
|
|
mtu_body() {
|
2020-08-25 14:16:05 +00:00
|
|
|
export IFACE=eth0 PHASE=up MOCK=echo IF_MTU=1492
|
2020-08-18 21:57:01 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link set up dev eth0 mtu 1492' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
2020-08-24 08:58:39 +00:00
|
|
|
|
2020-08-26 08:22:30 +00:00
|
|
|
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}
|
|
|
|
}
|
|
|
|
|
2020-09-09 21:36:11 +00:00
|
|
|
vlan_explicit_create_body() {
|
|
|
|
export IFACE=servers PHASE=create MOCK=echo \
|
2020-08-24 08:58:39 +00:00
|
|
|
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}
|
|
|
|
}
|
|
|
|
|
2020-09-09 21:36:11 +00:00
|
|
|
vlan_explicit_destroy_body() {
|
|
|
|
export IFACE=servers PHASE=destroy MOCK=echo \
|
2020-08-24 08:58:39 +00:00
|
|
|
IF_VLAN_RAW_DEVICE="eth0" IF_VLAN_ID="123"
|
2020-09-04 21:45:49 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link del servers' \
|
2020-08-24 08:58:39 +00:00
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
2020-09-09 21:36:11 +00:00
|
|
|
vlan_guessed_create_body() {
|
|
|
|
export IFACE=eth0.8 PHASE=create MOCK=echo
|
2020-08-24 08:58:39 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link add link eth0 name eth0.8 type vlan id 8' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|
|
|
|
|
2020-09-09 21:36:11 +00:00
|
|
|
vlan_guessed_destroy_body() {
|
|
|
|
export IFACE=eth0.8 PHASE=destroy MOCK=echo
|
2020-09-04 21:45:49 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link del eth0.8' \
|
2020-08-24 08:58:39 +00:00
|
|
|
${EXECUTOR}
|
|
|
|
}
|
2020-08-24 09:01:38 +00:00
|
|
|
|
|
|
|
vlan_explicit_depend_body() {
|
2020-09-04 22:24:40 +00:00
|
|
|
export IFACE=servers PHASE=depend \
|
2020-08-24 09:01:38 +00:00
|
|
|
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}
|
|
|
|
}
|
2020-09-04 22:28:12 +00:00
|
|
|
|
2020-09-09 21:36:11 +00:00
|
|
|
dummy_create_body() {
|
|
|
|
export IFACE=yolo IF_LINK_TYPE=dummy PHASE=create MOCK=echo
|
2020-09-04 22:28:12 +00:00
|
|
|
atf_check -s exit:0 -o match:'ip link add yolo type dummy' \
|
|
|
|
${EXECUTOR}
|
|
|
|
}
|