Merge "update log helm chart from 2 to 3.0.0"
[oom.git] / kubernetes / robot / demo-k8s.sh
index 23fc555..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,
@@ -22,7 +36,7 @@ function usage
        echo "       demo.sh <namespace> appc <module_name>"
     echo "               - provide APPC with vFW module mount point for closed loop"
        echo " "
-       echo "       demo.sh <namespace> init_robot"
+       echo "       demo.sh <namespace> init_robot [ <etc_hosts_prefix> ]"
     echo "               - Initialize robot after all ONAP VMs have started"
        echo " "
        echo "       demo.sh <namespace> instantiateVFW"
@@ -36,7 +50,11 @@ function usage
 }
 
 # Set the defaults
-if [ $# -le 1 ];then
+
+echo "Number of parameters:" 
+echo $#
+
+if [ $# -lt 2 ];then
        usage
        exit
 fi
@@ -50,6 +68,8 @@ shift
 while [ $# -gt 0 ]
 do
        key="$1"
+        echo "KEY:"
+        echo $key
 
        case $key in
        init_robot)
@@ -62,6 +82,10 @@ do
                        fi
                        VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
                        shift
+                       if [ $# -eq 2 ];then
+                               VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
+                       fi
+                       shift
                        ;;
        init)
                        TAG="InitDemo"
@@ -83,7 +107,7 @@ 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:$1"
@@ -92,15 +116,15 @@ do
                        shift
                        ;;
        appc)
-       TAG="APPCMountPointDemo"
-       shift
-       if [ $# -ne 1 ];then
-                       echo "Usage: demo.sh appc <module_name>"
-                       exit
-               fi
-       VARIABLES="$VARIABLES -v MODULE_NAME:$1"
-       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:$$"
@@ -110,7 +134,7 @@ 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=$1.py
@@ -120,13 +144,13 @@ do
                                echo "Cache file ${VARFILE} is not found"
                                exit
                        fi
-      shift
+                       shift
                        ;;
        heatbridge)
                        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:$1"
@@ -142,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)