support both full and minimal config, even simultaneously
diff --git a/.gitignore b/.gitignore
index fd9cc76..ee45cf0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
src
install.log
*.swp
+*.log
diff --git a/onos-files/install-onos-applications.sh b/onos-files/install-onos-applications.sh
index fca199c..86a5c26 100755
--- a/onos-files/install-onos-applications.sh
+++ b/onos-files/install-onos-applications.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash
# Copyright 2019 Ciena Corporation
#
@@ -20,6 +20,16 @@
AAA_VER=1.8.0
DHCP_VER=1.5.0
+TYPE=${TYPE:-minimal}
+
+if [ "$TYPE" == "full" ]; then
+ ONOS_API_PORT=${ONOS_API_PORT:-8182}
+ ONOS_SSH_PORT=${ONOS_SSH_PORT:-8102}
+else
+ ONOS_API_PORT=${ONOS_API_PORT:-8181}
+ ONOS_SSH_PORT=${ONOS_SSH_PORT:-8101}
+fi
+
mkdir -p onos-files/onos-apps
echo "Downloading ONOS applications"
curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/cord-config/$CONFIG_VER/cord-config-$CONFIG_VER.oar -o ./onos-files/onos-apps/cord-config-$CONFIG_VER.oar
@@ -28,12 +38,12 @@
curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/olt-app/$OLT_VER/olt-app-$OLT_VER.oar -o ./onos-files/onos-apps/olt-app-$OLT_VER.oar
curl --fail -sSL https://repo.maven.apache.org/maven2/org/opencord/dhcpl2relay/$DHCP_VER/dhcpl2relay-$DHCP_VER.oar -o ./onos-files/onos-apps/dhcpl2relay-$DHCP_VER.oar
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:8181/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/cord-config-$CONFIG_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'CONFIG' ONOS application ..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:8181/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/sadis-app-$SADIS_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'SADIS' ONOS application ..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:8181/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/olt-app-$OLT_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'OLT' ONOS application ..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:8181/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/aaa-$AAA_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'AAA' ONOS application ..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:8181/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/dhcpl2relay-$DHCP_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'DHCP L2 Relay' ONOS application ..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:8181/onos/v1/network/configuration --data @onos-files/olt-onos-netcfg.json 2>/dev/null | tail -1) -eq 200; do echo "Configuring VOLTHA ONOS ..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:8181/onos/v1/configuration/org.opencord.olt.impl.Olt --data @onos-files/olt-onos-olt-settings.json 2>/dev/null | tail -1) -eq 200; do echo "Enabling VOLTHA ONOS DHCP provisioning..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:8181/onos/v1/configuration/org.onosproject.net.flow.impl.FlowRuleManager --data @onos-files/olt-onos-enableExtraneousRules.json 2>/dev/null | tail -1) -eq 200; do echo "Enabling extraneous rules for ONOS..."; sleep 1; done
-until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json 'http://127.0.0.1:8181/onos/v1/flows/of:0000000000000001?appId=env.voltha' --data @onos-files/dhcp-to-controller-flow.json 2>/dev/null | tail -1) -eq 201; do echo "Establishing DHCP packet-in flow ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/cord-config-$CONFIG_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'CONFIG' ONOS application ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/sadis-app-$SADIS_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'SADIS' ONOS application ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/olt-app-$OLT_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'OLT' ONOS application ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/aaa-$AAA_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'AAA' ONOS application ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/octet-stream http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications?activate=true --data-binary @./onos-files/onos-apps/dhcpl2relay-$DHCP_VER.oar 2>/dev/null | tail -1) -eq 409; do echo "Installing 'DHCP L2 Relay' ONOS application ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/network/configuration --data @onos-files/olt-onos-netcfg.json 2>/dev/null | tail -1) -eq 200; do echo "Configuring VOLTHA ONOS ..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/configuration/org.opencord.olt.impl.Olt --data @onos-files/olt-onos-olt-settings.json 2>/dev/null | tail -1) -eq 200; do echo "Enabling VOLTHA ONOS DHCP provisioning..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://127.0.0.1:$ONOS_API_PORT/onos/v1/configuration/org.onosproject.net.flow.impl.FlowRuleManager --data @onos-files/olt-onos-enableExtraneousRules.json 2>/dev/null | tail -1) -eq 200; do echo "Enabling extraneous rules for ONOS..."; sleep 1; done
+until test $(curl -w '\n%{http_code}' --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json "http://127.0.0.1:$ONOS_API_PORT/onos/v1/flows/of:0000000000000001?appId=env.voltha" --data @onos-files/dhcp-to-controller-flow.json 2>/dev/null | tail -1) -eq 201; do echo "Establishing DHCP packet-in flow ..."; sleep 1; done
diff --git a/restart-api.sh b/restart-api.sh
index b18ff25..4cfb69a 100755
--- a/restart-api.sh
+++ b/restart-api.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash
# Copyright 2019 Ciena Corporation
#
@@ -14,6 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+TYPE=${TYPE:-minimal}
+if [ "$TYPE" == "full" ]; then
+ VOLTHA_API_PORT=${VOLTHA_API_PORT:-55556}
+ VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5023}
+else
+ VOLTHA_API_PORT=${VOLTHA_API_PORT:-55555}
+ VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5022}
+fi
+
echo "Scaling down voltha-api-server and ofagent"
(set -x; kubectl scale --replicas=0 deployment -n voltha voltha-api-server ofagent)
echo "Waiting for PODS to be terminated"
@@ -31,10 +40,8 @@
echo " Running"
echo "Forward VOLTHA API port"
-(set -x; screen -p 0 -X -S voltha-api stuff $'\003')
-(set -x; screen -dmS voltha-api kubectl port-forward -n voltha service/voltha-api 55555:55555)
+(set -x; screen -p 0 -X -S voltha-api-$TYPE stuff $'\003')
+(set -x; screen -dmS voltha-api-$TYPE kubectl port-forward -n voltha service/voltha-api $VOLTHA_API_PORT:55555)
echo "Forward VOLTHA SSH port"
-(set -x; screen -p 0 -X -S voltha-ssh stuff $'\003')
-(set -x; screen -dmS voltha-ssh kubectl port-forward -n voltha service/voltha-cli 5022:5022)
-
-
+(set -x; screen -p 0 -X -S voltha-ssh-$TYPE stuff $'\003')
+(set -x; screen -dmS voltha-ssh-$TYPE kubectl port-forward -n voltha service/voltha-cli $VOLTHA_SSH_PORT:5022)
diff --git a/voltha b/voltha
index fcd1d1a..6a1123f 100755
--- a/voltha
+++ b/voltha
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/bash
# Copyright 2019 Ciena Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,8 +29,23 @@
_VOLTCTL_VERSION=$(echo $VOLTCTL_VERSION | sed -e 's/-/_/g')
TYPE=${TYPE:-minimal}
-# Only minimal cluster works in this script currently
-TYPE=minimal
+
+if [ "$TYPE" == "full" ]; then
+ ONOS_API_PORT=${ONOS_API_PORT:-8182}
+ ONOS_SSH_PORT=${ONOS_SSH_PORT:-8102}
+ VOLTHA_API_PORT=${VOLTHA_API_PORT:-55556}
+ VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5023}
+else
+ ONOS_API_PORT=${ONOS_API_PORT:-8181}
+ ONOS_SSH_PORT=${ONOS_SSH_PORT:-8101}
+ VOLTHA_API_PORT=${VOLTHA_API_PORT:-55555}
+ VOLTHA_SSH_PORT=${VOLTHA_SSH_PORT:-5022}
+fi
+
+if [ "$1" == "get" -a "$2" == "voltconfig" ]; then
+ echo "$HOME/.volt/config-$TYPE"
+ exit
+fi
if [ $# -ne 1 -o $(echo ":up:down:" | grep -c ":$1:") -ne 1 ]; then
>&2 echo "up or down?"
@@ -46,7 +61,7 @@
exit
fi
-LOG="install.log"
+LOG="install-$TYPE.log"
date > $LOG
spin() {
@@ -266,7 +281,8 @@
kube-proxy-.* \
kube-scheduler-voltha-$TYPE-control-plane"
-wait_for_pods - "kube-system" 12 -1 "Waiting for system PODs to start..." $P
+EXPECT=$(test "$TYPE" == "minimal" && echo "12" || echo "14")
+wait_for_pods - "kube-system" $EXPECT -1 "Waiting for system PODs to start..." $P
COUNT=$(count_pods "kube-system" "tiller-deploy-.*")
bspin "Verify Helm"
@@ -312,7 +328,8 @@
else
espin $VERIFIED
fi
-wait_for_pods - "voltha" 1 -1 "Waiting for ETCD Operator to start..." "etcd-operator-.*"
+EXPECT=$(test "$TYPE" == "minimal" && echo "1" || echo "3")
+wait_for_pods - "voltha" $EXPECT -1 "Waiting for ETCD Operator to start..." "etcd-operator-.*"
bspin "Verify ONOS installed"
if [ $(helm list onos | grep -c DEPLOYED) -ne 1 ]; then
@@ -324,12 +341,12 @@
wait_for_pods - "default" 1 -1 "Waiting for ONOS to start..." "onos-.*"
bspin - "Forward ONOS API port"
-(set -x; screen -p 0 -X -S onos-ui stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
-(set -x; screen -dmS onos-ui kubectl port-forward service/onos-ui 8181:8181 >>$LOG 2>&1) >>$LOG 2>&1
+(set -x; screen -p 0 -X -S onos-ui-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
+(set -x; screen -dmS onos-ui-$TYPE kubectl port-forward service/onos-ui $ONOS_API_PORT:8181 >>$LOG 2>&1) >>$LOG 2>&1
espin - $VERIFIED
bspin - "Forward ONOS SSH port"
-(set -x; screen -p 0 -X -S onos-ssh stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
-(set -x; screen -dmS onos-ssh kubectl port-forward service/onos-ssh 8101:8101 >>$LOG 2>&1) >>$LOG 2>&1
+(set -x; screen -p 0 -X -S onos-ssh-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
+(set -x; screen -dmS onos-ssh-$TYPE kubectl port-forward service/onos-ssh $ONOS_SSH_PORT:8101 >>$LOG 2>&1) >>$LOG 2>&1
espin - $VERIFIED
bspin - "Install required ONOS applications"
(set -x; ./onos-files/install-onos-applications.sh >>$LOG 2>&1) >>$LOG 2>&1
@@ -350,7 +367,8 @@
voltha-etcd-cluster-.* \
voltha-kafka-.* \
voltha-zookeeper-.*"
-wait_for_pods - "voltha" 9 -1 "Waiting for VOLTHA Core to start..." $VOLTHA
+EXPECT=$(test "$TYPE" == "minimal" && echo "9" || echo "11")
+wait_for_pods - "voltha" $EXPECT -1 "Waiting for VOLTHA Core to start..." $VOLTHA
echo "Verify Adapters"
bspin - "Verify Simulated Adapters installed"
@@ -387,17 +405,17 @@
wait_for_pods - "voltha" 2 -1 "Wait for API to re-start ..." $API
bspin - "Forward VOLTHA API port"
-(set -x; screen -p 0 -X -S voltha-api stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
-(set -x; screen -dmS voltha-api kubectl port-forward -n voltha service/voltha-api 55555:55555 >>$LOG 2>&1) >>$LOG 2>&1
+(set -x; screen -p 0 -X -S voltha-api-$TYPE stuff $'\003' >>$LOG 2>&1) >>$LOG 2>&1
+(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
espin - $VERIFIED
bspin - "Forward VOLTHA SSH port"
-(set -x; screen -p 0 -X -S voltha-ssh stuff $'\003' 2>/dev/null >/dev/null >>$LOG 2>&1) >>$LOG 2>&1
-(set -x; screen -dmS voltha-ssh kubectl port-forward -n voltha service/voltha-cli 5022:5022 >>$LOG 2>&1) >>$LOG 2>&1
+(set -x; screen -p 0 -X -S voltha-ssh-$TYPE stuff $'\003' 2>/dev/null >/dev/null >>$LOG 2>&1) >>$LOG 2>&1
+(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
espin - $VERIFIED
bspin - "Create voltctl configuration file"
(set -x; mkdir -p $HOME/.volt >>$LOG 2>&1) >>$LOG 2>&1
-(set -x; voltctl -a v2 -s localhost:55555 config > $HOME/.volt/config 2>>$LOG) >>$LOG 2>&1
+(set -x; voltctl -a v2 -s localhost:$VOLTHA_API_PORT config > $HOME/.volt/config-$TYPE 2>>$LOG) >>$LOG 2>&1
espin - $VERIFIED
echo "Please issue the following commands in your terminal to ensure that you" | tee -a $LOG
@@ -405,6 +423,7 @@
echo "tools required by VOLTHA in your command path. " | tee -a $LOG
echo "" | tee -a $LOG
echo "export KUBECONFIG=\"\$(./bin/kind get kubeconfig-path --name=\"voltha-$TYPE\")\"" | tee -a $LOG
+echo "export VOLTCONFIG=\"$HOME/.volt/config-$TYPE\""
echo 'export PATH=$GOPATH/bin:$PATH' | tee -a $LOG
echo "" | tee -a $LOG
echo "Thank you for choosing kind-voltha for you quick cluster needs." | tee -a $LOG