3f07a7e970e774de1e8bcd3b9745b9d00b9279e3
[one.git] / tests / data_plane / vpp_lite_topo / test_driver / resolver_failover.sh
1 source config.sh
2 source odl_utils.sh
3 source topologies/basic_two_odls.sh
4
5 ODL_CONFIG_FILE1="vpp1.json"
6 ODL_CONFIG_FILE2="vpp2.json"
7
8 if [ "$1" == "clean" ] ; then
9   basic_two_odls_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 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
25 function 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 }