basic.sh revision f73cae4c
1source config.sh
2source odl_utils.sh
3source topologies/basic_topo.sh
4
5ODL_CONFIG_FILE1="vpp1.json"
6ODL_CONFIG_FILE2="vpp2.json"
7ODL_CONFIG_FILE3="update_vpp2.json"
8
9if [ "$1" == "clean" ] ; then
10  basic_topo_clean
11  exit 0
12fi
13
14if [[ $(id -u) != 0 ]]; then
15  echo "Error: run this as a root."
16  exit 1
17fi
18
19function test_basic
20{
21  if [ "$3" != "no_setup" ] ; then
22    basic_topo_setup
23  fi
24
25  if [ "$3" == "wait" ] ; then
26    read -p  "press any key to continue .." -n1
27  fi
28
29  test_result=1
30
31  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
32  rc=$?
33  if [ $rc -ne 0 ] ; then
34    echo "No response received!"
35    basic_topo_clean
36    exit $test_result
37  fi
38
39  if [ "$3" == "wait" ] ; then
40    read -p  "press any key to continue .." -n1
41  fi
42
43  # change IP addresses of destination RLOC
44  echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003
45  echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003
46  echo "set int ip address del host-intervpp2 6:0:3::2/64" | nc 0 5003
47  echo "set int ip address host-intervpp2 6:0:3::20/64" | nc 0 5003
48  post_curl "update-mapping" ${ODL_CONFIG_FILE3}
49
50  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
51  rc=$?
52
53  # test done
54
55  if [ "$3" == "wait" ] ; then
56    read -p  "press any key to continue .." -n1
57  fi
58
59  basic_topo_clean
60  if [ $rc -ne 0 ] ; then
61    echo "Test failed: No ICMP response received within specified timeout limit!"
62  else
63    echo "Test passed."
64    test_result=0
65  fi
66
67  exit $test_result
68}
69