#!groovy
// Copyright 2018 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 SRHA-pipeline-<branch>

// read dependencies.
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )

// init configuration to be SR
fileRelated.init()
funcs.initialize( "SR" )

// Allow to run with --params-file argument
hasArgs = true

// get the name of the Jenkins job.
jobName = env.JOB_NAME

// SRHA has it's own test machine
// testmachine = "Fabrics"

// read the TestON.property depends on which branch it is running.
// ( currently master on Fabric4, 1.13 on Fabric2 and 1.12 on Fabric3 )
def prop = null
prop = funcs.getProperties()
SRHA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SRHA" ]

// set the file paths and directory
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + "/"

// get the list of the tests.
echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )

// save the functions to run test in the dictionary.
def tests = [ : ]
for ( String test : SRHA.keySet() ){
    toBeRun = testsToRun.contains( test )
    def stepName = ( toBeRun ? "" : "Not " ) + "Running $test"
    tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false,
                                     SRHA, graph_generator_file, graph_saved_directory )
}

// get start time
start = funcs.getCurrentTime()

// run the tests sequentially
for ( test in tests.keySet() ){
    tests[ test ].call()
}
//funcs.generateOverallGraph( prop, SR, graph_saved_directory )
// send the notification of ending test after SRHA tests are done.
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
