onos-* script help functions, plus:
o support onos-watch on OS X by emulating 'watch'. Change-Id: I072f347b21b038168e08405bd228434bcc421aeb
Showing
8 changed files
with
171 additions
and
1 deletions
tools/test/bin/onos
100755 → 100644
... | @@ -3,6 +3,27 @@ | ... | @@ -3,6 +3,27 @@ |
3 | # ONOS remote command-line client. | 3 | # ONOS remote command-line client. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | 5 | ||
6 | +function _usage () { | ||
7 | +cat << _EOF_ | ||
8 | +usage: | ||
9 | + $(basename $0) [-w] [node] | ||
10 | + | ||
11 | +flags: | ||
12 | +- -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started. | ||
13 | + | ||
14 | +options: | ||
15 | +- [node] : the node to attach to | ||
16 | + | ||
17 | +summary: | ||
18 | + ONOS remote command-line client. | ||
19 | + | ||
20 | + The -w flag depends on 'onos-wait-for-start'. If [node] is unspecified, \$OCI | ||
21 | + is used. | ||
22 | + | ||
23 | +_EOF_ | ||
24 | +} | ||
25 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
26 | + | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 27 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 28 | . $ONOS_ROOT/tools/build/envDefaults |
8 | . $ONOS_ROOT/tools/test/bin/find-node.sh | 29 | . $ONOS_ROOT/tools/test/bin/find-node.sh | ... | ... |
tools/test/bin/onos-archetypes-test
100755 → 100644
... | @@ -3,6 +3,19 @@ | ... | @@ -3,6 +3,19 @@ |
3 | # Builds a set of projects using ONOS archetypes. | 3 | # Builds a set of projects using ONOS archetypes. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | 5 | ||
6 | +function _usage () { | ||
7 | +cat << _EOF_ | ||
8 | +usage: | ||
9 | + $(basename $0) | ||
10 | + | ||
11 | +summary: | ||
12 | + Builds a set of projects using ONOS archetypes. | ||
13 | + | ||
14 | +_EOF_ | ||
15 | +} | ||
16 | + | ||
17 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
18 | + | ||
6 | set -e | 19 | set -e |
7 | 20 | ||
8 | export AROOT=/tmp/foo | 21 | export AROOT=/tmp/foo | ... | ... |
tools/test/bin/onos-batch
100755 → 100644
... | @@ -3,6 +3,28 @@ | ... | @@ -3,6 +3,28 @@ |
3 | # Executes selected set of ONOS commands using the batch mode. | 3 | # Executes selected set of ONOS commands using the batch mode. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | 5 | ||
6 | +function _usage () { | ||
7 | +cat << _EOF_ | ||
8 | +usage: | ||
9 | + $(basename $0) [node] <commands> | ||
10 | + | ||
11 | +options: | ||
12 | +- [node] <commands> : node to run <commands> | ||
13 | + | ||
14 | +summary: | ||
15 | + Executes selected set of ONOS commands using the batch mode. | ||
16 | + | ||
17 | + <commands> is a comma-separated list of ONOS CLI commands. | ||
18 | + | ||
19 | + If [node] isn't specified, the defualt target becomes \$OCI. When no commands | ||
20 | + are specified, the commands 'summary','intents','flows', and 'hosts' are | ||
21 | + executed against \$OCI. | ||
22 | + | ||
23 | +_EOF_ | ||
24 | +} | ||
25 | + | ||
26 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
27 | + | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 28 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 29 | . $ONOS_ROOT/tools/build/envDefaults |
8 | 30 | ... | ... |
tools/test/bin/onos-config
100755 → 100644
... | @@ -3,6 +3,28 @@ | ... | @@ -3,6 +3,28 @@ |
3 | # Remotely configures & starts ONOS for the first time. | 3 | # Remotely configures & starts ONOS for the first time. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | 5 | ||
6 | +function _usage () { | ||
7 | +cat << _EOF_ | ||
8 | +usage: | ||
9 | + $(basename $0) [node] | ||
10 | + | ||
11 | +options: | ||
12 | +- [node] : The node to configure | ||
13 | + | ||
14 | +summary: | ||
15 | + Remotely configures and starts ONOS for the first time. | ||
16 | + | ||
17 | + The procedure for configruing a node include determining base features, | ||
18 | + applications to load at startup, and clustering and logical network view | ||
19 | + configurations, among others. | ||
20 | + | ||
21 | + If [node] isn't specified, the defualt target becomes \$OCI. | ||
22 | + | ||
23 | +_EOF_ | ||
24 | +} | ||
25 | + | ||
26 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
27 | + | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 28 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 29 | . $ONOS_ROOT/tools/build/envDefaults |
8 | 30 | ... | ... |
tools/test/bin/onos-install
100755 → 100644
... | @@ -3,6 +3,32 @@ | ... | @@ -3,6 +3,32 @@ |
3 | # Remotely pushes bits to a remote node and installs ONOS on it. | 3 | # Remotely pushes bits to a remote node and installs ONOS on it. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | 5 | ||
6 | +function _usage () { | ||
7 | +cat << _EOF_ | ||
8 | +usage: | ||
9 | + $(basename $0) [-fn] [-m] <settings> [node] | ||
10 | + | ||
11 | +flags: | ||
12 | +- -f : forces uninstall of currently installed ONOS | ||
13 | +- -n : do not copy over onos.conf upstart configuration file. | ||
14 | +- -m <settings> : pass <settings> XML file to remote maven installation | ||
15 | + | ||
16 | +options: | ||
17 | +- [node] : remote node to install ONOS on. | ||
18 | + | ||
19 | +summary: | ||
20 | + Remotely pushes bits to a remote node and installs ONOS on it. | ||
21 | + | ||
22 | + The [-n] flag assumes that Upstart is used. The [-f] flag depends on | ||
23 | + and 'onos-config'. | ||
24 | + | ||
25 | + If [node] is not specified the default target is \$OCI. | ||
26 | + | ||
27 | +_EOF_ | ||
28 | +} | ||
29 | + | ||
30 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
31 | + | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 32 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 33 | . $ONOS_ROOT/tools/build/envDefaults |
8 | 34 | ... | ... |
tools/test/bin/onos-push-bits
100755 → 100644
... | @@ -2,6 +2,24 @@ | ... | @@ -2,6 +2,24 @@ |
2 | # ----------------------------------------------------------------------------- | 2 | # ----------------------------------------------------------------------------- |
3 | # Remotely pushes bits to a remote node in preparation for install. | 3 | # Remotely pushes bits to a remote node in preparation for install. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | +function _usage () { | ||
6 | +cat << _EOF_ | ||
7 | +usage: | ||
8 | + $(basename $0) [node] | ||
9 | + | ||
10 | +options: | ||
11 | +- [node] : the target node to prime for installation | ||
12 | + | ||
13 | +summary: | ||
14 | + Remotely pushes bits to a remote node in preparation for install. | ||
15 | + | ||
16 | + $(basename $0) is invoked as part of 'onos-install', and shouldn't be | ||
17 | + directly invoked for the most part. | ||
18 | + | ||
19 | +_EOF_ | ||
20 | +} | ||
21 | + | ||
22 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
5 | 23 | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 24 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 25 | . $ONOS_ROOT/tools/build/envDefaults | ... | ... |
tools/test/bin/onos-uninstall
100755 → 100644
... | @@ -3,6 +3,24 @@ | ... | @@ -3,6 +3,24 @@ |
3 | # Remotely stops & uninstalls ONOS on the specified node. | 3 | # Remotely stops & uninstalls ONOS on the specified node. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | 5 | ||
6 | +function _usage () { | ||
7 | +cat << _EOF_ | ||
8 | +usage: | ||
9 | + $(basename $0) [node] | ||
10 | + | ||
11 | +options: | ||
12 | +- [node] : The remote instance to uninstall ONOS from. | ||
13 | + | ||
14 | +summary: | ||
15 | + Remotely stops and uninstalls ONOS on the specified node. | ||
16 | + | ||
17 | + If [node] isn't specified, \$OCI becomes the target. | ||
18 | + | ||
19 | +_EOF_ | ||
20 | +} | ||
21 | + | ||
22 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
23 | + | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 24 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 25 | . $ONOS_ROOT/tools/build/envDefaults |
8 | 26 | ... | ... |
tools/test/bin/onos-watch
100755 → 100644
... | @@ -2,6 +2,30 @@ | ... | @@ -2,6 +2,30 @@ |
2 | # ----------------------------------------------------------------------------- | 2 | # ----------------------------------------------------------------------------- |
3 | # Monitors selected set of ONOS commands using the system watch command. | 3 | # Monitors selected set of ONOS commands using the system watch command. |
4 | # ----------------------------------------------------------------------------- | 4 | # ----------------------------------------------------------------------------- |
5 | +function _usage () { | ||
6 | +cat << _EOF_ | ||
7 | +usage: | ||
8 | + $(basename $0) [node] <commands> [watchflags] | ||
9 | + | ||
10 | +options: | ||
11 | +- [node] <commands> : the node to run the commands against | ||
12 | +- [watchflags] : flags to be passed to the watch command. | ||
13 | + | ||
14 | +summary: | ||
15 | + Monitors selected set of ONOS commands using the system watch command. | ||
16 | + | ||
17 | + <commands> is a comma-sepatarted list of ONOS CLI commands. If no commands | ||
18 | + are supplied, the commands run are 'summary', 'intents', 'flows', and | ||
19 | + 'hosts' against \$OCI. | ||
20 | + | ||
21 | + Note that [watchflags] only applies to platforms with the Linux-like watch | ||
22 | + command. For other platforms, the default behavior of watch (refresh every 2 | ||
23 | + s) is emulated. | ||
24 | + | ||
25 | +_EOF_ | ||
26 | +} | ||
27 | + | ||
28 | +[ "$1" = "-h" ] && _usage && exit 0 | ||
5 | 29 | ||
6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 30 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
7 | . $ONOS_ROOT/tools/build/envDefaults | 31 | . $ONOS_ROOT/tools/build/envDefaults |
... | @@ -14,4 +38,10 @@ aux=/tmp/onos-watch.$$ | ... | @@ -14,4 +38,10 @@ aux=/tmp/onos-watch.$$ |
14 | trap "rm -f $aux" EXIT | 38 | trap "rm -f $aux" EXIT |
15 | 39 | ||
16 | echo "$commands" | tr ',' '\n' > $aux | 40 | echo "$commands" | tr ',' '\n' > $aux |
17 | -watch $3 "onos $node -b <$aux 2>/dev/null" | 41 | + |
42 | +# emulate watch if not Linux. | ||
43 | +if [ "$(uname)" != "Linux" ]; then | ||
44 | + while clear; "onos $node -b <$aux 2>/dev/null" ; do sleep 2; done | ||
45 | +else | ||
46 | + watch $3 "onos $node -b <$aux 2>/dev/null" | ||
47 | +fi | ... | ... |
-
Please register or login to post a comment