3 source topologies/2_node_topo.sh
5 ODL_CONFIG_FILE1="map1.json"
6 ODL_CONFIG_FILE2="map2.json"
8 if [ "$1" == "clean" ] ; then
13 if [[ $(id -u) != 0 ]]; then
14 echo "Error: run this as a root."
18 function send_ping_from_ns
20 ip netns exec "${1}" "${2}" -w 20 -c 1 "${3}"
21 assert_rc_ok $? 2_node_topo_clean "No ICMP Response!"
24 function send_ping_from_ns_expect_failure
26 ip netns exec "${1}" "${2}" -w 10 -c 1 "${3}"
27 assert_rc_not_ok $? 2_node_topo_clean "Reply received, but failure expected!"
30 function remove_sd_mapping {
31 curl -X POST -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type: application/json" -H "Cache-Control: no-cache" -H "Postman-Token: 1e4f00f4-74eb-20d7-97da-89963f37713b" -d '{
34 "address-type": "ietf-lisp-address-types:source-dest-key-lcaf",
41 }' "http://${ODL_IP}:8181/restconf/operations/odl-mappingservice:remove-mapping"
44 function remove_mapping1 {
45 curl -X DELETE -H "Content-Type: application/json" -H "Cache-Control: no-cache" "http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database/virtual-network-identifier/0/mapping/${1}/northbound/"
48 function test_src_dst_overwrite
57 send_ping_from_ns vppns1 ${1} ${2}
61 # Replace ODL mapping with negative one
62 post_curl "add-mapping" "replace1.json"
64 # wait for SMR being resolved
69 # now ping should fail
70 send_ping_from_ns_expect_failure vppns1 ${1} ${2}
74 # Replace ODL mapping with positive one
75 post_curl "add-mapping" "replace2.json"
77 # wait for SMR being resolved
82 # expect ping reply again
83 send_ping_from_ns vppns1 ${1} ${2}
88 print_status $rc "No ICMP response!"
92 function test_src_dst_overwrite_superset
101 send_ping_from_ns vppns1 ${1} ${2}
105 # Replace ODL mapping with negative one
106 post_curl "add-mapping" "replace1.json"
107 remove_sd_mapping "6.0.1.0/24" "6.0.2.0/24"
109 # wait for SMR being resolved
114 # now ping should fail
115 send_ping_from_ns_expect_failure vppns1 ${1} ${2}
119 # Replace ODL mapping with positive one
120 post_curl "add-mapping" "replace2.json"
121 remove_sd_mapping "6.0.0.0/16" "6.0.2.0/24"
123 # wait for SMR being resolved
128 # expect ping reply again
129 send_ping_from_ns vppns1 ${1} ${2}
134 print_status $rc "No ICMP response!"