Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 1 | #!/bin/bash |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 2 | # Copyright 2019 Ciena Corporation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
David Bainbridge | d049a61 | 2020-03-16 17:22:54 -0700 | [diff] [blame] | 15 | set -f |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 16 | TOTAL_START_TIME=$(date +%s) |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 17 | |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 18 | FANCY=${FANCY:-1} |
| 19 | if [ "$TERM X" == " X" ]; then |
| 20 | FANCY=0 |
| 21 | fi |
| 22 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 23 | # trap ctrl-c and call ctrl_c() |
| 24 | trap ctrl_c INT |
| 25 | |
| 26 | function ctrl_c() { |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 27 | echo -en $CNORM |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 28 | echo "" |
| 29 | echo "ctrl-c trapped" |
David Bainbridge | c6a6eb6 | 2019-10-18 22:50:07 +0000 | [diff] [blame] | 30 | echo "Thank you for trying 'voltha up'" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 31 | exit |
| 32 | } |
| 33 | |
David K. Bainbridge | ebf38d9 | 2020-02-10 10:46:31 -0800 | [diff] [blame] | 34 | VOLTCTL_VERSION=${VOLTCTL_VERSION:-latest} |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 35 | KIND_VERSION=${KIND_VERSION:-v0.5.1} |
David K. Bainbridge | b3a9937 | 2020-01-08 14:39:06 -0800 | [diff] [blame] | 36 | VK_RELEASE=${VK_RELEASE:-master} |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 37 | |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 38 | BLACK= |
| 39 | RED= |
| 40 | GREEN= |
| 41 | YELLOW= |
| 42 | BLUE= |
| 43 | MAGENTA= |
| 44 | CYAN= |
| 45 | WHITE= |
| 46 | BOLD= |
| 47 | NORMAL= |
| 48 | ERROR= |
| 49 | CEOL= |
| 50 | CNORM= |
| 51 | CIVIS= |
| 52 | if [ $FANCY -eq 1 ]; then |
| 53 | BLACK=$(tput setaf 0) |
| 54 | RED=$(tput setaf 1) |
| 55 | GREEN=$(tput setaf 2) |
| 56 | YELLOW=$(tput setaf 3) |
| 57 | BLUE=$(tput setaf 4) |
| 58 | MAGENTA=$(tput setaf 5) |
| 59 | CYAN=$(tput setaf 6) |
| 60 | WHITE=$(tput setaf 7) |
| 61 | BOLD=$(tput bold) |
| 62 | NORMAL=$(tput sgr0) |
| 63 | ERROR="\xe2\x9c\x97\x20" |
| 64 | CEOL=$(tput el) |
| 65 | CNORM=$(tput cnorm) |
| 66 | CIVIS=$(tput civis) |
| 67 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 68 | |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 69 | TYPE=${TYPE:-minimal} |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 70 | NAME=${NAME:-$TYPE} |
David K. Bainbridge | 484d80c | 2020-03-05 21:44:34 -0800 | [diff] [blame] | 71 | |
| 72 | ENABLE_ONOS_EXTRANEOUS_RULES=${ENABLE_ONOS_EXTRANEOUS_RULES:-no} |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 73 | WITH_TIMINGS=${WITH_TIMINGS:-no} |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 74 | WITH_BBSIM=${WITH_BBSIM:-no} |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 75 | WITH_RADIUS=${WITH_RADIUS:-no} |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 76 | WITH_EAPOL=${WITH_EAPOL:-yes} |
| 77 | WITH_DHCP=${WITH_DHCP:-yes} |
| 78 | WITH_IGMP=${WITH_IGMP:-no} |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 79 | WITH_ONOS=${WITH_ONOS:-yes} |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 80 | WITH_CHAOS=${WITH_CHAOS:-no} |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 81 | WITH_ADAPTERS=${WITH_ADAPTERS:-yes} |
David K. Bainbridge | da33d65 | 2020-03-06 10:31:23 -0800 | [diff] [blame] | 82 | WITH_SIM_ADAPTERS=${WITH_SIM_ADAPTERS:-no} |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 83 | WITH_OPEN_ADAPTERS=${WITH_OPEN_ADAPTERS:-yes} |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 84 | WITH_PORT_FORWARDS=${WITH_PORT_FORWARDS:-yes} |
David Bainbridge | 05cd882 | 2019-11-19 17:43:53 +0000 | [diff] [blame] | 85 | ONLY_ONE=${ONLY_ONE:-yes} |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 86 | CONFIG_SADIS=${CONFIG_SADIS:-no} # yes | no | file | bbsim | URL |
| 87 | SADIS_SUBSCRIBERS=${SADIS_SUBSCRIBERS:-http://bbsim.voltha.svc:50074/v2/subscribers/%s} |
| 88 | SADIS_BANDWIDTH_PROFILES=${SADIS_BANDWIDTH_PROFILES:-http://bbsim.voltha.svc:50074/v2/bandwidthprofiles/%s} |
Hardik Windlass | b314760 | 2020-03-09 16:59:15 +0530 | [diff] [blame] | 89 | SADIS_CFG=${SADIS_CFG:-onos-files/onos-sadis-sample.json} |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 90 | INSTALL_ONOS_APPS=${INSTALL_ONOS_APPS:-no} |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 91 | JUST_K8S=${JUST_K8S:-no} |
| 92 | DEPLOY_K8S=${DEPLOY_K8S:-yes} |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 93 | INSTALL_KUBECTL=${INSTALL_KUBECTL:-yes} |
| 94 | INSTALL_HELM=${INSTALL_HELM:-yes} |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 95 | UPDATE_HELM_REPOS=${UPDATE_HELM_REPOS:-yes} |
Matteo Scandolo | fab9862 | 2020-01-28 15:17:20 -0800 | [diff] [blame] | 96 | WAIT_ON_DOWN=${WAIT_ON_DOWN:-yes} |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 97 | VOLTHA_LOG_LEVEL=${VOLTHA_LOG_LEVEL:-WARN} |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 98 | VOLTHA_CHART=${VOLTHA_CHART:-onf/voltha} |
| 99 | VOLTHA_CHART_VERSION=${VOLTHA_CHART_VERSION:-latest} |
| 100 | VOLTHA_BBSIM_CHART=${VOLTHA_BBSIM_CHART:-onf/bbsim} |
Matteo Scandolo | dcd29f5 | 2019-10-07 15:42:42 -0700 | [diff] [blame] | 101 | VOLTHA_BBSIM_CHART_VERSION=${VOLTHA_BBSIM_CHART_VERSION:-latest} |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 102 | VOLTHA_ADAPTER_SIM_CHART=${VOLTHA_ADAPTER_SIM_CHART:-onf/voltha-adapter-simulated} |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 103 | VOLTHA_ADAPTER_SIM_CHART_VERSION=${VOLTHA_ADAPTER_SIM_CHART_VERSION:-latest} |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 104 | VOLTHA_ADAPTER_OPEN_OLT_CHART=${VOLTHA_ADAPTER_OPEN_OLT_CHART:-onf/voltha-adapter-openolt} |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 105 | VOLTHA_ADAPTER_OPEN_OLT_CHART_VERSION=${VOLTHA_ADAPTER_OPEN_OLT_CHART_VERSION:-latest} |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 106 | VOLTHA_ADAPTER_OPEN_ONU_CHART=${VOLTHA_ADAPTER_OPEN_ONU_CHART:-onf/voltha-adapter-openonu} |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 107 | VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION=${VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION:-latest} |
David K. Bainbridge | da33d65 | 2020-03-06 10:31:23 -0800 | [diff] [blame] | 108 | ONOS_CHART=${ONOS_CHART:-onf/onos} |
Andrea Campanella | 2132329 | 2019-12-18 11:44:19 -0800 | [diff] [blame] | 109 | ONOS_CHART_VERSION=${ONOS_CHART_VERSION:-latest} |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 110 | EXTRA_HELM_INSTALL_ARGS= |
uottremb | b16d398 | 2020-02-28 08:34:36 +0100 | [diff] [blame] | 111 | NUM_OF_BBSIM=${NUM_OF_BBSIM:-1} |
| 112 | MAX_NUM_OF_BBSIM=10 |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 113 | |
| 114 | HAVE_GO=$(which go >/dev/null 2>&1 && echo "yes" || echo "no") |
| 115 | HOSTOS=$(uname -s | tr "[:upper:]" "[:lower:"]) |
| 116 | HOSTARCH=$(uname -m | tr "[:upper:]" "[:lower:"]) |
| 117 | if [ $HOSTARCH == "x86_64" ]; then |
| 118 | HOSTARCH="amd64" |
| 119 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 120 | |
uottremb | b16d398 | 2020-02-28 08:34:36 +0100 | [diff] [blame] | 121 | # check number (range) of bbsim, max bbsim must not exceed 10 instances! |
| 122 | # note: instances will be numbered from 0 to 9 |
| 123 | if [ "$1" == "up" ]; then |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 124 | if [ "$NUM_OF_BBSIM" -lt 1 ]; then |
| 125 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of BBSIM instances. NUM_OF_BBSIM is less than 1${NORMAL}" |
| 126 | exit 1 |
| 127 | fi |
| 128 | if [ "$NUM_OF_BBSIM" -gt $MAX_NUM_OF_BBSIM ]; then |
| 129 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of BBSIM instances. NUM_OF_BBSIM is greater than $MAX_NUM_OF_BBSIM${NORMAL}" |
| 130 | exit 1 |
| 131 | fi |
uottremb | b16d398 | 2020-02-28 08:34:36 +0100 | [diff] [blame] | 132 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 133 | # Verify TYPE setting |
| 134 | if [ $(echo ":minimal:full:" | grep -ic ":$TYPE:") -eq 0 ]; then |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 135 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$TYPE value of '$TYPE'. Should be 'minimal' or 'full'${NORMAL}" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 136 | exit 1 |
| 137 | fi |
| 138 | |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 139 | function get_service_ep() { |
| 140 | local NS=$1 |
| 141 | local NAME=$2 |
| 142 | kubectl -n $NS get service $NAME -o json | jq -r '.spec.clusterIP + ":" + (.spec.ports[0].port|tostring)' |
| 143 | } |
| 144 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 145 | # Used to verify configuration values are set to "yes" or "no" value or convert |
| 146 | # equivalents to "yes" or "no" |
| 147 | function verify_yes_no() { |
| 148 | local VAR=$1 |
| 149 | local VAL=$(eval echo \$$VAR) |
| 150 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$VAL:") -eq 0 ]; then |
| 151 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid '$VAR' value of '$VAL'. Should be 'yes' or 'no'${NORMAL}" |
| 152 | echo "INVALID" |
| 153 | return 1 |
| 154 | fi |
| 155 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$VAL:") -eq 1 ]; then |
| 156 | echo "yes" |
| 157 | else |
| 158 | echo "no" |
| 159 | fi |
| 160 | return 0 |
| 161 | } |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 162 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 163 | ALL_YES_NO="\ |
David K. Bainbridge | 484d80c | 2020-03-05 21:44:34 -0800 | [diff] [blame] | 164 | ENABLE_ONOS_EXTRANEOUS_RULES \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 165 | WITH_TIMINGS \ |
| 166 | WITH_BBSIM \ |
| 167 | WITH_RADIUS \ |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 168 | WITH_EAPOL \ |
| 169 | WITH_DHCP \ |
| 170 | WITH_IGMP \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 171 | WITH_ONOS \ |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 172 | WITH_CHAOS \ |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 173 | WITH_ADAPTERS \ |
| 174 | WITH_SIM_ADAPTERS \ |
| 175 | WITH_OPEN_ADAPTERS \ |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 176 | WITH_PORT_FORWARDS \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 177 | JUST_K8S \ |
| 178 | DEPLOY_K8S \ |
| 179 | INSTALL_ONOS_APPS \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 180 | INSTALL_KUBECTL \ |
| 181 | INSTALL_HELM \ |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 182 | UPDATE_HELM_REPOS \ |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 183 | WAIT_ON_DOWN \ |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 184 | ONLY_ONE \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 185 | " |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 186 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 187 | ALL_OPTIONS="\ |
| 188 | NAME \ |
| 189 | TYPE \ |
| 190 | $ALL_YES_NO \ |
| 191 | VOLTHA_LOG_LEVEL \ |
| 192 | VOLTHA_CHART \ |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 193 | VOLTHA_CHART_VERSION \ |
| 194 | VOLTHA_BBSIM_CHART \ |
| 195 | VOLTHA_BBSIM_CHART_VERSION \ |
uottremb | d5a2057 | 2020-03-06 09:15:01 +0100 | [diff] [blame] | 196 | NUM_OF_BBSIM \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 197 | VOLTHA_ADAPTER_SIM_CHART \ |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 198 | VOLTHA_ADAPTER_SIM_CHART_VERSION \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 199 | VOLTHA_ADAPTER_OPEN_OLT_CHART \ |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 200 | VOLTHA_ADAPTER_OPEN_OLT_CHART_VERSION \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 201 | VOLTHA_ADAPTER_OPEN_ONU_CHART \ |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 202 | VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION \ |
David K. Bainbridge | da33d65 | 2020-03-06 10:31:23 -0800 | [diff] [blame] | 203 | ONOS_CHART \ |
Andrea Campanella | 2132329 | 2019-12-18 11:44:19 -0800 | [diff] [blame] | 204 | ONOS_CHART_VERSION \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 205 | ONOS_API_PORT \ |
| 206 | ONOS_SSH_PORT \ |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 207 | CONFIG_SADIS \ |
Hardik Windlass | b314760 | 2020-03-09 16:59:15 +0530 | [diff] [blame] | 208 | SADIS_CFG \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 209 | VOLTHA_API_PORT \ |
| 210 | VOLTHA_SSH_PORT \ |
| 211 | VOLTHA_ETCD_PORT \ |
David K. Bainbridge | 00ecd38 | 2020-02-28 12:31:58 -0800 | [diff] [blame] | 212 | VOLTHA_KAFKA_PORT \ |
David K. Bainbridge | 8f7f30b | 2020-01-08 13:06:16 -0800 | [diff] [blame] | 213 | VK_RELEASE \ |
| 214 | KIND_VERSION \ |
| 215 | VOLTCTL_VERSION \ |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 216 | " |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 217 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame] | 218 | # Iterate over yes/no configuration options and validate |
| 219 | for VAR in $ALL_YES_NO; do |
| 220 | eval $VAR=$(verify_yes_no $VAR) |
| 221 | if [ "$(eval echo \$$VAR)" == "INVALID" ]; then |
| 222 | exit 1; |
| 223 | fi |
| 224 | done |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 225 | |
David K. Bainbridge | da33d65 | 2020-03-06 10:31:23 -0800 | [diff] [blame] | 226 | # Check for prerequiste tools |
David K. Bainbridge | 726ff6a | 2020-03-06 11:09:50 -0800 | [diff] [blame] | 227 | TOOLS="curl sed jq" |
David K. Bainbridge | da33d65 | 2020-03-06 10:31:23 -0800 | [diff] [blame] | 228 | if [ $DEPLOY_K8S == "yes" ]; then |
| 229 | TOOLS+=" docker" |
| 230 | fi |
| 231 | NOT_FOUND="" |
| 232 | for T in $TOOLS; do |
| 233 | if [ -z "$(which $T)" ]; then |
| 234 | NOT_FOUND+=" $T" |
| 235 | fi |
| 236 | done |
| 237 | |
| 238 | if [ ! -z "$NOT_FOUND" ]; then |
| 239 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} The following required tools where not found, please install them:$NOT_FOUND" |
| 240 | exit 1 |
| 241 | fi |
| 242 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 243 | mkdir -p .voltha |
| 244 | touch .voltha/ports |
| 245 | HAVE=$(grep $NAME .voltha/ports) |
| 246 | if [ "$HAVE X" == " X" ]; then |
| 247 | # Find free port prefix |
| 248 | START=81 |
| 249 | while true; do |
| 250 | if [ $(grep -c $START .voltha/ports) -eq 0 ]; then |
| 251 | break |
| 252 | fi |
| 253 | START=$(expr $START + 1) |
| 254 | done |
| 255 | DELTA=$(expr $START - 81) |
David Bainbridge | a259542 | 2019-10-22 03:54:28 +0000 | [diff] [blame] | 256 | ONOS_API_PORT=${ONOS_API_PORT:-${START}81} |
| 257 | ONOS_SSH_PORT=${ONOS_SSH_PORT:-${START}01} |
| 258 | VOLTHA_API_PORT=${VOLTHA_API_PORT:-5$(expr 55 + $DELTA)55} |
| 259 | VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-$(expr 50 + $DELTA)22} |
| 260 | VOLTHA_ETCD_PORT=${VOLTHA_ETCD_PORT:-$(expr 23 + $DELTA)79} |
David K. Bainbridge | 00ecd38 | 2020-02-28 12:31:58 -0800 | [diff] [blame] | 261 | VOLTHA_KAFKA_PORT=${VOLTHA_KAFKA_PORT:-$(expr 90 + $DELTA)92} |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 262 | else |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 263 | VALUES=$(echo $HAVE | sed -e 's/\s//g' | cut -d= -f2) |
David Bainbridge | a259542 | 2019-10-22 03:54:28 +0000 | [diff] [blame] | 264 | ONOS_API_PORT=${ONOS_API_PORT:-$(echo $VALUES | cut -d, -f1)} |
| 265 | ONOS_SSH_PORT=${ONOS_SSH_PORT:-$(echo $VALUES | cut -d, -f2)} |
| 266 | VOLTHA_API_PORT=${VOLTHA_API_PORT:-$(echo $VALUES | cut -d, -f3)} |
| 267 | VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-$(echo $VALUES | cut -d, -f4)} |
| 268 | VOLTHA_ETCD_PORT=${VOLTHA_ETCD_PORT:-$(echo $VALUES | cut -d, -f5)} |
David K. Bainbridge | 00ecd38 | 2020-02-28 12:31:58 -0800 | [diff] [blame] | 269 | VOLTHA_KAFKA_PORT=${VOLTHA_KAFKA_PORT:-$(echo $VALUES | cut -d, -f6)} |
| 270 | |
David K. Bainbridge | 00ecd38 | 2020-02-28 12:31:58 -0800 | [diff] [blame] | 271 | # A bit of a hueristic required here as the KAFKA port forward was |
| 272 | # added after the .voltha/ports files was created. Basically, if |
| 273 | # the VOLTHA_KAFKA_PORT isn't in the file then calculate the original |
| 274 | # DELTA from the VOLTHA_SSH_PORT and apply it to the VOLTHA_KAFKA_PORT |
| 275 | if [ -z "$VOLTHA_KAFKA_PORT" ]; then |
| 276 | DELTA=$((VOLTHA_SSH_PORT/100-50)) |
| 277 | VOLTHA_KAFKA_PORT=${VOLTHA_KAFKA_PORT:-$(expr 90 + $DELTA)92} |
| 278 | fi |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 279 | fi |
| 280 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 281 | PORTTMP=$(mktemp -u) |
| 282 | cat .voltha/ports | grep -v $NAME > $PORTTMP |
David K. Bainbridge | 00ecd38 | 2020-02-28 12:31:58 -0800 | [diff] [blame] | 283 | echo "$NAME=$ONOS_API_PORT,$ONOS_SSH_PORT,$VOLTHA_API_PORT,$VOLTHA_SSH_PORT,$VOLTHA_ETCD_PORT,$VOLTHA_KAFKA_PORT" >> $PORTTMP |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 284 | cp $PORTTMP .voltha/ports |
| 285 | rm -f $PORTTMP |
| 286 | |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 287 | export ONOS_API_PORT ONOS_SSH_PORT |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 288 | |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 289 | IDX=1 |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 290 | CLOCK="TIME:" |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 291 | SPIN_PARTS= |
| 292 | NOT_VERIFIED= |
David Bainbridge | f858a02 | 2019-08-14 21:25:11 +0000 | [diff] [blame] | 293 | THEX= |
| 294 | BUILD= |
| 295 | CROSS= |
| 296 | ENTER= |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 297 | VERIFIED= |
| 298 | HELM= |
| 299 | OLD_KEY= |
| 300 | BIRD= |
| 301 | HIGH_VOLTAGE= |
| 302 | PLUG= |
| 303 | RESTART= |
| 304 | FORWARD= |
| 305 | INSTALL= |
| 306 | STOP= |
| 307 | GO= |
| 308 | DOWNLOAD= |
| 309 | GEAR= |
| 310 | NO_ENTRY= |
| 311 | LOCK= |
| 312 | |
| 313 | if [ $FANCY -eq 1 ]; then |
| 314 | SPIN_PARTS="\ |
| 315 | \xe2\xa2\x8e\xe2\xa1\xb0 \ |
| 316 | \xe2\xa2\x8e\xe2\xa1\xa1 \ |
| 317 | \xe2\xa2\x8e\xe2\xa1\x91 \ |
| 318 | \xe2\xa2\x8e\xe2\xa0\xb1 \ |
| 319 | \xe2\xa0\x8e\xe2\xa1\xb1 \ |
| 320 | \xe2\xa2\x8a\xe2\xa1\xb1 \ |
| 321 | \xe2\xa2\x8c\xe2\xa1\xb1 \ |
| 322 | \xe2\xa2\x86\xe2\xa1\xb1 \ |
| 323 | " |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 324 | CLOCK="\xe2\x8f\xb1" |
David Bainbridge | f858a02 | 2019-08-14 21:25:11 +0000 | [diff] [blame] | 325 | THEX="${RED}${BOLD}\xe2\x9c\x97\x20${NORMAL}" |
| 326 | ENTER="${YELLOW}${BOLD}\xe2\x8e\x86${NORMAL}" |
| 327 | CROSS="${YELLOW}${BOLD}\xe2\x9c\x9a${NORMAL}" |
| 328 | BUILD="${YELLOW}${BOLD}\xf0\x9f\x8f\x97${NORMAL}" |
| 329 | NOT_VERIFIED="$BUILD" |
| 330 | VERIFIED="${GREEN}${BOLD}\xe2\x9c\x93\x20${NORMAL}" |
| 331 | HELM="${BLUE}${BOLD}\xE2\x8E\x88${NORMAL}" |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 332 | OLD_KEY="\xF0\x9F\x97\x9D" |
| 333 | BIRD="\xF0\x9F\x90\xA6" |
| 334 | HIGH_VOLTAGE="\xE2\x9A\xA1" |
| 335 | PLUG="\xF0\x9F\xa7\xa9" |
| 336 | RESTART="\xf0\x9f\x94\x84" |
| 337 | FORWARD="\xE2\x87\xA8" |
| 338 | INSTALL="\xF0\x9F\x8F\x97" |
| 339 | STOP="\xf0\x9f\x9b\x91" |
| 340 | GO="\xf0\x9f\x9a\x80" |
| 341 | DOWNLOAD="\xf0\x9f\x93\xa5" |
| 342 | GEAR="\xe2\x9a\x99" |
| 343 | NO_ENTRY="\xe2\x9b\x94" |
| 344 | LOCK="\xf0\x9f\x94\x92" |
| 345 | fi |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 346 | |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 347 | duration() { |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 348 | local h=$(expr $1 / 3600) |
| 349 | local m=$(expr $1 % 3600 / 60) |
| 350 | local s=$(expr $1 % 60) |
| 351 | local t="" |
| 352 | |
| 353 | if [ $h -gt 0 ]; then |
| 354 | t="$t${h}h" |
| 355 | fi |
| 356 | if [ $m -gt 0 ]; then |
| 357 | t="$t${m}m" |
| 358 | fi |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 359 | echo "$t${s}s" |
| 360 | } |
| 361 | |
| 362 | printtime() { |
| 363 | local INDENT= |
| 364 | if [ "$1" == "-" ]; then |
| 365 | INDENT=" " |
| 366 | shift |
| 367 | fi |
| 368 | echo -e "$INDENT $CLOCK $(duration $1)" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 369 | } |
| 370 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 371 | bspin() { |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 372 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 373 | local INDENT= |
| 374 | if [ "$1" == "-" ]; then |
| 375 | INDENT=" " |
| 376 | shift |
| 377 | fi |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 378 | if [ $FANCY -eq 0 ]; then |
| 379 | LINE=$(echo $* | sed -e 's/[\s+-]//g') |
| 380 | if [ "$LINE X" == " X" ]; then |
| 381 | return |
| 382 | fi |
| 383 | echo -e "$CIVIS$INDENT$*" |
| 384 | else |
| 385 | echo -en "$CIVIS$INDENT $*" |
| 386 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 387 | } |
| 388 | |
| 389 | sspin() { |
| 390 | local INDENT= |
| 391 | if [ "$1" == "-" ]; then |
| 392 | INDENT=" " |
| 393 | shift |
| 394 | fi |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 395 | if [ $FANCY -eq 0 ]; then |
| 396 | LINE=$(echo $* | sed -e 's/[\s+-]//g') |
| 397 | if [ "$LINE X" == " X" ]; then |
| 398 | return |
| 399 | fi |
| 400 | echo -e "$INDENT$*" |
| 401 | else |
| 402 | C=$(echo $SPIN_PARTS | cut '-d ' -f $IDX) |
| 403 | echo -en "\r$INDENT$C $*" |
| 404 | IDX=$(expr $IDX + 1) |
| 405 | if [ $IDX -gt 8 ]; then |
| 406 | IDX=1 |
| 407 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 408 | fi |
| 409 | } |
| 410 | |
| 411 | espin() { |
| 412 | local INDENT= |
| 413 | if [ "$1" == "-" ]; then |
| 414 | INDENT=" " |
| 415 | shift |
| 416 | fi |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 417 | if [ $FANCY -eq 0 ]; then |
| 418 | LINE=$(echo $* | sed -e 's/[\s+-]//g') |
| 419 | if [ "$LINE X" == " X" ]; then |
| 420 | return |
| 421 | fi |
| 422 | echo -e "$INDENT$*" |
| 423 | else |
| 424 | echo -e "\r$INDENT$*$CNORM" |
| 425 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 426 | } |
| 427 | |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 428 | if [ "$1" == "get" -a "$2" == "voltconfig" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 429 | echo "$HOME/.volt/config-$NAME" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 430 | exit |
| 431 | fi |
| 432 | |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 433 | if [ $# -ne 1 -o $(echo ":up:down:dump:" | grep -c ":$1:") -ne 1 ]; then |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 434 | >&2 echo "What wouild you like to do today:" |
| 435 | >&2 echo " up - bring up voltha" |
| 436 | >&2 echo " down - tear down voltha" |
| 437 | >&2 echo " dump - create a debug dump of running system" |
| 438 | exit 1 |
| 439 | fi |
| 440 | |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 441 | push_onos_config() { |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 442 | local TYPE=$1 |
| 443 | local MSG=$2 |
| 444 | local RESOURCE=$3 |
| 445 | local DATA=$4 |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 446 | |
David K. Bainbridge | b4b163b | 2020-02-19 15:55:06 -0800 | [diff] [blame] | 447 | # Thanks to the latest version of ONOS using the return code 207 this gets a |
| 448 | # whole lot nastier. Can't thank them enough for doing this. So in order to |
| 449 | # capture the command and the output in the log file as well as capture the |
| 450 | # status code to verify it is 200 and not 207 mutltiple files and a bit of |
| 451 | # hackery must be used. Thanks again ONOS. |
| 452 | local CMD_ECHO=$(mktemp -u) |
| 453 | local CMD_OUTPUT=$(mktemp -u) |
| 454 | local SC_OUTPUT=$(mktemp -u) |
| 455 | |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 456 | bspin - "$MSG $GEAR" |
| 457 | while true; do |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 458 | if [ $TYPE == "file" ]; then |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 459 | (set -x; curl --fail -sSL --user karaf:karaf -w "%{http_code}" -o $CMD_OUTPUT -X POST -H Content-Type:application/json http://$_ONOS_API_EP/onos/v1/$RESOURCE --data @$DATA >$SC_OUTPUT 2>/dev/null) >>$CMD_ECHO 2>&1 |
| 460 | RESULT=$? |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 461 | fi |
| 462 | if [ $TYPE == "json" ]; then |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 463 | (set -x; curl --fail -sSL --user karaf:karaf -w "%{http_code}" -o $CMD_OUTPUT -X POST -H Content-Type:application/json http://$_ONOS_API_EP/onos/v1/$RESOURCE --data $DATA >$SC_OUTPUT 2>/dev/null) >>$CMD_ECHO 2>&1 |
| 464 | RESULT=$? |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 465 | fi |
David K. Bainbridge | b4b163b | 2020-02-19 15:55:06 -0800 | [diff] [blame] | 466 | # Dump everything to the log |
| 467 | cat $CMD_ECHO >> $LOG |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 468 | test -r $CMD_OUTPUT && cat $CMD_OUTPUT >> $LOG |
David K. Bainbridge | b4b163b | 2020-02-19 15:55:06 -0800 | [diff] [blame] | 469 | SC=$(cat $SC_OUTPUT) |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 470 | echo "RESPONSE CODE: $SC" >> $LOG |
| 471 | echo "ERROR CODE: $RESULT" >> $LOG |
David K. Bainbridge | b4b163b | 2020-02-19 15:55:06 -0800 | [diff] [blame] | 472 | |
| 473 | # clean up temp files |
| 474 | rm -f $CMD_ECHO $CMD_OUTPUT $SC_OUTPUT |
| 475 | if [ $RESULT -eq 0 -a "$SC" == "200" ]; then |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 476 | break |
| 477 | fi |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 478 | sleep 1 |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 479 | sspin - |
| 480 | done |
| 481 | espin - $VERIFIED |
| 482 | } |
| 483 | |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 484 | check_onos_app_active() { |
| 485 | local APP_ID=$1 |
| 486 | |
| 487 | bspin - "Checking that $APP_ID is active $CLOCK" |
| 488 | while true; do |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 489 | (set -x; curl --fail -sSL --user karaf:karaf -X GET http://$_ONOS_API_EP/onos/v1/applications/$APP_ID | grep ACTIVE >>$LOG 2>&1) >>$LOG 2>&1 |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 490 | if [ $? -eq 0 ]; then |
| 491 | break |
| 492 | fi |
| 493 | sleep 1 |
| 494 | sspin - |
| 495 | done |
| 496 | sleep 5 # OSGI components take a little longer that the app to activate |
| 497 | espin - $VERIFIED |
| 498 | } |
| 499 | |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 500 | override_onos_app() { |
| 501 | local APP=$1 |
| 502 | local NAME=$(basename $APP | sed -e 's/^[0-9][0-9]*-//g' -e 's/-.*$//g') |
| 503 | while true; do |
| 504 | sspin - |
| 505 | # Attempt to delete old version (if it exists) |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 506 | (set -x; curl --fail -sSL --user karaf:karaf -X DELETE http://$_ONOS_API_EP/onos/v1/applications/$NAME >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 507 | sspin - |
| 508 | if [ $? -ne 0 ]; then |
| 509 | continue |
| 510 | fi |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 511 | (set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://$_ONOS_API_EP/onos/v1/applications?activate=true --data-binary @$APP >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 512 | if [ $? -eq 0 ]; then |
| 513 | break |
| 514 | fi |
| 515 | sleep .2 |
| 516 | done |
| 517 | } |
| 518 | |
| 519 | activate_onos_app() { |
| 520 | local MSG="$1" |
| 521 | local APP=$2 |
| 522 | |
| 523 | bspin - "$MSG $GO" |
| 524 | while true; do |
| 525 | sspin - |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 526 | (set -x; curl --fail -sSL --user karaf:karaf -X POST http://$_ONOS_API_EP/onos/v1/applications/$APP/active >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 527 | if [ $? -eq 0 ]; then |
| 528 | break |
| 529 | fi |
| 530 | sleep .2 |
| 531 | done |
| 532 | espin - "$VERIFIED" |
| 533 | } |
| 534 | |
| 535 | count_pods() { |
| 536 | local NAMESPACE=$1; shift |
| 537 | if [ "$NAMESPACE" == "all-namespaces" ]; then |
| 538 | NAMESPACE="--all-namespaces" |
| 539 | else |
| 540 | NAMESPACE="-n $NAMESPACE" |
| 541 | fi |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 542 | local STATES=$1; shift |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 543 | local PODS=$(kubectl get $NAMESPACE pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}") |
| 544 | local COUNT=0 |
| 545 | local PATTERNS="$*" |
| 546 | for POD in $PODS; do |
| 547 | local NAME=$(echo $POD | cut -d/ -f 1) |
| 548 | local STATE=$(echo $POD | cut -d/ -f 2) |
| 549 | local CONTAINERS=$(echo $POD | cut -d/ -f 3 | sed -e 's/_/ /g') |
| 550 | if [ "$STATES" == "*" -o $(echo "$STATES" | grep -c ":$STATE:") -ne 0 ]; then |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 551 | local TOTAL=$(echo $CONTAINERS | wc -w) |
| 552 | local FOUND=$(echo $CONTAINERS | grep -o true | wc -l) |
| 553 | if [ $TOTAL -eq $FOUND ]; then |
| 554 | for PATTERN in $PATTERNS; do |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 555 | if [[ $NAME =~ $PATTERN ]]; then |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 556 | COUNT=$(expr $COUNT + 1) |
| 557 | break |
| 558 | fi |
| 559 | done |
| 560 | fi |
| 561 | fi |
| 562 | done |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 563 | echo $COUNT |
| 564 | } |
| 565 | |
| 566 | wait_for_pods() { |
| 567 | local INDENT= |
| 568 | if [ "$1" == "-" ]; then |
| 569 | INDENT=$1; shift |
| 570 | fi |
| 571 | local NAMESPACE=$1; shift |
| 572 | local EXPECT=$1; shift |
| 573 | local TYPE=$1; shift |
| 574 | local RETRY=$1; shift |
| 575 | local MESSAGE=$1; shift |
| 576 | local PATTERNS=$* |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 577 | local STATES=":Running:" |
| 578 | if [ "$TYPE" == "not" ]; then |
| 579 | STATES="*" |
| 580 | fi |
| 581 | local HAVE=$(count_pods $NAMESPACE "$STATES" $PATTERNS) |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 582 | local ALL=$HAVE |
| 583 | if [ "$TYPE" == "only" ]; then |
| 584 | ALL=$(count_pods "all-namespaces" "*" ".*") |
| 585 | fi |
| 586 | COUNT=$(expr 300 / 15) |
| 587 | bspin $INDENT $MESSAGE |
| 588 | sspin $INDENT |
| 589 | if [ $HAVE -ne $EXPECT -o $ALL -ne $HAVE ]; then |
| 590 | while [ $HAVE -ne $EXPECT -o $ALL -ne $HAVE ]; do |
| 591 | sspin $INDENT |
| 592 | COUNT=$(expr $COUNT - 1) |
| 593 | if [ $COUNT -eq 0 ]; then |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 594 | HAVE=$(count_pods $NAMESPACE "$STATES" $PATTERNS) |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 595 | ALL=$HAVE |
| 596 | if [ "$TYPE" == "only" ]; then |
| 597 | ALL=$(count_pods "all-namespaces" "*" ".*") |
| 598 | fi |
| 599 | COUNT=$(expr 300 / 15) |
| 600 | fi |
| 601 | sleep .15 |
| 602 | done |
| 603 | fi |
| 604 | espin $INDENT $VERIFIED |
| 605 | if [ $HAVE -ne $EXPECT ]; then |
| 606 | return 1 |
| 607 | fi |
| 608 | return 0 |
| 609 | } |
| 610 | |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 611 | port_forward() { |
| 612 | local NS=$1 |
| 613 | local SVC=$2 |
| 614 | local FROM_PORT=$3 |
| 615 | local TO_PORT=$4 |
| 616 | local TAG=$SVC-$NAME |
| 617 | |
| 618 | (set -x; _TAG=$TAG bash -c "while true; do kubectl port-forward -n $NS service/$SVC $FROM_PORT:$TO_PORT; done" >>$LOG 2>&1 &) >>$LOG 2>&1 |
| 619 | } |
| 620 | |
| 621 | kill_port_forward() { |
| 622 | local TAG=$1-$NAME |
David Bainbridge | c6871d2 | 2019-11-13 17:10:31 +0000 | [diff] [blame] | 623 | local P_IDS=$(ps e -ww -A | grep "_TAG=$TAG" | grep -v grep | awk '{print $1}') |
David Bainbridge | bcf235b | 2019-11-12 21:33:58 +0000 | [diff] [blame] | 624 | local PARENTS= |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 625 | local KIDS= |
David Bainbridge | c6871d2 | 2019-11-13 17:10:31 +0000 | [diff] [blame] | 626 | local UNKNOWN= |
| 627 | if [ ! -z "$P_IDS" ]; then |
| 628 | for P_ID in $P_IDS; do |
| 629 | local PP_ID=$(ps -o ppid $P_ID | tail -n +2) |
| 630 | if [ ! -z "$PP_ID" ]; then |
| 631 | if [ $PP_ID -eq 1 ]; then |
| 632 | PARENTS="$PARENTS $P_ID" |
| 633 | else |
| 634 | KIDS="$KIDS $P_ID" |
| 635 | fi |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 636 | else |
David Bainbridge | c6871d2 | 2019-11-13 17:10:31 +0000 | [diff] [blame] | 637 | UNKNOWN="$UNKNOWN $P_ID" |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 638 | fi |
| 639 | done |
David Bainbridge | c6871d2 | 2019-11-13 17:10:31 +0000 | [diff] [blame] | 640 | (set -x; kill -9 $PARENTS $KIDS $UNKNOWN >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 641 | fi |
| 642 | } |
| 643 | |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 644 | if [ "$1" == "down" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 645 | echo "Tearing down voltha cluster $NAME" |
| 646 | LOG="down-$NAME.log" |
| 647 | echo $(date -u +"%Y%m%dT%H%M%SZ") >$LOG |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 648 | bspin "Remove port-forwards: onos-ui-$NAME" |
| 649 | kill_port_forward onos-ui |
| 650 | sspin "Remove port-forwards: onos-ssh-$NAME$CEOL" |
| 651 | kill_port_forward onos-ssh |
| 652 | sspin "Remove port-forwards: voltha-api-$NAME$CEOL" |
| 653 | kill_port_forward voltha-api |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 654 | sspin "Remove port-forwards: voltha-etcd-$NAME$CEOL" |
| 655 | kill_port_forward voltha-etcd-cluster-client |
David K. Bainbridge | 00ecd38 | 2020-02-28 12:31:58 -0800 | [diff] [blame] | 656 | sspin "Remove port-forwards: voltha-kafka-$NAME$CEOL" |
| 657 | kill_port_forward voltha-kafka |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 658 | espin "$VERIFIED Remove port-forwards$CEOL" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 659 | if [ $DEPLOY_K8S == "yes" ]; then |
| 660 | if [ -x ./bin/kind ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 661 | bspin "Delete Kubernetes Kind Cluster" |
| 662 | (set -x; ./bin/kind delete cluster --name voltha-$NAME >>$LOG 2>&1) >>$LOG 2>&1 |
| 663 | espin $VERIFIED |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 664 | else |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 665 | espin "$NO_ENTRY Delete Kubernetes Kind Cluster: kind command not found" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 666 | fi |
| 667 | else |
| 668 | EXISTS=$(helm list -q) |
| 669 | EXPECT="etcd-operator onos open-olt open-onu sim voltha bbsim radius" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 670 | bspin "Remove Helm Deployments" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 671 | for i in $EXISTS; do |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 672 | for j in $EXPECT; do |
| 673 | if [[ $i =~ $j ]]; then |
| 674 | sspin "Remove Helm Deployments: $i$CEOL" |
| 675 | (set -x; ./bin/helm delete --no-hooks --purge $i >>$LOG 2>&1) >>$LOG 2>&1 |
| 676 | fi |
| 677 | done |
uottremb | b16d398 | 2020-02-28 08:34:36 +0100 | [diff] [blame] | 678 | done |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 679 | espin "$VERIFIED Remove Helm Deployments$CEOL" |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 680 | if [ "$WAIT_ON_DOWN" == "yes" ]; then |
| 681 | # There should only be 13 or 15 PODs in the kube-system name |
| 682 | # space and no other PODs |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 683 | PODS="coredns-.* \ |
| 684 | etcd-voltha-$NAME-control-plane \ |
| 685 | kindnet-.* \ |
| 686 | kube-apiserver-voltha-$NAME-control-plane \ |
| 687 | kube-controller-manager-voltha-$NAME-control-plane \ |
| 688 | kube-proxy-.* \ |
| 689 | kube-scheduler-voltha-$NAME-control-plane \ |
| 690 | tiller-deploy-.*" |
| 691 | EXPECT=$(test "$TYPE" == "minimal" && echo "13" || echo "15") |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 692 | PODS="adapter-.* \ |
| 693 | bbsim.* \ |
| 694 | etcd-operator.* \ |
| 695 | radius.* \ |
| 696 | voltha-.*" |
Matteo Scandolo | 73442f9 | 2020-01-29 09:53:22 -0800 | [diff] [blame] | 697 | |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 698 | EXPECT=0 |
| 699 | |
Matteo Scandolo | 73442f9 | 2020-01-29 09:53:22 -0800 | [diff] [blame] | 700 | if [ "$WITH_ONOS" == "yes" ]; then |
| 701 | ONOS_PODS="onos-.*" |
| 702 | wait_for_pods "default" $EXPECT "not" -1 "Waiting for ONOS PODs to terminate" $ONOS_PODS |
| 703 | fi |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 704 | wait_for_pods "voltha" $EXPECT "not" -1 "Waiting for VOLTHA PODs to terminate" $PODS |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 705 | fi |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 706 | fi |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 707 | exit |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 708 | fi |
| 709 | |
| 710 | if [ "$1" == "dump" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 711 | LOG="dump-$NAME.log" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 712 | TS=$(date -u +"%Y%m%dT%H%M%SZ") |
David Bainbridge | 76514a0 | 2019-10-08 01:50:35 +0000 | [diff] [blame] | 713 | if [ ! -z "$DUMP_FROM" ]; then |
| 714 | TS=$(echo $DUMP_FROM | sed -e 's/[:-]//g') |
| 715 | fi |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 716 | WORK=$(mktemp -u -d) |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 717 | DATA=$WORK/voltha-debug-dump-$NAME-$TS |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 718 | mkdir -p $DATA |
| 719 | echo $TS > $LOG |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 720 | echo -e "Capturing debug dump to voltha-debug-dump-$NAME-$TS.tgz" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 721 | bspin - "Copy install log" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 722 | if [ -f install-$NAME.log ]; then |
| 723 | (set -x; cp install-$NAME.log $DATA/install-$NAME.log) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 724 | espin - $VERIFIED |
| 725 | else |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 726 | espin - "$NO_ENTRY Copy install log: install-$NAME.log not found" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 727 | fi |
| 728 | bspin - "Dumping Kubernetes PODs" |
| 729 | (set -x; kubectl get --all-namespaces pods >> $DATA/all-pods.txt 2>&1) >>$LOG 2>&1 |
| 730 | espin - $VERIFIED |
| 731 | bspin - "Dumping Kubernetes SERVICEs" |
| 732 | (set -x; kubectl get --all-namespaces svc >> $DATA/all-services.txt 2>&1) >>$LOG 2>&1 |
| 733 | espin - $VERIFIED |
| 734 | bspin - "Dumping Kubernetes EVENTs" |
| 735 | (set -x; kubectl get --all-namespaces events >> $DATA/all-events.txt 2>&1) >>$LOG 2>&1 |
| 736 | espin - $VERIFIED |
| 737 | bspin - "Dumping VOLTHA POD details" |
Matteo Scandolo | dcd29f5 | 2019-10-07 15:42:42 -0700 | [diff] [blame] | 738 | PODS="$(kubectl -n default get pod -o name | grep onos | sed -e 's/^/default:/g') $(kubectl get -n voltha pod -o name | sed -e 's/^/voltha:/g')" |
David Bainbridge | cfd7ca1 | 2019-10-06 03:31:41 +0000 | [diff] [blame] | 739 | SINCE= |
| 740 | if [ ! -z "$DUMP_FROM" ]; then |
| 741 | SINCE="--since-time=$DUMP_FROM" |
| 742 | fi |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 743 | for POD in $PODS; do |
David Bainbridge | 1f0655a | 2019-10-01 22:08:48 +0000 | [diff] [blame] | 744 | NS=$(echo $POD | cut -d: -f1) |
| 745 | POD=$(echo $POD | cut -d: -f2) |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 746 | sspin - "Dumping VOLTHA POD details: $POD$CEOL" |
| 747 | mkdir -p $DATA/$POD |
David Bainbridge | 1f0655a | 2019-10-01 22:08:48 +0000 | [diff] [blame] | 748 | (set -x; kubectl describe -n $NS $POD >> $DATA/$POD/describe.txt 2>&1) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 749 | sspin - "Dumping VOLTHA POD details: $POD" |
David Bainbridge | cfd7ca1 | 2019-10-06 03:31:41 +0000 | [diff] [blame] | 750 | (set -x; kubectl logs -n $NS --all-containers $SINCE --previous $LOG_ARGS $POD >> $DATA/$POD/logs-previous.txt 2>&1) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 751 | sspin - "Dumping VOLTHA POD details: $POD" |
David Bainbridge | cfd7ca1 | 2019-10-06 03:31:41 +0000 | [diff] [blame] | 752 | (set -x; kubectl logs -n $NS --all-containers $SINCE $LOG_ARGS $POD >> $DATA/$POD/logs-current.txt 2>&1) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 753 | sspin - "Dumping VOLTHA POD details: $POD" |
| 754 | done |
| 755 | espin - "$VERIFIED Dumping VOLTHA POD details$CEOL" |
| 756 | bspin - "Dumping ETCD" |
| 757 | if [ "$(which etcdctl) X" != " X" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 758 | (set -x; ETCDCTL_API=3 etcdctl --endpoints localhost:$VOLTHA_ETCD_PORT get --prefix service/voltha | hexdump -C >> $DATA/etcd.hex 2>&1) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 759 | espin - $VERIFIED |
| 760 | else |
| 761 | espin - "$NO_ENTRY Dumping ETCD: etcdctl command not available" |
| 762 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 763 | bspin - "Creating compressed TAR: voltha-debug-dump-$NAME-$TS.tgz" |
| 764 | (set -x; tar -C $WORK -zcf voltha-debug-dump-$NAME-$TS.tgz ./voltha-debug-dump-$NAME-$TS) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 765 | espin - $VERIFIED |
| 766 | bspin - "Cleanup" |
| 767 | (set -x; rm -rf $WORK) >>$LOG 2>&1 |
| 768 | espin - $VERIFIED |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 769 | bspin - "$(ls -l voltha-debug-dump-$NAME-$TS.tgz)" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 770 | espin - $VERIFIED |
| 771 | exit |
| 772 | fi |
| 773 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 774 | LOG="install-$NAME.log" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 775 | date > $LOG |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 776 | echo "PORTS=$ONOS_API_PORT,$ONOS_SSH_PORT,$VOLTHA_API_PORT,$VOLTHA_SSH_PORT,$VOLTHA_ETCD_PORT" >> $LOG |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 777 | |
| 778 | # Output install options to log |
| 779 | echo "OPTIONS" >> $LOG |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 780 | for O in $ALL_OPTIONS; do |
| 781 | VAL=$(eval echo \$$O) |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 782 | if [ ! -z "$VAL" ]; then |
| 783 | printf " %-30s = %s\n" $O $VAL >> $LOG |
| 784 | fi |
| 785 | done |
| 786 | |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 787 | helm_install() { |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 788 | local INDENT= |
| 789 | if [ "$1" == "-" ]; then |
| 790 | INDENT=$1; shift |
| 791 | fi |
| 792 | local NAMESPACE=$1; shift |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 793 | local INAME=$1; shift |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 794 | local CHART=$1; shift |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 795 | local CHART_VERSION=$1; shift |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 796 | local MESSAGE=$* |
| 797 | |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 798 | if [ "$CHART_VERSION X" != " X" -a "$CHART_VERSION" != "latest" ]; then |
| 799 | CHART_VERSION="--version $CHART_VERSION" |
| 800 | else |
| 801 | CHART_VERSION= |
| 802 | fi |
| 803 | |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 804 | local CHART_ARGS= |
| 805 | if [ -r "${INAME}-values.yaml" ]; then |
| 806 | CHART_ARGS="-f ${INAME}-values.yaml" |
| 807 | fi |
| 808 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 809 | COUNT=$(expr 300 / 15) |
| 810 | bspin $INDENT $MESSAGE |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 811 | (set -x; helm install -f $NAME-values.yaml $CHART_ARGS $EXTRA_HELM_INSTALL_ARGS --set defaults.log_level=$VOLTHA_LOG_LEVEL --namespace $NAMESPACE --name $INAME $CHART_VERSION $EXTRA_HELM_FLAGS $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 812 | SUCCESS=$? |
| 813 | while [ $SUCCESS -ne 0 ]; do |
| 814 | sspin $INDENT |
| 815 | COUNT=$(expr $COUNT - 1) |
| 816 | if [ $COUNT -eq 0 ]; then |
Andy Bavier | e22ff25 | 2019-12-19 11:40:31 -0700 | [diff] [blame] | 817 | (set -x; helm delete --purge $INAME >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 818 | (set -x; helm install -f $NAME-values.yaml $CHART_ARGS --set defaults.log_level=$VOLTHA_LOG_LEVEL --namespace $NAMESPACE --name $INAME $CHART_VERSION $EXTRA_HELM_FLAGS $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
Andy Bavier | e22ff25 | 2019-12-19 11:40:31 -0700 | [diff] [blame] | 819 | SUCCESS=$? |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 820 | COUNT=$(expr 300 / 15) |
| 821 | fi |
| 822 | sleep .15 |
| 823 | done |
| 824 | espin $INDENT $VERIFIED |
| 825 | } |
| 826 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 827 | echo "INSTALL TYPE: $TYPE" >> $LOG |
| 828 | |
| 829 | bspin "Verify GOPATH" |
| 830 | export GOPATH=$(pwd) |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 831 | mkdir -p $GOPATH/bin |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 832 | espin $VERIFIED |
| 833 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 834 | STIME=$(date +%s) |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 835 | if [ "$INSTALL_KUBECTL" == "no" ]; then |
| 836 | bspin "Skip kubectl install" |
| 837 | espin $NO_ENTRY |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 838 | else |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 839 | bspin "Verify kubectl $HELM" |
| 840 | if [ -x $GOPATH/bin/kubectl ]; then |
| 841 | espin $VERIFIED |
| 842 | else |
| 843 | espin $NOT_VERIFIED |
| 844 | bspin - "Download and install Kubernetes/kubectl $DOWNLOAD" |
| 845 | (set -x; curl -o $GOPATH/bin/kubectl -sSL https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/$HOSTOS/$HOSTARCH/kubectl >>$LOG 2>&1) >>$LOG 2>&1 |
| 846 | (set -x; chmod 755 $GOPATH/bin/kubectl >>$LOG 2>&1) >>$LOG 2>&1 |
| 847 | espin - $VERIFIED |
| 848 | fi |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 849 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 850 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 851 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 852 | fi |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 853 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 854 | STIME=$(date +%s) |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 855 | if [ "$DEPLOY_K8S" == "no" ]; then |
| 856 | bspin "Skip Kubernetes/Kind Deployment" |
| 857 | espin $NO_ENTRY |
| 858 | else |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 859 | bspin "Verify Kubernetes/Kind $HELM" |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 860 | IS_INSTALLED=0 |
| 861 | OP_TYPE="install" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 862 | if [ -x $GOPATH/bin/kind ]; then |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 863 | OP_TYPE="upgrade" |
| 864 | if [ $($GOPATH/bin/kind --version | grep -c $KIND_VERSION) -eq 1 ]; then |
| 865 | IS_INSTALLED=1 |
| 866 | espin $VERIFIED |
| 867 | fi |
| 868 | fi |
| 869 | if [ $IS_INSTALLED -eq 0 ]; then |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 870 | espin $NOT_VERIFIED |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 871 | bspin - "Download and $OP_TYPE Kubernetes/kind $DOWNLOAD" |
David Bainbridge | 9e2a666 | 2019-07-11 17:07:57 +0000 | [diff] [blame] | 872 | (set -x; curl -o $GOPATH/bin/kind -sSL https://github.com/kubernetes-sigs/kind/releases/download/$KIND_VERSION/kind-$HOSTOS-$HOSTARCH >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 873 | (set -x; chmod 755 $GOPATH/bin/kind >>$LOG 2>&1) >>$LOG 2>&1 |
| 874 | espin - $VERIFIED |
| 875 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 876 | fi |
| 877 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 878 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 879 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 880 | fi |
| 881 | |
| 882 | STIME=$(date +%s) |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 883 | if [ "$INSTALL_HELM" == "no" ]; then |
| 884 | bspin "Skip Helm Install" |
| 885 | espin $NO_ENTRY |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 886 | else |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 887 | bspin "Verify Helm $HELM" |
| 888 | if [ -x $GOPATH/bin/helm ]; then |
| 889 | espin $VERIFIED |
| 890 | else |
| 891 | espin $NOT_VERIFIED |
| 892 | bspin - "Download and install Helm $DOWNLOAD" |
David Bainbridge | c6a6eb6 | 2019-10-18 22:50:07 +0000 | [diff] [blame] | 893 | (set -x; curl -sSL https://git.io/get_helm.sh | DESIRED_VERSION=v2.14.3 USE_SUDO=false HELM_INSTALL_DIR=$GOPATH/bin bash >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 894 | espin - $VERIFIED |
| 895 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 896 | fi |
David K. Bainbridge | fe1fa8a | 2019-11-12 12:03:21 -0800 | [diff] [blame] | 897 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 898 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 899 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 900 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 901 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 902 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 903 | bspin "Verify voltctl $HIGH_VOLTAGE" |
David Bainbridge | d281197 | 2019-12-14 01:14:09 +0000 | [diff] [blame] | 904 | VOK=0 |
| 905 | VMESSAGE="install" |
David K. Bainbridge | ebf38d9 | 2020-02-10 10:46:31 -0800 | [diff] [blame] | 906 | export VC_VERSION="$VOLTCTL_VERSION" |
| 907 | if [ "$VC_VERSION" == "latest" ]; then |
| 908 | export VC_VERSION=$(curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g') |
| 909 | fi |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 910 | if [ -x $GOPATH/bin/voltctl ]; then |
David Bainbridge | 1ba64f1 | 2019-12-18 00:40:13 +0000 | [diff] [blame] | 911 | VHAVE=$($GOPATH/bin/voltctl version --clientonly -o json | jq -r .version) |
David K. Bainbridge | ebf38d9 | 2020-02-10 10:46:31 -0800 | [diff] [blame] | 912 | if [ $? -eq 0 -a "$VHAVE" == "$VC_VERSION" ]; then |
David Bainbridge | d281197 | 2019-12-14 01:14:09 +0000 | [diff] [blame] | 913 | VOK=1 |
David Bainbridge | 1ba64f1 | 2019-12-18 00:40:13 +0000 | [diff] [blame] | 914 | espin $VERIFIED |
| 915 | else |
David K. Bainbridge | ebf38d9 | 2020-02-10 10:46:31 -0800 | [diff] [blame] | 916 | VCHECK=$(echo -e "$VHAVE\n$VC_VERSION" | sort -V | head -1) |
| 917 | if [ "$VCHECK" == "$VHAVE" ]; then |
| 918 | VMESSAGE="upgrade" |
| 919 | else |
| 920 | VMESSAGE="downgrade" |
| 921 | fi |
David Bainbridge | d281197 | 2019-12-14 01:14:09 +0000 | [diff] [blame] | 922 | fi |
| 923 | fi |
| 924 | |
David Bainbridge | 1ba64f1 | 2019-12-18 00:40:13 +0000 | [diff] [blame] | 925 | if [ $VOK -eq 0 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 926 | espin $NOT_VERIFIED |
David Bainbridge | d281197 | 2019-12-14 01:14:09 +0000 | [diff] [blame] | 927 | bspin - "Download and $VMESSAGE voltctl $DOWNLOAD" |
David K. Bainbridge | ebf38d9 | 2020-02-10 10:46:31 -0800 | [diff] [blame] | 928 | (set -x; curl -o $GOPATH/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v$VC_VERSION/voltctl-$VC_VERSION-$HOSTOS-$HOSTARCH >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 929 | (set -x; chmod 755 $GOPATH/bin/voltctl >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 930 | espin - $VERIFIED |
| 931 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 932 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 933 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 934 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 935 | |
| 936 | bspin "Verify command PATH" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 937 | export PATH=$GOPATH/bin:$PATH |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 938 | espin $VERIFIED |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 939 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 940 | STIME=$(date +%s) |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 941 | if [ "$DEPLOY_K8S" == "yes" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 942 | HAVE=$(kind get clusters | grep -c voltha-$NAME) |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 943 | bspin "Verify Kubernetes/Kind Cluster" |
| 944 | sspin |
| 945 | if [ $HAVE -eq 0 ]; then |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 946 | espin $NOT_VERIFIED |
| 947 | bspin - "Verify cluster configuration" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 948 | if [ ! -r ./$NAME-cluster.cfg ]; then |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 949 | espin - $NOT_VERIFIED |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 950 | bspin - "Download cluster configuration: $TYPE-cluster.cfg to $NAME-cluster.cfg $DOWNLOAD" |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 951 | ERR_OUT=$(mktemp) |
| 952 | (set -x; curl --fail -o ./$NAME-cluster.cfg -sSL https://raw.githubusercontent.com/ciena/kind-voltha/$VK_RELEASE/$TYPE-cluster.cfg >>$LOG 2>>$ERR_OUT) >>$LOG 2>&1 |
| 953 | if [ $? -ne 0 ]; then |
| 954 | espin - $THEX |
| 955 | echo -e "${RED}${BOLD}${ERROR}ERROR: $NAME-cluster.cfg${NORMAL}${RED} - $(cat $ERR_OUT)${NORMAL}" |
| 956 | echo "ERROR: $(cat $ERR_OUT)" >>$LOG |
| 957 | rm -rf $ERR_OUT ./$NAME-cluster.cfg |
| 958 | exit 1 |
| 959 | fi |
| 960 | rm -rf $ERR_OUT |
| 961 | else |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 962 | espin - $VERIFIED |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 963 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 964 | kind create cluster --name voltha-$NAME --config $NAME-cluster.cfg |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 965 | else |
| 966 | espin $VERIFIED |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 967 | fi |
| 968 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 969 | export KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$NAME")" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 970 | P="coredns-.* \ |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 971 | etcd-voltha-$NAME-control-plane \ |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 972 | kindnet-.* \ |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 973 | kube-apiserver-voltha-$NAME-control-plane \ |
| 974 | kube-controller-manager-voltha-$NAME-control-plane \ |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 975 | kube-proxy-.* \ |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 976 | kube-scheduler-voltha-$NAME-control-plane" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 977 | |
| 978 | EXPECT=$(test "$TYPE" == "minimal" && echo "12" || echo "14") |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 979 | wait_for_pods - "kube-system" $EXPECT "includes" -1 "Waiting for system PODs to start" $P |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 980 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 981 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 982 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 983 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 984 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 985 | STIME=$(date +%s) |
David Bainbridge | 4c6289c | 2019-09-03 21:11:32 +0000 | [diff] [blame] | 986 | COUNT=$(count_pods "kube-system" ":Running:" "tiller-deploy-.*") |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 987 | bspin "Verify Helm" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 988 | if [ $COUNT -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 989 | espin $NOT_VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 990 | echo -e "Configuring Helm $GEAR" |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 991 | if [ "$INSTALL_HELM" == "no" ]; then |
| 992 | bspin - "Skip Helm/Tiller Initialization" |
| 993 | espin - $NO_ENTRY |
| 994 | else |
| 995 | bspin - "Initialize Helm" |
| 996 | (set -x; helm init --upgrade >>$LOG 2>&1) >>$LOG 2>&1 |
| 997 | espin - $VERIFIED |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 998 | wait_for_pods - "kube-system" 1 "includes" -1 "Waiting for Tiller POD to start" "tiller-deploy-.*" |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 999 | fi |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1000 | bspin - "Add Google Incubator repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1001 | (set -x; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 1002 | espin - $VERIFIED |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1003 | |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1004 | # HACK (sort-of) - the config for tiller is about to be patched, which will |
| 1005 | # cause the tiller pod to be recreated. This can sometimes cause a timing |
| 1006 | # issue with the "wait_for_pods" call on tiller as it may incorrectly |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1007 | # identify the running/ready tiller pod that is soon to be terminated as |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1008 | # what it is waiting for. To avoid this issue we do a clean scale down and |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1009 | # scale up of the pod so the script controlls when it should be expecting |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1010 | # things |
| 1011 | (set -x; kubectl -n kube-system scale deploy tiller-deploy --replicas=0 >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1012 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1013 | bspin - "Add Google Stable repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1014 | (set -x; helm repo add stable https://kubernetes-charts.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 1015 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1016 | bspin - "Add ONF repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1017 | (set -x; helm repo add onf https://charts.opencord.org >>$LOG 2>&1) >>$LOG 2>&1 |
| 1018 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1019 | bspin - "Update Helm repository cache" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1020 | (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1 |
| 1021 | espin - $VERIFIED |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1022 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1023 | # Create and k8s service account so that Helm can create pods |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1024 | bspin - "Create Tiller ServiceAccount" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1025 | (set -x; kubectl create serviceaccount --namespace kube-system tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 1026 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1027 | bspin - "Create Tiller ClusterRoleBinding" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1028 | (set -x; kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 1029 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1030 | bspin - "Update Tiller Manifest" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1031 | (set -x; kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1032 | |
| 1033 | # HACK (sort-of) - part to, spin it back up |
| 1034 | (set -x; kubectl -n kube-system scale deploy tiller-deploy --replicas=1 >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1035 | espin - $VERIFIED |
| 1036 | else |
| 1037 | espin $VERIFIED |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 1038 | if [ "$UPDATE_HELM_REPOS" == "yes" ]; then |
| 1039 | bspin - "Update Helm repository cache" |
| 1040 | (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1 |
| 1041 | espin - $VERIFIED |
| 1042 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1043 | fi |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 1044 | wait_for_pods - "kube-system" 1 "includes" -1 "Waiting for Tiller POD to start" "tiller-deploy-.*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1045 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1046 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1047 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1048 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1049 | STIME=$(date +%s) |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1050 | bspin "Verify Helm values file: $NAME-values.yaml" |
| 1051 | if [ ! -r "./$NAME-values.yaml" ]; then |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1052 | espin $NOT_VERIFIED |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1053 | bspin - "Download Helm values file: $TYPE-values.yaml to $NAME-values.yaml $DOWNLOAD" |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 1054 | ERR_OUT=$(mktemp) |
| 1055 | (set -x; curl --fail -o ./$NAME-values.yaml -sSL https://raw.githubusercontent.com/ciena/kind-voltha/$VK_RELEASE/$TYPE-values.yaml >>$LOG 2>$ERR_OUT) >>$LOG 2>&1 |
| 1056 | if [ $? -ne 0 ]; then |
| 1057 | espin - $THEX |
| 1058 | echo -e "${RED}${BOLD}${ERROR}ERROR: $NAME-values.yaml${NORMAL}${RED} - $(cat $ERR_OUT)${NORMAL}" |
| 1059 | echo "ERROR: $(cat $ERR_OUT)" >>$LOG |
| 1060 | rm -rf $ERR_OUT ./$NAME-values.yaml |
| 1061 | exit 1 |
| 1062 | fi |
| 1063 | rm -rf $ERR_OUT |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1064 | espin - $VERIFIED |
| 1065 | else |
| 1066 | espin $VERIFIED |
| 1067 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1068 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1069 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1070 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1071 | |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 1072 | STIME=$(date +%s) |
| 1073 | bspin "Verify or download chart specific values files $DOWNLOAD" |
| 1074 | VALUES_FILES="monkey-values.yaml" |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 1075 | ERR_OUT=$(mktemp) |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 1076 | for i in $VALUES_FILES; do |
| 1077 | if [ ! -r ./$i ]; then |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 1078 | (set -x; curl --fail -o ./$i -sSL https://raw.githubusercontent.com/ciena/kind-voltha/$VK_RELEASE/$i >>$LOG 2>$ERR_OUT) >>$LOG 2>&1 |
| 1079 | if [ $? -ne 0 ]; then |
| 1080 | espin $THEX |
| 1081 | echo -e "${RED}${BOLD}${ERROR}ERROR: $i${NORMAL}${RED} - $(cat $ERR_OUT)${NORMAL}" |
| 1082 | echo "ERROR: $i - $(cat $ERR_OUT)" >>$LOG |
| 1083 | rm -rf $ERR_OUT ./$i |
| 1084 | exit 1 |
| 1085 | fi |
| 1086 | rm -rf $ERR_OUT |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 1087 | fi |
| 1088 | done |
| 1089 | espin $VERIFIED |
| 1090 | if [ "$WITH_TIMINGS" == "yes" ]; then |
| 1091 | printtime $(expr $(date +%s) - $STIME) |
| 1092 | fi |
| 1093 | |
| 1094 | if [ "$WITH_CHAOS" == "yes" ]; then |
| 1095 | bspin "Verify or clone kube-monkey helm chart $DOWNLOAD" |
| 1096 | if [ -r ./kube-monkey ]; then |
| 1097 | espin $VERIFIED |
| 1098 | else |
| 1099 | espin $NOT_VERIFIED |
| 1100 | bspin - "GIT clone kube-monkey" |
| 1101 | (set -x; git clone https://github.com/asobti/kube-monkey kube-monkey >>$LOG 2>&1) >>$LOG 2>&1 |
| 1102 | espin - $VERIFIED |
| 1103 | fi |
| 1104 | fi |
| 1105 | |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1106 | if [ "$JUST_K8S" == "yes" ]; then |
| 1107 | echo "Environment deployed, not deploying VOLTHA artifacts as requested. Good bye." |
| 1108 | echo "" |
| 1109 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 1110 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 1111 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 1112 | echo "" | tee -a $LOG |
| 1113 | echo -en $BOLD |
| 1114 | if [ $DEPLOY_K8S == "yes" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1115 | echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$NAME\")\"" | tee -a $LOG |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1116 | fi |
| 1117 | echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG |
| 1118 | echo -en $NORMAL |
| 1119 | echo "" | tee -a $LOG |
| 1120 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 1121 | exit 0 |
| 1122 | fi |
| 1123 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1124 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1125 | bspin "Verify ETCD Operator $OLD_KEY" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1126 | if [ $(helm list --deployed --short --namespace voltha "^etcd-operator\$" | wc -l) -ne 1 ]; then |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1127 | espin $NOT_VERIFIED |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 1128 | helm_install - voltha etcd-operator stable/etcd-operator latest "Install ETCD Operator" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1129 | else |
| 1130 | espin $VERIFIED |
| 1131 | fi |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 1132 | EXPECT=$(test "$TYPE" == "minimal" && echo "1" || echo "3") |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 1133 | wait_for_pods - "voltha" $EXPECT "includes" -1 "Waiting for ETCD Operator to start" "etcd-operator-.*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1134 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1135 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1136 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1137 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1138 | STIME=$(date +%s) |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 1139 | if [ $WITH_ONOS == "yes" ]; then |
| 1140 | bspin "Verify ONOS installed $BIRD" |
| 1141 | if [ $(helm list --deployed --short --namespace default "^onos\$" | wc -l) -ne 1 ]; then |
| 1142 | espin $NOT_VERIFIED |
David K. Bainbridge | da33d65 | 2020-03-06 10:31:23 -0800 | [diff] [blame] | 1143 | EXTRA_HELM_FLAGS="$SET_TAG $EXTRA_HELM_FLAGS" helm_install - default onos $ONOS_CHART $ONOS_CHART_VERSION "Install ONOS" |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 1144 | else |
| 1145 | espin $VERIFIED |
| 1146 | fi |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 1147 | wait_for_pods - "default" 1 "includes" -1 "Waiting for ONOS to start" "onos-.*" |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1148 | |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 1149 | if [ $WITH_PORT_FORWARDS == "yes" ]; then |
| 1150 | bspin - "Forward ONOS API port $FORWARD" |
| 1151 | kill_port_forward onos-ui |
| 1152 | port_forward default onos-ui $ONOS_API_PORT 8181 |
| 1153 | espin - $VERIFIED |
| 1154 | bspin - "Forward ONOS SSH port $FORWARD" |
| 1155 | kill_port_forward onos-ssh |
| 1156 | port_forward default onos-ssh $ONOS_SSH_PORT 8101 |
| 1157 | espin - $VERIFIED |
| 1158 | _ONOS_API_EP="127.0.0.1:$ONOS_API_PORT" |
| 1159 | else |
| 1160 | _ONOS_API_EP=$(get_service_ep default onos-ui) |
| 1161 | fi |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 1162 | bspin - "Verify or download ONOS configuration support files $DOWNLOAD" |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1163 | ONOS_FILES="olt-onos-enableExtraneousRules.json onos-aaa.json \ |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 1164 | onos-dhcpl2relay.json onos-kafka.json onos-sadis-sample.json" |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 1165 | (set -x; mkdir -p ./onos-files >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 1166 | ERR_OUT=$(mktemp) |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 1167 | for i in $ONOS_FILES; do |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 1168 | if [ ! -r ./onos-files/$i ]; then |
David K. Bainbridge | a00736b | 2020-01-08 14:33:17 -0800 | [diff] [blame] | 1169 | (set -x; curl --fail -o ./onos-files/$i -sSL https://raw.githubusercontent.com/ciena/kind-voltha/$VK_RELEASE/onos-files/$i >>$LOG 2>$ERR_OUT) >>$LOG 2>&1 |
| 1170 | if [ $? -ne 0 ]; then |
| 1171 | espin - $THEX |
| 1172 | echo -e "${RED}${BOLD}${ERROR}ERROR: $i${NORMAL}${RED} - $(cat $ERR_OUT)${NORMAL}" |
| 1173 | echo "ERROR: $(cat $ERR_OUT)" >>$LOG |
| 1174 | rm -rf $ERR_OUT ./onos-files/$i |
| 1175 | exit 1 |
| 1176 | fi |
| 1177 | rm -rf $ERR_OUT |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 1178 | fi |
| 1179 | done |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1180 | espin - $VERIFIED |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 1181 | |
| 1182 | if [ $INSTALL_ONOS_APPS == "yes" ]; then |
| 1183 | bspin - "Installing custom ONOS applications" |
| 1184 | if [ -x onos-files/onos-apps -a $(ls -1 onos-files/onos-apps/*.oar 2>/dev/null | wc -l) -gt 0 ]; then |
| 1185 | for OAR in $(ls -1 onos-files/onos-apps/*.oar); do |
| 1186 | sspin - "Installing custom ONOS applications - $OAR$CEOL" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 1187 | override_onos_app $OAR |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 1188 | done |
| 1189 | espin - "$VERIFIED Installing custom ONOS applications$CEOL" |
| 1190 | else |
| 1191 | espin - "$NOT_VERIFIED Installing custom ONOS applications - None Found" |
| 1192 | fi |
| 1193 | fi |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1194 | |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 1195 | check_onos_app_active org.opencord.kafka |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1196 | push_onos_config "file" "Push ONOS Kafka Configuration" "network/configuration/apps/org.opencord.kafka" "onos-files/onos-kafka.json" |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 1197 | check_onos_app_active org.opencord.dhcpl2relay |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1198 | push_onos_config "file" "Push ONOS DHCP L2 Relay Configuration" "network/configuration/apps/org.opencord.dhcpl2relay" "onos-files/onos-dhcpl2relay.json" |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 1199 | check_onos_app_active org.opencord.olt |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1200 | # FIXME use WITH_DHCP and WITH_EAPOL flags to configre OLT App |
Hardik Windlass | a7501fb | 2020-02-17 14:28:20 +0000 | [diff] [blame] | 1201 | # Default value for "enableEapol" is true in OLT App |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1202 | if [ $WITH_EAPOL == "yes" ]; then |
| 1203 | push_onos_config "json" "Enable VOLTHA ONOS EAPOL provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableEapol":true}' |
Hardik Windlass | a7501fb | 2020-02-17 14:28:20 +0000 | [diff] [blame] | 1204 | elif [ $WITH_EAPOL == "no" ]; then |
| 1205 | push_onos_config "json" "Disable VOLTHA ONOS EAPOL provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableEapol":false}' |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1206 | fi |
Hardik Windlass | a7501fb | 2020-02-17 14:28:20 +0000 | [diff] [blame] | 1207 | # Default value for "enableDhcpOnProvisioning" is false and for "enableDhcpV4" is true in OLT App |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1208 | if [ $WITH_DHCP == "yes" ]; then |
| 1209 | push_onos_config "json" "Enable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableDhcpOnProvisioning":true,"enableDhcpV4":true}' |
Hardik Windlass | a7501fb | 2020-02-17 14:28:20 +0000 | [diff] [blame] | 1210 | elif [ $WITH_DHCP == "no" ]; then |
| 1211 | push_onos_config "json" "Disable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableDhcpOnProvisioning":false,"enableDhcpV4":false}' |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1212 | fi |
Hardik Windlass | a7501fb | 2020-02-17 14:28:20 +0000 | [diff] [blame] | 1213 | # Default value for "enableIgmpOnProvisioning" is false in OLT App |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1214 | if [ $WITH_IGMP == "yes" ]; then |
| 1215 | push_onos_config "json" "Enable VOLTHA ONOS IGMP provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableIgmpOnProvisioning":true}' |
Hardik Windlass | a7501fb | 2020-02-17 14:28:20 +0000 | [diff] [blame] | 1216 | elif [ $WITH_IGMP == "no" ]; then |
| 1217 | push_onos_config "json" "Disable VOLTHA ONOS IGMP provisioning" "configuration/org.opencord.olt.impl.OltFlowService" '{"enableIgmpOnProvisioning":false}' |
Matteo Scandolo | 78dfee0 | 2020-02-13 16:18:03 -0800 | [diff] [blame] | 1218 | fi |
David K. Bainbridge | 484d80c | 2020-03-05 21:44:34 -0800 | [diff] [blame] | 1219 | if [ $ENABLE_ONOS_EXTRANEOUS_RULES == "yes" ]; then |
| 1220 | push_onos_config "file" "Enabling extraneous rules for ONOS" "configuration/org.onosproject.net.flow.impl.FlowRuleManager" "onos-files/olt-onos-enableExtraneousRules.json" |
| 1221 | fi |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 1222 | if [ $(echo ":yes:file:" | grep -c ":$CONFIG_SADIS:") -eq 1 ]; then |
Matteo Scandolo | 9a77a73 | 2020-01-09 14:24:12 -0800 | [diff] [blame] | 1223 | check_onos_app_active org.opencord.sadis |
Hardik Windlass | b314760 | 2020-03-09 16:59:15 +0530 | [diff] [blame] | 1224 | push_onos_config "file" "[optional] Push ONOS SADIS Configuration: $SADIS_CFG" "network/configuration/apps/org.opencord.sadis" "$SADIS_CFG" |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 1225 | elif [ "$CONFIG_SADIS" == "bbsim" ]; then |
| 1226 | push_onos_config "json" \ |
| 1227 | "[optional] Push ONOS configuration for BBSIM SADIS servers" \ |
| 1228 | "network/configuration/apps/org.opencord.sadis" \ |
| 1229 | "$(echo $(cat <<EOJ |
| 1230 | { |
| 1231 | "sadis": { |
| 1232 | "integration": { |
| 1233 | "url": "http://bbsim.voltha.svc.cluster.local:50074/v2/subscribers/%s", |
| 1234 | "cache": { |
| 1235 | "enabled": true, |
| 1236 | "maxsize": 50, |
| 1237 | "ttl": "PT1m" |
| 1238 | } |
| 1239 | } |
| 1240 | }, |
| 1241 | "bandwidthprofile": { |
| 1242 | "integration": { |
| 1243 | "url": "http://bbsim.voltha.svc.cluster.local:50074/v2/bandwidthprofiles/%s", |
| 1244 | "cache": { |
| 1245 | "enabled": true, |
| 1246 | "maxsize": 50, |
| 1247 | "ttl": "PT1m" |
| 1248 | } |
| 1249 | } |
| 1250 | } |
| 1251 | } |
| 1252 | EOJ |
| 1253 | ) | tr -d '[:space:]')" |
| 1254 | elif [ "$CONFIG_SADIS" == "url" ]; then |
| 1255 | push_onos_config "json" \ |
| 1256 | "[optional] Push ONOS configuration for custom SADIS and Bandwidth Profile servers" \ |
| 1257 | "network/configuration/apps/org.opencord.sadis" \ |
| 1258 | "$(echo $(cat <<EOJ |
| 1259 | { |
| 1260 | "sadis": { |
| 1261 | "integration": { |
| 1262 | "url": "$SADIS_SUBSCRIBERS", |
| 1263 | "cache": { |
| 1264 | "enabled": true, |
| 1265 | "maxsize": 50, |
| 1266 | "ttl": "PT1m" |
| 1267 | } |
| 1268 | } |
| 1269 | }, |
| 1270 | "bandwidthprofile": { |
| 1271 | "integration": { |
| 1272 | "url": "$SADIS_BANDWIDTH_PROFILES", |
| 1273 | "cache": { |
| 1274 | "enabled": true, |
| 1275 | "maxsize": 50, |
| 1276 | "ttl": "PT1m" |
| 1277 | } |
| 1278 | } |
| 1279 | } |
| 1280 | } |
| 1281 | EOJ |
| 1282 | ) | tr -d '[:space:]')" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 1283 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1284 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1285 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1286 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1287 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1288 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1289 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1290 | bspin "Verify VOLTHA installed $HIGH_VOLTAGE" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1291 | if [ $(helm list --deployed --short --namespace voltha "^voltha\$" | wc -l) -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1292 | espin $NOT_VERIFIED |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 1293 | if [ "$ONLY_ONE" == "yes" ]; then |
David K. Bainbridge | c859145 | 2020-03-09 18:56:03 -0700 | [diff] [blame] | 1294 | EXTRA_HELM_INSTALL_ARGS="--set therecanbeonlyone=true" |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 1295 | fi |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 1296 | helm_install - voltha voltha $VOLTHA_CHART $VOLTHA_CHART_VERSION "Install VOLTHA Core" |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 1297 | EXTRA_HELM_INSTALL_ARGS= |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1298 | else |
| 1299 | espin $VERIFIED |
| 1300 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1301 | |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 1302 | VOLTHA="voltha-ofagent-.* \ |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1303 | ro-core.* \ |
| 1304 | rw-core.* \ |
| 1305 | voltha-api-server-.* \ |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1306 | voltha-etcd-cluster-.* \ |
| 1307 | voltha-kafka-.* \ |
| 1308 | voltha-zookeeper-.*" |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 1309 | if [ "$ONLY_ONE" == "yes" ]; then |
David Bainbridge | fce8af4 | 2020-03-17 12:50:39 -0700 | [diff] [blame^] | 1310 | EXPECT=$(test "$TYPE" == "minimal" && echo "5" || echo "9") |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 1311 | else |
David Bainbridge | fce8af4 | 2020-03-17 12:50:39 -0700 | [diff] [blame^] | 1312 | EXPECT=$(test "$TYPE" == "minimal" && echo "8" || echo "12") |
David Bainbridge | 70c0ea8 | 2019-11-14 23:25:26 +0000 | [diff] [blame] | 1313 | fi |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 1314 | wait_for_pods - "voltha" $EXPECT "includes" -1 "Waiting for VOLTHA Core to start" $VOLTHA |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1315 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1316 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1317 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1318 | |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 1319 | if [ "$WITH_ADAPTERS" == "yes" ]; then |
| 1320 | STIME=$(date +%s) |
| 1321 | EXPECT=0 |
| 1322 | echo -e "Verify Adapters $PLUG" |
| 1323 | if [ "$WITH_SIM_ADAPTERS" == "yes" ]; then |
| 1324 | bspin - "Verify Simulated Adapters installed" |
| 1325 | if [ $(helm list --deployed --short --namespace voltha "^sim\$" | wc -l) -ne 1 ]; then |
| 1326 | espin - $NOT_VERIFIED |
| 1327 | helm_install - voltha sim $VOLTHA_ADAPTER_SIM_CHART $VOLTHA_ADAPTER_SIM_CHART_VERSION "Install Simulated Adapters" |
| 1328 | else |
| 1329 | espin - $VERIFIED |
| 1330 | fi |
| 1331 | EXPECT=$(expr $EXPECT + 2) |
| 1332 | fi |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1333 | |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 1334 | if [ "$WITH_OPEN_ADAPTERS" == "yes" ]; then |
| 1335 | bspin - "Verify OpenOLT Adapter installed" |
| 1336 | if [ $(helm list --deployed --short --namespace voltha "^open-olt\$" | wc -l) -ne 1 ]; then |
| 1337 | espin - $NOT_VERIFIED |
| 1338 | helm_install - voltha open-olt $VOLTHA_ADAPTER_OPEN_OLT_CHART $VOLTHA_ADAPTER_OPEN_OLT_CHART_VERSION "Install OpenOLT Adapter" |
| 1339 | else |
| 1340 | espin - $VERIFIED |
| 1341 | fi |
| 1342 | bspin - "Verify OpenONU Adapter installed" |
| 1343 | if [ $(helm list --deployed --short --namespace voltha "^open-onu\$" | wc -l) -ne 1 ]; then |
| 1344 | espin - $NOT_VERIFIED |
| 1345 | helm_install - voltha open-onu $VOLTHA_ADAPTER_OPEN_ONU_CHART $VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION "Install OpenONU Adapter" |
| 1346 | else |
| 1347 | espin - $VERIFIED |
| 1348 | fi |
| 1349 | EXPECT=$(expr $EXPECT + 2) |
| 1350 | fi |
Matteo Scandolo | 7ef6ba5 | 2019-10-04 09:20:37 -0700 | [diff] [blame] | 1351 | |
David Bainbridge | 46505fb | 2019-10-01 21:13:20 +0000 | [diff] [blame] | 1352 | ADAPTERS="adapter-.*" |
| 1353 | wait_for_pods - "voltha" $EXPECT "includes" -1 "Waiting for adapters to start" $ADAPTERS |
| 1354 | if [ "$WITH_TIMINGS" == "yes" ]; then |
| 1355 | printtime $(expr $(date +%s) - $STIME) |
| 1356 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1357 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1358 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1359 | if [ $WITH_BBSIM == "yes" ]; then |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1360 | STIME=$(date +%s) |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1361 | echo -e "Verify BBSIM $PLUG" |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1362 | bspin - "Verify BBSIM Installed" |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 1363 | for instance in $(seq 0 $(($NUM_OF_BBSIM-1))); do |
| 1364 | if [ $instance -eq 0 ]; then |
| 1365 | instance_num="" |
| 1366 | else |
| 1367 | instance_num=$instance |
| 1368 | fi |
| 1369 | if [ $(helm list --deployed --short --namespace voltha "^bbsim${instance_num}\$" | wc -l) -ne 1 ]; then |
| 1370 | espin - $NOT_VERIFIED |
David K. Bainbridge | c859145 | 2020-03-09 18:56:03 -0700 | [diff] [blame] | 1371 | SAVED=$EXTRA_HELM_INSTALL_ARGS |
| 1372 | EXTRA_HELM_INSTALL_ARGS+=" --set olt_id=$instance" |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 1373 | helm_install - voltha bbsim${instance_num} $VOLTHA_BBSIM_CHART $VOLTHA_BBSIM_CHART_VERSION "Install BBSIM${instance_num}" |
David K. Bainbridge | c859145 | 2020-03-09 18:56:03 -0700 | [diff] [blame] | 1374 | EXTRA_HELM_INSTALL_ARGS=$SAVED |
David K. Bainbridge | 4342240 | 2020-03-06 07:41:22 -0800 | [diff] [blame] | 1375 | else |
| 1376 | espin - $VERIFIED |
| 1377 | fi |
| 1378 | done |
uottremb | b16d398 | 2020-02-28 08:34:36 +0100 | [diff] [blame] | 1379 | wait_for_pods - "voltha" $NUM_OF_BBSIM "includes" -1 "Waiting for BBSIM to start" "bbsim*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1380 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1381 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1382 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1383 | fi |
| 1384 | |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1385 | if [ $WITH_RADIUS == "yes" ]; then |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1386 | STIME=$(date +%s) |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1387 | echo -e "Verify RADIUS $LOCK" |
| 1388 | bspin - "Verify RADIUS Installed" |
| 1389 | if [ $(helm list --deployed --short --namespace voltha "^radius\$" | wc -l) -ne 1 ]; then |
| 1390 | espin - $NOT_VERIFIED |
David Bainbridge | 90fd8e3 | 2019-08-21 23:32:47 +0000 | [diff] [blame] | 1391 | helm_install - voltha radius onf/freeradius latest "Install RADIUS" |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1392 | else |
| 1393 | espin - $VERIFIED |
| 1394 | fi |
David Bainbridge | 4f1b556 | 2019-08-19 04:46:52 +0000 | [diff] [blame] | 1395 | wait_for_pods - "voltha" 1 "includes" -1 "Waiting for RADIUS to start" "radius-.*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1396 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1397 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1398 | fi |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1399 | fi |
| 1400 | |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 1401 | if [ $WITH_PORT_FORWARDS == "yes" ]; then |
| 1402 | STIME=$(date +%s) |
| 1403 | bspin - "Forward VOLTHA API port $FORWARD" |
| 1404 | kill_port_forward voltha-api |
| 1405 | port_forward voltha voltha-api $VOLTHA_API_PORT 55555 |
| 1406 | espin - $VERIFIED |
| 1407 | bspin - "Forward VOLTHA ETCD port $FORWARD" |
| 1408 | kill_port_forward voltha-etcd-cluster-client |
| 1409 | port_forward voltha voltha-etcd-cluster-client $VOLTHA_ETCD_PORT 2379 |
| 1410 | espin - $VERIFIED |
| 1411 | bspin - "Forward VOLTHA Kafka port $FORWARD" |
| 1412 | kill_port_forward voltha-kafka |
| 1413 | port_forward voltha voltha-kafka $VOLTHA_KAFKA_PORT 9092 |
| 1414 | espin - $VERIFIED |
| 1415 | if [ "$WITH_TIMINGS" == "yes" ]; then |
| 1416 | printtime $(expr $(date +%s) - $STIME) |
| 1417 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1418 | fi |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 1419 | |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 1420 | if [ $WITH_ONOS == "yes" -a $WITH_RADIUS == "yes" ]; then |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1421 | bspin "Configure ONOS RADIUS Connection $GEAR" |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 1422 | (set -x; cat onos-files/onos-aaa.json | sed -e "s/:RADIUS_IP:/$(kubectl -n voltha get service/radius -o jsonpath={.spec.clusterIP})/g" | curl --fail -sSL --user karaf:karaf -X POST http://$_ONOS_API_EP/onos/v1/network/configuration/apps/org.opencord.aaa -H Content-type:application/json -d@- >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1423 | espin $VERIFIED |
| 1424 | fi |
| 1425 | |
David Bainbridge | 99ac7a2 | 2019-08-31 02:26:43 +0000 | [diff] [blame] | 1426 | if [ "$WITH_CHAOS" == "yes" ]; then |
| 1427 | STIME=$(date +%s) |
| 1428 | echo -e "Verify kube-monkey $LOCK" |
| 1429 | bspin - "Verify kube-monkey Installed" |
| 1430 | if [ $(helm list --deployed --short --namespace kube-monkey "^monkey\$" | wc -l) -ne 1 ]; then |
| 1431 | espin - $NOT_VERIFIED |
| 1432 | helm_install - kube-monkey monkey ./kube-monkey/helm/kubemonkey latest "Install Chaos Monkey" |
| 1433 | else |
| 1434 | espin - $VERIFIED |
| 1435 | fi |
| 1436 | wait_for_pods - "kube-monkey" 1 "includes" -1 "Waiting for Chaos to start" "monkey-.*" |
| 1437 | if [ "$WITH_TIMINGS" == "yes" ]; then |
| 1438 | printtime $(expr $(date +%s) - $STIME) |
| 1439 | fi |
| 1440 | fi |
| 1441 | |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1442 | bspin "Create voltctl configuration file" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 1443 | (set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 1444 | MIN_VC_VERSION=$(echo -e "1.0.15\n$VC_VERSION" | sort -V | head -1) |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 1445 | if [ $WITH_PORT_FORWARDS == "yes" ]; then |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 1446 | KAFKA_FLAG="-k localhost:$VOLTHA_KAFKA_PORT" |
| 1447 | SERVER_FLAG="-s localhost:$VOLTHA_API_PORT" |
| 1448 | ETCD_FLAG= |
| 1449 | if [ "$MIN_VC_VERSION" == "1.0.15" ]; then |
| 1450 | ETCD_FLAG="-e localhost:$VOLTHA_ETCD_PORT" |
| 1451 | fi |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 1452 | else |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 1453 | KAFKA_FLAG="-k $(get_service_ep voltha voltha-kafka)" |
| 1454 | SERVER_FLAG="-s $(get_service_ep voltha voltha-api)" |
| 1455 | ETCD_FLAG= |
| 1456 | if [ "$MIN_VC_VERSION" == "1.0.15" ]; then |
| 1457 | ETCD_FLAG="-e $(get_service_ep voltha voltha-etcd-client)" |
| 1458 | fi |
David K. Bainbridge | 4a06a4a | 2020-03-02 14:15:23 -0800 | [diff] [blame] | 1459 | fi |
David K. Bainbridge | b859e91 | 2020-03-13 14:07:52 -0700 | [diff] [blame] | 1460 | (set -x; voltctl -a v3 $KAFKA_FLAG $SERVER_FLAG $ETCD_FLAG config > $HOME/.volt/config-$NAME 2>>$LOG) >>$LOG 2>&1 |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1461 | espin $VERIFIED |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 1462 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1463 | if [ ! -f "$NAME-env.sh" ]; then |
| 1464 | touch $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1465 | fi |
| 1466 | |
David Bainbridge | 596f30d | 2019-07-30 17:07:59 +0000 | [diff] [blame] | 1467 | for O in $ALL_OPTIONS; do |
| 1468 | VAL=$(eval echo \$$O) |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1469 | if [ ! -z "$VAL" -a $(grep -c "^export $O=" $NAME-env.sh) -eq 0 ]; then |
| 1470 | echo "export $O=\"$(eval echo \$$O)\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1471 | fi |
| 1472 | done |
| 1473 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1474 | if [ $DEPLOY_K8S == "yes" -a $(grep -c "^export KUBECONFIG=" $NAME-env.sh) -eq 0 ]; then |
| 1475 | echo "export KUBECONFIG=\"$(./bin/kind get kubeconfig-path --name=voltha-$NAME)\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1476 | fi |
| 1477 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1478 | if [ $(grep -c "^export VOLTCONFIG=" $NAME-env.sh) -eq 0 ]; then |
| 1479 | echo "export VOLTCONFIG=\"$HOME/.volt/config-$NAME\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1480 | fi |
| 1481 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1482 | if [ $(grep -c "^export PATH=" $NAME-env.sh) -eq 0 ]; then |
| 1483 | echo "export PATH=\"$GOPATH/bin:\$PATH\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1484 | fi |
| 1485 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1486 | echo "" |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 1487 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 1488 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 1489 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 1490 | echo "" | tee -a $LOG |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1491 | echo -en $BOLD |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1492 | if [ $DEPLOY_K8S == "yes" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1493 | echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$NAME\")\"" | tee -a $LOG |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1494 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1495 | echo "export VOLTCONFIG=\"$HOME/.volt/config-$NAME\"" | tee -a $LOG |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1496 | echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1497 | echo -en $NORMAL |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 1498 | echo "" | tee -a $LOG |
| 1499 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 1500 | |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1501 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | f858a02 | 2019-08-14 21:25:11 +0000 | [diff] [blame] | 1502 | echo -e "$CLOCK ${BOLD}TOTAL: $(duration $(expr $(date +%s) - $TOTAL_START_TIME))${NORMAL}" |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1503 | fi |