Add portal option to ete test script
[oom.git] / kubernetes / robot / demo-k8s.sh
index d5e7a03..c4124c2 100755 (executable)
@@ -1,4 +1,18 @@
-#!/bin/bash -x
+# Copyright © 2018 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+#!/bin/bash
 
 #
 # Execute tags built to support the hands on demo,
@@ -36,7 +50,11 @@ function usage
 }
 
 # Set the defaults
-if [ $# -le 2 ];then
+
+echo "Number of parameters:" 
+echo $#
+
+if [ $# -lt 2 ];then
        usage
        exit
 fi
@@ -47,9 +65,11 @@ shift
 ##
 ## if more than 1 tag is supplied, the must be provided with -i or -e
 ##
-while [ $# -gt 1 ]
+while [ $# -gt 0 ]
 do
-       key="$2"
+       key="$1"
+        echo "KEY:"
+        echo $key
 
        case $key in
        init_robot)
@@ -63,7 +83,7 @@ do
                        VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
                        shift
                        if [ $# -eq 2 ];then
-                               VARIABLES="$VARIABLES -v HOSTS_PREFIX:$2"
+                               VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
                        fi
                        shift
                        ;;
@@ -79,7 +99,7 @@ do
                        TAG="InitDistribution"
                        shift
                        if [ $# -eq 1 ];then
-                               VARIABLES="$VARIABLES -v DEMO_PREFIX:$2"
+                               VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
                        fi
                        shift
                        ;;
@@ -87,24 +107,24 @@ do
                        TAG="PreloadDemo"
                        shift
                        if [ $# -ne 2 ];then
-                               echo "Usage: demo.sh preload <vnf_name> <module_name>"
+                               echo "Usage: demo.sh <namespace> preload <vnf_name> <module_name>"
                                exit
                        fi
-                       VARIABLES="$VARIABLES -v VNF_NAME:$2"
+                       VARIABLES="$VARIABLES -v VNF_NAME:$1"
                        shift
-                       VARIABLES="$VARIABLES -v MODULE_NAME:$2"
+                       VARIABLES="$VARIABLES -v MODULE_NAME:$1"
                        shift
                        ;;
        appc)
-       TAG="APPCMountPointDemo"
-       shift
-       if [ $# -ne 1 ];then
-                       echo "Usage: demo.sh appc <module_name>"
-                       exit
-               fi
-       VARIABLES="$VARIABLES -v MODULE_NAME:$2"
-       shift
-       ;;
+                       TAG="APPCMountPointDemo"
+                       shift
+                       if [ $# -ne 1 ];then
+                                       echo "Usage: demo.sh <namespace> appc <module_name>"
+                                       exit
+                               fi
+                       VARIABLES="$VARIABLES -v MODULE_NAME:$1"
+                       shift
+                       ;;
        instantiateVFW)
                        TAG="instantiateVFW"
                        VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
@@ -114,10 +134,10 @@ do
                        TAG="deleteVNF"
                        shift
                        if [ $# -ne 1 ];then
-                               echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
+                               echo "Usage: demo.sh <namespace> deleteVNF <module_name from instantiateVFW>"
                                exit
                        fi
-                       VARFILE=$2.py
+                       VARFILE=$1.py
                        if [ -e /opt/eteshare/${VARFILE} ]; then
                                VARIABLES="$VARIABLES -V /share/${VARFILE}"
                        else
@@ -130,14 +150,14 @@ do
                        TAG="heatbridge"
                        shift
                        if [ $# -ne 3 ];then
-                               echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service>"
+                               echo "Usage: demo.sh <namespace> heatbridge <stack_name> <service_instance_id> <service>"
                                exit
                        fi
-                       VARIABLES="$VARIABLES -v HB_STACK:$2"
+                       VARIABLES="$VARIABLES -v HB_STACK:$1"
                        shift
-                       VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$2"
+                       VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
                        shift
-                       VARIABLES="$VARIABLES -v HB_SERVICE:$2"
+                       VARIABLES="$VARIABLES -v HB_SERVICE:$1"
                        shift
                        ;;
        *)
@@ -146,6 +166,8 @@ do
        esac
 done
 
+set -x
+
 ETEHOME=/var/opt/OpenECOMP_ETE
 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)