blob: ef805a90a48ee3a7ee2dba4f8d290eccb89b6488 [file] [log] [blame]
Devin Lim431408d2018-03-23 17:51:31 -07001#!groovy
2
Devin Limb734ea52018-05-14 14:13:05 -07003funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
4test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
5triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/TriggerFuncs.groovy' )
6fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
Devin Lim431408d2018-03-23 17:51:31 -07007
Devin Limfe9a4cb2018-05-11 17:06:21 -07008fileRelated.init()
You Wang9af16482018-05-02 13:45:28 -07009current_version = "master"
10previous_version = "1.13"
11before_previous_version = "1.12"
Devin Lim431408d2018-03-23 17:51:31 -070012funcs.initializeTrend( "Fabric" );
13funcs.initialize( "Fabric" )
14triggerFuncs.init( funcs )
15
16wikiContents = ""
17testcases = [
18 "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
19 "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
20 "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
Devin Lim86e40532018-04-06 12:44:06 -070021 "SR" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
Devin Lim2edfcec2018-05-09 17:16:21 -070022 "SR1" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
Devin Lim431408d2018-03-23 17:51:31 -070023 "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
24]
25Prefix_organizer = [
26 "FU" : "FUNC",
27 "HA" : "HA",
28 "PL" : "USECASE",
29 "SA" : "USECASE",
30 "SC" : "SCPF",
31 "SR" : "SR",
32 "US" : "USECASE",
33 "VP" : "USECASE"
34]
35
36manually_run = params.manual_run
Devin Limb6f92de2018-04-13 18:27:33 -070037onos_b = current_version
Devin Lim431408d2018-03-23 17:51:31 -070038test_branch = ""
39onos_tag = params.ONOSTag
40isOldFlow = true
41
42// Set tests based on day of week
43def now = funcs.getCurrentTime()
44print now.toString()
45today = now[ Calendar.DAY_OF_WEEK ]
46
47if ( manually_run ){
48 onos_b = params.ONOSVersion
49}
50AllTheTests = test_lists.getAllTheTests( onos_b )
51
52day = ""
53SCPF_choices = ""
54USECASE_choices = ""
55FUNC_choices = ""
56HA_choices = ""
57SR_choices = ""
Devin Limfe9a4cb2018-05-11 17:06:21 -070058stat_graph_generator_file = fileRelated.histogramMultiple
59pie_graph_generator_file = fileRelated.pieMultiple
60graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric/"
Devin Lim431408d2018-03-23 17:51:31 -070061
62post_result = params.PostResult
63if( !manually_run ){
Devin Lim33fe4e72018-04-06 19:45:53 -070064 slackSend( channel:'sr-failures', color:'#03CD9F',
Devin Lim431408d2018-03-23 17:51:31 -070065 message:":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n"
66 + "Starting tests on : " + now.toString()
67 + "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
68
69 SR_choices += adder( "SR", "basic", true )
Devin Limbe483072018-03-24 14:37:48 -070070 if ( today == Calendar.FRIDAY ){
71 SR_choices += adder( "SR", "extra_A", true )
72 } else if( today == Calendar.SATURDAY ){
73 SR_choices += adder( "SR", "extra_B", true )
74 }
Devin Lim431408d2018-03-23 17:51:31 -070075 SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
76}
77if ( manually_run ){
78 testcases = triggerFuncs.organize_tests( params.Tests, testcases )
79
80 isOldFlow = params.isOldFlow
81 println "Tests to be run manually : "
82}else{
83 testcases[ "SR" ][ "tests" ] = SR_choices
Devin Lim2edfcec2018-05-09 17:16:21 -070084 testcases[ "SR1" ][ "tests" ] = SR_choices
Devin Lim431408d2018-03-23 17:51:31 -070085 println "Defaulting to " + day + " tests:"
86}
87
88triggerFuncs.print_tests( testcases )
89
90def runTest = [
Devin Lim86e40532018-04-06 12:44:06 -070091 "Fabric2" : [:],
92 "Fabric3" : [:]
Devin Lim431408d2018-03-23 17:51:31 -070093]
Devin Lim2edfcec2018-05-09 17:16:21 -070094if ( manually_run ){
95 for( String test in testcases.keySet() ){
96 println test
97 if ( testcases[ test ][ "tests" ] != "" ){
98 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 )
99 }
Devin Lim431408d2018-03-23 17:51:31 -0700100 }
Devin Lim2edfcec2018-05-09 17:16:21 -0700101}else{
Devin Lim0c25f2f2018-05-10 15:43:09 -0700102 runTest[ "Fabric2" ][ "SR1" ] = triggerFuncs.trigger_pipeline( current_version, testcases[ "SR1" ][ "tests" ], testcases[ "SR1" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
Devin Lim2edfcec2018-05-09 17:16:21 -0700103 runTest[ "Fabric2" ][ "SR" ] = triggerFuncs.trigger_pipeline( previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
104 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 -0700105}
Devin Lim2edfcec2018-05-09 17:16:21 -0700106
Devin Lim431408d2018-03-23 17:51:31 -0700107def finalList = [:]
Devin Lim86e40532018-04-06 12:44:06 -0700108finalList[ "Fabric2" ] = triggerFuncs.runTestSeq( runTest[ "Fabric2" ] )
109finalList[ "Fabric3" ] = triggerFuncs.runTestSeq( runTest[ "Fabric3" ] )
Devin Lim431408d2018-03-23 17:51:31 -0700110parallel finalList
111/*
112if ( !manually_run ){
Devin Lim86e40532018-04-06 12:44:06 -0700113 funcs.generateStatGraph( "TestStation-Fabric2s",
114 funcs.branchWithPrefix( "master" ),
115 AllTheTests,
116 stat_graph_generator_file,
117 pie_graph_generator_file,
118 graph_saved_directory )
119 funcs.generateStatGraph( "TestStation-Fabric3s",
120 funcs.branchWithPrefix( "1.12" ),
Devin Lim431408d2018-03-23 17:51:31 -0700121 AllTheTests,
122 stat_graph_generator_file,
123 pie_graph_generator_file,
124 graph_saved_directory )
125}*/
126def adder( testCat, set, getResult ){
127 result = ""
128 for( String test in AllTheTests[ testCat ].keySet() ){
129 if( AllTheTests[ testCat ][ test ][ set ] ){
130 if( getResult )
131 result += test + ","
132 }
133 }
134 return result
Devin Limb6f92de2018-04-13 18:27:33 -0700135}
Devin Lim2edfcec2018-05-09 17:16:21 -0700136def nodeOn( branch ){
137 return branch == "1.12" ? 1 : 0;
Devin Lim0c25f2f2018-05-10 15:43:09 -0700138}