2 # -----------------------------------------------------------------------------
3 # ONOS remote command-line client.
4 # -----------------------------------------------------------------------------
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
12 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
14 . $ONOS_ROOT/tools/build/envDefaults
15 . $ONOS_ROOT/tools/test/bin/find-node.sh
17 [ "$1" = "-w" ] && shift && onos-wait-for-start $1
19 [ -n "$1" ] && OCI=$(find_node $1) && shift
21 if which client 1>/dev/null 2>&1 && [ -z "$ONOS_USE_SSH" ]; then
22 # Use Karaf client only if we can and are allowed to
24 client -h $OCI -u karaf "$@" 2>/dev/null
26 # Otherwise use raw ssh; strict checking is off for dev environments only
27 #ssh -p 8101 -o StrictHostKeyChecking=no $OCI "$@"
28 sshpass -p karaf ssh -l karaf -p 8101 $OCI "$@"