Adding support to deploy multiple openonu adapters
Change-Id: I38ba60533333d845f5c5d8606f0c21b0d3c9ebfc
diff --git a/voltha b/voltha
index a887742..ba85f84 100755
--- a/voltha
+++ b/voltha
@@ -113,7 +113,9 @@
EXTRA_HELM_INSTALL_ARGS=${EXTRA_HELM_INSTALL_ARGS:-}
INTERNAL_EXTRA_HELM_INSTALL_ARGS=
NUM_OF_BBSIM=${NUM_OF_BBSIM:-1}
+NUM_OF_OPENONU=${NUM_OF_OPENONU:-1}
MAX_NUM_OF_BBSIM=10
+MAX_NUM_OF_OPENONU=10
HOSTOS="$(uname -s | tr "[:upper:]" "[:lower:"])"
HOSTARCH="$(uname -m | tr "[:upper:]" "[:lower:"])"
@@ -127,11 +129,20 @@
# note: instances will be numbered from 0 to 9
if [ "$1" == "up" ]; then
if [ "$NUM_OF_BBSIM" -lt 1 ]; then
- >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of BBSIM instances. NUM_OF_BBSIM is less than 1${NORMAL}"
+ >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of BBSIM instances. NUM_OF_BBSIM (${NUM_OF_BBSIM}) is less than 1${NORMAL}"
exit 1
fi
if [ "$NUM_OF_BBSIM" -gt "$MAX_NUM_OF_BBSIM" ]; then
- >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of BBSIM instances. NUM_OF_BBSIM is greater than $MAX_NUM_OF_BBSIM${NORMAL}"
+ >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of BBSIM instances. NUM_OF_BBSIM (${NUM_OF_BBSIM}) is greater than $MAX_NUM_OF_BBSIM${NORMAL}"
+ exit 1
+ fi
+
+ if [ "$NUM_OF_OPENONU" -lt 1 ]; then
+ >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of OPENONU instances. NUM_OF_OPENONU (${NUM_OF_OPENONU}) is less than 1${NORMAL}"
+ exit 1
+ fi
+ if [ "$NUM_OF_OPENONU" -gt "$MAX_NUM_OF_OPENONU" ]; then
+ >&2 echo -e "${RED}${BOLD}${ERROR}ERROR:${NORMAL}${RED} Invalid setting of OPENONU instances. NUM_OF_OPENONU (${NUM_OF_OPENONU}) is greater than $MAX_NUM_OF_OPENONU${NORMAL}"
exit 1
fi
fi
@@ -230,6 +241,7 @@
VOLTHA_BBSIM_CHART \
VOLTHA_BBSIM_CHART_VERSION \
NUM_OF_BBSIM \
+ NUM_OF_OPENONU \
VOLTHA_ADAPTER_SIM_CHART \
VOLTHA_ADAPTER_SIM_CHART_VERSION \
VOLTHA_ADAPTER_OPEN_OLT_CHART \
@@ -1593,7 +1605,7 @@
else
EXPECT="$((EXPECT+2))"
fi
-case $WITH_ETCD in
+case $WITH_ETCD in
no)
INTERNAL_EXTRA_HELM_INSTALL_ARGS+=" --set private_etcd_cluster=false"
;;
@@ -1719,14 +1731,18 @@
else
espin - "$VERIFIED"
fi
+ EXPECT="$((EXPECT + 1))"
bspin - "Verify OpenONU Adapter installed"
if [ "$HELM_USE_UPGRADE" == "yes" ] || [ "$(helm list --deployed --short --namespace "$ADAPTER_NS" "^open-onu\$" | wc -l)" -ne 1 ]; then
+ _ORIGINAL_EXTRA_HELM_INSTALL_ARGS="$INTERNAL_EXTRA_HELM_INSTALL_ARGS"
+ INTERNAL_EXTRA_HELM_INSTALL_ARGS+=" --set replicas.adapter_open_onu=$NUM_OF_OPENONU"
espin - "$NOT_VERIFIED"
- helm_install - "$ADAPTER_NS" open-onu "$VOLTHA_ADAPTER_OPEN_ONU_CHART" "$VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION" "$_HELM_DESC OpenONU Adapter"
+ helm_install - "$ADAPTER_NS" open-onu "$VOLTHA_ADAPTER_OPEN_ONU_CHART" "$VOLTHA_ADAPTER_OPEN_ONU_CHART_VERSION" "$_HELM_DESC OpenONU Adapter"
+ INTERNAL_EXTRA_HELM_INSTALL_ARGS="$_ORIGINAL_EXTRA_HELM_INSTALL_ARGS"
else
espin - "$VERIFIED"
fi
- EXPECT="$((EXPECT + 2))"
+ EXPECT=$((EXPECT + NUM_OF_OPENONU))
fi
INTERNAL_EXTRA_HELM_INSTALL_ARGS=