basic_multi_traffic.sh revision 4543d282
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_multi_traffic
20{
21  basic_topo_setup
22
23  # additional setup
24  ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4
25  post_curl "add-mapping" ${ODL_CONFIG_FILE1}
26  post_curl "add-mapping" ${ODL_CONFIG_FILE2}
27
28  test_result=1
29
30  if [ "$5" == "wait" ] ; then
31    read -p  "press any key to continue .." -n1
32  fi
33
34  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
35  if [ $? -ne 0 ] ; then
36    echo "No response received!"
37    basic_topo_clean
38    exit $test_result
39  fi
40
41  ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}"
42  if [ $? -ne 0 ] ; then
43    echo "No response received!"
44    basic_topo_clean
45    exit $test_result
46  fi
47
48  # change IP addresses of destination RLOC
49  echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003
50  echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003
51  echo "set int ip address del host-intervpp2 6:0:3::2/64" | nc 0 5003
52  echo "set int ip address host-intervpp2 6:0:3::20/64" | nc 0 5003
53
54  ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/6o6
55  post_curl "update-mapping" ${ODL_CONFIG_FILE3}
56  ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4
57  post_curl "update-mapping" ${ODL_CONFIG_FILE3}
58
59  if [ "$5" == "wait" ] ; then
60    read -p  "press any key to continue .." -n1
61  fi
62
63  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
64  if [ $? -ne 0 ] ; then
65    echo "No response received!"
66    basic_topo_clean
67    exit $test_result
68  fi
69
70  ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}"
71  rc=$?
72
73  if [ "$5" == "wait" ] ; then
74    read -p  "press any key to continue .." -n1
75  fi
76
77  # test done
78
79  basic_topo_clean
80  if [ $rc -ne 0 ] ; then
81    echo "Test failed: No ICMP response received within specified timeout limit!"
82  else
83    echo "Test passed."
84    test_result=0
85  fi
86
87  exit $test_result
88}
89
90