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