blob: aa4bfe0a7f768a1a33d46c10972da56f3dd67ddb [file] [log] [blame]
Devin Lim431408d2018-03-23 17:51:31 -07001#!groovy
2
Devin Limfc4f22c2018-03-23 18:18:27 -07003funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
4test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
Devin Lim431408d2018-03-23 17:51:31 -07005triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
6
You Wang9af16482018-05-02 13:45:28 -07007current_version = "master"
8previous_version = "1.13"
9before_previous_version = "1.12"
Devin Lim431408d2018-03-23 17:51:31 -070010funcs.initializeTrend( "Fabric" );
11funcs.initialize( "Fabric" )
12triggerFuncs.init( funcs )
13
14wikiContents = ""
15testcases = [
16 "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
17 "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
18 "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
Devin Lim86e40532018-04-06 12:44:06 -070019 "SR" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
Devin Lim2edfcec2018-05-09 17:16:21 -070020 "SR1" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
Devin Lim431408d2018-03-23 17:51:31 -070021 "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
22]
23Prefix_organizer = [
24 "FU" : "FUNC",
25 "HA" : "HA",
26 "PL" : "USECASE",
27 "SA" : "USECASE",
28 "SC" : "SCPF",
29 "SR" : "SR",
30 "US" : "USECASE",
31 "VP" : "USECASE"
32]
33
34manually_run = params.manual_run
Devin Limb6f92de2018-04-13 18:27:33 -070035onos_b = current_version
Devin Lim431408d2018-03-23 17:51:31 -070036test_branch = ""
37onos_tag = params.ONOSTag
38isOldFlow = true
39
40// Set tests based on day of week
41def now = funcs.getCurrentTime()
42print now.toString()
43today = now[ Calendar.DAY_OF_WEEK ]
44
45if ( manually_run ){
46 onos_b = params.ONOSVersion
47}
48AllTheTests = test_lists.getAllTheTests( onos_b )
49
50day = ""
51SCPF_choices = ""
52USECASE_choices = ""
53FUNC_choices = ""
54HA_choices = ""
55SR_choices = ""
56stat_graph_generator_file = "testCategoryBuildStats.R"
57pie_graph_generator_file = "testCategoryPiePassFail.R"
58graph_saved_directory = "/var/jenkins/workspace/postjob-Fabric/"
59
60post_result = params.PostResult
61if( !manually_run ){
Devin Lim33fe4e72018-04-06 19:45:53 -070062 slackSend( channel:'sr-failures', color:'#03CD9F',
Devin Lim431408d2018-03-23 17:51:31 -070063 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:" )
66
67 SR_choices += adder( "SR", "basic", true )
Devin Limbe483072018-03-24 14:37:48 -070068 if ( today == Calendar.FRIDAY ){
69 SR_choices += adder( "SR", "extra_A", true )
70 } else if( today == Calendar.SATURDAY ){
71 SR_choices += adder( "SR", "extra_B", true )
72 }
Devin Lim431408d2018-03-23 17:51:31 -070073 SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
74}
75if ( manually_run ){
76 testcases = triggerFuncs.organize_tests( params.Tests, testcases )
77
78 isOldFlow = params.isOldFlow
79 println "Tests to be run manually : "
80}else{
81 testcases[ "SR" ][ "tests" ] = SR_choices
Devin Lim2edfcec2018-05-09 17:16:21 -070082 testcases[ "SR1" ][ "tests" ] = SR_choices
Devin Lim431408d2018-03-23 17:51:31 -070083 println "Defaulting to " + day + " tests:"
84}
85
86triggerFuncs.print_tests( testcases )
87
88def runTest = [
Devin Lim86e40532018-04-06 12:44:06 -070089 "Fabric2" : [:],
90 "Fabric3" : [:]
Devin Lim431408d2018-03-23 17:51:31 -070091]
Devin Lim2edfcec2018-05-09 17:16:21 -070092if ( manually_run ){
93 for( String test in testcases.keySet() ){
94 println test
95 if ( testcases[ test ][ "tests" ] != "" ){
96 runTest[ testcases[ test ][ "nodeName" ][ nodeOn( onos_b ) ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ][ nodeOn( onos_b ) ], test, manually_run, onos_tag )
97 }
Devin Lim431408d2018-03-23 17:51:31 -070098 }
Devin Lim2edfcec2018-05-09 17:16:21 -070099}else{
100 runTest[ "Fabric2" ][ "SR1" ] = triggerFuncs.trigger_pipeline( current_version, testcases[ "SR1" ][ "tests" ], testcases[ "SR1" ][ "nodeName" ][ 0 ], "SR1", manually_run, onos_tag )
101 runTest[ "Fabric2" ][ "SR" ] = triggerFuncs.trigger_pipeline( previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
102 runTest[ "Fabric3" ][ "SR" ] = triggerFuncs.trigger_pipeline( before_previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 1 ], "SR", manually_run, onos_tag )
Devin Lim431408d2018-03-23 17:51:31 -0700103}
Devin Lim2edfcec2018-05-09 17:16:21 -0700104
Devin Lim431408d2018-03-23 17:51:31 -0700105def finalList = [:]
Devin Lim86e40532018-04-06 12:44:06 -0700106finalList[ "Fabric2" ] = triggerFuncs.runTestSeq( runTest[ "Fabric2" ] )
107finalList[ "Fabric3" ] = triggerFuncs.runTestSeq( runTest[ "Fabric3" ] )
Devin Lim431408d2018-03-23 17:51:31 -0700108parallel finalList
109/*
110if ( !manually_run ){
Devin Lim86e40532018-04-06 12:44:06 -0700111 funcs.generateStatGraph( "TestStation-Fabric2s",
112 funcs.branchWithPrefix( "master" ),
113 AllTheTests,
114 stat_graph_generator_file,
115 pie_graph_generator_file,
116 graph_saved_directory )
117 funcs.generateStatGraph( "TestStation-Fabric3s",
118 funcs.branchWithPrefix( "1.12" ),
Devin Lim431408d2018-03-23 17:51:31 -0700119 AllTheTests,
120 stat_graph_generator_file,
121 pie_graph_generator_file,
122 graph_saved_directory )
123}*/
124def adder( testCat, set, getResult ){
125 result = ""
126 for( String test in AllTheTests[ testCat ].keySet() ){
127 if( AllTheTests[ testCat ][ test ][ set ] ){
128 if( getResult )
129 result += test + ","
130 }
131 }
132 return result
Devin Limb6f92de2018-04-13 18:27:33 -0700133}
Devin Lim2edfcec2018-05-09 17:16:21 -0700134def nodeOn( branch ){
135 return branch == "1.12" ? 1 : 0;
136}