src_dst.sh revision 5089c812
1source config.sh
2source odl_utils.sh
3source topologies/3_node_star.sh
4
5ODL_CONFIG_FILE1="map1.json"
6ODL_CONFIG_FILE2="map2.json"
7
8if [ "$1" == "clean" ] ; then
9  3_node_star_topo_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 send_ping_from_ns
19{
20  ip netns exec "${1}" "${2}" -w 20 -c 1 "${3}"
21  assert_rc_ok $? 3_node_star_topo_clean "No ICMP Response!"
22}
23
24function test_src_dst
25{
26  3_node_star_topo_setup
27  post_curl "add-mapping" "map3.json"
28  post_curl "add-mapping" "map4.json"
29
30  maybe_pause
31
32  test_result=1
33
34  # send ping for first EID
35  send_ping_from_ns vpp-ns1 ${1} ${2}
36
37  # TODO assert counters
38
39  maybe_pause
40
41  # send ping for second EID
42  send_ping_from_ns vpp-ns3 ${1} ${2}
43
44  maybe_pause
45
46  # verify first tunnel still works
47  send_ping_from_ns vpp-ns1 ${1} ${2}
48
49  maybe_pause
50
51  # verify second tunnel still works
52  send_ping_from_ns vpp-ns3 ${1} ${2}
53  rc=$?
54
55  maybe_pause
56  3_node_star_topo_clean
57  print_status $rc "No ICM response!"
58  exit $test_result
59}
60
61function test_src_dst_l2
62{
63  3_node_star_topo_setup
64  post_curl "add-mapping" "map3.json"
65  post_curl "add-mapping" "map4.json"
66
67  maybe_pause
68
69  test_result=1
70
71  # send ping for first EID
72  send_ping_from_ns vpp-ns5 ${1} ${2}
73
74  # TODO assert counters
75
76  maybe_pause
77
78  # send ping for second EID
79  send_ping_from_ns vpp-ns8 ${1} ${2}
80
81  maybe_pause
82
83  # verify first tunnel still works
84  send_ping_from_ns vpp-ns5 ${1} ${2}
85
86  maybe_pause
87
88  # verify second tunnel still works
89  send_ping_from_ns vpp-ns8 ${1} ${2}
90  rc=$?
91
92  maybe_pause
93  3_node_star_topo_clean
94  print_status $rc "No ICM response!"
95  exit $test_result
96}
97