blob: 251388b26eaa840e836c5eceb44a55609fe6cf1e [file] [log] [blame]
Mandeep Khindad6ea9872017-06-24 11:49:37 -04001#!/bin/bash
2
3#
4# Execute tags built to support the hands on demo,
5#
6function usage
7{
8 echo "Usage: demo.sh <command> [<parameters>]"
9 echo " "
10 echo " demo.sh init"
11 echo " - Execute both init_customer + distribute"
12 echo " "
13 echo " demo.sh init_customer"
14 echo " - Create demo customer (Demonstration) and services, etc."
15 echo " "
Mandeep Khindac00c6872017-10-26 17:46:43 +000016 echo " demo.sh distribute [<prefix>]"
Mandeep Khindad6ea9872017-06-24 11:49:37 -040017 echo " - Distribute demo models (demoVFW and demoVLB)"
18 echo " "
19 echo " demo.sh preload <vnf_name> <module_name>"
20 echo " - Preload data for VNF for the <module_name>"
21 echo " "
22 echo " demo.sh appc <module_name>"
23 echo " - provide APPC with vFW module mount point for closed loop"
24 echo " "
25 echo " demo.sh init_robot"
26 echo " - Initialize robot after all ONAP VMs have started"
27 echo " "
28 echo " demo.sh instantiateVFW"
29 echo " - Instantiate vFW module for the a demo customer (DemoCust<uuid>)"
30 echo " "
31 echo " demo.sh deleteVNF <module_name from instantiateVFW>"
32 echo " - Delete the module created by instantiateVFW"
Alexis de Talhouët8e804c02017-12-07 16:23:15 -050033 echo " "
34 echo " demo.sh heatbridge <stack_name> <service_instance_id> <service>"
35 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
39if [ $# -eq 0 ];then
40 usage
41 exit
42fi
43##
44## if more than 1 tag is supplied, the must be provided with -i or -e
45##
46while [ $# -gt 0 ]
47do
48 key="$1"
49
50 case $key in
51 init_robot)
52 TAG="UpdateWebPage"
53 read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
54 if [ "$WEB_PASSWORD" = "" ]; then
55 echo ""
56 echo "WEB Password is required for user 'test'"
57 exit
58 fi
59 VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
60 shift
61 ;;
62 init)
63 TAG="InitDemo"
64 shift
65 ;;
66 init_customer)
67 TAG="InitCustomer"
68 shift
69 ;;
70 distribute)
71 TAG="InitDistribution"
72 shift
Mandeep Khindac00c6872017-10-26 17:46:43 +000073 if [ $# -eq 1 ];then
74 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
75 fi
76 shift
Mandeep Khindad6ea9872017-06-24 11:49:37 -040077 ;;
78 preload)
79 TAG="PreloadDemo"
80 shift
81 if [ $# -ne 2 ];then
82 echo "Usage: demo.sh preload <vnf_name> <module_name>"
83 exit
84 fi
85 VARIABLES="$VARIABLES -v VNF_NAME:$1"
86 shift
87 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
88 shift
89 ;;
90 appc)
91 TAG="APPCMountPointDemo"
92 shift
93 if [ $# -ne 1 ];then
94 echo "Usage: demo.sh appc <module_name>"
95 exit
96 fi
97 VARIABLES="$VARIABLES -v MODULE_NAME:$1"
98 shift
99 ;;
100 instantiateVFW)
101 TAG="instantiateVFW"
102 VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
103 shift
104 ;;
105 deleteVNF)
106 TAG="deleteVNF"
107 shift
108 if [ $# -ne 1 ];then
109 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
110 exit
111 fi
112 VARFILE=$1.py
113 if [ -e /opt/eteshare/${VARFILE} ]; then
114 VARIABLES="$VARIABLES -V /share/${VARFILE}"
115 else
116 echo "Cache file ${VARFILE} is not found"
117 exit
118 fi
Alexis de Talhouët8e804c02017-12-07 16:23:15 -0500119 shift
120 ;;
121 heatbridge)
122 TAG="heatbridge"
123 shift
124 if [ $# -ne 3 ];then
125 echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service>"
126 exit
127 fi
128 VARIABLES="$VARIABLES -v HB_STACK:$1"
129 shift
130 VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
131 shift
132 VARIABLES="$VARIABLES -v HB_SERVICE:$1"
Mandeep Khindad6ea9872017-06-24 11:49:37 -0400133 shift
134 ;;
135 *)
136 usage
137 exit
138 esac
139done
140
141ETEHOME=/var/opt/OpenECOMP_ETE
142VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
143POD=$(kubectl --namespace onap-robot get pods | sed 's/ .*//'| grep robot)
Alexis de Talhouëtec76c0c2017-11-30 14:37:02 -0500144kubectl --namespace onap-robot exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out