From 6a07d2d622eaa06953f3353e39c080984076e8de Mon Sep 17 00:00:00 2001 From: Ashlee Young Date: Fri, 9 Oct 2015 18:32:44 -0700 Subject: Updated master to commit id 6ee8aa3e67ce89908a8c93aa9445c6f71a18f986 Change-Id: I94b055ee2f298daf71e2ec794fd0f2495bd8081f --- framework/src/onos/tools/test/bin/ogroup-opts | 2 +- framework/src/onos/tools/test/bin/onos | 21 ++++++++++++++ .../src/onos/tools/test/bin/onos-archetypes-test | 13 +++++++++ framework/src/onos/tools/test/bin/onos-batch | 22 +++++++++++++++ framework/src/onos/tools/test/bin/onos-config | 22 +++++++++++++++ framework/src/onos/tools/test/bin/onos-install | 26 ++++++++++++++++++ framework/src/onos/tools/test/bin/onos-push-bits | 18 ++++++++++++ framework/src/onos/tools/test/bin/onos-service | 1 - .../src/onos/tools/test/bin/onos-set-controllers | 2 +- framework/src/onos/tools/test/bin/onos-uninstall | 27 ++++++++++++++++-- framework/src/onos/tools/test/bin/onos-watch | 32 +++++++++++++++++++++- 11 files changed, 179 insertions(+), 7 deletions(-) (limited to 'framework/src/onos/tools/test/bin') diff --git a/framework/src/onos/tools/test/bin/ogroup-opts b/framework/src/onos/tools/test/bin/ogroup-opts index 41842bdd..f02b7a8f 100644 --- a/framework/src/onos/tools/test/bin/ogroup-opts +++ b/framework/src/onos/tools/test/bin/ogroup-opts @@ -44,7 +44,7 @@ function _cell-opts () { fi } -complete -F _cell-opts cell +complete -F _cell-opts cell vicell # Tab completion settings for onos-create-app. diff --git a/framework/src/onos/tools/test/bin/onos b/framework/src/onos/tools/test/bin/onos index 89197db5..780a90dc 100755 --- a/framework/src/onos/tools/test/bin/onos +++ b/framework/src/onos/tools/test/bin/onos @@ -3,6 +3,27 @@ # ONOS remote command-line client. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [-w] [node] + +flags: +- -w : Waits for ONOS instance to reach run-level 100, i.e. to be fully started. + +options: +- [node] : the node to attach to + +summary: + ONOS remote command-line client. + + The -w flag depends on 'onos-wait-for-start'. If [node] is unspecified, \$OCI + is used. + +_EOF_ +} +[ "$1" = "-h" ] && _usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults . $ONOS_ROOT/tools/test/bin/find-node.sh diff --git a/framework/src/onos/tools/test/bin/onos-archetypes-test b/framework/src/onos/tools/test/bin/onos-archetypes-test index 7ae00332..331c4332 100755 --- a/framework/src/onos/tools/test/bin/onos-archetypes-test +++ b/framework/src/onos/tools/test/bin/onos-archetypes-test @@ -3,6 +3,19 @@ # Builds a set of projects using ONOS archetypes. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) + +summary: + Builds a set of projects using ONOS archetypes. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 + set -e export AROOT=/tmp/foo diff --git a/framework/src/onos/tools/test/bin/onos-batch b/framework/src/onos/tools/test/bin/onos-batch index 67864a22..ae288916 100755 --- a/framework/src/onos/tools/test/bin/onos-batch +++ b/framework/src/onos/tools/test/bin/onos-batch @@ -3,6 +3,28 @@ # Executes selected set of ONOS commands using the batch mode. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [node] + +options: +- [node] : node to run + +summary: + Executes selected set of ONOS commands using the batch mode. + + is a comma-separated list of ONOS CLI commands. + + If [node] isn't specified, the defualt target becomes \$OCI. When no commands + are specified, the commands 'summary','intents','flows', and 'hosts' are + executed against \$OCI. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults diff --git a/framework/src/onos/tools/test/bin/onos-config b/framework/src/onos/tools/test/bin/onos-config index 5c3ab024..348cb839 100755 --- a/framework/src/onos/tools/test/bin/onos-config +++ b/framework/src/onos/tools/test/bin/onos-config @@ -3,6 +3,28 @@ # Remotely configures & starts ONOS for the first time. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [node] + +options: +- [node] : The node to configure + +summary: + Remotely configures and starts ONOS for the first time. + + The procedure for configruing a node include determining base features, + applications to load at startup, and clustering and logical network view + configurations, among others. + + If [node] isn't specified, the defualt target becomes \$OCI. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults diff --git a/framework/src/onos/tools/test/bin/onos-install b/framework/src/onos/tools/test/bin/onos-install index 7384c2e3..139944e4 100755 --- a/framework/src/onos/tools/test/bin/onos-install +++ b/framework/src/onos/tools/test/bin/onos-install @@ -3,6 +3,32 @@ # Remotely pushes bits to a remote node and installs ONOS on it. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [-fn] [-m] [node] + +flags: +- -f : forces uninstall of currently installed ONOS +- -n : do not copy over onos.conf upstart configuration file. +- -m : pass XML file to remote maven installation + +options: +- [node] : remote node to install ONOS on. + +summary: + Remotely pushes bits to a remote node and installs ONOS on it. + + The [-n] flag assumes that Upstart is used. The [-f] flag depends on + and 'onos-config'. + + If [node] is not specified the default target is \$OCI. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults diff --git a/framework/src/onos/tools/test/bin/onos-push-bits b/framework/src/onos/tools/test/bin/onos-push-bits index 8c9276fc..4d425c63 100755 --- a/framework/src/onos/tools/test/bin/onos-push-bits +++ b/framework/src/onos/tools/test/bin/onos-push-bits @@ -2,6 +2,24 @@ # ----------------------------------------------------------------------------- # Remotely pushes bits to a remote node in preparation for install. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [node] + +options: +- [node] : the target node to prime for installation + +summary: + Remotely pushes bits to a remote node in preparation for install. + + $(basename $0) is invoked as part of 'onos-install', and shouldn't be + directly invoked for the most part. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults diff --git a/framework/src/onos/tools/test/bin/onos-service b/framework/src/onos/tools/test/bin/onos-service index cc694911..35764e6f 100755 --- a/framework/src/onos/tools/test/bin/onos-service +++ b/framework/src/onos/tools/test/bin/onos-service @@ -34,7 +34,6 @@ fi case $2 in start|stop|restart|status) - # Select the target if [ "${1}" = "--cell" ]; then nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) diff --git a/framework/src/onos/tools/test/bin/onos-set-controllers b/framework/src/onos/tools/test/bin/onos-set-controllers index 5b3cd6f7..27cc16c8 100755 --- a/framework/src/onos/tools/test/bin/onos-set-controllers +++ b/framework/src/onos/tools/test/bin/onos-set-controllers @@ -6,7 +6,7 @@ controllers="" for node in $ONOS_INSTANCES; do - controllers="$controllers tcp:$node:${OF_PORT:-6633}" + controllers="$controllers tcp:$node:${OF_PORT:-6653}" done ssh ${ONOS_USER:-sdn}@$OCN " diff --git a/framework/src/onos/tools/test/bin/onos-uninstall b/framework/src/onos/tools/test/bin/onos-uninstall index 7a8b9a5f..ff8ff536 100755 --- a/framework/src/onos/tools/test/bin/onos-uninstall +++ b/framework/src/onos/tools/test/bin/onos-uninstall @@ -3,6 +3,24 @@ # Remotely stops & uninstalls ONOS on the specified node. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [node] + +options: +- [node] : The remote instance to uninstall ONOS from. + +summary: + Remotely stops and uninstalls ONOS on the specified node. + + If [node] isn't specified, \$OCI becomes the target. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults @@ -16,9 +34,12 @@ ssh $remote " [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] && break sleep 1 done - [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] || echo 'ONOS failed to stop.' + [ -z \"\$(ps -ef | grep karaf.jar | grep -v grep)\" ] || \ + (echo 'ONOS failed to stop.'; status=1) # Remove onos directory and init file - sudo rm -fr $ONOS_INSTALL_DIR - [ -f /etc/init/onos.conf ] && sudo rm /etc/init/onos.conf + [ -d $ONOS_INSTALL_DIR ] && sudo rm -fr $ONOS_INSTALL_DIR + [ -f /etc/init/onos.conf ] && sudo rm -f /etc/init/onos.conf + + exit \${status:-0}; " diff --git a/framework/src/onos/tools/test/bin/onos-watch b/framework/src/onos/tools/test/bin/onos-watch index 28e88c2f..11962f9e 100755 --- a/framework/src/onos/tools/test/bin/onos-watch +++ b/framework/src/onos/tools/test/bin/onos-watch @@ -2,6 +2,30 @@ # ----------------------------------------------------------------------------- # Monitors selected set of ONOS commands using the system watch command. # ----------------------------------------------------------------------------- +function _usage () { +cat << _EOF_ +usage: + $(basename $0) [node] [watchflags] + +options: +- [node] : the node to run the commands against +- [watchflags] : flags to be passed to the watch command. + +summary: + Monitors selected set of ONOS commands using the system watch command. + + is a comma-sepatarted list of ONOS CLI commands. If no commands + are supplied, the commands run are 'summary', 'intents', 'flows', and + 'hosts' against \$OCI. + + Note that [watchflags] only applies to platforms with the Linux-like watch + command. For other platforms, the default behavior of watch (refresh every 2 + s) is emulated. + +_EOF_ +} + +[ "$1" = "-h" ] && _usage && exit 0 [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults @@ -14,4 +38,10 @@ aux=/tmp/onos-watch.$$ trap "rm -f $aux" EXIT echo "$commands" | tr ',' '\n' > $aux -watch $3 "onos $node -b <$aux 2>/dev/null" + +# emulate watch if not Linux. +if [ "$(uname)" != "Linux" ]; then + while clear; "onos $node -b <$aux 2>/dev/null" ; do sleep 2; done +else + watch $3 "onos $node -b <$aux 2>/dev/null" +fi -- cgit 1.2.3-korg