Adding documentations for the Jenkins file
Change-Id: I2ff71c4a787901b80401bb53117572f9c58ef6d0
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;