blob: fca468cb7038e0245e155341ca23aad1e2b288e3 [file] [log] [blame]
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
fileRelated.init()
current_version = "master"
previous_version = "1.13"
before_previous_version = "1.12"
funcs.initializeTrend( "Fabric" );
funcs.initialize( "Fabric" )
triggerFuncs.init( funcs )
wikiContents = ""
testcases = [
"FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
"HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
"SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
"SR" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
"SR1" : [ tests : "", nodeName : [ "Fabric2", "Fabric3" ], wikiContent : "" ],
"USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
]
Prefix_organizer = [
"FU" : "FUNC",
"HA" : "HA",
"PL" : "USECASE",
"SA" : "USECASE",
"SC" : "SCPF",
"SR" : "SR",
"US" : "USECASE",
"VP" : "USECASE"
]
manually_run = params.manual_run
onos_b = current_version
test_branch = ""
onos_tag = params.ONOSTag
isOldFlow = true
// Set tests based on day of week
def now = funcs.getCurrentTime()
print now.toString()
today = now[ Calendar.DAY_OF_WEEK ]
if ( manually_run ){
onos_b = params.ONOSVersion
}
AllTheTests = test_lists.getAllTheTests( onos_b )
day = ""
SCPF_choices = ""
USECASE_choices = ""
FUNC_choices = ""
HA_choices = ""
SR_choices = ""
stat_graph_generator_file = fileRelated.histogramMultiple
pie_graph_generator_file = fileRelated.pieMultiple
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric/"
post_result = params.PostResult
if( !manually_run ){
slackSend( channel:'sr-failures', color:'#03CD9F',
message:":sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:\n"
+ "Starting tests on : " + now.toString()
+ "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
SR_choices += adder( "SR", "basic", true )
if ( today == Calendar.FRIDAY ){
SR_choices += adder( "SR", "extra_A", true )
} else if( today == Calendar.SATURDAY ){
SR_choices += adder( "SR", "extra_B", true )
}
SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
}
if ( manually_run ){
testcases = triggerFuncs.organize_tests( params.Tests, testcases )
isOldFlow = params.isOldFlow
println "Tests to be run manually : "
}else{
testcases[ "SR" ][ "tests" ] = SR_choices
testcases[ "SR1" ][ "tests" ] = SR_choices
println "Defaulting to " + day + " tests:"
}
triggerFuncs.print_tests( testcases )
def runTest = [
"Fabric2" : [:],
"Fabric3" : [:]
]
if ( manually_run ){
for( String test in testcases.keySet() ){
println test
if ( testcases[ test ][ "tests" ] != "" ){
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 )
}
}
}else{
runTest[ "Fabric2" ][ "SR1" ] = triggerFuncs.trigger_pipeline( current_version, testcases[ "SR1" ][ "tests" ], testcases[ "SR1" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
runTest[ "Fabric2" ][ "SR" ] = triggerFuncs.trigger_pipeline( previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 0 ], "SR", manually_run, onos_tag )
runTest[ "Fabric3" ][ "SR" ] = triggerFuncs.trigger_pipeline( before_previous_version, testcases[ "SR" ][ "tests" ], testcases[ "SR" ][ "nodeName" ][ 1 ], "SR", manually_run, onos_tag )
}
def finalList = [:]
finalList[ "Fabric2" ] = triggerFuncs.runTestSeq( runTest[ "Fabric2" ] )
finalList[ "Fabric3" ] = triggerFuncs.runTestSeq( runTest[ "Fabric3" ] )
parallel finalList
/*
if ( !manually_run ){
funcs.generateStatGraph( "TestStation-Fabric2s",
funcs.branchWithPrefix( "master" ),
AllTheTests,
stat_graph_generator_file,
pie_graph_generator_file,
graph_saved_directory )
funcs.generateStatGraph( "TestStation-Fabric3s",
funcs.branchWithPrefix( "1.12" ),
AllTheTests,
stat_graph_generator_file,
pie_graph_generator_file,
graph_saved_directory )
}*/
def adder( testCat, set, getResult ){
result = ""
for( String test in AllTheTests[ testCat ].keySet() ){
if( AllTheTests[ testCat ][ test ][ set ] ){
if( getResult )
result += test + ","
}
}
return result
}
def nodeOn( branch ){
return branch == "1.12" ? 1 : 0;
}