#!/usr/bin/env bash
+source config.sh
+source odl_utils.sh
+
TESTS_DIR=tests
function help
start_time=`date +%s`
+# check whether ODL is running
+if [ "`curl -X DELETE \
+ "http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database" \
+ -u ${ODL_USER}:${ODL_PASSWD} -s -o /dev/null -w "%{http_code}"`" != 200 ] ; then
+ echo "ODL is not running!"
+ exit 1
+fi
+
+# sudo?
+if [[ $(id -u) != 0 ]]; then
+ echo "Superuser privileges needed!"
+ exit 1
+fi
+
# count tests
-test_num=`ls -l $TESTS_DIR/test_* | wc -l`
+test_num=`ls -l "$TESTS_DIR"/test_* | wc -l`
echo
echo "Running VPP lite test suite."
echo
-for test_case in $TESTS_DIR/test_*
+for test_case in "$TESTS_DIR"/test_*
do
let "count=$count + 1"
# run the test case
- base_name=`basename -a $test_case`
- printf "*** %d/%d : %-45s" $count $test_num $base_name
+ base_name=`basename -a "$test_case"`
+ printf "*** %2d/%d : %-45s" $count $test_num "$base_name"
if [ $verbose -ne 0 ] ; then
- $test_case
+ "$test_case"
else
- $test_case &> /dev/null
+ "$test_case" &> /dev/null
fi
rc=$?
basic_topo_setup
fi
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
test_result=1
ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
exit $test_result
fi
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
# change IP addresses of destination RLOC
echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003
echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003
# test done
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
basic_topo_clean
if [ $rc -ne 0 ] ; then
echo "Test failed: No ICMP response received within specified timeout limit!"
test_result=1
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
if [ $? -ne 0 ] ; then
echo "No response received!"
ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}"
rc=$?
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
# test done
basic_topo_clean
{
basic_topo_setup no_odl
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
test_result=1
ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
rc=$?
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
# test done
basic_topo_clean no_odl
function test_rtr_single_iface {
rtr_single_iface_setup
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
test_result=1
- ip netns exec vpp-ns1 "${1}" -w 15 -c 1 "${2}"
+ ip netns exec vpp-ns1 "${1}" -w 20 -c 1 "${2}"
rc=$?
rtr_single_iface_clean
rc=0
if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
- ip netns exec vpp1-ns ping -w 15 -c 1 "${1}"
+ ip netns exec vpp1-ns ping -w 20 -c 1 "${1}"
rc=$?
elif [ "$1" != "${1#*:[0-9a-fA-F]}" ]; then
- ip netns exec vpp1-ns ping6 -w 15 -c 1 "${1}"
+ ip netns exec vpp1-ns ping6 -w 20 -c 1 "${1}"
rc=$?
else
echo "Unrecognized IP format '$1'"
test_result=0
rc=0
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}"
rc=$?
if [ $rc -ne 0 ] ; then
test_result=1
fi
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
rtr_two_iface_two_customers_clean
if [ $rc -ne 0 ] ; then
# init to test failed
test_result=1
- #read -p "press any key to continue .." -n1
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}"
rc=$?
echo "Error: customer 2 did not receive any response!"
fi
+ if [ "$3" == "wait" ] ; then
+ read -p "press any key to continue .." -n1
+ fi
+
two_customers_topo_clean
if [ $rc -ne 0 ] ; then