Commit 2291752f authored by Petr Machata's avatar Petr Machata Committed by Paolo Abeni

selftests: forwarding: lib.sh: Validate NETIFS

The variable should contain at least NUM_NETIFS interfaces, stored
as keys named "p$i", for i in `seq $NUM_NETIFS`.
Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarBenjamin Poirier <bpoirier@nvidia.com>
Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent a4022a33
......@@ -273,11 +273,6 @@ if [[ "$REQUIRE_MTOOLS" = "yes" ]]; then
require_command mreceive
fi
if [[ ! -v NUM_NETIFS ]]; then
echo "SKIP: importer does not define \"NUM_NETIFS\""
exit $ksft_skip
fi
##############################################################################
# Command line options handling
......@@ -296,6 +291,23 @@ done
##############################################################################
# Network interfaces configuration
if [[ ! -v NUM_NETIFS ]]; then
echo "SKIP: importer does not define \"NUM_NETIFS\""
exit $ksft_skip
fi
if (( NUM_NETIFS > ${#NETIFS[@]} )); then
echo "SKIP: Importer requires $NUM_NETIFS NETIFS, but only ${#NETIFS[@]} are defined (${NETIFS[@]})"
exit $ksft_skip
fi
for i in $(seq ${#NETIFS[@]}); do
if [[ ! ${NETIFS[p$i]} ]]; then
echo "SKIP: NETIFS[p$i] not given"
exit $ksft_skip
fi
done
create_netif_veth()
{
local i
......
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