Update ONOS_INSTANCES when updating OCI

Change-Id: I416901175ba8662a07afe58ff2eb835cd51be242
diff --git a/tools/dev/bash_profile b/tools/dev/bash_profile
index 3eff8b0..3135bf7 100644
--- a/tools/dev/bash_profile
+++ b/tools/dev/bash_profile
@@ -99,6 +99,7 @@
 
 # Sets the primary instance to the specified instance number.
 function setPrimaryInstance {
+    export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
     export OCI=$(env | egrep "OC[0-9]+" | sort | egrep OC${1:-1} | cut -d= -f2)
     echo $OCI
 }
@@ -129,7 +130,6 @@
         curl -sS -X POST "http://$CELL_WARDEN:4321/?$query" -d "$(cat ~/.ssh/id_rsa.pub)" > $aux
         . $aux
         rm -f $aux
-        export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
         setPrimaryInstance 1 >/dev/null
         onos-verify-cell
         ;;
@@ -159,7 +159,6 @@
         export ONOS_WEB_PASS=${ONOS_WEB_PASS:-rocks}
         export ONOS_CELL=$1
         . $ONOS_ROOT/tools/test/cells/$1
-        export ONOS_INSTANCES=$(env | grep 'OC[0-9]*=' | sort | cut -d= -f2)
         setPrimaryInstance 1 >/dev/null
         cell
     esac