// 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 manual-graph-generator-trend

#!groovy

// read the dependency functions
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )

fileRelated.init()

// read the node cluster ( VM or BM or Fabrics ) from the Jenkins job.
nodeCluster = params.NodeCluster

funcs.initializeTrend( nodeCluster );

// do additional check for Fabric since it will be different depends on which branch it is running on.
if( nodeCluster == "Fabric" )
  funcs.additionalInitForSR( params.ONOSbranch )
def prop = null
prop = funcs.getProperties()

// get the list of the tests from the parameters.
def Tests = params.Test
prop[ "ONOSBranch" ] = params.ONOSbranch

// set some of the paths of the file and directory
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-" + nodeCluster + ( nodeCluster == "Fabric" ? funcs.fabricOn( prop[ "ONOSBranch" ] ) : "" ) + "/"

def testsToRun = null
testsToRun = funcs.getTestsToRun( Tests )

// set functions into the dictionary.
def tests = [:]
for( String test : testsToRun ){
    println test
    tests[ test ] = funcs.runTest( test, true, prop, test, true, [], graph_generator_file, graph_saved_directory )
}

parallel tests
//for ( test in tests.keySet() ){
//    tests[ test ].call()
//}
