From f20e6999369a2cd951247d4ef1b7a417b6a35566 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Thu, 25 May 2017 12:37:32 +0200 Subject: Add L2 ARP test Change-Id: Ib8cc113a5de812697ea4d927bce5c9ac77fffac1 Signed-off-by: Filip Tehlar --- .../configs/vpp_lite_config/arp/vpp1.config | 16 +++++++++++ .../configs/vpp_lite_config/arp/vpp2.config | 1 + .../configs/vpp_lite_config/arp/vpp3.config | 11 ++++++++ tests/data_plane/vpp_lite_topo/config.sh | 3 +- .../vpp_lite_topo/scripts/cmd_mappings.py | 1 + tests/data_plane/vpp_lite_topo/test_driver/arp.sh | 32 ++++++++++++++++++++++ .../vpp_lite_topo/tests/test_arp_resolution.sh | 7 +++++ .../vpp_lite_topo/topologies/3_node_star.sh | 14 +++++++--- 8 files changed, 80 insertions(+), 5 deletions(-) create mode 100644 tests/data_plane/configs/vpp_lite_config/arp/vpp1.config create mode 100644 tests/data_plane/configs/vpp_lite_config/arp/vpp2.config create mode 100644 tests/data_plane/configs/vpp_lite_config/arp/vpp3.config create mode 100644 tests/data_plane/vpp_lite_topo/test_driver/arp.sh create mode 100755 tests/data_plane/vpp_lite_topo/tests/test_arp_resolution.sh diff --git a/tests/data_plane/configs/vpp_lite_config/arp/vpp1.config b/tests/data_plane/configs/vpp_lite_config/arp/vpp1.config new file mode 100644 index 0000000..39fbf6a --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/arp/vpp1.config @@ -0,0 +1,16 @@ +create_host_iface vpp5 6.0.10.11/24 +set_if_l2_bridge host-vpp5 20 + +create_host_iface vpp8 6.0.10.15/24 +set_if_l2_bridge host-vpp8 10 + +create_host_iface xtr1 6.0.3.1/24 + +lisp_state enable +lisp_map_request_mode src-dst +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_l2_arp bd 20 ip 6.0.10.22 mac 08:22:22:22:22:22 diff --git a/tests/data_plane/configs/vpp_lite_config/arp/vpp2.config b/tests/data_plane/configs/vpp_lite_config/arp/vpp2.config new file mode 100644 index 0000000..ec80ccb --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/arp/vpp2.config @@ -0,0 +1 @@ +# unused config diff --git a/tests/data_plane/configs/vpp_lite_config/arp/vpp3.config b/tests/data_plane/configs/vpp_lite_config/arp/vpp3.config new file mode 100644 index 0000000..86e88bd --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/arp/vpp3.config @@ -0,0 +1,11 @@ +create_host_iface vpp6 6.0.10.12/24 +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_l2_arp bd 20 ip 6.0.10.21 mac 08:11:11:11:11:11 diff --git a/tests/data_plane/vpp_lite_topo/config.sh b/tests/data_plane/vpp_lite_topo/config.sh index 89fd908..c615707 100644 --- a/tests/data_plane/vpp_lite_topo/config.sh +++ b/tests/data_plane/vpp_lite_topo/config.sh @@ -116,7 +116,8 @@ function start_vpp unix { log /tmp/$2.log \ full-coredump \ cli-listen localhost:$1 } \ - api-trace { on } api-segment { prefix "$2" } + api-trace { on } api-segment { prefix "$2" } \ + plugins { plugin dpdk_plugin.so { disable } } } function print_status 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 7281cc1..4932617 100644 --- a/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py +++ b/tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py @@ -62,6 +62,7 @@ SimpleMapping('set_if_ip', 'set int ip address', 'sw_interface_add_del_address') SimpleMapping('lisp_rloc_probe_state', 'one rloc-probe', 'one_rloc_probe_enable_disable') 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('ipsec_sad_add_del_entry', 'TODO', 'ipsec_sad_add_del_entry') SimpleMapping('ipsec_spd_add_del', 'todo', 'ipsec_spd_add_del') diff --git a/tests/data_plane/vpp_lite_topo/test_driver/arp.sh b/tests/data_plane/vpp_lite_topo/test_driver/arp.sh new file mode 100644 index 0000000..dd6d41f --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/arp.sh @@ -0,0 +1,32 @@ +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_arp_resolution +{ + 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_arp_resolution.sh b/tests/data_plane/vpp_lite_topo/tests/test_arp_resolution.sh new file mode 100755 index 0000000..c8817b1 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/tests/test_arp_resolution.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/arp + +source test_driver/arp.sh + +test_arp_resolution ping "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 82dc734..d21732e 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 @@ -60,7 +60,9 @@ function 3_node_star_topo_clean ip netns del vpp-ns8 &> /dev/null ip netns del xtr-ns &> /dev/null - odl_clear_all + if [ "$1" != "no_odl" ] ; then + odl_clear_all + fi } function set_arp @@ -238,8 +240,12 @@ maybe_pause echo "===" fi - post_curl "add-mapping" ${ODL_CONFIG_FILE1} - post_curl "add-mapping" ${ODL_CONFIG_FILE2} + if [ "$1" != "no_odl" ] ; then + post_curl "add-mapping" ${ODL_CONFIG_FILE1} + post_curl "add-mapping" ${ODL_CONFIG_FILE2} + fi - set_arp + if [ "$2" != "no_arp" ] ; then + set_arp + fi } -- cgit 1.2.3-korg