diff options
Diffstat (limited to 'tests')
10 files changed, 435 insertions, 0 deletions
diff --git a/tests/data_plane/configs/odl/smr_rtr_disjoint/elp1.json b/tests/data_plane/configs/odl/smr_rtr_disjoint/elp1.json new file mode 100644 index 0000000..7696f59 --- /dev/null +++ b/tests/data_plane/configs/odl/smr_rtr_disjoint/elp1.json @@ -0,0 +1,42 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:2::0/64" + }, + "LocatorRecord": [ + { + "locator-id": "ELP", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf", + "explicit-locator-path": { + "hop": [ + { + "hop-id": "Hop 1", + "address": "6:0:5::2", + "lrs-bits": "lookup rloc-probe strict" + }, + { + "hop-id": "Hop 2", + "address": "6.0.3.1", + "lrs-bits": "lookup strict" + } + ] + } + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/smr_rtr_disjoint/elp2.json b/tests/data_plane/configs/odl/smr_rtr_disjoint/elp2.json new file mode 100644 index 0000000..a043715 --- /dev/null +++ b/tests/data_plane/configs/odl/smr_rtr_disjoint/elp2.json @@ -0,0 +1,42 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:4::0/64" + }, + "LocatorRecord": [ + { + "locator-id": "ELP", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": false, + "rloc": { + "address-type": "ietf-lisp-address-types:explicit-locator-path-lcaf", + "explicit-locator-path": { + "hop": [ + { + "hop-id": "Hop 1", + "address": "6.0.3.2", + "lrs-bits": "lookup rloc-probe strict" + }, + { + "hop-id": "Hop 2", + "address": "6:0:5::1", + "lrs-bits": "lookup strict" + } + ] + } + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/smr_rtr_disjoint/vpp1.json b/tests/data_plane/configs/odl/smr_rtr_disjoint/vpp1.json new file mode 100644 index 0000000..0d405e5 --- /dev/null +++ b/tests/data_plane/configs/odl/smr_rtr_disjoint/vpp1.json @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:2::0/64" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv4-afi", + "ipv4": "6.0.3.1" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/odl/smr_rtr_disjoint/vpp2.json b/tests/data_plane/configs/odl/smr_rtr_disjoint/vpp2.json new file mode 100644 index 0000000..84e39f7 --- /dev/null +++ b/tests/data_plane/configs/odl/smr_rtr_disjoint/vpp2.json @@ -0,0 +1,29 @@ +{ + "input": { + "mapping-record": { + "recordTtl": 1440, + "action": "NoAction", + "authoritative": true, + "eid": { + "address-type": "ietf-lisp-address-types:ipv6-prefix-afi", + "ipv6-prefix": "6:0:4::0/64" + }, + "LocatorRecord": [ + { + "locator-id": "ISP1", + "priority": 1, + "weight": 1, + "multicastPriority": 255, + "multicastWeight": 0, + "localLocator": true, + "rlocProbed": false, + "routed": true, + "rloc": { + "address-type": "ietf-lisp-address-types:ipv4-afi", + "ipv4": "6.0.3.3" + } + } + ] + } + } +} diff --git a/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/rtr.config b/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/rtr.config new file mode 100644 index 0000000..bb4bcb7 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/rtr.config @@ -0,0 +1,15 @@ +create host-interface name rtr_wan4 +set int state host-rtr_wan4 up +set int ip address host-rtr_wan4 6.0.3.2/24 + +create host-interface name rtr_vpp2 +set int state host-rtr_vpp2 up +set int ip address host-rtr_vpp2 6:0:5::2/64 + +lisp enable + +lisp locator-set add ls1 iface host-rtr_wan4 p 1 w 1 iface host-rtr_vpp2 p 1 w 1 +lisp pitr ls ls1 +comment { lisp pitr disable } +lisp remote-mapping deid 6:0:0::0/32 action send-map-request +lisp map-resolver add 6.0.3.100 diff --git a/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/vpp1.config b/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/vpp1.config new file mode 100644 index 0000000..2fe4b62 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/vpp1.config @@ -0,0 +1,12 @@ +create host-interface name vpp1 +set int state host-vpp1 up +set int ip address host-vpp1 6:0:2::1/64 +create host-interface name vpp1_wan4 +set int state host-vpp1_wan4 up +set int ip address host-vpp1_wan4 6.0.3.1/24 + +lisp enable + +lisp map-resolver add 6.0.3.100 +lisp locator-set add ls1 iface host-vpp1_wan4 p 1 w 1 +lisp eid-table add eid 6:0:2::0/64 locator-set ls1 diff --git a/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/vpp2.config b/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/vpp2.config new file mode 100644 index 0000000..71f3174 --- /dev/null +++ b/tests/data_plane/configs/vpp_lite_config/smr_rtr_disjoint/vpp2.config @@ -0,0 +1,15 @@ +create host-interface name vpp2 +set int state host-vpp2 up +set int ip address host-vpp2 6:0:4::1/64 +create host-interface name vpp2_rtr +set int state host-vpp2_rtr up +set int ip address host-vpp2_rtr 6:0:5::1/64 +create host-interface name vpp2_wan4 +set int state host-vpp2_wan4 up +set int ip address host-vpp2_wan4 6.0.3.3/24 + +lisp enable + +lisp map-resolver add 6:0:5::100 +lisp locator-set add ls1 iface host-vpp2_rtr p 1 w 1 iface host-vpp2_wan4 p 1 w 1 +lisp eid-table add eid 6:0:4::0/64 locator-set ls1 diff --git a/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh b/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh new file mode 100644 index 0000000..4b8abd9 --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_driver/smr_rtr_disjoint.sh @@ -0,0 +1,88 @@ +source config.sh +source odl_utils.sh +source topologies/smr_rtr_disjoint.sh + +# set odl config json file names; they are common among all rtr tests +ODL_CONFIG_FILE1="vpp1.json" +ODL_CONFIG_FILE2="vpp2.json" +ODL_CONFIG_FILE3="elp1.json" +ODL_CONFIG_FILE4="elp2.json" + +if [ "$1" == "clean" ] ; then + smr_rtr_disjoint_clean + exit 0 +fi + +if [[ $(id -u) != 0 ]]; then + echo "Error: run this as a root." + exit 1 +fi + +function test_ns_ping { + if [ "$1" != "${1#*[0-9].[0-9]}" ]; then + ip netns exec $2 ping -w 15 -c 1 "${1}" + rc=$? + elif [ "$1" != "${1#*:[0-9a-fA-F]}" ]; then + ip netns exec $2 ping6 -w 15 -c 1 "${1}" + rc=$? + else + echo "Unrecognized IP format '$1'" + fi + return $rc +} + +function test_smr_rtr_disjoint { + # CONFIGURE + smr_rtr_disjoint_setup + + if [ "$2" == "wait" ] ; then + read -p "press any key to continue .." -n1 + fi + + test_result=1 + rc=0 + + # TEST IP6 over IP4 + test_ns_ping $1 vpp1-ns + + rc=$? + + if [ $rc -ne 0 ] ; then + echo "Simple test failed: No ICMP response received within specified timeout limit!" + else + echo "Simple test passed." + test_result=0 + fi + + if [ "$2" == "wait" ] ; then + read -p "press any key to continue .." -n1 + fi + + # RECONFIGURE + smr_rtr_disjoint_reconfigure + + if [ "$2" == "wait" ] ; then + read -p "Topology reconfigured press any key to continue .." -n1 + fi + + # TEST IP6 over disjoing IP4 and IP6 underlay + test_ns_ping $1 vpp1-ns + + rc=$? + + if [ $rc -ne 0 ] ; then + echo "SMR+RTR test failed: No ICMP response received within specified timeout limit!" + else + echo "SMR+RTR test passed." + test_result=0 + fi + + if [ "$2" == "wait" ] ; then + read -p "press any key to continue .." -n1 + fi + + # CLEANUP + smr_rtr_disjoint_clean + + exit $test_result +} diff --git a/tests/data_plane/vpp_lite_topo/test_smr_rtr_disjoint.sh b/tests/data_plane/vpp_lite_topo/test_smr_rtr_disjoint.sh new file mode 100755 index 0000000..4d44ccb --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/test_smr_rtr_disjoint.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/smr_rtr_disjoint/" +ODL_CONFIG_DIR=`pwd`"/../configs/odl/smr_rtr_disjoint/" + +source test_driver/smr_rtr_disjoint.sh + +test_smr_rtr_disjoint "6:0:4::4" wait diff --git a/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh b/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh new file mode 100644 index 0000000..4bff1be --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/topologies/smr_rtr_disjoint.sh @@ -0,0 +1,143 @@ +#!/usr/bin/env bash + +function smr_rtr_disjoint_clean { + echo "Clearing all VPP instances.." + pkill vpp --signal 9 + + rm /dev/shm/* + + echo "Cleaning RTR topology.." + ip netns exec wan4-ns ifconfig vppbr1 down + ip netns exec wan4-ns brctl delbr vppbr1 + ip netns exec vpp2-rtr-ns ifconfig vppbr2 down + ip netns exec vpp2-rtr-ns brctl delbr vppbr2 + ip link del dev vpp1 &> /dev/null + ip link del dev vpp2 &> /dev/null + ip link del dev vpp1_wan4 &> /dev/null + ip link del dev rtr1_vpp1 &> /dev/null + ip link del dev vpp2_rtr &> /dev/null + ip link del dev rtr_vpp2 &> /dev/null + ip link del dev odl_vpp1 &> /dev/null + ip link del dev odl_vpp2 &> /dev/null + + ip netns del vpp1-ns &> /dev/null + ip netns del vpp2-ns &> /dev/null + ip netns del wan4-ns &> /dev/null + ip netns del vpp2-rtr-ns &> /dev/null + + odl_clear_all +} + +function smr_rtr_disjoint_setup { + # create namespaces + ip netns add vpp1-ns + ip netns add vpp2-ns + ip netns add wan4-ns + ip netns add vpp2-rtr-ns + + # create pair interfaces between vpp[1|2], rtr and odl + ip link add veth_vpp1_wan4 type veth peer name vpp1_wan4 + ip link add veth_rtr_wan4 type veth peer name rtr_wan4 + ip link add veth_vpp2_rtr type veth peer name vpp2_rtr + ip link add veth_vpp2_wan4 type veth peer name vpp2_wan4 + ip link add veth_rtr_vpp2 type veth peer name rtr_vpp2 + ip link add veth_odl_vpp1 type veth peer name odl_vpp1 + ip link add veth_odl_vpp2 type veth peer name odl_vpp2 + + # enable peer interfaces + ip link set dev vpp1_wan4 up + ip link set dev rtr_wan4 up + ip link set dev vpp2_rtr up + ip link set dev vpp2_wan4 up + ip link set dev rtr_vpp2 up + ip link set dev odl_vpp1 up + ip link set dev odl_vpp2 up + + # enable veth interfaces and set them in the appropriate ip ns + ip link set dev veth_vpp1_wan4 up netns wan4-ns + ip link set dev veth_rtr_wan4 up netns wan4-ns + ip link set dev veth_vpp2_rtr up netns vpp2-rtr-ns + ip link set dev veth_vpp2_wan4 up netns wan4-ns + ip link set dev veth_rtr_vpp2 up netns vpp2-rtr-ns + ip link set dev veth_odl_vpp1 up netns wan4-ns + ip link set dev veth_odl_vpp2 up netns vpp2-rtr-ns + + # vpp1, rtr and odl + ip netns exec wan4-ns brctl addbr vppbr1 + ip netns exec wan4-ns brctl addif vppbr1 veth_vpp1_wan4 + ip netns exec wan4-ns brctl addif vppbr1 veth_rtr_wan4 + ip netns exec wan4-ns brctl addif vppbr1 veth_vpp2_wan4 + ip netns exec wan4-ns brctl addif vppbr1 veth_odl_vpp1 + ip netns exec wan4-ns ifconfig vppbr1 up + + # vpp2, rtr and odl + ip netns exec vpp2-rtr-ns brctl addbr vppbr2 + ip netns exec vpp2-rtr-ns brctl addif vppbr2 veth_vpp2_rtr + ip netns exec vpp2-rtr-ns brctl addif vppbr2 veth_rtr_vpp2 + ip netns exec vpp2-rtr-ns brctl addif vppbr2 veth_odl_vpp2 + ip netns exec vpp2-rtr-ns ifconfig vppbr2 up + + # vpp1 to client + ip link add veth_vpp1 type veth peer name vpp1 + ip link set dev vpp1 up + ip link set dev veth_vpp1 up netns vpp1-ns + + ip netns exec vpp1-ns \ + bash -c " + ip link set dev lo up + ip addr add 6.0.2.2/24 dev veth_vpp1 + ip addr add 6:0:2::2/64 dev veth_vpp1 + ip route add 6.0.4.0/24 via 6.0.2.1 + ip route add 6:0:4::0/64 via 6:0:2::1 + " + + # vpp2 to client + ip link add veth_vpp2 type veth peer name vpp2 + ip link set dev vpp2 up + ip link set dev veth_vpp2 up netns vpp2-ns + + ip netns exec vpp2-ns \ + bash -c " + ip link set dev lo up + ip addr add 6.0.4.4/24 dev veth_vpp2 + ip addr add 6:0:4::4/64 dev veth_vpp2 + ip route add 6.0.2.0/24 via 6.0.4.1 + ip route add 6:0:2::0/64 via 6:0:4::1 + " + + # vpp1 to odl + ip addr add 6.0.3.100/24 dev odl_vpp1 + ip addr add 6:0:3::100/64 dev odl_vpp1 + ethtool --offload odl_vpp1 rx off tx off + + # vpp2 to odl + ip addr add 6.0.5.100/24 dev odl_vpp2 + ip addr add 6:0:5::100/64 dev odl_vpp2 + ethtool --offload odl_vpp2 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 } 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} + + ${VPP_LITE_BIN} \ + unix { log /tmp/rtr.log cli-listen \ + localhost:5004 full-coredump \ + exec ${VPP_LITE_CONF}/rtr.config } \ + api-trace { on } api-segment {prefix rtr} + + post_curl "add-mapping" ${ODL_CONFIG_FILE1} + post_curl "add-mapping" ${ODL_CONFIG_FILE2} +} + +function smr_rtr_disjoint_reconfigure { + post_curl "add-mapping" ${ODL_CONFIG_FILE3} + post_curl "add-mapping" ${ODL_CONFIG_FILE4} +} |