Bug fix, can`t create new interface
[one.git] / tests / data_plane / vpp_lite_topo / lisp_test.sh
index 9d33283..2f09abb 100755 (executable)
@@ -1,5 +1,17 @@
 #!/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 statick mapping, whit out ODL"
+  echo "        remote6 - test statick mapping for IPv6, whit out ODL"
+  exit 0
+fi
+
 set -x
 
 # path to vpp executable and configurations folder
@@ -10,17 +22,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,10 +60,17 @@ 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
+  curl -X DELETE http://${ODL_IP}:${ODL_PORT}/restconf/config/odl-mappingservice:mapping-database/ \
+       -u ${ODL_USER}:${ODL_PASSWD}
+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
@@ -83,11 +114,31 @@ 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
+
+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           \
@@ -110,7 +161,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 +169,20 @@ 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
 
+if [ "$1" == "remote" ] ; then
+  source lisp_remote_mapping.sh
+fi
+
+if [ "$1" == "remote6" ] ; then
+  source lisp_6_remote_mapping.sh
+fi
+
+echo "Success"