blob: 8e2f60062ab80a3ea699812769f16dcb777b146e [file] [log] [blame]
tomac77d762014-09-18 19:59:42 -07001#!/bin/bash
Pavlin Radoslavov91413792014-10-15 11:00:32 -07002# -----------------------------------------------------------------------------
tom1a2908c2014-09-23 16:37:39 -07003# ONOS remote command-line client.
Pavlin Radoslavov91413792014-10-15 11:00:32 -07004# -----------------------------------------------------------------------------
tomac77d762014-09-18 19:59:42 -07005
Ayaka Koshibef17f34a2015-09-24 19:31:48 -07006function _usage () {
7cat << _EOF_
Thomas Vachuskad76b6792018-02-01 11:46:12 -08008usage: $(basename $0) [node [command]]
Ayaka Koshibef17f34a2015-09-24 19:31:48 -07009
Thomas Vachuskad76b6792018-02-01 11:46:12 -080010ONOS remote command-line client.
Ayaka Koshibef17f34a2015-09-24 19:31:48 -070011
Thomas Vachuskad76b6792018-02-01 11:46:12 -080012Parameters:
13 - node ip or hostname of cluster node to attach to
14 - command command to be executed
Ayaka Koshibef17f34a2015-09-24 19:31:48 -070015
Thomas Vachuskad76b6792018-02-01 11:46:12 -080016If node is unspecified, the value of \$OCI environment variable is used.
Ayaka Koshibef17f34a2015-09-24 19:31:48 -070017_EOF_
18}
Ayaka Koshibef17f34a2015-09-24 19:31:48 -070019
Thomas Vachuskad76b6792018-02-01 11:46:12 -080020[ "$1" = "-h" -o "$1" = '-?' ] && _usage && exit 0
21[ "$1" = "-w" ] && echo "-w option is deprecated" && shift # Deprecated
22[ "$1" = "-f" ] && echo "-f option is deprecated" && shift # Deprecated
Pavlin Radoslavov4b154072014-10-15 10:49:23 -070023
Thomas Vachuska7f2a3562018-02-28 10:02:16 -080024[ -f $(dirname $0)/find-node.sh ] && . $(dirname $0)/find-node.sh
25[ -f $(dirname $0)/_find-node ] && . $(dirname $0)/_find-node
toma6bc21b2014-09-30 09:39:02 -070026
Jonathan Hart518e5e72014-10-31 15:28:35 -070027[ -n "$1" ] && OCI=$(find_node $1) && shift
Thomas Vachuska12bf4452015-06-26 09:15:38 -070028
You Wangdafd5b72017-09-08 14:23:15 -070029ssh -q -p 8101 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $OCI "$@"