VPP lite test improvements
[one.git] / tests / data_plane / vpp_lite_topo / test_driver / rtr_two_iface_two_customers.sh
1 source config.sh
2 source odl_utils.sh
3 source topologies/rtr_two_iface_two_customers.sh
4
5 ODL_CONFIG_FILE1="vpp1_customer1.json"
6 ODL_CONFIG_FILE2="vpp2_customer1.json"
7 ODL_CONFIG_FILE3="vpp1_customer2.json"
8 ODL_CONFIG_FILE4="vpp2_customer2.json"
9
10 if [ "$1" == "clean" ] ; then
11   rtr_two_iface_clean
12   exit 0
13 fi
14
15 if [[ $(id -u) != 0 ]]; then
16   echo "Error: run this as a root."
17   exit 1
18 fi
19
20 function test_rtr_two_iface_two_customers {
21   rtr_two_iface_two_customers_setup
22   sleep 1
23
24   test_result=0
25   rc=0
26
27   if [ "$3" == "wait" ] ; then
28     read -p  "press any key to continue .." -n1
29   fi
30
31   ip netns exec vpp1-cus1-ns "${1}" -w 20 -c 1 "${2}"
32   rc=$?
33   if [ $rc -ne 0 ] ; then
34     echo "Error: customer 1 did not receive any response!"
35     test_result=1
36   fi
37
38   ip netns exec vpp1-cus2-ns "${1}" -w 20 -c 1 "${2}"
39   rc=$?
40   if [ $rc -ne 0 ] ; then
41     echo "Error: customer 2 did not receive any response!"
42     test_result=1
43   fi
44
45   if [ "$3" == "wait" ] ; then
46     read -p  "press any key to continue .." -n1
47   fi
48
49   rtr_two_iface_two_customers_clean
50
51   if [ $rc -ne 0 ] ; then
52     echo "Test failed: No ICMP response received within specified timeout limit!"
53   else
54     echo "Test passed."
55   fi
56
57   exit $test_result
58 }