diff options
author | Filip Tehlar <ftehlar@cisco.com> | 2016-05-26 15:57:49 +0200 |
---|---|---|
committer | Filip Tehlar <ftehlar@cisco.com> | 2016-05-27 09:00:22 +0200 |
commit | 4bf6318c1de924c63e22479cc38549ce3af3e420 (patch) | |
tree | bca01ef7f954c2f6ef5c33d215a89f47e5a5588d /tests/data_plane/vpp_lite_topo | |
parent | 05767cf174f01c5ffdc317112dfabb64bd677a6c (diff) |
Add LISP RTR tests
This change adds tests for IPv4overIPv4 and IPv4overIPv6 scenarios.
Change-Id: I68e0e94538914cf0b03625ee1be3b92684184c78
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'tests/data_plane/vpp_lite_topo')
7 files changed, 209 insertions, 17 deletions
diff --git a/tests/data_plane/vpp_lite_topo/config.sh b/tests/data_plane/vpp_lite_topo/config.sh new file mode 100644 index 0000000..790d31e --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/config.sh @@ -0,0 +1,14 @@ +ODL_USER="admin" +ODL_PASSWD="admin" +ODL_IP="127.0.0.1" +ODL_PORT="8181" + +# path to vpp executable +VPP_LITE_BIN=/home/vagrant/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp + +if [ ! -f "${VPP_LITE_BIN}" ] ; then + echo "Error: VPP binary not found. You can set VPP_LITE_BIN in config.sh" + echo "Current value:" + echo "VPP_LITE_BIN=${VPP_LITE_BIN}" + exit 1 +fi diff --git a/tests/data_plane/vpp_lite_topo/lisp_test.sh b/tests/data_plane/vpp_lite_topo/lisp_test.sh index 2f09abb..33eee54 100755 --- a/tests/data_plane/vpp_lite_topo/lisp_test.sh +++ b/tests/data_plane/vpp_lite_topo/lisp_test.sh @@ -7,16 +7,13 @@ if [ "$1" == "-h" ] || [ "$1" == "-help" ] ; then echo " ip4_ip6 - test ip4 and ip6 topology" echo " 4o6 - test ip4 over ip6" echo " 6o4 - test ip6 over ip4" - echo " remote - test statick mapping, whit out ODL" - echo " remote6 - test statick mapping for IPv6, whit out ODL" + echo " remote - test static mapping, without ODL" + echo " remote6 - test static mapping for IPv6, without ODL" exit 0 fi set -x -# path to vpp executable and configurations folder -# VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp -VPP_LITE_BIN=/home/csit/lisp_vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/" VPP1_CONF="vpp1.conf" VPP2_CONF="vpp2.conf" @@ -34,16 +31,8 @@ ODL_REPLACE_CONFIG2_4o6="replace_ipv4o6_odl2.txt" ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt" ODL_REPLACE_CONFIG2_6o4="replace_ipv6o4_odl2.txt" -ODL_USER="admin" -ODL_PASSWD="admin" -ODL_IP="127.0.0.1" -ODL_PORT="8181" - -function post_curl { - curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:${1} \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${2}" \ - -u ${ODL_USER}:${ODL_PASSWD} -} +source config.sh +source odl_utils.sh # make sure there are no vpp instances running sudo pkill vpp @@ -61,8 +50,7 @@ sudo ip netns del vppns2 &> /dev/null sudo ip netns del intervppns &> /dev/null if [ "$1" != "remote" ] && [ "$1" != "remote6" ] ; then - curl -X DELETE http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database/ \ - -u ${ODL_USER}:${ODL_PASSWD} + odl_clear_all fi if [ "$1" == "clean" ] ; then diff --git a/tests/data_plane/vpp_lite_topo/odl_utils.sh b/tests/data_plane/vpp_lite_topo/odl_utils.sh new file mode 100644 index 0000000..f3edc28 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/odl_utils.sh @@ -0,0 +1,16 @@ + +function post_curl { + echo "Sending mapping from ${2} to ODL; operation: ${1}" + until [ "`curl -X POST "http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:${1}" \ + -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${2}" \ + -u ${ODL_USER}:${ODL_PASSWD} -s -o /dev/null -w "%{http_code}"`" == "200" ] + do + echo "Updating failed; trying again.." + done +} + +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} +} diff --git a/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh b/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh new file mode 100644 index 0000000..6331ab5 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/rtr_single_iface.sh @@ -0,0 +1,38 @@ + +source config.sh +source odl_utils.sh +source topologies/rtr_single_iface.sh + +# set odl config json file names; they are common among all rtr tests +ODL_CONFIG_FILE1="elp1.json" +ODL_CONFIG_FILE2="elp2.json" + +if [ "$1" == "clean" ] ; then + rtr_single_iface_clean + exit 0 +fi + +if [[ $(id -u) != 0 ]]; then + echo "Error: run this as a root." + exit 1 +fi + +function test_rtr_single_iface { + rtr_single_iface_setup + + test_result=1 + + ip netns exec vpp-ns1 ping -w 15 -c 1 "${1}" + rc=$? + + rtr_single_iface_clean + + if [ $rc -ne 0 ] ; then + echo "Test failed: No ICMP response received within specified timeout limit!" + else + echo "Test passed." + test_result=0 + fi + + exit $test_result +} diff --git a/tests/data_plane/vpp_lite_topo/test_rtr_single_iface_4o4.sh b/tests/data_plane/vpp_lite_topo/test_rtr_single_iface_4o4.sh new file mode 100755 index 0000000..f2e1a60 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_rtr_single_iface_4o4.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# +# Test for VPP LISP RTR functionality (4over4). +# +# IMPORTANT: This test needs to have ODL running with following config +# line in etc/custom.properties: +# lisp.elpPolicy = replace +# +# This test configures a topology of two XTRs and RTR. An ICMP request is +# sent from host1 behind first TR to the host2 behind the second TR. +# Both host and underlaying networks are IPv4. +# + +VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/rtr_single_iface/4o4" +ODL_CONFIG_DIR=`pwd`"/../configs/odl/rtr_single_iface/4o4/" + +source test_driver/rtr_single_iface.sh + +test_rtr_single_iface "6.0.4.4" diff --git a/tests/data_plane/vpp_lite_topo/test_rtr_single_iface_4o6.sh b/tests/data_plane/vpp_lite_topo/test_rtr_single_iface_4o6.sh new file mode 100755 index 0000000..59c75d1 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_rtr_single_iface_4o6.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# +# Test for VPP LISP RTR functionality (4over6). +# +# IMPORTANT: This test needs to have ODL running with following config +# line in etc/custom.properties: +# lisp.elpPolicy = replace +# +# This test configures a topology of two XTRs and RTR. An ICMP request is +# sent from host1 behind first TR to the host2 behind the second TR. +# Hosts resides in IPv4 network, underlying network is IPv6 +# + +VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/rtr_single_iface/4o6/" +ODL_CONFIG_DIR=`pwd`"/../configs/odl/rtr_single_iface/4o6/" + +source test_driver/rtr_single_iface.sh + +test_rtr_single_iface "6.0.4.4" diff --git a/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh b/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh new file mode 100644 index 0000000..70f1eeb --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/topologies/rtr_single_iface.sh @@ -0,0 +1,96 @@ +#!/usr/bin/env bash + +function rtr_single_iface_clean { + echo "Clearing all VPP instances.." + pkill vpp + + echo "Cleaning RTR topology.." + ip netns exec xtr-rtr-ns ifconfig vppbr1 down + ip netns exec xtr-rtr-ns brctl delbr vppbr1 + ip link del dev vpp1 &> /dev/null + ip link del dev vpp2 &> /dev/null + ip link del dev xtr_rtr1 &> /dev/null + ip link del dev xtr_rtr2 &> /dev/null + ip link del dev xtr_rtr3 &> /dev/null + ip link del dev odl &> /dev/null + + ip netns del vpp-ns1 &> /dev/null + ip netns del vpp-ns2 &> /dev/null + ip netns del xtr-rtr-ns &> /dev/null + + odl_clear_all +} + +function rtr_single_iface_setup { + ip netns add vpp-ns1 + ip netns add vpp-ns2 + ip netns add xtr-rtr-ns + + ip link add veth_xtr_rtr1 type veth peer name xtr_rtr1 + ip link add veth_xtr_rtr2 type veth peer name xtr_rtr2 + ip link add veth_xtr_rtr3 type veth peer name xtr_rtr3 + ip link add veth_odl type veth peer name odl + ip link set dev xtr_rtr1 up + ip link set dev xtr_rtr2 up + ip link set dev xtr_rtr3 up + ip link set dev odl up + + ip link set dev veth_xtr_rtr1 up netns xtr-rtr-ns + ip link set dev veth_xtr_rtr2 up netns xtr-rtr-ns + ip link set dev veth_xtr_rtr3 up netns xtr-rtr-ns + ip link set dev veth_odl up netns xtr-rtr-ns + + ip netns exec xtr-rtr-ns brctl addbr vppbr1 + ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_xtr_rtr1 + ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_xtr_rtr2 + ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_xtr_rtr3 + ip netns exec xtr-rtr-ns brctl addif vppbr1 veth_odl + ip netns exec xtr-rtr-ns ifconfig vppbr1 up + + ip link add veth_vpp1 type veth peer name vpp1 + ip link set dev vpp1 up + ip link set dev veth_vpp1 up netns vpp-ns1 + + ip netns exec vpp-ns1 \ + bash -c " + ip link set dev lo up + ip addr add 6.0.2.2/24 dev veth_vpp1 + ip route add 6.0.4.0/24 via 6.0.2.1 + " + + ip link add veth_vpp2 type veth peer name vpp2 + ip link set dev vpp2 up + ip link set dev veth_vpp2 up netns vpp-ns2 + + ip netns exec vpp-ns2 \ + bash -c " + ip link set dev lo up + ip addr add 6.0.4.4/24 dev veth_vpp2 + ip route add 6.0.2.0/24 via 6.0.4.1 + " + + ip addr add 6.0.3.100/24 dev odl + ip addr add 6:0:3::100/64 dev odl + ethtool --offload odl rx off tx off + + ${VPP_LITE_BIN} \ + unix { log /tmp/vpp1.log cli-listen \ + localhost:5002 full-coredump \ + exec ${VPP_LITE_CONF}/vpp1.config } \ + api-trace { on } chroot {prefix xtr1} + + ${VPP_LITE_BIN} \ + unix { log /tmp/vpp2.log cli-listen \ + localhost:5003 full-coredump \ + exec ${VPP_LITE_CONF}/vpp2.config } \ + api-trace { on } chroot {prefix xtr2} + + ${VPP_LITE_BIN} \ + unix { log /tmp/rtr.log cli-listen \ + localhost:5004 full-coredump \ + exec ${VPP_LITE_CONF}/rtr.config } \ + api-trace { on } chroot {prefix rtr} + + post_curl "add-mapping" ${ODL_CONFIG_FILE1} + post_curl "add-mapping" ${ODL_CONFIG_FILE2} +} |