2d3deaf3c0bd397761304af01396aaa140313de5
[one.git] / tests / data_plane / vpp_lite_topo / test_driver / basic_multi_traffic.sh
1 source config.sh
2 source odl_utils.sh
3 source topologies/basic_topo.sh
4
5 ODL_CONFIG_FILE1="vpp1.json"
6 ODL_CONFIG_FILE2="vpp2.json"
7 ODL_CONFIG_FILE3="update_vpp2.json"
8
9 if [ "$1" == "clean" ] ; then
10   basic_topo_clean
11   exit 0
12 fi
13
14 if [[ $(id -u) != 0 ]]; then
15   echo "Error: run this as a root."
16   exit 1
17 fi
18
19 function 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   ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
31   if [ $? -ne 0 ] ; then
32     echo "No response received!"
33     basic_topo_clean
34     exit $test_result
35   fi
36
37   ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}"
38   if [ $? -ne 0 ] ; then
39     echo "No response received!"
40     basic_topo_clean
41     exit $test_result
42   fi
43
44   # change IP addresses of destination RLOC
45   echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003
46   echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003
47   echo "set int ip address del host-intervpp2 6:0:3::2/24" | nc 0 5003
48   echo "set int ip address host-intervpp2 6:0:3::20/24" | nc 0 5003
49
50   ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/6o6
51   post_curl "update-mapping" ${ODL_CONFIG_FILE3}
52   ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4
53   post_curl "update-mapping" ${ODL_CONFIG_FILE3}
54
55   ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
56   if [ $? -ne 0 ] ; then
57     echo "No response received!"
58     basic_topo_clean
59     exit $test_result
60   fi
61
62   ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}"
63   rc=$?
64
65   # test done
66
67   basic_topo_clean
68   if [ $rc -ne 0 ] ; then
69     echo "Test failed: No ICMP response received within specified timeout limit!"
70   else
71     echo "Test passed."
72     test_result=0
73   fi
74
75   exit $test_result
76 }
77