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