56cfbabef97bdaf481619cecf04dbbe034e2adef
[demo.git] / boot / robot / demo.sh
1 #!/bin/bash
2
3 #
4 # Execute tags built to support the hands on demo,
5 #
6 function 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 " "
16         echo "       demo.sh distribute  [<prefix>]"
17         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 [ <etc_hosts_prefix> ]"
26     echo "               - Initialize robot after all ONAP VMs have started"
27         echo " "
28         echo "       demo.sh cds"
29     echo "               - Instantiate vFW service with Controller Design Studio feature for the a demo customer (DemoCust<uuid>)"
30         echo " "
31         echo "       demo.sh instantiateVFW | instantiateVFWCL"
32     echo "               - Instantiate vFW or vFWCL module for the a demo customer (DemoCust<uuid>)"
33         echo " "
34         echo "       demo.sh deleteVNF <module_name from instantiateVFW>"
35     echo "               - Delete the module created by instantiateVFW"
36         echo " "
37         echo "       demo.sh heatbridge <stack_name> <service_instance_id> <service> [<ipv4-oam-address>]"
38     echo "               - Run heatbridge against the stack for the given service instance and service"
39 }
40
41 # Set the defaults
42 if [ $# -eq 0 ];then
43         usage
44         exit
45 fi
46 ##
47 ## if more than 1 tag is supplied, the must be provided with -i or -e
48 ##
49 while [ $# -gt 0 ]
50 do
51         key="$1"
52
53         case $key in
54         init_robot)
55                         TAG="UpdateWebPage"
56                         read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
57                         if [ "$WEB_PASSWORD" = "" ]; then
58                                 echo ""
59                                 echo "WEB Password is required for user 'test'"
60                                 exit
61                         fi
62                         VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
63                         shift
64                         if [ $# -eq 1 ];then
65                                 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
66                         fi
67                         shift
68                         ;;
69         init)
70                         TAG="InitDemo"
71                         shift
72                         ;;
73         init_customer)
74                         TAG="InitCustomer"
75                         shift
76                         ;;
77         distribute)
78                         TAG="InitDistribution"
79                         shift
80                         if [ $# -eq 1 ];then
81                                 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
82                         fi
83                         shift
84                         ;;
85         preload)
86                         TAG="PreloadDemo"
87                         shift
88                         if [ $# -ne 2 ];then
89                                 echo "Usage: demo.sh preload <vnf_name> <module_name>"
90                                 exit
91                         fi
92                         VARIABLES="$VARIABLES -v VNF_NAME:$1"
93                         shift
94                         VARIABLES="$VARIABLES -v MODULE_NAME:$1"
95                         shift
96                         ;;
97         appc)
98         TAG="APPCMountPointDemo"
99         shift
100         if [ $# -ne 1 ];then
101                         echo "Usage: demo.sh appc <module_name>"
102                         exit
103                 fi
104         VARIABLES="$VARIABLES -v MODULE_NAME:$1"
105         shift
106         ;;
107         instantiateVFW)
108                         TAG="instantiateVFW"
109                         VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
110                         shift
111                         ;;
112         instantiateVFWCL)
113                         TAG="instantiateVFWCL"
114                         VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
115                         shift
116                         ;;
117         deleteVNF)
118                         TAG="deleteVNF"
119                         shift
120                         if [ $# -ne 1 ];then
121                                 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
122                                 exit
123                         fi
124                         VARFILE=$1.py
125                         if [ -e /opt/eteshare/${VARFILE} ]; then
126                                 VARIABLES="$VARIABLES -V /share/${VARFILE}"
127                         else
128                                 echo "Cache file ${VARFILE} is not found"
129                                 exit
130                         fi
131                         shift
132                         ;;
133         heatbridge)
134                         TAG="heatbridge"
135                         shift
136                         if [ $# -lt 3 ];then
137                                 echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service> [<ipv4-oam-address>]"
138                                 exit
139                         fi
140                         VARIABLES="$VARIABLES -v HB_STACK:$1"
141                         shift
142                         VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
143                         shift
144                         VARIABLES="$VARIABLES -v HB_SERVICE:$1"
145                         shift
146                         VARIABLES="$VARIABLES -v HB_IPV4_OAM_ADDRESS:$1"
147             shift
148                         ;;
149         cds)
150                         TAG="cds"
151                         shift
152                         ;;
153         *)
154                         usage
155                         exit
156         esac
157 done
158
159 ETEHOME=/var/opt/OpenECOMP_ETE
160 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
161 docker exec openecompete_container ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out