From 3db341de1dae5caedbe805ed7f3871a57dc8dbcb Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Tue, 19 Sep 2017 15:44:32 +0200 Subject: Add neighbor discovery test Change-Id: I88aa86ba917a43903b04aec44427ad0cc20439b3 Signed-off-by: Filip Tehlar --- .../configs/vpp_lite_config/ndp/vpp1.config | 11 ++++++++ .../configs/vpp_lite_config/ndp/vpp2.config | 1 + .../configs/vpp_lite_config/ndp/vpp3.config | 11 ++++++++ .../vpp_lite_topo/scripts/cmd_mappings.py | 1 + .../vpp_lite_topo/test_driver/basic_no_odl.sh | 2 +- tests/data_plane/vpp_lite_topo/test_driver/ndp.sh | 33 ++++++++++++++++++++++ .../tests/test_neighbor_solicitation_static.sh | 7 +++++ .../vpp_lite_topo/topologies/3_node_star.sh | 6 +++- 8 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 tests/data_plane/configs/vpp_lite_config/ndp/vpp1.config create mode 100644 tests/data_plane/configs/vpp_lite_config/ndp/vpp2.config create mode 100644 tests/data_plane/configs/vpp_lite_config/ndp/vpp3.config create mode 100644 tests/data_plane/vpp_lite_topo/test_driver/ndp.sh create mode 100755 tests/data_plane/vpp_lite_topo/tests/test_neighbor_solicitation_static.sh diff --git a/tests/data_plane/configs/vpp_lite_config/ndp/vpp1.config b/tests/data_plane/configs/vpp_lite_config/ndp/vpp1.config new file mode 100644 index 0000000..9175801 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/ndp/vpp1.config @@ -0,0 +1,11 @@ +create_host_iface vpp5 6:0:10::11/64 +set_if_l2_bridge host-vpp5 20 +create_host_iface xtr1 6.0.3.1/24 + +lisp_state enable +lisp_locator_set_with_locator ls1 host-xtr1 1 1 +lisp_eid_map_bd 20 20 +lisp_local_eid vni 20 eid 08:11:11:11:11:11 locator-set ls1 +lisp_remote_mapping vni 20 eid 08:22:22:22:22:22 rloc 6.0.3.3 +lisp_adjacency vni 20 leid 08:11:11:11:11:11 reid 08:22:22:22:22:22 +lisp_ndp_entry bd 20 ip 6:0:10::22 mac 08:22:22:22:22:22 diff --git a/tests/data_plane/configs/vpp_lite_config/ndp/vpp2.config b/tests/data_plane/configs/vpp_lite_config/ndp/vpp2.config new file mode 100644 index 0000000..ec80ccb --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/ndp/vpp2.config @@ -0,0 +1 @@ +# unused config diff --git a/tests/data_plane/configs/vpp_lite_config/ndp/vpp3.config b/tests/data_plane/configs/vpp_lite_config/ndp/vpp3.config new file mode 100644 index 0000000..7a4d8e8 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/ndp/vpp3.config @@ -0,0 +1,11 @@ +create_host_iface vpp6 6:0:10::12/64 +set_if_l2_bridge host-vpp6 20 +create_host_iface xtr3 6.0.3.3/24 + +lisp_state enable +lisp_locator_set_with_locator ls1 host-xtr3 1 1 +lisp_eid_map_bd 20 20 +lisp_local_eid vni 20 eid 08:22:22:22:22:22 locator-set ls1 +lisp_remote_mapping vni 20 eid 08:11:11:11:11:11 rloc 6.0.3.1 +lisp_adjacency vni 20 reid 08:11:11:11:11:11 leid 08:22:22:22:22:22 +lisp_ndp_entry bd 20 ip 6:0:10::21 mac 08:11:11:11:11:11 diff --git a/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py b/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py index 9bf2c15..864b486 100644 --- a/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py +++ b/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py @@ -63,6 +63,7 @@ SimpleMapping('lisp_rloc_probe_state', 'one rloc-probe', 'one_rloc_probe_enable_ SimpleMapping('lisp_map_register_state', 'one map-register', 'one_map_register_enable_disable') SimpleMapping('lisp_stats', 'one statistics', 'one_stats_enable_disable') SimpleMapping('lisp_l2_arp', 'one l2 arp', 'one_add_del_l2_arp_entry') +SimpleMapping('lisp_ndp_entry', 'one ndp', 'one_add_del_ndp_entry') SimpleMapping('lisp_nsh_set_ls', 'one nsh-mapping', 'one_nsh_set_locator_set') SimpleMapping('ipsec_sad_add_del_entry', 'TODO', 'ipsec_sad_add_del_entry') diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh index 8a1ac51..06f355b 100644 --- a/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh @@ -33,7 +33,7 @@ function test_basic_no_odl echo "set int ip address del host-intervpp2 6:0:3::2/64" | nc 0 5003 echo "set int ip address host-intervpp2 6:0:3::20/64" | nc 0 5003 - if [ ${3} == "switch_rlocs" ] ; then + if [ "${3}" == "switch_rlocs" ] ; then echo "lisp remote-mapping del vni 0 eid 6.0.2.0/24" | nc 0 5002 echo "lisp remote-mapping add vni 0 eid 6.0.2.0/24 rloc 6:0:3::20" | nc 0 5002 echo "lisp remote-mapping del vni 0 eid 6:0:2::0/64" | nc 0 5002 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/ndp.sh b/tests/data_plane/vpp_lite_topo/test_driver/ndp.sh new file mode 100644 index 0000000..5280c67 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/ndp.sh @@ -0,0 +1,33 @@ +source config.sh +source odl_utils.sh +source topologies/3_node_star.sh + +if [ "$1" == "clean" ] ; then + 3_node_star_topo_clean no_odl + exit 0 +fi + +if [[ $(id -u) != 0 ]]; then + echo "Error: run this as root." + exit 1 +fi + +function send_icmp_from_namespace +{ + ip netns exec "$1" "$2" -w 15 -c 1 "$3" +} + + +function test_neighbor_discovery +{ + 3_node_star_topo_setup no_odl no_arp + + maybe_pause + send_icmp_from_namespace vpp-ns5 "$1" "$2" + rc=$? + + maybe_pause + 3_node_star_topo_clean no_odl + print_status $rc "No ICMP response!" + exit $test_result +} diff --git a/tests/data_plane/vpp_lite_topo/tests/test_neighbor_solicitation_static.sh b/tests/data_plane/vpp_lite_topo/tests/test_neighbor_solicitation_static.sh new file mode 100755 index 0000000..fbea78d --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/tests/test_neighbor_solicitation_static.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/ndp + +source test_driver/ndp.sh + +test_neighbor_discovery ping6 "6:0:10::22" diff --git a/tests/data_plane/vpp_lite_topo/topologies/3_node_star.sh b/tests/data_plane/vpp_lite_topo/topologies/3_node_star.sh index d21732e..6b67a00 100644 --- a/tests/data_plane/vpp_lite_topo/topologies/3_node_star.sh +++ b/tests/data_plane/vpp_lite_topo/topologies/3_node_star.sh @@ -17,12 +17,13 @@ # + | | + 6.0.10.22 # 6.0.10.21 | VPP3 | 08:22:22:22:22:22 # 08:11:11:11:11:11 | | -# +-+----+-+ +# 6:0:10::21 +-+----+-+ # vpp6| |vpp4 # | | # | +6.0.2.2 # + 6:0:2::2 # 6.0.10.22 +# 6:0:10::22 # 08:22:22:22:22:22 # @@ -177,6 +178,7 @@ function 3_node_star_topo_setup bash -c " ip link set dev lo up ip addr add 6.0.10.21/24 dev veth_vpp5 + ip addr add 6:0:10::21/64 dev veth_vpp5 " ip link add veth_vpp6 type veth peer name vpp6 @@ -188,6 +190,7 @@ function 3_node_star_topo_setup bash -c " ip link set dev lo up ip addr add 6.0.10.22/24 dev veth_vpp6 + ip addr add 6:0:10::22/64 dev veth_vpp6 " ip link add veth_vpp7 type veth peer name vpp7 @@ -225,6 +228,7 @@ maybe_pause echo "* Selected configuration method: $CFG_METHOD" if [ "$CFG_METHOD" == "cli" ] ; then + sleep 1 echo "exec ${VPP_LITE_CONF}/vpp1.cli" | nc 0 5002 echo "exec ${VPP_LITE_CONF}/vpp2.cli" | nc 0 5003 echo "exec ${VPP_LITE_CONF}/vpp3.cli" | nc 0 5004 -- cgit 1.2.3-korg