Fixing a few tools to work with the new REST security stuff.

Change-Id: I1fcff24bf57e3198c16df5a6e42d721a004e9097
diff --git a/tools/test/bin/onos b/tools/test/bin/onos
index 63786d9..89197db 100755
--- a/tools/test/bin/onos
+++ b/tools/test/bin/onos
@@ -11,7 +11,7 @@
 
 [ -n "$1" ] && OCI=$(find_node $1) && shift
 
-if which client 2>/dev/null && [ -z "$ONOS_USE_SSH" ]; then
+if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then
     # Use Karaf client only if we can and are allowed to
     unset KARAF_HOME
     client -h $OCI -u karaf "$@" 2>/dev/null
diff --git a/tools/test/bin/onos-form-cluster b/tools/test/bin/onos-form-cluster
index f1d3429..b6823b1 100755
--- a/tools/test/bin/onos-form-cluster
+++ b/tools/test/bin/onos-form-cluster
@@ -6,10 +6,22 @@
 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
 . $ONOS_ROOT/tools/build/envDefaults
 
+# Scan arguments for user/password or other options...
+while getopts u:p: o; do
+    case "$o" in
+        u) user=$OPTARG;;
+        p) password=$OPTARG;;
+    esac
+done
+user=${user:-onos}           # user defaults to 'onos'
+password=${password:-$user}  # password defaults to user name if not specified
+let OPC=$OPTIND-1
+shift $OPC
+
 node=${1:-$OCI}
 
 if [ $node = "cell" ]; then
-    nodes=$(env | grep "OC[0-9]*=" | cut -d= -f2)
+    nodes=${ONOS_INSTANCES}
     node=${OCI}
 else
     nodes="$@"
@@ -17,4 +29,4 @@
 
 set -x
 
-ssh $ONOS_USER@$node /tmp/$ONOS_BITS/bin/onos-form-cluster $nodes
\ No newline at end of file
+ssh $ONOS_USER@$node /tmp/$ONOS_BITS/bin/onos-form-cluster -u $user -p $password $nodes
\ No newline at end of file
diff --git a/tools/test/bin/onos-topo-cfg b/tools/test/bin/onos-topo-cfg
index 258bfe7..5f40d8e 100755
--- a/tools/test/bin/onos-topo-cfg
+++ b/tools/test/bin/onos-topo-cfg
@@ -9,5 +9,6 @@
 node="${1:-$OCI}"
 file="${2:-$ONOS_ROOT/tools/test/topos/oe-linear-3.json}"
 
-curl -sS --fail -L -X POST -H 'Content-Type:application/json' \
+curl -sS --fail -L --user $ONOS_WEB_USER:$ONOS_WEB_PASS \
+    -X POST -H 'Content-Type:application/json' \
     http://$node:8181/onos/v1/config/topology -d@$file