tom | ac77d76 | 2014-09-18 19:59:42 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 2 | # ----------------------------------------------------------------------------- |
tom | 1a2908c | 2014-09-23 16:37:39 -0700 | [diff] [blame] | 3 | # ONOS remote command-line client. |
Pavlin Radoslavov | 9141379 | 2014-10-15 11:00:32 -0700 | [diff] [blame] | 4 | # ----------------------------------------------------------------------------- |
tom | ac77d76 | 2014-09-18 19:59:42 -0700 | [diff] [blame] | 5 | |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 6 | function _usage () { |
| 7 | cat << _EOF_ |
Thomas Vachuska | d76b679 | 2018-02-01 11:46:12 -0800 | [diff] [blame] | 8 | usage: $(basename $0) [node [command]] |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 9 | |
Thomas Vachuska | d76b679 | 2018-02-01 11:46:12 -0800 | [diff] [blame] | 10 | ONOS remote command-line client. |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 11 | |
Thomas Vachuska | d76b679 | 2018-02-01 11:46:12 -0800 | [diff] [blame] | 12 | Parameters: |
| 13 | - node ip or hostname of cluster node to attach to |
| 14 | - command command to be executed |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 15 | |
Thomas Vachuska | d76b679 | 2018-02-01 11:46:12 -0800 | [diff] [blame] | 16 | If node is unspecified, the value of \$OCI environment variable is used. |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 17 | _EOF_ |
| 18 | } |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 19 | |
Thomas Vachuska | d76b679 | 2018-02-01 11:46:12 -0800 | [diff] [blame] | 20 | [ "$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 Radoslavov | 4b15407 | 2014-10-15 10:49:23 -0700 | [diff] [blame] | 23 | |
Thomas Vachuska | 7f2a356 | 2018-02-28 10:02:16 -0800 | [diff] [blame] | 24 | [ -f $(dirname $0)/find-node.sh ] && . $(dirname $0)/find-node.sh |
| 25 | [ -f $(dirname $0)/_find-node ] && . $(dirname $0)/_find-node |
tom | a6bc21b | 2014-09-30 09:39:02 -0700 | [diff] [blame] | 26 | |
Jonathan Hart | 518e5e7 | 2014-10-31 15:28:35 -0700 | [diff] [blame] | 27 | [ -n "$1" ] && OCI=$(find_node $1) && shift |
Thomas Vachuska | 12bf445 | 2015-06-26 09:15:38 -0700 | [diff] [blame] | 28 | |
You Wang | dafd5b7 | 2017-09-08 14:23:15 -0700 | [diff] [blame] | 29 | ssh -q -p 8101 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $OCI "$@" |