Basic l2 over ip4 tests
[one.git] / tests / data_plane / vpp_lite_topo / test_driver / basic_l2.sh
1 source config.sh
2 source odl_utils.sh
3 source topologies/basic_topo_l2.sh
4
5 ODL_CONFIG_FILE1="vpp1.json"
6 ODL_CONFIG_FILE2="vpp2.json"
7
8 if [ "$1" == "clean" ] ; then
9   basic_topo_clean
10   exit 0
11 fi
12
13 if [[ $(id -u) != 0 ]]; then
14   echo "Error: run this as a root."
15   exit 1
16 fi
17
18 function test_basic
19 {
20   if [ "$3" != "no_setup" ] ; then
21     basic_topo_setup
22   fi
23
24   if [ "$3" == "wait" ] ; then
25     read -p  "press any key to continue .." -n1
26   fi
27
28   test_result=1
29
30   ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
31   rc=$?
32
33   if [ "$3" == "wait" ] ; then
34     read -p  "press any key to continue .." -n1
35   fi
36
37   if [ $rc -ne 0 ] ; then
38     echo "No response received!"
39     basic_topo_clean
40     exit $test_result
41   fi
42
43   # test done
44
45   basic_topo_clean
46   if [ $rc -ne 0 ] ; then
47     echo "Test failed: No ICMP response received within specified timeout limit!"
48   else
49     echo "Test passed."
50     test_result=0
51   fi
52
53   exit $test_result
54 }