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 |
Brian Freeman | 2706630 | 2018-04-23 17:24:35 -0500 | [diff] [blame] | 39 | |
| 40 | echo "Number of parameters:" |
| 41 | echo $# |
| 42 | |
| 43 | if [ $# -lt 2 ];then |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 44 | usage |
| 45 | exit |
| 46 | fi |
BorislavG | 8bfc6cf | 2018-02-27 15:04:26 +0000 | [diff] [blame] | 47 | |
| 48 | NAMESPACE=$1 |
| 49 | shift |
| 50 | |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 51 | ## |
| 52 | ## if more than 1 tag is supplied, the must be provided with -i or -e |
| 53 | ## |
Brian Freeman | 2706630 | 2018-04-23 17:24:35 -0500 | [diff] [blame] | 54 | while [ $# -gt 0 ] |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 55 | do |
Brian Freeman | 2706630 | 2018-04-23 17:24:35 -0500 | [diff] [blame] | 56 | key="$1" |
| 57 | echo "KEY:" |
| 58 | echo $key |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 59 | |
| 60 | case $key in |
| 61 | init_robot) |
| 62 | TAG="UpdateWebPage" |
| 63 | read -s -p "WEB Site Password for user 'test': " WEB_PASSWORD |
| 64 | if [ "$WEB_PASSWORD" = "" ]; then |
| 65 | echo "" |
| 66 | echo "WEB Password is required for user 'test'" |
| 67 | exit |
| 68 | fi |
| 69 | VARIABLES="$VARIABLES -v WEB_PASSWORD:$WEB_PASSWORD" |
| 70 | shift |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 71 | if [ $# -eq 2 ];then |
| 72 | VARIABLES="$VARIABLES -v HOSTS_PREFIX:$2" |
| 73 | fi |
| 74 | shift |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 75 | ;; |
| 76 | init) |
| 77 | TAG="InitDemo" |
| 78 | shift |
| 79 | ;; |
| 80 | init_customer) |
| 81 | TAG="InitCustomer" |
| 82 | shift |
| 83 | ;; |
| 84 | distribute) |
| 85 | TAG="InitDistribution" |
| 86 | shift |
Mandeep Khinda | c00c687 | 2017-10-26 17:46:43 +0000 | [diff] [blame] | 87 | if [ $# -eq 1 ];then |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 88 | VARIABLES="$VARIABLES -v DEMO_PREFIX:$2" |
Mandeep Khinda | c00c687 | 2017-10-26 17:46:43 +0000 | [diff] [blame] | 89 | fi |
| 90 | shift |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 91 | ;; |
| 92 | preload) |
| 93 | TAG="PreloadDemo" |
| 94 | shift |
| 95 | if [ $# -ne 2 ];then |
| 96 | echo "Usage: demo.sh preload <vnf_name> <module_name>" |
| 97 | exit |
| 98 | fi |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 99 | VARIABLES="$VARIABLES -v VNF_NAME:$2" |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 100 | shift |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 101 | VARIABLES="$VARIABLES -v MODULE_NAME:$2" |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 102 | shift |
| 103 | ;; |
| 104 | appc) |
| 105 | TAG="APPCMountPointDemo" |
| 106 | shift |
| 107 | if [ $# -ne 1 ];then |
| 108 | echo "Usage: demo.sh appc <module_name>" |
| 109 | exit |
| 110 | fi |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 111 | VARIABLES="$VARIABLES -v MODULE_NAME:$2" |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 112 | shift |
| 113 | ;; |
| 114 | instantiateVFW) |
| 115 | TAG="instantiateVFW" |
| 116 | VARIABLES="$VARIABLES -v GLOBAL_BUILD_NUMBER:$$" |
| 117 | shift |
| 118 | ;; |
| 119 | deleteVNF) |
| 120 | TAG="deleteVNF" |
| 121 | shift |
| 122 | if [ $# -ne 1 ];then |
| 123 | echo "Usage: demo.sh deleteVNF <module_name from instantiateVFW>" |
| 124 | exit |
| 125 | fi |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 126 | VARFILE=$2.py |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 127 | if [ -e /opt/eteshare/${VARFILE} ]; then |
| 128 | VARIABLES="$VARIABLES -V /share/${VARFILE}" |
| 129 | else |
| 130 | echo "Cache file ${VARFILE} is not found" |
| 131 | exit |
| 132 | fi |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 133 | shift |
Alexis de Talhouët | 8e804c0 | 2017-12-07 16:23:15 -0500 | [diff] [blame] | 134 | ;; |
| 135 | heatbridge) |
| 136 | TAG="heatbridge" |
| 137 | shift |
| 138 | if [ $# -ne 3 ];then |
| 139 | echo "Usage: demo.sh heatbridge <stack_name> <service_instance_id> <service>" |
| 140 | exit |
| 141 | fi |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 142 | VARIABLES="$VARIABLES -v HB_STACK:$2" |
Alexis de Talhouët | 8e804c0 | 2017-12-07 16:23:15 -0500 | [diff] [blame] | 143 | shift |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 144 | VARIABLES="$VARIABLES -v HB_SERVICE_INSTANCE_ID:$2" |
Alexis de Talhouët | 8e804c0 | 2017-12-07 16:23:15 -0500 | [diff] [blame] | 145 | shift |
Mandeep Khinda | 7ea563e | 2018-04-17 03:26:26 +0000 | [diff] [blame] | 146 | VARIABLES="$VARIABLES -v HB_SERVICE:$2" |
Mandeep Khinda | d6ea987 | 2017-06-24 11:49:37 -0400 | [diff] [blame] | 147 | shift |
| 148 | ;; |
| 149 | *) |
| 150 | usage |
| 151 | exit |
| 152 | esac |
| 153 | done |
| 154 | |
| 155 | ETEHOME=/var/opt/OpenECOMP_ETE |
| 156 | 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] | 157 | POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot) |
| 158 | kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/demo/${TAG} -i ${TAG} --display 89 2> ${TAG}.out |