resolver_failover.sh revision f9c4cfa7
1source config.sh
2source odl_utils.sh
3source topologies/basic_two_odls.sh
4
5ODL_CONFIG_FILE1="vpp1.json"
6ODL_CONFIG_FILE2="vpp2.json"
7
8if [ "$1" == "clean" ] ; then
9  basic_two_odls_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 start_map_resolver
19{
20  echo "starting dummy map resolver on interface $1"
21  python scripts/dummy_mr.py "$1" 4342 &
22  mr_id=$!
23}
24
25function test_resolver_failover
26{
27  basic_two_odls_setup
28
29  start_map_resolver "6.0.3.100"
30
31  test_result=1
32
33  if [ "$3" == "wait" ] ; then
34    read -p  "press any key to continue .." -n1
35  fi
36
37  ip netns exec vppns1 "${1}" -w 20 -c 1 "${2}"
38  rc=$?
39
40  # test done
41  if [ "$3" == "wait" ] ; then
42    read -p  "press any key to continue .." -n1
43  fi
44
45  basic_two_odls_clean
46  kill $mr_id
47
48  if [ $rc -ne 0 ] ; then
49    echo "Test failed: No ICMP response received within specified timeout limit!"
50  else
51    echo "Test passed."
52    test_result=0
53  fi
54
55  exit $test_result
56}
57