diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-09-07 15:47:47 +0200 |
---|---|---|
committer | Filip Tehlar <ftehlar@cisco.com> | 2016-09-12 14:41:10 +0200 |
commit | bf231ba795387064e7c4f1781240619429a4ef29 (patch) | |
tree | 86da34369910ca1c85672ed30d4374d4ecda9ac3 /tests/data_plane/vpp_lite_topo/test_driver | |
parent | 1df1d674eaace35d52973786403eb1dbe3c0d5eb (diff) |
Introduce an option for testing binary API
This patch introduces an option for choosing a configuration method in
tests. Supported methods are VAT and vpp's debug CLI.
* Added new aprameter to run.sh to define method (--cfg-method [vat|cli]).
Defaults to vat.
* When running a test separately the method can be set as follows:
$ sudo CFG_METHOD=cli ./tests/<test_case>.sh
Again, it defaults to 'vat' if not provided.
* Increased readability in test driver scripts when checking test
status
* When debugging you can stop test execution by running the test with WAIT=1:
$ sudo WAIT=1 tests/<test_case>.sh
Change-Id: If851139cff072ba2e3b3594a3345763d360f3b59
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'tests/data_plane/vpp_lite_topo/test_driver')
12 files changed, 49 insertions, 230 deletions
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 77e3d14..cd10d4c 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh @@ -22,24 +22,13 @@ function test_basic basic_topo_setup fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause test_result=1 ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" - rc=$? - if [ $rc -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi - - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + assert_rc_ok $? basic_topo_clean "No ICMP response!" + maybe_pause # 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 @@ -52,17 +41,8 @@ function test_basic # test done - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause basic_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh index c744dc1..b3d53aa 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_l2.sh @@ -21,34 +21,18 @@ function test_basic basic_topo_setup fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause test_result=1 ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" rc=$? - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - - if [ $rc -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + maybe_pause + assert_rc_ok $rc basic_topo_clean "No response received!" # test done basic_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICM response!" exit $test_result } 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 81fd0ff..79456b7 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,23 +27,13 @@ function test_basic_multi_traffic test_result=1 - if [ "$5" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" - if [ $? -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + assert_rc_ok $? basic_topo_clean "No response received!" ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}" - if [ $? -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + assert_rc_ok $? basic_topo_clean "No response received!" # change IP addresses of destination RLOC echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003 @@ -56,33 +46,19 @@ function test_basic_multi_traffic ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4 post_curl "update-mapping" ${ODL_CONFIG_FILE3} - if [ "$5" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" - if [ $? -ne 0 ] ; then - echo "No response received!" - basic_topo_clean - exit $test_result - fi + assert_rc_ok $? basic_topo_clean "No response received!" ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}" rc=$? - if [ "$5" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # test done - basic_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi + print_status $rc "No ICMP response!" exit $test_result } 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 9df6ebb..6d06a16 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,9 +16,7 @@ function test_basic_no_odl { basic_topo_setup no_odl - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 @@ -43,9 +41,7 @@ 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 + maybe_pause # test done diff --git a/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh b/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh index 7d623f0..9e34d11 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/multihoming.sh @@ -22,13 +22,12 @@ function test_multihoming multihoming_topo_setup fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + assert_rc_ok $? multihoming_topo_clean "No response received!" # do some port sweeping to see that load balancing works ip netns exec vppns1 nc -n -z "${2}" 1-1000 > /dev/null 2>&1 @@ -45,17 +44,13 @@ function test_multihoming if [ $rc -ne 0 ] ; then echo "Load balancing doesn't work!" - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause multihoming_topo_clean exit $test_result fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # change IP addresses of destination RLOC echo "set int ip address del host-intervpp12 6.0.3.2/24" | nc 0 5003 @@ -69,17 +64,9 @@ function test_multihoming # test done - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause multihoming_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh b/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh index 64d3486..0238046 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/multihoming_l2.sh @@ -6,13 +6,6 @@ ODL_CONFIG_FILE1="vpp1.json" ODL_CONFIG_FILE2="vpp2.json" ODL_CONFIG_FILE3="update_vpp2.json" -function maybe_pause -{ - if [ "$1" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi -} - if [ "$1" == "clean" ] ; then multihoming_topo_clean exit 0 @@ -83,12 +76,6 @@ function test_multihoming maybe_pause $3 multihoming_topo_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh b/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh index 3f07a7e..ea3a212 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/resolver_failover.sh @@ -30,27 +30,17 @@ function test_resolver_failover test_result=1 - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vppns1 "${1}" -w 20 -c 1 "${2}" rc=$? # test done - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause basic_two_odls_clean kill $mr_id - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } 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 40979e6..8ec9320 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,23 +20,16 @@ fi function test_rtr_single_iface { rtr_single_iface_setup - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 ip netns exec vpp-ns1 "${1}" -w 20 -c 1 "${2}" rc=$? + maybe_pause rtr_single_iface_clean - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } 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 507a817..a7d4a03 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 @@ -20,9 +20,7 @@ fi function test_rtr_two_iface { rtr_two_iface_setup - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 rc=0 @@ -37,21 +35,9 @@ function test_rtr_two_iface { echo "Unrecognized IP format '$1'" fi - #ip netns exec vpp1-ns ping -w 15 -c 1 "${1}" - #rc=$? - - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause rtr_two_iface_clean - - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } 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 5a3dc83..2dd2a12 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,35 +24,17 @@ 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 + maybe_pause ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}" - rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 1 did not receive any response!" - test_result=1 - fi + assert_rc_ok $? rtr_two_iface_two_customers_clean "No response received!" ip netns exec vpp1-cus2-ns "${1}" -w 20 -c 1 "${2}" rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 2 did not receive any response!" - test_result=1 - fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause rtr_two_iface_two_customers_clean - - if [ $rc -ne 0 ] ; then - echo "Test failed: No ICMP response received within specified timeout limit!" - else - echo "Test passed." - fi - + print_status $rc "No ICMP response!" exit $test_result } diff --git a/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh b/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh index f03c199..cec65a1 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh @@ -35,54 +35,29 @@ function test_smr_rtr_disjoint { # CONFIGURE smr_rtr_disjoint_setup - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause test_result=1 rc=0 # TEST IP6 over IP4 test_ns_ping $1 vpp1-ns + assert_rc_ok $? smr_rtr_disjoint_clean "No icmp received!" - rc=$? - - if [ $rc -ne 0 ] ; then - echo "IPv6 over IPv4 test failed: No ICMP response received within specified timeout limit!" - else - echo "IPv6 over IPv4 test passed." - test_result=0 - fi - - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause # RECONFIGURE smr_rtr_disjoint_reconfigure - if [ "$2" == "wait" ] ; then - read -p "Forwarding reconfigured press any key to continue .." -n1 - fi + maybe_pause # TEST IP6 over disjoint IP4 and IP6 underlay test_ns_ping $1 vpp1-ns - rc=$? - if [ $rc -ne 0 ] ; then - echo "SMR + disjoint locators test failed: No ICMP response received within specified timeout limit!" - else - echo "SMR + disjoint locators test passed." - test_result=0 - fi - - if [ "$2" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi - + maybe_pause # CLEANUP smr_rtr_disjoint_clean - + print_status $rc "No ICMP response!" exit $test_result } 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 9a5755f..84c8d96 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,36 +23,19 @@ function test_eid_virtualization { # init to test failed test_result=1 - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}" - rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 1 did not receive any response!" - fi + assert_rc_ok $? two_customers_topo_clean "No response!" - #read -p "press any key to continue .." -n1 + maybe_pause ip netns exec vpp1-cus2-ns "${1}" -w 20 -c 1 "${2}" rc=$? - if [ $rc -ne 0 ] ; then - echo "Error: customer 2 did not receive any response!" - fi - if [ "$3" == "wait" ] ; then - read -p "press any key to continue .." -n1 - fi + maybe_pause two_customers_topo_clean - - if [ $rc -ne 0 ] ; then - echo "Test failed!"; - else - echo "Test passed." - test_result=0 - fi - + print_status $rc "No ICMP response!" exit $test_result } |