Merge "Fix MSO encrypted password on long namespaces"
[oom.git] / kubernetes / robot / demo-k8s.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"
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                         if [ $# -eq 1 ];then
71                                 VARIABLES="$VARIABLES -v DEMO_PREFIX:$1"
72                         fi
73                         shift
74                         ;;
75         preload)
76                         TAG="PreloadDemo"
77                         shift
78                         if [ $# -ne 2 ];then
79                                 echo "Usage: demo.sh preload <vnf_name> <module_name>"
80                                 exit
81                         fi
82                         VARIABLES="$VARIABLES -v VNF_NAME:$1"
83                         shift
84                         VARIABLES="$VARIABLES -v MODULE_NAME:$1"
85                         shift
86                         ;;
87         appc)
88         TAG="APPCMountPointDemo"
89         shift
90         if [ $# -ne 1 ];then
91                         echo "Usage: demo.sh appc <module_name>"
92                         exit
93                 fi
94         VARIABLES="$VARIABLES -v MODULE_NAME:$1"
95         shift
96         ;;
97         instantiateVFW)
98                         TAG="instantiateVFW"
99                         VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$"
100                         shift
101                         ;;
102         deleteVNF)
103                         TAG="deleteVNF"
104                         shift
105                         if [ $# -ne 1 ];then
106                                 echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>"
107                                 exit
108                         fi
109                         VARFILE=$1.py
110                         if [ -e /opt/eteshare/${VARFILE} ]; then
111                                 VARIABLES="$VARIABLES -V /share/${VARFILE}"
112                         else
113                                 echo "Cache file ${VARFILE} is not found"
114                                 exit
115                         fi
116                         shift
117                         ;;
118         *)
119                         usage
120                         exit
121         esac
122 done
123
124 ETEHOME=/var/opt/OpenECOMP_ETE
125 VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py"
126 POD=$(kubectl --namespace onap-robot get pods | sed 's/ .*//'| grep robot)
127 kubectl --namespace onap-robot exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d ${ETEHOME}/html/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out