Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 1 | #!groovy |
| 2 | // This is a Jenkinsfile for a scripted pipeline for the SCPF tests |
| 3 | // Define sets of tests |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 4 | previous_version = "1.11" |
| 5 | before_previous_version = "1.10" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 6 | AllTheTests= |
| 7 | [ |
| 8 | "FUNC":[ |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 9 | "FUNCipv6Intent" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 10 | "FUNCoptical" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 11 | "FUNCflow" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 12 | "FUNCnetCfg": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 13 | "FUNCovsdbtest" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 14 | "FUNCnetconf" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 15 | "FUNCgroup" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 16 | "FUNCformCluster" :["basic":false, "extra_A":false, "extra_B":false, "new_Test":true, "day":""], |
| 17 | "FUNCintent" : ["basic":false, "extra_A":true, "extra_B":false, "new_Test":false, "day":""], |
| 18 | "FUNCintentRest" : ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 19 | ], |
| 20 | "HA":[ |
| 21 | "HAsanity" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 22 | "HAclusterRestart" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 23 | "HAsingleInstanceRestart" : ["basic":true, "extra_A":false, "extra_B":false, "day":""], |
| 24 | "HAstopNodes" : ["basic":false, "extra_A":true, "extra_B":false, "day":""], |
| 25 | "HAfullNetPartition" : ["basic":false, "extra_A":true, "extra_B":false, "day":""], |
| 26 | "HAswapNodes" : ["basic":false, "extra_A":false, "extra_B":true, "day":""], |
| 27 | "HAscaling" : ["basic":false, "extra_A":false, "extra_B":true, "day":""], |
| 28 | "HAkillNodes" : ["basic":false, "extra_A":false, "extra_B":true, "day":""] |
| 29 | ], |
| 30 | "SCPF":[ |
| 31 | "SCPFswitchLat": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 32 | "SCPFcbench": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 33 | "SCPFportLat": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 34 | "SCPFflowTp1g": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 35 | "SCPFintentEventTp": ["basic":true, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 36 | "SCPFhostLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 37 | // batch will be on extra_A after fixing from the ONOS side. |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 38 | "SCPFbatchFlowResp": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 39 | "SCPFintentRerouteLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 40 | "SCPFintentInstallWithdrawLat": ["basic":false, "extra_A":true, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 41 | "SCPFflowTp1gWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 42 | "SCPFintentEventTpWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 43 | "SCPFintentRerouteLatWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 44 | "SCPFscalingMaxIntentsWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 45 | "SCPFintentInstallWithdrawLatWithFlowObj": ["basic":false, "extra_A":false, "extra_B":true, "extra_C":false, "extra_D":false, "new_Test":false, day:""], |
| 46 | "SCPFscaleTopo": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":true, "extra_D":false, "new_Test":false, day:""], |
| 47 | "SCPFscalingMaxIntents": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":true, "new_Test":false, day:""], |
| 48 | "SCPFmastershipFailoverLat": ["basic":false, "extra_A":false, "extra_B":false, "extra_C":false, "extra_D":false, "new_Test":true, day:""] |
| 49 | ], |
| 50 | "USECASE":[ |
| 51 | "FUNCvirNetNB" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 52 | "FUNCbgpls" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 53 | "VPLSBasic" : ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 54 | "USECASE_SdnipFunction": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 55 | "USECASE_SdnipFunctionCluster": ["basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":""], |
| 56 | "PLATdockertest": ["basic":false, "extra_A":true, "extra_B":false, "new_Test":false, "day":""], |
| 57 | "SRSanity": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 58 | "SRSwitchFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 59 | "SRLinkFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 60 | "SROnosFailure": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 61 | "SRClusterRestart": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 62 | "SRDynamic": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 63 | "SRHighAvailability": ["basic":false, "extra_A":false, "extra_B":true, "new_Test":false, "day":""], |
| 64 | "VPLSfailsafe" : ["basic":false, "extra_A":false, "extra_B":false, "new_Test":true, "day":""] |
| 65 | ] |
| 66 | ] |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 67 | testcases = [ |
| 68 | "FUNC" : [ tests : "" , nodeName : "VM"], |
| 69 | "HA" : [ tests : "" , nodeName : "VM"], |
| 70 | "SCPF" : [ tests : "" , nodeName : "BM"], |
| 71 | "USECASE" : [ tests : "" , nodeName : "BM"] |
| 72 | ] |
| 73 | Prefix_organizer = [ |
| 74 | "FU" : "FUNC", |
| 75 | "HA" : "HA", |
| 76 | "PL" : "USECASE", |
| 77 | "SA" : "USECASE", |
| 78 | "SC" : "SCPF", |
| 79 | "SR" : "USECASE", |
| 80 | "US" : "USECASE", |
| 81 | "VP" : "USECASE" |
| 82 | ] |
| 83 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 84 | onos_branch = "master" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 85 | test_branch = "" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 86 | onos_tag = params.ONOSTag |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 87 | isOldFlow = false |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 88 | // Set tests based on day of week |
| 89 | def now = new Date() |
| 90 | echo(now.toString()) |
| 91 | today = now[Calendar.DAY_OF_WEEK] |
| 92 | day = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 93 | SCPF_choices = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 94 | USECASE_choices = "" |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 95 | FUNC_choices = "" |
| 96 | HA_choices = "" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 97 | |
| 98 | manually_run = params.manual_run |
| 99 | post_result = params.PostResult |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 100 | if( !manually_run ){ |
| 101 | sendToSlack( '#03CD9F', ":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n" |
| 102 | + "Starting tests on : " + now.toString() |
| 103 | + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" ) |
| 104 | testDivider( today ) |
| 105 | FUNC_choices = lastCommaRemover( FUNC_choices ) |
| 106 | HA_choices = lastCommaRemover( HA_choices ) |
| 107 | SCPF_choices = lastCommaRemover( SCPF_choices ) |
| 108 | USECASE_choices = lastCommaRemover( USECASE_choices ) |
| 109 | } |
| 110 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 111 | if ( manually_run ){ |
| 112 | organize_tests( params.Tests ) |
| 113 | onos_branch = params.ONOSVersion |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 114 | isOldFlow = params.isOldFlow |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 115 | println "Tests to be run manually : " |
| 116 | }else{ |
| 117 | testcases["SCPF"]["tests"] = SCPF_choices |
| 118 | testcases["USECASE"]["tests"] = USECASE_choices |
| 119 | testcases["FUNC"]["tests"] = FUNC_choices |
| 120 | testcases["HA"]["tests"] = HA_choices |
| 121 | println "Defaulting to " + day + " tests:" |
| 122 | } |
| 123 | print_tests( testcases ) |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 124 | def runTest = [ |
| 125 | "VM" : [:], |
| 126 | "BM" : [:] |
| 127 | ] |
| 128 | for( String test in testcases.keySet() ){ |
| 129 | println test |
| 130 | if (testcases[test]["tests"] != ""){ |
| 131 | runTest[testcases[test]["nodeName"]][test] = trigger_pipeline( onos_branch, testcases[test]["tests"], testcases[test]["nodeName"], test, manually_run, onos_tag ) |
| 132 | } |
| 133 | } |
| 134 | def finalList = [:] |
| 135 | finalList["VM"] = runTestSeq( runTest["VM"] ) |
| 136 | finalList["BM"] = runTestSeq( runTest["BM"] ) |
| 137 | parallel finalList |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 138 | |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 139 | def testDivider( today ){ |
| 140 | switch (today) { |
| 141 | case Calendar.MONDAY: |
| 142 | monday( true ) |
| 143 | tuesday( true, false ) |
| 144 | wednesday( true, false ) |
| 145 | thursday( true, false ) |
| 146 | friday( true, false ) |
| 147 | day = "Monday" |
| 148 | sendToSlack( '#FFD988', "Tests to be run this weekdays : \n" + printDaysForTest() ) |
| 149 | break |
| 150 | case Calendar.TUESDAY: |
| 151 | tuesday( true, true ) |
| 152 | day = "Tuesday" |
| 153 | break |
| 154 | case Calendar.WEDNESDAY: |
| 155 | wednesday( true, true ) |
| 156 | day = "Wednesday" |
| 157 | break |
| 158 | case Calendar.THURSDAY: |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 159 | thursday( true, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 160 | day = "Thursday" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 161 | isOldFlow = true |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 162 | break |
| 163 | case Calendar.FRIDAY: |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 164 | friday( true, true ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 165 | day = "Friday" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 166 | isOldFlow = true |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 167 | break |
| 168 | case Calendar.SATURDAY: |
| 169 | saturday() |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 170 | onos_branch= previous_version |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 171 | day = "Saturday" |
| 172 | break |
| 173 | case Calendar.SUNDAY: |
| 174 | sunday() |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 175 | onos_branch= before_previous_version |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 176 | day = "Sunday" |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 177 | isOldFlow = true |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 178 | break |
| 179 | } |
| 180 | } |
| 181 | def printDaysForTest(){ |
| 182 | result = "" |
| 183 | for ( String test in AllTheTests.keySet() ){ |
| 184 | result += test + " : \n" |
| 185 | for( String each in AllTheTests[ test ].keySet() ){ |
| 186 | AllTheTests[ test ][ each ][ "day" ] = lastCommaRemover( AllTheTests[ test ][ each ][ "day" ] ) |
| 187 | result += " " + each + ":[" + AllTheTests[ test ][ each ][ "day" ] + "]\n" |
| 188 | } |
| 189 | result += "\n" |
| 190 | } |
| 191 | return result |
| 192 | } |
| 193 | def lastCommaRemover( str ){ |
| 194 | if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){ |
| 195 | str = str.substring( 0,str.size() - 1 ) |
| 196 | } |
| 197 | return str |
| 198 | } |
| 199 | def monday( getResult ){ |
| 200 | FUNC_choices += adder( "FUNC", "basic", true, "M", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 201 | FUNC_choices += adder( "FUNC", "new_Test", true, "M", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 202 | FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult ) |
| 203 | HA_choices += adder( "HA", "basic", true, "M", getResult ) |
| 204 | HA_choices += adder( "HA", "extra_A", true, "M", getResult ) |
| 205 | SCPF_choices += adder( "SCPF", "basic", true, "M", getResult ) |
| 206 | SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult ) |
| 207 | } |
| 208 | def tuesday( getDay, getResult ){ |
| 209 | FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 210 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "T", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 211 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "T", getResult ) |
| 212 | HA_choices += adder( "HA", "basic", getDay, "T", getResult ) |
| 213 | HA_choices += adder( "HA", "extra_B", getDay, "T", getResult ) |
| 214 | SCPF_choices += adder( "SCPF", "basic", getDay, "T", getResult ) |
| 215 | SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult ) |
| 216 | USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult ) |
| 217 | USECASE_choices += adder( "USECASE", "extra_A", getDay, "T", getResult ) |
| 218 | USECASE_choices += adder( "USECASE", "new_Test", getDay, "T", getResult ) |
| 219 | } |
| 220 | def wednesday( getDay, getResult ){ |
| 221 | FUNC_choices += adder( "FUNC", "basic", getDay, "W", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 222 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "W", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 223 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "W", getResult ) |
| 224 | HA_choices += adder( "HA", "basic", getDay, "W", getResult ) |
| 225 | HA_choices += adder( "HA", "extra_A", getDay, "W", getResult ) |
| 226 | SCPF_choices += adder( "SCPF", "basic", getDay, "W", getResult ) |
| 227 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "W", getResult ) |
| 228 | SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult ) |
| 229 | } |
| 230 | def thursday( getDay, getResult ){ |
| 231 | FUNC_choices += adder( "FUNC", "basic", getDay, "Th", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 232 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "Th", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 233 | FUNC_choices += adder( "FUNC", "extra_B", getDay, "Th", getResult ) |
| 234 | HA_choices += adder( "HA", "basic", getDay, "Th", getResult ) |
| 235 | HA_choices += adder( "HA", "extra_B", getDay, "Th", getResult ) |
| 236 | SCPF_choices += adder( "SCPF", "basic", getDay, "Th", getResult ) |
| 237 | SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult ) |
| 238 | } |
| 239 | def friday( getDay, getResult ){ |
| 240 | FUNC_choices += adder( "FUNC", "basic", getDay, "F", getResult ) |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 241 | FUNC_choices += adder( "FUNC", "new_Test", getDay, "F", getResult ) |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 242 | FUNC_choices += adder( "FUNC", "extra_A", getDay, "F", getResult ) |
| 243 | HA_choices += adder( "HA", "basic", getDay, "F", getResult ) |
| 244 | HA_choices += adder( "HA", "extra_A", getDay, "F", getResult ) |
| 245 | SCPF_choices += adder( "SCPF", "basic", getDay, "F", getResult ) |
| 246 | SCPF_choices += adder( "SCPF", "extra_A", getDay, "F", getResult ) |
| 247 | SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult ) |
| 248 | } |
| 249 | def saturday(){ |
| 250 | FUNC_choices += adder( "FUNC", "basic", false, "Sa", true ) |
| 251 | FUNC_choices += adder( "FUNC", "extra_A", false, "Sa", true ) |
| 252 | FUNC_choices += adder( "FUNC", "extra_B", false, "Sa", true ) |
| 253 | HA_choices += adder( "HA", "basic", false, "Sa", true ) |
| 254 | HA_choices += adder( "HA", "extra_A", false, "Sa", true ) |
| 255 | HA_choices += adder( "HA", "extra_B", false, "Sa", true ) |
| 256 | SCPF_choices += adder( "SCPF", "basic", false, "Sa", true ) |
| 257 | SCPF_choices += adder( "SCPF", "extra_A", false, "Sa", true ) |
| 258 | SCPF_choices += adder( "SCPF", "extra_B", false, "Sa", true ) |
| 259 | SCPF_choices += adder( "SCPF", "extra_C", false, "Sa", true ) |
| 260 | SCPF_choices += adder( "SCPF", "extra_D", false, "Sa", true ) |
| 261 | SCPF_choices += adder( "SCPF", "new_Test", false, "Sa", true ) |
| 262 | USECASE_choices += adder( "USECASE", "basic", false, "Sa", true ) |
| 263 | USECASE_choices += adder( "USECASE", "new_Test", false, "Sa", true ) |
| 264 | } |
| 265 | def sunday(){ |
| 266 | FUNC_choices += adder( "FUNC", "basic", false, "S", true ) |
| 267 | FUNC_choices += adder( "FUNC", "extra_A", false, "S", true ) |
| 268 | FUNC_choices += adder( "FUNC", "extra_B", false, "S", true ) |
| 269 | HA_choices += adder( "HA", "basic", false, "S", true ) |
| 270 | HA_choices += adder( "HA", "extra_A", false, "S", true ) |
| 271 | HA_choices += adder( "HA", "extra_B", false, "S", true ) |
| 272 | SCPF_choices += adder( "SCPF", "basic", false, "S", true ) |
| 273 | USECASE_choices += adder( "USECASE", "basic", false, "S", true ) |
| 274 | } |
| 275 | def adder( testCat, set, dayAdding, day, getResult ){ |
| 276 | result = "" |
| 277 | for( String test in AllTheTests[ testCat ].keySet() ){ |
| 278 | if( AllTheTests[ testCat ][ test ][ set ] ){ |
| 279 | if( getResult ) |
| 280 | result += test + "," |
| 281 | if( dayAdding ) |
| 282 | dayAdder( testCat, test, day ) |
| 283 | } |
| 284 | } |
| 285 | return result |
| 286 | } |
| 287 | def dayAdder( testCat, testName, dayOfWeek ){ |
| 288 | AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + "," |
| 289 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 290 | def runTestSeq( testList ){ |
| 291 | return{ |
| 292 | for ( test in testList.keySet() ){ |
| 293 | testList[test].call() |
| 294 | } |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | def print_tests( tests ){ |
| 299 | for( String test in tests.keySet() ){ |
| 300 | if( tests[test]["tests"] != "" ){ |
| 301 | println test + ":" |
| 302 | println tests[test]["tests"] |
| 303 | } |
| 304 | } |
| 305 | } |
| 306 | def organize_tests( tests ){ |
| 307 | testList = tests.tokenize("\n;, ") |
| 308 | for( String test in testList ) |
| 309 | testcases [ Prefix_organizer[ ( test == "FUNCbgpls" || test == "FUNCvirNetNB" ? "US" : ( test[ 0 ] + test[ 1 ] ) ) ] ][ "tests" ] += test + "," |
| 310 | } |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 311 | def trigger_pipeline( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 312 | // nodeName : "BM" or "VM" |
| 313 | // jobOn : "SCPF" or "USECASE" or "FUNC" or "HA" |
| 314 | return{ |
| 315 | if (branch == "master"){ |
| 316 | onos_branch = branch |
| 317 | }else{ |
| 318 | onos_branch = "onos-" + branch |
| 319 | } |
| 320 | wiki = branch |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 321 | test_branch = onos_branch |
| 322 | if (onos_branch == previous_version) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 323 | test_branch = "master" |
| 324 | println jobOn + "_Pipeline_" + manuallyRun ? "manually" : branch |
| 325 | node("TestStation-" + nodeName + "s"){ |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 326 | envSetup(onos_branch, test_branch, onosTag, jobOn, manuallyRun ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 327 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 328 | exportEnvProperty( onos_branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag, isOldFlow ) |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | jobToRun = jobOn + "_Pipeline_" + ( manuallyRun ? "manually" : branch ) |
| 332 | build job: jobToRun, propagate: false |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | // export Environment properties. |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 337 | def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 338 | stage("export Property"){ |
| 339 | sh ''' |
| 340 | echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property |
| 341 | echo "TestONBranch=''' + test_branch +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 342 | echo "ONOSTag='''+ onosTag +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 343 | echo "WikiPrefix=''' + wiki +'''" >> /var/jenkins/TestONOS.property |
| 344 | echo "ONOSJVMHeap='''+ env.ONOSJVMHeap +'''" >> /var/jenkins/TestONOS.property |
| 345 | echo "Tests=''' + tests +'''" >> /var/jenkins/TestONOS.property |
| 346 | echo "postResult=''' + postResult +'''" >> /var/jenkins/TestONOS.property |
| 347 | echo "manualRun=''' + manually_run +'''" >> /var/jenkins/TestONOS.property |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 348 | echo "isOldFlow=''' + isOldFlow +'''" >> /var/jenkins/TestONOS.property |
| 349 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 350 | ''' |
| 351 | } |
| 352 | } |
Devin Lim | 61657e4 | 2017-10-09 17:24:40 -0700 | [diff] [blame] | 353 | def sendToSlack( color, message ){ |
| 354 | slackSend(color:color, message: message) |
| 355 | } |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 356 | // Initialize the environment Setup for the onos and OnosSystemTest |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 357 | def envSetup( onos_branch, test_branch, onos_tag, jobOn, manuallyRun ){ |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 358 | stage("envSetup") { |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 359 | sh '''#!/bin/bash -l |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 360 | set +e |
| 361 | . ~/.bashrc |
| 362 | env |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 363 | ''' + preSetup( onos_branch, test_branch, onos_tag, manuallyRun ) + ''' |
Devin Lim | cbba085 | 2017-11-13 10:31:32 -0800 | [diff] [blame] | 364 | ''' + oldFlowCheck( jobOn, onos_branch ) + ''' |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 365 | ''' + postSetup( onos_branch, test_branch, onos_tag, manuallyRun ) |
| 366 | } |
| 367 | } |
| 368 | def tagCheck(onos_tag, onos_branch){ |
| 369 | result = "git checkout " |
| 370 | if (onos_tag == "" ) |
| 371 | result += onos_branch //create new local branch |
| 372 | else |
| 373 | result += onos_tag //checkout the tag |
| 374 | return result |
| 375 | } |
| 376 | def preSetup( onos_branch, test_branch, onos_tag, isManual ){ |
| 377 | result = "" |
| 378 | if( !isManual ){ |
| 379 | result = '''echo -e "\n##### Set TestON Branch #####" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 380 | echo "TestON Branch is set on: ''' + test_branch + '''" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 381 | |
| 382 | cd ~/OnosSystemTest/ |
| 383 | git checkout HEAD~1 # Make sure you aren't pn a branch |
| 384 | git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 385 | git branch -D ''' + test_branch + ''' # just incase there are local changes. This will normally result in a branch not found error |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 386 | git clean -df # clean any local files |
| 387 | git fetch --all # update all caches from remotes |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 388 | git reset --hard origin/''' + test_branch +''' # force local index to match remote branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 389 | git clean -df # clean any local files |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 390 | git checkout ''' + test_branch + ''' #create new local branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 391 | git branch |
| 392 | git log -1 --decorate |
| 393 | |
| 394 | |
| 395 | echo -e "\n##### Set ONOS Branch #####" |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 396 | echo "ONOS Branch is set on: ''' + onos_branch + '''" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 397 | |
| 398 | echo -e "\n #### check karaf version ######" |
| 399 | env |grep karaf |
| 400 | |
| 401 | cd ~/onos |
| 402 | rm -rf buck-out/* |
| 403 | ~/onos/tools/build/onos-buck clean |
| 404 | git checkout HEAD~1 # Make sure you aren't pn a branch |
| 405 | git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 406 | git branch -D ''' + onos_branch + ''' # just incase there are local changes. This will normally result in a branch not found error |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 407 | git clean -df # clean any local files |
| 408 | git fetch --all # update all caches from remotes |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 409 | git reset --hard origin/''' + onos_branch + ''' # force local index to match remote branch |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 410 | git clean -df # clean any local files |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 411 | ''' + tagCheck(onos_tag, onos_branch) + ''' |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 412 | git branch |
| 413 | git log -1 --decorate |
| 414 | |
| 415 | |
| 416 | echo -e "\n##### set jvm heap size to 8G #####" |
| 417 | echo ${ONOSJVMHeap} |
| 418 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 419 | inserted_line="export JAVA_OPTS=\"\${ONOSJVMHeap}\"" |
| 420 | sed -i "s/bash/bash\\n$inserted_line/" ~/onos/tools/package/bin/onos-service |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 421 | |
| 422 | echo "##### Check onos-service setting..... #####" |
| 423 | cat ~/onos/tools/package/bin/onos-service |
| 424 | |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 425 | export JAVA_HOME=/usr/lib/jvm/java-8-oracle''' |
| 426 | } |
| 427 | return result |
| 428 | } |
Devin Lim | cbba085 | 2017-11-13 10:31:32 -0800 | [diff] [blame] | 429 | def oldFlowCheck( jobOn, onos_branch ){ |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 430 | result = "" |
Devin Lim | 3ebd5e7 | 2017-11-14 10:38:00 -0800 | [diff] [blame] | 431 | if( isOldFlow && jobOn == "SCPF" && onos_branch== "master" ) |
Devin Lim | 0e96716 | 2017-11-03 15:59:53 -0700 | [diff] [blame] | 432 | result = '''sed -i -e 's/@Component(immediate = true)/@Component(enabled = false)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/DistributedFlowRuleStore.java |
| 433 | sed -i -e 's/@Component(enabled = false)/@Component(immediate = true)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/ECFlowRuleStore.java''' |
| 434 | return result |
| 435 | } |
| 436 | def postSetup( onos_branch, test_branch, onos_tag, isManual ){ |
| 437 | result = "" |
| 438 | if( !isManual ){ |
| 439 | result = '''echo -e "\n##### build ONOS skip unit tests ######" |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 440 | #mvn clean install -DskipTests |
| 441 | # Force buck update |
| 442 | rm -f ~/onos/bin/buck |
| 443 | ~/onos/tools/build/onos-buck build onos |
| 444 | |
Devin Lim | a0e52eb | 2017-09-13 18:35:12 -0700 | [diff] [blame] | 445 | sleep 30 |
| 446 | echo -e "\n##### Stop all running instances of Karaf #####" |
| 447 | kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}') |
| 448 | sleep 30 |
| 449 | |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 450 | git branch''' |
| 451 | } |
Devin Lim | 37a8379 | 2017-10-26 16:38:21 -0700 | [diff] [blame] | 452 | return result |
Devin Lim | 90803a8 | 2017-08-29 13:41:44 -0700 | [diff] [blame] | 453 | } |