blob: f5e43989400285afecced5437f63e9bc978fb0a9 [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
Brian Freeman7e13acc2018-05-15 17:49:50 -050072 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
Mandeep Khinda7ea563e2018-04-17 03:26:26 +000073 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
Brian Freeman7e13acc2018-05-15 17:49:50 -050088 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
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
Brian Freeman7e13acc2018-05-15 17:49:50 -050096 echo "Usage: demo.sh <namespace> preload <vnf_name> <module_name>"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040097 exit
98 fi
Brian Freeman7e13acc2018-05-15 17:49:50 -050099 VARIABLES="$VARIABLES -v VNF_NAME:$1"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400100 shift
Brian Freeman7e13acc2018-05-15 17:49:50 -0500101 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400102 shift
103 ;;
104 appc)
Brian Freeman7e13acc2018-05-15 17:49:50 -0500105 TAG="APPCMountPointDemo"
106 shift
107 if [ $# -ne 1 ];then
108 echo "Usage: demo.sh <namespace> appc <module_name>"
109 exit
110 fi
111 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
112 shift
113 ;;
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400114 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
Brian Freeman7e13acc2018-05-15 17:49:50 -0500123 echo "Usage: demo.sh <namespace> deleteVNF <module_name from instantiateVFW>"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400124 exit
125 fi
Brian Freeman7e13acc2018-05-15 17:49:50 -0500126 VARFILE=$1.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
Brian Freeman7e13acc2018-05-15 17:49:50 -0500139 echo "Usage: demo.sh <namespace> heatbridge <stack_name> <service_instance_id> <service>"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500140 exit
141 fi
Brian Freeman7e13acc2018-05-15 17:49:50 -0500142 VARIABLES="$VARIABLES -v HB_STACK:$1"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500143 shift
Brian Freeman7e13acc2018-05-15 17:49:50 -0500144 VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500145 shift
Brian Freeman7e13acc2018-05-15 17:49:50 -0500146 VARIABLES="$VARIABLES -v HB_SERVICE:$1"
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