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. |
| 15 | |
| 16 | # trap ctrl-c and call ctrl_c() |
| 17 | trap ctrl_c INT |
| 18 | |
| 19 | function ctrl_c() { |
| 20 | tput cnorm |
| 21 | echo "" |
| 22 | echo "ctrl-c trapped" |
| 23 | echo "Thank you for trying 'votlha up'" |
| 24 | exit |
| 25 | } |
| 26 | |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 27 | VOLTCTL_VERSION=${VOLTCTL_VERSION:-0.0.5-dev} |
| 28 | KIND_VERSION=${KIND_VERSION:-v0.4.0} |
| 29 | _VOLTCTL_VERSION=$(echo $VOLTCTL_VERSION | sed -e 's/-/_/g') |
| 30 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 31 | BLACK=$(tput setaf 0) |
| 32 | RED=$(tput setaf 1) |
| 33 | GREEN=$(tput setaf 2) |
| 34 | YELLOW=$(tput setaf 3) |
| 35 | BLUE=$(tput setaf 4) |
| 36 | MAGENTA=$(tput setaf 5) |
| 37 | CYAN=$(tput setaf 6) |
| 38 | WHITE=$(tput setaf 7) |
| 39 | BOLD=$(tput bold) |
| 40 | NORMAL=$(tput sgr0) |
| 41 | ERROR="\xe2\x9c\x97\x20" |
| 42 | |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 43 | TYPE=${TYPE:-minimal} |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 44 | WITH_BBSIM=${WITH_BBSIM:-no} |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 45 | JUST_K8S=${JUST_K8S:-no} |
| 46 | DEPLOY_K8S=${DEPLOY_K8S:-yes} |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 47 | INSTALL_KUBECTL=${INSTALL_KUBECTL:-yes} |
| 48 | INSTALL_HELM=${INSTALL_HELM:-yes} |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 49 | |
| 50 | HAVE_GO=$(which go >/dev/null 2>&1 && echo "yes" || echo "no") |
| 51 | HOSTOS=$(uname -s | tr "[:upper:]" "[:lower:"]) |
| 52 | HOSTARCH=$(uname -m | tr "[:upper:]" "[:lower:"]) |
| 53 | if [ $HOSTARCH == "x86_64" ]; then |
| 54 | HOSTARCH="amd64" |
| 55 | fi |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 56 | |
| 57 | # Verify TYPE setting |
| 58 | if [ $(echo ":minimal:full:" | grep -ic ":$TYPE:") -eq 0 ]; then |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 59 | >&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] | 60 | exit 1 |
| 61 | fi |
| 62 | |
| 63 | # Verify WITH_BBSIM settting and convert uniform value of yes or no |
| 64 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$WITH_BBSIM:") -eq 0 ]; then |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 65 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$WITH_BBSIM value of '$WITH_BBSIM'. Should be 'yes' or 'no'${NORMAL}" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 66 | exit 1 |
| 67 | fi |
| 68 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$WITH_BBSIM:") -eq 1 ]; then |
| 69 | WITH_BBSIM=yes |
| 70 | else |
| 71 | WITH_BBSIM=no |
| 72 | fi |
| 73 | |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 74 | # Verify JUST_K8S settting and convert uniform value of yes or no |
| 75 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$JUST_K8S:") -eq 0 ]; then |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 76 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$JUST_K8S value of '$JUST_K8S'. Should be 'yes' or 'no'${NORMAL}" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 77 | exit 1 |
| 78 | fi |
| 79 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$JUST_K8S:") -eq 1 ]; then |
| 80 | JUST_K8S=yes |
| 81 | else |
| 82 | JUST_K8S=no |
| 83 | fi |
| 84 | |
| 85 | # Verify DEPLOY_K8S settting and convert uniform value of yes or no |
| 86 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$DEPLOY_K8S:") -eq 0 ]; then |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 87 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$DEPLOY_K8S value of '$DEPLOY_K8S'. Should be 'yes' or 'no'${NORMAL}" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 88 | exit 1 |
| 89 | fi |
| 90 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$DEPLOY_K8S:") -eq 1 ]; then |
| 91 | DEPLOY_K8S=yes |
| 92 | else |
| 93 | DEPLOY_K8S=no |
| 94 | fi |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 95 | |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 96 | # Verify INSTALL_KUBECTL settting and convert uniform value of yes or no |
| 97 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_KUBECTL:") -eq 0 ]; then |
| 98 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_KUBECTL value of '$INSTALL_KUBECTL'. Should be 'yes' or 'no'${NORMAL}" |
| 99 | exit 1 |
| 100 | fi |
| 101 | |
| 102 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_KUBECTL:") -eq 1 ]; then |
| 103 | INSTALL_KUBECTL=yes |
| 104 | else |
| 105 | INSTALL_KUBECTL=no |
| 106 | fi |
| 107 | |
| 108 | # Verify INSTALL_HELM settting and convert uniform value of yes or no |
| 109 | if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_HELM:") -eq 0 ]; then |
| 110 | >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_HELM value of '$INSTALL_HELM'. Should be 'yes' or 'no'${NORMAL}" |
| 111 | exit 1 |
| 112 | fi |
| 113 | |
| 114 | if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_HELM:") -eq 1 ]; then |
| 115 | INSTALL_HELM=yes |
| 116 | else |
| 117 | INSTALL_HELM=no |
| 118 | fi |
| 119 | |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 120 | if [ "$TYPE" == "full" ]; then |
| 121 | ONOS_API_PORT=${ONOS_API_PORT:-8182} |
| 122 | ONOS_SSH_PORT=${ONOS_SSH_PORT:-8102} |
| 123 | VOLTHA_API_PORT=${VOLTHA_API_PORT:-55556} |
| 124 | VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5023} |
| 125 | else |
| 126 | ONOS_API_PORT=${ONOS_API_PORT:-8181} |
| 127 | ONOS_SSH_PORT=${ONOS_SSH_PORT:-8101} |
| 128 | VOLTHA_API_PORT=${VOLTHA_API_PORT:-55555} |
| 129 | VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5022} |
| 130 | fi |
| 131 | |
| 132 | if [ "$1" == "get" -a "$2" == "voltconfig" ]; then |
| 133 | echo "$HOME/.volt/config-$TYPE" |
| 134 | exit |
| 135 | fi |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 136 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 137 | if [ $# -ne 1 -o $(echo ":up:down:" | grep -c ":$1:") -ne 1 ]; then |
| 138 | >&2 echo "up or down?" |
| 139 | exit 1 |
| 140 | fi |
| 141 | |
| 142 | if [ "$1" == "down" ]; then |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 143 | if [ $DEPLOY_K8S == "yes" ]; then |
| 144 | if [ -x ./bin/kind ]; then |
| 145 | exec ./bin/kind delete cluster --name voltha-$TYPE |
| 146 | else |
| 147 | >&2 echo "Kind doesn't seem to be installed, so nothing to do. Bye." |
| 148 | fi |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 149 | else |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 150 | EXISTS=$(helm list -q) |
| 151 | EXPECT="etcd-operator onos open-olt open-onu sim voltha" |
| 152 | INTERSECT= |
| 153 | for i in $EXISTS; do |
| 154 | if [ $(echo $EXPECT | grep -c $i) -eq 1 ]; then |
| 155 | HAVE="$HAVE $i" |
| 156 | fi |
| 157 | done |
| 158 | ./bin/helm delete --purge $HAVE |
| 159 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 160 | exit |
| 161 | fi |
| 162 | |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 163 | LOG="install-$TYPE.log" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 164 | date > $LOG |
| 165 | |
| 166 | spin() { |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 167 | PARTS="\ |
| 168 | \xe2\xa2\x8e\xe2\xa1\xb0 \ |
| 169 | \xe2\xa2\x8e\xe2\xa1\xa1 \ |
| 170 | \xe2\xa2\x8e\xe2\xa1\x91 \ |
| 171 | \xe2\xa2\x8e\xe2\xa0\xb1 \ |
| 172 | \xe2\xa0\x8e\xe2\xa1\xb1 \ |
| 173 | \xe2\xa2\x8a\xe2\xa1\xb1 \ |
| 174 | \xe2\xa2\x8c\xe2\xa1\xb1 \ |
| 175 | \xe2\xa2\x86\xe2\xa1\xb1 \ |
| 176 | " |
| 177 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 178 | tput civis |
| 179 | while true; do |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 180 | C=$(echo $PARTS | cut '-d ' -f $IDX) |
| 181 | echo -en "$C" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 182 | IDX=$(expr $IDX + 1) |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 183 | if [ $IDX -gt 8 ]; then |
| 184 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 185 | fi |
| 186 | sleep .15 |
| 187 | echo -en "\r" |
| 188 | done |
| 189 | } |
| 190 | |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 191 | SPIN_PARTS="\ |
| 192 | \xe2\xa2\x8e\xe2\xa1\xb0 \ |
| 193 | \xe2\xa2\x8e\xe2\xa1\xa1 \ |
| 194 | \xe2\xa2\x8e\xe2\xa1\x91 \ |
| 195 | \xe2\xa2\x8e\xe2\xa0\xb1 \ |
| 196 | \xe2\xa0\x8e\xe2\xa1\xb1 \ |
| 197 | \xe2\xa2\x8a\xe2\xa1\xb1 \ |
| 198 | \xe2\xa2\x8c\xe2\xa1\xb1 \ |
| 199 | \xe2\xa2\x86\xe2\xa1\xb1 \ |
| 200 | " |
| 201 | IDX=1 |
| 202 | NOT_VERIFIED="\xe2\x9c\x97\x20" |
| 203 | VERIFIED="\xe2\x9c\x93\x20" |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 204 | HELM="\xE2\x8E\x88" |
| 205 | OLD_KEY="\xF0\x9F\x97\x9D" |
| 206 | BIRD="\xF0\x9F\x90\xA6" |
| 207 | HIGH_VOLTAGE="\xE2\x9A\xA1" |
| 208 | PLUG="\xF0\x9F\xa7\xa9" |
| 209 | RESTART="\xf0\x9f\x94\x84" |
| 210 | FORWARD="\xE2\x87\xA8" |
| 211 | INSTALL="\xF0\x9F\x8F\x97" |
| 212 | STOP="\xf0\x9f\x9b\x91" |
| 213 | GO="\xf0\x9f\x9a\x80" |
| 214 | DOWNLOAD="\xf0\x9f\x93\xa5" |
| 215 | GEAR="\xe2\x9a\x99" |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 216 | NO_ENTRY="\xe2\x9b\x94" |
| 217 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 218 | bspin() { |
| 219 | tput civis |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 220 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 221 | local INDENT= |
| 222 | if [ "$1" == "-" ]; then |
| 223 | INDENT=" " |
| 224 | shift |
| 225 | fi |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 226 | echo -en "$INDENT $*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | sspin() { |
| 230 | local INDENT= |
| 231 | if [ "$1" == "-" ]; then |
| 232 | INDENT=" " |
| 233 | shift |
| 234 | fi |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 235 | C=$(echo $SPIN_PARTS | cut '-d ' -f $IDX) |
| 236 | echo -en "\r$INDENT$C $*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 237 | IDX=$(expr $IDX + 1) |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 238 | if [ $IDX -gt 8 ]; then |
| 239 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 240 | fi |
| 241 | } |
| 242 | |
| 243 | espin() { |
| 244 | local INDENT= |
| 245 | if [ "$1" == "-" ]; then |
| 246 | INDENT=" " |
| 247 | shift |
| 248 | fi |
| 249 | echo -e "\r$INDENT$*" |
| 250 | tput cnorm |
| 251 | } |
| 252 | |
| 253 | count_pods() { |
| 254 | local NAMESPACE=$1; shift |
| 255 | local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}") |
| 256 | local COUNT=0 |
| 257 | local PATTERNS=$* |
| 258 | for POD in $PODS; do |
| 259 | local NAME=$(echo $POD | cut -d/ -f 1) |
| 260 | local STATE=$(echo $POD | cut -d/ -f 2) |
| 261 | local CONTAINERS=$(echo $POD | cut -d/ -f 3 | sed -e 's/_/ /g') |
| 262 | if [ "$STATE" == "Running" ]; then |
| 263 | local TOTAL=$(echo $CONTAINERS | wc -w) |
| 264 | local FOUND=$(echo $CONTAINERS | grep -o true | wc -l) |
| 265 | if [ $TOTAL -eq $FOUND ]; then |
| 266 | for PATTERN in $PATTERNS; do |
| 267 | if [[ $NAME =~ $PATTERN ]]; then |
| 268 | COUNT=$(expr $COUNT + 1) |
| 269 | fi |
| 270 | done |
| 271 | fi |
| 272 | fi |
| 273 | done |
| 274 | echo $COUNT |
| 275 | } |
| 276 | |
| 277 | wait_for_pods() { |
| 278 | local INDENT= |
| 279 | if [ "$1" == "-" ]; then |
| 280 | INDENT=$1; shift |
| 281 | fi |
| 282 | local NAMESPACE=$1; shift |
| 283 | local EXPECT=$1; shift |
| 284 | local RETRY=$1; shift |
| 285 | local MESSAGE=$1; shift |
| 286 | local PATTERNS=$* |
| 287 | local HAVE=$(count_pods $NAMESPACE $PATTERNS) |
| 288 | COUNT=$(expr 300 / 15) |
| 289 | bspin $INDENT $MESSAGE |
| 290 | sspin $INDENT |
| 291 | if [ $HAVE -ne $EXPECT ]; then |
| 292 | while [ $HAVE -ne $EXPECT ]; do |
| 293 | sspin $INDENT |
| 294 | COUNT=$(expr $COUNT - 1) |
| 295 | if [ $COUNT -eq 0 ]; then |
| 296 | HAVE=$(count_pods $NAMESPACE $PATTERNS) |
| 297 | COUNT=$(expr 300 / 15) |
| 298 | fi |
| 299 | sleep .15 |
| 300 | done |
| 301 | fi |
| 302 | espin $INDENT $VERIFIED |
| 303 | if [ $HAVE -ne $EXPECT ]; then |
| 304 | return 1 |
| 305 | fi |
| 306 | return 0 |
| 307 | } |
| 308 | |
| 309 | helm_install() { |
| 310 | local INDENT= |
| 311 | if [ "$1" == "-" ]; then |
| 312 | INDENT=$1; shift |
| 313 | fi |
| 314 | local NAMESPACE=$1; shift |
| 315 | local NAME=$1; shift |
| 316 | local CHART=$1; shift |
| 317 | local MESSAGE=$* |
| 318 | |
| 319 | COUNT=$(expr 300 / 15) |
| 320 | bspin $INDENT $MESSAGE |
| 321 | (set -x; helm install -f $TYPE-values.yaml --namespace $NAMESPACE --name $NAME $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
| 322 | SUCCESS=$? |
| 323 | while [ $SUCCESS -ne 0 ]; do |
| 324 | sspin $INDENT |
| 325 | COUNT=$(expr $COUNT - 1) |
| 326 | if [ $COUNT -eq 0 ]; then |
| 327 | (set -x; helm install -f $TYPE-values.yaml --namespace $NAMESPACE --name $NAME $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
| 328 | COUNT=$(expr 300 / 15) |
| 329 | fi |
| 330 | sleep .15 |
| 331 | done |
| 332 | espin $INDENT $VERIFIED |
| 333 | } |
| 334 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 335 | echo "INSTALL TYPE: $TYPE" >> $LOG |
| 336 | |
| 337 | bspin "Verify GOPATH" |
| 338 | export GOPATH=$(pwd) |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 339 | mkdir -p $GOPATH/bin |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 340 | espin $VERIFIED |
| 341 | |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 342 | if [ "$INSTALL_KUBECTL" == "no" ]; then |
| 343 | bspin "Skip kubectl install" |
| 344 | espin $NO_ENTRY |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 345 | else |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 346 | bspin "Verify kubectl $HELM" |
| 347 | if [ -x $GOPATH/bin/kubectl ]; then |
| 348 | espin $VERIFIED |
| 349 | else |
| 350 | espin $NOT_VERIFIED |
| 351 | bspin - "Download and install Kubernetes/kubectl $DOWNLOAD" |
| 352 | (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 |
| 353 | (set -x; chmod 755 $GOPATH/bin/kubectl >>$LOG 2>&1) >>$LOG 2>&1 |
| 354 | espin - $VERIFIED |
| 355 | fi |
Test User | c13bdc9 | 2019-07-03 20:57:49 +0000 | [diff] [blame] | 356 | fi |
| 357 | |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 358 | if [ "$DEPLOY_K8S" == "no" ]; then |
| 359 | bspin "Skip Kubernetes/Kind Deployment" |
| 360 | espin $NO_ENTRY |
| 361 | else |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 362 | bspin "Verify Kubernetes/Kind $HELM" |
| 363 | if [ -x $GOPATH/bin/kind ]; then |
| 364 | espin $VERIFIED |
| 365 | else |
| 366 | espin $NOT_VERIFIED |
| 367 | bspin - "Download and install Kubernetes/kind $DOWNLOAD" |
David Bainbridge | 9e2a666 | 2019-07-11 17:07:57 +0000 | [diff] [blame] | 368 | (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] | 369 | (set -x; chmod 755 $GOPATH/bin/kind >>$LOG 2>&1) >>$LOG 2>&1 |
| 370 | espin - $VERIFIED |
| 371 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 372 | fi |
| 373 | |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 374 | if [ "$INSTALL_HELM" == "no" ]; then |
| 375 | bspin "Skip Helm Install" |
| 376 | espin $NO_ENTRY |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 377 | else |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 378 | bspin "Verify Helm $HELM" |
| 379 | if [ -x $GOPATH/bin/helm ]; then |
| 380 | espin $VERIFIED |
| 381 | else |
| 382 | espin $NOT_VERIFIED |
| 383 | bspin - "Download and install Helm $DOWNLOAD" |
| 384 | (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 |
| 385 | espin - $VERIFIED |
| 386 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 387 | fi |
| 388 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 389 | bspin "Verify voltctl $HIGH_VOLTAGE" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 390 | if [ -x $GOPATH/bin/voltctl ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 391 | espin $VERIFIED |
| 392 | else |
| 393 | espin $NOT_VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 394 | bspin - "Download and build voltctl $DOWNLOAD" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 395 | (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] | 396 | (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] | 397 | espin - $VERIFIED |
| 398 | fi |
| 399 | |
| 400 | bspin "Verify command PATH" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 401 | export PATH=$GOPATH/bin:$PATH |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 402 | espin $VERIFIED |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 403 | |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 404 | if [ "$DEPLOY_K8S" == "yes" ]; then |
| 405 | HAVE=$(kind get clusters | grep -c voltha-$TYPE) |
| 406 | bspin "Verify Kubernetes/Kind Cluster" |
| 407 | sspin |
| 408 | if [ $HAVE -eq 0 ]; then |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 409 | espin $NOT_VERIFIED |
| 410 | bspin - "Verify cluster configuration" |
| 411 | if [ ! -r ./$TYPE-cluster.cfg ]; then |
| 412 | espin - $NOT_VERIFIED |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 413 | bspin - "Download cluster configuration: $TYPE-cluster.cfg $DOWNLOAD" |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 414 | (set -x; curl -o ./$TYPE-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^] | 415 | espin - $VERIFIED |
| 416 | else |
| 417 | espin - $VERIFIED |
| 418 | fi |
David Bainbridge | 491b1bd | 2019-07-11 17:53:11 +0000 | [diff] [blame] | 419 | kind create cluster --name voltha-$TYPE --config $TYPE-cluster.cfg |
| 420 | else |
| 421 | espin $VERIFIED |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 422 | fi |
| 423 | |
| 424 | export KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$TYPE")" |
| 425 | P="coredns-.* \ |
| 426 | etcd-voltha-$TYPE-control-plane \ |
| 427 | kindnet-.* \ |
| 428 | kube-apiserver-voltha-$TYPE-control-plane \ |
| 429 | kube-controller-manager-voltha-$TYPE-control-plane \ |
| 430 | kube-proxy-.* \ |
| 431 | kube-scheduler-voltha-$TYPE-control-plane" |
| 432 | |
| 433 | EXPECT=$(test "$TYPE" == "minimal" && echo "12" || echo "14") |
| 434 | 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] | 435 | fi |
| 436 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 437 | COUNT=$(count_pods "kube-system" "tiller-deploy-.*") |
| 438 | bspin "Verify Helm" |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 439 | if [ $COUNT -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 440 | espin $NOT_VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 441 | echo -e "Configuring Helm $GEAR" |
David K. Bainbridge | 0e89cb9 | 2019-07-17 11:30:10 -0700 | [diff] [blame^] | 442 | if [ "$INSTALL_HELM" == "no" ]; then |
| 443 | bspin - "Skip Helm/Tiller Initialization" |
| 444 | espin - $NO_ENTRY |
| 445 | else |
| 446 | bspin - "Initialize Helm" |
| 447 | (set -x; helm init --upgrade >>$LOG 2>&1) >>$LOG 2>&1 |
| 448 | espin - $VERIFIED |
| 449 | wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*" |
| 450 | fi |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 451 | bspin - "Add Google Incubator repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 452 | (set -x; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 453 | espin - $VERIFIED |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 454 | |
| 455 | # HACK (sort-of) - the config for tiller is about to be patched, which will |
| 456 | # cause the tiller pod to be recreated. This can sometimes cause a timing |
| 457 | # issue with the "wait_for_pods" call on tiller as it may incorrectly |
| 458 | # identify the running/ready tiller pod that is soon to be terminated as |
| 459 | # what it is waiting for. To avoid this issue we do a clean scale down and |
| 460 | # scale up of the pod so the script controlls when it should be expecting |
| 461 | # things |
| 462 | (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] | 463 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 464 | bspin - "Add Google Stable repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 465 | (set -x; helm repo add stable https://kubernetes-charts.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 466 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 467 | bspin - "Add ONF repository to Helm" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 468 | (set -x; helm repo add onf https://charts.opencord.org >>$LOG 2>&1) >>$LOG 2>&1 |
| 469 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 470 | bspin - "Update Helm repository cache" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 471 | (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1 |
| 472 | espin - $VERIFIED |
| 473 | |
| 474 | # Create and k8s service account so that Helm can create pods |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 475 | bspin - "Create Tiller ServiceAccount" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 476 | (set -x; kubectl create serviceaccount --namespace kube-system tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 477 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 478 | bspin - "Create Tiller ClusterRoleBinding" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 479 | (set -x; kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 480 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 481 | bspin - "Update Tiller Manifest" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 482 | (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] | 483 | |
| 484 | # HACK (sort-of) - part to, spin it back up |
| 485 | (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] | 486 | espin - $VERIFIED |
| 487 | else |
| 488 | espin $VERIFIED |
| 489 | fi |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 490 | wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 491 | |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 492 | bspin "Verify Helm values file: $TYPE-values.yaml" |
| 493 | if [ ! -r "./$TYPE-values.yaml" ]; then |
| 494 | espin $NOT_VERIFIED |
| 495 | bspin - "Download Helm values file: $TYPE-values.yaml $DOWNLOAD" |
| 496 | (set -x; curl -o ./$TYPE-values.yaml -sSL https://raw.githubusercontent.com/ciena/kind-voltha/master/$TYPE-values.yaml >>$LOG 2>&1) >>$LOG 2>&1 |
| 497 | espin - $VERIFIED |
| 498 | else |
| 499 | espin $VERIFIED |
| 500 | fi |
| 501 | |
| 502 | if [ "$JUST_K8S" == "yes" ]; then |
| 503 | echo "Environment deployed, not deploying VOLTHA artifacts as requested. Good bye." |
| 504 | echo "" |
| 505 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 506 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 507 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 508 | echo "" | tee -a $LOG |
| 509 | echo -en $BOLD |
| 510 | if [ $DEPLOY_K8S == "yes" ]; then |
| 511 | echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG |
| 512 | fi |
| 513 | echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG |
| 514 | echo -en $NORMAL |
| 515 | echo "" | tee -a $LOG |
| 516 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 517 | exit 0 |
| 518 | fi |
| 519 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 520 | bspin "Verify ETCD Operator $OLD_KEY" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 521 | 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] | 522 | espin $NOT_VERIFIED |
| 523 | helm_install - voltha etcd-operator stable/etcd-operator "Install ETCD Operator" |
| 524 | else |
| 525 | espin $VERIFIED |
| 526 | fi |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 527 | EXPECT=$(test "$TYPE" == "minimal" && echo "1" || echo "3") |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 528 | wait_for_pods - "voltha" $EXPECT -1 "Waiting for ETCD Operator to start" "etcd-operator-.*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 529 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 530 | bspin "Verify ONOS installed $BIRD" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 531 | if [ $(helm list --deployed --short --namespace default "^onos\$" | wc -l) -ne 1 ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 532 | espin $NOT_VERIFIED |
| 533 | helm_install - default onos onf/onos "Install ONOS" |
| 534 | else |
| 535 | espin $VERIFIED |
| 536 | fi |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 537 | wait_for_pods - "default" 1 -1 "Waiting for ONOS to start" "onos-.*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 538 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 539 | bspin - "Forward ONOS API port $FORWARD" |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 540 | (set -x; screen -p 0 -X -S onos-ui-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1 |
| 541 | (set -x; screen -dmS onos-ui-$TYPE kubectl port-forward service/onos-ui $ONOS_API_PORT:8181 >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 542 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 543 | bspin - "Forward ONOS SSH port $FORWARD" |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 544 | (set -x; screen -p 0 -X -S onos-ssh-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1 |
| 545 | (set -x; screen -dmS onos-ssh-$TYPE kubectl port-forward service/onos-ssh $ONOS_SSH_PORT:8101 >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 546 | espin - $VERIFIED |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 547 | if [ ! -x ./onos-files/install-onos-applications.sh ]; then |
| 548 | bspin - "Verify or download ONOS configuration support files $DOWNLOAD" |
| 549 | (set -x; mkdir -p ./onos-files >>$LOG 2>&1) >>$LOG 2>&1 |
| 550 | for i in dhcp-to-controller-flow.json install-onos-applications.sh olt-onos-enableExtraneousRules.json olt-onos-netcfg.json olt-onos-olt-settings.json; do |
| 551 | if [ ! -r ./onos-files/$i ]; then |
| 552 | (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 |
| 553 | fi |
| 554 | done |
| 555 | (set -x; chmod 755 ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1 |
| 556 | espin - $VERIFIED |
| 557 | fi |
| 558 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 559 | bspin - "Install required ONOS applications $INSTALL" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 560 | (set -x; ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1 |
| 561 | espin - $VERIFIED |
| 562 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 563 | bspin "Verify VOLTHA installed $HIGH_VOLTAGE" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 564 | 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] | 565 | espin $NOT_VERIFIED |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 566 | helm_install - voltha voltha onf/voltha "Install VOLTHA Core" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 567 | else |
| 568 | espin $VERIFIED |
| 569 | fi |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 570 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 571 | VOLTHA="ofagent-.* \ |
| 572 | ro-core.* \ |
| 573 | rw-core.* \ |
| 574 | voltha-api-server-.* \ |
| 575 | voltha-cli-server-.* \ |
| 576 | voltha-etcd-cluster-.* \ |
| 577 | voltha-kafka-.* \ |
| 578 | voltha-zookeeper-.*" |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 579 | EXPECT=$(test "$TYPE" == "minimal" && echo "9" || echo "11") |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 580 | wait_for_pods - "voltha" $EXPECT -1 "Waiting for VOLTHA Core to start" $VOLTHA |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 581 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 582 | echo -e "Verify Adapters $PLUG" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 583 | bspin - "Verify Simulated Adapters installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 584 | 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] | 585 | espin - $NOT_VERIFIED |
| 586 | helm_install - voltha sim onf/voltha-adapter-simulated "Install Simulated Adapters" |
| 587 | else |
| 588 | espin - $VERIFIED |
| 589 | fi |
| 590 | |
| 591 | bspin - "Verify OpenOLT Adapter installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 592 | 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] | 593 | espin - $NOT_VERIFIED |
| 594 | helm_install - voltha open-olt onf/voltha-adapter-openolt "Install OpenOLT Adapter" |
| 595 | else |
| 596 | espin - $VERIFIED |
| 597 | fi |
| 598 | bspin - "Verify OpenONU Adapter installed" |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 599 | 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] | 600 | espin - $NOT_VERIFIED |
| 601 | helm_install - voltha open-onu onf/voltha-adapter-openonu "Install OpenONU Adapter" |
| 602 | else |
| 603 | espin - $VERIFIED |
| 604 | fi |
| 605 | |
| 606 | ADAPTERS="adapter-.*" |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 607 | wait_for_pods - "voltha" 4 -1 "Waiting for adapters to start" $ADAPTERS |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 608 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 609 | if [ $WITH_BBSIM == "yes" ]; then |
| 610 | echo -e "Verify BBSIM $PLUG" |
| 611 | bspin - "Verify BBSIM Insalled" |
| 612 | if [ $(helm list --deployed --short --namespace voltha "^bbsim\$" | wc -l) -ne 1 ]; then |
| 613 | espin - $NOT_VERIFIED |
| 614 | helm_install - voltha bbsim onf/bbsim "Install BBSIM" |
| 615 | else |
| 616 | espin - $VERIFIED |
| 617 | fi |
| 618 | wait_for_pods - "voltha" 1 -1 "Waiting for BBSIM to start" "bbsim-.*" |
| 619 | fi |
| 620 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 621 | echo -e "Restart VOLTHA API $RESTART" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 622 | API="voltha-api-server-.* ofagent-.*" |
| 623 | (set -x; kubectl scale --replicas=0 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 624 | wait_for_pods - "voltha" 0 -1 "Wait for API to stop $STOP" $API |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 625 | (set -x; kubectl scale --replicas=1 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 626 | wait_for_pods - "voltha" 2 -1 "Wait for API to re-start $GO" $API |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 627 | |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 628 | bspin - "Forward VOLTHA API port $FORWARD" |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 629 | (set -x; screen -p 0 -X -S voltha-api-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1 |
| 630 | (set -x; screen -dmS voltha-api-$TYPE kubectl port-forward -n voltha service/voltha-api $VOLTHA_API_PORT:55555 >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 631 | espin - $VERIFIED |
Test User | b571237 | 2019-07-03 21:52:17 +0000 | [diff] [blame] | 632 | bspin - "Forward VOLTHA SSH port $FORWARD" |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 633 | (set -x; screen -p 0 -X -S voltha-ssh-$TYPE stuff $'\003' 2>/dev/null >/dev/null >>$LOG 2>&1) >>$LOG 2>&1 |
| 634 | (set -x; screen -dmS voltha-ssh-$TYPE kubectl port-forward -n voltha service/voltha-cli $VOLTHA_SSH_PORT:5022 >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 635 | espin - $VERIFIED |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 636 | |
| 637 | bspin - "Create voltctl configuration file" |
| 638 | (set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | 01ed064 | 2019-07-03 20:17:06 +0000 | [diff] [blame] | 639 | (set -x; voltctl -a v2 -s localhost:$VOLTHA_API_PORT config > $HOME/.volt/config-$TYPE 2>>$LOG) >>$LOG 2>&1 |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 640 | espin - $VERIFIED |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 641 | |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 642 | echo "" |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 643 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 644 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 645 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 646 | echo "" | tee -a $LOG |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 647 | echo -en $BOLD |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 648 | if [ $DEPLOY_K8S == "yes" ]; then |
| 649 | echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG |
| 650 | fi |
Test User | fa30f7f | 2019-07-03 20:35:19 +0000 | [diff] [blame] | 651 | echo "export VOLTCONFIG=\"$HOME/.volt/config-$TYPE\"" | tee -a $LOG |
Test User | ba1e7e7 | 2019-07-10 22:27:54 +0000 | [diff] [blame] | 652 | echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG |
Test User | 7d86612 | 2019-07-09 17:52:35 +0000 | [diff] [blame] | 653 | echo -en $NORMAL |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame] | 654 | echo "" | tee -a $LOG |
| 655 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 656 | |