Add map register and rloc probe tests 66/3966/1
authorFilip Tehlar <ftehlar@cisco.com>
Tue, 22 Nov 2016 13:05:49 +0000 (14:05 +0100)
committerFilip Tehlar <ftehlar@cisco.com>
Fri, 25 Nov 2016 13:50:40 +0000 (14:50 +0100)
Change-Id: I7b2908ee9e6058bc5bad9ea82ca69e51e3bb2534
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
tests/data_plane/configs/odl/basic/4o4_map_register/vpp1.json [new file with mode: 0644]
tests/data_plane/configs/odl/basic/4o4_map_register/vpp2.json [new file with mode: 0644]
tests/data_plane/configs/vpp_lite_config/basic/4o4_map_register/vpp1.config [new file with mode: 0644]
tests/data_plane/configs/vpp_lite_config/basic/4o4_map_register/vpp2.config [new file with mode: 0644]
tests/data_plane/configs/vpp_lite_config/basic/4o4_rloc_probe/vpp1.config [new file with mode: 0644]
tests/data_plane/configs/vpp_lite_config/basic/4o4_rloc_probe/vpp2.config [new file with mode: 0644]
tests/data_plane/vpp_lite_topo/odl_utils.sh
tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py
tests/data_plane/vpp_lite_topo/test_driver/basic.sh
tests/data_plane/vpp_lite_topo/tests/manual_test_rloc_probe_4o4.sh [new file with mode: 0755]
tests/data_plane/vpp_lite_topo/tests/test_map_register_4o4.sh [new file with mode: 0755]

