From 51b44223b063eeccccd078d39ab08f5d16629e22 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Mon, 25 Jul 2016 14:22:53 +0200 Subject: VPP lite test improvements * check if tests run with sudo * check if ODL is running * add 'wait' option to each test * increase wait time for RTR tests (timing issue) Change-Id: I1df01b43adc322635508fc4e2ad3e90759bb087c Signed-off-by: Filip Tehlar --- tests/data_plane/vpp_lite_topo/run.sh | 29 +++++++++++++++++----- .../data_plane/vpp_lite_topo/test_driver/basic.sh | 12 +++++++++ .../test_driver/basic_multi_traffic.sh | 8 ++++++ .../vpp_lite_topo/test_driver/basic_no_odl.sh | 8 ++++++ .../vpp_lite_topo/test_driver/rtr_single_iface.sh | 6 ++++- .../vpp_lite_topo/test_driver/rtr_two_iface.sh | 4 +-- .../test_driver/rtr_two_iface_two_customers.sh | 8 ++++++ .../test_driver/two_customers_topo.sh | 8 +++++- 8 files changed, 73 insertions(+), 10 deletions(-) diff --git a/tests/data_plane/vpp_lite_topo/run.sh b/tests/data_plane/vpp_lite_topo/run.sh index 59bae1c..aa0a298 100755 --- a/tests/data_plane/vpp_lite_topo/run.sh +++ b/tests/data_plane/vpp_lite_topo/run.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash +source config.sh +source odl_utils.sh + TESTS_DIR=tests function help @@ -37,25 +40,39 @@ passed_num=0 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=$? diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh index 897c773..d678e9e 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh @@ -22,6 +22,10 @@ function test_basic 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}" @@ -32,6 +36,10 @@ function test_basic 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 @@ -44,6 +52,10 @@ function test_basic # 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!" diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh index 2d3deaf..3af8bfa 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh @@ -27,6 +27,10 @@ function test_basic_multi_traffic 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!" @@ -62,6 +66,10 @@ function test_basic_multi_traffic 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 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh index f19fce6..ee0f66d 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh @@ -16,6 +16,10 @@ function test_basic_no_odl { 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}" @@ -37,6 +41,10 @@ function test_basic_no_odl 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 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh index f51e0af..40979e6 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh @@ -20,9 +20,13 @@ fi 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 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh index ea5aa2c..507a817 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh @@ -28,10 +28,10 @@ function test_rtr_two_iface { 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'" diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh index 46e0918..5a3dc83 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh @@ -24,6 +24,10 @@ function test_rtr_two_iface_two_customers { 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 @@ -38,6 +42,10 @@ function test_rtr_two_iface_two_customers { 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 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh b/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh index 7ff2a1d..9a5755f 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh @@ -23,7 +23,9 @@ function test_eid_virtualization { # 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=$? @@ -39,6 +41,10 @@ function test_eid_virtualization { 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 -- cgit 1.2.3-korg