Add L2 ARP test 77/6877/2
authorFilip Tehlar <ftehlar@cisco.com>
Thu, 25 May 2017 10:37:32 +0000 (12:37 +0200)
committerFilip Tehlar <ftehlar@cisco.com>
Fri, 26 May 2017 06:58:02 +0000 (08:58 +0200)
Change-Id: Ib8cc113a5de812697ea4d927bce5c9ac77fffac1
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
tests/data_plane/configs/vpp_lite_config/arp/vpp1.config [new file with mode: 0644]
tests/data_plane/configs/vpp_lite_config/arp/vpp2.config [new file with mode: 0644]
tests/data_plane/configs/vpp_lite_config/arp/vpp3.config [new file with mode: 0644]
tests/data_plane/vpp_lite_topo/config.sh
tests/data_plane/vpp_lite_topo/scripts/cmd_mappings.py
tests/data_plane/vpp_lite_topo/test_driver/arp.sh [new file with mode: 0644]
tests/data_plane/vpp_lite_topo/tests/test_arp_resolution.sh [new file with mode: 0755]
tests/data_plane/vpp_lite_topo/topologies/3_node_star.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 (file)
index 0000000..39fbf6a
--- /dev/null
@@ -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 (file)
index 0000000..ec80ccb
--- /dev/null
@@ -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 (file)
index 0000000..86e88bd
--- /dev/null
@@ -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
index 89fd908..c615707 100644 (file)
@@ -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
index 7281cc1..4932617 100644 (file)
@@ -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 (file)
index 0000000..dd6d41f
--- /dev/null
@@ -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 (executable)
index 0000000..c8817b1
--- /dev/null
@@ -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"
index 82dc734..d21732e 100644 (file)
@@ -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
 }