diff --git a/tests/data_plane/configs/odl/basic/4o4_map_register/vpp1.json b/tests/data_plane/configs/odl/basic/4o4_map_register/vpp1.json
new file mode 100644 (file)
index 0000000..c62dd6b
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "input": {
+        "eid": {
+            "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+            "ipv4-prefix": "6.0.1.0/24"
+        },
+        "mapping-authkey": {
+            "key-string": "password",
+            "key-type": 1
+        }
+    }
+}
diff --git a/tests/data_plane/configs/odl/basic/4o4_map_register/vpp2.json b/tests/data_plane/configs/odl/basic/4o4_map_register/vpp2.json
new file mode 100644 (file)
index 0000000..4e03188
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "input": {
+        "eid": {
+            "address-type": "ietf-lisp-address-types:ipv4-prefix-afi",
+            "ipv4-prefix": "6.0.2.0/24"
+        },
+        "mapping-authkey": {
+            "key-string": "password2",
+            "key-type": 2
+        }
+    }
+}
diff --git a/tests/data_plane/configs/vpp_lite_config/basic/4o4_map_register/vpp1.config b/tests/data_plane/configs/vpp_lite_config/basic/4o4_map_register/vpp1.config
new file mode 100644 (file)
index 0000000..ad9f845
--- /dev/null
@@ -0,0 +1,9 @@
+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_resolver 6.0.3.100
+lisp_map_server 6.0.3.100
+lisp_map_register_state enable
diff --git a/tests/data_plane/configs/vpp_lite_config/basic/4o4_map_register/vpp2.config b/tests/data_plane/configs/vpp_lite_config/basic/4o4_map_register/vpp2.config
new file mode 100644 (file)
index 0000000..512bf62
--- /dev/null
@@ -0,0 +1,9 @@
+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
+lisp_map_register_state enable
diff --git a/tests/data_plane/configs/vpp_lite_config/basic/4o4_rloc_probe/vpp1.config b/tests/data_plane/configs/vpp_lite_config/basic/4o4_rloc_probe/vpp1.config
new file mode 100644 (file)
index 0000000..24239d0
--- /dev/null
@@ -0,0 +1,8 @@
+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
+lisp_map_resolver 6.0.3.100
+lisp_rloc_probe_state enable
diff --git a/tests/data_plane/configs/vpp_lite_config/basic/4o4_rloc_probe/vpp2.config b/tests/data_plane/configs/vpp_lite_config/basic/4o4_rloc_probe/vpp2.config
new file mode 100644 (file)
index 0000000..c2edf63
--- /dev/null
@@ -0,0 +1,7 @@
+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
+lisp_map_resolver 6.0.3.100
index 44064c0..f6f9957 100644 (file)
@@ -13,6 +13,7 @@ function odl_clear_all {
   echo "Deleting all ODL mappings.."
   curl -X DELETE "http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database" \
        -u ${ODL_USER}:${ODL_PASSWD}
+  # TODO how to delete operational mappings?
 }
 
 function check_odl_running {
index 62cde11..d6bde91 100644 (file)
@@ -52,12 +52,15 @@ class RepeatableLocators(SimpleMapping):
 
 SimpleMapping('lisp_state', 'lisp', 'lisp_enable_disable')
 SimpleMapping('lisp_map_resolver', 'lisp map-resolver', 'lisp_add_del_map_resolver')
+SimpleMapping('lisp_map_server', 'lisp map-server', 'lisp_add_del_map_server')
 SimpleMapping('lisp_local_eid', 'lisp eid-table', 'lisp_add_del_local_eid')
 SimpleMapping('lisp_remote_mapping', 'lisp remote-mapping', 'lisp_add_del_remote_mapping')
 SimpleMapping('lisp_pitr', 'lisp pitr ls', 'lisp_pitr_set_locator_set locator-set')
 SimpleMapping('lisp_adjacency', 'lisp adjacency', 'lisp_add_del_adjacency')
 SimpleMapping('lisp_map_request_mode', 'lisp map-request mode', 'lisp_map_request_mode')
 SimpleMapping('set_if_ip', 'set int ip address', 'sw_interface_add_del_address')
+SimpleMapping('lisp_rloc_probe_state', 'lisp rloc-probe', 'lisp_rloc_probe_enable_disable')
+SimpleMapping('lisp_map_register_state', 'lisp map-register', 'lisp_map_register_enable_disable')
 
 CustomMapping('lisp_eid_map_bd',
               'lisp eid-table map vni {0} bd {1}',
index 88753bf..309ff64 100644 (file)
@@ -46,3 +46,49 @@ function test_basic
   print_status $rc "No ICMP response!"
   exit $test_result
 }
+
+function test_basic_map_register
+{
+  2_node_topo_setup no_odl
+  post_curl "add-key" ${ODL_CONFIG_FILE1}
+  post_curl "add-key" ${ODL_CONFIG_FILE2}
+
+  maybe_pause
+
+  test_result=1
+
+  wait_for_map_register=10
+  echo "Waiting for map registration $wait_for_map_register seconds .."
+  sleep $wait_for_map_register
+
+  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
+  rc=$?
+
+  maybe_pause
+
+  # test done
+  2_node_topo_clean
+  print_status $rc "No ICMP response!"
+  exit $test_result
+}
+
+function test_rloc_probe
+{
+  2_node_topo_setup
+
+  maybe_pause
+  test_result=1
+
+  ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}"
+  rc=$?
+  assert_rc_ok $rc 2_node_topo_clean "No ICMP response!"
+
+  read -p  "Please check RLOC probe messages manually .." -n1
+
+  # test done
+
+  maybe_pause
+  2_node_topo_clean
+  print_status $rc "No ICMP response!"
+  exit $test_result
+}
diff --git a/tests/data_plane/vpp_lite_topo/tests/manual_test_rloc_probe_4o4.sh b/tests/data_plane/vpp_lite_topo/tests/manual_test_rloc_probe_4o4.sh
new file mode 100755 (executable)
index 0000000..e7f2f2c
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+
+# Manual test for LISP RLOC probe
+#
+# Test procedure:
+# 1) run the test
+# 2) the test stops its execution after few seconds.
+#    At that moment there should be a LISP tunnel configured
+# 3) Attach wireshark to intervpp1 or intervpp2 interface and check if there
+#    are map-requests and map-replies coming forth and back with RLOC probe
+#    bit set in the LISP header.
+
+VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/4o4_rloc_probe
+ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4
+
+source test_driver/basic.sh
+
+test_rloc_probe ping "6.0.2.2"
diff --git a/tests/data_plane/vpp_lite_topo/tests/test_map_register_4o4.sh b/tests/data_plane/vpp_lite_topo/tests/test_map_register_4o4.sh
new file mode 100755 (executable)
index 0000000..4bc471b
--- /dev/null
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+# Test LISP map register feature (ip4 over ip4)
+
+VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/4o4_map_register
+ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4_map_register
+
+source test_driver/basic.sh
+
+test_basic_map_register ping "6.0.2.2"