Ray Milkey
Committed by Brian O'Connor

STC scenario for testing meta app behavior

Change-Id: I1b047624dd96383baee8f93e9f94052a4c5ff10a
1 +#!/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# Finds an app in the system.
4 +# -----------------------------------------------------------------------------
5 +
6 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
7 +. $ONOS_ROOT/tools/build/envDefaults
8 +
9 +aux=/tmp/stc-$$.log
10 +trap "rm -f $aux 2>/dev/null" EXIT
11 +
12 +echo onos-find-app: $*
13 +
14 +target=${1:-$OCI}
15 +app=$2
16 +id=$3
17 +set -x
18 +
19 +onos $target "onos:apps" | tee $aux
20 +appString=`cat $aux | grep "name=$app,"`
21 +
22 +if [ $? -ne 0 ]
23 +then
24 + exit 1;
25 +fi
26 +
27 +state='inactive'
28 +if [ appString != "" ]
29 +then
30 + if [[ ${appString:0:1} == '*' ]]
31 + then
32 + state='active'
33 + fi
34 + for token in '$appString'
35 + do
36 + if [[ $token =~ "id=" ]]
37 + then
38 + echo "@stc ${id}Id=${token}"
39 + fi
40 + done
41 + echo "@stc ${id}State=${state}"
42 + exit 0
43 +fi
44 +
45 +
46 +cat $aux
47 +exit 1
48 +
1 +<!--
2 + ~ Copyright 2016-present Open Networking Laboratory
3 + ~
4 + ~ Licensed under the Apache License, Version 2.0 (the "License");
5 + ~ you may not use this file except in compliance with the License.
6 + ~ You may obtain a copy of the License at
7 + ~
8 + ~ http://www.apache.org/licenses/LICENSE-2.0
9 + ~
10 + ~ Unless required by applicable law or agreed to in writing, software
11 + ~ distributed under the License is distributed on an "AS IS" BASIS,
12 + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + ~ See the License for the specific language governing permissions and
14 + ~ limitations under the License.
15 + -->
16 +<scenario name="meta-apps"
17 + description="Openflow provider activate/deactivate test">
18 +
19 +
20 + <!-- Check initial state of openflow apps -->
21 + <group name="MetaAppInitialVerification">
22 + <sequential var="${OC#}" starts="MetaAppTest.FindOpenflowInitial-${#}" ends="MetaAppTest.CheckLldpProviderInitial-${#-1}">
23 + <step name="MetaAppTest.FindOpenflowInitial-${#}"
24 + exec="onos-find-app ${OC#} org.onosproject.openflow openflowAppInitial" />
25 + <step name="MetaAppTest.CheckOpenflowInitial-${#}" requires="MetaAppTest.FindOpenflowInitial-${#}"
26 + exec="test '${openflowAppInitialState}' == 'active'"/>
27 +
28 + <step name="MetaAppTest.FindOpenflowBaseInitial-${#}"
29 + exec="onos-find-app ${OC#} org.onosproject.openflow-base openflowBaseInitial" />
30 + <step name="MetaAppTest.CheckOpenflowBaseInitial-${#}" requires="MetaAppTest.FindOpenflowBaseInitial-${#}"
31 + exec="test '${openflowBaseInitialState}' == 'active'"/>
32 +
33 + <step name="MetaAppTest.FindHostProviderInitial-${#}"
34 + exec="onos-find-app ${OC#} org.onosproject.hostprovider hostProviderInitial" />
35 + <step name="MetaAppTest.CheckHostProviderInitial-${#}" requires="MetaAppTest.FindHostProviderInitial-${#}"
36 + exec="test '${hostProviderInitialState}' == 'active'"/>
37 +
38 + <step name="MetaAppTest.FindLldpProviderInitial-${#}"
39 + exec="onos-find-app ${OC#} org.onosproject.lldpprovider lldpProviderInitial" />
40 + <step name="MetaAppTest.CheckLldpProviderInitial-${#}" requires="MetaAppTest.FindLldpProviderInitial-${#}"
41 + exec="test '${lldpProviderInitialState}' == 'active'"/>
42 + </sequential>
43 + </group>
44 +
45 + <!-- Deactivate openflow meta app -->
46 + <step name="MetaAppTest.DeactivateOpenflowMetaApp" requires="MetaAppInitialVerification"
47 + exec="onos ${OCI} onos:app deactivate org.onosproject.openflow"/>
48 +
49 + <!-- Check that openflow apps are no longer active -->
50 + <group name="MetaAppInactive" requires="MetaAppTest.DeactivateOpenflowMetaApp,MetaAppInitialVerification">
51 + <sequential var="${OC#}" starts="MetaAppTest.FindOpenflowInactive-${#}" ends="MetaAppTest.CheckLldpProviderInactive-${#-1}">
52 + <step name="MetaAppTest.FindOpenflowInactive-${#}"
53 + exec="onos-find-app ${OC#} org.onosproject.openflow openflowAppInactive" />
54 + <step name="MetaAppTest.CheckOpenflowInactive-${#}" requires="^"
55 + exec="test '${openflowAppInactiveState}' == 'inactive'"/>
56 +
57 + <step name="MetaAppTest.FindOpenflowBaseInactive-${#}" requires="^"
58 + exec="onos-find-app ${OC#} org.onosproject.openflow-base openflowBaseInactive" />
59 + <step name="MetaAppTest.CheckOpenflowBaseInactive-${#}" requires="^"
60 + exec="test '${openflowBaseInactiveState}' == 'inactive'"/>
61 +
62 + <step name="MetaAppTest.FindHostProviderInactive-${#}" requires="^"
63 + exec="onos-find-app ${OC#} org.onosproject.hostprovider hostProviderInactive" />
64 + <step name="MetaAppTest.CheckHostProviderInactive-${#}" requires="^"
65 + exec="test '${hostProviderInactiveState}' == 'inactive'"/>
66 +
67 + <step name="MetaAppTest.FindLldpProviderInactive-${#}" requires="^"
68 + exec="onos-find-app ${OC#} org.onosproject.lldpprovider lldpProviderInactive" />
69 + <step name="MetaAppTest.CheckLldpProviderInactive-${#}" requires="^"
70 + exec="test '${lldpProviderInactiveState}' == 'inactive'"/>
71 + </sequential>
72 + </group>
73 +
74 + <!-- Reactivate openflow meta app -->
75 + <step name="MetaAppTest.ReactivateOpenflowMetaApp" requires="MetaAppInactive"
76 + exec="onos ${OCI} onos:app activate org.onosproject.openflow"/>
77 +
78 + <!-- Check that openflow apps are now active again -->
79 + <group name="MetaAppReactivated" requires="MetaAppTest.ReactivateOpenflowMetaApp,MetaAppInactive,MetaAppInitialVerification">
80 + <sequential var="${OC#}" starts="MetaAppTest.FindOpenflowReactivated-${#}" ends="MetaAppTest.CheckLldpProviderRectivated-${#-1}">
81 + <step name="MetaAppTest.FindOpenflowReactivated-${#}"
82 + exec="onos-find-app ${OC#} org.onosproject.openflow openflowAppReactivated" />
83 + <step name="MetaAppTest.CheckOpenflowReactivated-${#}" requires="^"
84 + exec="test '${openflowAppReactivatedState}' == 'active'"/>
85 +
86 + <step name="MetaAppTest.FindOpenflowBaseReactivated-${#}" requires="^"
87 + exec="onos-find-app ${OC#} org.onosproject.openflow-base openflowBaseReactivated" />
88 + <step name="MetaAppTest.CheckOpenflowBaseReactivated-${#}" requires="^"
89 + exec="test '${openflowBaseReactivatedState}' == 'active'"/>
90 +
91 + <step name="MetaAppTest.FindHostProviderReactivated-${#}" requires="^"
92 + exec="onos-find-app ${OC#} org.onosproject.hostprovider hostProviderReactivated" />
93 + <step name="MetaAppTest.CheckHostProviderReactivated-${#}" requires="^"
94 + exec="test '${hostProviderReactivatedState}' == 'active'"/>
95 +
96 + <step name="MetaAppTest.FindLldpProviderReactivated-${#}" requires="^"
97 + exec="onos-find-app ${OC#} org.onosproject.lldpprovider lldpProviderReactivated" />
98 + <step name="MetaAppTest.CheckLldpProviderReactivated-${#}" requires="^"
99 + exec="test '${lldpProviderReactivatedState}' == 'active'"/>
100 + </sequential>
101 + </group>
102 +
103 +</scenario>
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
20 <import file="${ONOS_SCENARIOS}/setup.xml"/> 20 <import file="${ONOS_SCENARIOS}/setup.xml"/>
21 <dependency name="Setup" requires="Prerequisites,Net-Prerequisites"/> 21 <dependency name="Setup" requires="Prerequisites,Net-Prerequisites"/>
22 22
23 + <import file="${ONOS_SCENARIOS}/meta-apps-test.xml"/>
24 + <dependency name="MetaAppReactivated" requires="Setup"/>
25 + <dependency name="MetaAppInactive" requires="Setup"/>
26 + <dependency name="MetaAppInitialVerification" requires="Setup"/>
27 +
23 <import file="${ONOS_SCENARIOS}/net-smoke.xml"/> 28 <import file="${ONOS_SCENARIOS}/net-smoke.xml"/>
24 <dependency name="Net-Smoke" requires="Setup"/> 29 <dependency name="Net-Smoke" requires="Setup"/>
25 30
...@@ -30,5 +35,5 @@ ...@@ -30,5 +35,5 @@
30 <dependency name="Drivers-Test" requires="Setup,Net-Smoke,Archetypes"/> 35 <dependency name="Drivers-Test" requires="Setup,Net-Smoke,Archetypes"/>
31 36
32 <import file="${ONOS_SCENARIOS}/wrapup.xml"/> 37 <import file="${ONOS_SCENARIOS}/wrapup.xml"/>
33 - <dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke"/> 38 + <dependency name="Wrapup" requires="~Archetypes,~Setup,~Net-Smoke,~Drivers-Test,~MetaAppReactivated"/>
34 </scenario> 39 </scenario>
......