blob: d5e7a0384dbba347822166ac836418442dd651a2 [file] [log] [blame]
BorislavG8bfc6cf2018-02-27 15:04:26 +00001#!/bin/bash -x
Mandeep Khindad6ea9872017-06-24 11:49:37 -04002
3#
4# Execute tags built to support the hands on demo,
5#
6function usage
7{
BorislavG8bfc6cf2018-02-27 15:04:26 +00008 echo "Usage: demo.sh namespace <command> [<parameters>]"
Mandeep Khindad6ea9872017-06-24 11:49:37 -04009 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000010 echo " demo.sh <namespace> init"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040011 echo " - Execute both init_customer + distribute"
12 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000013 echo " demo.sh <namespace> init_customer"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040014 echo " - Create demo customer (Demonstration) and services, etc."
15 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000016 echo " demo.sh <namespace> distribute [<prefix>]"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040017 echo " - Distribute demo models (demoVFW and demoVLB)"
18 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000019 echo " demo.sh <namespace> preload <vnf_name> <module_name>"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040020 echo " - Preload data for VNF for the <module_name>"
21 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000022 echo " demo.sh <namespace> appc <module_name>"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040023 echo " - provide APPC with vFW module mount point for closed loop"
24 echo " "
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000025 echo " demo.sh <namespace> init_robot [ <etc_hosts_prefix> ]"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040026 echo " - Initialize robot after all ONAP VMs have started"
27 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000028 echo " demo.sh <namespace> instantiateVFW"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040029 echo " - Instantiate vFW module for the a demo customer (DemoCust<uuid>)"
30 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000031 echo " demo.sh <namespace> deleteVNF <module_name from instantiateVFW>"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040032 echo " - Delete the module created by instantiateVFW"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -050033 echo " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000034 echo " demo.sh <namespace> heatbridge <stack_name> <service_instance_id> <service>"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -050035 echo " - Run heatbridge against the stack for the given service instance and service"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040036}
37
38# Set the defaults
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000039if [ $# -le 2 ];then
Mandeep Khindad6ea9872017-06-24 11:49:37 -040040 usage
41 exit
42fi
BorislavG8bfc6cf2018-02-27 15:04:26 +000043
44NAMESPACE=$1
45shift
46
Mandeep Khindad6ea9872017-06-24 11:49:37 -040047##
48## if more than 1 tag is supplied, the must be provided with -i or -e
49##
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000050while [ $# -gt 1 ]
Mandeep Khindad6ea9872017-06-24 11:49:37 -040051do
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000052 key="$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040053
54 case $key in
55 init_robot)
56 TAG="UpdateWebPage"
57 read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
58 if [ "$WEB_PASSWORD" = "" ]; then
59 echo ""
60 echo "WEB Password is required for user 'test'"
61 exit
62 fi
63 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
64 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000065 if [ $# -eq 2 ];then
66 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$2"
67 fi
68 shift
Mandeep Khindad6ea9872017-06-24 11:49:37 -040069 ;;
70 init)
71 TAG="InitDemo"
72 shift
73 ;;
74 init_customer)
75 TAG="InitCustomer"
76 shift
77 ;;
78 distribute)
79 TAG="InitDistribution"
80 shift
Mandeep Khindac00c6872017-10-26 17:46:43 +000081 if [ $# -eq 1 ];then
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000082 VARIABLES="$VARIABLES -v DEMO_PREFIX:$2"
Mandeep Khindac00c6872017-10-26 17:46:43 +000083 fi
84 shift
Mandeep Khindad6ea9872017-06-24 11:49:37 -040085 ;;
86 preload)
87 TAG="PreloadDemo"
88 shift
89 if [ $# -ne 2 ];then
90 echo "Usage: demo.sh preload <vnf_name> <module_name>"
91 exit
92 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000093 VARIABLES="$VARIABLES -v VNF_NAME:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040094 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000095 VARIABLES="$VARIABLES -v MODULE_NAME:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040096 shift
97 ;;
98 appc)
99 TAG="APPCMountPointDemo"
100 shift
101 if [ $# -ne 1 ];then
102 echo "Usage: demo.sh appc <module_name>"
103 exit
104 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000105 VARIABLES="$VARIABLES -v MODULE_NAME:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400106 shift
107 ;;
108 instantiateVFW)
109 TAG="instantiateVFW"
110 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
111 shift
112 ;;
113 deleteVNF)
114 TAG="deleteVNF"
115 shift
116 if [ $# -ne 1 ];then
117 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
118 exit
119 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000120 VARFILE=$2.py
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400121 if [ -e /opt/eteshare/${VARFILE} ]; then
122 VARIABLES="$VARIABLES -V /share/${VARFILE}"
123 else
124 echo "Cache file ${VARFILE} is not found"
125 exit
126 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000127 shift
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500128 ;;
129 heatbridge)
130 TAG="heatbridge"
131 shift
132 if [ $# -ne 3 ];then
133 echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service>"
134 exit
135 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000136 VARIABLES="$VARIABLES -v HB_STACK:$2"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500137 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000138 VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$2"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500139 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000140 VARIABLES="$VARIABLES -v HB_SERVICE:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400141 shift
142 ;;
143 *)
144 usage
145 exit
146 esac
147done
148
149ETEHOME=/var/opt/OpenECOMP_ETE
150VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
BorislavG8bfc6cf2018-02-27 15:04:26 +0000151POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
152kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out