Commit 967450c5 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

selftests: forwarding: lib: extract ping and ping6 so they can be reused

Extract ping and ping6 command execution so the return value can be
checked by the caller, this is needed for port isolation tests that are
intended to fail.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f744c4bb
...@@ -659,30 +659,40 @@ multipath_eval() ...@@ -659,30 +659,40 @@ multipath_eval()
############################################################################## ##############################################################################
# Tests # Tests
ping_test() ping_do()
{ {
local if_name=$1 local if_name=$1
local dip=$2 local dip=$2
local vrf_name local vrf_name
RET=0
vrf_name=$(master_name_get $if_name) vrf_name=$(master_name_get $if_name)
ip vrf exec $vrf_name $PING $dip -c 10 -i 0.1 -w 2 &> /dev/null ip vrf exec $vrf_name $PING $dip -c 10 -i 0.1 -w 2 &> /dev/null
}
ping_test()
{
RET=0
ping_do $1 $2
check_err $? check_err $?
log_test "ping" log_test "ping"
} }
ping6_test() ping6_do()
{ {
local if_name=$1 local if_name=$1
local dip=$2 local dip=$2
local vrf_name local vrf_name
RET=0
vrf_name=$(master_name_get $if_name) vrf_name=$(master_name_get $if_name)
ip vrf exec $vrf_name $PING6 $dip -c 10 -i 0.1 -w 2 &> /dev/null ip vrf exec $vrf_name $PING6 $dip -c 10 -i 0.1 -w 2 &> /dev/null
}
ping6_test()
{
RET=0
ping6_do $1 $2
check_err $? check_err $?
log_test "ping6" log_test "ping6"
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment