blob: 23fc555dc5be134667c2d222f7807e42888b920f [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 " "
BorislavG8bfc6cf2018-02-27 15:04:26 +000025 echo " demo.sh <namespace> init_robot"
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
BorislavG8bfc6cf2018-02-27 15:04:26 +000039if [ $# -le 1 ];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##
50while [ $# -gt 0 ]
51do
52 key="$1"
53
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
65 ;;
66 init)
67 TAG="InitDemo"
68 shift
69 ;;
70 init_customer)
71 TAG="InitCustomer"
72 shift
73 ;;
74 distribute)
75 TAG="InitDistribution"
76 shift
Mandeep Khindac00c6872017-10-26 17:46:43 +000077 if [ $# -eq 1 ];then
78 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
79 fi
80 shift
Mandeep Khindad6ea9872017-06-24 11:49:37 -040081 ;;
82 preload)
83 TAG="PreloadDemo"
84 shift
85 if [ $# -ne 2 ];then
86 echo "Usage: demo.sh preload <vnf_name> <module_name>"
87 exit
88 fi
89 VARIABLES="$VARIABLES -v VNF_NAME:$1"
90 shift
91 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
92 shift
93 ;;
94 appc)
95 TAG="APPCMountPointDemo"
96 shift
97 if [ $# -ne 1 ];then
98 echo "Usage: demo.sh appc <module_name>"
99 exit
100 fi
101 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
102 shift
103 ;;
104 instantiateVFW)
105 TAG="instantiateVFW"
106 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
107 shift
108 ;;
109 deleteVNF)
110 TAG="deleteVNF"
111 shift
112 if [ $# -ne 1 ];then
113 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
114 exit
115 fi
116 VARFILE=$1.py
117 if [ -e /opt/eteshare/${VARFILE} ]; then
118 VARIABLES="$VARIABLES -V /share/${VARFILE}"
119 else
120 echo "Cache file ${VARFILE} is not found"
121 exit
122 fi
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500123 shift
124 ;;
125 heatbridge)
126 TAG="heatbridge"
127 shift
128 if [ $# -ne 3 ];then
129 echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service>"
130 exit
131 fi
132 VARIABLES="$VARIABLES -v HB_STACK:$1"
133 shift
134 VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
135 shift
136 VARIABLES="$VARIABLES -v HB_SERVICE:$1"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400137 shift
138 ;;
139 *)
140 usage
141 exit
142 esac
143done
144
145ETEHOME=/var/opt/OpenECOMP_ETE
146VARIABLEFILES="-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 +0000147POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
148kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out