basic_l2.sh revision 8719d315
1source config.sh
2source odl_utils.sh
3source topologies/basic_topo_l2.sh
4
5ODL_CONFIG_FILE1="vpp1.json"
6ODL_CONFIG_FILE2="vpp2.json"
7
8if [ "$1" == "clean" ] ; then
9  basic_topo_clean
10  exit 0
11fi
12
13if [[ $(id -u) != 0 ]]; then
14  echo "Error: run this as a root."
15  exit 1
16fi
17
18function 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}
55