blob: 0db6091b6f2ac183ee24077be402787304952ec3 [file] [log] [blame]
Test User01ed0642019-07-03 20:17:06 +00001#!/bin/bash
David K. Bainbridgeb7285432019-07-02 22:05:24 -07002# 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()
17trap ctrl_c INT
18
19function 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 User08ebbd92019-07-03 17:15:39 +000027VOLTCTL_VERSION=${VOLTCTL_VERSION:-0.0.5-dev}
28KIND_VERSION=${KIND_VERSION:-v0.4.0}
29_VOLTCTL_VERSION=$(echo $VOLTCTL_VERSION | sed -e 's/-/_/g')
30
Test User7d866122019-07-09 17:52:35 +000031BLACK=$(tput setaf 0)
32RED=$(tput setaf 1)
33GREEN=$(tput setaf 2)
34YELLOW=$(tput setaf 3)
35BLUE=$(tput setaf 4)
36MAGENTA=$(tput setaf 5)
37CYAN=$(tput setaf 6)
38WHITE=$(tput setaf 7)
39BOLD=$(tput bold)
40NORMAL=$(tput sgr0)
41ERROR="\xe2\x9c\x97\x20"
42
Test User3d7ad8e2019-07-03 06:15:44 +000043TYPE=${TYPE:-minimal}
Test User7d866122019-07-09 17:52:35 +000044WITH_BBSIM=${WITH_BBSIM:-no}
David Bainbridge5b7b96b2019-07-25 20:29:13 +000045WITH_RADIUS=${WITH_RADIUS:-no}
David Bainbridgeb270c202019-07-26 01:44:42 +000046WITH_ONOS=${WITH_ONOS:-yes}
Test Userba1e7e72019-07-10 22:27:54 +000047JUST_K8S=${JUST_K8S:-no}
48DEPLOY_K8S=${DEPLOY_K8S:-yes}
David Bainbridgee10f6d52019-07-25 00:28:13 +000049SKIP_RESTART_API=${SKIP_RESTART_API:-no}
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070050INSTALL_KUBECTL=${INSTALL_KUBECTL:-yes}
51INSTALL_HELM=${INSTALL_HELM:-yes}
David Bainbridge5b7b96b2019-07-25 20:29:13 +000052USE_GO=${USE_GO:-yes}
53VOLTHA_LOG_LEVEL=${VOLTHA_LOG_LEVEL:-WARN}
David Bainbridgee10f6d52019-07-25 00:28:13 +000054VOLTHA_CHART=${VOLTHA_CHART:=onf/voltha}
55VOLTHA_ADAPTER_SIM_CHART=${VOLTHA_ADAPTER_SIM_CHART:-onf/voltha-adapter-simulated}
56VOLTHA_ADAPTER_OPEN_OLT_CHART=${VOLTHA_ADAPTER_OPEN_OLT_CHART:-onf/voltha-adapter-openolt}
57VOLTHA_ADAPTER_OPEN_ONU_CHART=${VOLTHA_ADAPTER_OPEN_ONU_CHART:-onf/voltha-adapter-openonu}
Test Userba1e7e72019-07-10 22:27:54 +000058
59HAVE_GO=$(which go >/dev/null 2>&1 && echo "yes" || echo "no")
60HOSTOS=$(uname -s | tr "[:upper:]" "[:lower:"])
61HOSTARCH=$(uname -m | tr "[:upper:]" "[:lower:"])
62if [ $HOSTARCH == "x86_64" ]; then
63 HOSTARCH="amd64"
64fi
Test User7d866122019-07-09 17:52:35 +000065
66# Verify TYPE setting
67if [ $(echo ":minimal:full:" | grep -ic ":$TYPE:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070068 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$TYPE value of '$TYPE'. Should be 'minimal' or 'full'${NORMAL}"
Test User7d866122019-07-09 17:52:35 +000069 exit 1
70fi
71
72# Verify WITH_BBSIM settting and convert uniform value of yes or no
73if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$WITH_BBSIM:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070074 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$WITH_BBSIM value of '$WITH_BBSIM'. Should be 'yes' or 'no'${NORMAL}"
Test User7d866122019-07-09 17:52:35 +000075 exit 1
76fi
77if [ $(echo ":y:yes:true:1:" | grep -ic ":$WITH_BBSIM:") -eq 1 ]; then
78 WITH_BBSIM=yes
79else
80 WITH_BBSIM=no
81fi
82
David Bainbridge5b7b96b2019-07-25 20:29:13 +000083# Verify WITH_RADIUS settting and convert uniform value of yes or no
84if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$WITH_RADIUS:") -eq 0 ]; then
85 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$WITH_RADIUS value of '$WITH_RADIUS'. Should be 'yes' or 'no'${NORMAL}"
86 exit 1
87fi
88if [ $(echo ":y:yes:true:1:" | grep -ic ":$WITH_RADIUS:") -eq 1 ]; then
89 WITH_RADIUS=yes
90else
91 WITH_RADIUS=no
92fi
93
David Bainbridgeb270c202019-07-26 01:44:42 +000094# Verify WITH_ONOS settting and convert uniform value of yes or no
95if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$WITH_ONOS:") -eq 0 ]; then
96 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$WITH_ONOS value of '$WITH_ONOS'. Should be 'yes' or 'no'${NORMAL}"
97 exit 1
98fi
99if [ $(echo ":y:yes:true:1:" | grep -ic ":$WITH_ONOS:") -eq 1 ]; then
100 WITH_ONOS=yes
101else
102 WITH_ONOS=no
103fi
104
Test Userba1e7e72019-07-10 22:27:54 +0000105# Verify JUST_K8S settting and convert uniform value of yes or no
106if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$JUST_K8S:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700107 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$JUST_K8S value of '$JUST_K8S'. Should be 'yes' or 'no'${NORMAL}"
Test Userba1e7e72019-07-10 22:27:54 +0000108 exit 1
109fi
110if [ $(echo ":y:yes:true:1:" | grep -ic ":$JUST_K8S:") -eq 1 ]; then
111 JUST_K8S=yes
112else
113 JUST_K8S=no
114fi
115
116# Verify DEPLOY_K8S settting and convert uniform value of yes or no
117if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$DEPLOY_K8S:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700118 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$DEPLOY_K8S value of '$DEPLOY_K8S'. Should be 'yes' or 'no'${NORMAL}"
Test Userba1e7e72019-07-10 22:27:54 +0000119 exit 1
120fi
121if [ $(echo ":y:yes:true:1:" | grep -ic ":$DEPLOY_K8S:") -eq 1 ]; then
122 DEPLOY_K8S=yes
123else
124 DEPLOY_K8S=no
125fi
Test User01ed0642019-07-03 20:17:06 +0000126
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700127# Verify INSTALL_KUBECTL settting and convert uniform value of yes or no
128if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_KUBECTL:") -eq 0 ]; then
129 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_KUBECTL value of '$INSTALL_KUBECTL'. Should be 'yes' or 'no'${NORMAL}"
130 exit 1
131fi
132
133if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_KUBECTL:") -eq 1 ]; then
134 INSTALL_KUBECTL=yes
135else
136 INSTALL_KUBECTL=no
137fi
138
David Bainbridgee10f6d52019-07-25 00:28:13 +0000139# Verify SKIP_RESTART_API settting and convert uniform value of yes or no
140if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$SKIP_RESTART_API:") -eq 0 ]; then
141 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$SKIP_RESTART_API value of '$SKIP_RESTART_API'. Should be 'yes' or 'no'${NORMAL}"
142 exit 1
143fi
144if [ $(echo ":y:yes:true:1:" | grep -ic ":$SKIP_RESTART_API:") -eq 1 ]; then
145 SKIP_RESTART_API=yes
146else
147 SKIP_RESTART_API=no
148fi
149
David Bainbridge1ceabc12019-07-25 17:21:05 +0000150# Verify USE_GO settting and convert uniform value of yes or no
151if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$USE_GO:") -eq 0 ]; then
152 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$USE_GO value of '$USE_GO'. Should be 'yes' or 'no'${NORMAL}"
153 exit 1
154fi
155if [ $(echo ":y:yes:true:1:" | grep -ic ":$USE_GO:") -eq 1 ]; then
156 USE_GO=true
157else
158 USE_GO=false
159fi
160
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700161# Verify INSTALL_HELM settting and convert uniform value of yes or no
162if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_HELM:") -eq 0 ]; then
163 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_HELM value of '$INSTALL_HELM'. Should be 'yes' or 'no'${NORMAL}"
164 exit 1
165fi
166
167if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_HELM:") -eq 1 ]; then
168 INSTALL_HELM=yes
169else
170 INSTALL_HELM=no
171fi
172
Test User01ed0642019-07-03 20:17:06 +0000173if [ "$TYPE" == "full" ]; then
174 ONOS_API_PORT=${ONOS_API_PORT:-8182}
175 ONOS_SSH_PORT=${ONOS_SSH_PORT:-8102}
176 VOLTHA_API_PORT=${VOLTHA_API_PORT:-55556}
177 VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5023}
178else
179 ONOS_API_PORT=${ONOS_API_PORT:-8181}
180 ONOS_SSH_PORT=${ONOS_SSH_PORT:-8101}
181 VOLTHA_API_PORT=${VOLTHA_API_PORT:-55555}
182 VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5022}
183fi
184
185if [ "$1" == "get" -a "$2" == "voltconfig" ]; then
186 echo "$HOME/.volt/config-$TYPE"
187 exit
188fi
Test User3d7ad8e2019-07-03 06:15:44 +0000189
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700190if [ $# -ne 1 -o $(echo ":up:down:" | grep -c ":$1:") -ne 1 ]; then
191 >&2 echo "up or down?"
192 exit 1
193fi
194
195if [ "$1" == "down" ]; then
Test Userba1e7e72019-07-10 22:27:54 +0000196 if [ $DEPLOY_K8S == "yes" ]; then
197 if [ -x ./bin/kind ]; then
198 exec ./bin/kind delete cluster --name voltha-$TYPE
199 else
200 >&2 echo "Kind doesn't seem to be installed, so nothing to do. Bye."
201 fi
Test User08ebbd92019-07-03 17:15:39 +0000202 else
Test Userba1e7e72019-07-10 22:27:54 +0000203 EXISTS=$(helm list -q)
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000204 EXPECT="etcd-operator onos open-olt open-onu sim voltha bbsim radius"
Test Userba1e7e72019-07-10 22:27:54 +0000205 INTERSECT=
206 for i in $EXISTS; do
207 if [ $(echo $EXPECT | grep -c $i) -eq 1 ]; then
208 HAVE="$HAVE $i"
209 fi
210 done
David Bainbridge7831a662019-07-25 18:12:25 +0000211 if [ "$HAVE X" != " X" ]; then
212 ./bin/helm delete --purge $HAVE
213 fi
Test Userba1e7e72019-07-10 22:27:54 +0000214fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700215 exit
216fi
217
Test User01ed0642019-07-03 20:17:06 +0000218LOG="install-$TYPE.log"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700219date > $LOG
220
David Bainbridge1ceabc12019-07-25 17:21:05 +0000221# Output install options to log
222echo "OPTIONS" >> $LOG
223echo " TYPE = $TYPE" >> $LOG
224echo " WITH_BBSIM = $WITH_BBSIM" >> $LOG
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000225echo " WITH_RADIUS = $WITH_RADIUS" >> $LOG
David Bainbridgeb270c202019-07-26 01:44:42 +0000226echo " WITH_ONOS = $WITH_ONOS" >> $LOG
David Bainbridge1ceabc12019-07-25 17:21:05 +0000227echo " JUST_K8S = $JUST_K8S" >> $LOG
228echo " DEPLOY_K8S = $DEPLOY_K8S" >> $LOG
229echo " SKIP_RESTART_API = $SKIP_RESTART_API" >> $LOG
230echo " INSTALL_KUBECTL = $INSTALL_KUBECTL" >> $LOG
231echo " INSTALL_HELM = $INSTALL_HELM" >> $LOG
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000232echo " USE_GO = $(echo $USE_GO | test $(grep -c true) -eq 1 && echo yes || echo no)" >> $LOG
233echo " VOLTHA_LOG_LEVEL = $VOLTHA_LOG_LEVEL" >> $LOG
David Bainbridge1ceabc12019-07-25 17:21:05 +0000234echo " VOLTHA_CHART = $VOLTHA_CHART" >> $LOG
235echo " VOLTHA_ADAPTER_SIM_CHART = $VOLTHA_ADAPTER_SIM_CHART" >> $LOG
236echo " VOLTHA_ADAPTER_OPEN_OLT_CHART = $VOLTHA_ADAPTER_OPEN_OLT_CHART" >> $LOG
237echo " VOLTHA_ADAPTER_OPEN_ONU_CHART = $VOLTHA_ADAPTER_OPEN_ONU_CHART" >> $LOG
David Bainbridge1ceabc12019-07-25 17:21:05 +0000238
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700239spin() {
Test Userd87942b2019-07-03 07:20:24 +0000240 PARTS="\
241 \xe2\xa2\x8e\xe2\xa1\xb0 \
242 \xe2\xa2\x8e\xe2\xa1\xa1 \
243 \xe2\xa2\x8e\xe2\xa1\x91 \
244 \xe2\xa2\x8e\xe2\xa0\xb1 \
245 \xe2\xa0\x8e\xe2\xa1\xb1 \
246 \xe2\xa2\x8a\xe2\xa1\xb1 \
247 \xe2\xa2\x8c\xe2\xa1\xb1 \
248 \xe2\xa2\x86\xe2\xa1\xb1 \
249 "
250 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700251 tput civis
252 while true; do
Test Userd87942b2019-07-03 07:20:24 +0000253 C=$(echo $PARTS | cut '-d ' -f $IDX)
254 echo -en "$C"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700255 IDX=$(expr $IDX + 1)
Test Userd87942b2019-07-03 07:20:24 +0000256 if [ $IDX -gt 8 ]; then
257 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700258 fi
259 sleep .15
260 echo -en "\r"
261 done
262}
263
Test Userd87942b2019-07-03 07:20:24 +0000264SPIN_PARTS="\
265 \xe2\xa2\x8e\xe2\xa1\xb0 \
266 \xe2\xa2\x8e\xe2\xa1\xa1 \
267 \xe2\xa2\x8e\xe2\xa1\x91 \
268 \xe2\xa2\x8e\xe2\xa0\xb1 \
269 \xe2\xa0\x8e\xe2\xa1\xb1 \
270 \xe2\xa2\x8a\xe2\xa1\xb1 \
271 \xe2\xa2\x8c\xe2\xa1\xb1 \
272 \xe2\xa2\x86\xe2\xa1\xb1 \
273 "
274IDX=1
275NOT_VERIFIED="\xe2\x9c\x97\x20"
276VERIFIED="\xe2\x9c\x93\x20"
Test Userb5712372019-07-03 21:52:17 +0000277HELM="\xE2\x8E\x88"
278OLD_KEY="\xF0\x9F\x97\x9D"
279BIRD="\xF0\x9F\x90\xA6"
280HIGH_VOLTAGE="\xE2\x9A\xA1"
281PLUG="\xF0\x9F\xa7\xa9"
282RESTART="\xf0\x9f\x94\x84"
283FORWARD="\xE2\x87\xA8"
284INSTALL="\xF0\x9F\x8F\x97"
285STOP="\xf0\x9f\x9b\x91"
286GO="\xf0\x9f\x9a\x80"
287DOWNLOAD="\xf0\x9f\x93\xa5"
288GEAR="\xe2\x9a\x99"
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700289NO_ENTRY="\xe2\x9b\x94"
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000290LOCK="\xf0\x9f\x94\x92"
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700291
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700292bspin() {
293 tput civis
Test Userd87942b2019-07-03 07:20:24 +0000294 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700295 local INDENT=
296 if [ "$1" == "-" ]; then
297 INDENT=" "
298 shift
299 fi
Test Userd87942b2019-07-03 07:20:24 +0000300 echo -en "$INDENT $*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700301}
302
303sspin() {
304 local INDENT=
305 if [ "$1" == "-" ]; then
306 INDENT=" "
307 shift
308 fi
Test Userd87942b2019-07-03 07:20:24 +0000309 C=$(echo $SPIN_PARTS | cut '-d ' -f $IDX)
310 echo -en "\r$INDENT$C $*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700311 IDX=$(expr $IDX + 1)
Test Userd87942b2019-07-03 07:20:24 +0000312 if [ $IDX -gt 8 ]; then
313 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700314 fi
315}
316
317espin() {
318 local INDENT=
319 if [ "$1" == "-" ]; then
320 INDENT=" "
321 shift
322 fi
323 echo -e "\r$INDENT$*"
324 tput cnorm
325}
326
327count_pods() {
328 local NAMESPACE=$1; shift
329 local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}")
330 local COUNT=0
331 local PATTERNS=$*
332 for POD in $PODS; do
333 local NAME=$(echo $POD | cut -d/ -f 1)
334 local STATE=$(echo $POD | cut -d/ -f 2)
335 local CONTAINERS=$(echo $POD | cut -d/ -f 3 | sed -e 's/_/ /g')
336 if [ "$STATE" == "Running" ]; then
337 local TOTAL=$(echo $CONTAINERS | wc -w)
338 local FOUND=$(echo $CONTAINERS | grep -o true | wc -l)
339 if [ $TOTAL -eq $FOUND ]; then
340 for PATTERN in $PATTERNS; do
341 if [[ $NAME =~ $PATTERN ]]; then
342 COUNT=$(expr $COUNT + 1)
343 fi
344 done
345 fi
346 fi
347 done
348 echo $COUNT
349}
350
351wait_for_pods() {
352 local INDENT=
353 if [ "$1" == "-" ]; then
354 INDENT=$1; shift
355 fi
356 local NAMESPACE=$1; shift
357 local EXPECT=$1; shift
358 local RETRY=$1; shift
359 local MESSAGE=$1; shift
360 local PATTERNS=$*
361 local HAVE=$(count_pods $NAMESPACE $PATTERNS)
362 COUNT=$(expr 300 / 15)
363 bspin $INDENT $MESSAGE
364 sspin $INDENT
365 if [ $HAVE -ne $EXPECT ]; then
366 while [ $HAVE -ne $EXPECT ]; do
367 sspin $INDENT
368 COUNT=$(expr $COUNT - 1)
369 if [ $COUNT -eq 0 ]; then
370 HAVE=$(count_pods $NAMESPACE $PATTERNS)
371 COUNT=$(expr 300 / 15)
372 fi
373 sleep .15
374 done
375 fi
376 espin $INDENT $VERIFIED
377 if [ $HAVE -ne $EXPECT ]; then
378 return 1
379 fi
380 return 0
381}
382
383helm_install() {
384 local INDENT=
385 if [ "$1" == "-" ]; then
386 INDENT=$1; shift
387 fi
388 local NAMESPACE=$1; shift
389 local NAME=$1; shift
390 local CHART=$1; shift
391 local MESSAGE=$*
392
393 COUNT=$(expr 300 / 15)
394 bspin $INDENT $MESSAGE
David Bainbridge1ceabc12019-07-25 17:21:05 +0000395 (set -x; helm install -f $TYPE-values.yaml --set use_go=$USE_GO --set defaults.log_level=$VOLTHA_LOG_LEVEL --namespace $NAMESPACE --name $NAME $CHART >>$LOG 2>&1) >>$LOG 2>&1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700396 SUCCESS=$?
397 while [ $SUCCESS -ne 0 ]; do
398 sspin $INDENT
399 COUNT=$(expr $COUNT - 1)
400 if [ $COUNT -eq 0 ]; then
David Bainbridgee10f6d52019-07-25 00:28:13 +0000401 (set -x; helm install -f $TYPE-values.yaml --set defaults.log_level=$VOLTHA_LOG_LEVEL --namespace $NAMESPACE --name $NAME $CHART >>$LOG 2>&1) >>$LOG 2>&1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700402 COUNT=$(expr 300 / 15)
403 fi
404 sleep .15
405 done
406 espin $INDENT $VERIFIED
407}
408
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700409echo "INSTALL TYPE: $TYPE" >> $LOG
410
411bspin "Verify GOPATH"
412export GOPATH=$(pwd)
Test User3d7ad8e2019-07-03 06:15:44 +0000413mkdir -p $GOPATH/bin
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700414espin $VERIFIED
415
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700416if [ "$INSTALL_KUBECTL" == "no" ]; then
417 bspin "Skip kubectl install"
418 espin $NO_ENTRY
Test Userc13bdc92019-07-03 20:57:49 +0000419else
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700420 bspin "Verify kubectl $HELM"
421 if [ -x $GOPATH/bin/kubectl ]; then
422 espin $VERIFIED
423 else
424 espin $NOT_VERIFIED
425 bspin - "Download and install Kubernetes/kubectl $DOWNLOAD"
426 (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
427 (set -x; chmod 755 $GOPATH/bin/kubectl >>$LOG 2>&1) >>$LOG 2>&1
428 espin - $VERIFIED
429 fi
Test Userc13bdc92019-07-03 20:57:49 +0000430fi
431
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700432if [ "$DEPLOY_K8S" == "no" ]; then
433 bspin "Skip Kubernetes/Kind Deployment"
434 espin $NO_ENTRY
435else
Test Userba1e7e72019-07-10 22:27:54 +0000436 bspin "Verify Kubernetes/Kind $HELM"
437 if [ -x $GOPATH/bin/kind ]; then
438 espin $VERIFIED
439 else
440 espin $NOT_VERIFIED
441 bspin - "Download and install Kubernetes/kind $DOWNLOAD"
David Bainbridge9e2a6662019-07-11 17:07:57 +0000442 (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 Userba1e7e72019-07-10 22:27:54 +0000443 (set -x; chmod 755 $GOPATH/bin/kind >>$LOG 2>&1) >>$LOG 2>&1
444 espin - $VERIFIED
445 fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700446fi
447
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700448if [ "$INSTALL_HELM" == "no" ]; then
449 bspin "Skip Helm Install"
450 espin $NO_ENTRY
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700451else
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700452 bspin "Verify Helm $HELM"
453 if [ -x $GOPATH/bin/helm ]; then
454 espin $VERIFIED
455 else
456 espin $NOT_VERIFIED
457 bspin - "Download and install Helm $DOWNLOAD"
458 (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
459 espin - $VERIFIED
460 fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700461fi
462
Test Userb5712372019-07-03 21:52:17 +0000463bspin "Verify voltctl $HIGH_VOLTAGE"
Test User3d7ad8e2019-07-03 06:15:44 +0000464if [ -x $GOPATH/bin/voltctl ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700465 espin $VERIFIED
466else
467 espin $NOT_VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000468 bspin - "Download and build voltctl $DOWNLOAD"
Test Userba1e7e72019-07-10 22:27:54 +0000469 (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 User08ebbd92019-07-03 17:15:39 +0000470 (set -x; chmod 755 $GOPATH/bin/voltctl >>$LOG 2>&1) >>$LOG 2>&1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700471 espin - $VERIFIED
472fi
473
474bspin "Verify command PATH"
Test Userba1e7e72019-07-10 22:27:54 +0000475export PATH=$GOPATH/bin:$PATH
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700476espin $VERIFIED
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700477
Test Userba1e7e72019-07-10 22:27:54 +0000478if [ "$DEPLOY_K8S" == "yes" ]; then
479 HAVE=$(kind get clusters | grep -c voltha-$TYPE)
480 bspin "Verify Kubernetes/Kind Cluster"
481 sspin
482 if [ $HAVE -eq 0 ]; then
David Bainbridge491b1bd2019-07-11 17:53:11 +0000483 espin $NOT_VERIFIED
484 bspin - "Verify cluster configuration"
485 if [ ! -r ./$TYPE-cluster.cfg ]; then
486 espin - $NOT_VERIFIED
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700487 bspin - "Download cluster configuration: $TYPE-cluster.cfg $DOWNLOAD"
David Bainbridge491b1bd2019-07-11 17:53:11 +0000488 (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. Bainbridge0e89cb92019-07-17 11:30:10 -0700489 espin - $VERIFIED
490 else
491 espin - $VERIFIED
492 fi
David Bainbridge491b1bd2019-07-11 17:53:11 +0000493 kind create cluster --name voltha-$TYPE --config $TYPE-cluster.cfg
494 else
495 espin $VERIFIED
Test Userba1e7e72019-07-10 22:27:54 +0000496 fi
497
498 export KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$TYPE")"
499 P="coredns-.* \
500 etcd-voltha-$TYPE-control-plane \
501 kindnet-.* \
502 kube-apiserver-voltha-$TYPE-control-plane \
503 kube-controller-manager-voltha-$TYPE-control-plane \
504 kube-proxy-.* \
505 kube-scheduler-voltha-$TYPE-control-plane"
506
507 EXPECT=$(test "$TYPE" == "minimal" && echo "12" || echo "14")
508 wait_for_pods - "kube-system" $EXPECT -1 "Waiting for system PODs to start" $P
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700509fi
510
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700511COUNT=$(count_pods "kube-system" "tiller-deploy-.*")
512bspin "Verify Helm"
Test Userba1e7e72019-07-10 22:27:54 +0000513if [ $COUNT -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700514 espin $NOT_VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000515 echo -e "Configuring Helm $GEAR"
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700516 if [ "$INSTALL_HELM" == "no" ]; then
517 bspin - "Skip Helm/Tiller Initialization"
518 espin - $NO_ENTRY
519 else
520 bspin - "Initialize Helm"
521 (set -x; helm init --upgrade >>$LOG 2>&1) >>$LOG 2>&1
522 espin - $VERIFIED
523 wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*"
524 fi
Test Userb5712372019-07-03 21:52:17 +0000525 bspin - "Add Google Incubator repository to Helm"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700526 (set -x; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1
527 espin - $VERIFIED
Test Userba1e7e72019-07-10 22:27:54 +0000528
529 # HACK (sort-of) - the config for tiller is about to be patched, which will
530 # cause the tiller pod to be recreated. This can sometimes cause a timing
531 # issue with the "wait_for_pods" call on tiller as it may incorrectly
532 # identify the running/ready tiller pod that is soon to be terminated as
533 # what it is waiting for. To avoid this issue we do a clean scale down and
534 # scale up of the pod so the script controlls when it should be expecting
535 # things
536 (set -x; kubectl -n kube-system scale deploy tiller-deploy --replicas=0 >>$LOG 2>&1) >>$LOG 2>&1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700537
Test Userb5712372019-07-03 21:52:17 +0000538 bspin - "Add Google Stable repository to Helm"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700539 (set -x; helm repo add stable https://kubernetes-charts.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1
540 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000541 bspin - "Add ONF repository to Helm"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700542 (set -x; helm repo add onf https://charts.opencord.org >>$LOG 2>&1) >>$LOG 2>&1
543 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000544 bspin - "Update Helm repository cache"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700545 (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1
546 espin - $VERIFIED
547
548 # Create and k8s service account so that Helm can create pods
Test Userb5712372019-07-03 21:52:17 +0000549 bspin - "Create Tiller ServiceAccount"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700550 (set -x; kubectl create serviceaccount --namespace kube-system tiller >>$LOG 2>&1) >>$LOG 2>&1
551 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000552 bspin - "Create Tiller ClusterRoleBinding"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700553 (set -x; kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller >>$LOG 2>&1) >>$LOG 2>&1
554 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000555 bspin - "Update Tiller Manifest"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700556 (set -x; kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' >>$LOG 2>&1) >>$LOG 2>&1
Test Userba1e7e72019-07-10 22:27:54 +0000557
558 # HACK (sort-of) - part to, spin it back up
559 (set -x; kubectl -n kube-system scale deploy tiller-deploy --replicas=1 >>$LOG 2>&1) >>$LOG 2>&1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700560 espin - $VERIFIED
561else
562 espin $VERIFIED
563fi
Test Userb5712372019-07-03 21:52:17 +0000564wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700565
Test Userba1e7e72019-07-10 22:27:54 +0000566bspin "Verify Helm values file: $TYPE-values.yaml"
567if [ ! -r "./$TYPE-values.yaml" ]; then
568 espin $NOT_VERIFIED
569 bspin - "Download Helm values file: $TYPE-values.yaml $DOWNLOAD"
570 (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
571 espin - $VERIFIED
572else
573 espin $VERIFIED
574fi
575
576if [ "$JUST_K8S" == "yes" ]; then
577 echo "Environment deployed, not deploying VOLTHA artifacts as requested. Good bye."
578 echo ""
579 echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG
580 echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG
581 echo "tools required by VOLTHA in your command path. " | tee -a $LOG
582 echo "" | tee -a $LOG
583 echo -en $BOLD
584 if [ $DEPLOY_K8S == "yes" ]; then
585 echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG
586 fi
587 echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG
588 echo -en $NORMAL
589 echo "" | tee -a $LOG
590 echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG
591 exit 0
592fi
593
Test Userb5712372019-07-03 21:52:17 +0000594bspin "Verify ETCD Operator $OLD_KEY"
Test User7d866122019-07-09 17:52:35 +0000595if [ $(helm list --deployed --short --namespace voltha "^etcd-operator\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700596 espin $NOT_VERIFIED
597 helm_install - voltha etcd-operator stable/etcd-operator "Install ETCD Operator"
598else
599 espin $VERIFIED
600fi
Test User01ed0642019-07-03 20:17:06 +0000601EXPECT=$(test "$TYPE" == "minimal" && echo "1" || echo "3")
Test Userb5712372019-07-03 21:52:17 +0000602wait_for_pods - "voltha" $EXPECT -1 "Waiting for ETCD Operator to start" "etcd-operator-.*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700603
David Bainbridgeb270c202019-07-26 01:44:42 +0000604if [ $WITH_ONOS == "yes" ]; then
605 bspin "Verify ONOS installed $BIRD"
606 if [ $(helm list --deployed --short --namespace default "^onos\$" | wc -l) -ne 1 ]; then
607 espin $NOT_VERIFIED
608 helm_install - default onos onf/onos "Install ONOS"
609 else
610 espin $VERIFIED
611 fi
612 wait_for_pods - "default" 1 -1 "Waiting for ONOS to start" "onos-.*"
613
614 bspin - "Forward ONOS API port $FORWARD"
615 (set -x; screen -p 0 -X -S onos-ui-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
616 (set -x; screen -dmS onos-ui-$TYPE kubectl port-forward service/onos-ui $ONOS_API_PORT:8181 >>$LOG 2>&1) >>$LOG 2>&1
617 espin - $VERIFIED
618 bspin - "Forward ONOS SSH port $FORWARD"
619 (set -x; screen -p 0 -X -S onos-ssh-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
620 (set -x; screen -dmS onos-ssh-$TYPE kubectl port-forward service/onos-ssh $ONOS_SSH_PORT:8101 >>$LOG 2>&1) >>$LOG 2>&1
621 espin - $VERIFIED
622 if [ ! -x ./onos-files/install-onos-applications.sh ]; then
623 bspin - "Verify or download ONOS configuration support files $DOWNLOAD"
624 (set -x; mkdir -p ./onos-files >>$LOG 2>&1) >>$LOG 2>&1
625 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 radius-config.json; do
626 if [ ! -r ./onos-files/$i ]; then
627 (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
628 fi
629 done
630 (set -x; chmod 755 ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1
631 espin - $VERIFIED
632 fi
633
634 bspin - "Install required ONOS applications $INSTALL"
635 (set -x; ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1
Test Userba1e7e72019-07-10 22:27:54 +0000636 espin - $VERIFIED
637fi
638
Test Userb5712372019-07-03 21:52:17 +0000639bspin "Verify VOLTHA installed $HIGH_VOLTAGE"
Test User7d866122019-07-09 17:52:35 +0000640if [ $(helm list --deployed --short --namespace voltha "^voltha\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700641 espin $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000642 helm_install - voltha voltha $VOLTHA_CHART "Install VOLTHA Core"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700643else
644 espin $VERIFIED
645fi
Test Userba1e7e72019-07-10 22:27:54 +0000646
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700647VOLTHA="ofagent-.* \
648 ro-core.* \
649 rw-core.* \
650 voltha-api-server-.* \
651 voltha-cli-server-.* \
652 voltha-etcd-cluster-.* \
653 voltha-kafka-.* \
654 voltha-zookeeper-.*"
Test User01ed0642019-07-03 20:17:06 +0000655EXPECT=$(test "$TYPE" == "minimal" && echo "9" || echo "11")
Test Userb5712372019-07-03 21:52:17 +0000656wait_for_pods - "voltha" $EXPECT -1 "Waiting for VOLTHA Core to start" $VOLTHA
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700657
Test Userb5712372019-07-03 21:52:17 +0000658echo -e "Verify Adapters $PLUG"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700659bspin - "Verify Simulated Adapters installed"
Test User7d866122019-07-09 17:52:35 +0000660if [ $(helm list --deployed --short --namespace voltha "^sim\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700661 espin - $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000662 helm_install - voltha sim $VOLTHA_ADAPTER_SIM_CHART "Install Simulated Adapters"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700663else
664 espin - $VERIFIED
665fi
666
667bspin - "Verify OpenOLT Adapter installed"
Test User7d866122019-07-09 17:52:35 +0000668if [ $(helm list --deployed --short --namespace voltha "^open-olt\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700669 espin - $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000670 helm_install - voltha open-olt $VOLTHA_ADAPTER_OPEN_OLT_CHART "Install OpenOLT Adapter"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700671else
672 espin - $VERIFIED
673fi
674bspin - "Verify OpenONU Adapter installed"
Test User7d866122019-07-09 17:52:35 +0000675if [ $(helm list --deployed --short --namespace voltha "^open-onu\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700676 espin - $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000677 helm_install - voltha open-onu $VOLTHA_ADAPTER_OPEN_ONU_CHART "Install OpenONU Adapter"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700678else
679 espin - $VERIFIED
680fi
681
682ADAPTERS="adapter-.*"
Test Userb5712372019-07-03 21:52:17 +0000683wait_for_pods - "voltha" 4 -1 "Waiting for adapters to start" $ADAPTERS
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700684
Test User7d866122019-07-09 17:52:35 +0000685if [ $WITH_BBSIM == "yes" ]; then
686 echo -e "Verify BBSIM $PLUG"
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000687 bspin - "Verify BBSIM Installed"
Test User7d866122019-07-09 17:52:35 +0000688 if [ $(helm list --deployed --short --namespace voltha "^bbsim\$" | wc -l) -ne 1 ]; then
689 espin - $NOT_VERIFIED
690 helm_install - voltha bbsim onf/bbsim "Install BBSIM"
691 else
692 espin - $VERIFIED
693 fi
694 wait_for_pods - "voltha" 1 -1 "Waiting for BBSIM to start" "bbsim-.*"
695fi
696
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000697if [ $WITH_RADIUS == "yes" ]; then
698 echo -e "Verify RADIUS $LOCK"
699 bspin - "Verify RADIUS Installed"
700 if [ $(helm list --deployed --short --namespace voltha "^radius\$" | wc -l) -ne 1 ]; then
701 espin - $NOT_VERIFIED
702 helm_install - voltha radius onf/freeradius "Install RADIUS"
703 else
704 espin - $VERIFIED
705 fi
706 wait_for_pods - "voltha" 1 -1 "Waiting for RADIUS to start" "radius-.*"
707fi
708
David Bainbridgee10f6d52019-07-25 00:28:13 +0000709if [ $SKIP_RESTART_API == "no" ]; then
710 echo -e "Restart VOLTHA API $RESTART"
711 API="voltha-api-server-.* ofagent-.*"
712 (set -x; kubectl scale --replicas=0 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1
713 wait_for_pods - "voltha" 0 -1 "Wait for API to stop $STOP" $API
714 (set -x; kubectl scale --replicas=1 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1
715 wait_for_pods - "voltha" 2 -1 "Wait for API to re-start $GO" $API
716else
717 bspin "Skip VOLTHA API Restart"
718 espin $NO_ENTRY
719fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700720
Test Userb5712372019-07-03 21:52:17 +0000721bspin - "Forward VOLTHA API port $FORWARD"
Test User01ed0642019-07-03 20:17:06 +0000722(set -x; screen -p 0 -X -S voltha-api-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
723(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. Bainbridgeb7285432019-07-02 22:05:24 -0700724espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000725bspin - "Forward VOLTHA SSH port $FORWARD"
Test User01ed0642019-07-03 20:17:06 +0000726(set -x; screen -p 0 -X -S voltha-ssh-$TYPE stuff $'\003' 2>/dev/null >/dev/null >>$LOG 2>&1) >>$LOG 2>&1
727(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. Bainbridgeb7285432019-07-02 22:05:24 -0700728espin - $VERIFIED
Test User3d7ad8e2019-07-03 06:15:44 +0000729
David Bainbridgeb270c202019-07-26 01:44:42 +0000730if [ $WITH_ONOS == "yes" -a $WITH_RADIUS == "yes" ]; then
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000731 bspin "Configure ONOS RADIUS Connection $GEAR"
732 (set -x; cat onos-files/radius-config.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 -H Content-type:application/json -d@- >>$LOG 2>&1) >>$LOG 2>&1
733 espin $VERIFIED
734fi
735
736bspin "Create voltctl configuration file"
Test User3d7ad8e2019-07-03 06:15:44 +0000737(set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1
Test User01ed0642019-07-03 20:17:06 +0000738(set -x; voltctl -a v2 -s localhost:$VOLTHA_API_PORT config > $HOME/.volt/config-$TYPE 2>>$LOG) >>$LOG 2>&1
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000739espin $VERIFIED
Test User08ebbd92019-07-03 17:15:39 +0000740
Test User7d866122019-07-09 17:52:35 +0000741echo ""
Test User08ebbd92019-07-03 17:15:39 +0000742echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG
743echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG
744echo "tools required by VOLTHA in your command path. " | tee -a $LOG
745echo "" | tee -a $LOG
Test User7d866122019-07-09 17:52:35 +0000746echo -en $BOLD
Test Userba1e7e72019-07-10 22:27:54 +0000747if [ $DEPLOY_K8S == "yes" ]; then
748 echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG
749fi
Test Userfa30f7f2019-07-03 20:35:19 +0000750echo "export VOLTCONFIG=\"$HOME/.volt/config-$TYPE\"" | tee -a $LOG
Test Userba1e7e72019-07-10 22:27:54 +0000751echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG
Test User7d866122019-07-09 17:52:35 +0000752echo -en $NORMAL
Test User08ebbd92019-07-03 17:15:39 +0000753echo "" | tee -a $LOG
754echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG
755