Devin Lim | e1346f4 | 2018-05-15 15:41:36 -0700 | [diff] [blame] | 1 | #!groovy |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 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 | |
| 21 | // This is the dependency Jenkins script. |
| 22 | // it has some common functions that runs test and generate graph. |
| 23 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 24 | import groovy.time.TimeCategory |
| 25 | import groovy.time.TimeDuration |
| 26 | |
Devin Lim | b734ea5 | 2018-05-14 14:13:05 -0700 | [diff] [blame] | 27 | generalFuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/GeneralFuncs.groovy' ) |
| 28 | fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' ) |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 29 | test_list = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' ) |
Devin Lim | fe9a4cb | 2018-05-11 17:06:21 -0700 | [diff] [blame] | 30 | |
| 31 | fileRelated.init() |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 32 | test_list.init() |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 33 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 34 | def initializeTrend( machine ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 35 | // For initializing any trend graph jobs |
| 36 | // machine : Either VM,BM, or Fabric# |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 37 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 38 | table_name = "executed_test_tests" |
| 39 | result_name = "executed_test_results" |
| 40 | testMachine = "TestStation-" + machine + "s" |
| 41 | this.machine = machine |
| 42 | isSCPF = false |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 43 | hasArgs = false |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 44 | isTrend = true |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 45 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 46 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 47 | def initialize( type, SCPFfuncs ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 48 | // Initializing for SCPF tests |
| 49 | // type : type of the test ( SR,FUNC,SCPF... ) |
| 50 | // Passing the SCPFfunction which will be PerformanceFuncs.groovy |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 51 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 52 | init( type ) |
| 53 | SCPFfunc = SCPFfuncs |
| 54 | isSCPF = true |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 55 | hasArgs = true // Has TestON cli arguments to be added when running the test |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 56 | machine = machineType[ type ] |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 57 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 58 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 59 | def initialize( type ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 60 | // initializing for FUNC,HA,SR, and USECASE |
| 61 | // type : type of the test ( SR,FUNC,SCPF... ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 62 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 63 | init( type ) |
| 64 | SCPFfunc = null |
| 65 | table_name = "executed_test_tests" |
| 66 | result_name = "executed_test_results" |
| 67 | trend_generator_file = fileRelated.trendMultiple |
| 68 | build_stats_generator_file = fileRelated.histogramMultiple |
| 69 | isSCPF = false |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 70 | hasArgs = false |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 71 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 72 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 73 | def init( type ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 74 | // type : type of the test ( SR,FUNC,SCPF... ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 75 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 76 | machineType = [ "FUNC": "VM", |
| 77 | "HA": "VM", |
| 78 | "SR": "Fabric", |
| 79 | "SCPF": "BM", |
| 80 | "USECASE": "BM" ] |
| 81 | testType = type |
| 82 | testMachine = "TestStation-" + machineType[ type ] + "s" |
| 83 | isTrend = false |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 84 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 85 | |
Devin Lim | 86e4053 | 2018-04-06 12:44:06 -0700 | [diff] [blame] | 86 | def additionalInitForSR( branch ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 87 | // additional setup for SegmentRouting tests to determine the machine depends on the branch it is running. |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 88 | // branch : branch of the onos. ( master, 2.1, 1.15... ) |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 89 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 90 | testMachine = ( ( new StringBuilder( testMachine ) ).insert( testMachine.size() - 1, fabricOn( branch ) ) ). |
| 91 | toString() |
| 92 | if ( isTrend ){ |
| 93 | machine += fabricOn( branch ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 94 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 95 | else { |
| 96 | machineType[ testType ] += fabricOn( branch ) |
| 97 | } |
| 98 | print testMachine |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 99 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 100 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 101 | def fabricOn( branch ){ |
| 102 | // gets the fabric machines with the branch of onos. |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 103 | // branch : master, 2.1, 1.15... |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 104 | // branch.reverse().take(4).reverse() will get last 4 characters of the string. |
You Wang | dba6c9f | 2018-12-21 11:58:55 -0800 | [diff] [blame] | 105 | switch ( branch.reverse().take( 3 ).reverse() ){ |
| 106 | case "ter": return "4" |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 107 | case "2.1": return "3" |
You Wang | dba6c9f | 2018-12-21 11:58:55 -0800 | [diff] [blame] | 108 | case "2.0": return "3" |
| 109 | case ".15": return "2" |
| 110 | case ".14": return "3" |
| 111 | case ".13": return "2" |
| 112 | case ".12": return "3" |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 113 | default: return "4" |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | def printType(){ |
| 118 | // print the test type and test machine that was initialized. |
| 119 | |
| 120 | echo testType |
| 121 | echo testMachine |
| 122 | } |
| 123 | |
Jeremy Ronquillo | 259d71f | 2019-06-07 14:38:46 -0700 | [diff] [blame] | 124 | def getProperties( category ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 125 | // get the properties of the test by reading the TestONOS.property |
| 126 | |
| 127 | node( testMachine ) { |
Jeremy Ronquillo | 259d71f | 2019-06-07 14:38:46 -0700 | [diff] [blame] | 128 | return readProperties( file: '/var/jenkins/TestONOS-' + category + '.property' ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 129 | } |
| 130 | } |
| 131 | |
| 132 | def getTestsToRun( testList ){ |
| 133 | // get test to run by tokenizing the list. |
| 134 | |
| 135 | testList.tokenize( "\n;, " ) |
| 136 | } |
| 137 | |
| 138 | def getCurrentTime(){ |
| 139 | // get time of the PST zone. |
| 140 | |
| 141 | TimeZone.setDefault( TimeZone.getTimeZone( 'PST' ) ) |
| 142 | return new Date() |
| 143 | } |
| 144 | |
| 145 | def getTotalTime( start, end ){ |
| 146 | // get total time of the test using start and end time. |
| 147 | |
| 148 | return TimeCategory.minus( end, start ) |
| 149 | } |
| 150 | |
| 151 | def printTestToRun( testList ){ |
| 152 | // printout the list of the test in the list. |
| 153 | |
| 154 | for ( String test : testList ){ |
| 155 | println test |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | def sendResultToSlack( start, isManualRun, branch ){ |
| 160 | // send the result of the test to the slack when it is not manually running. |
| 161 | // start : start time of the test |
| 162 | // isManualRun : string that is whether "false" or "true" |
| 163 | // branch : branch of the onos. |
| 164 | |
| 165 | try { |
| 166 | if ( isManualRun == "false" ){ |
| 167 | end = getCurrentTime() |
| 168 | TimeDuration duration = TimeCategory.minus( end, start ) |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 169 | // FIXME: for now we disable notifications of normal test results |
| 170 | /* |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 171 | slackSend( color: "#5816EE", |
| 172 | message: testType + "-" + branch + " tests ended at: " + end.toString() + |
| 173 | "\nTime took : " + duration ) |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 174 | */ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 175 | } |
| 176 | } |
| 177 | catch ( all ){ |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | def initAndRunTest( testName, testCategory ){ |
| 182 | // Bash script that will |
| 183 | // Initialize the environment to the machine and run the test. |
| 184 | // testName : name of the test |
| 185 | // testCategory : (SR,FUNC ... ) |
| 186 | |
| 187 | return '''#!/bin/bash -l |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 188 | set -i # interactive |
| 189 | set +e |
| 190 | shopt -s expand_aliases # expand alias in non-interactive mode |
| 191 | export PYTHONUNBUFFERED=1 |
| 192 | ifconfig |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 193 | echo "ONOS Branch is: $ONOSBranch" |
| 194 | echo "TestON Branch is: $TestONBranch" |
| 195 | echo "Test date: " |
| 196 | date |
| 197 | cd ~ |
| 198 | export PATH=$PATH:onos/tools/test/bin |
| 199 | timeout 240 stc shutdown | head -100 |
| 200 | timeout 240 stc teardown | head -100 |
| 201 | timeout 240 stc shutdown | head -100 |
| 202 | cd ~/OnosSystemTest/TestON/bin |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 203 | git log | head |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 204 | ./cleanup.sh -f |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 205 | ''' + "./cli.py run " + |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 206 | ( !hasArgs ? testName : testCategory[ testName ][ 'test' ] ) + |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 207 | " --params GRAPH/nodeCluster=" + machineType[ testType ] + ''' |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 208 | ./cleanup.sh -f |
| 209 | # cleanup config changes |
| 210 | cd ~/onos/tools/package/config |
| 211 | git clean -df''' |
| 212 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 213 | |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 214 | def copyLogs(){ |
| 215 | // bash script to copy the logs and other necessary element for SR tests. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 216 | |
| 217 | result = "" |
| 218 | if ( testType == "SR" ){ |
| 219 | result = ''' |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 220 | sudo rm /var/jenkins/workspace/SR-log-${WikiPrefix}/* |
| 221 | sudo cp *karaf.log.* /var/jenkins/workspace/SR-log-${WikiPrefix}/ |
| 222 | sudo cp *Flows* /var/jenkins/workspace/SR-log-${WikiPrefix}/ |
| 223 | sudo cp *Groups* /var/jenkins/workspace/SR-log-${WikiPrefix}/ |
Devin Lim | a7b97a4 | 2018-04-09 14:26:38 -0700 | [diff] [blame] | 224 | sudo cp *.tar.gz /var/jenkins/workspace/SR-log-${WikiPrefix}/ |
Devin Lim | 6faa3f9 | 2018-05-01 13:16:25 -0700 | [diff] [blame] | 225 | sudo cp t3-* /var/jenkins/workspace/SR-log-${WikiPrefix}/ |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 226 | ''' |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 227 | } |
| 228 | return result |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 229 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 230 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 231 | def cleanAndCopyFiles( testName ){ |
| 232 | // clean up some files that were in the folder and copy the new files from the log |
| 233 | // testName : name of the test |
| 234 | |
| 235 | return '''#!/bin/bash -i |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 236 | set +e |
| 237 | echo "ONOS Branch is: ${ONOSBranch}" |
| 238 | echo "TestON Branch is: ${TestONBranch}" |
| 239 | echo "Job name is: "''' + testName + ''' |
| 240 | echo "Workspace is: ${WORKSPACE}/" |
| 241 | echo "Wiki page to post is: ${WikiPrefix}-" |
| 242 | # remove any leftover files from previous tests |
| 243 | sudo rm ${WORKSPACE}/*Wiki.txt |
| 244 | sudo rm ${WORKSPACE}/*Summary.txt |
| 245 | sudo rm ${WORKSPACE}/*Result.txt |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 246 | sudo rm ${WORKSPACE}/*Alarm.txt || true |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 247 | sudo rm ${WORKSPACE}/*.csv |
| 248 | #copy files to workspace |
| 249 | cd `ls -t ~/OnosSystemTest/TestON/logs/*/ | head -1 | sed 's/://'` |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 250 | ''' + copyLogs() + ''' |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 251 | sudo cp *.txt ${WORKSPACE}/ |
| 252 | sudo cp *.csv ${WORKSPACE}/ |
| 253 | cd ${WORKSPACE}/ |
| 254 | for i in *.csv |
| 255 | do mv "$i" "$WikiPrefix"-"$i" |
| 256 | done |
| 257 | ls -al |
| 258 | cd ''' |
| 259 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 260 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 261 | def fetchLogs( testName ){ |
| 262 | // fetch the logs of onos from onos nodes to onos System Test logs |
| 263 | // testName: name of the test |
| 264 | |
| 265 | return '''#!/bin/bash |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 266 | set +e |
| 267 | cd ~/OnosSystemTest/TestON/logs |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 268 | echo "TestON test name is: "''' + testName + ''' |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 269 | TestONlogDir=$(ls -t | grep ${TEST_NAME}_ |head -1) |
| 270 | echo "########################################################################################" |
| 271 | echo "##### copying ONOS logs from all nodes to TestON/logs directory: ${TestONlogDir}" |
| 272 | echo "########################################################################################" |
| 273 | cd $TestONlogDir |
| 274 | if [ $? -eq 1 ] |
| 275 | then |
| 276 | echo "Job name does not match any test suite name to move log!" |
| 277 | else |
| 278 | pwd |
Jon Hall | 3e6edb3 | 2018-08-21 16:20:30 -0700 | [diff] [blame] | 279 | for i in $OC{1..7}; do onos-fetch-logs $i || echo log does not exist for onos $i; done |
| 280 | for i in $OC{1..7}; do atomix-fetch-logs $i || echo log does not exist for atomix $i; done |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 281 | fi |
| 282 | cd''' |
| 283 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 284 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 285 | def isPostingResult( manual, postresult ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 286 | // check if it is posting the result. |
| 287 | // posting when it is automatically running or has postResult condition from the manual run |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 288 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 289 | return manual == "false" || postresult == "true" |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 290 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 291 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 292 | def postResult( prop, graphOnly ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 293 | // post the result by triggering postjob. |
| 294 | // prop : property dictionary that was read from the machine. |
| 295 | // graphOnly : if it is graph generating job |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 296 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 297 | if ( graphOnly || isPostingResult( prop[ "manualRun" ], prop[ "postResult" ] ) ){ |
| 298 | def post = build job: "postjob-" + ( graphOnly ? machine : machineType[ testType ] ), propagate: false |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 299 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 300 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 301 | |
| 302 | def postLogs( testName, prefix ){ |
| 303 | // posting logs of the onos jobs specifically SR tests |
| 304 | // testName : name of the test |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 305 | // prefix : branch prefix ( master, 2.1, 1.15 ... ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 306 | |
| 307 | resultURL = "" |
| 308 | if ( testType == "SR" ){ |
| 309 | def post = build job: "SR-log-" + prefix, propagate: false |
| 310 | resultURL = post.getAbsoluteUrl() |
| 311 | } |
| 312 | return resultURL |
| 313 | } |
| 314 | |
| 315 | def getSlackChannel(){ |
| 316 | // get name of the slack channel. |
| 317 | // if the test is SR, it will return sr-failures |
| 318 | |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 319 | // FIXME: For now we move all notifications to #jenkins-related |
| 320 | // return "#" + ( testType == "SR" ? "sr-failures" : "jenkins-related" ) |
| 321 | return "#jenkins-related" |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 322 | } |
| 323 | |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 324 | def analyzeResult( prop, workSpace, pureTestName, testName, resultURL, wikiLink, isSCPF ){ |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 325 | // analyzing the result of the test and send to slack if any abnormal result is logged. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 326 | // prop : property dictionary |
| 327 | // workSpace : workSpace where the result file is saved |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 328 | // pureTestName : TestON name of the test |
| 329 | // testName : Jenkins name of the test. Example: SCPFflowTPFobj |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 330 | // resultURL : url for the logs for SR tests. Will not be posted if it is empty |
| 331 | // wikiLink : link of the wiki page where the result was posted |
| 332 | // isSCPF : Check if it is SCPF. If so, it won't post the wiki link. |
| 333 | |
| 334 | node( testMachine ) { |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 335 | def alarmFile = workSpace + "/" + pureTestName + "Alarm.txt" |
| 336 | if ( fileExists( alarmFile ) ) { |
| 337 | print "Abnormal test result logged" |
| 338 | def alarmContents = readFile( alarmFile ) |
You Wang | 2dcde68 | 2019-02-21 12:18:15 -0800 | [diff] [blame] | 339 | slackSend( channel: getSlackChannel(), |
| 340 | color: "FF0000", |
| 341 | message: "[" + prop[ "ONOSBranch" ] + "]" + testName + " : triggered alarms:\n" + |
| 342 | alarmContents + "\n" + |
| 343 | "[TestON log] : \n" + |
| 344 | "https://jenkins.onosproject.org/blue/organizations/jenkins/${ env.JOB_NAME }/detail/${ env.JOB_NAME }/${ env.BUILD_NUMBER }/pipeline" + |
| 345 | ( isSCPF ? "" : ( "\n[Result on Wiki] : \n" + |
| 346 | "https://wiki.onosproject.org/display/ONOS/" + |
| 347 | wikiLink.replaceAll( "\\s", "+" ) ) ) + |
| 348 | ( resultURL != "" ? ( "\n[Karaf log] : \n" + |
| 349 | resultURL + "artifact/" ) : "" ), |
| 350 | teamDomain: 'onosproject' ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 351 | Failed |
| 352 | } |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 353 | else { |
| 354 | print "Test results are normal" |
| 355 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 356 | } |
| 357 | } |
| 358 | |
Devin Lim | e89761a | 2018-03-16 17:52:57 -0700 | [diff] [blame] | 359 | def publishToConfluence( isManualRun, isPostResult, wikiLink, file ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 360 | // publish HTML script to wiki confluence |
| 361 | // isManualRun : string "true" "false" |
| 362 | // isPostResult : string "true" "false" |
| 363 | // wikiLink : link of the wiki page to publish |
| 364 | // file : name of the file to be published |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 365 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 366 | if ( isPostingResult( isManualRun, isPostResult ) ){ |
| 367 | publishConfluence siteName: 'wiki.onosproject.org', pageName: wikiLink, spaceName: 'ONOS', |
| 368 | attachArchivedArtifacts: true, buildIfUnstable: true, |
| 369 | editorList: [ confluenceWritePage( confluenceFile( file ) ) ] |
| 370 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 371 | |
| 372 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 373 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 374 | def runTest( testName, toBeRun, prop, pureTestName, graphOnly, testCategory, graph_generator_file, |
| 375 | graph_saved_directory ){ |
| 376 | // run the test on the machine that contains all the steps : init and run test, copy files, publish result ... |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 377 | // testName : name of the test in Jenkins |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 378 | // toBeRun : boolean value whether the test will be run or not. If not, it won't be run but shows up with empty |
| 379 | // result on pipeline view |
| 380 | // prop : dictionary property on the machine |
| 381 | // pureTestName : Pure name of the test. ( ex. pureTestName of SCPFflowTpFobj will be SCPFflowTp ) |
| 382 | // graphOnly : check if it is generating graph job. If so, it will only generate the generating graph part |
Jon Hall | 2ee92f8 | 2018-06-07 13:07:33 -0700 | [diff] [blame] | 383 | // testCategory : Map for the test suit ( SCPF, SR, FUNC, ... ) which contains information about the tests |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 384 | // graph_generator_file : Rscript file with the full path. |
| 385 | // graph_saved_directory : where the generated graph will be saved to. |
| 386 | |
| 387 | return { |
| 388 | catchError { |
| 389 | stage( testName ) { |
| 390 | if ( toBeRun ){ |
| 391 | def workSpace = "/var/jenkins/workspace/" + testName |
| 392 | def fileContents = "" |
| 393 | node( testMachine ) { |
| 394 | withEnv( [ 'ONOSBranch=' + prop[ "ONOSBranch" ], |
You Wang | 8e4f4c0 | 2019-01-03 10:49:46 -0800 | [diff] [blame] | 395 | 'ONOSJAVAOPTS=' + prop[ "ONOSJAVAOPTS" ], |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 396 | 'TestONBranch=' + prop[ "TestONBranch" ], |
| 397 | 'ONOSTag=' + prop[ "ONOSTag" ], |
| 398 | 'WikiPrefix=' + prop[ "WikiPrefix" ], |
| 399 | 'WORKSPACE=' + workSpace ] ) { |
| 400 | if ( !graphOnly ){ |
You Wang | 6d17194 | 2018-10-17 11:45:05 -0700 | [diff] [blame] | 401 | if ( isSCPF ){ |
| 402 | // Remove the old database file |
| 403 | sh SCPFfunc.cleanupDatabaseFile( testName ) |
| 404 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 405 | sh initAndRunTest( testName, testCategory ) |
| 406 | // For the Wiki page |
| 407 | sh cleanAndCopyFiles( pureTestName ) |
| 408 | } |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 409 | databaseAndGraph( prop, testName, pureTestName, graphOnly, |
| 410 | graph_generator_file, graph_saved_directory ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 411 | if ( !graphOnly ){ |
| 412 | sh fetchLogs( pureTestName ) |
| 413 | if ( !isSCPF ){ |
| 414 | publishToConfluence( prop[ "manualRun" ], prop[ "postResult" ], |
| 415 | testCategory[ testName ][ 'wiki_link' ], |
| 416 | workSpace + "/" + testCategory[ testName ][ 'wiki_file' ] ) |
| 417 | } |
| 418 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 419 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 420 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 421 | postResult( prop, graphOnly ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 422 | if ( !graphOnly ){ |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 423 | def resultURL = postLogs( testName, prop[ "WikiPrefix" ] ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 424 | analyzeResult( prop, workSpace, pureTestName, testName, resultURL, |
| 425 | isSCPF ? "" : testCategory[ testName ][ 'wiki_link' ], |
| 426 | isSCPF ) |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | } |
| 431 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 432 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 433 | |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 434 | def databaseAndGraph( prop, testName, pureTestName, graphOnly, graph_generator_file, graph_saved_directory ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 435 | // part where it insert the data into the database. |
| 436 | // It will use the predefined encrypted variables from the Jenkins. |
| 437 | // prop : property dictionary that was read from the machine |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 438 | // testName : Jenkins name for the test |
| 439 | // pureTestName : TestON name for the test |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 440 | // graphOnly : boolean whether it is graph only or not |
| 441 | // graph_generator_file : Rscript file with the full path. |
| 442 | // graph_saved_directory : where the generated graph will be saved to. |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 443 | if ( graphOnly || isPostingResult( prop[ "manualRun" ], prop[ "postResult" ] ) ){ |
| 444 | // Post Results |
| 445 | withCredentials( [ |
| 446 | string( credentialsId: 'db_pass', variable: 'pass' ), |
| 447 | string( credentialsId: 'db_user', variable: 'user' ), |
| 448 | string( credentialsId: 'db_host', variable: 'host' ), |
| 449 | string( credentialsId: 'db_port', variable: 'port' ) ] ) { |
| 450 | def database_command = generalFuncs.database_command_create( pass, host, port, user ) + |
| 451 | ( !isSCPF ? sqlCommand( testName ) : SCPFfunc.sqlCommand( testName ) ) |
| 452 | sh '''#!/bin/bash |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 453 | export DATE=\$(date +%F_%T) |
| 454 | cd ~ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 455 | pwd ''' + ( graphOnly ? "" : |
Jon Hall | 8b1e92c | 2018-06-13 14:07:22 -0700 | [diff] [blame] | 456 | ( !isSCPF ? databasePart( prop[ "WikiPrefix" ], pureTestName, database_command ) : |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 457 | SCPFfunc.databasePart( testName, database_command ) ) ) + ''' |
| 458 | ''' + ( !isSCPF ? graphGenerating( host, port, user, pass, testName, prop, graph_saved_directory, |
| 459 | graph_generator_file ) : |
| 460 | SCPFfunc.getGraphGeneratingCommand( host, port, user, pass, testName, prop ) ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 461 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 462 | } |
| 463 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 464 | |
| 465 | def generateCategoryStatsGraph( testMachineOn, manualRun, postresult, stat_file, pie_file, type, branch, testListPart, |
| 466 | save_path, pieTestListPart ){ |
| 467 | // function that will generate the category stat graphs for the overall test. |
| 468 | // testMachineOn : the machine the graph will be generated. It will be TestStation-VMs for the most cases |
| 469 | // manualRun : string of "true" or "false" |
| 470 | // postresult : string of "true" or "false" |
| 471 | // stat_file : file name with full path for Rscript for the stat graph |
| 472 | // pie_file : file name with full path for Rscript for the pie graph |
| 473 | // type : type of the test ( USECASE, FUNC, HA ) |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 474 | // branch : branch of the test ( master, onos-2.1, onos-1.15 ) |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 475 | // testListPart : list of the test to be included |
| 476 | // save_path : path that will save the graphs to |
| 477 | // pieTestListPart : list of the test for pie graph |
| 478 | |
| 479 | if ( isPostingResult( manualRun, postresult ) ){ |
| 480 | node( testMachineOn ) { |
| 481 | |
| 482 | withCredentials( [ |
| 483 | string( credentialsId: 'db_pass', variable: 'pass' ), |
| 484 | string( credentialsId: 'db_user', variable: 'user' ), |
| 485 | string( credentialsId: 'db_host', variable: 'host' ), |
| 486 | string( credentialsId: 'db_port', variable: 'port' ) ] ) { |
| 487 | sh '''#!/bin/bash |
| 488 | ''' + generalFuncs.basicGraphPart( stat_file, host, port, user, pass, type, |
| 489 | branch ) + " \"" + testListPart + "\" latest " + save_path + ''' |
| 490 | ''' + getOverallPieGraph( pie_file, host, port, user, pass, branch, type, pieTestListPart, 'y', |
| 491 | save_path ) + ''' |
| 492 | ''' + |
| 493 | getOverallPieGraph( pie_file, host, port, user, pass, branch, type, pieTestListPart, 'n', save_path ) |
| 494 | } |
| 495 | } |
| 496 | postResult( [ ], true ) |
| 497 | } |
| 498 | } |
| 499 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 500 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 501 | def generateOverallGraph( prop, testCategory, graph_saved_directory ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 502 | // generate the overall graph for the test |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 503 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 504 | if ( isPostingResult( prop[ "manualRun" ], prop[ "postResult" ] ) ){ |
| 505 | node( testMachine ) { |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 506 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 507 | withCredentials( [ |
| 508 | string( credentialsId: 'db_pass', variable: 'pass' ), |
| 509 | string( credentialsId: 'db_user', variable: 'user' ), |
| 510 | string( credentialsId: 'db_host', variable: 'host' ), |
| 511 | string( credentialsId: 'db_port', variable: 'port' ) ] ) { |
| 512 | testList = generalFuncs.getTestList( testCategory ) |
| 513 | sh '''#!/bin/bash |
| 514 | ''' + |
| 515 | generalFuncs.basicGraphPart( trend_generator_file, host, port, |
| 516 | user, pass, testType, |
| 517 | prop[ "ONOSBranch" ] ) + " " + testList + " 20 " + graph_saved_directory |
| 518 | } |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 519 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 520 | postResult( prop, false ) |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 521 | } |
| 522 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 523 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 524 | def getOverallPieGraph( file, host, port, user, pass, branch, type, testList, yOrN, path ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 525 | // Rcommand for the pie graph |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 526 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 527 | return generalFuncs.basicGraphPart( file, host, port, user, pass, type, branch ) + |
| 528 | " \"" + testList + "\" latest " + yOrN + " " + path |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 529 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 530 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 531 | def sqlCommand( testName ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 532 | // get the inserting sqlCommand for non-SCPF tests. |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 533 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 534 | return "\"INSERT INTO " + table_name + " VALUES('\$DATE','" + result_name + "','" + |
| 535 | testName + "',\$BUILD_NUMBER, '\$ONOSBranch', \$line);\" " |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 536 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 537 | |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 538 | def graphGenerating( host, port, user, pass, testName, prop, graph_saved_directory, graph_generator_file ){ |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 539 | // get the graphGenerating R command for non-SCPF tests |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 540 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 541 | return generalFuncs.basicGraphPart( graph_generator_file, host, port, user, pass, testName, |
| 542 | prop[ "ONOSBranch" ] ) + " 20 " + graph_saved_directory |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 543 | } |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 544 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 545 | def databasePart( wikiPrefix, testName, database_command ){ |
| 546 | // to read and insert the data from .csv to the database |
| 547 | |
| 548 | return ''' |
Devin Lim | 6164376 | 2017-12-07 15:55:38 -0800 | [diff] [blame] | 549 | sed 1d ''' + workSpace + "/" + wikiPrefix + "-" + testName + '''.csv | while read line |
| 550 | do |
| 551 | echo \$line |
| 552 | echo ''' + database_command + ''' |
| 553 | done ''' |
| 554 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 555 | |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 556 | def generateStatGraph( testMachineOn, onos_branch, stat_graph_generator_file, pie_graph_generator_file, |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 557 | graph_saved_directory ){ |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 558 | |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 559 | // Will generate the stats graph. |
| 560 | FUNCtestsStr = test_list.getTestListAsString( test_list.getTestsFromCategory( "FUNC" ) ) |
| 561 | HAtestsStr = test_list.getTestListAsString( test_list.getTestsFromCategory( "HA" ) ) |
| 562 | USECASEtestsStr = test_list.getTestListAsString( test_list.getTestsFromCategory( "USECASE" ) ) |
| 563 | |
| 564 | testListParam = "FUNC-" + FUNCtestsStr + ";" + |
| 565 | "HA-" + HAtestsStr + ";" + |
| 566 | "USECASE-" + USECASEtestsStr |
| 567 | |
| 568 | pieTestListParam = FUNCtestsStr + "," + |
| 569 | HAtestsStr + "," + |
| 570 | USECASEtestsStr |
| 571 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 572 | generateCategoryStatsGraph( testMachineOn, "false", "true", stat_graph_generator_file, pie_graph_generator_file, |
Jeremy Ronquillo | 64eeeb1 | 2019-05-13 11:19:46 -0700 | [diff] [blame] | 573 | "ALL", onos_branch, testListParam, graph_saved_directory, pieTestListParam ) |
Jeremy Ronquillo | 14ecc17 | 2018-03-05 09:57:17 -0800 | [diff] [blame] | 574 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 575 | |
Jeremy Ronquillo | f78a6ca | 2018-03-12 09:20:57 -0700 | [diff] [blame] | 576 | def branchWithPrefix( branch ){ |
Devin Lim | f517519 | 2018-05-14 19:13:22 -0700 | [diff] [blame] | 577 | // get the branch with the prefix ( "onos-" ) |
Jeremy Ronquillo | f78a6ca | 2018-03-12 09:20:57 -0700 | [diff] [blame] | 578 | return ( ( branch != "master" ) ? "onos-" : "" ) + branch |
| 579 | } |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 580 | |
You Wang | fe3877b | 2018-08-02 11:48:35 -0700 | [diff] [blame] | 581 | def testBranchWithPrefix( branch ){ |
| 582 | // get TestON branch with the prefix ( "onos-" ) |
You Wang | 8f12d7d | 2018-11-09 13:47:23 -0800 | [diff] [blame] | 583 | if ( branch == "1.12" ) |
You Wang | fe3877b | 2018-08-02 11:48:35 -0700 | [diff] [blame] | 584 | return "onos-1.13" |
You Wang | 8f12d7d | 2018-11-09 13:47:23 -0800 | [diff] [blame] | 585 | else if ( branch == "1.13" ) |
You Wang | fe3877b | 2018-08-02 11:48:35 -0700 | [diff] [blame] | 586 | return "onos-1.13" |
You Wang | 8f12d7d | 2018-11-09 13:47:23 -0800 | [diff] [blame] | 587 | else if ( branch == "1.14" ) |
You Wang | da4b144 | 2018-11-29 12:31:22 -0800 | [diff] [blame] | 588 | return "onos-1.15" |
You Wang | 8f12d7d | 2018-11-09 13:47:23 -0800 | [diff] [blame] | 589 | else if ( branch == "1.15" ) |
You Wang | da4b144 | 2018-11-29 12:31:22 -0800 | [diff] [blame] | 590 | return "onos-1.15" |
You Wang | dba6c9f | 2018-12-21 11:58:55 -0800 | [diff] [blame] | 591 | else if ( branch == "2.0" ) |
You Wang | a4062a3 | 2019-03-21 15:25:13 -0700 | [diff] [blame] | 592 | return "onos-2.0" |
You Wang | f043d0a | 2019-04-22 16:30:40 -0700 | [diff] [blame] | 593 | else if ( branch == "2.1" ) |
| 594 | return "onos-2.1" |
You Wang | fe3877b | 2018-08-02 11:48:35 -0700 | [diff] [blame] | 595 | else |
| 596 | return "master" |
| 597 | } |
| 598 | |
Jon Hall | 6af749d | 2018-05-29 12:59:47 -0700 | [diff] [blame] | 599 | return this |