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"
63 remove_sd_mapping "6.0.1.0/24" "6.0.2.0/24"
65 # wait for SMR being resolved
70 # now ping should fail
71 send_ping_from_ns_expect_failure vppns1 ${1} ${2}
75 # Replace ODL mapping with positive one
76 post_curl "add-mapping" "replace2.json"
77 remove_sd_mapping "6.0.0.0/16" "6.0.2.0/24"
79 # wait for SMR being resolved
84 # expect ping reply again
85 send_ping_from_ns vppns1 ${1} ${2}
90 print_status $rc "No ICM response!"