blob: 54cec8028815fb9820ea52e8dbce8fd09e379991 [file] [log] [blame]
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -07001#!groovy
2// 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
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070021import groovy.time.TimeCategory
22import groovy.time.TimeDuration
23
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070024// read the dependency files
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070025graphs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsGraphs.groovy' )
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070026test_list = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
27fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
28SCPFfuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy' )
29
30category = null
31prop = null
Jeremy Ronquilloa8490fb2019-06-26 11:59:50 -070032testsToRunStrList = null
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070033branch = null
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070034branchWithPrefix = null
Jeremy Ronquilloa8490fb2019-06-26 11:59:50 -070035start = null
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070036nodeLabel = null
Jeremy Ronquillo6fbfdd52019-07-09 13:49:34 -070037testStation = null
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070038testsOverride = null
39isGraphOnly = false
40isSCPF = false
Jeremy Ronquillo6da78cf2019-07-29 11:47:19 -070041pipelineTimeout = null
42
Jon Hallf29368d2020-07-31 12:23:56 -070043testsToRun = [:]
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070044testsFromList = [:]
45graphPaths = [:]
46pipeline = [:]
47
48main()
49
50def main(){
Jeremy Ronquillo892c1732019-07-29 15:22:57 -070051 pipelineTimeout = params.TimeOut.toInteger() // integer minutes until the entire pipeline times out. Usually passed from upstream master-trigger job.
Jeremy Ronquillo6da78cf2019-07-29 11:47:19 -070052 timeout( time: pipelineTimeout, unit: "MINUTES" ){
Jeremy Ronquillo892c1732019-07-29 15:22:57 -070053 init()
Jeremy Ronquillo6da78cf2019-07-29 11:47:19 -070054 runTests()
55 generateGraphs()
56 sendToSlack()
57 }
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070058}
59
60def init(){
61 fileRelated.init()
62 test_list.init()
63 readParams()
64
Jeremy Ronquillob8aac442019-07-31 13:28:01 -070065 if ( branch == "manually" ){
66 echo '''Warning: entered branch was: "manually". Defaulting to master branch.'''
67 branch = "master"
68 branchWithPrefix = test_list.addPrefixToBranch( branch )
69 }
70
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070071 if ( category == "SCPF" ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070072 isSCPF = true
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070073 SCPFfuncs.init()
Jeremy Ronquillo442ce4d2019-07-26 16:35:11 -070074 graphs.initialize( SCPFfuncs );
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070075 prop = getProperties()
76 isOldFlow = ( prop[ "isOldFlow" ] == "true" )
Jeremy Ronquilloa8490fb2019-06-26 11:59:50 -070077 SCPFfuncs.oldFlowRuleCheck( isOldFlow, prop[ "ONOSBranch" ] )
Jeremy Ronquilloa8490fb2019-06-26 11:59:50 -070078 } else {
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070079 isSCPF = false
80 graphs.initialize()
81 prop = getProperties()
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070082 }
83
Jeremy Ronquillob8aac442019-07-31 13:28:01 -070084 // get the list of the tests from category
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070085 testsFromList = test_list.getTestsFromCategory( category )
86
87 initGraphPaths()
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070088 tokenizeTokens = "\n;, "
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070089
Jeremy Ronquillo336110a2019-07-11 14:20:40 -070090 if ( testsOverride == "" || testsOverride == null ){
91 testsToRunStrList = prop[ "Tests" ].tokenize( tokenizeTokens )
92 } else {
93 testsToRunStrList = testsOverride.tokenize( tokenizeTokens )
94 }
Jeremy Ronquilloa8490fb2019-06-26 11:59:50 -070095 testsToRun = test_list.getTestsFromStringList( testsToRunStrList )
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -070096}
97
98def readParams(){
Jeremy Ronquillo6fbfdd52019-07-09 13:49:34 -070099 category = params.Category // "FUNC", "HA", "USECASE", etc.
100 branch = params.Branch // "1.15", "2.1", "master", etc.
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700101 branchWithPrefix = test_list.addPrefixToBranch( branch )
Jeremy Ronquillo6fbfdd52019-07-09 13:49:34 -0700102 testStation = params.TestStation // "TestStation-BMs", etc.
103 nodeLabel = params.NodeLabel // "BM", "VM", "Fabric-1.x", etc.
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700104 testsOverride = params.TestsOverride // "FUNCflow, FUNCintent, [...]", overrides property file
105 isGraphOnly = params.OnlyRefreshGraphs // true or false
106}
107
108def getProperties(){
109 // get the properties of the test by reading the TestONOS.property
110
111 filePath = '''/var/jenkins/TestONOS-''' + category + '''-''' + branchWithPrefix + '''.property'''
112
113 node( testStation ) {
114 return readProperties( file: filePath )
115 }
116}
117
118def getCurrentTime(){
119 // get time of the PST zone.
120
121 TimeZone.setDefault( TimeZone.getTimeZone( 'PST' ) )
122 return new Date()
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700123}
124
125def initGraphPaths(){
Jeremy Ronquillo1e5d7f22019-07-17 14:18:42 -0700126 graphPaths.put( "trendIndividual", fileRelated.rScriptPaths[ "scripts" ][ "trendIndividual" ] )
Jon Hallc68e2162020-07-29 10:50:09 -0700127 if ( category == "SR" || category == "SR-StratumBMv2" || category == "SR-Tofino" ){
Jeremy Ronquillo1e5d7f22019-07-17 14:18:42 -0700128 graphPaths.put( "saveDirectory", fileRelated.workspaces[ "base" ] + "postjob-" + ( testStation - "TestStation-" - "s" ) + "/" )
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700129 } else if ( category == "SRHA" ) {
Jeremy Ronquillo1e5d7f22019-07-17 14:18:42 -0700130 graphPaths.put( "saveDirectory", fileRelated.workspaces[ "Fabric" ] )
Jeremy Ronquillobb3001f2019-07-01 12:57:07 -0700131 } else if ( category == "SCPF" || category == "USECASE" ){
Jeremy Ronquillo1e5d7f22019-07-17 14:18:42 -0700132 graphPaths.put( "saveDirectory", fileRelated.workspaces[ "BM" ] )
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700133 } else {
Jeremy Ronquillo1e5d7f22019-07-17 14:18:42 -0700134 graphPaths.put( "saveDirectory", fileRelated.workspaces[ "VM" ] )
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700135 }
136}
137
138def runTests(){
139 // run the test sequentially and save the function into the dictionary.
Jon Halld4f33e12020-07-29 14:50:34 -0700140 for ( String JenkinsLabel : testsFromList.keySet() ){
141 toBeRun = testsToRun.keySet().contains( JenkinsLabel )
142 stepName = ( toBeRun ? "" : "Not " ) + "Running $JenkinsLabel"
143
Jon Hallf29368d2020-07-31 12:23:56 -0700144 TestONTest = ( toBeRun && testsToRun[ JenkinsLabel ].keySet().contains( "test" ) ) ? testsToRun[ JenkinsLabel ][ "test" ] : JenkinsLabel
Jon Halld4f33e12020-07-29 14:50:34 -0700145
146 pipeline[ stepName ] = runTest( JenkinsLabel,
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700147 toBeRun,
148 prop,
Jon Halld4f33e12020-07-29 14:50:34 -0700149 TestONTest,
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700150 isGraphOnly,
151 testsToRun,
152 graphPaths[ "trendIndividual" ],
153 graphPaths[ "saveDirectory" ] )
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700154 }
155
156 // get the start time of the test.
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700157 start = getCurrentTime()
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700158
159 // run the tests sequentially.
Jon Halld4f33e12020-07-29 14:50:34 -0700160 for ( JenkinsLabel in pipeline.keySet() ){
161 pipeline[ JenkinsLabel ].call()
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700162 }
163}
164
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700165def initTest(){
166 return '''#!/bin/bash -l
167 set -i # interactive
168 set +e
169 shopt -s expand_aliases # expand alias in non-interactive mode
170 export PYTHONUNBUFFERED=1
171 ifconfig
172 echo "ONOS Branch is: $ONOSBranch"
173 echo "TestON Branch is: $TestONBranch"
174 echo "Test date: "
175 date
176 cd ~
177 export PATH=$PATH:onos/tools/test/bin
178 timeout 240 stc shutdown | head -100
179 timeout 240 stc teardown | head -100
180 timeout 240 stc shutdown | head -100
181 cd ~/OnosSystemTest/TestON/bin
182 git log | head
183 ./cleanup.sh -f || true
184 '''
185}
186
Jeremy Ronquillo5ceda072019-08-12 12:56:43 -0700187def configureJavaVersion(){
188 java_1_8_branches = [ "1.15" ]
189 return '''#!/bin/bash -l
190 ''' + ( java_1_8_branches.contains( branch ) ? '''SET_JAVA_VER=java-8-oracle''' : '''SET_JAVA_VER=java-1.11.0-openjdk-amd64''' ) +
191 '''
192 CELL_COUNT=$( env | egrep "OC[1-9]+" | wc -l )
193 for i in $(seq 1 $CELL_COUNT)
194 do
195 CELL_TO_SET=$( env | egrep "OC$i" | cut -c5- )
196 echo "Setting java to $SET_JAVA_VER on $CELL_TO_SET"
197 eval ssh $CELL_TO_SET 'sudo update-java-alternatives -s $SET_JAVA_VER'
198 done
199 '''
200}
201
Jon Halld4f33e12020-07-29 14:50:34 -0700202def runTestCli_py( testName, testArguments ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700203 // Bash script that will run the test.
Jon Halld4f33e12020-07-29 14:50:34 -0700204 // testName : name of the test in TestON
205 // testArguments : Arguments to be passed to the test framework
Jeremy Ronquillo31a3eb32019-08-02 13:30:37 -0700206
207 command = '''cd ~/OnosSystemTest/TestON/bin
Jon Halld4f33e12020-07-29 14:50:34 -0700208 ./cli.py run ''' + testName + ''' --params GRAPH/nodeCluster=''' + graphs.getPostjobType( nodeLabel ) + ''' ''' + testArguments
Jeremy Ronquillo31a3eb32019-08-02 13:30:37 -0700209 echo command
210
211 return command
212
213
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700214}
215
216def concludeRunTest(){
Jon Halld4f33e12020-07-29 14:50:34 -0700217 // TODO: Add cleanup for if we use docker containers
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700218 return '''cd ~/OnosSystemTest/TestON/bin
219 ./cleanup.sh -f || true
220 # cleanup config changes
221 cd ~/onos/tools/package/config
222 git clean -df'''
223}
224
225def copyLogs(){
226 // bash script to copy the logs and other necessary element for SR tests.
227
228 result = ""
Jon Hallc68e2162020-07-29 10:50:09 -0700229 if ( category == "SR" || category == "SR-StratumBMv2" || category == "SR-Tofino" ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700230 result = '''
231 sudo rm /var/jenkins/workspace/SR-log-${WikiPrefix}/*
232 sudo cp *karaf.log.* /var/jenkins/workspace/SR-log-${WikiPrefix}/
233 sudo cp *Flows* /var/jenkins/workspace/SR-log-${WikiPrefix}/
234 sudo cp *Groups* /var/jenkins/workspace/SR-log-${WikiPrefix}/
235 sudo cp *.tar.gz /var/jenkins/workspace/SR-log-${WikiPrefix}/
236 sudo cp t3-* /var/jenkins/workspace/SR-log-${WikiPrefix}/
237 '''
238 }
239 return result
240}
241
Jon Halld4f33e12020-07-29 14:50:34 -0700242def cleanAndCopyFiles( JenkinsLabel ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700243 // clean up some files that were in the folder and copy the new files from the log
Jon Halld4f33e12020-07-29 14:50:34 -0700244 // JenkinsLabel : name of the test in Jenkins
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700245
246 return '''#!/bin/bash -i
247 set +e
248 echo "ONOS Branch is: ${ONOSBranch}"
249 echo "TestON Branch is: ${TestONBranch}"
Jon Halld4f33e12020-07-29 14:50:34 -0700250 echo "Job name is: "''' + JenkinsLabel + '''
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700251 echo "Workspace is: ${WORKSPACE}/"
252 echo "Wiki page to post is: ${WikiPrefix}-"
253 # remove any leftover files from previous tests
254 sudo rm ${WORKSPACE}/*Wiki.txt
255 sudo rm ${WORKSPACE}/*Summary.txt
256 sudo rm ${WORKSPACE}/*Result.txt
257 sudo rm ${WORKSPACE}/*Alarm.txt || true
258 sudo rm ${WORKSPACE}/*.csv
259 #copy files to workspace
260 cd `ls -t ~/OnosSystemTest/TestON/logs/*/ | head -1 | sed 's/://'`
261 ''' + copyLogs() + '''
262 sudo cp *.txt ${WORKSPACE}/
263 sudo cp *.csv ${WORKSPACE}/
264 cd ${WORKSPACE}/
265 for i in *.csv
266 do mv "$i" "$WikiPrefix"-"$i"
267 done
268 ls -al
269 cd '''
270}
271
Jon Halld4f33e12020-07-29 14:50:34 -0700272def fetchLogs( JenkinsLabel ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700273 // fetch the logs of onos from onos nodes to onos System Test logs
Jon Halld4f33e12020-07-29 14:50:34 -0700274 // JenkinsLabel : name of the test in Jenkins
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700275
276 return '''#!/bin/bash
277 set +e
278 cd ~/OnosSystemTest/TestON/logs
Jon Halld4f33e12020-07-29 14:50:34 -0700279 echo "TestON test name is: "''' + JenkinsLabel + '''
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700280 TestONlogDir=$(ls -t | grep ${TEST_NAME}_ |head -1)
281 echo "########################################################################################"
282 echo "##### copying ONOS logs from all nodes to TestON/logs directory: ${TestONlogDir}"
283 echo "########################################################################################"
284 cd $TestONlogDir
285 if [ $? -eq 1 ]
286 then
287 echo "Job name does not match any test suite name to move log!"
288 else
289 pwd
290 for i in $OC{1..7}; do onos-fetch-logs $i || echo log does not exist for onos $i; done
291 for i in $OC{1..7}; do atomix-fetch-logs $i || echo log does not exist for atomix $i; done
292 fi
293 cd'''
294}
295
296def publishToConfluence( isManualRun, isPostResult, wikiLink, file ){
297 // publish HTML script to wiki confluence
298 // isManualRun : string "true" "false"
299 // isPostResult : string "true" "false"
300 // wikiLink : link of the wiki page to publish
301 // file : name of the file to be published
302
Jeremy Ronquillo31a3eb32019-08-02 13:30:37 -0700303 if ( graphs.isPostingResult( isManualRun, isPostResult ) ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700304 publishConfluence siteName: 'wiki.onosproject.org', pageName: wikiLink, spaceName: 'ONOS',
305 attachArchivedArtifacts: true, buildIfUnstable: true,
306 editorList: [ confluenceWritePage( confluenceFile( file ) ) ]
307 }
308}
309
Jon Halld4f33e12020-07-29 14:50:34 -0700310def postLogs( prefix ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700311 // posting logs of the onos jobs specifically SR tests
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700312 // prefix : branch prefix ( master, 2.1, 1.15 ... )
313
314 resultURL = ""
Jon Hallc68e2162020-07-29 10:50:09 -0700315 if ( category == "SR" || category == "SR-StratumBMv2" || category == "SR-Tofino" ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700316 def post = build job: "SR-log-" + prefix, propagate: false
317 resultURL = post.getAbsoluteUrl()
318 }
319 return resultURL
320}
321
Jon Halld4f33e12020-07-29 14:50:34 -0700322def analyzeResult( prop, workSpace, TestONTest, JenkinsLabel, resultURL, wikiLink, isSCPF ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700323 // analyzing the result of the test and send to slack if any abnormal result is logged.
324 // prop : property dictionary
325 // workSpace : workSpace where the result file is saved
Jon Halld4f33e12020-07-29 14:50:34 -0700326 // TestONTest : TestON name of the test
327 // JenkinsLabel : Jenkins name of the test. Example: SCPFflowTPFobj
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700328 // resultURL : url for the logs for SR tests. Will not be posted if it is empty
329 // wikiLink : link of the wiki page where the result was posted
330 // isSCPF : Check if it is SCPF. If so, it won't post the wiki link.
331
332 node( testStation ) {
Jon Halld4f33e12020-07-29 14:50:34 -0700333 def alarmFile = workSpace + "/" + TestONTest + "Alarm.txt"
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700334 if ( fileExists( alarmFile ) ) {
335 def alarmContents = readFile( alarmFile )
336 slackSend( channel: "#jenkins-related",
337 color: "FF0000",
Jon Halld4f33e12020-07-29 14:50:34 -0700338 message: "[" + prop[ "ONOSBranch" ] + "] " + JenkinsLabel + " : triggered alarms:\n" +
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700339 alarmContents + "\n" +
340 "[TestON log] : \n" +
341 "https://jenkins.onosproject.org/blue/organizations/jenkins/${ env.JOB_NAME }/detail/${ env.JOB_NAME }/${ env.BUILD_NUMBER }/pipeline" +
342 ( isSCPF ? "" : ( "\n[Result on Wiki] : \n" +
343 "https://wiki.onosproject.org/display/ONOS/" +
344 wikiLink.replaceAll( "\\s", "+" ) ) ) +
345 ( resultURL != "" ? ( "\n[Karaf log] : \n" +
346 resultURL + "artifact/" ) : "" ),
347 teamDomain: 'onosproject' )
Jeremy Ronquilloe4e83912019-07-29 12:58:48 -0700348 print "Abnormal test result."
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700349 throw new Exception( "Abnormal test result." )
350 }
351 else {
352 print "Test results are OK."
353 }
354 }
355}
356
Jon Halld4f33e12020-07-29 14:50:34 -0700357def runTest( JenkinsLabel, toBeRun, prop, TestONTest, graphOnly, testCategory,
358 graph_generator_file, graph_saved_directory ){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700359 // run the test on the machine that contains all the steps : init and run test, copy files, publish result ...
Jon Halld4f33e12020-07-29 14:50:34 -0700360 // JenkinsLabel : name of the test in Jenkins
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700361 // toBeRun : boolean value whether the test will be run or not. If not, it won't be run but shows up with empty
362 // result on pipeline view
363 // prop : dictionary property on the machine
Jon Halld4f33e12020-07-29 14:50:34 -0700364 // TestONTest : Pure name of the test. ( ex. TestONTest of SCPFflowTpFobj will be SCPFflowTp )
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700365 // graphOnly : check if it is generating graph job. If so, it will only generate the generating graph part
366 // testCategory : Map for the test suit ( SCPF, SR, FUNC, ... ) which contains information about the tests
367 // graph_generator_file : Rscript file with the full path.
368 // graph_saved_directory : where the generated graph will be saved to.
369
370 return {
371 catchError {
Jon Halld4f33e12020-07-29 14:50:34 -0700372 stage( JenkinsLabel ) {
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700373 if ( toBeRun ){
Jon Halld4f33e12020-07-29 14:50:34 -0700374 def workSpace = "/var/jenkins/workspace/" + JenkinsLabel
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700375 def fileContents = ""
Jon Hall1d1c4512020-07-29 16:10:40 -0700376 testArguments = testCategory[ JenkinsLabel ].keySet().contains( "arguments" ) ? testCategory[ JenkinsLabel ][ "arguments" ] : ""
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700377 node( testStation ) {
378 withEnv( [ 'ONOSBranch=' + prop[ "ONOSBranch" ],
379 'ONOSJAVAOPTS=' + prop[ "ONOSJAVAOPTS" ],
380 'TestONBranch=' + prop[ "TestONBranch" ],
381 'ONOSTag=' + prop[ "ONOSTag" ],
382 'WikiPrefix=' + prop[ "WikiPrefix" ],
383 'WORKSPACE=' + workSpace ] ) {
384 if ( !graphOnly ){
385 if ( isSCPF ){
386 // Remove the old database file
Jon Halld4f33e12020-07-29 14:50:34 -0700387 sh SCPFfuncs.cleanupDatabaseFile( JenkinsLabel )
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700388 }
Jeremy Ronquillo5ceda072019-08-12 12:56:43 -0700389 sh script: configureJavaVersion(), label: "Configure Java Version"
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700390 sh script: initTest(), label: "Test Initialization: stc shutdown; stc teardown; ./cleanup.sh"
391 catchError{
Jon Halld4f33e12020-07-29 14:50:34 -0700392 sh script: runTestCli_py( TestONTest, testArguments ), label: ( "Run Test: ./cli.py run " + TestONTest + " " + testArguments )
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700393 }
394 catchError{
395 sh script: concludeRunTest(), label: "Conclude Running Test: ./cleanup.sh; git clean -df"
396 }
397 catchError{
398 // For the Wiki page
Jon Halld4f33e12020-07-29 14:50:34 -0700399 sh script: cleanAndCopyFiles( TestONTest ), label: "Clean and Copy Files"
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700400 }
401 }
Jon Halld4f33e12020-07-29 14:50:34 -0700402 graphs.databaseAndGraph( prop, JenkinsLabel, TestONTest, graphOnly,
403 graph_generator_file, graph_saved_directory )
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700404 if ( !graphOnly ){
Jon Halld4f33e12020-07-29 14:50:34 -0700405 sh script: fetchLogs( TestONTest ), label: "Fetch Logs"
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700406 if ( !isSCPF ){
407 publishToConfluence( prop[ "manualRun" ], prop[ "postResult" ],
Jon Halld4f33e12020-07-29 14:50:34 -0700408 prop[ "WikiPrefix" ] + "-" + testCategory[ JenkinsLabel ][ 'wikiName' ],
409 workSpace + "/" + testCategory[ JenkinsLabel ][ 'wikiFile' ] )
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700410 }
411 }
412 }
413 }
414 graphs.postResult( prop, graphOnly, nodeLabel )
415 if ( !graphOnly ){
Jon Halld4f33e12020-07-29 14:50:34 -0700416 def resultURL = postLogs( prop[ "WikiPrefix" ] )
417 analyzeResult( prop, workSpace, TestONTest, JenkinsLabel, resultURL,
418 isSCPF ? "" : testCategory[ JenkinsLabel ][ 'wikiName' ],
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700419 isSCPF )
420 }
Jeremy Ronquillob8aac442019-07-31 13:28:01 -0700421 } else {
Jon Halld4f33e12020-07-29 14:50:34 -0700422 echo JenkinsLabel + " is not being run today. Leaving the rest of stage contents blank."
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700423 }
424 }
425 }
426 }
427}
428
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700429def generateGraphs(){
Jeremy Ronquillo06950992019-07-09 11:16:49 -0700430 if ( category != "SCPF" ){
431 // generate the overall graph of the non SCPF tests.
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700432 graphs.generateOverallGraph( prop, testsToRun, graphPaths[ "saveDirectory" ], nodeLabel, category )
Jeremy Ronquillobb3001f2019-07-01 12:57:07 -0700433 }
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700434}
435
436def sendToSlack(){
Jeremy Ronquillo336110a2019-07-11 14:20:40 -0700437 // send the result of the test to the slack when it is not manually running.
438 // start : start time of the test
439 // isManualRun : string that is whether "false" or "true"
440 // branch : branch of the onos.
441
442 try {
443 if ( prop[ "manualRun" ] == "false" ){
444 end = getCurrentTime()
445 TimeDuration duration = TimeCategory.minus( end, start )
446 // FIXME: for now we disable notifications of normal test results
447 /*
448 slackSend( color: "#5816EE",
449 message: category + "-" + prop[ "WikiPrefix" ] + " tests ended at: " + end.toString() +
450 "\nTime took : " + duration )
451 */
452 }
453 }
454 catch ( all ){
455 }
Jeremy Ronquillo21c29fc2019-06-05 11:15:24 -0700456}