diff options
Diffstat (limited to 'tests/data_plane/vpp_lite_topo')
-rw-r--r-- | tests/data_plane/vpp_lite_topo/README | 8 | ||||
-rw-r--r-- | tests/data_plane/vpp_lite_topo/lisp_ip4.sh | 12 | ||||
-rw-r--r-- | tests/data_plane/vpp_lite_topo/lisp_ip4o6.sh | 41 | ||||
-rw-r--r-- | tests/data_plane/vpp_lite_topo/lisp_ip6.sh | 12 | ||||
-rw-r--r-- | tests/data_plane/vpp_lite_topo/lisp_ip6o4.sh | 41 | ||||
-rwxr-xr-x | tests/data_plane/vpp_lite_topo/lisp_test.sh | 48 |
6 files changed, 140 insertions, 22 deletions
diff --git a/tests/data_plane/vpp_lite_topo/README b/tests/data_plane/vpp_lite_topo/README index a7ab39e..1b526c9 100644 --- a/tests/data_plane/vpp_lite_topo/README +++ b/tests/data_plane/vpp_lite_topo/README @@ -12,4 +12,10 @@ Please before use, set variable VPP_LITE_BIN to your vpp_lite in file lisp_test. ./lisp_test ip6 # Test ip4 and ip6 topology -./lisp_test all +./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/lisp_ip4.sh b/tests/data_plane/vpp_lite_topo/lisp_ip4.sh index f817a96..a03b0cb 100644 --- a/tests/data_plane/vpp_lite_topo/lisp_ip4.sh +++ b/tests/data_plane/vpp_lite_topo/lisp_ip4.sh @@ -22,12 +22,8 @@ sudo ip netns exec vppns2 \ ip route add 6.0.1.0/24 via 6.0.2.1 " -curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG1}" \ - -u ${ODL_USER}:${ODL_PASSWD} -curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG2}" \ - -u ${ODL_USER}:${ODL_PASSWD} +post_curl "add-mapping" ${ODL_ADD_CONFIG1} +post_curl "add-mapping" ${ODL_ADD_CONFIG2} ping_lisp @@ -40,8 +36,6 @@ send "set int ip address host-intervpp2 6.0.3.20/24\r" expect -re ".*>" EOF -curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:update-mapping \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_REPLACE_CONFIG2}" \ - -u ${ODL_USER}:${ODL_PASSWD} +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 new file mode 100644 index 0000000..edc3ffa --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/lisp_ip4o6.sh @@ -0,0 +1,41 @@ +#!/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 index c49ecbf..103f113 100644 --- a/tests/data_plane/vpp_lite_topo/lisp_ip6.sh +++ b/tests/data_plane/vpp_lite_topo/lisp_ip6.sh @@ -22,12 +22,8 @@ sudo ip netns exec vppns2 \ ip route add 6:0:1::0/64 via 6:0:2::1 " -curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG1_6}" \ - -u ${ODL_USER}:${ODL_PASSWD} -curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:add-mapping \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_ADD_CONFIG2_6}" \ - -u ${ODL_USER}:${ODL_PASSWD} +post_curl "add-mapping" ${ODL_ADD_CONFIG1_6} +post_curl "add-mapping" ${ODL_ADD_CONFIG2_6} ping_lisp6 @@ -40,8 +36,6 @@ send "set int ip address host-intervpp2 6:0:3::20/64\r" expect -re ".*>" EOF -curl -X POST http://${ODL_IP}:${ODL_PORT}/restconf/operations/odl-mappingservice:update-mapping \ - -H "Content-Type: application/json" --data-binary "@${ODL_CONFIG_DIR}${ODL_REPLACE_CONFIG2_6}" \ - -u ${ODL_USER}:${ODL_PASSWD} +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 new file mode 100644 index 0000000..3da810e --- /dev/null +++ b/tests/data_plane/vpp_lite_topo/lisp_ip6o4.sh @@ -0,0 +1,41 @@ +#!/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_test.sh b/tests/data_plane/vpp_lite_topo/lisp_test.sh index 9d33283..9e3070e 100755 --- a/tests/data_plane/vpp_lite_topo/lisp_test.sh +++ b/tests/data_plane/vpp_lite_topo/lisp_test.sh @@ -1,5 +1,15 @@ #!/usr/bin/env bash +if [ "$1" == "-h" ] || [ "$1" == "-help" ] ; then + echo "lisp_test.sh [ip4] [ip6] [ip4_ip6] [4o6] [6o4]" + 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" + exit 0 +fi + set -x # path to vpp executable and configurations folder @@ -10,17 +20,29 @@ 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" 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} +} + # make sure there are no vpp instances running sudo pkill vpp @@ -36,6 +58,9 @@ sudo ip netns del vppns1 &> /dev/null sudo ip netns del vppns2 &> /dev/null sudo ip netns del intervppns &> /dev/null +curl -X DELETE http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database/ \ + -u ${ODL_USER}:${ODL_PASSWD} + if [ "$1" == "clean" ] ; then exit 0; fi @@ -83,11 +108,21 @@ if [ "$1" == "ip6" ] ; then VPP2_CONF="vpp2_6.conf" fi -if [ "$1" == "all" ] ; then +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 + # start vpp1 and vpp2 in separate chroot sudo $VPP_LITE_BIN \ unix { log /tmp/vpp1.log cli-listen \ @@ -110,7 +145,7 @@ if [ "$1" == "ip6" ] ; then source lisp_ip6.sh fi -if [ "$1" == "all" ] ; then +if [ "$1" == "ip4_ip6" ] ; then source lisp_ip4.sh source lisp_ip6.sh @@ -118,5 +153,12 @@ if [ "$1" == "all" ] ; then ping_lisp6 fi -echo "Success" +if [ "$1" == "4o6" ] ; then + source lisp_ip4o6.sh +fi +if [ "$1" == "6o4" ] ; then + source lisp_ip6o4.sh +fi + +echo "Success" |