David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 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 | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 31 | TYPE=${TYPE:-minimal} |
| 32 | # Only minimal cluster works in this script currently |
| 33 | TYPE=minimal |
| 34 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 35 | if [ $# -ne 1 -o $(echo ":up:down:" | grep -c ":$1:") -ne 1 ]; then |
| 36 | >&2 echo "up or down?" |
| 37 | exit 1 |
| 38 | fi |
| 39 | |
| 40 | if [ "$1" == "down" ]; then |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame^] | 41 | if [ -x ./bin/kind ]; then |
| 42 | exec ./bin/kind delete cluster --name voltha-$TYPE |
| 43 | else |
| 44 | >&2 echo "Kind doesn't seem to be installed, so nothing to do. Bye." |
| 45 | fi |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 46 | exit |
| 47 | fi |
| 48 | |
| 49 | LOG="install.log" |
| 50 | date > $LOG |
| 51 | |
| 52 | spin() { |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 53 | PARTS="\ |
| 54 | \xe2\xa2\x8e\xe2\xa1\xb0 \ |
| 55 | \xe2\xa2\x8e\xe2\xa1\xa1 \ |
| 56 | \xe2\xa2\x8e\xe2\xa1\x91 \ |
| 57 | \xe2\xa2\x8e\xe2\xa0\xb1 \ |
| 58 | \xe2\xa0\x8e\xe2\xa1\xb1 \ |
| 59 | \xe2\xa2\x8a\xe2\xa1\xb1 \ |
| 60 | \xe2\xa2\x8c\xe2\xa1\xb1 \ |
| 61 | \xe2\xa2\x86\xe2\xa1\xb1 \ |
| 62 | " |
| 63 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 64 | tput civis |
| 65 | while true; do |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 66 | C=$(echo $PARTS | cut '-d ' -f $IDX) |
| 67 | echo -en "$C" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 68 | IDX=$(expr $IDX + 1) |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 69 | if [ $IDX -gt 8 ]; then |
| 70 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 71 | fi |
| 72 | sleep .15 |
| 73 | echo -en "\r" |
| 74 | done |
| 75 | } |
| 76 | |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 77 | SPIN_PARTS="\ |
| 78 | \xe2\xa2\x8e\xe2\xa1\xb0 \ |
| 79 | \xe2\xa2\x8e\xe2\xa1\xa1 \ |
| 80 | \xe2\xa2\x8e\xe2\xa1\x91 \ |
| 81 | \xe2\xa2\x8e\xe2\xa0\xb1 \ |
| 82 | \xe2\xa0\x8e\xe2\xa1\xb1 \ |
| 83 | \xe2\xa2\x8a\xe2\xa1\xb1 \ |
| 84 | \xe2\xa2\x8c\xe2\xa1\xb1 \ |
| 85 | \xe2\xa2\x86\xe2\xa1\xb1 \ |
| 86 | " |
| 87 | IDX=1 |
| 88 | NOT_VERIFIED="\xe2\x9c\x97\x20" |
| 89 | VERIFIED="\xe2\x9c\x93\x20" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 90 | bspin() { |
| 91 | tput civis |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 92 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 93 | local INDENT= |
| 94 | if [ "$1" == "-" ]; then |
| 95 | INDENT=" " |
| 96 | shift |
| 97 | fi |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 98 | echo -en "$INDENT $*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | sspin() { |
| 102 | local INDENT= |
| 103 | if [ "$1" == "-" ]; then |
| 104 | INDENT=" " |
| 105 | shift |
| 106 | fi |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 107 | C=$(echo $SPIN_PARTS | cut '-d ' -f $IDX) |
| 108 | echo -en "\r$INDENT$C $*" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 109 | IDX=$(expr $IDX + 1) |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 110 | if [ $IDX -gt 8 ]; then |
| 111 | IDX=1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 112 | fi |
| 113 | } |
| 114 | |
| 115 | espin() { |
| 116 | local INDENT= |
| 117 | if [ "$1" == "-" ]; then |
| 118 | INDENT=" " |
| 119 | shift |
| 120 | fi |
| 121 | echo -e "\r$INDENT$*" |
| 122 | tput cnorm |
| 123 | } |
| 124 | |
| 125 | count_pods() { |
| 126 | local NAMESPACE=$1; shift |
| 127 | local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}") |
| 128 | local COUNT=0 |
| 129 | local PATTERNS=$* |
| 130 | for POD in $PODS; do |
| 131 | local NAME=$(echo $POD | cut -d/ -f 1) |
| 132 | local STATE=$(echo $POD | cut -d/ -f 2) |
| 133 | local CONTAINERS=$(echo $POD | cut -d/ -f 3 | sed -e 's/_/ /g') |
| 134 | if [ "$STATE" == "Running" ]; then |
| 135 | local TOTAL=$(echo $CONTAINERS | wc -w) |
| 136 | local FOUND=$(echo $CONTAINERS | grep -o true | wc -l) |
| 137 | if [ $TOTAL -eq $FOUND ]; then |
| 138 | for PATTERN in $PATTERNS; do |
| 139 | if [[ $NAME =~ $PATTERN ]]; then |
| 140 | COUNT=$(expr $COUNT + 1) |
| 141 | fi |
| 142 | done |
| 143 | fi |
| 144 | fi |
| 145 | done |
| 146 | echo $COUNT |
| 147 | } |
| 148 | |
| 149 | wait_for_pods() { |
| 150 | local INDENT= |
| 151 | if [ "$1" == "-" ]; then |
| 152 | INDENT=$1; shift |
| 153 | fi |
| 154 | local NAMESPACE=$1; shift |
| 155 | local EXPECT=$1; shift |
| 156 | local RETRY=$1; shift |
| 157 | local MESSAGE=$1; shift |
| 158 | local PATTERNS=$* |
| 159 | local HAVE=$(count_pods $NAMESPACE $PATTERNS) |
| 160 | COUNT=$(expr 300 / 15) |
| 161 | bspin $INDENT $MESSAGE |
| 162 | sspin $INDENT |
| 163 | if [ $HAVE -ne $EXPECT ]; then |
| 164 | while [ $HAVE -ne $EXPECT ]; do |
| 165 | sspin $INDENT |
| 166 | COUNT=$(expr $COUNT - 1) |
| 167 | if [ $COUNT -eq 0 ]; then |
| 168 | HAVE=$(count_pods $NAMESPACE $PATTERNS) |
| 169 | COUNT=$(expr 300 / 15) |
| 170 | fi |
| 171 | sleep .15 |
| 172 | done |
| 173 | fi |
| 174 | espin $INDENT $VERIFIED |
| 175 | if [ $HAVE -ne $EXPECT ]; then |
| 176 | return 1 |
| 177 | fi |
| 178 | return 0 |
| 179 | } |
| 180 | |
| 181 | helm_install() { |
| 182 | local INDENT= |
| 183 | if [ "$1" == "-" ]; then |
| 184 | INDENT=$1; shift |
| 185 | fi |
| 186 | local NAMESPACE=$1; shift |
| 187 | local NAME=$1; shift |
| 188 | local CHART=$1; shift |
| 189 | local MESSAGE=$* |
| 190 | |
| 191 | COUNT=$(expr 300 / 15) |
| 192 | bspin $INDENT $MESSAGE |
| 193 | (set -x; helm install -f $TYPE-values.yaml --namespace $NAMESPACE --name $NAME $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
| 194 | SUCCESS=$? |
| 195 | while [ $SUCCESS -ne 0 ]; do |
| 196 | sspin $INDENT |
| 197 | COUNT=$(expr $COUNT - 1) |
| 198 | if [ $COUNT -eq 0 ]; then |
| 199 | (set -x; helm install -f $TYPE-values.yaml --namespace $NAMESPACE --name $NAME $CHART >>$LOG 2>&1) >>$LOG 2>&1 |
| 200 | COUNT=$(expr 300 / 15) |
| 201 | fi |
| 202 | sleep .15 |
| 203 | done |
| 204 | espin $INDENT $VERIFIED |
| 205 | } |
| 206 | |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 207 | echo "INSTALL TYPE: $TYPE" >> $LOG |
| 208 | |
| 209 | bspin "Verify GOPATH" |
| 210 | export GOPATH=$(pwd) |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 211 | mkdir -p $GOPATH/bin |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 212 | espin $VERIFIED |
| 213 | |
| 214 | bspin "Verify Kubernetes/Kind" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 215 | if [ -x $GOPATH/bin/kind ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 216 | espin $VERIFIED |
| 217 | else |
| 218 | espin $NOT_VERIFIED |
| 219 | bspin - "Download and build Kubernetes/Kind" |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame^] | 220 | (set -x; curl -o $GOPATH/bin/kind -sSL https://github.com/kubernetes-sigs/kind/releases/download/$KIND_VERSION/kind-$(go env GOHOSTOS)-$(go env GOARCH) >>$LOG 2>&1) >>$LOG 2>&1 |
Test User | 7c2be41 | 2019-07-03 06:20:30 +0000 | [diff] [blame] | 221 | (set -x; chmod 755 $GOPATH/bin/kind >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 222 | espin - $VERIFIED |
| 223 | fi |
| 224 | |
| 225 | bspin "Verify Helm" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 226 | if [ -x $GOPATH/bin/helm ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 227 | espin $VERIFIED |
| 228 | else |
| 229 | espin $NOT_VERIFIED |
| 230 | bspin - "Download and install Helm" |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame^] | 231 | (set -x; curl -sSL https://git.io/get_helm.sh | USE_SUDO=false HELM_INSTALL_DIR=$(go env GOPATH)/bin bash >>$LOG 2>&1) >>$LOG 2>&1 |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 232 | espin - $VERIFIED |
| 233 | fi |
| 234 | |
| 235 | bspin "Verify voltctl" |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 236 | if [ -x $GOPATH/bin/voltctl ]; then |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 237 | espin $VERIFIED |
| 238 | else |
| 239 | espin $NOT_VERIFIED |
| 240 | bspin - "Download and build voltctl" |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame^] | 241 | (set -x; curl -o $GOPATH/bin/voltctl -sSL https://github.com/ciena/voltctl/releases/download/$VOLTCTL_VERSION/voltctl-$_VOLTCTL_VERSION-$(go env GOHOSTOS)-$(go env GOARCH) >>$LOG 2>&1) >>$LOG 2>&1 |
| 242 | (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] | 243 | espin - $VERIFIED |
| 244 | fi |
| 245 | |
| 246 | bspin "Verify command PATH" |
| 247 | export PATH=$(go env GOPATH)/bin:$PATH |
| 248 | espin $VERIFIED |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 249 | |
| 250 | HAVE=$(kind get clusters | grep -c voltha-$TYPE) |
| 251 | bspin "Verify Kubernetes/Kind Cluster" |
| 252 | sspin |
| 253 | if [ $HAVE -eq 0 ]; then |
| 254 | espin $NOT_VERIFIED |
| 255 | kind create cluster --name voltha-$TYPE --config $TYPE-cluster.cfg |
| 256 | else |
| 257 | espin $VERIFIED |
| 258 | fi |
| 259 | |
| 260 | export KUBECONFIG="$(kind get kubeconfig-path --name="voltha-$TYPE")" |
| 261 | P="coredns-.* \ |
| 262 | etcd-voltha-$TYPE-control-plane \ |
| 263 | kindnet-.* \ |
| 264 | kube-apiserver-voltha-$TYPE-control-plane \ |
| 265 | kube-controller-manager-voltha-$TYPE-control-plane \ |
| 266 | kube-proxy-.* \ |
| 267 | kube-scheduler-voltha-$TYPE-control-plane" |
| 268 | |
| 269 | wait_for_pods - "kube-system" 12 -1 "Waiting for system PODs to start..." $P |
| 270 | |
| 271 | COUNT=$(count_pods "kube-system" "tiller-deploy-.*") |
| 272 | bspin "Verify Helm" |
| 273 | if [ $(count_pods "kube-system" "tiller-deploy-.*") -ne 1 ]; then |
| 274 | espin $NOT_VERIFIED |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 275 | echo "Configuring Helm ..." |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 276 | bspin - "Initialize Helm" |
| 277 | (set -x; helm init --upgrade >>$LOG 2>&1) >>$LOG 2>&1 |
| 278 | espin - $VERIFIED |
| 279 | bspin - "Add Google Incubator repository to Helm ..." |
| 280 | (set -x; helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 281 | espin - $VERIFIED |
| 282 | |
| 283 | bspin - "Add Google Stable repository to Helm ..." |
| 284 | (set -x; helm repo add stable https://kubernetes-charts.storage.googleapis.com >>$LOG 2>&1) >>$LOG 2>&1 |
| 285 | espin - $VERIFIED |
| 286 | bspin - "Add ONF repository to Helm ..." |
| 287 | (set -x; helm repo add onf https://charts.opencord.org >>$LOG 2>&1) >>$LOG 2>&1 |
| 288 | espin - $VERIFIED |
| 289 | bspin - "Update Helm repository cache ..." |
| 290 | (set -x; helm repo update >>$LOG 2>&1) >>$LOG 2>&1 |
| 291 | espin - $VERIFIED |
| 292 | |
| 293 | # Create and k8s service account so that Helm can create pods |
| 294 | bspin - "Create Tiller ServiceAccount ..." |
| 295 | (set -x; kubectl create serviceaccount --namespace kube-system tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 296 | espin - $VERIFIED |
| 297 | bspin - "Create Tiller ClusterRoleBinding ..." |
| 298 | (set -x; kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller >>$LOG 2>&1) >>$LOG 2>&1 |
| 299 | espin - $VERIFIED |
| 300 | bspin - "Update Tiller Manifest ..." |
| 301 | (set -x; kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}' >>$LOG 2>&1) >>$LOG 2>&1 |
| 302 | espin - $VERIFIED |
| 303 | else |
| 304 | espin $VERIFIED |
| 305 | fi |
| 306 | wait_for_pods - "kube-system" 1 -1 "Waiting for Tiller POD to start..." "tiller-deploy-.*" |
| 307 | |
| 308 | bspin "Verify ETCD Operator" |
| 309 | if [ $(helm list etcd-operator | grep -c DEPLOYED) -ne 1 ]; then |
| 310 | espin $NOT_VERIFIED |
| 311 | helm_install - voltha etcd-operator stable/etcd-operator "Install ETCD Operator" |
| 312 | else |
| 313 | espin $VERIFIED |
| 314 | fi |
| 315 | wait_for_pods - "voltha" 1 -1 "Waiting for ETCD Operator to start..." "etcd-operator-.*" |
| 316 | |
| 317 | bspin "Verify ONOS installed" |
| 318 | if [ $(helm list onos | grep -c DEPLOYED) -ne 1 ]; then |
| 319 | espin $NOT_VERIFIED |
| 320 | helm_install - default onos onf/onos "Install ONOS" |
| 321 | else |
| 322 | espin $VERIFIED |
| 323 | fi |
| 324 | wait_for_pods - "default" 1 -1 "Waiting for ONOS to start..." "onos-.*" |
| 325 | |
| 326 | bspin - "Forward ONOS API port" |
| 327 | (set -x; screen -p 0 -X -S onos-ui stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1 |
| 328 | (set -x; screen -dmS onos-ui kubectl port-forward service/onos-ui 8181:8181 >>$LOG 2>&1) >>$LOG 2>&1 |
| 329 | espin - $VERIFIED |
| 330 | bspin - "Forward ONOS SSH port" |
| 331 | (set -x; screen -p 0 -X -S onos-ssh stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1 |
| 332 | (set -x; screen -dmS onos-ssh kubectl port-forward service/onos-ssh 8101:8101 >>$LOG 2>&1) >>$LOG 2>&1 |
| 333 | espin - $VERIFIED |
| 334 | bspin - "Install required ONOS applications" |
| 335 | (set -x; ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1 |
| 336 | espin - $VERIFIED |
| 337 | |
| 338 | bspin "Verify VOLTHA installed" |
| 339 | if [ $(helm list voltha | grep -c DEPLOYED) -ne 1 ]; then |
| 340 | espin $NOT_VERIFIED |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 341 | helm_install - voltha voltha onf/voltha "Install VOLTHA Core" |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 342 | else |
| 343 | espin $VERIFIED |
| 344 | fi |
| 345 | VOLTHA="ofagent-.* \ |
| 346 | ro-core.* \ |
| 347 | rw-core.* \ |
| 348 | voltha-api-server-.* \ |
| 349 | voltha-cli-server-.* \ |
| 350 | voltha-etcd-cluster-.* \ |
| 351 | voltha-kafka-.* \ |
| 352 | voltha-zookeeper-.*" |
Test User | d87942b | 2019-07-03 07:20:24 +0000 | [diff] [blame] | 353 | wait_for_pods - "voltha" 9 -1 "Waiting for VOLTHA Core to start..." $VOLTHA |
David K. Bainbridge | b728543 | 2019-07-02 22:05:24 -0700 | [diff] [blame] | 354 | |
| 355 | echo "Verify Adapters" |
| 356 | bspin - "Verify Simulated Adapters installed" |
| 357 | if [ $(helm list sim | grep -c DEPLOYED) -ne 1 ]; then |
| 358 | espin - $NOT_VERIFIED |
| 359 | helm_install - voltha sim onf/voltha-adapter-simulated "Install Simulated Adapters" |
| 360 | else |
| 361 | espin - $VERIFIED |
| 362 | fi |
| 363 | |
| 364 | bspin - "Verify OpenOLT Adapter installed" |
| 365 | if [ $(helm list open-olt | grep -c DEPLOYED) -ne 1 ]; then |
| 366 | espin - $NOT_VERIFIED |
| 367 | helm_install - voltha open-olt onf/voltha-adapter-openolt "Install OpenOLT Adapter" |
| 368 | else |
| 369 | espin - $VERIFIED |
| 370 | fi |
| 371 | bspin - "Verify OpenONU Adapter installed" |
| 372 | if [ $(helm list open-onu | grep -c DEPLOYED) -ne 1 ]; then |
| 373 | espin - $NOT_VERIFIED |
| 374 | helm_install - voltha open-onu onf/voltha-adapter-openonu "Install OpenONU Adapter" |
| 375 | else |
| 376 | espin - $VERIFIED |
| 377 | fi |
| 378 | |
| 379 | ADAPTERS="adapter-.*" |
| 380 | wait_for_pods - "voltha" 4 -1 "Waiting for adapters to start..." $ADAPTERS |
| 381 | |
| 382 | echo "Restart VOLTHA API" |
| 383 | API="voltha-api-server-.* ofagent-.*" |
| 384 | (set -x; kubectl scale --replicas=0 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1 |
| 385 | wait_for_pods - "voltha" 0 -1 "Wait for API to stop" $API |
| 386 | (set -x; kubectl scale --replicas=1 deployment -n voltha voltha-api-server ofagent >>$LOG 2>&1) >>$LOG 2>&1 |
| 387 | wait_for_pods - "voltha" 2 -1 "Wait for API to re-start ..." $API |
| 388 | |
| 389 | bspin - "Forward VOLTHA API port" |
| 390 | (set -x; screen -p 0 -X -S voltha-api stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1 |
| 391 | (set -x; screen -dmS voltha-api kubectl port-forward -n voltha service/voltha-api 55555:55555 >>$LOG 2>&1) >>$LOG 2>&1 |
| 392 | espin - $VERIFIED |
| 393 | bspin - "Forward VOLTHA SSH port" |
| 394 | (set -x; screen -p 0 -X -S voltha-ssh stuff $'\003' 2>/dev/null >/dev/null >>$LOG 2>&1) >>$LOG 2>&1 |
| 395 | (set -x; screen -dmS voltha-ssh kubectl port-forward -n voltha service/voltha-cli 5022:5022 >>$LOG 2>&1) >>$LOG 2>&1 |
| 396 | espin - $VERIFIED |
Test User | 3d7ad8e | 2019-07-03 06:15:44 +0000 | [diff] [blame] | 397 | |
| 398 | bspin - "Create voltctl configuration file" |
| 399 | (set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1 |
| 400 | (set -x; voltctl -a v2 -s localhost:55555 config > $HOME/.volt/config 2>>$LOG) >>$LOG 2>&1 |
| 401 | espin - $VERIFIED |
Test User | 08ebbd9 | 2019-07-03 17:15:39 +0000 | [diff] [blame^] | 402 | |
| 403 | echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG |
| 404 | echo "are accessing the correct Kubernetes/Kind cluster as well as have the " | tee -a $LOG |
| 405 | echo "tools required by VOLTHA in your command path. " | tee -a $LOG |
| 406 | echo "" | tee -a $LOG |
| 407 | echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG |
| 408 | echo 'export PATH=$GOPATH/bin:$PATH' | tee -a $LOG |
| 409 | echo "" | tee -a $LOG |
| 410 | echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG |
| 411 | |