b8df99eed118c969d90524b854912f884e9fd39b
[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 instantiateVFW | instantiateVFWCL"
29     echo "               - Instantiate vFW or vFWCL 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"
33         echo " "
34         echo "       demo.sh heatbridge <stack_name> <service_instance_id> <service> [<ipv4-oam-address>]"
35     echo "               - Run heatbridge against the stack for the given service instance and service"
36 }
37
38 # Set the defaults
39 if [ $# -eq 0 ];then
40         usage
41         exit
42 fi
43 ##
44 ## if more than 1 tag is supplied, the must be provided with -i or -e
45 ##
46 while [ $# -gt 0 ]
47 do
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                         if [ $# -eq 1 ];then
62                                 VARIABLES="$VARIABLES -v HOSTS_PREFIX:$1"
63                         fi
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
77                         if [ $# -eq 1 ];then
78                                 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
79                         fi
80                         shift
81                         ;;
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         instantiateVFWCL)
110                         TAG="instantiateVFWCL"
111                         VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
112                         shift
113                         ;;
114         deleteVNF)
115                         TAG="deleteVNF"
116                         shift
117                         if [ $# -ne 1 ];then
118                                 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
119                                 exit
120                         fi
121                         VARFILE=$1.py
122                         if [ -e /opt/eteshare/${VARFILE} ]; then
123                                 VARIABLES="$VARIABLES -V /share/${VARFILE}"
124                         else
125                                 echo "Cache file ${VARFILE} is not found"
126                                 exit
127                         fi
128                         shift
129                         ;;
130         heatbridge)
131                         TAG="heatbridge"
132                         shift
133                         if [ $# -lt 3 ];then
134                                 echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service> [<ipv4-oam-address>]"
135                                 exit
136                         fi
137                         VARIABLES="$VARIABLES -v HB_STACK:$1"
138                         shift
139                         VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$1"
140                         shift
141                         VARIABLES="$VARIABLES -v HB_SERVICE:$1"
142                         shift
143                         VARIABLES="$VARIABLES -v HB_IPV4_OAM_ADDRESS:$1"
144             shift
145                         ;;
146         *)
147                         usage
148                         exit
149         esac
150 done
151
152 ETEHOME=/var/opt/OpenECOMP_ETE
153 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
154 docker exec openecompete_container ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out