Correct variable references for namespace shift
[oom.git] / kubernetes / robot / demo-k8s.sh
index 23fc555..f5e4398 100755 (executable)
@@ -22,7 +22,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 +36,11 @@ function usage
 }
 
 # Set the defaults
-if [ $# -le 1 ];then
+
+echo "Number of parameters:" 
+echo $#
+
+if [ $# -lt 2 ];then
        usage
        exit
 fi
@@ -50,6 +54,8 @@ shift
 while [ $# -gt 0 ]
 do
        key="$1"
+        echo "KEY:"
+        echo $key
 
        case $key in
        init_robot)
@@ -62,6 +68,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 +93,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 +102,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 +120,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 +130,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"