onap on kubernetes source files
[oom.git] / kubernetes / config / docker / init / src / config / robot / demo-docker.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"
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"
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"
33 }
34
35 # Set the defaults
36 if [ $# -eq 0 ];then
37         usage
38         exit
39 fi
40 ##
41 ## if more than 1 tag is supplied, the must be provided with -i or -e
42 ##
43 while [ $# -gt 0 ]
44 do
45         key="$1"
46
47         case $key in
48         init_robot)
49                         TAG="UpdateWebPage"
50                         read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD
51                         if [ "$WEB_PASSWORD" = "" ]; then
52                                 echo ""
53                                 echo "WEB Password is required for user 'test'"
54                                 exit
55                         fi
56                         VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD"
57                         shift
58                         ;;
59         init)
60                         TAG="InitDemo"
61                         shift
62                         ;;
63         init_customer)
64                         TAG="InitCustomer"
65                         shift
66                         ;;
67         distribute)
68                         TAG="InitDistribution"
69                         shift
70                         ;;
71         preload)
72                         TAG="PreloadDemo"
73                         shift
74                         if [ $# -ne 2 ];then
75                                 echo "Usage: demo.sh preload <vnf_name> <module_name>"
76                                 exit
77                         fi
78                         VARIABLES="$VARIABLES -v VNF_NAME:$1"
79                         shift
80                         VARIABLES="$VARIABLES -v MODULE_NAME:$1"
81                         shift
82                         ;;
83         appc)
84         TAG="APPCMountPointDemo"
85         shift
86         if [ $# -ne 1 ];then
87                         echo "Usage: demo.sh appc <module_name>"
88                         exit
89                 fi
90         VARIABLES="$VARIABLES -v MODULE_NAME:$1"
91         shift
92         ;;
93         instantiateVFW)
94                         TAG="instantiateVFW"
95                         VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
96                         shift
97                         ;;
98         deleteVNF)
99                         TAG="deleteVNF"
100                         shift
101                         if [ $# -ne 1 ];then
102                                 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
103                                 exit
104                         fi
105                         VARFILE=$1.py
106                         if [ -e /opt/eteshare/${VARFILE} ]; then
107                                 VARIABLES="$VARIABLES -V /share/${VARFILE}"
108                         else
109                                 echo "Cache file ${VARFILE} is not found"
110                                 exit
111                         fi
112                         shift
113                         ;;
114         *)
115                         usage
116                         exit
117         esac
118 done
119
120 ETEHOME=/var/opt/OpenECOMP_ETE
121 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
122 CONTAINER_ID=`docker ps |grep robot |grep onap-robot|grep -v gcr|awk '{print $1}'`
123 docker exec ${CONTAINER_ID} ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d ${ETEHOME}/html/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out