blob: 33ec1ebe3d09aafa96bd1633549ebb4748a5f08e [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}
Test Userba1e7e72019-07-10 22:27:54 +000046JUST_K8S=${JUST_K8S:-no}
47DEPLOY_K8S=${DEPLOY_K8S:-yes}
David Bainbridgee10f6d52019-07-25 00:28:13 +000048SKIP_RESTART_API=${SKIP_RESTART_API:-no}
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070049INSTALL_KUBECTL=${INSTALL_KUBECTL:-yes}
50INSTALL_HELM=${INSTALL_HELM:-yes}
David Bainbridge5b7b96b2019-07-25 20:29:13 +000051USE_GO=${USE_GO:-yes}
52VOLTHA_LOG_LEVEL=${VOLTHA_LOG_LEVEL:-WARN}
David Bainbridgee10f6d52019-07-25 00:28:13 +000053VOLTHA_CHART=${VOLTHA_CHART:=onf/voltha}
54VOLTHA_ADAPTER_SIM_CHART=${VOLTHA_ADAPTER_SIM_CHART:-onf/voltha-adapter-simulated}
55VOLTHA_ADAPTER_OPEN_OLT_CHART=${VOLTHA_ADAPTER_OPEN_OLT_CHART:-onf/voltha-adapter-openolt}
56VOLTHA_ADAPTER_OPEN_ONU_CHART=${VOLTHA_ADAPTER_OPEN_ONU_CHART:-onf/voltha-adapter-openonu}
Test Userba1e7e72019-07-10 22:27:54 +000057
58HAVE_GO=$(which go >/dev/null 2>&1 && echo "yes" || echo "no")
59HOSTOS=$(uname -s | tr "[:upper:]" "[:lower:"])
60HOSTARCH=$(uname -m | tr "[:upper:]" "[:lower:"])
61if [ $HOSTARCH == "x86_64" ]; then
62 HOSTARCH="amd64"
63fi
Test User7d866122019-07-09 17:52:35 +000064
65# Verify TYPE setting
66if [ $(echo ":minimal:full:" | grep -ic ":$TYPE:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070067 >&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 +000068 exit 1
69fi
70
71# Verify WITH_BBSIM settting and convert uniform value of yes or no
72if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$WITH_BBSIM:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070073 >&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 +000074 exit 1
75fi
76if [ $(echo ":y:yes:true:1:" | grep -ic ":$WITH_BBSIM:") -eq 1 ]; then
77 WITH_BBSIM=yes
78else
79 WITH_BBSIM=no
80fi
81
David Bainbridge5b7b96b2019-07-25 20:29:13 +000082# Verify WITH_RADIUS settting and convert uniform value of yes or no
83if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$WITH_RADIUS:") -eq 0 ]; then
84 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$WITH_RADIUS value of '$WITH_RADIUS'. Should be 'yes' or 'no'${NORMAL}"
85 exit 1
86fi
87if [ $(echo ":y:yes:true:1:" | grep -ic ":$WITH_RADIUS:") -eq 1 ]; then
88 WITH_RADIUS=yes
89else
90 WITH_RADIUS=no
91fi
92
Test Userba1e7e72019-07-10 22:27:54 +000093# Verify JUST_K8S settting and convert uniform value of yes or no
94if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$JUST_K8S:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -070095 >&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 +000096 exit 1
97fi
98if [ $(echo ":y:yes:true:1:" | grep -ic ":$JUST_K8S:") -eq 1 ]; then
99 JUST_K8S=yes
100else
101 JUST_K8S=no
102fi
103
104# Verify DEPLOY_K8S settting and convert uniform value of yes or no
105if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$DEPLOY_K8S:") -eq 0 ]; then
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700106 >&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 +0000107 exit 1
108fi
109if [ $(echo ":y:yes:true:1:" | grep -ic ":$DEPLOY_K8S:") -eq 1 ]; then
110 DEPLOY_K8S=yes
111else
112 DEPLOY_K8S=no
113fi
Test User01ed0642019-07-03 20:17:06 +0000114
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700115# Verify INSTALL_KUBECTL settting and convert uniform value of yes or no
116if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_KUBECTL:") -eq 0 ]; then
117 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_KUBECTL value of '$INSTALL_KUBECTL'. Should be 'yes' or 'no'${NORMAL}"
118 exit 1
119fi
120
121if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_KUBECTL:") -eq 1 ]; then
122 INSTALL_KUBECTL=yes
123else
124 INSTALL_KUBECTL=no
125fi
126
David Bainbridgee10f6d52019-07-25 00:28:13 +0000127# Verify SKIP_RESTART_API settting and convert uniform value of yes or no
128if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$SKIP_RESTART_API:") -eq 0 ]; then
129 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$SKIP_RESTART_API value of '$SKIP_RESTART_API'. Should be 'yes' or 'no'${NORMAL}"
130 exit 1
131fi
132if [ $(echo ":y:yes:true:1:" | grep -ic ":$SKIP_RESTART_API:") -eq 1 ]; then
133 SKIP_RESTART_API=yes
134else
135 SKIP_RESTART_API=no
136fi
137
David Bainbridge1ceabc12019-07-25 17:21:05 +0000138# Verify USE_GO settting and convert uniform value of yes or no
139if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$USE_GO:") -eq 0 ]; then
140 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$USE_GO value of '$USE_GO'. Should be 'yes' or 'no'${NORMAL}"
141 exit 1
142fi
143if [ $(echo ":y:yes:true:1:" | grep -ic ":$USE_GO:") -eq 1 ]; then
144 USE_GO=true
145else
146 USE_GO=false
147fi
148
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700149# Verify INSTALL_HELM settting and convert uniform value of yes or no
150if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_HELM:") -eq 0 ]; then
151 >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_HELM value of '$INSTALL_HELM'. Should be 'yes' or 'no'${NORMAL}"
152 exit 1
153fi
154
155if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_HELM:") -eq 1 ]; then
156 INSTALL_HELM=yes
157else
158 INSTALL_HELM=no
159fi
160
Test User01ed0642019-07-03 20:17:06 +0000161if [ "$TYPE" == "full" ]; then
162 ONOS_API_PORT=${ONOS_API_PORT:-8182}
163 ONOS_SSH_PORT=${ONOS_SSH_PORT:-8102}
164 VOLTHA_API_PORT=${VOLTHA_API_PORT:-55556}
165 VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5023}
166else
167 ONOS_API_PORT=${ONOS_API_PORT:-8181}
168 ONOS_SSH_PORT=${ONOS_SSH_PORT:-8101}
169 VOLTHA_API_PORT=${VOLTHA_API_PORT:-55555}
170 VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5022}
171fi
172
173if [ "$1" == "get" -a "$2" == "voltconfig" ]; then
174 echo "$HOME/.volt/config-$TYPE"
175 exit
176fi
Test User3d7ad8e2019-07-03 06:15:44 +0000177
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700178if [ $# -ne 1 -o $(echo ":up:down:" | grep -c ":$1:") -ne 1 ]; then
179 >&2 echo "up or down?"
180 exit 1
181fi
182
183if [ "$1" == "down" ]; then
Test Userba1e7e72019-07-10 22:27:54 +0000184 if [ $DEPLOY_K8S == "yes" ]; then
185 if [ -x ./bin/kind ]; then
186 exec ./bin/kind delete cluster --name voltha-$TYPE
187 else
188 >&2 echo "Kind doesn't seem to be installed, so nothing to do. Bye."
189 fi
Test User08ebbd92019-07-03 17:15:39 +0000190 else
Test Userba1e7e72019-07-10 22:27:54 +0000191 EXISTS=$(helm list -q)
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000192 EXPECT="etcd-operator onos open-olt open-onu sim voltha bbsim radius"
Test Userba1e7e72019-07-10 22:27:54 +0000193 INTERSECT=
194 for i in $EXISTS; do
195 if [ $(echo $EXPECT | grep -c $i) -eq 1 ]; then
196 HAVE="$HAVE $i"
197 fi
198 done
David Bainbridge7831a662019-07-25 18:12:25 +0000199 if [ "$HAVE X" != " X" ]; then
200 ./bin/helm delete --purge $HAVE
201 fi
Test Userba1e7e72019-07-10 22:27:54 +0000202fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700203 exit
204fi
205
Test User01ed0642019-07-03 20:17:06 +0000206LOG="install-$TYPE.log"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700207date > $LOG
208
David Bainbridge1ceabc12019-07-25 17:21:05 +0000209# Output install options to log
210echo "OPTIONS" >> $LOG
211echo " TYPE = $TYPE" >> $LOG
212echo " WITH_BBSIM = $WITH_BBSIM" >> $LOG
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000213echo " WITH_RADIUS = $WITH_RADIUS" >> $LOG
David Bainbridge1ceabc12019-07-25 17:21:05 +0000214echo " JUST_K8S = $JUST_K8S" >> $LOG
215echo " DEPLOY_K8S = $DEPLOY_K8S" >> $LOG
216echo " SKIP_RESTART_API = $SKIP_RESTART_API" >> $LOG
217echo " INSTALL_KUBECTL = $INSTALL_KUBECTL" >> $LOG
218echo " INSTALL_HELM = $INSTALL_HELM" >> $LOG
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000219echo " USE_GO = $(echo $USE_GO | test $(grep -c true) -eq 1 && echo yes || echo no)" >> $LOG
220echo " VOLTHA_LOG_LEVEL = $VOLTHA_LOG_LEVEL" >> $LOG
David Bainbridge1ceabc12019-07-25 17:21:05 +0000221echo " VOLTHA_CHART = $VOLTHA_CHART" >> $LOG
222echo " VOLTHA_ADAPTER_SIM_CHART = $VOLTHA_ADAPTER_SIM_CHART" >> $LOG
223echo " VOLTHA_ADAPTER_OPEN_OLT_CHART = $VOLTHA_ADAPTER_OPEN_OLT_CHART" >> $LOG
224echo " VOLTHA_ADAPTER_OPEN_ONU_CHART = $VOLTHA_ADAPTER_OPEN_ONU_CHART" >> $LOG
David Bainbridge1ceabc12019-07-25 17:21:05 +0000225
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700226spin() {
Test Userd87942b2019-07-03 07:20:24 +0000227 PARTS="\
228 \xe2\xa2\x8e\xe2\xa1\xb0 \
229 \xe2\xa2\x8e\xe2\xa1\xa1 \
230 \xe2\xa2\x8e\xe2\xa1\x91 \
231 \xe2\xa2\x8e\xe2\xa0\xb1 \
232 \xe2\xa0\x8e\xe2\xa1\xb1 \
233 \xe2\xa2\x8a\xe2\xa1\xb1 \
234 \xe2\xa2\x8c\xe2\xa1\xb1 \
235 \xe2\xa2\x86\xe2\xa1\xb1 \
236 "
237 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700238 tput civis
239 while true; do
Test Userd87942b2019-07-03 07:20:24 +0000240 C=$(echo $PARTS | cut '-d ' -f $IDX)
241 echo -en "$C"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700242 IDX=$(expr $IDX + 1)
Test Userd87942b2019-07-03 07:20:24 +0000243 if [ $IDX -gt 8 ]; then
244 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700245 fi
246 sleep .15
247 echo -en "\r"
248 done
249}
250
Test Userd87942b2019-07-03 07:20:24 +0000251SPIN_PARTS="\
252 \xe2\xa2\x8e\xe2\xa1\xb0 \
253 \xe2\xa2\x8e\xe2\xa1\xa1 \
254 \xe2\xa2\x8e\xe2\xa1\x91 \
255 \xe2\xa2\x8e\xe2\xa0\xb1 \
256 \xe2\xa0\x8e\xe2\xa1\xb1 \
257 \xe2\xa2\x8a\xe2\xa1\xb1 \
258 \xe2\xa2\x8c\xe2\xa1\xb1 \
259 \xe2\xa2\x86\xe2\xa1\xb1 \
260 "
261IDX=1
262NOT_VERIFIED="\xe2\x9c\x97\x20"
263VERIFIED="\xe2\x9c\x93\x20"
Test Userb5712372019-07-03 21:52:17 +0000264HELM="\xE2\x8E\x88"
265OLD_KEY="\xF0\x9F\x97\x9D"
266BIRD="\xF0\x9F\x90\xA6"
267HIGH_VOLTAGE="\xE2\x9A\xA1"
268PLUG="\xF0\x9F\xa7\xa9"
269RESTART="\xf0\x9f\x94\x84"
270FORWARD="\xE2\x87\xA8"
271INSTALL="\xF0\x9F\x8F\x97"
272STOP="\xf0\x9f\x9b\x91"
273GO="\xf0\x9f\x9a\x80"
274DOWNLOAD="\xf0\x9f\x93\xa5"
275GEAR="\xe2\x9a\x99"
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700276NO_ENTRY="\xe2\x9b\x94"
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000277LOCK="\xf0\x9f\x94\x92"
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700278
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700279bspin() {
280 tput civis
Test Userd87942b2019-07-03 07:20:24 +0000281 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700282 local INDENT=
283 if [ "$1" == "-" ]; then
284 INDENT=" "
285 shift
286 fi
Test Userd87942b2019-07-03 07:20:24 +0000287 echo -en "$INDENT $*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700288}
289
290sspin() {
291 local INDENT=
292 if [ "$1" == "-" ]; then
293 INDENT=" "
294 shift
295 fi
Test Userd87942b2019-07-03 07:20:24 +0000296 C=$(echo $SPIN_PARTS | cut '-d ' -f $IDX)
297 echo -en "\r$INDENT$C $*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700298 IDX=$(expr $IDX + 1)
Test Userd87942b2019-07-03 07:20:24 +0000299 if [ $IDX -gt 8 ]; then
300 IDX=1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700301 fi
302}
303
304espin() {
305 local INDENT=
306 if [ "$1" == "-" ]; then
307 INDENT=" "
308 shift
309 fi
310 echo -e "\r$INDENT$*"
311 tput cnorm
312}
313
314count_pods() {
315 local NAMESPACE=$1; shift
316 local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}")
317 local COUNT=0
318 local PATTERNS=$*
319 for POD in $PODS; do
320 local NAME=$(echo $POD | cut -d/ -f 1)
321 local STATE=$(echo $POD | cut -d/ -f 2)
322 local CONTAINERS=$(echo $POD | cut -d/ -f 3 | sed -e 's/_/ /g')
323 if [ "$STATE" == "Running" ]; then
324 local TOTAL=$(echo $CONTAINERS | wc -w)
325 local FOUND=$(echo $CONTAINERS | grep -o true | wc -l)
326 if [ $TOTAL -eq $FOUND ]; then
327 for PATTERN in $PATTERNS; do
328 if [[ $NAME =~ $PATTERN ]]; then
329 COUNT=$(expr $COUNT + 1)
330 fi
331 done
332 fi
333 fi
334 done
335 echo $COUNT
336}
337
338wait_for_pods() {
339 local INDENT=
340 if [ "$1" == "-" ]; then
341 INDENT=$1; shift
342 fi
343 local NAMESPACE=$1; shift
344 local EXPECT=$1; shift
345 local RETRY=$1; shift
346 local MESSAGE=$1; shift
347 local PATTERNS=$*
348 local HAVE=$(count_pods $NAMESPACE $PATTERNS)
349 COUNT=$(expr 300 / 15)
350 bspin $INDENT $MESSAGE
351 sspin $INDENT
352 if [ $HAVE -ne $EXPECT ]; then
353 while [ $HAVE -ne $EXPECT ]; do
354 sspin $INDENT
355 COUNT=$(expr $COUNT - 1)
356 if [ $COUNT -eq 0 ]; then
357 HAVE=$(count_pods $NAMESPACE $PATTERNS)
358 COUNT=$(expr 300 / 15)
359 fi
360 sleep .15
361 done
362 fi
363 espin $INDENT $VERIFIED
364 if [ $HAVE -ne $EXPECT ]; then
365 return 1
366 fi
367 return 0
368}
369
370helm_install() {
371 local INDENT=
372 if [ "$1" == "-" ]; then
373 INDENT=$1; shift
374 fi
375 local NAMESPACE=$1; shift
376 local NAME=$1; shift
377 local CHART=$1; shift
378 local MESSAGE=$*
379
380 COUNT=$(expr 300 / 15)
381 bspin $INDENT $MESSAGE
David Bainbridge1ceabc12019-07-25 17:21:05 +0000382 (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 -0700383 SUCCESS=$?
384 while [ $SUCCESS -ne 0 ]; do
385 sspin $INDENT
386 COUNT=$(expr $COUNT - 1)
387 if [ $COUNT -eq 0 ]; then
David Bainbridgee10f6d52019-07-25 00:28:13 +0000388 (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 -0700389 COUNT=$(expr 300 / 15)
390 fi
391 sleep .15
392 done
393 espin $INDENT $VERIFIED
394}
395
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700396echo "INSTALL TYPE: $TYPE" >> $LOG
397
398bspin "Verify GOPATH"
399export GOPATH=$(pwd)
Test User3d7ad8e2019-07-03 06:15:44 +0000400mkdir -p $GOPATH/bin
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700401espin $VERIFIED
402
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700403if [ "$INSTALL_KUBECTL" == "no" ]; then
404 bspin "Skip kubectl install"
405 espin $NO_ENTRY
Test Userc13bdc92019-07-03 20:57:49 +0000406else
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700407 bspin "Verify kubectl $HELM"
408 if [ -x $GOPATH/bin/kubectl ]; then
409 espin $VERIFIED
410 else
411 espin $NOT_VERIFIED
412 bspin - "Download and install Kubernetes/kubectl $DOWNLOAD"
413 (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
414 (set -x; chmod 755 $GOPATH/bin/kubectl >>$LOG 2>&1) >>$LOG 2>&1
415 espin - $VERIFIED
416 fi
Test Userc13bdc92019-07-03 20:57:49 +0000417fi
418
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700419if [ "$DEPLOY_K8S" == "no" ]; then
420 bspin "Skip Kubernetes/Kind Deployment"
421 espin $NO_ENTRY
422else
Test Userba1e7e72019-07-10 22:27:54 +0000423 bspin "Verify Kubernetes/Kind $HELM"
424 if [ -x $GOPATH/bin/kind ]; then
425 espin $VERIFIED
426 else
427 espin $NOT_VERIFIED
428 bspin - "Download and install Kubernetes/kind $DOWNLOAD"
David Bainbridge9e2a6662019-07-11 17:07:57 +0000429 (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 +0000430 (set -x; chmod 755 $GOPATH/bin/kind >>$LOG 2>&1) >>$LOG 2>&1
431 espin - $VERIFIED
432 fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700433fi
434
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700435if [ "$INSTALL_HELM" == "no" ]; then
436 bspin "Skip Helm Install"
437 espin $NO_ENTRY
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700438else
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700439 bspin "Verify Helm $HELM"
440 if [ -x $GOPATH/bin/helm ]; then
441 espin $VERIFIED
442 else
443 espin $NOT_VERIFIED
444 bspin - "Download and install Helm $DOWNLOAD"
445 (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
446 espin - $VERIFIED
447 fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700448fi
449
Test Userb5712372019-07-03 21:52:17 +0000450bspin "Verify voltctl $HIGH_VOLTAGE"
Test User3d7ad8e2019-07-03 06:15:44 +0000451if [ -x $GOPATH/bin/voltctl ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700452 espin $VERIFIED
453else
454 espin $NOT_VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000455 bspin - "Download and build voltctl $DOWNLOAD"
Test Userba1e7e72019-07-10 22:27:54 +0000456 (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 +0000457 (set -x; chmod 755 $GOPATH/bin/voltctl >>$LOG 2>&1) >>$LOG 2>&1
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700458 espin - $VERIFIED
459fi
460
461bspin "Verify command PATH"
Test Userba1e7e72019-07-10 22:27:54 +0000462export PATH=$GOPATH/bin:$PATH
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700463espin $VERIFIED
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700464
Test Userba1e7e72019-07-10 22:27:54 +0000465if [ "$DEPLOY_K8S" == "yes" ]; then
466 HAVE=$(kind get clusters | grep -c voltha-$TYPE)
467 bspin "Verify Kubernetes/Kind Cluster"
468 sspin
469 if [ $HAVE -eq 0 ]; then
David Bainbridge491b1bd2019-07-11 17:53:11 +0000470 espin $NOT_VERIFIED
471 bspin - "Verify cluster configuration"
472 if [ ! -r ./$TYPE-cluster.cfg ]; then
473 espin - $NOT_VERIFIED
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700474 bspin - "Download cluster configuration: $TYPE-cluster.cfg $DOWNLOAD"
David Bainbridge491b1bd2019-07-11 17:53:11 +0000475 (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 -0700476 espin - $VERIFIED
477 else
478 espin - $VERIFIED
479 fi
David Bainbridge491b1bd2019-07-11 17:53:11 +0000480 kind create cluster --name voltha-$TYPE --config $TYPE-cluster.cfg
481 else
482 espin $VERIFIED
Test Userba1e7e72019-07-10 22:27:54 +0000483 fi
484
485 export KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$TYPE")"
486 P="coredns-.* \
487 etcd-voltha-$TYPE-control-plane \
488 kindnet-.* \
489 kube-apiserver-voltha-$TYPE-control-plane \
490 kube-controller-manager-voltha-$TYPE-control-plane \
491 kube-proxy-.* \
492 kube-scheduler-voltha-$TYPE-control-plane"
493
494 EXPECT=$(test "$TYPE" == "minimal" && echo "12" || echo "14")
495 wait_for_pods - "kube-system" $EXPECT -1 "Waiting for system PODs to start" $P
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700496fi
497
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700498COUNT=$(count_pods "kube-system" "tiller-deploy-.*")
499bspin "Verify Helm"
Test Userba1e7e72019-07-10 22:27:54 +0000500if [ $COUNT -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700501 espin $NOT_VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000502 echo -e "Configuring Helm $GEAR"
David K. Bainbridge0e89cb92019-07-17 11:30:10 -0700503 if [ "$INSTALL_HELM" == "no" ]; then
504 bspin - "Skip Helm/Tiller Initialization"
505 espin - $NO_ENTRY
506 else
507 bspin - "Initialize Helm"
508 (set -x; helm init --upgrade >>$LOG 2>&1) >>$LOG 2>&1
509 espin - $VERIFIED
510 wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*"
511 fi
Test Userb5712372019-07-03 21:52:17 +0000512 bspin - "Add Google Incubator repository to Helm"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700513 (set -x; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1
514 espin - $VERIFIED
Test Userba1e7e72019-07-10 22:27:54 +0000515
516 # HACK (sort-of) - the config for tiller is about to be patched, which will
517 # cause the tiller pod to be recreated. This can sometimes cause a timing
518 # issue with the "wait_for_pods" call on tiller as it may incorrectly
519 # identify the running/ready tiller pod that is soon to be terminated as
520 # what it is waiting for. To avoid this issue we do a clean scale down and
521 # scale up of the pod so the script controlls when it should be expecting
522 # things
523 (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 -0700524
Test Userb5712372019-07-03 21:52:17 +0000525 bspin - "Add Google Stable repository to Helm"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700526 (set -x; helm repo add stable https://kubernetes-charts.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1
527 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000528 bspin - "Add ONF repository to Helm"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700529 (set -x; helm repo add onf https://charts.opencord.org >>$LOG 2>&1) >>$LOG 2>&1
530 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000531 bspin - "Update Helm repository cache"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700532 (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1
533 espin - $VERIFIED
534
535 # Create and k8s service account so that Helm can create pods
Test Userb5712372019-07-03 21:52:17 +0000536 bspin - "Create Tiller ServiceAccount"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700537 (set -x; kubectl create serviceaccount --namespace kube-system tiller >>$LOG 2>&1) >>$LOG 2>&1
538 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000539 bspin - "Create Tiller ClusterRoleBinding"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700540 (set -x; kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller >>$LOG 2>&1) >>$LOG 2>&1
541 espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000542 bspin - "Update Tiller Manifest"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700543 (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 +0000544
545 # HACK (sort-of) - part to, spin it back up
546 (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 -0700547 espin - $VERIFIED
548else
549 espin $VERIFIED
550fi
Test Userb5712372019-07-03 21:52:17 +0000551wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start" "tiller-deploy-.*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700552
Test Userba1e7e72019-07-10 22:27:54 +0000553bspin "Verify Helm values file: $TYPE-values.yaml"
554if [ ! -r "./$TYPE-values.yaml" ]; then
555 espin $NOT_VERIFIED
556 bspin - "Download Helm values file: $TYPE-values.yaml $DOWNLOAD"
557 (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
558 espin - $VERIFIED
559else
560 espin $VERIFIED
561fi
562
563if [ "$JUST_K8S" == "yes" ]; then
564 echo "Environment deployed, not deploying VOLTHA artifacts as requested. Good bye."
565 echo ""
566 echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG
567 echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG
568 echo "tools required by VOLTHA in your command path. " | tee -a $LOG
569 echo "" | tee -a $LOG
570 echo -en $BOLD
571 if [ $DEPLOY_K8S == "yes" ]; then
572 echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG
573 fi
574 echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG
575 echo -en $NORMAL
576 echo "" | tee -a $LOG
577 echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG
578 exit 0
579fi
580
Test Userb5712372019-07-03 21:52:17 +0000581bspin "Verify ETCD Operator $OLD_KEY"
Test User7d866122019-07-09 17:52:35 +0000582if [ $(helm list --deployed --short --namespace voltha "^etcd-operator\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700583 espin $NOT_VERIFIED
584 helm_install - voltha etcd-operator stable/etcd-operator "Install ETCD Operator"
585else
586 espin $VERIFIED
587fi
Test User01ed0642019-07-03 20:17:06 +0000588EXPECT=$(test "$TYPE" == "minimal" && echo "1" || echo "3")
Test Userb5712372019-07-03 21:52:17 +0000589wait_for_pods - "voltha" $EXPECT -1 "Waiting for ETCD Operator to start" "etcd-operator-.*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700590
Test Userb5712372019-07-03 21:52:17 +0000591bspin "Verify ONOS installed $BIRD"
Test User7d866122019-07-09 17:52:35 +0000592if [ $(helm list --deployed --short --namespace default "^onos\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700593 espin $NOT_VERIFIED
594 helm_install - default onos onf/onos "Install ONOS"
595else
596 espin $VERIFIED
597fi
Test Userb5712372019-07-03 21:52:17 +0000598wait_for_pods - "default" 1 -1 "Waiting for ONOS to start" "onos-.*"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700599
Test Userb5712372019-07-03 21:52:17 +0000600bspin - "Forward ONOS API port $FORWARD"
Test User01ed0642019-07-03 20:17:06 +0000601(set -x; screen -p 0 -X -S onos-ui-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
602(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. Bainbridgeb7285432019-07-02 22:05:24 -0700603espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000604bspin - "Forward ONOS SSH port $FORWARD"
Test User01ed0642019-07-03 20:17:06 +0000605(set -x; screen -p 0 -X -S onos-ssh-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
606(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. Bainbridgeb7285432019-07-02 22:05:24 -0700607espin - $VERIFIED
Test Userba1e7e72019-07-10 22:27:54 +0000608if [ ! -x ./onos-files/install-onos-applications.sh ]; then
609 bspin - "Verify or download ONOS configuration support files $DOWNLOAD"
610 (set -x; mkdir -p ./onos-files >>$LOG 2>&1) >>$LOG 2>&1
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000611 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
Test Userba1e7e72019-07-10 22:27:54 +0000612 if [ ! -r ./onos-files/$i ]; then
613 (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
614 fi
615 done
616 (set -x; chmod 755 ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1
617 espin - $VERIFIED
618fi
619
Test Userb5712372019-07-03 21:52:17 +0000620bspin - "Install required ONOS applications $INSTALL"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700621(set -x; ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1
622espin - $VERIFIED
623
Test Userb5712372019-07-03 21:52:17 +0000624bspin "Verify VOLTHA installed $HIGH_VOLTAGE"
Test User7d866122019-07-09 17:52:35 +0000625if [ $(helm list --deployed --short --namespace voltha "^voltha\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700626 espin $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000627 helm_install - voltha voltha $VOLTHA_CHART "Install VOLTHA Core"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700628else
629 espin $VERIFIED
630fi
Test Userba1e7e72019-07-10 22:27:54 +0000631
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700632VOLTHA="ofagent-.* \
633 ro-core.* \
634 rw-core.* \
635 voltha-api-server-.* \
636 voltha-cli-server-.* \
637 voltha-etcd-cluster-.* \
638 voltha-kafka-.* \
639 voltha-zookeeper-.*"
Test User01ed0642019-07-03 20:17:06 +0000640EXPECT=$(test "$TYPE" == "minimal" && echo "9" || echo "11")
Test Userb5712372019-07-03 21:52:17 +0000641wait_for_pods - "voltha" $EXPECT -1 "Waiting for VOLTHA Core to start" $VOLTHA
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700642
Test Userb5712372019-07-03 21:52:17 +0000643echo -e "Verify Adapters $PLUG"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700644bspin - "Verify Simulated Adapters installed"
Test User7d866122019-07-09 17:52:35 +0000645if [ $(helm list --deployed --short --namespace voltha "^sim\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700646 espin - $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000647 helm_install - voltha sim $VOLTHA_ADAPTER_SIM_CHART "Install Simulated Adapters"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700648else
649 espin - $VERIFIED
650fi
651
652bspin - "Verify OpenOLT Adapter installed"
Test User7d866122019-07-09 17:52:35 +0000653if [ $(helm list --deployed --short --namespace voltha "^open-olt\$" | wc -l) -ne 1 ]; then
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700654 espin - $NOT_VERIFIED
David Bainbridgee10f6d52019-07-25 00:28:13 +0000655 helm_install - voltha open-olt $VOLTHA_ADAPTER_OPEN_OLT_CHART "Install OpenOLT Adapter"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700656else
657 espin - $VERIFIED
658fi
659bspin - "Verify OpenONU Adapter installed"
Test User7d866122019-07-09 17:52:35 +0000660if [ $(helm list --deployed --short --namespace voltha "^open-onu\$" | 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 open-onu $VOLTHA_ADAPTER_OPEN_ONU_CHART "Install OpenONU Adapter"
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700663else
664 espin - $VERIFIED
665fi
666
667ADAPTERS="adapter-.*"
Test Userb5712372019-07-03 21:52:17 +0000668wait_for_pods - "voltha" 4 -1 "Waiting for adapters to start" $ADAPTERS
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700669
Test User7d866122019-07-09 17:52:35 +0000670if [ $WITH_BBSIM == "yes" ]; then
671 echo -e "Verify BBSIM $PLUG"
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000672 bspin - "Verify BBSIM Installed"
Test User7d866122019-07-09 17:52:35 +0000673 if [ $(helm list --deployed --short --namespace voltha "^bbsim\$" | wc -l) -ne 1 ]; then
674 espin - $NOT_VERIFIED
675 helm_install - voltha bbsim onf/bbsim "Install BBSIM"
676 else
677 espin - $VERIFIED
678 fi
679 wait_for_pods - "voltha" 1 -1 "Waiting for BBSIM to start" "bbsim-.*"
680fi
681
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000682if [ $WITH_RADIUS == "yes" ]; then
683 echo -e "Verify RADIUS $LOCK"
684 bspin - "Verify RADIUS Installed"
685 if [ $(helm list --deployed --short --namespace voltha "^radius\$" | wc -l) -ne 1 ]; then
686 espin - $NOT_VERIFIED
687 helm_install - voltha radius onf/freeradius "Install RADIUS"
688 else
689 espin - $VERIFIED
690 fi
691 wait_for_pods - "voltha" 1 -1 "Waiting for RADIUS to start" "radius-.*"
692fi
693
David Bainbridgee10f6d52019-07-25 00:28:13 +0000694if [ $SKIP_RESTART_API == "no" ]; then
695 echo -e "Restart VOLTHA API $RESTART"
696 API="voltha-api-server-.* ofagent-.*"
697 (set -x; kubectl scale --replicas=0 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1
698 wait_for_pods - "voltha" 0 -1 "Wait for API to stop $STOP" $API
699 (set -x; kubectl scale --replicas=1 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1
700 wait_for_pods - "voltha" 2 -1 "Wait for API to re-start $GO" $API
701else
702 bspin "Skip VOLTHA API Restart"
703 espin $NO_ENTRY
704fi
David K. Bainbridgeb7285432019-07-02 22:05:24 -0700705
Test Userb5712372019-07-03 21:52:17 +0000706bspin - "Forward VOLTHA API port $FORWARD"
Test User01ed0642019-07-03 20:17:06 +0000707(set -x; screen -p 0 -X -S voltha-api-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
708(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 -0700709espin - $VERIFIED
Test Userb5712372019-07-03 21:52:17 +0000710bspin - "Forward VOLTHA SSH port $FORWARD"
Test User01ed0642019-07-03 20:17:06 +0000711(set -x; screen -p 0 -X -S voltha-ssh-$TYPE stuff $'\003' 2>/dev/null >/dev/null >>$LOG 2>&1) >>$LOG 2>&1
712(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 -0700713espin - $VERIFIED
Test User3d7ad8e2019-07-03 06:15:44 +0000714
David Bainbridge5b7b96b2019-07-25 20:29:13 +0000715if [ $WITH_RADIUS == "yes" ]; then
716 bspin "Configure ONOS RADIUS Connection $GEAR"
717 (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
718 espin $VERIFIED
719fi
720
721bspin "Create voltctl configuration file"
Test User3d7ad8e2019-07-03 06:15:44 +0000722(set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1
Test User01ed0642019-07-03 20:17:06 +0000723(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 +0000724espin $VERIFIED
Test User08ebbd92019-07-03 17:15:39 +0000725
Test User7d866122019-07-09 17:52:35 +0000726echo ""
Test User08ebbd92019-07-03 17:15:39 +0000727echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG
728echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG
729echo "tools required by VOLTHA in your command path. " | tee -a $LOG
730echo "" | tee -a $LOG
Test User7d866122019-07-09 17:52:35 +0000731echo -en $BOLD
Test Userba1e7e72019-07-10 22:27:54 +0000732if [ $DEPLOY_K8S == "yes" ]; then
733 echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG
734fi
Test Userfa30f7f2019-07-03 20:35:19 +0000735echo "export VOLTCONFIG=\"$HOME/.volt/config-$TYPE\"" | tee -a $LOG
Test Userba1e7e72019-07-10 22:27:54 +0000736echo "export PATH=$GOPATH/bin:\$PATH" | tee -a $LOG
Test User7d866122019-07-09 17:52:35 +0000737echo -en $NORMAL
Test User08ebbd92019-07-03 17:15:39 +0000738echo "" | tee -a $LOG
739echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG
740