Merge "Adding documentations for the Jenkins file"
diff --git a/TestON/JenkinsFile/CHO_Graph_Generator b/TestON/JenkinsFile/CHO_Graph_Generator
index 424f9a3..da81c04 100644
--- a/TestON/JenkinsFile/CHO_Graph_Generator
+++ b/TestON/JenkinsFile/CHO_Graph_Generator
@@ -1,36 +1,80 @@
+// 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 graph-generator-CHO jenkins job.
+
#!groovy
+// Read the files that has the dependencies
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
fileRelated.init()
+// The way reading the parameters from the Jenkins.
branches = params.ONOSbranch
hours = params.hours
+
+// divide the branch list into the list that was separated by newline, semi-colon, comma or space
branchList = branches.tokenize( "\n;, " )
+
+// initialize the directory.
+
+// Script file is the R script path
script_file = fileRelated.trendCHO
+// saving_directory is the directory that save the generate graphs.
saving_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric5/"
scriptDir = fileRelated.CHOScriptDir
+// create a bash script that will generate the graph
graphScript = generateGraphScript( branchList )
stage( 'Generating-Graph' ){
+ // This will run on TestStation-Fabric5s node.
node( "TestStation-Fabric5s" ){
+ // run the bash script on this node.
runScript( graphScript )
}
}
+// stage that will trigger postjob.
+// Need to be executed outside the current node to avoid deadlock.
stage( 'posting-result' ){
postJob()
}
def generateGraphScript( branchList ){
+ // Generate the bash script that will run the Rscript to make graph.
graphScript = ''''''
+
+ // In case there are multiple branches running.
for( branch in branchList ){
branchDir = scriptDir + branch + "/"
graphScript += '''export BRANCH=''' + branchDir + '''
+ # make branch dir if not existing.
mkdir ''' + branchDir + ''';
+ # inside the branchDir, check if there were existing graph
if [ ! -f ''' + branchDir + '''existing.txt ]; then
+ # If it was first generated, it will copy .csv file.
cp *.csv ''' + branchDir + ''';
+ # mark that this has created already.
echo "1" > ''' + branchDir + '''existing.txt;
fi;
+ # run the log-summary that will export status
bash log-summary;''' + '''
+ # run Rscript with it's parameters.
Rscript ''' + script_file + ' ' + branchDir + 'event.csv ' +
branchDir + 'failure.csv ' + branchDir + 'error.csv ' +
branch + ' 60 ' + hours + ' ' + saving_directory + ''';
@@ -40,6 +84,7 @@
return graphScript
}
def runScript( graphScript ){
+ // run bash script that will init the environment and run the graph generating part.
sh '''#!/bin/bash -l
set -i
set +e
@@ -48,6 +93,7 @@
''' + graphScript
}
def postJob(){
- jobToRun = "postjob-Fabric5"
- build job: jobToRun, propagate: false
+ // Triggering jenkins job called `postjob-Fabric5`
+ jobToRun = "postjob-Fabric5"
+ build job: jobToRun, propagate: false
}
diff --git a/TestON/JenkinsFile/FUNCJenkinsFile b/TestON/JenkinsFile/FUNCJenkinsFile
index c063ee2..24c5f71 100644
--- a/TestON/JenkinsFile/FUNCJenkinsFile
+++ b/TestON/JenkinsFile/FUNCJenkinsFile
@@ -1,24 +1,56 @@
+// 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 FUNC-pipeline-<branch>
+
#!groovy
+
+// read the dependency files
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' )
fileRelated.init()
+
+// initialize the funcs with category of FUNC
funcs.initialize( "FUNC" );
// This is a Jenkinsfile for a scripted pipeline for the FUNC tests
def prop = null
+
+// Read the TestONOS.property from the VM
prop = funcs.getProperties()
+
+// get the list of the test and init branch to it.
FUNC = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "FUNC" ]
+// init some directories
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
+// get the list of the test to run
echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )
+// run the test sequentially and save the function into the dictionary.
def tests = [:]
for( String test : FUNC.keySet() ){
toBeRun = testsToRun.contains( test )
@@ -26,10 +58,16 @@
tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, FUNC, graph_generator_file, graph_saved_directory )
}
+// get the start time of the test.
start = funcs.getCurrentTime()
-// run the tests
+
+// run the tests sequentially.
for ( test in tests.keySet() ){
tests[ test ].call()
}
+
+// generate the overall graph of the FUNC tests.
funcs.generateOverallGraph( prop, FUNC, graph_saved_directory )
+
+// send the notification to Slack that running FUNC tests was ended.
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
diff --git a/TestON/JenkinsFile/FabricJenkinsfileTrigger b/TestON/JenkinsFile/FabricJenkinsfileTrigger
index ef805a9..b5d09bd 100644
--- a/TestON/JenkinsFile/FabricJenkinsfileTrigger
+++ b/TestON/JenkinsFile/FabricJenkinsfileTrigger
@@ -1,19 +1,49 @@
+// 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 : "" ],
@@ -22,6 +52,8 @@
"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",
@@ -33,6 +65,7 @@
"VP" : "USECASE"
]
+// set some variables from the parameter
manually_run = params.manual_run
onos_b = current_version
test_branch = ""
@@ -44,70 +77,104 @@
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",
@@ -123,7 +190,12 @@
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 ] ){
@@ -133,6 +205,9 @@
}
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;
}
diff --git a/TestON/JenkinsFile/HAJenkinsFile b/TestON/JenkinsFile/HAJenkinsFile
index 7a0638d..7c9bafd 100644
--- a/TestON/JenkinsFile/HAJenkinsFile
+++ b/TestON/JenkinsFile/HAJenkinsFile
@@ -1,23 +1,56 @@
+// 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 HA-pipeline-<branch>
+
#!groovy
+
+// read the dependency files
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' )
fileRelated.init()
+
+// initialize the funcs with category of HA
funcs.initialize( "HA" );
-// This is a Jenkinsfile for a scripted pipeline for the HA tests
+
+// This is a Jenkinsfile for a scripted pipeline for the FUNC tests
def prop = null
+
+// Read the TestONOS.property from the VM
prop = funcs.getProperties()
+
+// get the list of the test and init branch to it.
HA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "HA" ]
+// init some directories
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
+// get the list of the test to run
echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )
+// run the test sequentially and save the function into the dictionary.
def tests = [:]
for( String test : HA.keySet() ){
toBeRun = testsToRun.contains( test )
@@ -25,10 +58,15 @@
tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, HA, graph_generator_file, graph_saved_directory )
}
+// get the start time of the test.
start = funcs.getCurrentTime()
-// run the tests
+// run the tests sequentially.
for ( test in tests.keySet() ){
tests[ test ].call()
}
+
+// generate the overall graph of the HA tests.
funcs.generateOverallGraph( prop, HA, graph_saved_directory )
+
+// send the notification to Slack that running HA tests was ended.
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
diff --git a/TestON/JenkinsFile/JenkinsfileTrigger b/TestON/JenkinsFile/JenkinsfileTrigger
index 6625355..2523a1c 100644
--- a/TestON/JenkinsFile/JenkinsfileTrigger
+++ b/TestON/JenkinsFile/JenkinsfileTrigger
@@ -1,9 +1,35 @@
+// 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 all-pipeline-trigger
+
#!groovy
+
+// read the dependency functions
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
+// get current time and send the notification of starting the test.
def now = funcs.getCurrentTime()
print now.toString()
today = now[ Calendar.DAY_OF_WEEK ]
+
+// read the passed parameters from the Jenkins.
machines = params.machines
manually_run = params.manual_run
if( !manually_run ){
@@ -13,17 +39,20 @@
+ "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
}
+// store the list of the machines into the dictionary.
machineList = machines.tokenize( "\n;, " )
machineOn = [:]
+// save the triggering job function as a dictionary.
for (machine in machineList){
print( machine )
machineOn[ machine ] = triggerJob( machine )
}
+// run the triggering jobs concurrently.
parallel machineOn
-
+// function that will trigger the specific jobs from current pipeline.
def triggerJob( on ){
return{
jobToRun = on + "-pipeline-trigger"
diff --git a/TestON/JenkinsFile/Overall_Graph_Generator b/TestON/JenkinsFile/Overall_Graph_Generator
index f08f18a..e96a65f 100644
--- a/TestON/JenkinsFile/Overall_Graph_Generator
+++ b/TestON/JenkinsFile/Overall_Graph_Generator
@@ -1,18 +1,46 @@
+// 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-overall
+
#!groovy
+
+// read the dependency functions.
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' )
fileRelated.init()
+
+// set the file and directory paths.
stat_graph_generator_file = fileRelated.histogramMultiple
pie_graph_generator_file = fileRelated.pieMultiple
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
+// init trend which will generate the pie and histogram graphs to be VM.
funcs.initializeTrend( "VM" )
onos_branch = params.ONOSbranch
AllTheTests = test_lists.getAllTheTests("")
+// generate the graph and post the result on TestStation-VMs. Right now, all the pie and histograms are saved
+// on VM.
funcs.generateStatGraph( "TestStation-VMs",
onos_branch,
AllTheTests,
diff --git a/TestON/JenkinsFile/SCPFJenkinsFile b/TestON/JenkinsFile/SCPFJenkinsFile
index 5f039b5..a890608 100644
--- a/TestON/JenkinsFile/SCPFJenkinsFile
+++ b/TestON/JenkinsFile/SCPFJenkinsFile
@@ -1,19 +1,49 @@
+// 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 SCPF-pipeline-<branch>
+
#!groovy
+
+// read the dependency files
SCPFfuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy' )
SCPFfuncs.init()
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
+
+// init funcs with SCPF specificaton
funcs.initialize( "SCPF", SCPFfuncs );
-// This is a Jenkinsfile for a scripted pipeline for the SCPF tests
+
+// read the information from TestON.property on BM
def prop = null
prop = funcs.getProperties()
+// get the list of the test to run.
echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )
+// check if it is using old flow.
isOldFlow = prop[ "isOldFlow" ] == "true"
SCPFfuncs.oldFlowRuleCheck( isOldFlow, prop[ "ONOSBranch" ] )
+
+// set test to run as a list of function
def tests = [:]
for( String test : SCPFfuncs.SCPF.keySet() ){
toBeRun = testsToRun.contains( test )
@@ -23,9 +53,12 @@
tests[ stepName ] = funcs.runTest( test, toBeRun, prop, pureTestName, false, SCPFfuncs.SCPF, "", "" )
}
+// get start time
start = funcs.getCurrentTime()
-// run the tests
+// run the tests sequentially
for ( test in tests.keySet() ){
tests[ test ].call()
}
+
+// send result to slack after running test is done.
funcs.sendResultToSlack( start, prop["manualRun"], prop[ "WikiPrefix" ] )
diff --git a/TestON/JenkinsFile/SCPF_Graph_Generator b/TestON/JenkinsFile/SCPF_Graph_Generator
index 938faf8..146e72e 100644
--- a/TestON/JenkinsFile/SCPF_Graph_Generator
+++ b/TestON/JenkinsFile/SCPF_Graph_Generator
@@ -1,4 +1,27 @@
+// 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-SCPF
+
#!groovy
+
+// read and set the functions from dependcies.
SCPFfuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy' )
SCPFfuncs.init()
funcs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy' )
@@ -7,6 +30,7 @@
def prop = null
prop = funcs.getProperties()
+// get the variables from the Jenkins parameters.
def Tests = params.Test
isOldFlow = params.isOldFlow
prop[ "ONOSBranch" ] = params.ONOSbranch
@@ -16,6 +40,7 @@
def testsToRun = null
testsToRun = funcs.getTestsToRun( Tests )
+// pureTestName is because we don't want 'WFobj' to be used for test name.
def tests = [:]
for( String test : testsToRun ){
println test
@@ -23,6 +48,8 @@
tests[ test ] = funcs.runTest( test, true, prop, pureTestName, true, [], "", "" )
}
-for ( test in tests.keySet() ){
- tests[ test ].call()
-}
+// generate the graphs sequentially.
+parallel tests
+//for ( test in tests.keySet() ){
+// tests[ test ].call()
+//}
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index c9c00e5..bc2ac39 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -1,25 +1,57 @@
+// 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 SR-pipeline-<branch>
+
#!groovy
+
+// 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 configuratin to be SR
fileRelated.init()
funcs.initialize( "SR" );
+
+// get the name of the Jenkins job.
jobName = env.JOB_NAME
+
+// additional setup for Segment routing because it is running multiple branch concurrently on different machines.
funcs.additionalInitForSR( jobName )
-// This is a Jenkinsfile for a scripted pipeline for the SR tests
+
+// read the TestON.property depends on which branch it is running. ( currently 1.13 and master on Fabric2, 1.12 on Fabric3 )
def prop = null
prop = funcs.getProperties()
SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
+// set the file paths and directory
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
+// 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 : SR.keySet() ){
toBeRun = testsToRun.contains( test )
@@ -27,10 +59,13 @@
tests[stepName] = funcs.runTest( test, toBeRun, prop, test, false, SR, graph_generator_file, graph_saved_directory )
}
+// get start time
start = funcs.getCurrentTime()
-// run the tests
+
+// 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 SR tests is done.
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
diff --git a/TestON/JenkinsFile/Trend_Graph_Generator b/TestON/JenkinsFile/Trend_Graph_Generator
index 3430b40..fbdd54b 100644
--- a/TestON/JenkinsFile/Trend_Graph_Generator
+++ b/TestON/JenkinsFile/Trend_Graph_Generator
@@ -1,32 +1,62 @@
+// 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 )
}
-for ( test in tests.keySet() ){
- tests[ test ].call()
-}
+parallel tests
+//for ( test in tests.keySet() ){
+// tests[ test ].call()
+//}
diff --git a/TestON/JenkinsFile/USECASEJenkinsFile b/TestON/JenkinsFile/USECASEJenkinsFile
index 6493914..98b58da 100644
--- a/TestON/JenkinsFile/USECASEJenkinsFile
+++ b/TestON/JenkinsFile/USECASEJenkinsFile
@@ -1,23 +1,51 @@
+// 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 USECASE-pipeline-<branch>
+
#!groovy
+
+// set the 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 of funcs to be USECASE
fileRelated.init()
funcs.initialize( "USECASE" );
-// This is a Jenkinsfile for a scripted pipeline for the USECASE tests
+
+// read the TestON.property files and save it as a dictionary
def prop = null
prop = funcs.getProperties()
USECASE = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "USECASE" ]
+// save directory and file.
graph_generator_file = fileRelated.trendIndividual
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
+// get tests to run.
echo( "Testcases:" )
def testsToRun = null
testsToRun = funcs.getTestsToRun( prop[ "Tests" ] )
funcs.printTestToRun( testsToRun )
+// save the function of the test running into the dictionary.
def tests = [:]
for( String test : USECASE.keySet() ){
toBeRun = testsToRun.contains( test )
@@ -25,10 +53,15 @@
tests[ stepName ] = funcs.runTest( test, toBeRun, prop, test, false, USECASE, graph_generator_file, graph_saved_directory )
}
+// get start time of the test.
start = funcs.getCurrentTime()
-// run the tests
+// run the tests sequntially
for ( test in tests.keySet() ){
tests[ test ].call()
}
+
+// send the result to slack after USECASE test is done.
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
+
+// generate the overall graph for USECASE.
funcs.generateOverallGraph( prop, USECASE, graph_saved_directory )
diff --git a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
index 119b427..ee7a5ed 100644
--- a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
+++ b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
@@ -1,17 +1,48 @@
+// 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 vm-pipeline-trigger or bm-pipeline-trigger
+
#!groovy
+// set the functions of the dependencies.
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' )
+// set the versions of the onos
fileRelated.init()
current_version = "master"
previous_version = "1.13"
before_previous_version = "1.12"
+
+// init trend graphs to be on VM.
funcs.initializeTrend( "VM" );
triggerFuncs.init( funcs )
+
+// contents for page https://wiki.onosproject.org/display/ONOS/Automated+Test+Schedule
+// which will demonstrates the list of the scheduled tests on the days.
wikiContents = ""
+
+// default FUNC,HA to be VM, SCPF,USECASE to be BM.
+// SR will not be used in here.
testcases = [
"FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
"HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
@@ -19,6 +50,8 @@
"SR" : [ tests : "", nodeName : "Fabric", wikiContent : "" ],
"USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
]
+
+// depends on the first two characters of the test name, it will be divided.
Prefix_organizer = [
"FU" : "FUNC",
"HA" : "HA",
@@ -30,7 +63,10 @@
"VP" : "USECASE"
]
+// read the parameters from the Jenkins
manually_run = params.manual_run
+
+// set default onos_b to be current_version.
onos_b = current_version
test_branch = ""
onos_tag = params.ONOSTag
@@ -41,28 +77,39 @@
print now.toString()
today = now[ Calendar.DAY_OF_WEEK ]
+// get branch from parameter if it is manually running
if ( manually_run ){
onos_b = params.ONOSVersion
} else {
+ // otherwise, the version would be different over the weekend.
+ // If today is weekdays, it will be default to current_version.
if ( today == Calendar.SATURDAY ){
onos_b = previous_version
} else if( today == Calendar.SUNDAY ){
onos_b = before_previous_version
}
}
+
+// Get all the list of the tests from the JenkinsTestONTests.groovy
AllTheTests = test_lists.getAllTheTests( onos_b )
+// list of the tests to be run will be saved in each choices.
day = ""
SCPF_choices = ""
USECASE_choices = ""
FUNC_choices = ""
HA_choices = ""
SR_choices = ""
+
+// init some paths for the files and directories.
stat_graph_generator_file = fileRelated.histogramMultiple
pie_graph_generator_file = fileRelated.pieMultiple
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
+// get post result from the params for manually run.
post_result = params.PostResult
+
+// if automatically run, it will remove the comma at the end after dividing the tests.
if( !manually_run ){
testDivider( today )
FUNC_choices = triggerFuncs.lastCommaRemover( FUNC_choices )
@@ -72,6 +119,7 @@
SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
}
+
if ( manually_run ){
testcases = triggerFuncs.organize_tests( params.Tests, testcases )
@@ -92,6 +140,8 @@
"VM" : [:],
"BM" : [:]
]
+
+// set the test running function into the dictionary.
for( String test in testcases.keySet() ){
println test
if ( testcases[ test ][ "tests" ] != "" ){
@@ -99,15 +149,22 @@
}
}
def finalList = [:]
+
+// get the name of the job.
jobName = env.JOB_NAME
+
+// first set the list of the functions to be run.
finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] )
finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] )
-//parallel finalList
+
+// if first two character of the job name is vm, only call VM.
+// else, only on BM
if( jobName.take( 2 ) == "vm" )
finalList[ "VM" ].call()
else
finalList[ "BM" ].call()
+// If it is automated running, it will generate the stats graph on VM.
if ( !manually_run ){
funcs.generateStatGraph( "TestStation-VMs",
funcs.branchWithPrefix( onos_b ),
@@ -117,9 +174,13 @@
graph_saved_directory )
}
+// function that will divide tests depends on which day it is.
def testDivider( today ){
switch ( today ) {
case Calendar.MONDAY:
+ // THe reason Monday calls all the days is because we want to post the test schedules on the wiki
+ // and slack channel every monday.
+ // It will only generate the list of the test for monday.
initHtmlForWiki()
monday( true )
tuesday( true, false )
@@ -159,8 +220,13 @@
break
}
}
+
+// function for monday.
def monday( getResult ){
+ // add header for wiki page script.
addingHeader( "FUNC" )
+ // call category of basic and extra_A of FUNC tests.
+ // put M into the dictionary.
FUNC_choices += adder( "FUNC", "basic", true, "M", getResult )
FUNC_choices += adder( "FUNC", "extra_A", true, "M", getResult )
closingHeader( "FUNC" )
@@ -178,6 +244,9 @@
addingHeader( "USECASE" )
closingHeader( "USECASE" )
}
+
+// If get result is false, it will not add the test result to xx_choices, but will generate the
+// header and days
def tuesday( getDay, getResult ){
addingHeader( "FUNC" )
FUNC_choices += adder( "FUNC", "basic", getDay, "T", getResult )
@@ -309,7 +378,15 @@
USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult )
closingHeader( "USECASE" )
}
+
+// adder that will return the list of the tests.
def adder( testCat, set, dayAdding, day, getResult ){
+ // testCat : the category of the test which will be either FUNC,HA,SR...
+ // set : the set of the test to be run which will be basic,extra_A,extra_B...
+ // dayAdding : boolean whether to add the days into the list or not
+ // day : the day you are trying to add (m,t,w,th... )
+ // getResult : if want to get the list of the test to be run. False will return empty list.
+ // And once the list is empty, it will not be run.
result = ""
for( String test in AllTheTests[ testCat ].keySet() ){
if( AllTheTests[ testCat ][ test ][ set ] ){
@@ -317,11 +394,14 @@
result += test + ","
if( dayAdding )
dayAdder( testCat, test, day )
+ // make HTML columns for wiki page on schedule.
makeHtmlColList( testCat, test )
}
}
return result
}
+
+// Initial part of the wiki page.
def initHtmlForWiki(){
wikiContents = '''
<table class="wrapped confluenceTable">
@@ -352,21 +432,29 @@
<th colspan="1" class="confluenceTh">''' + test + '''</th>'''
}
}
+
+// adding header functionality.
def addingHeader( testCategory ){
testcases[ testCategory ][ 'wikiContent' ] += '''
<td class="confluenceTd">
<ul>'''
}
+
+// making column list for html
def makeHtmlColList( testCategory, testName ){
testcases[ testCategory ][ 'wikiContent' ] += '''
<li>'''+ testName +'''</li>'''
}
+
+// closing the header for html
def closingHeader( testCategory ){
testcases[ testCategory ][ 'wikiContent' ] += '''
</ul>
</td>'''
}
+
+// close the html for the wiki page.
def closeHtmlForWiki(){
for( String test in testcases.keySet() ){
wikiContents += testcases[ test ][ 'wikiContent' ]
@@ -381,6 +469,8 @@
<p>On <strong>Saturdays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( previous_version ) +''' branch.</p>
<p>On <strong>Sundays</strong>, all the other tests are built and run on the '''+ funcs.branchWithPrefix( before_previous_version ) +''' branch.</p>'''
}
+
+// post the result to wiki page using publish to confluence.
def postToWiki( contents ){
node( testMachine ){
workspace = fileRelated.jenkinsWorkspace + "all-pipeline-trigger/"
@@ -391,6 +481,8 @@
workspace + filename )
}
}
+
+// add the day to the "day" on the dictionary.
def dayAdder( testCat, testName, dayOfWeek ){
AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + ","
}
diff --git a/TestON/JenkinsFile/dependencies/GeneralFuncs.groovy b/TestON/JenkinsFile/dependencies/GeneralFuncs.groovy
index a0c70c9..7618fe0 100644
--- a/TestON/JenkinsFile/dependencies/GeneralFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/GeneralFuncs.groovy
@@ -1,11 +1,38 @@
+// 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 dependency Jenkins script.
+// it has some general functionality of making database command, basic graph part, and get list of the test
+
#!groovy
+// make the init part of the database command
def database_command_create( pass, host, port, user ){
return pass + "|psql --host=" + host + " --port=" + port + " --username=" + user + " --password --dbname onostest -c "
}
+
+// make the basic graph part for the Rscript
def basicGraphPart( rFileName, host, port, user, pass, subject, branchName ){
return " Rscript " + rFileName + " " + host + " " + port + " " + user + " " + pass + " " + subject + " " + branchName
}
+
+// get the list of the test as dictionary then return as a string
def getTestList( tests ){
list = ""
for( String test : tests.keySet() )
diff --git a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
index 8c480d3..2b3a23a 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsCommonFuncs.groovy
@@ -1,3 +1,25 @@
+// 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 dependency Jenkins script.
+// it has some common functions that runs test and generate graph.
+
#!groovy
import groovy.time.*
generalFuncs = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/GeneralFuncs.groovy' )
@@ -6,6 +28,9 @@
fileRelated.init()
def initializeTrend( machine ){
+ // For initializing any trend graph jobs
+ // machine : Either VM,BM, or Fabric#
+
table_name = "executed_test_tests"
result_name = "executed_test_results"
testMachine = "TestStation-" + machine + "s";
@@ -14,12 +39,19 @@
isTrend = true
}
def initialize( type, SCPFfuncs ){
+ // Initializing for SCPF tests
+ // type : type of the test ( SR,FUNC,SCPF... )
+ // Passing the SCPFfunction which will be PerformanceFuncs.groovy
+
init( type )
SCPFfunc = SCPFfuncs
isSCPF = true
machine = machineType[ type ]
}
def initialize( type ){
+ // initializing for FUNC,HA,SR, and USECASE
+ // type : type of the test ( SR,FUNC,SCPF... )
+
init( type )
SCPFfunc = null
table_name = "executed_test_tests"
@@ -29,6 +61,8 @@
isSCPF = false
}
def init( type ){
+ // type : type of the test ( SR,FUNC,SCPF... )
+
machineType = [ "FUNC" : "VM",
"HA" : "VM",
"SR" : "Fabric",
@@ -39,6 +73,9 @@
isTrend = false
}
def additionalInitForSR( branch ){
+ // additional setup for SegmentRouting tests to determine the machine depends on the branch it is running.
+ // branch : branch of the onos. ( master, 1.12, 1.13... )
+
testMachine = ( ( new StringBuilder( testMachine ) ).insert( testMachine.size()-1, fabricOn( branch ) ) ).toString()
if( isTrend )
machine += fabricOn( branch )
@@ -47,33 +84,53 @@
print testMachine
}
def fabricOn( branch ){
+ // gets the fabric machines with the branch of onos.
+ // branch : master, 1.12, 1.13...
+
return branch.reverse().take(4).reverse() == "1.12" ? '3' : '2'
}
def printType(){
+ // print the test type and test machine that was initialized.
+
echo testType;
echo testMachine;
}
def getProperties(){
+ // get the properties of the test by reading the TestONOS.property
+
node( testMachine ){
return readProperties( file:'/var/jenkins/TestONOS.property' );
}
}
def getTestsToRun( testList ){
+ // get test to run by tokenizing the list.
+
testList.tokenize("\n;, ")
}
def getCurrentTime(){
+ // get time of the PST zone.
+
TimeZone.setDefault( TimeZone.getTimeZone('PST') )
return new Date();
}
def getTotalTime( start, end ){
+ // get total time of the test using start and end time.
+
return TimeCategory.minus( end, start );
}
def printTestToRun( testList ){
+ // printout the list of the test in the list.
+
for ( String test : testList ) {
println test;
}
}
def sendResultToSlack( start, isManualRun, branch ){
+ // send the result of the test to the slack when it is not manually running.
+ // start : start time of the test
+ // isManualRun : string that is whether "false" or "true"
+ // branch : branch of the onos.
+
try{
if( isManualRun == "false" ){
end = getCurrentTime();
@@ -85,7 +142,11 @@
catch( all ){}
}
def initAndRunTest( testName, testCategory ){
- // after ifconfig : ''' + borrowCell( testName ) + '''
+ // Bash script that will
+ // Initialize the environment to the machine and run the test.
+ // testName : name of the test
+ // testCategory : (SR,FUNC ... )
+
return '''#!/bin/bash -l
set -i # interactive
set +e
@@ -111,6 +172,9 @@
git clean -df'''
}
def copyLogs( testName ){
+ // bash script part for copy the logs and other neccessary element for SR tests.
+ // testName : name of the test.
+
result = ""
if( testType == "SR" ){
result = '''
@@ -125,6 +189,9 @@
return result
}
def cleanAndCopyFiles( testName ){
+ // clean up some files that were in the folder and copy the new files from the log
+ // testName : name of the test
+
return '''#!/bin/bash -i
set +e
echo "ONOS Branch is: ${ONOSBranch}"
@@ -150,6 +217,9 @@
cd '''
}
def fetchLogs( testName ){
+ // fetch the logs of onos from onos nodes to onos System Test logs
+ // testName: name of the test
+
return '''#!/bin/bash
set +e
cd ~/OnosSystemTest/TestON/logs
@@ -169,14 +239,25 @@
cd'''
}
def isPostingResult( manual, postresult ){
+ // check if it is posting the result.
+ // posting when it is automatically running or has postResult condition from the manual run
+
return manual == "false" || postresult == "true"
}
def postResult( prop, graphOnly ){
+ // post the result by triggering postjob.
+ // prop : property dictionary that was read from the machine.
+ // graphOnly : if it is graph generating job
+
if( graphOnly || isPostingResult( prop[ "manualRun" ], prop[ "postResult" ] ) ){
def post = build job: "postjob-" + ( graphOnly ? machine : machineType[ testType ] ), propagate: false
}
}
def postLogs( testName, prefix ){
+ // posting logs of the onos jobs specifically SR tests
+ // testName : name of the test
+ // prefix : branch prefix ( master, 1.12, 1.13 ... )
+
resultURL = ""
if( testType == "SR" ){
def post = build job: "SR-log-" + prefix, propagate: false
@@ -185,9 +266,21 @@
return resultURL
}
def getSlackChannel(){
+ // get name of the slack channel.
+ // if the test is SR, it will return sr-failures
+
return "#" + ( testType == "SR" ? "sr-failures" : "jenkins-related" )
}
def analyzeResult( prop, workSpace, testName, otherTestName, resultURL, wikiLink, isSCPF ){
+ // analyzing the result of the test and send to slack if the test was failed.
+ // prop : property dictionary
+ // workSpace : workSpace where the result file is saved
+ // testName : real name of the test
+ // otherTestName : other name of the test for SCPF tests ( SCPFflowTPFobj )
+ // resultURL : url for the logs for SR tests. Will not be posted if it is empty
+ // wikiLink : link of the wiki page where the result was posted
+ // isSCPF : Check if it is SCPF. If so, it won't post the wiki link.
+
node( testMachine ){
resultContents = readFile workSpace + "/" + testName + "Result.txt"
resultContents = resultContents.split("\n")
@@ -209,6 +302,12 @@
}
}
def publishToConfluence( isManualRun, isPostResult, wikiLink, file ){
+ // publish HTML script to wiki confluence
+ // isManualRun : string "true" "false"
+ // isPostResult : string "true" "false"
+ // wikiLink : link of the wiki page to publish
+ // file : name of the file to be published
+
if( isPostingResult( isManualRun, isPostResult ) ){
publishConfluence siteName: 'wiki.onosproject.org', pageName: wikiLink, spaceName: 'ONOS',
attachArchivedArtifacts: true, buildIfUnstable: true,
@@ -219,6 +318,16 @@
}
def runTest( testName, toBeRun, prop, pureTestName, graphOnly, testCategory, graph_generator_file, graph_saved_directory ) {
+ // run the test on the machine that contains all the steps : init and run test, copy files, publish result ...
+ // testName : name of the test
+ // toBeRun : boolean value whether the test will be run or not. If not, it won't be run but shows up with empty result on pipeline view
+ // prop : dictionary property on the machine
+ // pureTestName : Pure name of the test. ( ex. pureTestName of SCPFflowTpFobj will be SCPFflowTp )
+ // graphOnly : check if it is generating graph job. If so, it will only generate the generating graph part
+ // testCategory : category of the test ( SCPF, SR, FUNC ... )
+ // graph_generator_file : Rscript file with the full path.
+ // graph_saved_directory : where the generated graph will be saved to.
+
return {
catchError{
stage( testName ) {
@@ -259,17 +368,15 @@
}
}
}
-def borrowCell( testName ){
- result = ""
- if( testType == "SR" ){
- result = '''
- cd
- source ~/borrow.cell
- '''
- }
- return result
-}
def databaseAndGraph( prop, testName, graphOnly, graph_generator_file, graph_saved_directory ){
+ // part where it insert the data into the database.
+ // It will use the predefined encrypted variables from the Jenkins.
+ // prop : property dictionary that was read from the machine
+ // testName : name of the test
+ // graphOnly : boolean whether it is graph only or not
+ // graph_generator_file : Rscript file with the full path.
+ // graph_saved_directory : where the generated graph will be saved to.
+
if( graphOnly || isPostingResult( prop[ "manualRun" ], prop[ "postResult" ] ) ){
// Post Results
withCredentials( [
@@ -288,6 +395,17 @@
}
}
def generateCategoryStatsGraph( testMachineOn, manualRun, postresult, stat_file, pie_file, type, branch, testListPart, save_path, pieTestListPart ){
+ // function that will generate the category stat graphs for the overall test.
+ // testMachineOn : the machine the graph will be generated. It will be TestStation-VMs for the most cases
+ // manualRun : string of "true" or "false"
+ // postresult : string of "true" or "false"
+ // stat_file : file name with full path for Rscript for the stat graph
+ // pie_file : file name with full path for Rscript for the pie graph
+ // type : type of the test ( USECASE, FUNC, HA )
+ // branch : branch of the test ( master, onos-1.12, onos-1.13 )
+ // testListPart : list of the test to be included
+ // save_path : path that will save the graphs to
+ // pieTestListPart : list of the test for pie graph
if( isPostingResult( manualRun, postresult ) ){
node( testMachineOn ){
@@ -307,12 +425,22 @@
}
}
def makeTestList( list, commaNeeded ){
+ // make the list of the test in to a string.
+ // list : list of the test
+ // commaNeeded : if comma is needed for the string
+
return generalFuncs.getTestList( list ) + ( commaNeeded ? "," : "" )
}
def createStatsList( testCategory, list, semiNeeded ){
+ // make the list for stats
+ // testCategory : category of the test
+ // list : list of the test
+ // semiNeeded: if semi colon is needed
+
return testCategory + "-" + generalFuncs.getTestList( list ) + ( semiNeeded ? ";" : "" )
}
def generateOverallGraph( prop, testCategory, graph_saved_directory ){
+ // generate the overall graph for the test
if( isPostingResult( prop[ "manualRun" ], prop[ "postResult" ] ) ){
node( testMachine ){
@@ -331,15 +459,23 @@
}
}
def getOverallPieGraph( file, host, port, user, pass, branch, type, testList, yOrN, path ){
+ // Rcommand for the pie graph
+
return generalFuncs.basicGraphPart( file, host, port, user, pass, type, branch ) + " \"" + testList + "\" latest " + yOrN + " " + path
}
def sqlCommand( testName ){
+ // get the inserting sqlCommand for non-SCPF tests.
+
return "\"INSERT INTO " + table_name + " VALUES('\$DATE','" + result_name + "','" + testName + "',\$BUILD_NUMBER, '\$ONOSBranch', \$line);\" "
}
def graphGenerating( host, port, user, pass, testName, prop, graph_saved_directory, graph_generator_file ){
+ // get the graphGenerating R command for non-SCPF tests
+
return generalFuncs.basicGraphPart( graph_generator_file, host, port, user, pass, testName, prop[ "ONOSBranch" ] ) + " 20 " + graph_saved_directory
}
def databasePart( wikiPrefix, testName, database_command ){
+ // to read and insert the data from .csv to the database
+
return '''
sed 1d ''' + workSpace + "/" + wikiPrefix + "-" + testName + '''.csv | while read line
do
@@ -348,6 +484,8 @@
done '''
}
def generateStatGraph( testMachineOn, onos_branch, AllTheTests, stat_graph_generator_file, pie_graph_generator_file, graph_saved_directory ){
+ // Will generate the stats graph.
+
testListPart = createStatsList( "FUNC", AllTheTests[ "FUNC" ], true ) +
createStatsList( "HA", AllTheTests[ "HA" ], true ) +
createStatsList( "USECASE", AllTheTests[ "USECASE" ], false )
@@ -357,6 +495,7 @@
generateCategoryStatsGraph( testMachineOn, "false", "true", stat_graph_generator_file, pie_graph_generator_file, "ALL", onos_branch, testListPart, graph_saved_directory, pieTestList )
}
def branchWithPrefix( branch ){
+ // get the branch with the prefix ( "onos-" )
return ( ( branch != "master" ) ? "onos-" : "" ) + branch
}
return this;
diff --git a/TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy b/TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy
index fc89730..b2c30c5 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy
@@ -1,5 +1,28 @@
+// 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 dependency Jenkins script.
+// This will initialize the paths of the jenkins file and paths.
+
#!groovy
+// init the paths for the directory
def initLocation(){
jenkinsFolder = "~/OnosSystemTest/TestON/JenkinsFile/"
rScriptLocation = jenkinsFolder + "wikiGraphRScripts/"
@@ -7,6 +30,8 @@
SCPFSpecificLocation = rScriptLocation + "SCPFspecificGraphRScripts/"
CHOScriptDir = "~/CHO_Jenkins_Scripts/"
}
+
+// init the paths for the files.
def initFiles(){
trendIndividual = rScriptLocation + "trendIndividualTest.R"
trendMultiple = rScriptLocation + "trendMultipleTests.R"
@@ -15,6 +40,8 @@
histogramMultiple = rScriptLocation + "histogramMultipleTestGroups.R"
pieMultiple = rScriptLocation + "pieMultipleTests.R"
}
+
+// init both directory and file paths.
def init(){
initLocation()
initFiles()
diff --git a/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy b/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
index ac27a0c..a47e4c0 100644
--- a/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
+++ b/TestON/JenkinsFile/dependencies/JenkinsTestONTests.groovy
@@ -1,6 +1,37 @@
+// 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 dependency Jenkins script.
+// This will provide the basic information for the tests for scheduling.
+// Any new test to be added should be added here.
+
#!groovy
def getAllTheTests( wikiPrefix ){
+ // This contains the dictionary of the test and the category of them
+ // wikiPrefix : master, 1.13, 1.12 ...
+
+ // category: it will be used to distinguish which category to be run on which days ( basic,extra_A, extra_B ... )
+ // day: it will be used to display the schedule of the test to be run to the slack. It is empty in the first place but will be
+ // filled out every monday.
+ // wiki_link : link of the wiki page that will be used to publish to confluence later on. SCPF tests don't need one.
+
return [
"FUNC":[
"FUNCipv6Intent" : [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCipv6Intent", wiki_file:"FUNCipv6IntentWiki.txt" ],
diff --git a/TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy b/TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy
index a759051..65f9cb5 100644
--- a/TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/PerformanceFuncs.groovy
@@ -1,12 +1,54 @@
+// 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 dependency Jenkins script.
+// This will provide the SCPF specific functions
+
#!groovy
fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/dependencies/JenkinsPathAndFiles.groovy' )
fileRelated.init()
def init(){
+ // init step for SCPFfunctions. It has some mandatory init steps
+
+ // none, batches, neighbors, times : to be used for extra parameters for generating graphs.
none = [ "" ]
batches = [ 1, 100, 1000 ]
neighbors = [ 'y', 'n' ]
times = [ 'y', 'n' ]
+
+ //flows : whether the test is affected by oldFlow or newFlow
+ // test : command of the test to be executed when running the test
+ // table : name of the view table on database
+ // result : name of the actual table on database
+ // file : name of the file that contains the result of the test to be used to insert data to database
+ // rFile : specific Rscript file name to be used to generate each SCPF graph. For with flowObj graphs, you need to put 'n' or 'y' after the test name
+ // extra : extra condition that will be used for Rscript parameter. Some of the Rscript requires extra parameters like if it has
+ // neighbors or batches. In this case, it will generate Rscript x times of what extra has. So that it will generate one with
+ // neighbor = y and the other with neighbor = n
+ // finalResult : If you want to generate overall graph for the front page.
+ // graphTitle : title for the graph. It should contain n numbers depends on how many graphs you are generating.
+ // [Optional]
+ // dbCols : specific dbColumns to choose for 50 data overall graph if there is one.
+ // dbWhere : specific where statement that has some condition for 50 data overall graph if there is one.
+ // y_axis : title of the y_axis to be shown for 50 data overall graph if there is one.
+
SCPF = [
SCPFcbench: [ flows:false, test:'SCPFcbench', table:'cbench_bm_tests', results:'cbench_bm_results', file:'CbenchDB', rFile:'SCPFcbench.R', extra:none, finalResult:1, graphTitle:[ 'Cbench Test' ], dbCols:'avg', dbWhere:'', y_axis:'Throughput (Responses/sec)' ],
SCPFhostLat: [ flows:false, test:'SCPFhostLat', table:'host_latency_tests', results:'host_latency_results', file:'HostAddLatency', rFile:'SCPFhostLat.R', extra:none,finalResult:1, graphTitle:[ 'Host Latency Test' ], dbCols:'avg', dbWhere:'AND scale=5', y_axis:'Latency (ms)' ],
@@ -29,6 +71,8 @@
graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
}
def getGraphCommand( rFileName, extras, host, port, user, pass, testName, branchName, isOldFlow ){
+ // generate the list of Rscript command for individual graphs
+
result = ""
for( extra in extras ){
result += generateGraph( rFileName, " " + extra, host, port, user, pass, testName, branchName, isOldFlow ) + ";"
@@ -36,11 +80,13 @@
return result
}
def generateGraph( rFileName, batch, host, port, user, pass, testName, branchName, isOldFlow ){
+ // generate the Rscript command for individual graphs
return generalFuncs.basicGraphPart( fileRelated.SCPFSpecificLocation + rFileName, host, port, user, pass, testName, branchName ) +
" " + batch + " " + usingOldFlow( isOldFlow, testName ) + graph_saved_directory
}
def generateCombinedResultGraph( host, port, user, pass, testName, branchName, isOldFlow ){
+ // generate Rscript for overall graph for the front page.
result = ""
for ( int i=0; i< SCPF[ testName ][ 'graphTitle' ].size(); i++ ){
@@ -51,32 +97,47 @@
return result
}
def checkIfList( testName, forWhich, pos ){
+ // check if some dictionary has list or string.
+
return SCPF[ testName ][ forWhich ].getClass().getName() != "java.lang.String" ? SCPF[ testName ][ forWhich ][ pos ] : SCPF[ testName ][ forWhich ]
}
def sqlOldFlow( isOldFlow, testName ){
+ // sql where command part for checking old flows.
+
return SCPF[ testName ][ 'flows' ] ? " AND " + ( isOldFlow ? "" : "NOT " ) + "is_old_flow " : ""
}
def oldFlowRuleCheck( isOldFlow, branch ){
+ // checking if it is old flow
+
this.isOldFlow = isOldFlow
if( !isOldFlow ){
SCPF[ 'SCPFflowTp1g' ][ 'test' ] += " --params TEST/flows=" + ( branch == "onos-1.11" ? "4000" : "3500" )
}
}
def affectedByOldFlow( isOldFlow, testName ){
+ // For sql command : if the test is affect by old flow, it will return parameters for old flow
return SCPF[ testName ][ 'flows' ] ? "" + isOldFlow + ", " : ""
}
def usingOldFlow( isOldFlow, testName ){
+ // For Rscript command : if it is using old flow.
+
return SCPF[ testName ][ 'flows' ] ? ( isOldFlow ? "y" : "n" ) + " " : ""
}
def hasOldFlow( isOldFlow, testName ){
+ // For Rscript command for 50 data
+
return ( SCPF[ testName ][ 'flows' ] && isOldFlow ? "y" : "n" ) + " "
}
def sqlCommand( testName ){
+ // sql command for inserting data into the database
+
if ( testName == "SCPFscaleTopo" || testName == "SCPFswitchLat" || testName == "SCPFportLat" )
return "\"INSERT INTO " + SCPF[ testName ][ 'table' ] + " VALUES( '\$DATE','" + SCPF[ testName ][ 'results' ] + "','\$BUILD_NUMBER', \$line, '\$ONOSBranch');\""
return "\"INSERT INTO " + SCPF[ testName ][ 'table' ] + " VALUES( '\$DATE','" + SCPF[ testName ][ 'results' ] + "','\$BUILD_NUMBER', '\$ONOSBranch', " + affectedByOldFlow( isOldFlow, testName ) + "\$line);\""
}
def databasePart( testName, database_command ){
+ // read the file from the machine and insert it to the database
+
return '''
cd /tmp
while read line
@@ -86,6 +147,8 @@
done< ''' + SCPF[ testName ][ 'file' ]
}
def getGraphGeneratingCommand( host, port, user, pass, testName, prop ){
+ // returns the combined Rscript command for each test.
+
return getGraphCommand( SCPF[ testName ][ 'rFile' ], SCPF[ testName ][ 'extra' ], host, port, user, pass, testName, prop[ "ONOSBranch" ], isOldFlow ) + '''
''' + ( SCPF[ testName ][ 'finalResult' ] ? generateCombinedResultGraph( host, port, user, pass, testName, prop[ "ONOSBranch" ], , isOldFlow ) : "" )
}
diff --git a/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy b/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy
index 96c0855..9b290a6 100644
--- a/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy
+++ b/TestON/JenkinsFile/dependencies/TriggerFuncs.groovy
@@ -1,15 +1,42 @@
+// 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 dependency Jenkins script.
+// This will provide the portion that will set up the environment of the machine
+// and trigger the corresponding jobs.
+
#!groovy
def init( commonFuncs ){
funcs = commonFuncs
}
def lastCommaRemover( str ){
+ // function that will remove the last comma from the string
+
if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){
str = str.substring( 0,str.size() - 1 )
}
return str
}
def printDaysForTest( AllTheTests ){
+ // Print the days for what test has.
+
result = ""
for ( String test in AllTheTests.keySet() ){
result += test + " : \n"
@@ -22,6 +49,7 @@
return result
}
def runTestSeq( testList ){
+ // Running the test sequentially
return{
for ( test in testList.keySet() ){
testList[ test ].call()
@@ -29,6 +57,8 @@
}
}
def print_tests( tests ){
+ // print the list of the tsets to be run
+
for( String test in tests.keySet() ){
if( tests[ test ][ "tests" ] != "" ){
println test + ":"
@@ -37,19 +67,18 @@
}
}
def organize_tests( tests, testcases ){
+ // organize the test to its category using its name.
+ // most of the time it will use the first two character of the test name
+ // but there are some exceptions like FUNCbgpls or FUNCvirNetNB since they are now under USECASE
+
testList = tests.tokenize( "\n;, " )
for( String test in testList )
testcases [ Prefix_organizer[ ( test == "FUNCbgpls" || test == "FUNCvirNetNB" ? "US" : ( test[ 0 ] + test[ 1 ] ) ) ] ][ "tests" ] += test + ","
return testcases
}
-def borrow_mn( jobOn ){
- result = ""
- if( jobOn == "SR" ){
- result = "~/cell_borrow.sh"
- }
- return result
-}
def trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){
+ // triggering function that will setup the environment and determine which pipeline to trigger
+
println jobOn + "-pipeline-" + manuallyRun ? "manually" : branch
def wiki = branch
branch = funcs.branchWithPrefix( branch )
@@ -64,14 +93,18 @@
build job: jobToRun, propagate: false
}
def trigger_pipeline( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){
-// nodeName : "BM" or "VM"
-// jobOn : "SCPF" or "USECASE" or "FUNC" or "HA"
+ // nodeName : "BM" or "VM"
+ // jobOn : "SCPF" or "USECASE" or "FUNC" or "HA"
+ // this will return the function by wrapping them up with return{} to prevent them to be
+ // executed once this function is called to assign to specific variable.
return{
trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag )
}
}
// export Environment properties.
def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){
+ // export environment properties to the machine.
+
stage( "export Property" ){
sh '''
echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property
@@ -88,6 +121,8 @@
}
// Initialize the environment Setup for the onos and OnosSystemTest
def envSetup( onos_branch, test_branch, onos_tag, jobOn, manuallyRun ){
+ // to setup the environment using the bash script
+
stage( "envSetup" ) {
// after env: ''' + borrow_mn( jobOn ) + '''
sh '''#!/bin/bash -l
@@ -101,6 +136,8 @@
}
}
def tagCheck( onos_tag, onos_branch ){
+ // check the tag for onos if it is not empty
+
result = "git checkout "
if ( onos_tag == "" )
result += onos_branch //create new local branch
@@ -109,6 +146,8 @@
return result
}
def preSetup( onos_branch, test_branch, onos_tag, isManual ){
+ // pre setup part which will clean up and checkout to corresponding branch.
+
result = ""
if( !isManual ){
result = '''echo -e "\n##### Set TestON Branch #####"
@@ -152,6 +191,8 @@
return result
}
def oldFlowCheck( jobOn, onos_branch ){
+ // part that will check if it is oldFlow. If so, it will switch to use old flow. Only affected with SCPF.
+
result = ""
if( jobOn == "SCPF" && ( onos_branch== "master" || onos_branch=="onos-1.12" ) )
result = '''sed -i -e 's/@Component(immediate = true)/@Component(enabled = false)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/''' + ( isOldFlow ? "DistributedFlowRuleStore" : "ECFlowRuleStore" ) + '''.java
@@ -159,6 +200,8 @@
return result
}
def postSetup( onos_branch, test_branch, onos_tag, isManual ){
+ // setup that will build the onos using buck.
+
result = ""
if( !isManual ){
result = '''echo -e "\n##### build ONOS skip unit tests ######"
@@ -176,6 +219,8 @@
return result
}
def generateKey(){
+ // generate cluster-key of the onos
+
try{
sh '''
#!/bin/bash -l
@@ -187,15 +232,5 @@
'''
}catch( all ){}
}
-def returnCell( nodeName ){
- node( "TestStation-" + nodeName + "s" ){
- sh '''#!/bin/bash -l
- set +e
- . ~/.bashrc
- env
- ~/./return_cell.sh
- '''
- }
-}
return this;