// Copyright 2017 Open Networking Foundation (ONF)
//
// Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
// the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
// or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
//
//     TestON is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 2 of the License, or
//     (at your option) any later version.
//
//     TestON is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
//
//     You should have received a copy of the GNU General Public License
//     along with TestON.  If not, see <http://www.gnu.org/licenses/>.

// This is the Jenkins script for the fabric-pipeline-trigger

#!groovy

// init dependencies functions
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/TriggerFuncs.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )

fileRelated.init()

// set the versions of the onos.
current_version = "master"
previous_version = "1.13"
before_previous_version = "1.12"

// Function that will initialize the configuration of the Fabric.
funcs.initializeTrend( "Fabric" );
funcs.initialize( "Fabric" )
triggerFuncs.init( funcs )

// Wiki contents is the contents for https://wiki.onosproject.org/display/ONOS/Automated+Test+Schedule
// It will only be used by the VM_BMJenkinsTrigger not in here.
wikiContents = ""

// Having two different SR and SR1 to allow current_version and previous_version to be run on same machine.
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 : "" ]
]

// depends on the First two letter of the testname, it will decide which category to put test.
Prefix_organizer = [
    "FU" : "FUNC",
    "HA" : "HA",
    "PL" : "USECASE",
    "SA" : "USECASE",
    "SC" : "SCPF",
    "SR" : "SR",
    "US" : "USECASE",
    "VP" : "USECASE"
]

// set some variables from the parameter
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 it is manually run, it will set the onos version to be what it was passed by.
// Currently, SR-pipeline-manually is not supported due to the special way of it is executed.
if ( manually_run ){
    onos_b = params.ONOSVersion
}

// get the list of the tests from the JenkinsTestONTests.groovy
AllTheTests = test_lists.getAllTheTests( onos_b )


day = ""

// list of the test on each test category will be run.
SCPF_choices = ""
USECASE_choices = ""
FUNC_choices = ""
HA_choices = ""
SR_choices = ""

// initialize the graph generating files.
stat_graph_generator_file = fileRelated.histogramMultiple
pie_graph_generator_file = fileRelated.pieMultiple
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric/"

// get the post_result. This will be affected only for the manual runs.
post_result = params.PostResult
if( !manually_run ){
    // If it is automated running, it will post the beginning message to the channel.
    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:" )

    // Choices will get the list of the test with Segment Rounting type tests.
    SR_choices += adder( "SR", "basic", true )
    if ( today == Calendar.FRIDAY ){
        // if today is Friday, it will also test tests with extra_A category
        SR_choices += adder( "SR", "extra_A", true )
    } else if( today == Calendar.SATURDAY ){
        // if today is Saturday, it will add the test with extra_B category
        SR_choices += adder( "SR", "extra_B", true )
    }
    // removing last comma added at the end of the last test name.
    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{
    // set the list of the tests to run.
    testcases[ "SR" ][ "tests" ] = SR_choices
    testcases[ "SR1" ][ "tests" ] = SR_choices
    println "Defaulting to " + day + " tests:"
}

// print out the list of the test to run on Jenkins
triggerFuncs.print_tests( testcases )

// This will hold the block of code to be run.
def runTest = [
    "Fabric2" : [:],
    "Fabric3" : [:]
]
if ( manually_run ){
    // for manual run situation.
    for( String test in testcases.keySet() ){
        println test
        // Unless the list of the tests on the test category is empty, it will save the block of code to run in dictionary.
        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{
    // for automated situation, it will save current and previous version to Fabric2 and before_previous_version to Fabric3.
    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 = [:]

// It will run each category of test to run sequentially on each branch.
// In our case, it will run SR1 first then SR on Fabric2 and just SR on Fabric3
finalList[ "Fabric2" ] = triggerFuncs.runTestSeq( runTest[ "Fabric2" ] )
finalList[ "Fabric3" ] = triggerFuncs.runTestSeq( runTest[ "Fabric3" ] )

// It will then run Fabric2 and Fabric3 to be run concurrently.
// In our case,
//                      ----> Fabric2 : current -> previous
// This pipeline ----->
//                      ----> Fabric3 : before_previous
parallel finalList

// Way we are generating pie graphs. not supported in SegmentRouting yet.
/*
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 )
}*/

// Way to add list of the tests with specific category to the result
def adder( testCat, set, getResult ){
    // testCat : test Category ( Eg. FUNC, HA, SR ... )
    // set : set of the test ( Eg. basic, extra_A ... )
    // if getResult == true, it will add the result.
    result = ""
    for( String test in AllTheTests[ testCat ].keySet() ){
        if( AllTheTests[ testCat ][ test ][ set ] ){
            if( getResult )
                result += test + ","
        }
    }
    return result
}

// check which node is on.
// 1.12 runs on Fabric3 and rest on 1.13 and master
def nodeOn( branch ){
    return branch == "1.12" ? 1 : 0;
}
