Skip to content

Commit 2e825f8

Browse files
liuhangbindavem330
authored andcommitted
selftests: bonding: add arp validate test
This patch add bonding arp validate tests with mode active backup, monitor arp_ip_target and ns_ip6_target. It also checks mii_status to make sure all slaves are UP. Acked-by: Jonathan Toppins <[email protected]> Acked-by: Jay Vosburgh <[email protected]> Signed-off-by: Hangbin Liu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 481b56e commit 2e825f8

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

tools/testing/selftests/drivers/net/bonding/bond_options.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
ALL_TESTS="
77
prio
8+
arp_validate
89
"
910

1011
REQUIRE_MZ=no
@@ -200,6 +201,60 @@ prio()
200201
done
201202
}
202203

204+
arp_validate_test()
205+
{
206+
local param="$1"
207+
RET=0
208+
209+
# create bond
210+
bond_reset "${param}"
211+
212+
bond_check_connection
213+
[ $RET -ne 0 ] && log_test "arp_validate" "$retmsg"
214+
215+
# wait for a while to make sure the mii status stable
216+
sleep 5
217+
for i in $(seq 0 2); do
218+
mii_status=$(cmd_jq "ip -n ${s_ns} -j -d link show eth$i" ".[].linkinfo.info_slave_data.mii_status")
219+
if [ ${mii_status} != "UP" ]; then
220+
RET=1
221+
log_test "arp_validate" "interface eth$i mii_status $mii_status"
222+
fi
223+
done
224+
}
225+
226+
arp_validate_arp()
227+
{
228+
local mode=$1
229+
local val
230+
for val in $(seq 0 6); do
231+
arp_validate_test "mode $mode arp_interval 100 arp_ip_target ${g_ip4} arp_validate $val"
232+
log_test "arp_validate" "$mode arp_ip_target arp_validate $val"
233+
done
234+
}
235+
236+
arp_validate_ns()
237+
{
238+
local mode=$1
239+
local val
240+
241+
if skip_ns; then
242+
log_test_skip "arp_validate ns" "Current iproute or kernel doesn't support bond option 'ns_ip6_target'."
243+
return 0
244+
fi
245+
246+
for val in $(seq 0 6); do
247+
arp_validate_test "mode $mode arp_interval 100 ns_ip6_target ${g_ip6} arp_validate $val"
248+
log_test "arp_validate" "$mode ns_ip6_target arp_validate $val"
249+
done
250+
}
251+
252+
arp_validate()
253+
{
254+
arp_validate_arp "active-backup"
255+
arp_validate_ns "active-backup"
256+
}
257+
203258
trap cleanup EXIT
204259

205260
setup_prepare

0 commit comments

Comments
 (0)