VPP lite test improvements
[one.git] / tests / data_plane / vpp_lite_topo / test_driver / rtr_two_iface.sh
1 source config.sh
2 source odl_utils.sh
3 source topologies/rtr_two_iface.sh
4
5
6 # set odl config json file names; they are common among all rtr tests
7 ODL_CONFIG_FILE1="elp1.json"
8 ODL_CONFIG_FILE2="elp2.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 {
21   rtr_two_iface_setup
22
23   if [ "$2" == "wait" ] ; then
24     read -p  "press any key to continue .." -n1
25   fi
26
27   test_result=1
28   rc=0
29
30   if [ "$1" != "${1#*[0-9].[0-9]}" ]; then
31     ip netns exec vpp1-ns ping -w 20 -c 1 "${1}"
32     rc=$?
33   elif [ "$1" != "${1#*:[0-9a-fA-F]}" ]; then
34     ip netns exec vpp1-ns ping6 -w 20 -c 1 "${1}"
35     rc=$?
36   else
37     echo "Unrecognized IP format '$1'"
38   fi
39
40   #ip netns exec vpp1-ns ping -w 15 -c 1 "${1}"
41   #rc=$?
42
43   if [ "$2" == "wait" ] ; then
44     read -p  "press any key to continue .." -n1
45   fi
46
47   rtr_two_iface_clean
48
49   if [ $rc -ne 0 ] ; then
50     echo "Test failed: No ICMP response received within specified timeout limit!"
51   else
52     echo "Test passed."
53     test_result=0
54   fi
55
56   exit $test_result
57 }