diff options
Diffstat (limited to 'framework/src/onos/tools/test/bin')
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-archetypes-test | 2 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-check-intent | 2 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-check-logs | 20 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-install | 2 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-start-network | 26 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-topo-cfg | 3 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/onos-uninstall | 10 | ||||
-rwxr-xr-x | framework/src/onos/tools/test/bin/stc | 16 |
8 files changed, 72 insertions, 9 deletions
diff --git a/framework/src/onos/tools/test/bin/onos-archetypes-test b/framework/src/onos/tools/test/bin/onos-archetypes-test index 55f40e76..7ae00332 100755 --- a/framework/src/onos/tools/test/bin/onos-archetypes-test +++ b/framework/src/onos/tools/test/bin/onos-archetypes-test @@ -6,7 +6,7 @@ set -e export AROOT=/tmp/foo -export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -DarchetypeVersion=1.3.0-SNAPSHOT" +export ARCHETYPE_OPTS="-DarchetypeGroupId=org.onosproject -DarchetypeVersion=1.4.0-SNAPSHOT" mkdir -p $AROOT for an in api bundle cli ui; do diff --git a/framework/src/onos/tools/test/bin/onos-check-intent b/framework/src/onos/tools/test/bin/onos-check-intent index e332dc5b..760afafe 100755 --- a/framework/src/onos/tools/test/bin/onos-check-intent +++ b/framework/src/onos/tools/test/bin/onos-check-intent @@ -13,7 +13,7 @@ target=${1:-$OCI} echo onos-check-intent: $* set -x -for i in {1..10}; do +for i in {1..15}; do onos $target "onos:intents" | tee $aux ( cat $aux | grep "key=$2" | grep "state=$3" ) && cat $aux && exit 0 sleep 1 diff --git a/framework/src/onos/tools/test/bin/onos-check-logs b/framework/src/onos/tools/test/bin/onos-check-logs index ec1013ab..40e3e106 100755 --- a/framework/src/onos/tools/test/bin/onos-check-logs +++ b/framework/src/onos/tools/test/bin/onos-check-logs @@ -3,6 +3,25 @@ # Checks the logs of the remote ONOS instance and makes sure they are clean. # ----------------------------------------------------------------------------- +function __usage() { +cat << _EOM_ + +usage: + $(basename $0) [node] ['old'] + +options: + - [node] : The node whose logs to inspect. The default is \$OCI. + - ['old'] : If 'old' is specified, the logs are simply searched for errors + and exceptions, and they are displayed. + +summary: + Checks the logs of the remote ONOS instance and makes sure they are clean. + +_EOM_ +} + +[ "$1" = "-h" ] && __usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults @@ -17,6 +36,7 @@ if [ "$2" = "old" ]; then else ssh $remote " + [ "'`uname`'" != "'"Linux"'" ] && alias tac='tail -r' tac $LOG | awk ' BEGIN { off = 0; fail = 0; } / org.apache.karaf.main.lock.SimpleFileLock lock/ { diff --git a/framework/src/onos/tools/test/bin/onos-install b/framework/src/onos/tools/test/bin/onos-install index 0f4cc9dd..7384c2e3 100755 --- a/framework/src/onos/tools/test/bin/onos-install +++ b/framework/src/onos/tools/test/bin/onos-install @@ -43,7 +43,7 @@ ssh $remote " mkdir -p -- $ONOS_INSTALL_DIR/$KARAF_DIST/data/raft # Install the upstart configuration file and setup options for debugging - [ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/debian/onos.conf /etc/init/onos.conf + [ -z "$nostart" ] && sudo cp $ONOS_INSTALL_DIR/init/onos.conf /etc/init/onos.conf echo 'export ONOS_OPTS=debug' > $ONOS_INSTALL_DIR/options # Setup correct user to run onos-service diff --git a/framework/src/onos/tools/test/bin/onos-start-network b/framework/src/onos/tools/test/bin/onos-start-network index 1e162fb4..5412e096 100755 --- a/framework/src/onos/tools/test/bin/onos-start-network +++ b/framework/src/onos/tools/test/bin/onos-start-network @@ -1,17 +1,39 @@ #!/bin/bash # ----------------------------------------------------------------------------- -# Verifies connectivity to each node in ONOS cell. +# Starts a Mininet network topology connected to all nodes in a cell. # ----------------------------------------------------------------------------- +function __usage() { +cat << _EOM_ + +usage: + $(basename $0) [file] + +options: + - [file] : a Mininet topology file. Default is *sol.py* . + +summary: + Starts a Mininet network topology connected to all nodes in a cell. + + Currently, all topology files are assumed to be found in + \$OCN's ~/topos directory. Therefore [file] must be specified as + topos/filename. + +_EOM_ +} + +[ "$1" = "-h" ] && __usage && exit 0 + [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 . $ONOS_ROOT/tools/build/envDefaults SSHCMD="ssh -o PasswordAuthentication=no" SCPCMD="scp -q -o PasswordAuthentication=no" +topo=${1:-topos/sol.py} echo "Copying topology files to mininet vm." $SSHCMD -n $ONOS_USER@$OCN mkdir -p topos $SCPCMD $ONOS_ROOT/tools/test/topos/* $ONOS_USER@$OCN:topos/ echo "Starting Network." -$SSHCMD -t $ONOS_USER@$OCN sudo python topos/sol.py $(env | sort | egrep "OC[0-9]+" | cut -d= -f2) +$SSHCMD -t $ONOS_USER@$OCN sudo python $topo $(env | sort | egrep "OC[0-9]+" | cut -d= -f2) diff --git a/framework/src/onos/tools/test/bin/onos-topo-cfg b/framework/src/onos/tools/test/bin/onos-topo-cfg index 5f40d8e7..489083f7 100755 --- a/framework/src/onos/tools/test/bin/onos-topo-cfg +++ b/framework/src/onos/tools/test/bin/onos-topo-cfg @@ -8,7 +8,8 @@ node="${1:-$OCI}" file="${2:-$ONOS_ROOT/tools/test/topos/oe-linear-3.json}" +url="${3:-config/topology}" curl -sS --fail -L --user $ONOS_WEB_USER:$ONOS_WEB_PASS \ -X POST -H 'Content-Type:application/json' \ - http://$node:8181/onos/v1/config/topology -d@$file + http://$node:8181/onos/v1/${url} -d@$file diff --git a/framework/src/onos/tools/test/bin/onos-uninstall b/framework/src/onos/tools/test/bin/onos-uninstall index c04db7ac..7a8b9a5f 100755 --- a/framework/src/onos/tools/test/bin/onos-uninstall +++ b/framework/src/onos/tools/test/bin/onos-uninstall @@ -10,5 +10,15 @@ remote=$ONOS_USER@${1:-$OCI} ssh $remote " sudo stop onos 1>/dev/null 2>/dev/null + + # Wait for onos to stop up to 5 seconds + for i in \$(seq 1 5); do + [ -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.' + + # Remove onos directory and init file sudo rm -fr $ONOS_INSTALL_DIR + [ -f /etc/init/onos.conf ] && sudo rm /etc/init/onos.conf " diff --git a/framework/src/onos/tools/test/bin/stc b/framework/src/onos/tools/test/bin/stc index fe8a5afe..8737cf3f 100755 --- a/framework/src/onos/tools/test/bin/stc +++ b/framework/src/onos/tools/test/bin/stc @@ -3,7 +3,7 @@ # System Test Coordinator #------------------------------------------------------------------------------- -VER=1.3.0-SNAPSHOT +VER=1.4.0-SNAPSHOT JAR=~/.m2/repository/org/onosproject/onlab-stc/$VER/onlab-stc-$VER.jar SCENARIOS=$ONOS_ROOT/tools/test/scenarios @@ -15,9 +15,19 @@ scenario=${1:-smoke} [ ! -f $scenario ] && scenario=$scenario.xml [ ! -f $scenario ] && echo "Scenario $scenario file not found" && exit 1 +# Remove the test name from the list of parameters, if one is specified [ $# -ge 1 ] && shift -[ -t 1 ] && stcColor=true || unset stcColor +# If stcColor is not set, we will enable color if this is an interactive session +[ -t 1 ] && interactive=true || interactive=false +# stc requires that ONOS_USE_SSH=true, but we will store the old value and reset it after +sshSet=$([ -z ${ONOS_USE_SSH+x} ]) && oldSSH=$ONOS_USE_SSH +export ONOS_USE_SSH=true + +# Run stc [ -z "$stcDebug" ] && DEBUG_OPTS="" -java $DEBUG_OPTS -jar $JAR $scenario "$@" +stcColor=${stcColor:-$interactive} java $DEBUG_OPTS -jar $JAR $scenario "$@" + +# Reset the old value of ONOS_USE_SSH +[ $sshSet ] && export ONOS_USE_SSH=oldSSH || unset ONOS_USE_SSH |