VPP lite test improvements 69/2069/1
authorFilip Tehlar <ftehlar@cisco.com>
Mon, 25 Jul 2016 12:22:53 +0000 (14:22 +0200)
committerFilip Tehlar <ftehlar@cisco.com>
Mon, 25 Jul 2016 12:25:54 +0000 (14:25 +0200)
* 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 <ftehlar@cisco.com>
tests/data_plane/vpp_lite_topo/run.sh
tests/data_plane/vpp_lite_topo/test_driver/basic.sh
tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh
tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh
tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh
tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface.sh
tests/data_plane/vpp_lite_topo/test_driver/rtr_two_iface_two_customers.sh
tests/data_plane/vpp_lite_topo/test_driver/two_customers_topo.sh

index 59bae1c..aa0a298 100755 (executable)
@@ -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=$?
 
index 897c773..d678e9e 100644 (file)
@@ -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!"
index 2d3deaf..3af8bfa 100644 (file)
@@ -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
index f19fce6..ee0f66d 100644 (file)
@@ -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
index f51e0af..40979e6 100644 (file)
@@ -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
index ea5aa2c..507a817 100644 (file)
@@ -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'"
index 46e0918..5a3dc83 100644 (file)
@@ -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
index 7ff2a1d..9a5755f 100644 (file)
@@ -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