Ray Milkey

STC scenario for testing meta app behavior

Change-Id: I1b047624dd96383baee8f93e9f94052a4c5ff10a
#!/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
<!--
~ Copyright 2016-present Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<scenario name="meta-apps"
description="Openflow provider activate/deactivate test">
<!-- Check initial state of openflow apps -->
<group name="MetaAppInitialVerification">
<sequential var="${OC#}" starts="MetaAppTest.FindOpenflowInitial-${#}" ends="MetaAppTest.CheckLldpProviderInitial-${#-1}">
<step name="MetaAppTest.FindOpenflowInitial-${#}"
exec="onos-find-app ${OC#} org.onosproject.openflow openflowAppInitial" />
<step name="MetaAppTest.CheckOpenflowInitial-${#}" requires="MetaAppTest.FindOpenflowInitial-${#}"
exec="test '${openflowAppInitialState}' == 'active'"/>
<step name="MetaAppTest.FindOpenflowBaseInitial-${#}"
exec="onos-find-app ${OC#} org.onosproject.openflow-base openflowBaseInitial" />
<step name="MetaAppTest.CheckOpenflowBaseInitial-${#}" requires="MetaAppTest.FindOpenflowBaseInitial-${#}"
exec="test '${openflowBaseInitialState}' == 'active'"/>
<step name="MetaAppTest.FindHostProviderInitial-${#}"
exec="onos-find-app ${OC#} org.onosproject.hostprovider hostProviderInitial" />
<step name="MetaAppTest.CheckHostProviderInitial-${#}" requires="MetaAppTest.FindHostProviderInitial-${#}"
exec="test '${hostProviderInitialState}' == 'active'"/>
<step name="MetaAppTest.FindLldpProviderInitial-${#}"
exec="onos-find-app ${OC#} org.onosproject.lldpprovider lldpProviderInitial" />
<step name="MetaAppTest.CheckLldpProviderInitial-${#}" requires="MetaAppTest.FindLldpProviderInitial-${#}"
exec="test '${lldpProviderInitialState}' == 'active'"/>
</sequential>
</group>
<!-- Deactivate openflow meta app -->
<step name="MetaAppTest.DeactivateOpenflowMetaApp" requires="MetaAppInitialVerification"
exec="onos ${OCI} onos:app deactivate org.onosproject.openflow"/>
<!-- Check that openflow apps are no longer active -->
<group name="MetaAppInactive" requires="MetaAppTest.DeactivateOpenflowMetaApp,MetaAppInitialVerification">
<sequential var="${OC#}" starts="MetaAppTest.FindOpenflowInactive-${#}" ends="MetaAppTest.CheckLldpProviderInactive-${#-1}">
<step name="MetaAppTest.FindOpenflowInactive-${#}"
exec="onos-find-app ${OC#} org.onosproject.openflow openflowAppInactive" />
<step name="MetaAppTest.CheckOpenflowInactive-${#}" requires="^"
exec="test '${openflowAppInactiveState}' == 'inactive'"/>
<step name="MetaAppTest.FindOpenflowBaseInactive-${#}" requires="^"
exec="onos-find-app ${OC#} org.onosproject.openflow-base openflowBaseInactive" />
<step name="MetaAppTest.CheckOpenflowBaseInactive-${#}" requires="^"
exec="test '${openflowBaseInactiveState}' == 'inactive'"/>
<step name="MetaAppTest.FindHostProviderInactive-${#}" requires="^"
exec="onos-find-app ${OC#} org.onosproject.hostprovider hostProviderInactive" />
<step name="MetaAppTest.CheckHostProviderInactive-${#}" requires="^"
exec="test '${hostProviderInactiveState}' == 'inactive'"/>
<step name="MetaAppTest.FindLldpProviderInactive-${#}" requires="^"
exec="onos-find-app ${OC#} org.onosproject.lldpprovider lldpProviderInactive" />
<step name="MetaAppTest.CheckLldpProviderInactive-${#}" requires="^"
exec="test '${lldpProviderInactiveState}' == 'inactive'"/>
</sequential>
</group>
<!-- Reactivate openflow meta app -->
<step name="MetaAppTest.ReactivateOpenflowMetaApp" requires="MetaAppInactive"
exec="onos ${OCI} onos:app activate org.onosproject.openflow"/>
<!-- Check that openflow apps are now active again -->
<group name="MetaAppReactivated" requires="MetaAppTest.ReactivateOpenflowMetaApp,MetaAppInactive,MetaAppInitialVerification">
<sequential var="${OC#}" starts="MetaAppTest.FindOpenflowReactivated-${#}" ends="MetaAppTest.CheckLldpProviderRectivated-${#-1}">
<step name="MetaAppTest.FindOpenflowReactivated-${#}"
exec="onos-find-app ${OC#} org.onosproject.openflow openflowAppReactivated" />
<step name="MetaAppTest.CheckOpenflowReactivated-${#}" requires="^"
exec="test '${openflowAppReactivatedState}' == 'active'"/>
<step name="MetaAppTest.FindOpenflowBaseReactivated-${#}" requires="^"
exec="onos-find-app ${OC#} org.onosproject.openflow-base openflowBaseReactivated" />
<step name="MetaAppTest.CheckOpenflowBaseReactivated-${#}" requires="^"
exec="test '${openflowBaseReactivatedState}' == 'active'"/>
<step name="MetaAppTest.FindHostProviderReactivated-${#}" requires="^"
exec="onos-find-app ${OC#} org.onosproject.hostprovider hostProviderReactivated" />
<step name="MetaAppTest.CheckHostProviderReactivated-${#}" requires="^"
exec="test '${hostProviderReactivatedState}' == 'active'"/>
<step name="MetaAppTest.FindLldpProviderReactivated-${#}" requires="^"
exec="onos-find-app ${OC#} org.onosproject.lldpprovider lldpProviderReactivated" />
<step name="MetaAppTest.CheckLldpProviderReactivated-${#}" requires="^"
exec="test '${lldpProviderReactivatedState}' == 'active'"/>
</sequential>
</group>
</scenario>
......@@ -20,6 +20,11 @@
<import file="${ONOS_SCENARIOS}/setup.xml"/>
<dependency name="Setup" requires="Prerequisites,Net-Prerequisites"/>
<import file="${ONOS_SCENARIOS}/meta-apps-test.xml"/>
<dependency name="MetaAppReactivated" requires="Setup"/>
<dependency name="MetaAppInactive" requires="Setup"/>
<dependency name="MetaAppInitialVerification" requires="Setup"/>
<import file="${ONOS_SCENARIOS}/net-smoke.xml"/>
<dependency name="Net-Smoke" requires="Setup"/>
......@@ -30,5 +35,5 @@
<dependency name="Drivers-Test" requires="Setup,Net-Smoke,Archetypes"/>
<import file="${ONOS_SCENARIOS}/wrapup.xml"/>
<dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke"/>
<dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke,~Drivers-Test,~MetaAppReactivated"/>
</scenario>
......