From 97dfd1ec9f28287d3d4530b74d64cbfa540a0c99 Mon Sep 17 00:00:00 2001 From: Ray Milkey Date: Mon, 20 Jun 2016 17:04:19 -0700 Subject: [PATCH] STC scenario for testing meta app behavior Change-Id: I1b047624dd96383baee8f93e9f94052a4c5ff10a --- tools/test/bin/onos-find-app | 48 +++++++++++ tools/test/scenarios/meta-apps-test.xml | 103 ++++++++++++++++++++++++ tools/test/scenarios/smoke.xml | 7 +- 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100755 tools/test/bin/onos-find-app create mode 100644 tools/test/scenarios/meta-apps-test.xml diff --git a/tools/test/bin/onos-find-app b/tools/test/bin/onos-find-app new file mode 100755 index 0000000000..4f3acce7e6 --- /dev/null +++ b/tools/test/bin/onos-find-app @@ -0,0 +1,48 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Finds an app in the system. +# ----------------------------------------------------------------------------- + +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 +. $ONOS_ROOT/tools/build/envDefaults + +aux=/tmp/stc-$$.log +trap "rm -f $aux 2>/dev/null" EXIT + +echo onos-find-app: $* + +target=${1:-$OCI} +app=$2 +id=$3 +set -x + +onos $target "onos:apps" | tee $aux +appString=`cat $aux | grep "name=$app,"` + +if [ $? -ne 0 ] +then + exit 1; +fi + +state='inactive' +if [ appString != "" ] +then + if [[ ${appString:0:1} == '*' ]] + then + state='active' + fi + for token in '$appString' + do + if [[ $token =~ "id=" ]] + then + echo "@stc ${id}Id=${token}" + fi + done + echo "@stc ${id}State=${state}" + exit 0 +fi + + +cat $aux +exit 1 + diff --git a/tools/test/scenarios/meta-apps-test.xml b/tools/test/scenarios/meta-apps-test.xml new file mode 100644 index 0000000000..91624f1307 --- /dev/null +++ b/tools/test/scenarios/meta-apps-test.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/test/scenarios/smoke.xml b/tools/test/scenarios/smoke.xml index f0de23bcc8..dce57c5fa6 100644 --- a/tools/test/scenarios/smoke.xml +++ b/tools/test/scenarios/smoke.xml @@ -20,6 +20,11 @@ + + + + + @@ -30,5 +35,5 @@ - +