rtr_two_iface.sh revision 51b44223
1source config.sh
2source odl_utils.sh
3source topologies/rtr_two_iface.sh
4
5
6# set odl config json file names; they are common among all rtr tests
7ODL_CONFIG_FILE1="elp1.json"
8ODL_CONFIG_FILE2="elp2.json"
9
10if [ "$1" == "clean" ] ; then
11  rtr_two_iface_clean
12  exit 0
13fi
14
15if [[ $(id -u) != 0 ]]; then
16  echo "Error: run this as a root."
17  exit 1
18fi
19
20function 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}
58