From: Filip Tehlar Date: Wed, 6 Jul 2016 11:38:18 +0000 (+0200) Subject: Refactor basic LISP tests X-Git-Url: https://gerrit.fd.io/r/gitweb?p=one.git;a=commitdiff_plain;h=12defda1182a88e98a20d63c32fe897359663ad7 Refactor basic LISP tests Change-Id: Ibc11d4d82006ea11580d3b3e269f81709eedb53a Signed-off-by: Filip Tehlar --- diff --git a/tests/data_plane/configs/odl/replace_ipv4_odl2.txt b/tests/data_plane/configs/odl/basic/4o4/update_vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/replace_ipv4_odl2.txt rename to tests/data_plane/configs/odl/basic/4o4/update_vpp2.json diff --git a/tests/data_plane/configs/odl/add_ipv4_odl1.txt b/tests/data_plane/configs/odl/basic/4o4/vpp1.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv4_odl1.txt rename to tests/data_plane/configs/odl/basic/4o4/vpp1.json diff --git a/tests/data_plane/configs/odl/add_ipv4_odl2.txt b/tests/data_plane/configs/odl/basic/4o4/vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv4_odl2.txt rename to tests/data_plane/configs/odl/basic/4o4/vpp2.json diff --git a/tests/data_plane/configs/odl/replace_ipv4o6_odl2.txt b/tests/data_plane/configs/odl/basic/4o6/update_vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/replace_ipv4o6_odl2.txt rename to tests/data_plane/configs/odl/basic/4o6/update_vpp2.json diff --git a/tests/data_plane/configs/odl/add_ipv4o6_odl1.txt b/tests/data_plane/configs/odl/basic/4o6/vpp1.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv4o6_odl1.txt rename to tests/data_plane/configs/odl/basic/4o6/vpp1.json diff --git a/tests/data_plane/configs/odl/add_ipv4o6_odl2.txt b/tests/data_plane/configs/odl/basic/4o6/vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv4o6_odl2.txt rename to tests/data_plane/configs/odl/basic/4o6/vpp2.json diff --git a/tests/data_plane/configs/odl/replace_ipv6o4_odl2.txt b/tests/data_plane/configs/odl/basic/6o4/update_vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/replace_ipv6o4_odl2.txt rename to tests/data_plane/configs/odl/basic/6o4/update_vpp2.json diff --git a/tests/data_plane/configs/odl/add_ipv6o4_odl1.txt b/tests/data_plane/configs/odl/basic/6o4/vpp1.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv6o4_odl1.txt rename to tests/data_plane/configs/odl/basic/6o4/vpp1.json diff --git a/tests/data_plane/configs/odl/add_ipv6o4_odl2.txt b/tests/data_plane/configs/odl/basic/6o4/vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv6o4_odl2.txt rename to tests/data_plane/configs/odl/basic/6o4/vpp2.json diff --git a/tests/data_plane/configs/odl/replace_ipv6_odl2.txt b/tests/data_plane/configs/odl/basic/6o6/update_vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/replace_ipv6_odl2.txt rename to tests/data_plane/configs/odl/basic/6o6/update_vpp2.json diff --git a/tests/data_plane/configs/odl/add_ipv6_odl1.txt b/tests/data_plane/configs/odl/basic/6o6/vpp1.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv6_odl1.txt rename to tests/data_plane/configs/odl/basic/6o6/vpp1.json diff --git a/tests/data_plane/configs/odl/add_ipv6_odl2.txt b/tests/data_plane/configs/odl/basic/6o6/vpp2.json similarity index 100% rename from tests/data_plane/configs/odl/add_ipv6_odl2.txt rename to tests/data_plane/configs/odl/basic/6o6/vpp2.json diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o4/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o4/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o4/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o4/vpp2.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_ip4_6.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o4_and_6o6/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1_ip4_6.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o4_and_6o6/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_ip4_6.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o4_and_6o6/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2_ip4_6.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o4_and_6o6/vpp2.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_remote.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o4_no_odl/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1_remote.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o4_no_odl/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_remote.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o4_no_odl/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2_remote.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o4_no_odl/vpp2.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_4o6.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o6/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1_4o6.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o6/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_4o6.conf b/tests/data_plane/configs/vpp_lite_config/basic/4o6/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2_4o6.conf rename to tests/data_plane/configs/vpp_lite_config/basic/4o6/vpp2.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_6o4.conf b/tests/data_plane/configs/vpp_lite_config/basic/6o4/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1_6o4.conf rename to tests/data_plane/configs/vpp_lite_config/basic/6o4/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_6o4.conf b/tests/data_plane/configs/vpp_lite_config/basic/6o4/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2_6o4.conf rename to tests/data_plane/configs/vpp_lite_config/basic/6o4/vpp2.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_6.conf b/tests/data_plane/configs/vpp_lite_config/basic/6o6/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1_6.conf rename to tests/data_plane/configs/vpp_lite_config/basic/6o6/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_6.conf b/tests/data_plane/configs/vpp_lite_config/basic/6o6/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2_6.conf rename to tests/data_plane/configs/vpp_lite_config/basic/6o6/vpp2.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp1_6_remote.conf b/tests/data_plane/configs/vpp_lite_config/basic/6o6_no_odl/vpp1.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp1_6_remote.conf rename to tests/data_plane/configs/vpp_lite_config/basic/6o6_no_odl/vpp1.config diff --git a/tests/data_plane/configs/vpp_lite_config/vpp2_6_remote.conf b/tests/data_plane/configs/vpp_lite_config/basic/6o6_no_odl/vpp2.config similarity index 100% rename from tests/data_plane/configs/vpp_lite_config/vpp2_6_remote.conf rename to tests/data_plane/configs/vpp_lite_config/basic/6o6_no_odl/vpp2.config diff --git a/tests/data_plane/vpp_lite_topo/README b/tests/data_plane/vpp_lite_topo/README deleted file mode 100644 index 1b526c9..0000000 --- a/tests/data_plane/vpp_lite_topo/README +++ /dev/null @@ -1,21 +0,0 @@ -# Test require program expect - - install expect - aptitude install expect - -Please before use, set variable VPP_LITE_BIN to your vpp_lite in file lisp_test.sh - -# example use -# Test ip4 topology -./lisp_test.sh or ./lisp_test ip4 - -# Test ip6 topology -./lisp_test ip6 - -# Test ip4 and ip6 topology -./lisp_test ip4_ip6 - -# Test ip4 over ip6 -./lisp_test 4o6 - -# Test ip6 over ip4 -./lisp_test 6o4 diff --git a/tests/data_plane/vpp_lite_topo/config.sh b/tests/data_plane/vpp_lite_topo/config.sh index 351df29..f7afa3c 100644 --- a/tests/data_plane/vpp_lite_topo/config.sh +++ b/tests/data_plane/vpp_lite_topo/config.sh @@ -6,6 +6,11 @@ ODL_PORT="8181" # path to vpp executable VPP_LITE_BIN=/vpp/build-root/install-vpp_lite_debug-native/vpp/bin/vpp +# read user config file if exists +if [ -f "${HOME}/.onerc" ] ; then + source "${HOME}/.onerc" +fi + if [ ! -f "${VPP_LITE_BIN}" ] ; then echo "Error: VPP binary not found. You can set VPP_LITE_BIN in config.sh" echo "Current value:" diff --git a/tests/data_plane/vpp_lite_topo/lisp_6_remote_mapping.sh b/tests/data_plane/vpp_lite_topo/lisp_6_remote_mapping.sh deleted file mode 100644 index f25e8ec..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_6_remote_mapping.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -function ping_lisp6 { - sudo ip netns exec vppns1 ping6 -c 10 6:0:2::2 - if [ $? -ne 0 ] ; then - echo "Can not ping other machine" - exit -1 - fi -} - -sudo ip netns exec vppns1 \ - bash -c " - ip link set dev lo up - ip addr add 6:0:1::2/64 dev veth_vpp1 - ip route add 6:0:2::0/64 via 6:0:1::1 -" - -sudo ip netns exec vppns2 \ - bash -c " - ip link set dev lo up - ip addr add 6:0:2::2/64 dev veth_vpp2 - ip route add 6:0:1::0/64 via 6:0:2::1 -" - -ping_lisp6 - -expect << EOF -spawn telnet localhost 5003 -expect -re ".*>" -send "set int ip address del host-intervpp2 6:0:3::2/64\r" -expect -re ".*>" -send "set int ip address host-intervpp2 6:0:3::20/64\r" -expect -re ".*>" -EOF - -expect << EOF -spawn telnet localhost 5002 -expect -re ".*>" -send "lisp remote-mapping del vni 0 deid 6:0:2::0/64 seid 6:0:1::0/64 rloc 6:0:3::2\r" -expect -re ".*>" -send "lisp remote-mapping add vni 0 deid 6:0:2::0/64 seid 6:0:1::0/64 rloc 6:0:3::20\r" -expect -re ".*>" -EOF - -ping_lisp6 diff --git a/tests/data_plane/vpp_lite_topo/lisp_ip4.sh b/tests/data_plane/vpp_lite_topo/lisp_ip4.sh deleted file mode 100644 index a03b0cb..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_ip4.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -function ping_lisp { - sudo ip netns exec vppns1 ping -c 10 6.0.2.2 - if [ $? -ne 0 ] ; then - echo "Can not ping other machine" - exit -1 - fi -} - -sudo ip netns exec vppns1 \ - bash -c " - ip link set dev lo up - ip addr add 6.0.1.2/24 dev veth_vpp1 - ip route add 6.0.2.0/24 via 6.0.1.1 -" - -sudo ip netns exec vppns2 \ - bash -c " - ip link set dev lo up - ip addr add 6.0.2.2/24 dev veth_vpp2 - ip route add 6.0.1.0/24 via 6.0.2.1 -" - -post_curl "add-mapping" ${ODL_ADD_CONFIG1} -post_curl "add-mapping" ${ODL_ADD_CONFIG2} - -ping_lisp - -expect << EOF -spawn telnet localhost 5003 -expect -re ".*>" -send "set int ip address del host-intervpp2 6.0.3.2/24\r" -expect -re ".*>" -send "set int ip address host-intervpp2 6.0.3.20/24\r" -expect -re ".*>" -EOF - -post_curl "update-mapping" ${ODL_REPLACE_CONFIG2} - -ping_lisp diff --git a/tests/data_plane/vpp_lite_topo/lisp_ip4o6.sh b/tests/data_plane/vpp_lite_topo/lisp_ip4o6.sh deleted file mode 100644 index edc3ffa..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_ip4o6.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -function ping_lisp { - sudo ip netns exec vppns1 ping -c 15 6.0.2.2 - if [ $? -ne 0 ] ; then - echo "Can not ping other machine" - exit -1 - fi -} - -sudo ip netns exec vppns1 \ - bash -c " - ip link set dev lo up - ip addr add 6.0.1.2/24 dev veth_vpp1 - ip route add 6.0.2.0/24 via 6.0.1.1 -" - -sudo ip netns exec vppns2 \ - bash -c " - ip link set dev lo up - ip addr add 6.0.2.2/24 dev veth_vpp2 - ip route add 6.0.1.0/24 via 6.0.2.1 -" - -post_curl "add-mapping" ${ODL_ADD_CONFIG1_4o6} -post_curl "add-mapping" ${ODL_ADD_CONFIG2_4o6} - -ping_lisp - -expect << EOF -spawn telnet localhost 5003 -expect -re ".*>" -send "set int ip address del host-intervpp2 6:0:3::2/64\r" -expect -re ".*>" -send "set int ip address host-intervpp2 6:0:3::20/64\r" -expect -re ".*>" -EOF - -post_curl "update-mapping" ${ODL_REPLACE_CONFIG2_4o6} - -ping_lisp diff --git a/tests/data_plane/vpp_lite_topo/lisp_ip6.sh b/tests/data_plane/vpp_lite_topo/lisp_ip6.sh deleted file mode 100644 index 103f113..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_ip6.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -function ping_lisp6 { - sudo ip netns exec vppns1 ping6 -c 10 6:0:2::2 - if [ $? -ne 0 ] ; then - echo "Can not ping other machine" - exit -1 - fi -} - -sudo ip netns exec vppns1 \ - bash -c " - ip link set dev lo up - ip addr add 6:0:1::2/64 dev veth_vpp1 - ip route add 6:0:2::0/64 via 6:0:1::1 -" - -sudo ip netns exec vppns2 \ - bash -c " - ip link set dev lo up - ip addr add 6:0:2::2/64 dev veth_vpp2 - ip route add 6:0:1::0/64 via 6:0:2::1 -" - -post_curl "add-mapping" ${ODL_ADD_CONFIG1_6} -post_curl "add-mapping" ${ODL_ADD_CONFIG2_6} - -ping_lisp6 - -expect << EOF -spawn telnet localhost 5003 -expect -re ".*>" -send "set int ip address del host-intervpp2 6:0:3::2/64\r" -expect -re ".*>" -send "set int ip address host-intervpp2 6:0:3::20/64\r" -expect -re ".*>" -EOF - -post_curl "update-mapping" ${ODL_REPLACE_CONFIG2_6} - -ping_lisp6 diff --git a/tests/data_plane/vpp_lite_topo/lisp_ip6o4.sh b/tests/data_plane/vpp_lite_topo/lisp_ip6o4.sh deleted file mode 100644 index 3da810e..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_ip6o4.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -function ping_lisp6 { - sudo ip netns exec vppns1 ping6 -c 15 6:0:2::2 - if [ $? -ne 0 ] ; then - echo "Can not ping other machine" - exit -1 - fi -} - -sudo ip netns exec vppns1 \ - bash -c " - ip link set dev lo up - ip addr add 6:0:1::2/64 dev veth_vpp1 - ip route add 6:0:2::0/64 via 6:0:1::1 -" - -sudo ip netns exec vppns2 \ - bash -c " - ip link set dev lo up - ip addr add 6:0:2::2/64 dev veth_vpp2 - ip route add 6:0:1::0/64 via 6:0:2::1 -" - -post_curl "add-mapping" ${ODL_ADD_CONFIG1_6o4} -post_curl "add-mapping" ${ODL_ADD_CONFIG2_6o4} - -ping_lisp6 - -expect << EOF -spawn telnet localhost 5003 -expect -re ".*>" -send "set int ip address del host-intervpp2 6.0.3.2/24\r" -expect -re ".*>" -send "set int ip address host-intervpp2 6.0.3.20/24\r" -expect -re ".*>" -EOF - -post_curl "update-mapping" ${ODL_REPLACE_CONFIG2_6o4} - -ping_lisp6 diff --git a/tests/data_plane/vpp_lite_topo/lisp_remote_mapping.sh b/tests/data_plane/vpp_lite_topo/lisp_remote_mapping.sh deleted file mode 100644 index 3ee6f07..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_remote_mapping.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -function ping_lisp { - sudo ip netns exec vppns1 ping -c 10 6.0.2.2 - if [ $? -ne 0 ] ; then - echo "Can not ping other machine" - exit -1 - fi -} - -sudo ip netns exec vppns1 \ - bash -c " - ip link set dev lo up - ip addr add 6.0.1.2/24 dev veth_vpp1 - ip route add 6.0.2.0/24 via 6.0.1.1 -" - -sudo ip netns exec vppns2 \ - bash -c " - ip link set dev lo up - ip addr add 6.0.2.2/24 dev veth_vpp2 - ip route add 6.0.1.0/24 via 6.0.2.1 -" - -ping_lisp - -expect << EOF -spawn telnet localhost 5003 -expect -re ".*>" -send "set int ip address del host-intervpp2 6.0.3.2/24\r" -expect -re ".*>" -send "set int ip address host-intervpp2 6.0.3.20/24\r" -expect -re ".*>" -EOF - -expect << EOF -spawn telnet localhost 5002 -expect -re ".*>" -send "lisp remote-mapping del vni 0 deid 6.0.2.0/24 seid 6.0.1.0/24 rloc 6.0.3.2\r" -expect -re ".*>" -send "lisp remote-mapping add vni 0 deid 6.0.2.0/24 seid 6.0.1.0/24 rloc 6.0.3.20\r" -expect -re ".*>" -EOF - -ping_lisp diff --git a/tests/data_plane/vpp_lite_topo/lisp_test.sh b/tests/data_plane/vpp_lite_topo/lisp_test.sh deleted file mode 100755 index abacd42..0000000 --- a/tests/data_plane/vpp_lite_topo/lisp_test.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/usr/bin/env bash - -if [ "$1" == "-h" ] || [ "$1" == "-help" ] ; then - echo "lisp_test.sh [ip4] [ip6] [ip4_ip6] [4o6] [6o4] [remote] [remote6]" - echo " ip4 - test ip4 topology" - echo " ip6 - test ip6 topology" - echo " ip4_ip6 - test ip4 and ip6 topology" - echo " 4o6 - test ip4 over ip6" - echo " 6o4 - test ip6 over ip4" - echo " remote - test static mapping, without ODL" - echo " remote6 - test static mapping for IPv6, without ODL" - exit 0 -fi - -set -x - -VPP_LITE_CONF=`pwd`"/../configs/vpp_lite_config/" -VPP1_CONF="vpp1.conf" -VPP2_CONF="vpp2.conf" -ODL_CONFIG_DIR="../configs/odl/" -ODL_ADD_CONFIG1="add_ipv4_odl1.txt" -ODL_ADD_CONFIG1_4o6="add_ipv4o6_odl1.txt" -ODL_ADD_CONFIG1_6="add_ipv6_odl1.txt" -ODL_ADD_CONFIG1_6o4="add_ipv6o4_odl1.txt" -ODL_ADD_CONFIG2="add_ipv4_odl2.txt" -ODL_ADD_CONFIG2_4o6="add_ipv4o6_odl2.txt" -ODL_ADD_CONFIG2_6="add_ipv6_odl2.txt" -ODL_ADD_CONFIG2_6o4="add_ipv6o4_odl2.txt" -ODL_REPLACE_CONFIG2="replace_ipv4_odl2.txt" -ODL_REPLACE_CONFIG2_4o6="replace_ipv4o6_odl2.txt" -ODL_REPLACE_CONFIG2_6="replace_ipv6_odl2.txt" -ODL_REPLACE_CONFIG2_6o4="replace_ipv6o4_odl2.txt" - -source config.sh -source odl_utils.sh - -# make sure there are no vpp instances running -sudo pkill vpp - -# delete previous incarnations if they exist -sudo ip netns exec intervppns ifconfig vppbr down -sudo ip netns exec intervppns brctl delbr vppbr -sudo ip link del dev veth_vpp1 &> /dev/null -sudo ip link del dev veth_vpp2 &> /dev/null -sudo ip link del dev veth_intervpp1 &> /dev/null -sudo ip link del dev veth_intervpp2 &> /dev/null -sudo ip link del dev veth_odl &> /dev/null -sudo ip netns del vppns1 &> /dev/null -sudo ip netns del vppns2 &> /dev/null -sudo ip netns del intervppns &> /dev/null - -if [ "$1" != "remote" ] && [ "$1" != "remote6" ] ; then - odl_clear_all -fi - -if [ "$1" == "clean" ] ; then - exit 0; -fi - -sleep 1 - -# create vpp to clients and inter-vpp namespaces -sudo ip netns add vppns1 -sudo ip netns add vppns2 -sudo ip netns add intervppns - -# create vpp and odl interfaces and set them in intervppns -sudo ip link add veth_intervpp1 type veth peer name intervpp1 -sudo ip link add veth_intervpp2 type veth peer name intervpp2 -sudo ip link add veth_odl type veth peer name odl -sudo ip link set dev intervpp1 up -sudo ip link set dev intervpp2 up -sudo ip link set dev odl up -sudo ip link set dev veth_intervpp1 up netns intervppns -sudo ip link set dev veth_intervpp2 up netns intervppns -sudo ip link set dev veth_odl up netns intervppns - -# create bridge in intervppns and add vpp and odl interfaces -sudo ip netns exec intervppns brctl addbr vppbr -sudo ip netns exec intervppns brctl addif vppbr veth_intervpp1 -sudo ip netns exec intervppns brctl addif vppbr veth_intervpp2 -sudo ip netns exec intervppns brctl addif vppbr veth_odl -sudo ip netns exec intervppns ifconfig vppbr up - -# create and configure 1st veth client to vpp pair -sudo ip link add veth_vpp1 type veth peer name vpp1 -sudo ip link set dev vpp1 up -sudo ip link set dev veth_vpp1 up netns vppns1 - -# create and configure 2nd veth client to vpp pair -sudo ip link add veth_vpp2 type veth peer name vpp2 -sudo ip link set dev vpp2 up -sudo ip link set dev veth_vpp2 up netns vppns2 - -# set odl iface ip and disable checksum offloading -sudo ip addr add 6.0.3.100/24 dev odl -sudo ip addr add 6:0:3::100/64 dev odl -sudo ethtool --offload odl rx off tx off - -if [ "$1" == "ip6" ] ; then - VPP1_CONF="vpp1_6.conf" - VPP2_CONF="vpp2_6.conf" -fi - -if [ "$1" == "ip4_ip6" ] ; then - VPP1_CONF="vpp1_ip4_6.conf" - VPP2_CONF="vpp2_ip4_6.conf" -fi - -if [ "$1" == "4o6" ] ; then - VPP1_CONF="vpp1_4o6.conf" - VPP2_CONF="vpp2_4o6.conf" -fi - -if [ "$1" == "6o4" ] ; then - VPP1_CONF="vpp1_6o4.conf" - VPP2_CONF="vpp2_6o4.conf" -fi - -if [ "$1" == "remote" ] ; then - VPP1_CONF="vpp1_remote.conf" - VPP2_CONF="vpp2_remote.conf" -fi - -if [ "$1" == "remote6" ] ; then - VPP1_CONF="vpp1_6_remote.conf" - VPP2_CONF="vpp2_6_remote.conf" -fi - -# start vpp1 and vpp2 in separate chroot -sudo $VPP_LITE_BIN \ - unix { log /tmp/vpp1.log cli-listen \ - localhost:5002 full-coredump \ - exec $VPP_LITE_CONF/${VPP1_CONF} } \ - api-trace { on } api-segment {prefix xtr1} - -sudo $VPP_LITE_BIN \ - unix { log /tmp/vpp2.log cli-listen \ - localhost:5003 full-coredump \ - exec $VPP_LITE_CONF/${VPP2_CONF}} \ - api-trace { on } api-segment {prefix xtr2} - - -if [ "$#" == 0 ] || [ "$1" == "ip4" ] ; then - source lisp_ip4.sh -fi - -if [ "$1" == "ip6" ] ; then - source lisp_ip6.sh -fi - -if [ "$1" == "ip4_ip6" ] ; then - source lisp_ip4.sh - source lisp_ip6.sh - - ping_lisp - ping_lisp6 -fi - -if [ "$1" == "4o6" ] ; then - source lisp_ip4o6.sh -fi - -if [ "$1" == "6o4" ] ; then - source lisp_ip6o4.sh -fi - -if [ "$1" == "remote" ] ; then - source lisp_remote_mapping.sh -fi - -if [ "$1" == "remote6" ] ; then - source lisp_6_remote_mapping.sh -fi - -echo "Success" diff --git a/tests/data_plane/vpp_lite_topo/test_basic_4o4.sh b/tests/data_plane/vpp_lite_topo/test_basic_4o4.sh new file mode 100755 index 0000000..807edcc --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_4o4.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality (ip4 over ip4) + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/4o4 +ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4 + +source test_driver/basic.sh + +test_basic ping "6.0.2.2" diff --git a/tests/data_plane/vpp_lite_topo/test_basic_4o4_and_6o6.sh b/tests/data_plane/vpp_lite_topo/test_basic_4o4_and_6o6.sh new file mode 100755 index 0000000..9adeaf6 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_4o4_and_6o6.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality with two ongoing traffics - 4o4 and 6o6 + +ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/6o6 +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/4o4_and_6o6 + +source test_driver/basic_multi_traffic.sh + +test_basic_multi_traffic ping6 "6:0:2::2" ping "6.0.2.2" + diff --git a/tests/data_plane/vpp_lite_topo/test_basic_4o4_no_odl.sh b/tests/data_plane/vpp_lite_topo/test_basic_4o4_no_odl.sh new file mode 100755 index 0000000..0c2d2d0 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_4o4_no_odl.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality without odl (ip4 over ip4) + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/4o4_no_odl + +source test_driver/basic_no_odl.sh + +test_basic_no_odl ping "6.0.2.2" diff --git a/tests/data_plane/vpp_lite_topo/test_basic_4o6.sh b/tests/data_plane/vpp_lite_topo/test_basic_4o6.sh new file mode 100755 index 0000000..c9bd8de --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_4o6.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality (ip4 over ip6) + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/4o6 +ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o6 + +source test_driver/basic.sh + +test_basic ping "6.0.2.2" + diff --git a/tests/data_plane/vpp_lite_topo/test_basic_6o4.sh b/tests/data_plane/vpp_lite_topo/test_basic_6o4.sh new file mode 100755 index 0000000..757b7ce --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_6o4.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality (ip6 over ip4) + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/6o4 +ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/6o4 + +source test_driver/basic.sh + +test_basic ping6 "6:0:2::2" diff --git a/tests/data_plane/vpp_lite_topo/test_basic_6o6.sh b/tests/data_plane/vpp_lite_topo/test_basic_6o6.sh new file mode 100755 index 0000000..3ef68f4 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_6o6.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality (ip6 over ip6) + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/6o6 +ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/6o6 + +source test_driver/basic.sh + +test_basic ping6 "6:0:2::2" diff --git a/tests/data_plane/vpp_lite_topo/test_basic_6o6_no_odl.sh b/tests/data_plane/vpp_lite_topo/test_basic_6o6_no_odl.sh new file mode 100755 index 0000000..ce332d4 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_basic_6o6_no_odl.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Test basic LISP functionality without odl (ip6 over ip6) + +VPP_LITE_CONF=`pwd`/../configs/vpp_lite_config/basic/6o6_no_odl + +source test_driver/basic_no_odl.sh + +test_basic_no_odl ping6 "6:0:2::2" + diff --git a/tests/data_plane/vpp_lite_topo/test_driver/basic.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh new file mode 100644 index 0000000..897c773 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic.sh @@ -0,0 +1,56 @@ +source config.sh +source odl_utils.sh +source topologies/basic_topo.sh + +ODL_CONFIG_FILE1="vpp1.json" +ODL_CONFIG_FILE2="vpp2.json" +ODL_CONFIG_FILE3="update_vpp2.json" + +if [ "$1" == "clean" ] ; then + basic_topo_clean + exit 0 +fi + +if [[ $(id -u) != 0 ]]; then + echo "Error: run this as a root." + exit 1 +fi + +function test_basic +{ + if [ "$3" != "no_setup" ] ; then + basic_topo_setup + fi + + test_result=1 + + ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + rc=$? + if [ $rc -ne 0 ] ; then + echo "No response received!" + basic_topo_clean + exit $test_result + fi + + # change IP addresses of destination RLOC + echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003 + echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003 + echo "set int ip address del host-intervpp2 6:0:3::2/24" | nc 0 5003 + echo "set int ip address host-intervpp2 6:0:3::20/24" | nc 0 5003 + post_curl "update-mapping" ${ODL_CONFIG_FILE3} + + ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + rc=$? + + # test done + + basic_topo_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_driver/basic_multi_traffic.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh new file mode 100644 index 0000000..2d3deaf --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_multi_traffic.sh @@ -0,0 +1,77 @@ +source config.sh +source odl_utils.sh +source topologies/basic_topo.sh + +ODL_CONFIG_FILE1="vpp1.json" +ODL_CONFIG_FILE2="vpp2.json" +ODL_CONFIG_FILE3="update_vpp2.json" + +if [ "$1" == "clean" ] ; then + basic_topo_clean + exit 0 +fi + +if [[ $(id -u) != 0 ]]; then + echo "Error: run this as a root." + exit 1 +fi + +function test_basic_multi_traffic +{ + basic_topo_setup + + # additional setup + ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4 + post_curl "add-mapping" ${ODL_CONFIG_FILE1} + post_curl "add-mapping" ${ODL_CONFIG_FILE2} + + test_result=1 + + ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + if [ $? -ne 0 ] ; then + echo "No response received!" + basic_topo_clean + exit $test_result + fi + + ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}" + if [ $? -ne 0 ] ; then + echo "No response received!" + basic_topo_clean + exit $test_result + fi + + # change IP addresses of destination RLOC + echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003 + echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003 + echo "set int ip address del host-intervpp2 6:0:3::2/24" | nc 0 5003 + echo "set int ip address host-intervpp2 6:0:3::20/24" | nc 0 5003 + + ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/6o6 + post_curl "update-mapping" ${ODL_CONFIG_FILE3} + ODL_CONFIG_DIR=`pwd`/../configs/odl/basic/4o4 + post_curl "update-mapping" ${ODL_CONFIG_FILE3} + + ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + if [ $? -ne 0 ] ; then + echo "No response received!" + basic_topo_clean + exit $test_result + fi + + ip netns exec vppns1 "${3}" -w 15 -c 1 "${4}" + rc=$? + + # test done + + basic_topo_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_driver/basic_no_odl.sh b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh new file mode 100644 index 0000000..f19fce6 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/basic_no_odl.sh @@ -0,0 +1,52 @@ +source config.sh +source odl_utils.sh +source topologies/basic_topo.sh + +if [ "$1" == "clean" ] ; then + basic_topo_clean + exit 0 +fi + +if [[ $(id -u) != 0 ]]; then + echo "Error: run this as a root." + exit 1 +fi + +function test_basic_no_odl +{ + basic_topo_setup no_odl + + test_result=1 + + ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + if [ $? -ne 0 ] ; then + echo "No response received!" + basic_topo_clean no_odl + exit $test_result + fi + + # change IP addresses of destination RLOC + echo "set int ip address del host-intervpp2 6.0.3.2/24" | nc 0 5003 + echo "set int ip address host-intervpp2 6.0.3.20/24" | nc 0 5003 + echo "set int ip address del host-intervpp2 6:0:3::2/24" | nc 0 5003 + echo "set int ip address host-intervpp2 6:0:3::20/24" | nc 0 5003 + + echo "lisp remote-mapping del vni 0 deid 6.0.2.0/24 seid 6.0.1.0/24 rloc 6.0.3.2" | nc 0 5002 + echo "lisp remote-mapping add vni 0 deid 6.0.2.0/24 seid 6.0.1.0/24 rloc 6.0.3.20" | nc 0 5002 + + ip netns exec vppns1 "${1}" -w 15 -c 1 "${2}" + rc=$? + + # test done + + basic_topo_clean no_odl + 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/topologies/basic_topo.sh b/tests/data_plane/vpp_lite_topo/topologies/basic_topo.sh new file mode 100644 index 0000000..4a57c58 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/topologies/basic_topo.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +function basic_topo_clean +{ + echo "Clearing all VPP instances.." + pkill vpp --signal 9 + rm /dev/shm/* + + echo "Cleaning topology.." + ip netns exec intervppns ifconfig vppbr down + ip netns exec intervppns brctl delbr vppbr + ip link del dev veth_vpp1 &> /dev/null + ip link del dev veth_vpp2 &> /dev/null + ip link del dev veth_intervpp1 &> /dev/null + ip link del dev veth_intervpp2 &> /dev/null + ip link del dev veth_odl &> /dev/null + ip netns del vppns1 &> /dev/null + ip netns del vppns2 &> /dev/null + ip netns del intervppns &> /dev/null + + if [ "$1" != "no_odl" ] ; then + odl_clear_all + fi +} + +function basic_topo_setup +{ + + # create vpp to clients and inter-vpp namespaces + ip netns add vppns1 + ip netns add vppns2 + ip netns add intervppns + + # create vpp and odl interfaces and set them in intervppns + ip link add veth_intervpp1 type veth peer name intervpp1 + ip link add veth_intervpp2 type veth peer name intervpp2 + ip link add veth_odl type veth peer name odl + ip link set dev intervpp1 up + ip link set dev intervpp2 up + ip link set dev odl up + ip link set dev veth_intervpp1 up netns intervppns + ip link set dev veth_intervpp2 up netns intervppns + ip link set dev veth_odl up netns intervppns + + # create bridge in intervppns and add vpp and odl interfaces + ip netns exec intervppns brctl addbr vppbr + ip netns exec intervppns brctl addif vppbr veth_intervpp1 + ip netns exec intervppns brctl addif vppbr veth_intervpp2 + ip netns exec intervppns brctl addif vppbr veth_odl + ip netns exec intervppns ifconfig vppbr up + + # create and configure 1st veth client to vpp pair + ip link add veth_vpp1 type veth peer name vpp1 + ip link set dev vpp1 up + ip link set dev veth_vpp1 up netns vppns1 + + # create and configure 2nd veth client to vpp pair + ip link add veth_vpp2 type veth peer name vpp2 + ip link set dev vpp2 up + ip link set dev veth_vpp2 up netns vppns2 + + ip netns exec vppns1 \ + bash -c " + ip link set dev lo up + ip addr add 6.0.1.2/24 dev veth_vpp1 + ip route add 6.0.2.0/24 via 6.0.1.1 + ip addr add 6:0:1::2/64 dev veth_vpp1 + ip route add 6:0:2::0/64 via 6:0:1::1 + " + + ip netns exec vppns2 \ + bash -c " + ip link set dev lo up + ip addr add 6.0.2.2/24 dev veth_vpp2 + ip route add 6.0.1.0/24 via 6.0.2.1 + ip addr add 6:0:2::2/64 dev veth_vpp2 + ip route add 6:0:1::0/64 via 6:0:2::1 + " + + # set odl iface ip and disable checksum offloading + 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 + + # start vpp1 and vpp2 in separate chroot + ${VPP_LITE_BIN} \ + unix { log /tmp/vpp1.log cli-listen \ + localhost:5002 full-coredump \ + exec ${VPP_LITE_CONF}/vpp1.config } \ + api-trace { on } api-segment {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 } api-segment {prefix xtr2} + + if [ "$1" != "no_odl" ] ; then + post_curl "add-mapping" ${ODL_CONFIG_FILE1} + post_curl "add-mapping" ${ODL_CONFIG_FILE2} + fi +} +