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 | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 15 | TOTAL_START_TIME=$(date +%s) |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 16 | |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 17 | FANCY=${FANCY:-1} |
| 18 | if [ "$TERM X" == " X" ]; then |
| 19 | FANCY=0 |
| 20 | fi |
| 21 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 22 | # trap ctrl-c and call ctrl_c() |
| 23 | trap ctrl_c INT |
| 24 | |
| 25 | function ctrl_c() { |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 26 | echo -en $CNORM |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 27 | echo "" |
| 28 | echo "ctrl-c trapped" |
| 29 | echo "Thank you for trying 'votlha up'" |
| 30 | exit |
| 31 | } |
| 32 | |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 33 | VOLTCTL_VERSION=${VOLTCTL_VERSION:-0.0.5-dev} |
| 34 | KIND_VERSION=${KIND_VERSION:-v0.4.0} |
| 35 | _VOLTCTL_VERSION=$(echo $VOLTCTL_VERSION | sed -e 's/-/_/g') |
| 36 | |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 37 | BLACK= |
| 38 | RED= |
| 39 | GREEN= |
| 40 | YELLOW= |
| 41 | BLUE= |
| 42 | MAGENTA= |
| 43 | CYAN= |
| 44 | WHITE= |
| 45 | BOLD= |
| 46 | NORMAL= |
| 47 | ERROR= |
| 48 | CEOL= |
| 49 | CNORM= |
| 50 | CIVIS= |
| 51 | if [ $FANCY -eq 1 ]; then |
| 52 | BLACK=$(tput setaf 0) |
| 53 | RED=$(tput setaf 1) |
| 54 | GREEN=$(tput setaf 2) |
| 55 | YELLOW=$(tput setaf 3) |
| 56 | BLUE=$(tput setaf 4) |
| 57 | MAGENTA=$(tput setaf 5) |
| 58 | CYAN=$(tput setaf 6) |
| 59 | WHITE=$(tput setaf 7) |
| 60 | BOLD=$(tput bold) |
| 61 | NORMAL=$(tput sgr0) |
| 62 | ERROR="\xe2\x9c\x97\x20" |
| 63 | CEOL=$(tput el) |
| 64 | CNORM=$(tput cnorm) |
| 65 | CIVIS=$(tput civis) |
| 66 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 67 | |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 68 | TYPE=${TYPE:-minimal} |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 69 | NAME=${NAME:-$TYPE} |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 70 | WITH_TIMINGS=${WITH_TIMINGS:-no} |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 71 | WITH_BBSIM=${WITH_BBSIM:-no} |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 72 | WITH_RADIUS=${WITH_RADIUS:-no} |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 73 | WITH_ONOS=${WITH_ONOS:-yes} |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 74 | CONFIG_SADIS=${CONFIG_SADIS:-no} |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 75 | INSTALL_ONOS_APPS=${INSTALL_ONOS_APPS:-no} |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 76 | WITH_TP=${WITH_TP:-yes} |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 77 | JUST_K8S=${JUST_K8S:-no} |
| 78 | DEPLOY_K8S=${DEPLOY_K8S:-yes} |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 79 | SKIP_RESTART_API=${SKIP_RESTART_API:-no} |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 80 | INSTALL_KUBECTL=${INSTALL_KUBECTL:-yes} |
| 81 | INSTALL_HELM=${INSTALL_HELM:-yes} |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 82 | USE_GO=${USE_GO:-yes} |
| 83 | VOLTHA_LOG_LEVEL=${VOLTHA_LOG_LEVEL:-WARN} |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 84 | VOLTHA_CHART=${VOLTHA_CHART:=onf/voltha} |
| 85 | VOLTHA_ADAPTER_SIM_CHART=${VOLTHA_ADAPTER_SIM_CHART:-onf/voltha-adapter-simulated} |
| 86 | VOLTHA_ADAPTER_OPEN_OLT_CHART=${VOLTHA_ADAPTER_OPEN_OLT_CHART:-onf/voltha-adapter-openolt} |
| 87 | VOLTHA_ADAPTER_OPEN_ONU_CHART=${VOLTHA_ADAPTER_OPEN_ONU_CHART:-onf/voltha-adapter-openonu} |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 88 | |
| 89 | HAVE_GO=$(which go >/dev/null 2>&1 && echo "yes" || echo "no") |
| 90 | HOSTOS=$(uname -s | tr "[:upper:]" "[:lower:"]) |
| 91 | HOSTARCH=$(uname -m | tr "[:upper:]" "[:lower:"]) |
| 92 | if [ $HOSTARCH == "x86_64" ]; then |
| 93 | HOSTARCH="amd64" |
| 94 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 95 | |
| 96 | # Verify TYPE setting |
| 97 | if [ $(echo ":minimal:full:" | grep -ic ":$TYPE:") -eq 0 ]; then |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 98 | >&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] | 99 | exit 1 |
| 100 | fi |
| 101 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame^] | 102 | # Used to verify configuration values are set to "yes" or "no" value or convert |
| 103 | # equivalents to "yes" or "no" |
| 104 | function verify_yes_no() { |
| 105 | local VAR=$1 |
| 106 | local VAL=$(eval echo \$$VAR) |
| 107 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$VAL:") -eq 0 ]; then |
| 108 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid '$VAR' value of '$VAL'. Should be 'yes' or 'no'${NORMAL}" |
| 109 | echo "INVALID" |
| 110 | return 1 |
| 111 | fi |
| 112 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$VAL:") -eq 1 ]; then |
| 113 | echo "yes" |
| 114 | else |
| 115 | echo "no" |
| 116 | fi |
| 117 | return 0 |
| 118 | } |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 119 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame^] | 120 | ALL_YES_NO="\ |
| 121 | WITH_TIMINGS \ |
| 122 | WITH_BBSIM \ |
| 123 | WITH_RADIUS \ |
| 124 | WITH_ONOS \ |
| 125 | WITH_TP \ |
| 126 | CONFIG_SADIS \ |
| 127 | JUST_K8S \ |
| 128 | DEPLOY_K8S \ |
| 129 | INSTALL_ONOS_APPS \ |
| 130 | SKIP_RESTART_API \ |
| 131 | INSTALL_KUBECTL \ |
| 132 | INSTALL_HELM \ |
| 133 | USE_GO \ |
| 134 | " |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 135 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame^] | 136 | ALL_OPTIONS="\ |
| 137 | NAME \ |
| 138 | TYPE \ |
| 139 | $ALL_YES_NO \ |
| 140 | VOLTHA_LOG_LEVEL \ |
| 141 | VOLTHA_CHART \ |
| 142 | VOLTHA_ADAPTER_SIM_CHART \ |
| 143 | VOLTHA_ADAPTER_OPEN_OLT_CHART \ |
| 144 | VOLTHA_ADAPTER_OPEN_ONU_CHART \ |
| 145 | ONOS_TAG \ |
| 146 | ONOS_API_PORT \ |
| 147 | ONOS_SSH_PORT \ |
| 148 | VOLTHA_API_PORT \ |
| 149 | VOLTHA_SSH_PORT \ |
| 150 | VOLTHA_ETCD_PORT \ |
| 151 | " |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 152 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame^] | 153 | # Iterate over yes/no configuration options and validate |
| 154 | for VAR in $ALL_YES_NO; do |
| 155 | eval $VAR=$(verify_yes_no $VAR) |
| 156 | if [ "$(eval echo \$$VAR)" == "INVALID" ]; then |
| 157 | exit 1; |
| 158 | fi |
| 159 | done |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 160 | |
David Bainbridge | 2a0b8a4 | 2019-08-16 17:39:29 +0000 | [diff] [blame^] | 161 | # Convert USE_GO from yes/no to true/false for helm chart usage |
| 162 | if [ "$USE_GO" == "yes" ]; then |
David Bainbridge | 1ceabc1 | 2019-07-25 17:21:05 +0000 | [diff] [blame] | 163 | USE_GO=true |
| 164 | else |
| 165 | USE_GO=false |
| 166 | fi |
| 167 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 168 | mkdir -p .voltha |
| 169 | touch .voltha/ports |
| 170 | HAVE=$(grep $NAME .voltha/ports) |
| 171 | if [ "$HAVE X" == " X" ]; then |
| 172 | # Find free port prefix |
| 173 | START=81 |
| 174 | while true; do |
| 175 | if [ $(grep -c $START .voltha/ports) -eq 0 ]; then |
| 176 | break |
| 177 | fi |
| 178 | START=$(expr $START + 1) |
| 179 | done |
| 180 | DELTA=$(expr $START - 81) |
| 181 | ONOS_API_PORT=${START}81 |
| 182 | ONOS_SSH_PORT=${START}01 |
| 183 | VOLTHA_API_PORT=5$(expr 55 + $DELTA)55 |
| 184 | VOLTHA_SSH_PORT=$(expr 50 + $DELTA)22 |
| 185 | VOLTHA_ETCD_PORT=$(expr 23 + $DELTA)79 |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 186 | else |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 187 | VALUES=$(echo $HAVE | sed -e 's/\s//g' | cut -d= -f2) |
| 188 | ONOS_API_PORT=$(echo $VALUES | cut -d, -f1) |
| 189 | ONOS_SSH_PORT=$(echo $VALUES | cut -d, -f2) |
| 190 | VOLTHA_API_PORT=$(echo $VALUES | cut -d, -f3) |
| 191 | VOLTHA_SSH_PORT=$(echo $VALUES | cut -d, -f4) |
| 192 | VOLTHA_ETCD_PORT=$(echo $VALUES | cut -d, -f5) |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 193 | fi |
| 194 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 195 | PORTTMP=$(mktemp -u) |
| 196 | cat .voltha/ports | grep -v $NAME > $PORTTMP |
| 197 | echo "$NAME=$ONOS_API_PORT,$ONOS_SSH_PORT,$VOLTHA_API_PORT,$VOLTHA_SSH_PORT,$VOLTHA_ETCD_PORT" >> $PORTTMP |
| 198 | cp $PORTTMP .voltha/ports |
| 199 | rm -f $PORTTMP |
| 200 | |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 201 | ONOS_TAG=${ONOS_TAG:-} |
| 202 | if [ "$WITH_TP" == "yes" -a "$ONOS_TAG X" == " X" ]; then |
| 203 | ONOS_TAG="voltha-1.7" |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 204 | fi |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 205 | export ONOS_API_PORT ONOS_SSH_PORT |
David Bainbridge | 0129495 | 2019-07-30 19:33:45 +0000 | [diff] [blame] | 206 | |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 207 | IDX=1 |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 208 | CLOCK="TIME:" |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 209 | SPIN_PARTS= |
| 210 | NOT_VERIFIED= |
David Bainbridge | f858a02 | 2019-08-14 21:25:11 +0000 | [diff] [blame] | 211 | THEX= |
| 212 | BUILD= |
| 213 | CROSS= |
| 214 | ENTER= |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 215 | VERIFIED= |
| 216 | HELM= |
| 217 | OLD_KEY= |
| 218 | BIRD= |
| 219 | HIGH_VOLTAGE= |
| 220 | PLUG= |
| 221 | RESTART= |
| 222 | FORWARD= |
| 223 | INSTALL= |
| 224 | STOP= |
| 225 | GO= |
| 226 | DOWNLOAD= |
| 227 | GEAR= |
| 228 | NO_ENTRY= |
| 229 | LOCK= |
| 230 | |
| 231 | if [ $FANCY -eq 1 ]; then |
| 232 | SPIN_PARTS="\ |
| 233 | \xe2\xa2\x8e\xe2\xa1\xb0 \ |
| 234 | \xe2\xa2\x8e\xe2\xa1\xa1 \ |
| 235 | \xe2\xa2\x8e\xe2\xa1\x91 \ |
| 236 | \xe2\xa2\x8e\xe2\xa0\xb1 \ |
| 237 | \xe2\xa0\x8e\xe2\xa1\xb1 \ |
| 238 | \xe2\xa2\x8a\xe2\xa1\xb1 \ |
| 239 | \xe2\xa2\x8c\xe2\xa1\xb1 \ |
| 240 | \xe2\xa2\x86\xe2\xa1\xb1 \ |
| 241 | " |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 242 | CLOCK="\xe2\x8f\xb1" |
David Bainbridge | f858a02 | 2019-08-14 21:25:11 +0000 | [diff] [blame] | 243 | THEX="${RED}${BOLD}\xe2\x9c\x97\x20${NORMAL}" |
| 244 | ENTER="${YELLOW}${BOLD}\xe2\x8e\x86${NORMAL}" |
| 245 | CROSS="${YELLOW}${BOLD}\xe2\x9c\x9a${NORMAL}" |
| 246 | BUILD="${YELLOW}${BOLD}\xf0\x9f\x8f\x97${NORMAL}" |
| 247 | NOT_VERIFIED="$BUILD" |
| 248 | VERIFIED="${GREEN}${BOLD}\xe2\x9c\x93\x20${NORMAL}" |
| 249 | HELM="${BLUE}${BOLD}\xE2\x8E\x88${NORMAL}" |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 250 | OLD_KEY="\xF0\x9F\x97\x9D" |
| 251 | BIRD="\xF0\x9F\x90\xA6" |
| 252 | HIGH_VOLTAGE="\xE2\x9A\xA1" |
| 253 | PLUG="\xF0\x9F\xa7\xa9" |
| 254 | RESTART="\xf0\x9f\x94\x84" |
| 255 | FORWARD="\xE2\x87\xA8" |
| 256 | INSTALL="\xF0\x9F\x8F\x97" |
| 257 | STOP="\xf0\x9f\x9b\x91" |
| 258 | GO="\xf0\x9f\x9a\x80" |
| 259 | DOWNLOAD="\xf0\x9f\x93\xa5" |
| 260 | GEAR="\xe2\x9a\x99" |
| 261 | NO_ENTRY="\xe2\x9b\x94" |
| 262 | LOCK="\xf0\x9f\x94\x92" |
| 263 | fi |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 264 | |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 265 | duration() { |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 266 | local h=$(expr $1 / 3600) |
| 267 | local m=$(expr $1 % 3600 / 60) |
| 268 | local s=$(expr $1 % 60) |
| 269 | local t="" |
| 270 | |
| 271 | if [ $h -gt 0 ]; then |
| 272 | t="$t${h}h" |
| 273 | fi |
| 274 | if [ $m -gt 0 ]; then |
| 275 | t="$t${m}m" |
| 276 | fi |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 277 | echo "$t${s}s" |
| 278 | } |
| 279 | |
| 280 | printtime() { |
| 281 | local INDENT= |
| 282 | if [ "$1" == "-" ]; then |
| 283 | INDENT=" " |
| 284 | shift |
| 285 | fi |
| 286 | echo -e "$INDENT $CLOCK $(duration $1)" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 287 | } |
| 288 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 289 | bspin() { |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 290 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 291 | local INDENT= |
| 292 | if [ "$1" == "-" ]; then |
| 293 | INDENT=" " |
| 294 | shift |
| 295 | fi |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 296 | if [ $FANCY -eq 0 ]; then |
| 297 | LINE=$(echo $* | sed -e 's/[\s+-]//g') |
| 298 | if [ "$LINE X" == " X" ]; then |
| 299 | return |
| 300 | fi |
| 301 | echo -e "$CIVIS$INDENT$*" |
| 302 | else |
| 303 | echo -en "$CIVIS$INDENT $*" |
| 304 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | sspin() { |
| 308 | local INDENT= |
| 309 | if [ "$1" == "-" ]; then |
| 310 | INDENT=" " |
| 311 | shift |
| 312 | fi |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 313 | if [ $FANCY -eq 0 ]; then |
| 314 | LINE=$(echo $* | sed -e 's/[\s+-]//g') |
| 315 | if [ "$LINE X" == " X" ]; then |
| 316 | return |
| 317 | fi |
| 318 | echo -e "$INDENT$*" |
| 319 | else |
| 320 | C=$(echo $SPIN_PARTS | cut '-d ' -f $IDX) |
| 321 | echo -en "\r$INDENT$C $*" |
| 322 | IDX=$(expr $IDX + 1) |
| 323 | if [ $IDX -gt 8 ]; then |
| 324 | IDX=1 |
| 325 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 326 | fi |
| 327 | } |
| 328 | |
| 329 | espin() { |
| 330 | local INDENT= |
| 331 | if [ "$1" == "-" ]; then |
| 332 | INDENT=" " |
| 333 | shift |
| 334 | fi |
David Bainbridge | 38dc1e8 | 2019-08-12 15:18:45 +0000 | [diff] [blame] | 335 | if [ $FANCY -eq 0 ]; then |
| 336 | LINE=$(echo $* | sed -e 's/[\s+-]//g') |
| 337 | if [ "$LINE X" == " X" ]; then |
| 338 | return |
| 339 | fi |
| 340 | echo -e "$INDENT$*" |
| 341 | else |
| 342 | echo -e "\r$INDENT$*$CNORM" |
| 343 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 344 | } |
| 345 | |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 346 | if [ "$1" == "get" -a "$2" == "voltconfig" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 347 | echo "$HOME/.volt/config-$NAME" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 348 | exit |
| 349 | fi |
| 350 | |
| 351 | if [ $# -ne 1 -o $(echo ":up:down:dump:" | grep -c ":$1:") -ne 1 ]; then |
| 352 | >&2 echo "What wouild you like to do today:" |
| 353 | >&2 echo " up - bring up voltha" |
| 354 | >&2 echo " down - tear down voltha" |
| 355 | >&2 echo " dump - create a debug dump of running system" |
| 356 | exit 1 |
| 357 | fi |
| 358 | |
| 359 | if [ "$1" == "down" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 360 | echo "Tearing down voltha cluster $NAME" |
| 361 | LOG="down-$NAME.log" |
| 362 | echo $(date -u +"%Y%m%dT%H%M%SZ") >$LOG |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 363 | if [ $DEPLOY_K8S == "yes" ]; then |
| 364 | if [ -x ./bin/kind ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 365 | bspin "Delete Kubernetes Kind Cluster" |
| 366 | (set -x; ./bin/kind delete cluster --name voltha-$NAME >>$LOG 2>&1) >>$LOG 2>&1 |
| 367 | espin $VERIFIED |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 368 | else |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 369 | espin "$NO_ENTRY Delete Kubernetes Kind Cluster: kind command not found" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 370 | fi |
| 371 | else |
| 372 | EXISTS=$(helm list -q) |
| 373 | EXPECT="etcd-operator onos open-olt open-onu sim voltha bbsim radius" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 374 | bspin "Remove Helm Deployments" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 375 | for i in $EXISTS; do |
| 376 | if [ $(echo $EXPECT | grep -c $i) -eq 1 ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 377 | sspin "Remove Helm Deployments: $i$CEOL" |
| 378 | (set -x; ./bin/helm delete --purge $i >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 379 | fi |
| 380 | done |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 381 | espin "$VERIFIED Remove Helm Deployments$CEOL" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 382 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 383 | bspin "Remove port-forwards: onos-ui-$NAME" |
| 384 | for i in $(screen -ls | grep onos-ui-$NAME | awk '{print $1}'); do |
| 385 | sspin |
| 386 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 387 | done |
| 388 | sspin "Remove port-forwards: onos-ssh-$NAME$CEOL" |
| 389 | for i in $(screen -ls | grep onos-ssh-$NAME | awk '{print $1}'); do |
| 390 | sspin |
| 391 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 392 | done |
| 393 | sspin "Remove port-forwards: voltha-api-$NAME$CEOL" |
| 394 | for i in $(screen -ls | grep voltha-api-$NAME | awk '{print $1}'); do |
| 395 | sspin |
| 396 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 397 | done |
| 398 | sspin "Remove port-forwards: voltha-ssh-$NAME$CEOL" |
| 399 | for i in $(screen -ls | grep voltha-ssh-$NAME | awk '{print $1}'); do |
| 400 | sspin |
| 401 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 402 | done |
| 403 | sspin "Remove port-forwards: voltha-etcd-$NAME$CEOL" |
| 404 | for i in $(screen -ls | grep voltha-etcd-$NAME | awk '{print $1}'); do |
| 405 | sspin |
| 406 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 407 | done |
| 408 | espin "$VERIFIED Remove port-forwards$CEOL" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 409 | exit |
| 410 | fi |
| 411 | |
| 412 | if [ "$1" == "dump" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 413 | LOG="dump-$NAME.log" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 414 | TS=$(date -u +"%Y%m%dT%H%M%SZ") |
| 415 | WORK=$(mktemp -u -d) |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 416 | DATA=$WORK/voltha-debug-dump-$NAME-$TS |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 417 | mkdir -p $DATA |
| 418 | echo $TS > $LOG |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 419 | echo -e "Capturing debug dump to voltha-debug-dump-$NAME-$TS.tgz" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 420 | bspin - "Copy install log" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 421 | if [ -f install-$NAME.log ]; then |
| 422 | (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] | 423 | espin - $VERIFIED |
| 424 | else |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 425 | espin - "$NO_ENTRY Copy install log: install-$NAME.log not found" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 426 | fi |
| 427 | bspin - "Dumping Kubernetes PODs" |
| 428 | (set -x; kubectl get --all-namespaces pods >> $DATA/all-pods.txt 2>&1) >>$LOG 2>&1 |
| 429 | espin - $VERIFIED |
| 430 | bspin - "Dumping Kubernetes SERVICEs" |
| 431 | (set -x; kubectl get --all-namespaces svc >> $DATA/all-services.txt 2>&1) >>$LOG 2>&1 |
| 432 | espin - $VERIFIED |
| 433 | bspin - "Dumping Kubernetes EVENTs" |
| 434 | (set -x; kubectl get --all-namespaces events >> $DATA/all-events.txt 2>&1) >>$LOG 2>&1 |
| 435 | espin - $VERIFIED |
| 436 | bspin - "Dumping VOLTHA POD details" |
| 437 | PODS=$(kubectl get -n voltha pod -o name) |
| 438 | for POD in $PODS; do |
| 439 | sspin - "Dumping VOLTHA POD details: $POD$CEOL" |
| 440 | mkdir -p $DATA/$POD |
| 441 | (set -x; kubectl describe -n voltha $POD >> $DATA/$POD/describe.txt 2>&1) >>$LOG 2>&1 |
| 442 | sspin - "Dumping VOLTHA POD details: $POD" |
| 443 | (set -x; kubectl logs -n voltha --all-containers --previous $LOG_ARGS $POD >> $DATA/$POD/logs-previous.txt 2>&1) >>$LOG 2>&1 |
| 444 | sspin - "Dumping VOLTHA POD details: $POD" |
| 445 | (set -x; kubectl logs -n voltha --all-containers $LOG_ARGS $POD >> $DATA/$POD/logs-current.txt 2>&1) >>$LOG 2>&1 |
| 446 | sspin - "Dumping VOLTHA POD details: $POD" |
| 447 | done |
| 448 | espin - "$VERIFIED Dumping VOLTHA POD details$CEOL" |
| 449 | bspin - "Dumping ETCD" |
| 450 | if [ "$(which etcdctl) X" != " X" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 451 | (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] | 452 | espin - $VERIFIED |
| 453 | else |
| 454 | espin - "$NO_ENTRY Dumping ETCD: etcdctl command not available" |
| 455 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 456 | bspin - "Creating compressed TAR: voltha-debug-dump-$NAME-$TS.tgz" |
| 457 | (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] | 458 | espin - $VERIFIED |
| 459 | bspin - "Cleanup" |
| 460 | (set -x; rm -rf $WORK) >>$LOG 2>&1 |
| 461 | espin - $VERIFIED |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 462 | bspin - "$(ls -l voltha-debug-dump-$NAME-$TS.tgz)" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 463 | espin - $VERIFIED |
| 464 | exit |
| 465 | fi |
| 466 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 467 | LOG="install-$NAME.log" |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 468 | date > $LOG |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 469 | 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] | 470 | |
| 471 | # Output install options to log |
| 472 | echo "OPTIONS" >> $LOG |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 473 | for O in $ALL_OPTIONS; do |
| 474 | VAL=$(eval echo \$$O) |
| 475 | if [ $O == "USE_GO" ]; then |
| 476 | VAL="$(echo $VAL| test $(grep -c true) -eq 1 && echo yes || echo no)" |
| 477 | fi |
| 478 | if [ ! -z "$VAL" ]; then |
| 479 | printf " %-30s = %s\n" $O $VAL >> $LOG |
| 480 | fi |
| 481 | done |
| 482 | |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 483 | push_onos_config() { |
| 484 | local MSG=$1 |
| 485 | local RESOURCE=$2 |
| 486 | local DATA=$3 |
| 487 | |
| 488 | bspin - "$MSG $GEAR" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 489 | while true; do |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 490 | (set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/$RESOURCE --data @$DATA >>$LOG 2>&1) >>$LOG 2>&1 |
| 491 | if [ $? -eq 0 ]; then |
| 492 | break |
| 493 | fi |
| 494 | sleep .2 |
| 495 | sspin - |
| 496 | done |
| 497 | espin - $VERIFIED |
| 498 | } |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 499 | |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 500 | override_onos_app() { |
| 501 | local APP=$1 |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 502 | local NAME=$(basename $APP | sed -e 's/^[0-9][0-9]*-//g' -e 's/-.*$//g') |
| 503 | while true; do |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 504 | sspin - |
| 505 | # Attempt to delete old version (if it exists) |
| 506 | (set -x; curl --fail -sSL --user karaf:karaf -X DELETE http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications/$NAME >>$LOG 2>&1) >>$LOG 2>&1 |
| 507 | sspin - |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 508 | if [ $? -ne 0 ]; then |
| 509 | continue |
| 510 | fi |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 511 | (set -x; curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @$APP >>$LOG 2>&1) >>$LOG 2>&1 |
| 512 | if [ $? -eq 0 ]; then |
| 513 | break |
| 514 | fi |
| 515 | sleep .2 |
| 516 | done |
| 517 | } |
| 518 | |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 519 | activate_onos_app() { |
| 520 | local MSG="$1" |
| 521 | local APP=$2 |
| 522 | |
| 523 | bspin - "$MSG $GO" |
| 524 | while true; do |
| 525 | sspin - |
| 526 | (set -x; curl --fail -sSL --user karaf:karaf -X POST http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications/$APP/active >>$LOG 2>&1) >>$LOG 2>&1 |
| 527 | if [ $? -eq 0 ]; then |
| 528 | break |
| 529 | fi |
| 530 | sleep .2 |
| 531 | done |
| 532 | espin - "$VERIFIED" |
| 533 | } |
| 534 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 535 | count_pods() { |
| 536 | local NAMESPACE=$1; shift |
| 537 | local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}") |
| 538 | local COUNT=0 |
| 539 | local PATTERNS=$* |
| 540 | for POD in $PODS; do |
| 541 | local NAME=$(echo $POD | cut -d/ -f 1) |
| 542 | local STATE=$(echo $POD | cut -d/ -f 2) |
| 543 | local CONTAINERS=$(echo $POD | cut -d/ -f 3 | sed -e 's/_/ /g') |
| 544 | if [ "$STATE" == "Running" ]; then |
| 545 | local TOTAL=$(echo $CONTAINERS | wc -w) |
| 546 | local FOUND=$(echo $CONTAINERS | grep -o true | wc -l) |
| 547 | if [ $TOTAL -eq $FOUND ]; then |
| 548 | for PATTERN in $PATTERNS; do |
| 549 | if [[ $NAME =~ $PATTERN ]]; then |
| 550 | COUNT=$(expr $COUNT + 1) |
| 551 | fi |
| 552 | done |
| 553 | fi |
| 554 | fi |
| 555 | done |
| 556 | echo $COUNT |
| 557 | } |
| 558 | |
| 559 | wait_for_pods() { |
| 560 | local INDENT= |
| 561 | if [ "$1" == "-" ]; then |
| 562 | INDENT=$1; shift |
| 563 | fi |
| 564 | local NAMESPACE=$1; shift |
| 565 | local EXPECT=$1; shift |
| 566 | local RETRY=$1; shift |
| 567 | local MESSAGE=$1; shift |
| 568 | local PATTERNS=$* |
| 569 | local HAVE=$(count_pods $NAMESPACE $PATTERNS) |
| 570 | COUNT=$(expr 300 / 15) |
| 571 | bspin $INDENT $MESSAGE |
| 572 | sspin $INDENT |
| 573 | if [ $HAVE -ne $EXPECT ]; then |
| 574 | while [ $HAVE -ne $EXPECT ]; do |
| 575 | sspin $INDENT |
| 576 | COUNT=$(expr $COUNT - 1) |
| 577 | if [ $COUNT -eq 0 ]; then |
| 578 | HAVE=$(count_pods $NAMESPACE $PATTERNS) |
| 579 | COUNT=$(expr 300 / 15) |
| 580 | fi |
| 581 | sleep .15 |
| 582 | done |
| 583 | fi |
| 584 | espin $INDENT $VERIFIED |
| 585 | if [ $HAVE -ne $EXPECT ]; then |
| 586 | return 1 |
| 587 | fi |
| 588 | return 0 |
| 589 | } |
| 590 | |
| 591 | helm_install() { |
| 592 | local INDENT= |
| 593 | if [ "$1" == "-" ]; then |
| 594 | INDENT=$1; shift |
| 595 | fi |
| 596 | local NAMESPACE=$1; shift |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 597 | local INAME=$1; shift |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 598 | local CHART=$1; shift |
| 599 | local MESSAGE=$* |
| 600 | |
| 601 | COUNT=$(expr 300 / 15) |
| 602 | bspin $INDENT $MESSAGE |
David Bainbridge | 458bb66 | 2019-08-02 20:04:23 +0000 | [diff] [blame] | 603 | (set -x; helm install -f $NAME-values.yaml --set use_go=$USE_GO --set defaults.log_level=$VOLTHA_LOG_LEVEL --namespace $NAMESPACE --name $INAME $EXTRA_HELM_FLAGS $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 604 | SUCCESS=$? |
| 605 | while [ $SUCCESS -ne 0 ]; do |
| 606 | sspin $INDENT |
| 607 | COUNT=$(expr $COUNT - 1) |
| 608 | if [ $COUNT -eq 0 ]; then |
David Bainbridge | 458bb66 | 2019-08-02 20:04:23 +0000 | [diff] [blame] | 609 | (set -x; helm install -f $NAME-values.yaml --set use_go=$USE_GO --set defaults.log_level=$VOLTHA_LOG_LEVEL --namespace $NAMESPACE --name $INAME $EXTRA_HELM_FLAGS $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 610 | COUNT=$(expr 300 / 15) |
| 611 | fi |
| 612 | sleep .15 |
| 613 | done |
| 614 | espin $INDENT $VERIFIED |
| 615 | } |
| 616 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 617 | echo "INSTALL TYPE: $TYPE" >> $LOG |
| 618 | |
| 619 | bspin "Verify GOPATH" |
| 620 | export GOPATH=$(pwd) |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 621 | mkdir -p $GOPATH/bin |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 622 | espin $VERIFIED |
| 623 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 624 | STIME=$(date +%s) |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 625 | if [ "$INSTALL_KUBECTL" == "no" ]; then |
| 626 | bspin "Skip kubectl install" |
| 627 | espin $NO_ENTRY |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 628 | else |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 629 | bspin "Verify kubectl $HELM" |
| 630 | if [ -x $GOPATH/bin/kubectl ]; then |
| 631 | espin $VERIFIED |
| 632 | else |
| 633 | espin $NOT_VERIFIED |
| 634 | bspin - "Download and install Kubernetes/kubectl $DOWNLOAD" |
| 635 | (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 |
| 636 | (set -x; chmod 755 $GOPATH/bin/kubectl >>$LOG 2>&1) >>$LOG 2>&1 |
| 637 | espin - $VERIFIED |
| 638 | fi |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 639 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 640 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 641 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 642 | fi |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 643 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 644 | STIME=$(date +%s) |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 645 | if [ "$DEPLOY_K8S" == "no" ]; then |
| 646 | bspin "Skip Kubernetes/Kind Deployment" |
| 647 | espin $NO_ENTRY |
| 648 | else |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 649 | bspin "Verify Kubernetes/Kind $HELM" |
| 650 | if [ -x $GOPATH/bin/kind ]; then |
| 651 | espin $VERIFIED |
| 652 | else |
| 653 | espin $NOT_VERIFIED |
| 654 | bspin - "Download and install Kubernetes/kind $DOWNLOAD" |
David Bainbridge | 9e2a666 | 2019-07-11 17:07:57 +0000 | [diff] [blame] | 655 | (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] | 656 | (set -x; chmod 755 $GOPATH/bin/kind >>$LOG 2>&1) >>$LOG 2>&1 |
| 657 | espin - $VERIFIED |
| 658 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 659 | fi |
| 660 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 661 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 662 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 663 | fi |
| 664 | |
| 665 | STIME=$(date +%s) |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 666 | if [ "$INSTALL_HELM" == "no" ]; then |
| 667 | bspin "Skip Helm Install" |
| 668 | espin $NO_ENTRY |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 669 | else |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 670 | bspin "Verify Helm $HELM" |
| 671 | if [ -x $GOPATH/bin/helm ]; then |
| 672 | espin $VERIFIED |
| 673 | else |
| 674 | espin $NOT_VERIFIED |
| 675 | bspin - "Download and install Helm $DOWNLOAD" |
| 676 | (set -x; curl -sSL https://git.io/get_helm.sh | USE_SUDO=false HELM_INSTALL_DIR=$GOPATH/bin bash >>$LOG 2>&1) >>$LOG 2>&1 |
| 677 | espin - $VERIFIED |
| 678 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 679 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 680 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 681 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 682 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 683 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 684 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 685 | bspin "Verify voltctl $HIGH_VOLTAGE" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 686 | if [ -x $GOPATH/bin/voltctl ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 687 | espin $VERIFIED |
| 688 | else |
| 689 | espin $NOT_VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 690 | bspin - "Download and build voltctl $DOWNLOAD" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 691 | (set -x; curl -o $GOPATH/bin/voltctl -sSL https://github.com/ciena/voltctl/releases/download/$VOLTCTL_VERSION/voltctl-$_VOLTCTL_VERSION-$HOSTOS-$HOSTARCH >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 692 | (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] | 693 | espin - $VERIFIED |
| 694 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 695 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 696 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 697 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 698 | |
| 699 | bspin "Verify command PATH" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 700 | export PATH=$GOPATH/bin:$PATH |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 701 | espin $VERIFIED |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 702 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 703 | STIME=$(date +%s) |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 704 | if [ "$DEPLOY_K8S" == "yes" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 705 | HAVE=$(kind get clusters | grep -c voltha-$NAME) |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 706 | bspin "Verify Kubernetes/Kind Cluster" |
| 707 | sspin |
| 708 | if [ $HAVE -eq 0 ]; then |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 709 | espin $NOT_VERIFIED |
| 710 | bspin - "Verify cluster configuration" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 711 | if [ ! -r ./$NAME-cluster.cfg ]; then |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 712 | espin - $NOT_VERIFIED |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 713 | bspin - "Download cluster configuration: $TYPE-cluster.cfg to $NAME-cluster.cfg $DOWNLOAD" |
| 714 | (set -x; curl -o ./$NAME-cluster.cfg -sSL https://raw.githubusercontent.com/ciena/kind-voltha/master/$TYPE-cluster.cfg >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 715 | espin - $VERIFIED |
| 716 | else |
| 717 | espin - $VERIFIED |
| 718 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 719 | kind create cluster --name voltha-$NAME --config $NAME-cluster.cfg |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 720 | else |
| 721 | espin $VERIFIED |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 722 | fi |
| 723 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 724 | export KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$NAME")" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 725 | P="coredns-.* \ |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 726 | etcd-voltha-$NAME-control-plane \ |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 727 | kindnet-.* \ |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 728 | kube-apiserver-voltha-$NAME-control-plane \ |
| 729 | kube-controller-manager-voltha-$NAME-control-plane \ |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 730 | kube-proxy-.* \ |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 731 | kube-scheduler-voltha-$NAME-control-plane" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 732 | |
| 733 | EXPECT=$(test "$TYPE" == "minimal" && echo "12" || echo "14") |
| 734 | wait_for_pods - "kube-system" $EXPECT -1 "Waiting for system PODs to start" $P |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 735 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 736 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 737 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 738 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 739 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 740 | STIME=$(date +%s) |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 741 | COUNT=$(count_pods "kube-system" "tiller-deploy-.*") |
| 742 | bspin "Verify Helm" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 743 | if [ $COUNT -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 744 | espin $NOT_VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 745 | echo -e "Configuring Helm $GEAR" |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame] | 746 | if [ "$INSTALL_HELM" == "no" ]; then |
| 747 | bspin - "Skip Helm/Tiller Initialization" |
| 748 | espin - $NO_ENTRY |
| 749 | else |
| 750 | bspin - "Initialize Helm" |
| 751 | (set -x; helm init --upgrade >>$LOG 2>&1) >>$LOG 2>&1 |
| 752 | espin - $VERIFIED |
| 753 | wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*" |
| 754 | fi |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 755 | bspin - "Add Google Incubator repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 756 | (set -x; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 757 | espin - $VERIFIED |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 758 | |
| 759 | # HACK (sort-of) - the config for tiller is about to be patched, which will |
| 760 | # cause the tiller pod to be recreated. This can sometimes cause a timing |
| 761 | # issue with the "wait_for_pods" call on tiller as it may incorrectly |
| 762 | # identify the running/ready tiller pod that is soon to be terminated as |
| 763 | # what it is waiting for. To avoid this issue we do a clean scale down and |
| 764 | # scale up of the pod so the script controlls when it should be expecting |
| 765 | # things |
| 766 | (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] | 767 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 768 | bspin - "Add Google Stable repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 769 | (set -x; helm repo add stable https://kubernetes-charts.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 770 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 771 | bspin - "Add ONF repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 772 | (set -x; helm repo add onf https://charts.opencord.org >>$LOG 2>&1) >>$LOG 2>&1 |
| 773 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 774 | bspin - "Update Helm repository cache" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 775 | (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1 |
| 776 | espin - $VERIFIED |
| 777 | |
| 778 | # Create and k8s service account so that Helm can create pods |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 779 | bspin - "Create Tiller ServiceAccount" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 780 | (set -x; kubectl create serviceaccount --namespace kube-system tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 781 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 782 | bspin - "Create Tiller ClusterRoleBinding" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 783 | (set -x; kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 784 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 785 | bspin - "Update Tiller Manifest" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 786 | (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] | 787 | |
| 788 | # HACK (sort-of) - part to, spin it back up |
| 789 | (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] | 790 | espin - $VERIFIED |
| 791 | else |
| 792 | espin $VERIFIED |
| 793 | fi |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 794 | wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 795 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 796 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 797 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 798 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 799 | STIME=$(date +%s) |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 800 | bspin "Verify Helm values file: $NAME-values.yaml" |
| 801 | if [ ! -r "./$NAME-values.yaml" ]; then |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 802 | espin $NOT_VERIFIED |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 803 | bspin - "Download Helm values file: $TYPE-values.yaml to $NAME-values.yaml $DOWNLOAD" |
| 804 | (set -x; curl -o ./$NAME-values.yaml -sSL https://raw.githubusercontent.com/ciena/kind-voltha/master/$TYPE-values.yaml >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 805 | espin - $VERIFIED |
| 806 | else |
| 807 | espin $VERIFIED |
| 808 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 809 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 810 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 811 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 812 | |
| 813 | if [ "$JUST_K8S" == "yes" ]; then |
| 814 | echo "Environment deployed, not deploying VOLTHA artifacts as requested. Good bye." |
| 815 | echo "" |
| 816 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 817 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 818 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 819 | echo "" | tee -a $LOG |
| 820 | echo -en $BOLD |
| 821 | if [ $DEPLOY_K8S == "yes" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 822 | 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] | 823 | fi |
| 824 | echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG |
| 825 | echo -en $NORMAL |
| 826 | echo "" | tee -a $LOG |
| 827 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 828 | exit 0 |
| 829 | fi |
| 830 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 831 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 832 | bspin "Verify ETCD Operator $OLD_KEY" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 833 | if [ $(helm list --deployed --short --namespace voltha "^etcd-operator\$" | wc -l) -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 834 | espin $NOT_VERIFIED |
| 835 | helm_install - voltha etcd-operator stable/etcd-operator "Install ETCD Operator" |
| 836 | else |
| 837 | espin $VERIFIED |
| 838 | fi |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 839 | EXPECT=$(test "$TYPE" == "minimal" && echo "1" || echo "3") |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 840 | wait_for_pods - "voltha" $EXPECT -1 "Waiting for ETCD Operator to start" "etcd-operator-.*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 841 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 842 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 843 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 844 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 845 | STIME=$(date +%s) |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 846 | if [ $WITH_ONOS == "yes" ]; then |
| 847 | bspin "Verify ONOS installed $BIRD" |
| 848 | if [ $(helm list --deployed --short --namespace default "^onos\$" | wc -l) -ne 1 ]; then |
| 849 | espin $NOT_VERIFIED |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 850 | SET_TAG= |
| 851 | if [ "$ONOS_TAG X" != " X" ]; then |
| 852 | SET_TAG="--set images.onos.tag=$ONOS_TAG" |
| 853 | fi |
| 854 | EXTRA_HELM_FLAGS="$SET_TAG $EXTRA_HELM_FLAGS" helm_install - default onos onf/onos "Install ONOS" |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 855 | else |
| 856 | espin $VERIFIED |
| 857 | fi |
| 858 | wait_for_pods - "default" 1 -1 "Waiting for ONOS to start" "onos-.*" |
| 859 | |
| 860 | bspin - "Forward ONOS API port $FORWARD" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 861 | for i in $(screen -ls | grep onos-ui-$NAME | awk '{print $1}'); do |
David Bainbridge | 82bd121 | 2019-07-29 19:19:31 +0000 | [diff] [blame] | 862 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 863 | done |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 864 | (set -x; screen -dmS onos-ui-$NAME bash -c "while true; do kubectl port-forward service/onos-ui $ONOS_API_PORT:8181; done" >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 865 | espin - $VERIFIED |
| 866 | bspin - "Forward ONOS SSH port $FORWARD" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 867 | for i in $(screen -ls | grep onos-ssh-$NAME | awk '{print $1}'); do |
David Bainbridge | 82bd121 | 2019-07-29 19:19:31 +0000 | [diff] [blame] | 868 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 869 | done |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 870 | |
| 871 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 872 | (set -x; screen -dmS onos-ssh-$NAME bash -c "while true; do kubectl port-forward service/onos-ssh $ONOS_SSH_PORT:8101; done" >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 873 | espin - $VERIFIED |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 874 | bspin - "Verify or download ONOS configuration support files $DOWNLOAD" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 875 | ONOS_FILES="olt-onos-enableExtraneousRules.json olt-onos-olt-settings.json onos-aaa.json \ |
| 876 | onos-dhcpl2relay.json onos-kafka.json onos-sadis-no-tp.json onos-sadis-tp.json" |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 877 | (set -x; mkdir -p ./onos-files >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 878 | for i in $ONOS_FILES; do |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 879 | if [ ! -r ./onos-files/$i ]; then |
| 880 | (set -x; curl -o ./onos-files/$i -sSL https://raw.githubusercontent.com/ciena/kind-voltha/master/onos-files/$i >>$LOG 2>&1) >>$LOG 2>&1 |
| 881 | fi |
| 882 | done |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 883 | espin - $VERIFIED |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 884 | |
| 885 | if [ $INSTALL_ONOS_APPS == "yes" ]; then |
| 886 | bspin - "Installing custom ONOS applications" |
| 887 | if [ -x onos-files/onos-apps -a $(ls -1 onos-files/onos-apps/*.oar 2>/dev/null | wc -l) -gt 0 ]; then |
| 888 | for OAR in $(ls -1 onos-files/onos-apps/*.oar); do |
| 889 | sspin - "Installing custom ONOS applications - $OAR$CEOL" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 890 | override_onos_app $OAR |
David Bainbridge | 27790d6 | 2019-08-13 22:43:19 +0000 | [diff] [blame] | 891 | done |
| 892 | espin - "$VERIFIED Installing custom ONOS applications$CEOL" |
| 893 | else |
| 894 | espin - "$NOT_VERIFIED Installing custom ONOS applications - None Found" |
| 895 | fi |
| 896 | fi |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 897 | |
| 898 | push_onos_config "Push ONOS Kafka Configuration" "network/configuration/apps/org.opencord.kafka" "onos-files/onos-kafka.json" |
| 899 | push_onos_config "Push ONOS DHCP L2 Relay Configuration" "network/configuration/apps/org.opencord.dhcpl2relay" "onos-files/onos-dhcpl2relay.json" |
David Bainbridge | d31d612 | 2019-08-13 19:37:59 +0000 | [diff] [blame] | 900 | push_onos_config "Enable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.Olt" "onos-files/olt-onos-olt-settings.json" |
| 901 | push_onos_config "Enabling extraneous rules for ONOS" "configuration/org.onosproject.net.flow.impl.FlowRuleManager" "onos-files/olt-onos-enableExtraneousRules.json" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 902 | if [ -f onos-files/onos-sadis.json ]; then |
| 903 | push_onos_config "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "onos-files/onos-sadis.json" |
| 904 | elif [ "$CONFIG_SADIS" == "yes" ]; then |
| 905 | SADIS_CFG=onos-files/onos-sadis-no-tp.json |
| 906 | if [ "$WITH_TP" == "yes" ]; then |
| 907 | SADIS_CFG=onos-files/onos-sadis-tp.json |
| 908 | fi |
| 909 | push_onos_config "[optional] Push ONOS SADIS Configuration" "network/configuration/apps/org.opencord.sadis" "$SADIS_CFG" |
| 910 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 911 | fi |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 912 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 913 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 914 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 915 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 916 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 917 | bspin "Verify VOLTHA installed $HIGH_VOLTAGE" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 918 | 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] | 919 | espin $NOT_VERIFIED |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 920 | helm_install - voltha voltha $VOLTHA_CHART "Install VOLTHA Core" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 921 | else |
| 922 | espin $VERIFIED |
| 923 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 924 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 925 | VOLTHA="ofagent-.* \ |
| 926 | ro-core.* \ |
| 927 | rw-core.* \ |
| 928 | voltha-api-server-.* \ |
| 929 | voltha-cli-server-.* \ |
| 930 | voltha-etcd-cluster-.* \ |
| 931 | voltha-kafka-.* \ |
| 932 | voltha-zookeeper-.*" |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 933 | EXPECT=$(test "$TYPE" == "minimal" && echo "9" || echo "11") |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 934 | wait_for_pods - "voltha" $EXPECT -1 "Waiting for VOLTHA Core to start" $VOLTHA |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 935 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 936 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 937 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 938 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 939 | STIME=$(date +%s) |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 940 | echo -e "Verify Adapters $PLUG" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 941 | bspin - "Verify Simulated Adapters installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 942 | if [ $(helm list --deployed --short --namespace voltha "^sim\$" | wc -l) -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 943 | espin - $NOT_VERIFIED |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 944 | helm_install - voltha sim $VOLTHA_ADAPTER_SIM_CHART "Install Simulated Adapters" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 945 | else |
| 946 | espin - $VERIFIED |
| 947 | fi |
| 948 | |
| 949 | bspin - "Verify OpenOLT Adapter installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 950 | if [ $(helm list --deployed --short --namespace voltha "^open-olt\$" | wc -l) -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 951 | espin - $NOT_VERIFIED |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 952 | helm_install - voltha open-olt $VOLTHA_ADAPTER_OPEN_OLT_CHART "Install OpenOLT Adapter" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 953 | else |
| 954 | espin - $VERIFIED |
| 955 | fi |
| 956 | bspin - "Verify OpenONU Adapter installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 957 | if [ $(helm list --deployed --short --namespace voltha "^open-onu\$" | wc -l) -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 958 | espin - $NOT_VERIFIED |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 959 | helm_install - voltha open-onu $VOLTHA_ADAPTER_OPEN_ONU_CHART "Install OpenONU Adapter" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 960 | else |
| 961 | espin - $VERIFIED |
| 962 | fi |
| 963 | |
| 964 | ADAPTERS="adapter-.*" |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 965 | wait_for_pods - "voltha" 4 -1 "Waiting for adapters to start" $ADAPTERS |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 966 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 967 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 968 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 969 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 970 | if [ $WITH_BBSIM == "yes" ]; then |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 971 | STIME=$(date +%s) |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 972 | echo -e "Verify BBSIM $PLUG" |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 973 | bspin - "Verify BBSIM Installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 974 | if [ $(helm list --deployed --short --namespace voltha "^bbsim\$" | wc -l) -ne 1 ]; then |
| 975 | espin - $NOT_VERIFIED |
| 976 | helm_install - voltha bbsim onf/bbsim "Install BBSIM" |
| 977 | else |
| 978 | espin - $VERIFIED |
| 979 | fi |
| 980 | wait_for_pods - "voltha" 1 -1 "Waiting for BBSIM to start" "bbsim-.*" |
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 |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 984 | fi |
| 985 | |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 986 | if [ $WITH_RADIUS == "yes" ]; then |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 987 | STIME=$(date +%s) |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 988 | echo -e "Verify RADIUS $LOCK" |
| 989 | bspin - "Verify RADIUS Installed" |
| 990 | if [ $(helm list --deployed --short --namespace voltha "^radius\$" | wc -l) -ne 1 ]; then |
| 991 | espin - $NOT_VERIFIED |
| 992 | helm_install - voltha radius onf/freeradius "Install RADIUS" |
| 993 | else |
| 994 | espin - $VERIFIED |
| 995 | fi |
| 996 | wait_for_pods - "voltha" 1 -1 "Waiting for RADIUS to start" "radius-.*" |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 997 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 998 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 999 | fi |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1000 | fi |
| 1001 | |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1002 | STIME=$(date +%s) |
David Bainbridge | e10f6d5 | 2019-07-25 00:28:13 +0000 | [diff] [blame] | 1003 | if [ $SKIP_RESTART_API == "no" ]; then |
| 1004 | echo -e "Restart VOLTHA API $RESTART" |
| 1005 | API="voltha-api-server-.* ofagent-.*" |
| 1006 | (set -x; kubectl scale --replicas=0 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1 |
| 1007 | wait_for_pods - "voltha" 0 -1 "Wait for API to stop $STOP" $API |
| 1008 | (set -x; kubectl scale --replicas=1 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1 |
| 1009 | wait_for_pods - "voltha" 2 -1 "Wait for API to re-start $GO" $API |
| 1010 | else |
| 1011 | bspin "Skip VOLTHA API Restart" |
| 1012 | espin $NO_ENTRY |
| 1013 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1014 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1015 | bspin - "Forward VOLTHA API port $FORWARD" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1016 | for i in $(screen -ls | grep voltha-api-$NAME | awk '{print $1}'); do |
David Bainbridge | 82bd121 | 2019-07-29 19:19:31 +0000 | [diff] [blame] | 1017 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 1018 | done |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1019 | (set -x; screen -dmS voltha-api-$NAME bash -c "while true; do kubectl port-forward -n voltha service/voltha-api $VOLTHA_API_PORT:55555; done" >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1020 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 1021 | bspin - "Forward VOLTHA SSH port $FORWARD" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1022 | for i in $(screen -ls | grep voltha-ssh-$NAME | awk '{print $1}'); do |
David Bainbridge | 82bd121 | 2019-07-29 19:19:31 +0000 | [diff] [blame] | 1023 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 1024 | done |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1025 | (set -x; screen -dmS voltha-ssh-$NAME bash -c "while true; do kubectl port-forward -n voltha service/voltha-cli $VOLTHA_SSH_PORT:5022; done" >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1026 | espin - $VERIFIED |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 1027 | bspin - "Forward VOLTHA ETCD port $FORWARD" |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1028 | for i in $(screen -ls | grep voltha-etcd-$NAME | awk '{print $1}'); do |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 1029 | (set -x; screen -X -S $i quit >>$LOG 2>&1) >>$LOG 2>&1 |
| 1030 | done |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1031 | (set -x; screen -dmS voltha-etcd-$NAME bash -c "while true; do kubectl port-forward -n voltha service/voltha-etcd-cluster-client $VOLTHA_ETCD_PORT:2379; done" >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | ac7f807 | 2019-08-01 22:15:33 +0000 | [diff] [blame] | 1032 | espin - $VERIFIED |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1033 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1034 | printtime $(expr $(date +%s) - $STIME) |
David Bainbridge | e87067b | 2019-08-12 22:00:12 +0000 | [diff] [blame] | 1035 | fi |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 1036 | |
David Bainbridge | b270c20 | 2019-07-26 01:44:42 +0000 | [diff] [blame] | 1037 | if [ $WITH_ONOS == "yes" -a $WITH_RADIUS == "yes" ]; then |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1038 | bspin "Configure ONOS RADIUS Connection $GEAR" |
David Bainbridge | 2b19e83 | 2019-08-16 02:40:53 +0000 | [diff] [blame] | 1039 | (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 -XPOST -sSL http://karaf:karaf@localhost:8181/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] | 1040 | espin $VERIFIED |
| 1041 | fi |
| 1042 | |
| 1043 | bspin "Create voltctl configuration file" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 1044 | (set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1 |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1045 | (set -x; voltctl -a v2 -s localhost:$VOLTHA_API_PORT config > $HOME/.volt/config-$NAME 2>>$LOG) >>$LOG 2>&1 |
David Bainbridge | 5b7b96b | 2019-07-25 20:29:13 +0000 | [diff] [blame] | 1046 | espin $VERIFIED |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 1047 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1048 | if [ ! -f "$NAME-env.sh" ]; then |
| 1049 | touch $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1050 | fi |
| 1051 | |
David Bainbridge | 596f30d | 2019-07-30 17:07:59 +0000 | [diff] [blame] | 1052 | for O in $ALL_OPTIONS; do |
| 1053 | VAL=$(eval echo \$$O) |
| 1054 | if [ $O == "USE_GO" ]; then |
| 1055 | VAL="$(echo $VAL| test $(grep -c true) -eq 1 && echo yes || echo no)" |
| 1056 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1057 | if [ ! -z "$VAL" -a $(grep -c "^export $O=" $NAME-env.sh) -eq 0 ]; then |
| 1058 | echo "export $O=\"$(eval echo \$$O)\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1059 | fi |
| 1060 | done |
| 1061 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1062 | if [ $DEPLOY_K8S == "yes" -a $(grep -c "^export KUBECONFIG=" $NAME-env.sh) -eq 0 ]; then |
| 1063 | 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] | 1064 | fi |
| 1065 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1066 | if [ $(grep -c "^export VOLTCONFIG=" $NAME-env.sh) -eq 0 ]; then |
| 1067 | echo "export VOLTCONFIG=\"$HOME/.volt/config-$NAME\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1068 | fi |
| 1069 | |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1070 | if [ $(grep -c "^export PATH=" $NAME-env.sh) -eq 0 ]; then |
| 1071 | echo "export PATH=\"$GOPATH/bin:\$PATH\"" >> $NAME-env.sh |
David Bainbridge | b07fdf7 | 2019-07-29 22:51:40 +0000 | [diff] [blame] | 1072 | fi |
| 1073 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1074 | echo "" |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 1075 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 1076 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 1077 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 1078 | echo "" | tee -a $LOG |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1079 | echo -en $BOLD |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1080 | if [ $DEPLOY_K8S == "yes" ]; then |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1081 | 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] | 1082 | fi |
David Bainbridge | 0774b23 | 2019-08-02 06:37:19 +0000 | [diff] [blame] | 1083 | echo "export VOLTCONFIG=\"$HOME/.volt/config-$NAME\"" | tee -a $LOG |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 1084 | echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 1085 | echo -en $NORMAL |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 1086 | echo "" | tee -a $LOG |
| 1087 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 1088 | |
David Bainbridge | 712afb8 | 2019-08-14 19:55:58 +0000 | [diff] [blame] | 1089 | if [ "$WITH_TIMINGS" == "yes" ]; then |
David Bainbridge | f858a02 | 2019-08-14 21:25:11 +0000 | [diff] [blame] | 1090 | 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] | 1091 | fi |
| 1092 | |