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_ |
| 8 | usage: |
Claudine Chiu | b0d0ada | 2016-06-06 18:03:09 -0400 | [diff] [blame] | 9 | $(basename $0) [-w] [-f] [node] |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 10 | |
| 11 | flags: |
| 12 | - -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started. |
Thomas Vachuska | 5af2e4f | 2016-12-16 12:07:33 -0800 | [diff] [blame] | 13 | - -f : Deprecated - use bash's IFS expansion of positional parameters |
Ayaka Koshibe | f17f34a | 2015-09-24 19:31:48 -0700 | [diff] [blame] | 14 | |
| 15 | options: |
| 16 | - [node] : the node to attach to |
| 17 | |
| 18 | summary: |
| 19 | ONOS remote command-line client. |
| 20 | |
| 21 | The -w flag depends on 'onos-wait-for-start'. If [node] is unspecified, \$OCI |
| 22 | is used. |
| 23 | |
| 24 | _EOF_ |
| 25 | } |
| 26 | [ "$1" = "-h" ] && _usage && exit 0 |
| 27 | |
Pavlin Radoslavov | 4b15407 | 2014-10-15 10:49:23 -0700 | [diff] [blame] | 28 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 29 | . $ONOS_ROOT/tools/build/envDefaults |
Jonathan Hart | 518e5e7 | 2014-10-31 15:28:35 -0700 | [diff] [blame] | 30 | . $ONOS_ROOT/tools/test/bin/find-node.sh |
Pavlin Radoslavov | 4b15407 | 2014-10-15 10:49:23 -0700 | [diff] [blame] | 31 | |
tom | a6bc21b | 2014-09-30 09:39:02 -0700 | [diff] [blame] | 32 | [ "$1" = "-w" ] && shift && onos-wait-for-start $1 |
Thomas Vachuska | 5af2e4f | 2016-12-16 12:07:33 -0800 | [diff] [blame] | 33 | [ "$1" = "-f" ] && shift # Deprecated |
tom | a6bc21b | 2014-09-30 09:39:02 -0700 | [diff] [blame] | 34 | |
Jonathan Hart | 518e5e7 | 2014-10-31 15:28:35 -0700 | [diff] [blame] | 35 | [ -n "$1" ] && OCI=$(find_node $1) && shift |
Thomas Vachuska | 12bf445 | 2015-06-26 09:15:38 -0700 | [diff] [blame] | 36 | |
You Wang | dafd5b7 | 2017-09-08 14:23:15 -0700 | [diff] [blame] | 37 | ssh -q -p 8101 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $OCI "$@" |