Added PT to openstack connector. Additional tests included
[osm/RO.git] / test / basictest.sh
index 5b7dca5..b15269a 100755 (executable)
@@ -39,6 +39,7 @@ function usage(){
     echo -e "    --screen         forces to run openmano (and openvim) service in a screen"
     echo -e "    --insert-bashrc  insert the created tenant,datacenter variables at"
     echo -e "                     ~/.bashrc to be available by openmano CLI"
+    echo -e "    --install-openvim   install openvim in test mode"
     echo -e "    --init-openvim   if openvim runs locally, an init is called to clean openvim"
     echo -e "                      database and add fake hosts"
 }
@@ -57,7 +58,7 @@ DIRscript=${DIRmano}/scripts
 
 
 #process options
-source ${DIRscript}/get-options.sh "force:f help:h insert-bashrc init-openvim screen" $* || $_exit 1
+source ${DIRscript}/get-options.sh "force:f help:h insert-bashrc init-openvim install-openvim screen" $* || $_exit 1
 
 #help
 [ -n "$option_help" ] && usage && $_exit 0
@@ -72,7 +73,7 @@ action_list=""
 
 for argument in $params
 do
-    if [[ $argument == reset ]] || [[ $argument == create ]] || [[ $argument == delete ]]
+    if [[ $argument == reset ]] || [[ $argument == create ]] || [[ $argument == delete ]] || [[ -z "$argument" ]]
     then
         action_list="$action_list $argument"
         continue
@@ -88,6 +89,22 @@ export OPENMANO_PORT=9090
 
 #by default action should be reset and create
 [[ -z $action_list ]]  && action_list="reset create delete"
+
+if [[ -n "$option_install_openvim" ]] 
+then
+    mkdir -p ${DIRNAME}/local
+    pushd ${DIRNAME}/local
+    echo "installing openvim at  ${DIRNAME}/openvim ... "
+    wget -O install-openvim.sh "https://osm.etsi.org/gitweb/?p=osm/openvim.git;a=blob_plain;f=scripts/install-openvim.sh"
+    chmod +x install-openvim.sh
+    sudo ./install-openvim.sh --no-install-packages --force --quiet --develop
+    export alias initopenvim="${PWD}/openvim/scripts/initopenvim.sh"
+    export alias openvim="${PWD}/openvim/scripts/openvim"
+    option_init_openvim=""
+    ${DIRNAME}/local/openvim/scripts/initopenvim.sh${force_param}${insert_bashrc_param}${screen_vim_param} || echo "WARNING openvim cannot be initialized. The rest of test can fail!"
+
+    popd
+fi
 [[ -z "$option_init_openvim" ]] || initopenvim${force_param}${insert_bashrc_param}${screen_vim_param} || echo "WARNING openvim cannot be initialized. The rest of test can fail!"
 
 #check openvim client variables are set
@@ -135,11 +152,13 @@ then
     ${DIRmano}/openmano instance-scenario-delete -f complex2-instance   || echo "fail"
     ${DIRmano}/openmano instance-scenario-delete -f complex3-instance   || echo "fail"
     ${DIRmano}/openmano instance-scenario-delete -f complex4-instance   || echo "fail"
+    ${DIRmano}/openmano instance-scenario-delete -f complex5-instance   || echo "fail"
     ${DIRmano}/openmano scenario-delete -f simple           || echo "fail"
     ${DIRmano}/openmano scenario-delete -f complex          || echo "fail"
     ${DIRmano}/openmano scenario-delete -f complex2         || echo "fail"
     ${DIRmano}/openmano scenario-delete -f complex3         || echo "fail"
     ${DIRmano}/openmano scenario-delete -f complex4         || echo "fail"
+    ${DIRmano}/openmano scenario-delete -f complex5         || echo "fail"
     ${DIRmano}/openmano vnf-delete -f linux                 || echo "fail"
     ${DIRmano}/openmano vnf-delete -f linux_2VMs_v02        || echo "fail"
     ${DIRmano}/openmano vnf-delete -f dataplaneVNF_2VMs     || echo "fail"
@@ -167,8 +186,8 @@ then
     [[ -z $OPENVIM_HOST ]] && OPENVIM_HOST=localhost
     [[ -z $OPENVIM_PORT ]] && OPENVIM_PORT=9080
     URL_ADMIN_PARAM=""
-    [[ -n $OPENVIM_ADMIN_PORT ]] && URL_ADMIN_PARAM="--url_admin=http://${OPENVIM_HOST}:${OPENVIM_ADMIN_PORT}/openvim"
-    result=`${DIRmano}/openmano datacenter-create TEST-dc "http://${OPENVIM_HOST}:${OPENVIM_PORT}/openvim" --type=openvim $URL_ADMIN_PARAM`
+    [[ -n $OPENVIM_ADMIN_PORT ]] && URL_ADMIN_PARAM=" --url_admin=http://${OPENVIM_HOST}:${OPENVIM_ADMIN_PORT}/openvim"
+    result=`${DIRmano}/openmano datacenter-create TEST-dc "http://${OPENVIM_HOST}:${OPENVIM_PORT}/openvim" --type=openvim${URL_ADMIN_PARAM} --config="{test: no use just for test}"`
     datacenter=`echo $result |gawk '{print $1}'`
     #check a valid uuid is obtained
     ! is_valid_uuid $datacenter && echo "FAIL" && echo "    $result" && $_exit 1
@@ -177,7 +196,7 @@ then
     [[ -n "$option_insert_bashrc" ]] && echo -e "\nexport OPENMANO_DATACENTER=$datacenter"  >> ~/.bashrc
 
     printf "%-50s" "Attaching openmano tenant to the datacenter:"
-    result=`${DIRmano}/openmano datacenter-attach TEST-dc`
+    result=`${DIRmano}/openmano datacenter-attach TEST-dc --config="{test: no use just for test}"`
     [[ $? != 0 ]] && echo  "FAIL" && echo "    $result" && $_exit 1
     echo OK
 
@@ -197,7 +216,7 @@ then
         ! is_valid_uuid $vnf && echo FAIL && echo "    $result" &&  $_exit 1
         echo $vnf
     done
-    for NS in simple complex complex2 complex3 complex4
+    for NS in simple complex complex2 complex3 complex4 complex5
     do
         printf "%-50s" "Creating scenario '${NS}':"
         result=`$DIRmano/openmano scenario-create $DIRmano/scenarios/examples/${NS}.yaml`
@@ -206,7 +225,7 @@ then
         echo $scenario
     done
 
-    for IS in simple complex complex2 complex3
+    for IS in simple complex complex2 complex3 complex5
     do
         printf "%-50s" "Creating instance-scenario '${IS}':"
         result=`$DIRmano/openmano instance-scenario-create  --scenario ${IS} --name ${IS}-instance`