blob: 393982acd7bf4c6e3274598488b2f491ff3c4ea9 [file] [log] [blame]
#!/bin/bash
# -----------------------------------------------------------------------------
# ONOS remote command-line client.
# -----------------------------------------------------------------------------
function _usage () {
cat << _EOF_
usage: $(basename $0) [node [command]]
ONOS remote command-line client.
Parameters:
- node ip or hostname of cluster node to attach to
- command command to be executed
If node is unspecified, the value of \$OCI environment variable is used.
_EOF_
}
[ "$1" = "-h" -o "$1" = '-?' ] && _usage && exit 0
[ "$1" = "-w" ] && echo "-w option is deprecated" && shift # Deprecated
[ "$1" = "-f" ] && echo "-f option is deprecated" && shift # Deprecated
# If ONOS_HOME is set, respect its value.
# If ONOS_HOME is not set (e.g. in the init or service environment),
# set it based on this script's path.
ONOS_HOME=${ONOS_HOME:-$(cd $(dirname $0)/.. >/dev/null 2>&1 && pwd)}
[ $(dirname $0)/find-node.sh ] && . $(dirname $0)/find-node.sh
[ -x ${ONOS_HOME}/bin/_find-node ] && . ${ONOS_HOME}/bin/_find-node
[ -n "$1" ] && OCI=$(find_node $1) && shift
ssh -q -p 8101 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $OCI "$@"