--- /dev/null
+create_host_iface vpp1 6.0.1.1/24
+create_host_iface intervpp1 6.0.3.1/24
+
+lisp_state enable
+lisp_locator_set_with_locator ls1 host-intervpp1 1 1
+lisp_local_eid eid 6.0.1.0/24 locator-set ls1 secret-key password key-id sha1
+lisp_map_server 6.0.3.100
+lisp_map_server 6.0.3.200
+lisp_map_register_state enable
--- /dev/null
+create_host_iface vpp2 6.0.2.1/24
+create_host_iface intervpp2 6.0.3.2/24
+
+lisp_state enable
+lisp_locator_set_with_locator ls1 host-intervpp2 1 1
+lisp_local_eid eid 6.0.2.0/24 locator-set ls1 secret-key password2 key-id sha256
+lisp_map_server 6.0.3.100
+lisp_map_resolver 6.0.3.100
--- /dev/null
+# Usage:
+#
+# $ python dummy_map_server <bind-ip> <port>
+#
+
+import sys
+import socket
+import hmac
+import hashlib
+
+map_notify = (b"\x40\x00\x00\x01"
+ + "\x00\x00\x00\x00"
+ + "\x00\x00\x00\x00"
+ + "\x00\x01\x00\x14" # key ID, Auth data length = 20
+ + "\x00\x00\x00\x00"
+ + "\x00\x00\x00\x00"
+ + "\x00\x00\x00\x00"
+ + "\x00\x00\x00\x00"
+ + "\x00\x00\x00\x00" # auth data
+ + "\x00\x01"
+ + "\x51\x80\x01\x18\x00\x00\x00\x00\x00\x01\x06\x00\x01\x00\x01\x01"
+ + "\x00\x00\x00\x04\x00\x01\x06\x00\x03\x01")
+
+notify_nonce_offset = 4
+notify_auth_data_len = 20
+register_nonce_offset = 4
+auth_data_offset = 16
+secret_key = 'password'
+
+
+def build_notify(nonce):
+ rp = bytearray(map_notify)
+
+ for i in range(0, 8):
+ rp[notify_nonce_offset + i] = nonce[i]
+
+ # compute hash
+ digest = hmac.new(secret_key, rp, hashlib.sha1).digest()
+
+ for i in range(0, notify_auth_data_len):
+ rp[auth_data_offset + i] = digest[i]
+
+ return rp
+
+
+def run(host, port):
+ sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ server_address = (host, int(port))
+ sock.bind(server_address)
+
+ while True:
+ data, address = sock.recvfrom(4096)
+
+ # extract nonce from message
+ nonce = data[register_nonce_offset:register_nonce_offset+8]
+
+ rp = build_notify(nonce)
+ sock.sendto(rp, address)
+ print 'Replied to ', ''.join(x.encode('hex') for x in nonce)
+
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ raise Exception('IP and port expected')
+
+ run(sys.argv[1], sys.argv[2])
exit $test_result
}
+function test_basic_map_register_fallback
+{
+ 2_node_topo_setup no_odl
+
+ maybe_pause
+
+ test_result=1
+
+ start_map_server "6.0.3.200"
+
+ wait_for_map_register=20
+ echo "Waiting for map registration $wait_for_map_register seconds .."
+ sleep $wait_for_map_register
+
+ rc=1
+
+ count="`echo "show error" | nc 0 5002 | grep 'map-notifies received' | awk '{print $1}'`"
+ if [ "$count" != "" ] ; then
+ if [ $count -gt 0 ] ; then
+ echo "no map-notifies received! ($count)"
+ rc=0 # test passed
+ fi
+ fi
+
+ maybe_pause
+ kill $ms_id
+
+ # test done
+ 2_node_topo_clean no_odl
+ print_status $rc "map server fallback does not work!"
+ exit $test_result
+}
+
function test_basic_map_register
{
2_node_topo_setup no_odl