1source config.sh
2source odl_utils.sh
3source topologies/2_node_topo.sh
4
5if [ "$1" == "clean" ] ; then
6  2_node_topo_clean
7  exit 0
8fi
9
10if [[ $(id -u) != 0 ]]; then
11  echo "Error: run this as a root."
12  exit 1
13fi
14
15function test_basic_no_odl
16{
17  2_node_topo_setup no_odl
18
19  maybe_pause
20
21  test_result=1
22
23  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
24  if [ $? -ne 0 ] ; then
25    echo "No response received!"
26    2_node_topo_clean no_odl
27    exit $test_result
28  fi
29
30  # change IP addresses of destination RLOC
31  echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003
32  echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003
33  echo "set int ip address del host-intervpp2 6:0:3::2/64" | nc 0 5003
34  echo "set int ip address host-intervpp2 6:0:3::20/64" | nc 0 5003
35
36  if [ "${3}" == "switch_rlocs" ] ; then
37    echo "lisp remote-mapping del vni 0 eid 6.0.2.0/24" | nc 0 5002
38    echo "lisp remote-mapping add vni 0 eid 6.0.2.0/24 rloc 6:0:3::20" | nc 0 5002
39    echo "lisp remote-mapping del vni 0 eid 6:0:2::0/64" | nc 0 5002
40    echo "lisp remote-mapping add vni 0 eid 6:0:2::0/64 rloc 6.0.3.20" | nc 0 5002
41  else
42    echo "lisp remote-mapping del vni 0 eid 6.0.2.0/24 rloc 6.0.3.2" | nc 0 5002
43    echo "lisp remote-mapping add vni 0 eid 6.0.2.0/24 rloc 6.0.3.20" | nc 0 5002
44    echo "lisp remote-mapping del vni 0 eid 6:0:2::0/64 rloc 6:0:3::2" | nc 0 5002
45    echo "lisp remote-mapping add vni 0 eid 6:0:2::0/64 rloc 6:0:3::20" | nc 0 5002
46  fi
47
48  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
49  rc=$?
50
51  maybe_pause
52
53  # test done
54
55  2_node_topo_clean no_odl
56  if [ $rc -ne 0 ] ; then
57    echo "Test failed: No ICMP response received within specified timeout limit!"
58  else
59    echo "Test passed."
60    test_result=0
61  fi
62
63  exit $test_result
64}
65
66function test_negative_mapping
67{
68  2_node_topo_setup no_odl
69  maybe_pause
70
71  test_result=1
72
73  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
74  rc=$?
75
76  # test done
77  2_node_topo_clean no_odl
78  if [ $rc -eq 0 ] ; then
79    echo "Test failed!"
80  else
81    echo "Test passed."
82    test_result=0
83  fi
84
85  exit $test_result
86}
87