blob: e4af10935d4156024b724680052ea2560c568b28 [file] [log] [blame]
Devin Lime1346f42018-05-15 15:41:36 -07001#!groovy
Devin Limf5175192018-05-14 19:13:22 -07002// Copyright 2017 Open Networking Foundation (ONF)
3//
4// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
7//
8// TestON is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License as published by
10// the Free Software Foundation, either version 2 of the License, or
11// (at your option) any later version.
12//
13// TestON is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with TestON. If not, see <http://www.gnu.org/licenses/>.
20
21// This is the Jenkins script for SR-pipeline-<branch>
22
Devin Limf5175192018-05-14 19:13:22 -070023// read dependencies.
Devin Limb734ea52018-05-14 14:13:05 -070024funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
Jeremy Ronquillo64eeeb12019-05-13 11:19:46 -070025test_list = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
Devin Limb734ea52018-05-14 14:13:05 -070026fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080027
Jon Hall2ee92f82018-06-07 13:07:33 -070028// init configuration to be SR
Devin Limfe9a4cb2018-05-11 17:06:21 -070029fileRelated.init()
Jeremy Ronquillo64eeeb12019-05-13 11:19:46 -070030test_list.init()
Jon Hall2ee92f82018-06-07 13:07:33 -070031funcs.initialize( "SR" )
Devin Limf5175192018-05-14 19:13:22 -070032
33// get the name of the Jenkins job.
Devin Lim35df4e62018-04-06 17:58:58 -070034jobName = env.JOB_NAME
Devin Limf5175192018-05-14 19:13:22 -070035
36// additional setup for Segment routing because it is running multiple branch concurrently on different machines.
Devin Limc4054d52018-04-13 18:58:33 -070037funcs.additionalInitForSR( jobName )
Devin Limf5175192018-05-14 19:13:22 -070038
Jon Hall6af749d2018-05-29 12:59:47 -070039// read the TestON.property depends on which branch it is running.
You Wangf043d0a2019-04-22 16:30:40 -070040// ( currently master on Fabric4, 1.15 on Fabric2 and 2.1 on Fabric3 )
Devin Limd1fb8e92018-02-28 16:29:33 -080041def prop = null
42prop = funcs.getProperties()
Jeremy Ronquillo64eeeb12019-05-13 11:19:46 -070043SR_tests = test_list.getTestsFromCategory( "SR" )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080044
Devin Limf5175192018-05-14 19:13:22 -070045// set the file paths and directory
Devin Limfe9a4cb2018-05-11 17:06:21 -070046graph_generator_file = fileRelated.trendIndividual
47graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080048
Devin Limf5175192018-05-14 19:13:22 -070049// get the list of the tests.
Devin Limd1fb8e92018-02-28 16:29:33 -080050echo( "Testcases:" )
51def testsToRun = null
52testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
53funcs.printTestToRun( testsToRun )
54
Devin Limf5175192018-05-14 19:13:22 -070055// save the functions to run test in the dictionary.
Jon Hall6af749d2018-05-29 12:59:47 -070056def tests = [ : ]
Jeremy Ronquillo64eeeb12019-05-13 11:19:46 -070057for ( String test : SR_tests.keySet() ){
Devin Limd1fb8e92018-02-28 16:29:33 -080058 toBeRun = testsToRun.contains( test )
59 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
Jeremy Ronquillo64eeeb12019-05-13 11:19:46 -070060 def pureTestName = ( SR_tests[ test ].containsKey( "test" ) ? SR_tests[ test ][ "test" ].split().head() : test )
Jon Halle5da90a2018-06-14 12:26:00 -070061 tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false,
Jeremy Ronquillo64eeeb12019-05-13 11:19:46 -070062 SR_tests, graph_generator_file, graph_saved_directory )
Devin Limd1fb8e92018-02-28 16:29:33 -080063}
64
Devin Limf5175192018-05-14 19:13:22 -070065// get start time
Devin Limd1fb8e92018-02-28 16:29:33 -080066start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070067
68// run the tests sequentially
Devin Limd1fb8e92018-02-28 16:29:33 -080069for ( test in tests.keySet() ){
70 tests[ test ].call()
71}
72//funcs.generateOverallGraph( prop, SR, graph_saved_directory )
Devin Limf5175192018-05-14 19:13:22 -070073// send the notification of ending test after SR tests is done.
Jon Hall6af749d2018-05-29 12:59:47 -070074funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )