blob: a890608b88bbf83437845b5f8f1d4f78097a16eb [file] [log] [blame]
Devin Limf5175192018-05-14 19:13:22 -07001// Copyright 2017 Open Networking Foundation (ONF)
2//
3// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
4// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
5// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
6//
7// TestON is free software: you can redistribute it and/or modify
8// it under the terms of the GNU General Public License as published by
9// the Free Software Foundation, either version 2 of the License, or
10// (at your option) any later version.
11//
12// TestON is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with TestON. If not, see <http://www.gnu.org/licenses/>.
19
20// This is the Jenkins script for SCPF-pipeline-<branch>
21
Devin Lim90803a82017-08-29 13:41:44 -070022#!groovy
Devin Limf5175192018-05-14 19:13:22 -070023
24// read the dependency files
Devin Limb734ea52018-05-14 14:13:05 -070025SCPFfuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy' )
Devin Lim61643762017-12-07 15:55:38 -080026SCPFfuncs.init()
Devin Limb734ea52018-05-14 14:13:05 -070027funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
Devin Limf5175192018-05-14 19:13:22 -070028
29// init funcs with SCPF specificaton
Devin Lim61643762017-12-07 15:55:38 -080030funcs.initialize( "SCPF", SCPFfuncs );
Devin Limf5175192018-05-14 19:13:22 -070031
32// read the information from TestON.property on BM
Devin Lim90803a82017-08-29 13:41:44 -070033def prop = null
Devin Lim61643762017-12-07 15:55:38 -080034prop = funcs.getProperties()
35
Devin Limf5175192018-05-14 19:13:22 -070036// get the list of the test to run.
Devin Lim61643762017-12-07 15:55:38 -080037echo( "Testcases:" )
38def testsToRun = null
39testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
40funcs.printTestToRun( testsToRun )
41
Devin Limf5175192018-05-14 19:13:22 -070042// check if it is using old flow.
Devin Limc49c3732018-04-10 18:57:17 -070043isOldFlow = prop[ "isOldFlow" ] == "true"
Devin Lim61643762017-12-07 15:55:38 -080044SCPFfuncs.oldFlowRuleCheck( isOldFlow, prop[ "ONOSBranch" ] )
Devin Limf5175192018-05-14 19:13:22 -070045
46// set test to run as a list of function
Devin Lim90803a82017-08-29 13:41:44 -070047def tests = [:]
Devin Lim61643762017-12-07 15:55:38 -080048for( String test : SCPFfuncs.SCPF.keySet() ){
Devin Lim90803a82017-08-29 13:41:44 -070049 toBeRun = testsToRun.contains( test )
50 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
Devin Lim61643762017-12-07 15:55:38 -080051
52 pureTestName = test.replaceAll( "WithFlowObj", "" )
53 tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false, SCPFfuncs.SCPF, "", "" )
Devin Lim90803a82017-08-29 13:41:44 -070054}
55
Devin Limf5175192018-05-14 19:13:22 -070056// get start time
Devin Lim61643762017-12-07 15:55:38 -080057start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070058// run the tests sequentially
Devin Lim90803a82017-08-29 13:41:44 -070059for ( test in tests.keySet() ){
Devin Lim61643762017-12-07 15:55:38 -080060 tests[ test ].call()
Devin Lim90803a82017-08-29 13:41:44 -070061}
Devin Limf5175192018-05-14 19:13:22 -070062
63// send result to slack after running test is done.
Devin Limc49c3732018-04-10 18:57:17 -070064funcs.sendResultToSlack( start, prop["manualRun"], prop[ "WikiPrefix" ] )