[ONOS-7577]Add new Fabrics TestMachine to Jenkins and Schedule tests
Change-Id: I2ea8ebae14c262487f0fbb0317bbd41bc236e4de
diff --git a/TestON/JenkinsFile/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
index 2b114d1..7ba926b 100644
--- a/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
@@ -28,7 +28,7 @@
def init( type ){
machineType = [ "FUNC" : "VM",
"HA" : "VM",
- "SR" : "VM",
+ "SR" : "Fabric",
"SCPF" : "BM",
"USECASE" : "BM" ]
testType = type;
diff --git a/TestON/JenkinsFile/JenkinsTestONTests.groovy b/TestON/JenkinsFile/JenkinsTestONTests.groovy
index 97551b2..f78ddff 100644
--- a/TestON/JenkinsFile/JenkinsTestONTests.groovy
+++ b/TestON/JenkinsFile/JenkinsTestONTests.groovy
@@ -58,12 +58,15 @@
"SRLinkFailure": [ "basic":false, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Link Failure", wiki_file:"SRLinkFailureWiki.txt" ],
"SROnosFailure": [ "basic":false, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Onos node Failure", wiki_file:"SROnosFailureWiki.txt" ],
"SRClusterRestart": [ "basic":false, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Cluster Restart", wiki_file:"SRClusterRestartWiki.txt" ],
- "SRDynamic": [ "basic":false, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Dynamic Config", wiki_file:"SRDynamicWiki.txt" ],
+ "SRDynamic": [ "basic":false, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Dynamic", wiki_file:"SRDynamicWiki.txt" ],
"SRHighAvailability": [ "basic":false, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR High Availability", wiki_file:"SRHighAvailabilityWiki.txt" ]
],
"SR":[
"SRBridging": [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Bridging", wiki_file:"SRBridgingWiki.txt" ],
- "SRRouting": [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Routing", wiki_file:"SRRoutingWiki.txt" ]
+ "SRRouting": [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Routing", wiki_file:"SRRoutingWiki.txt" ],
+ "SRDhcprelay": [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Dhcp Relay", wiki_file:"SRDhcprelay.txt" ],
+ "SRDynamicConf": [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Dynamic Config", wiki_file:"SRDynamicConf.txt" ],
+ "SRMulticast": [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "SR Multi Cast", wiki_file:"SRMulticast.txt" ]
]
];
}
diff --git a/TestON/JenkinsFile/JenkinsfileTrigger b/TestON/JenkinsFile/JenkinsfileTrigger
index e960d70..80cda37 100644
--- a/TestON/JenkinsFile/JenkinsfileTrigger
+++ b/TestON/JenkinsFile/JenkinsfileTrigger
@@ -2,16 +2,18 @@
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
previous_version = "1.12"
before_previous_version = "1.11"
funcs.initializeTrend( "VM" );
+triggerFuncs.init( funcs )
wikiContents = ""
testcases = [
"FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
"HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
"SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
- "SR" : [ tests : "", nodeName : "VM", wikiContent : "" ],
+ "SR" : [ tests : "", nodeName : "Fabric", wikiContent : "" ],
"USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
]
Prefix_organizer = [
@@ -64,15 +66,15 @@
+ "Starting tests on : " + now.toString()
+ "\n:sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles::sparkles:" )
testDivider( today )
- FUNC_choices = lastCommaRemover( FUNC_choices )
- HA_choices = lastCommaRemover( HA_choices )
- SCPF_choices = lastCommaRemover( SCPF_choices )
- USECASE_choices = lastCommaRemover( USECASE_choices )
- SR_choices = lastCommaRemover( SR_choices )
+ FUNC_choices = triggerFuncs.lastCommaRemover( FUNC_choices )
+ HA_choices = triggerFuncs.lastCommaRemover( HA_choices )
+ SCPF_choices = triggerFuncs.lastCommaRemover( SCPF_choices )
+ USECASE_choices = triggerFuncs.lastCommaRemover( USECASE_choices )
+ SR_choices = triggerFuncs.lastCommaRemover( SR_choices )
}
if ( manually_run ){
- organize_tests( params.Tests )
+ testcases = triggerFuncs.organize_tests( params.Tests, testcases )
isOldFlow = params.isOldFlow
println "Tests to be run manually : "
@@ -85,7 +87,7 @@
println "Defaulting to " + day + " tests:"
}
-print_tests( testcases )
+triggerFuncs.print_tests( testcases )
def runTest = [
"VM" : [:],
@@ -94,12 +96,12 @@
for( String test in testcases.keySet() ){
println test
if ( testcases[ test ][ "tests" ] != "" ){
- runTest[ testcases[ test ][ "nodeName" ] ][ test ] = trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag )
+ runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag )
}
}
def finalList = [:]
-finalList[ "VM" ] = runTestSeq( runTest[ "VM" ] )
-finalList[ "BM" ] = runTestSeq( runTest[ "BM" ] )
+finalList[ "VM" ] = triggerFuncs.runTestSeq( runTest[ "VM" ] )
+finalList[ "BM" ] = triggerFuncs.runTestSeq( runTest[ "BM" ] )
parallel finalList
//finalList[ "BM" ].call()
@@ -154,24 +156,6 @@
break
}
}
-def printDaysForTest(){
- result = ""
- for ( String test in AllTheTests.keySet() ){
- result += test + " : \n"
- for( String each in AllTheTests[ test ].keySet() ){
- AllTheTests[ test ][ each ][ "day" ] = lastCommaRemover( AllTheTests[ test ][ each ][ "day" ] )
- result += " " + each + ":[" + AllTheTests[ test ][ each ][ "day" ] + "]\n"
- }
- result += "\n"
- }
- return result
-}
-def lastCommaRemover( str ){
- if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){
- str = str.substring( 0,str.size() - 1 )
- }
- return str
-}
def monday( getResult ){
addingHeader( "FUNC" )
FUNC_choices += adder( "FUNC", "basic", true, "M", getResult )
@@ -188,7 +172,7 @@
SCPF_choices += adder( "SCPF", "extra_B", true, "M", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", true, "M", getResult )
+ SR_choices += adder( "SR", "basic", true, "M", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
closingHeader( "USECASE" )
@@ -210,7 +194,7 @@
SCPF_choices += adder( "SCPF", "extra_C", getDay, "T", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", getDay, "T", getResult )
+ SR_choices += adder( "SR", "basic", getDay, "T", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
USECASE_choices += adder( "USECASE", "basic", getDay, "T", getResult )
@@ -234,7 +218,7 @@
SCPF_choices += adder( "SCPF", "new_Test", getDay, "W", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", getDay, "W", getResult )
+ SR_choices += adder( "SR", "basic", getDay, "W", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
closingHeader( "USECASE" )
@@ -255,7 +239,7 @@
SCPF_choices += adder( "SCPF", "extra_B", getDay, "Th", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", getDay, "Th", getResult )
+ SR_choices += adder( "SR", "basic", getDay, "Th", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
closingHeader( "USECASE" )
@@ -277,7 +261,7 @@
SCPF_choices += adder( "SCPF", "extra_D", getDay, "F", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", getDay, "F", getResult )
+ SR_choices += adder( "SR", "basic", getDay, "F", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
closingHeader( "USECASE" )
@@ -304,7 +288,7 @@
SCPF_choices += adder( "SCPF", "new_Test", getDay, "Sa", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", getDay, "Sa", getResult )
+ SR_choices += adder( "SR", "basic", getDay, "Sa", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
USECASE_choices += adder( "USECASE", "basic", getDay, "Sa", getResult )
@@ -329,7 +313,7 @@
SCPF_choices += adder( "SCPF", "extra_D", getDay, "S", getResult )
closingHeader( "SCPF" )
addingHeader( "SR" )
- SR_choices += adder( "SR", "basic", getDay, "S", getResult )
+ SR_choices += adder( "SR", "basic", getDay, "S", false )
closingHeader( "SR" )
addingHeader( "USECASE" )
USECASE_choices += adder( "USECASE", "basic", getDay, "S", getResult )
@@ -419,186 +403,4 @@
}
def dayAdder( testCat, testName, dayOfWeek ){
AllTheTests[ testCat ][ testName ][ "day" ] += dayOfWeek + ","
-}
-def runTestSeq( testList ){
- return{
- for ( test in testList.keySet() ){
- testList[ test ].call()
- }
- }
-}
-
-def print_tests( tests ){
- for( String test in tests.keySet() ){
- if( tests[ test ][ "tests" ] != "" ){
- println test + ":"
- println tests[ test ][ "tests" ]
- }
- }
-}
-def organize_tests( tests ){
- testList = tests.tokenize( "\n;, " )
- for( String test in testList )
- testcases [ Prefix_organizer[ ( test == "FUNCbgpls" || test == "FUNCvirNetNB" ? "US" : ( test[ 0 ] + test[ 1 ] ) ) ] ][ "tests" ] += test + ","
-}
-def borrow_mn( jobOn ){
- result = ""
- if( jobOn == "SR" ){
- result = "~/cell_borrow.sh"
- }
- return result
-}
-def trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag ){
- println jobOn + "-pipeline-" + manuallyRun ? "manually" : branch
- wiki = branch
- branch = funcs.branchWithPrefix( branch )
- test_branch = "master"
- node( "TestStation-" + nodeName + "s" ){
- envSetup( branch, test_branch, onosTag, jobOn, manuallyRun )
-
- exportEnvProperty( branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag, isOldFlow )
- }
-
- jobToRun = jobOn + "-pipeline-" + ( manuallyRun ? "manually" : wiki )
- 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"
- return{
- if( jobOn == "SR" ){
- trigger( "1.11", tests, nodeName, jobOn, manuallyRun, onosTag )
- trigger( "1.12", tests, nodeName, jobOn, manuallyRun, onosTag )
- trigger( "master", tests, nodeName, jobOn, manuallyRun, onosTag )
- // returnCell( nodeName )
- }else{
- trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag )
- }
- }
-}
-// export Environment properties.
-def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){
- stage( "export Property" ){
- sh '''
- echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property
- echo "TestONBranch=''' + test_branch +'''" >> /var/jenkins/TestONOS.property
- echo "ONOSTag='''+ onosTag +'''" >> /var/jenkins/TestONOS.property
- echo "WikiPrefix=''' + wiki +'''" >> /var/jenkins/TestONOS.property
- echo "ONOSJVMHeap='''+ env.ONOSJVMHeap +'''" >> /var/jenkins/TestONOS.property
- echo "Tests=''' + tests +'''" >> /var/jenkins/TestONOS.property
- echo "postResult=''' + postResult +'''" >> /var/jenkins/TestONOS.property
- echo "manualRun=''' + manually_run +'''" >> /var/jenkins/TestONOS.property
- echo "isOldFlow=''' + isOldFlow +'''" >> /var/jenkins/TestONOS.property
-
- '''
- }
-}
-// Initialize the environment Setup for the onos and OnosSystemTest
-def envSetup( onos_branch, test_branch, onos_tag, jobOn, manuallyRun ){
- stage( "envSetup" ) {
- // after env: ''' + borrow_mn( jobOn ) + '''
- sh '''#!/bin/bash -l
- set +e
- . ~/.bashrc
- env
- ''' + preSetup( onos_branch, test_branch, onos_tag, manuallyRun ) + '''
- ''' + oldFlowCheck( jobOn, onos_branch ) + '''
- ''' + postSetup( onos_branch, test_branch, onos_tag, manuallyRun )
- }
-}
-def tagCheck( onos_tag, onos_branch ){
- result = "git checkout "
- if ( onos_tag == "" )
- result += onos_branch //create new local branch
- else
- result += onos_tag //checkout the tag
- return result
-}
-def preSetup( onos_branch, test_branch, onos_tag, isManual ){
- result = ""
- if( !isManual ){
- result = '''echo -e "\n##### Set TestON Branch #####"
- echo "TestON Branch is set on: ''' + test_branch + '''"
-
- cd ~/OnosSystemTest/
- git checkout HEAD~1 # Make sure you aren't pn a branch
- git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
- git branch -D ''' + test_branch + ''' # just incase there are local changes. This will normally result in a branch not found error
- git clean -df # clean any local files
- git fetch --all # update all caches from remotes
- git reset --hard origin/''' + test_branch +''' # force local index to match remote branch
- git clean -df # clean any local files
- git checkout ''' + test_branch + ''' #create new local branch
- git branch
- git log -1 --decorate
-
-
- echo -e "\n##### Set ONOS Branch #####"
- echo "ONOS Branch is set on: ''' + onos_branch + '''"
-
- echo -e "\n #### check karaf version ######"
- env |grep karaf
-
- cd ~/onos
- rm -rf buck-out/*
- ~/onos/tools/build/onos-buck clean
- git checkout HEAD~1 # Make sure you aren't pn a branch
- git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
- git branch -D ''' + onos_branch + ''' # just incase there are local changes. This will normally result in a branch not found error
- git clean -df # clean any local files
- git fetch --all # update all caches from remotes
- git reset --hard origin/''' + onos_branch + ''' # force local index to match remote branch
- git clean -df # clean any local files
- ''' + tagCheck( onos_tag, onos_branch ) + '''
- git branch
- git log -1 --decorate
-
-
- echo -e "\n##### set jvm heap size to 8G #####"
- echo ${ONOSJVMHeap}
-
- inserted_line="export JAVA_OPTS=\"\${ONOSJVMHeap}\""
- sed -i "s/bash/bash\\n$inserted_line/" ~/onos/tools/package/bin/onos-service
-
- echo "##### Check onos-service setting..... #####"
- cat ~/onos/tools/package/bin/onos-service
-
- export JAVA_HOME=/usr/lib/jvm/java-8-oracle'''
- }
- return result
-}
-def oldFlowCheck( jobOn, onos_branch ){
- 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
- sed -i -e 's/@Component(enabled = false)/@Component(immediate = true)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/''' + ( isOldFlow ? "ECFlowRuleStore" : "DistributedFlowRuleStore" ) + ".java"
- return result
-}
-def postSetup( onos_branch, test_branch, onos_tag, isManual ){
- result = ""
- if( !isManual ){
- result = '''echo -e "\n##### build ONOS skip unit tests ######"
- #mvn clean install -DskipTests
- # Force buck update
- rm -f ~/onos/bin/buck
- ~/onos/tools/build/onos-buck build onos
-
- sleep 30
- echo -e "\n##### Stop all running instances of Karaf #####"
- kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}')
- sleep 30
-
- git branch'''
- }
- return result
-}
-def returnCell( nodeName ){
- node( "TestStation-" + nodeName + "s" ){
- sh '''#!/bin/bash -l
- set +e
- . ~/.bashrc
- env
- ~/./return_cell.sh
- '''
- }
-}
+}
\ No newline at end of file
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index 0cd424c..e4e0139 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -9,7 +9,7 @@
SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+graph_saved_directory = "/var/jenkins/workspace/postjob-Fabric/"
echo( "Testcases:" )
def testsToRun = null
diff --git a/TestON/JenkinsFile/SRJenkinsfileTrigger b/TestON/JenkinsFile/SRJenkinsfileTrigger
new file mode 100644
index 0000000..9e155fb
--- /dev/null
+++ b/TestON/JenkinsFile/SRJenkinsfileTrigger
@@ -0,0 +1,111 @@
+#!groovy
+
+funcs = evaluate readTrusted( 'JenkinsCommonFuncs.groovy' )
+test_lists = evaluate readTrusted( 'JenkinsTestONTests.groovy' )
+triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
+
+previous_version = "1.12"
+before_previous_version = "1.11"
+funcs.initializeTrend( "Fabric" );
+funcs.initialize( "Fabric" )
+triggerFuncs.init( funcs )
+
+wikiContents = ""
+testcases = [
+ "FUNC" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
+ "HA" : [ tests : "" , nodeName : "VM", wikiContent : "" ],
+ "SCPF" : [ tests : "" , nodeName : "BM", wikiContent : "" ],
+ "SR" : [ tests : "", nodeName : "Fabric", wikiContent : "" ],
+ "USECASE" : [ tests : "" , nodeName : "BM", wikiContent : "" ]
+]
+Prefix_organizer = [
+ "FU" : "FUNC",
+ "HA" : "HA",
+ "PL" : "USECASE",
+ "SA" : "USECASE",
+ "SC" : "SCPF",
+ "SR" : "SR",
+ "US" : "USECASE",
+ "VP" : "USECASE"
+]
+
+manually_run = params.manual_run
+onos_b = "master"
+test_branch = ""
+onos_tag = params.ONOSTag
+isOldFlow = true
+
+// Set tests based on day of week
+def now = funcs.getCurrentTime()
+print now.toString()
+today = now[ Calendar.DAY_OF_WEEK ]
+
+if ( manually_run ){
+ onos_b = params.ONOSVersion
+}
+AllTheTests = test_lists.getAllTheTests( onos_b )
+
+day = ""
+SCPF_choices = ""
+USECASE_choices = ""
+FUNC_choices = ""
+HA_choices = ""
+SR_choices = ""
+stat_graph_generator_file = "testCategoryBuildStats.R"
+pie_graph_generator_file = "testCategoryPiePassFail.R"
+graph_saved_directory = "/var/jenkins/workspace/postjob-Fabric/"
+
+post_result = params.PostResult
+if( !manually_run ){
+ 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:" )
+
+ SR_choices += adder( "SR", "basic", true )
+ 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{
+ testcases[ "SR" ][ "tests" ] = SR_choices
+ println "Defaulting to " + day + " tests:"
+}
+
+triggerFuncs.print_tests( testcases )
+
+def runTest = [
+ "VM" : [:],
+ "BM" : [:],
+ "Fabric" : [:]
+]
+for( String test in testcases.keySet() ){
+ println test
+ if ( testcases[ test ][ "tests" ] != "" ){
+ runTest[ testcases[ test ][ "nodeName" ] ][ test ] = triggerFuncs.trigger_pipeline( onos_b, testcases[ test ][ "tests" ], testcases[ test ][ "nodeName" ], test, manually_run, onos_tag )
+ }
+}
+def finalList = [:]
+finalList[ "Fabric" ] = triggerFuncs.runTestSeq( runTest[ "Fabric" ] )
+parallel finalList
+/*
+if ( !manually_run ){
+ funcs.generateStatGraph( funcs.branchWithPrefix( onos_b ),
+ AllTheTests,
+ stat_graph_generator_file,
+ pie_graph_generator_file,
+ graph_saved_directory )
+}*/
+def adder( testCat, set, getResult ){
+ result = ""
+ for( String test in AllTheTests[ testCat ].keySet() ){
+ if( AllTheTests[ testCat ][ test ][ set ] ){
+ if( getResult )
+ result += test + ","
+ }
+ }
+ return result
+}
\ No newline at end of file
diff --git a/TestON/JenkinsFile/TriggerFuncs.groovy b/TestON/JenkinsFile/TriggerFuncs.groovy
new file mode 100644
index 0000000..c6fa9ca
--- /dev/null
+++ b/TestON/JenkinsFile/TriggerFuncs.groovy
@@ -0,0 +1,194 @@
+#!groovy
+
+def init( commonFuncs ){
+ funcs = commonFuncs
+}
+def lastCommaRemover( str ){
+ if ( str.size() > 0 && str[ str.size() - 1 ] == ',' ){
+ str = str.substring( 0,str.size() - 1 )
+ }
+ return str
+}
+def printDaysForTest( AllTheTests ){
+ result = ""
+ for ( String test in AllTheTests.keySet() ){
+ result += test + " : \n"
+ for( String each in AllTheTests[ test ].keySet() ){
+ AllTheTests[ test ][ each ][ "day" ] = lastCommaRemover( AllTheTests[ test ][ each ][ "day" ] )
+ result += " " + each + ":[" + AllTheTests[ test ][ each ][ "day" ] + "]\n"
+ }
+ result += "\n"
+ }
+ return result
+}
+def runTestSeq( testList ){
+ return{
+ for ( test in testList.keySet() ){
+ testList[ test ].call()
+ }
+ }
+}
+def print_tests( tests ){
+ for( String test in tests.keySet() ){
+ if( tests[ test ][ "tests" ] != "" ){
+ println test + ":"
+ println tests[ test ][ "tests" ]
+ }
+ }
+}
+def organize_tests( tests, testcases ){
+ 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 ){
+ println jobOn + "-pipeline-" + manuallyRun ? "manually" : branch
+ wiki = branch
+ branch = funcs.branchWithPrefix( branch )
+ test_branch = "master"
+ node( "TestStation-" + nodeName + "s" ){
+ envSetup( branch, test_branch, onosTag, jobOn, manuallyRun )
+
+ exportEnvProperty( branch, test_branch, wiki, tests, post_result, manuallyRun, onosTag, isOldFlow )
+ }
+
+ jobToRun = jobOn + "-pipeline-" + ( manuallyRun ? "manually" : wiki )
+ 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"
+ return{
+ if( jobOn == "SR" ){
+ trigger( "1.11", tests, nodeName, jobOn, manuallyRun, onosTag )
+ trigger( "1.12", tests, nodeName, jobOn, manuallyRun, onosTag )
+ trigger( "master", tests, nodeName, jobOn, manuallyRun, onosTag )
+ // returnCell( nodeName )
+ }else{
+ trigger( branch, tests, nodeName, jobOn, manuallyRun, onosTag )
+ }
+ }
+}
+// export Environment properties.
+def exportEnvProperty( onos_branch, test_branch, wiki, tests, postResult, manually_run, onosTag, isOldFlow ){
+ stage( "export Property" ){
+ sh '''
+ echo "ONOSBranch=''' + onos_branch +'''" > /var/jenkins/TestONOS.property
+ echo "TestONBranch=''' + test_branch +'''" >> /var/jenkins/TestONOS.property
+ echo "ONOSTag='''+ onosTag +'''" >> /var/jenkins/TestONOS.property
+ echo "WikiPrefix=''' + wiki +'''" >> /var/jenkins/TestONOS.property
+ echo "ONOSJVMHeap='''+ env.ONOSJVMHeap +'''" >> /var/jenkins/TestONOS.property
+ echo "Tests=''' + tests +'''" >> /var/jenkins/TestONOS.property
+ echo "postResult=''' + postResult +'''" >> /var/jenkins/TestONOS.property
+ echo "manualRun=''' + manually_run +'''" >> /var/jenkins/TestONOS.property
+ echo "isOldFlow=''' + isOldFlow +'''" >> /var/jenkins/TestONOS.property
+ '''
+ }
+}
+// Initialize the environment Setup for the onos and OnosSystemTest
+def envSetup( onos_branch, test_branch, onos_tag, jobOn, manuallyRun ){
+ stage( "envSetup" ) {
+ // after env: ''' + borrow_mn( jobOn ) + '''
+ sh '''#!/bin/bash -l
+ set +e
+ . ~/.bashrc
+ env
+ ''' + preSetup( onos_branch, test_branch, onos_tag, manuallyRun ) + '''
+ ''' + oldFlowCheck( jobOn, onos_branch ) + '''
+ ''' + postSetup( onos_branch, test_branch, onos_tag, manuallyRun )
+ }
+}
+def tagCheck( onos_tag, onos_branch ){
+ result = "git checkout "
+ if ( onos_tag == "" )
+ result += onos_branch //create new local branch
+ else
+ result += onos_tag //checkout the tag
+ return result
+}
+def preSetup( onos_branch, test_branch, onos_tag, isManual ){
+ result = ""
+ if( !isManual ){
+ result = '''echo -e "\n##### Set TestON Branch #####"
+ echo "TestON Branch is set on: ''' + test_branch + '''"
+ cd ~/OnosSystemTest/
+ git checkout HEAD~1 # Make sure you aren't pn a branch
+ git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
+ git branch -D ''' + test_branch + ''' # just incase there are local changes. This will normally result in a branch not found error
+ git clean -df # clean any local files
+ git fetch --all # update all caches from remotes
+ git reset --hard origin/''' + test_branch +''' # force local index to match remote branch
+ git clean -df # clean any local files
+ git checkout ''' + test_branch + ''' #create new local branch
+ git branch
+ git log -1 --decorate
+ echo -e "\n##### Set ONOS Branch #####"
+ echo "ONOS Branch is set on: ''' + onos_branch + '''"
+ echo -e "\n #### check karaf version ######"
+ env |grep karaf
+ cd ~/onos
+ rm -rf buck-out/*
+ ~/onos/tools/build/onos-buck clean
+ git checkout HEAD~1 # Make sure you aren't pn a branch
+ git branch | grep -v "detached from" | xargs git branch -d # delete all local branches merged with remote
+ git branch -D ''' + onos_branch + ''' # just incase there are local changes. This will normally result in a branch not found error
+ git clean -df # clean any local files
+ git fetch --all # update all caches from remotes
+ git reset --hard origin/''' + onos_branch + ''' # force local index to match remote branch
+ git clean -df # clean any local files
+ ''' + tagCheck( onos_tag, onos_branch ) + '''
+ git branch
+ git log -1 --decorate
+ echo -e "\n##### set jvm heap size to 8G #####"
+ echo ${ONOSJVMHeap}
+ inserted_line="export JAVA_OPTS=\"\${ONOSJVMHeap}\""
+ sed -i "s/bash/bash\\n$inserted_line/" ~/onos/tools/package/bin/onos-service
+ echo "##### Check onos-service setting..... #####"
+ cat ~/onos/tools/package/bin/onos-service
+ export JAVA_HOME=/usr/lib/jvm/java-8-oracle'''
+ }
+ return result
+}
+def oldFlowCheck( jobOn, onos_branch ){
+ 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
+ sed -i -e 's/@Component(enabled = false)/@Component(immediate = true)/g' ~/onos/core/store/dist/src/main/java/org/onosproject/store/flow/impl/''' + ( isOldFlow ? "ECFlowRuleStore" : "DistributedFlowRuleStore" ) + ".java"
+ return result
+}
+def postSetup( onos_branch, test_branch, onos_tag, isManual ){
+ result = ""
+ if( !isManual ){
+ result = '''echo -e "\n##### build ONOS skip unit tests ######"
+ #mvn clean install -DskipTests
+ # Force buck update
+ rm -f ~/onos/bin/buck
+ ~/onos/tools/build/onos-buck build onos
+ sleep 30
+ echo -e "\n##### Stop all running instances of Karaf #####"
+ kill $(ps -efw | grep karaf | grep -v grep | awk '{print $2}')
+ sleep 30
+ git branch'''
+ }
+ return result
+}
+def returnCell( nodeName ){
+ node( "TestStation-" + nodeName + "s" ){
+ sh '''#!/bin/bash -l
+ set +e
+ . ~/.bashrc
+ env
+ ~/./return_cell.sh
+ '''
+ }
+}
+
+return this;
\ No newline at end of file