Update cell related util scripts to support larger cluster [ONOS-467]
Change-Id: Ie182397b7da92212cdaf6e1622b1482408b6de59
diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile
index d73ff06..4394a32 100644
--- a/tools/dev/bash_profile
+++ b/tools/dev/bash_profile
@@ -78,7 +78,8 @@
[ ! -f $ONOS_ROOT/tools/test/cells/$1 ] && \
echo "No such cell: $1" >&2 && return 1
unset ONOS_CELL ONOS_NIC ONOS_FEATURES ONOS_USER ONOS_GROUP
- unset OC0 OC1 OC2 OC3 OC4 OC5 OC6 OC7 OC8 OC9 OCN OCI
+ unset OCI OCN
+ unset $(env | sed -n 's:\(^OC[0-9]\{1,\}\)=.*:\1 :g p')
export ONOS_CELL=$1
. $ONOS_ROOT/tools/test/cells/$1
cell
diff --git a/tools/test/bin/onos-group b/tools/test/bin/onos-group
index 0e6b396..150f947 100755
--- a/tools/test/bin/onos-group
+++ b/tools/test/bin/onos-group
@@ -49,7 +49,7 @@
# early sanity check for instances/arguments
[ -z "$1" ] && usage && exit 0
-OCIS=( $(env | sed -ne 's:OC[0-9]=\(.*\):\1 :g p' | sort -k1) )
+OCIS=( $(env | sed -ne 's:OC[0-9]\{1,\}=\(.*\):\1 :g p' | sort -k1) )
if [ -z "$OCIS" ]; then
printf "no controller instances, quitting early" >&2 && exit 0
fi
diff --git a/tools/test/bin/onos-show-cell b/tools/test/bin/onos-show-cell
index 559ecaf..3b11a1d 100755
--- a/tools/test/bin/onos-show-cell
+++ b/tools/test/bin/onos-show-cell
@@ -42,7 +42,9 @@
echo "ONOS_CELL=${ONOS_CELL}"
echo "ONOS_NIC=${ONOS_NIC}"
-for n in {0..9}; do
+# get number of OC variables
+max=$( env | egrep 'OC[0-9]+' | wc -l )
+for n in $( seq 0 ${max} ); do
ocn="OC${n}"
if [ -n "${!ocn}" ]; then
echo "$ocn=${!ocn}"