add support for TP voltha-onos image and OAR overrides
diff --git a/README.md b/README.md
index 28feeee..25fa6c1 100644
--- a/README.md
+++ b/README.md
@@ -62,16 +62,20 @@
| OPTION | DEFAULT | DESCRIPTION |
| ------------------------------- | ---------------------------- | ----------------------------------------------------------------------------------- |
| `TYPE` | minimal | `minimal` or `full` and determines number of cluster nodes and etcd cluster members |
-| `WITH_TIMINGS` | no | Outputs duration of various steps of the install |
-| `WITH_BBSIM` | no | Should the BBSIM POD be deployed? |
-| `WITH_RADIUS` | no | Should `freeradius` service be deployed? |
-| `WITH_ONOS` | yes | Should `ONOS` service be deployed? |
-| `JUST_K8S` | no | Should just the KinD Kubernetes cluster be depoyed? (i.e. no VOLTHA) |
+| `NAME` | TYPE | Name of the KinD Cluster to be created |
| `DEPLOY_K8S` | yes | Should the KinD Kubernetes cluster be deployed? |
+| `JUST_K8S` | no | Should just the KinD Kubernetes cluster be depoyed? (i.e. no VOLTHA) |
+| `WITH_BBSIM` | no | Should the BBSIM POD be deployed? |
+| `WITH_ONOS` | yes | Should `ONOS` service be deployed? |
+| `WITH_RADIUS` | no | Should `freeradius` service be deployed? |
+| `WITH_TP` | yes | Install the ONOS image that support Tech Profiles |
+| `WITH_TIMINGS` | no | Outputs duration of various steps of the install |
+| `INSTALL_ONOS_APPS` | no | Replaces/installs ONOS OAR files in onos-files/onos-apps |
| `SKIP_RESTART_API` | no | Should the VOLTHA API service be restarted after install to avoid known bug? |
| `INSTALL_KUBECTL` | yes | Should a copy of `kubectl` be installed locally? |
| `INSTALL_HELM` | yes | Should a copy of `helm` be installed locallly? |
| `USE_GO` | yes | Should the Go[lang] version of the OpenOLT adapter be used? |
+| `ONOS_TAG` | | Used to override the default image tag for the ONOS docker image |
| `VOLTHA_LOG_LEVEL` | WARN | Log level to set for VOLTHA core processes |
| `VOLTHA_CHART` | onf/voltha | Helm chart to used to install voltha |
| `VOLTHA_ADAPTER_SIM_CHART` | onf/voltha-adapter-simulated | Helm chart to use to install simulated device adapter |
diff --git a/voltha b/voltha
index 54397bd..2a45b2a 100755
--- a/voltha
+++ b/voltha
@@ -70,6 +70,7 @@
WITH_BBSIM=${WITH_BBSIM:-no}
WITH_RADIUS=${WITH_RADIUS:-no}
WITH_ONOS=${WITH_ONOS:-yes}
+INSTALL_ONOS_APPS=${INSTALL_ONOS_APPS:-no}
WITH_TP=${WITH_TP:-yes}
JUST_K8S=${JUST_K8S:-no}
DEPLOY_K8S=${DEPLOY_K8S:-yes}
@@ -220,6 +221,18 @@
WITH_TIMINGS=no
fi
+# Verify INSTALL_ONOS_APPS settting and convert uniform value of yes or no
+if [ $(echo ":y:yes:true:n:no:false:1:0:" | grep -ic ":$INSTALL_ONOS_APPS:") -eq 0 ]; then
+ >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid \$INSTALL_ONOS_APPS value of '$INSTALL_ONOS_APPS'. Should be 'yes' or 'no'${NORMAL}"
+ exit 1
+fi
+
+if [ $(echo ":y:yes:true:1:" | grep -ic ":$INSTALL_ONOS_APPS:") -eq 1 ]; then
+ INSTALL_ONOS_APPS=yes
+else
+ INSTALL_ONOS_APPS=no
+fi
+
mkdir -p .voltha
touch .voltha/ports
HAVE=$(grep $NAME .voltha/ports)
@@ -253,18 +266,11 @@
cp $PORTTMP .voltha/ports
rm -f $PORTTMP
-if [ "$WITH_TP" == "yes" ]; then
- SADIS_VER=3.1.0
- OLT_VER=3.0.1
- AAA_VER=1.9.0
- DHCP_VER=1.6.0
-else
- SADIS_VER=2.2.0
- OLT_VER=2.1.0
- AAA_VER=1.8.0
- DHCP_VER=1.5.0
+ONOS_TAG=${ONOS_TAG:-}
+if [ "$WITH_TP" == "yes" -a "$ONOS_TAG X" == " X" ]; then
+ ONOS_TAG="voltha-1.7"
fi
-export ONOS_API_PORT ONOS_SSH_PORT SADIS_VER OLT_VER AAA_VER DHCP_VER
+export ONOS_API_PORT ONOS_SSH_PORT
spin() {
PARTS="\
@@ -548,9 +554,9 @@
# Output install options to log
echo "OPTIONS" >> $LOG
ALL_OPTIONS="NAME TYPE WITH_TIMINGS WITH_BBSIM WITH_RADIUS WITH_ONOS WITH_TP JUST_K8S DEPLOY_K8S \
- SKIP_RESTART_API INSTALL_KUBECTL INSTALL_HELM USE_GO VOLTHA_LOG_LEVEL \
+ INSTALL_ONOS_APPS SKIP_RESTART_API INSTALL_KUBECTL INSTALL_HELM USE_GO VOLTHA_LOG_LEVEL \
VOLTHA_CHART VOLTHA_ADAPTER_SIM_CHART VOLTHA_ADAPTER_OPEN_OLT_CHART \
- VOLTHA_ADAPTER_OPEN_ONU_CHART SADIS_VER OLT_VER AAA_VER DHCP_VER \
+ VOLTHA_ADAPTER_OPEN_ONU_CHART ONOS_TAG \
ONOS_API_PORT ONOS_SSH_PORT VOLTHA_API_PORT VOLTHA_SSH_PORT VOLTHA_ETCD_PORT"
for O in $ALL_OPTIONS; do
VAL=$(eval echo \$$O)
@@ -579,6 +585,22 @@
espin - $VERIFIED
}
+override_onos_app() {
+ local APP=$1
+ local NAME=$(basename $APP | sed -e 's/-.*$//g')
+ until test; do
+ sspin -
+ # Attempt to delete old version (if it exists)
+ (set -x; curl --fail -sSL --user karaf:karaf -X DELETE http://127.0.0.1:$ONOS_API_PORT/onos/v1/applications/$NAME >>$LOG 2>&1) >>$LOG 2>&1
+ sspin -
+ (set -x; curl --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 @$APP >>$LOG 2>&1) >>$LOG 2>&1
+ if [ $? -eq 0 ]; then
+ break
+ fi
+ sleep .2
+ done
+}
+
count_pods() {
local NAMESPACE=$1; shift
local PODS=$(kubectl -n $NAMESPACE get pod -o go-template="{{range .items}}{{.metadata.name}}/{{.status.phase}}/_{{range .status.containerStatuses}}{{.ready}}_{{end}} {{end}}")
@@ -894,7 +916,11 @@
bspin "Verify ONOS installed $BIRD"
if [ $(helm list --deployed --short --namespace default "^onos\$" | wc -l) -ne 1 ]; then
espin $NOT_VERIFIED
- helm_install - default onos onf/onos "Install ONOS"
+ SET_TAG=
+ if [ "$ONOS_TAG X" != " X" ]; then
+ SET_TAG="--set images.onos.tag=$ONOS_TAG"
+ fi
+ EXTRA_HELM_FLAGS="$SET_TAG $EXTRA_HELM_FLAGS" helm_install - default onos onf/onos "Install ONOS"
else
espin $VERIFIED
fi
@@ -920,6 +946,19 @@
fi
done
espin - $VERIFIED
+
+ if [ $INSTALL_ONOS_APPS == "yes" ]; then
+ bspin - "Installing custom ONOS applications"
+ if [ -x onos-files/onos-apps -a $(ls -1 onos-files/onos-apps/*.oar 2>/dev/null | wc -l) -gt 0 ]; then
+ for OAR in $(ls -1 onos-files/onos-apps/*.oar); do
+ sspin - "Installing custom ONOS applications - $OAR$CEOL"
+ override_onos_app $OAR
+ done
+ espin - "$VERIFIED Installing custom ONOS applications$CEOL"
+ else
+ espin - "$NOT_VERIFIED Installing custom ONOS applications - None Found"
+ fi
+ fi
push_onos_config "Push ONOS Network Configuration" "network/configuration" "onos-files/olt-onos-netcfg.json"
push_onos_config "Enable VOLTHA ONOS DHCP provisioning" "configuration/org.opencord.olt.impl.Olt" "onos-files/olt-onos-olt-settings.json"