blob: bc2ac393c8bf3b6903f002ff91ab07d4ddc9387a [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 SR-pipeline-<branch>
21
Devin Limd1fb8e92018-02-28 16:29:33 -080022#!groovy
Devin Limf5175192018-05-14 19:13:22 -070023
24// read dependencies.
Devin Limb734ea52018-05-14 14:13:05 -070025funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
26test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
27fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080028
Devin Limf5175192018-05-14 19:13:22 -070029// init configuratin to be SR
Devin Limfe9a4cb2018-05-11 17:06:21 -070030fileRelated.init()
Devin Limd1fb8e92018-02-28 16:29:33 -080031funcs.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
39// read the TestON.property depends on which branch it is running. ( currently 1.13 and master on Fabric2, 1.12 on Fabric3 )
Devin Limd1fb8e92018-02-28 16:29:33 -080040def prop = null
41prop = funcs.getProperties()
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080042SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
43
Devin Limf5175192018-05-14 19:13:22 -070044// set the file paths and directory
Devin Limfe9a4cb2018-05-11 17:06:21 -070045graph_generator_file = fileRelated.trendIndividual
46graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
Jeremy Ronquillo14ecc172018-03-05 09:57:17 -080047
Devin Limf5175192018-05-14 19:13:22 -070048// get the list of the tests.
Devin Limd1fb8e92018-02-28 16:29:33 -080049echo( "Testcases:" )
50def testsToRun = null
51testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
52funcs.printTestToRun( testsToRun )
53
Devin Limf5175192018-05-14 19:13:22 -070054// save the functions to run test in the dictionary.
Devin Limd1fb8e92018-02-28 16:29:33 -080055def tests = [:]
56for( String test : SR.keySet() ){
57 toBeRun = testsToRun.contains( test )
58 def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
59 tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, SR, graph_generator_file, graph_saved_directory )
60}
61
Devin Limf5175192018-05-14 19:13:22 -070062// get start time
Devin Limd1fb8e92018-02-28 16:29:33 -080063start = funcs.getCurrentTime()
Devin Limf5175192018-05-14 19:13:22 -070064
65// run the tests sequentially
Devin Limd1fb8e92018-02-28 16:29:33 -080066for ( test in tests.keySet() ){
67 tests[ test ].call()
68}
69//funcs.generateOverallGraph( prop, SR, graph_saved_directory )
Devin Limf5175192018-05-14 19:13:22 -070070// send the notification of ending test after SR tests is done.
Devin Limc4054d52018-04-13 18:58:33 -070071funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )