blob: c74ebc655d778fedddc12c1c51a6b0f13dab442f [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_
8usage:
Claudine Chiub0d0ada2016-06-06 18:03:09 -04009 $(basename $0) [-w] [-f] [node]
Ayaka Koshibef17f34a2015-09-24 19:31:48 -070010
11flags:
12- -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started.
Thomas Vachuska5af2e4f2016-12-16 12:07:33 -080013- -f : Deprecated - use bash's IFS expansion of positional parameters
Ayaka Koshibef17f34a2015-09-24 19:31:48 -070014
15options:
16- [node] : the node to attach to
17
18summary:
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 Radoslavov4b154072014-10-15 10:49:23 -070028[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
29. $ONOS_ROOT/tools/build/envDefaults
Jonathan Hart518e5e72014-10-31 15:28:35 -070030. $ONOS_ROOT/tools/test/bin/find-node.sh
Pavlin Radoslavov4b154072014-10-15 10:49:23 -070031
toma6bc21b2014-09-30 09:39:02 -070032[ "$1" = "-w" ] && shift && onos-wait-for-start $1
Thomas Vachuska5af2e4f2016-12-16 12:07:33 -080033[ "$1" = "-f" ] && shift # Deprecated
toma6bc21b2014-09-30 09:39:02 -070034
Jonathan Hart518e5e72014-10-31 15:28:35 -070035[ -n "$1" ] && OCI=$(find_node $1) && shift
Thomas Vachuska12bf4452015-06-26 09:15:38 -070036
You Wangdafd5b72017-09-08 14:23:15 -070037ssh -q -p 8101 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $OCI "$@"