blob: de3362740ece420bc08267521448b527c081e782 [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
Brian Freeman27066302018-04-23 17:24:35 -050039
40echo "Number of parameters:"
41echo $#
42
43if [ $# -lt 2 ];then
Mandeep Khindad6ea9872017-06-24 11:49:37 -040044 usage
45 exit
46fi
BorislavG8bfc6cf2018-02-27 15:04:26 +000047
48NAMESPACE=$1
49shift
50
Mandeep Khindad6ea9872017-06-24 11:49:37 -040051##
52## if more than 1 tag is supplied, the must be provided with -i or -e
53##
Brian Freeman27066302018-04-23 17:24:35 -050054while [ $# -gt 0 ]
Mandeep Khindad6ea9872017-06-24 11:49:37 -040055do
Brian Freeman27066302018-04-23 17:24:35 -050056 key="$1"
57 echo "KEY:"
58 echo $key
Mandeep Khindad6ea9872017-06-24 11:49:37 -040059
60 case $key in
61 init_robot)
62 TAG="UpdateWebPage"
63 read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
64 if [ "$WEB_PASSWORD" = "" ]; then
65 echo ""
66 echo "WEB Password is required for user 'test'"
67 exit
68 fi
69 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
70 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000071 if [ $# -eq 2 ];then
72 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$2"
73 fi
74 shift
Mandeep Khindad6ea9872017-06-24 11:49:37 -040075 ;;
76 init)
77 TAG="InitDemo"
78 shift
79 ;;
80 init_customer)
81 TAG="InitCustomer"
82 shift
83 ;;
84 distribute)
85 TAG="InitDistribution"
86 shift
Mandeep Khindac00c6872017-10-26 17:46:43 +000087 if [ $# -eq 1 ];then
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000088 VARIABLES="$VARIABLES -v DEMO_PREFIX:$2"
Mandeep Khindac00c6872017-10-26 17:46:43 +000089 fi
90 shift
Mandeep Khindad6ea9872017-06-24 11:49:37 -040091 ;;
92 preload)
93 TAG="PreloadDemo"
94 shift
95 if [ $# -ne 2 ];then
96 echo "Usage: demo.sh preload <vnf_name> <module_name>"
97 exit
98 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000099 VARIABLES="$VARIABLES -v VNF_NAME:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400100 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000101 VARIABLES="$VARIABLES -v MODULE_NAME:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400102 shift
103 ;;
104 appc)
105 TAG="APPCMountPointDemo"
106 shift
107 if [ $# -ne 1 ];then
108 echo "Usage: demo.sh appc <module_name>"
109 exit
110 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000111 VARIABLES="$VARIABLES -v MODULE_NAME:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400112 shift
113 ;;
114 instantiateVFW)
115 TAG="instantiateVFW"
116 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
117 shift
118 ;;
119 deleteVNF)
120 TAG="deleteVNF"
121 shift
122 if [ $# -ne 1 ];then
123 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
124 exit
125 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000126 VARFILE=$2.py
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400127 if [ -e /opt/eteshare/${VARFILE} ]; then
128 VARIABLES="$VARIABLES -V /share/${VARFILE}"
129 else
130 echo "Cache file ${VARFILE} is not found"
131 exit
132 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000133 shift
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500134 ;;
135 heatbridge)
136 TAG="heatbridge"
137 shift
138 if [ $# -ne 3 ];then
139 echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service>"
140 exit
141 fi
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000142 VARIABLES="$VARIABLES -v HB_STACK:$2"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500143 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000144 VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$2"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500145 shift
Mandeep Khinda7ea563e2018-04-17 03:26:26 +0000146 VARIABLES="$VARIABLES -v HB_SERVICE:$2"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400147 shift
148 ;;
149 *)
150 usage
151 exit
152 esac
153done
154
155ETEHOME=/var/opt/OpenECOMP_ETE
156VARIABLEFILES="-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 +0000157POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
158kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out