Merge "minor fix to trend cho displaying too many dates"
diff --git a/TestON/JenkinsFile/CHO_Graph_Generator b/TestON/JenkinsFile/CHO_Graph_Generator
index 70969b5..a16bf00 100644
--- a/TestON/JenkinsFile/CHO_Graph_Generator
+++ b/TestON/JenkinsFile/CHO_Graph_Generator
@@ -1,10 +1,13 @@
#!groovy
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
branches = params.ONOSbranch
+hours = params.hours
branchList = branches.tokenize( "\n;, " )
-script_file = "~/OnosSystemTest/TestON/JenkinsFile/wikiGraphRScripts/trendCHO.R"
-saving_directory = "/var/jenkins/workspace/postjob-Fabric5/"
-scriptDir = "~/CHO_Jenkins_Scripts/"
+script_file = fileRelated.trendCHO
+saving_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric5/"
+scriptDir = fileRelated.CHOScriptDir
graphScript = generateGraphScript( branchList )
@@ -25,12 +28,12 @@
mkdir ''' + branchDir + ''';
if [ ! -f ''' + branchDir + '''existing.txt ]; then
cp *.csv ''' + branchDir + ''';
- echo "1" > existing.txt;
+ echo "1" > ''' + branchDir + '''existing.txt;
fi;
bash log-summary;''' + '''
Rscript ''' + script_file + ' ' + branchDir + 'event.csv ' +
branchDir + 'failure.csv ' + branchDir + 'error.csv ' +
- branch + ' 60 ' + saving_directory + ''';
+ branch + ' 60 ' + hours + ' ' + saving_directory + ''';
'''
print( graphScript )
}
diff --git a/TestON/JenkinsFile/FUNCJenkinsFile b/TestON/JenkinsFile/FUNCJenkinsFile
index 8592090..ce61765 100644
--- a/TestON/JenkinsFile/FUNCJenkinsFile
+++ b/TestON/JenkinsFile/FUNCJenkinsFile
@@ -1,15 +1,18 @@
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
funcs.initialize( "FUNC" );
+
// This is a Jenkinsfile for a scripted pipeline for the FUNC tests
def prop = null
prop = funcs.getProperties()
FUNC = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "FUNC" ]
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
echo( "Testcases:" )
def testsToRun = null
@@ -29,4 +32,4 @@
tests[ test ].call()
}
funcs.generateOverallGraph( prop, FUNC, graph_saved_directory )
-funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
\ No newline at end of file
+funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
diff --git a/TestON/JenkinsFile/FabricJenkinsfileTrigger b/TestON/JenkinsFile/FabricJenkinsfileTrigger
index da75805..fca468c 100644
--- a/TestON/JenkinsFile/FabricJenkinsfileTrigger
+++ b/TestON/JenkinsFile/FabricJenkinsfileTrigger
@@ -3,7 +3,9 @@
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
current_version = "master"
previous_version = "1.13"
before_previous_version = "1.12"
@@ -53,9 +55,9 @@
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/"
+stat_graph_generator_file = fileRelated.histogramMultiple
+pie_graph_generator_file = fileRelated.pieMultiple
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric/"
post_result = params.PostResult
if( !manually_run ){
diff --git a/TestON/JenkinsFile/GeneralFuncs.groovy b/TestON/JenkinsFile/GeneralFuncs.groovy
index 70b0fe0..a0c70c9 100644
--- a/TestON/JenkinsFile/GeneralFuncs.groovy
+++ b/TestON/JenkinsFile/GeneralFuncs.groovy
@@ -6,13 +6,10 @@
def basicGraphPart( rFileName, host, port, user, pass, subject, branchName ){
return " Rscript " + rFileName + " " + host + " " + port + " " + user + " " + pass + " " + subject + " " + branchName
}
-def initBasicVars(){
- rScriptLocation = "~/OnosSystemTest/TestON/JenkinsFile/scripts/"
-}
def getTestList( tests ){
list = ""
for( String test : tests.keySet() )
list += test + ","
return list[ 0..-2 ]
}
-return this;
\ No newline at end of file
+return this;
diff --git a/TestON/JenkinsFile/HAJenkinsFile b/TestON/JenkinsFile/HAJenkinsFile
index a03b71e..61d2acf 100644
--- a/TestON/JenkinsFile/HAJenkinsFile
+++ b/TestON/JenkinsFile/HAJenkinsFile
@@ -1,15 +1,17 @@
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
funcs.initialize( "HA" );
// This is a Jenkinsfile for a scripted pipeline for the HA tests
def prop = null
prop = funcs.getProperties()
HA = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "HA" ]
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
echo( "Testcases:" )
def testsToRun = null
diff --git a/TestON/JenkinsFile/JenkinsCommonFuncs.groovy b/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
index fd7253b..8c0322f 100644
--- a/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
+++ b/TestON/JenkinsFile/JenkinsCommonFuncs.groovy
@@ -1,6 +1,9 @@
#!groovy
import groovy.time.*
generalFuncs = evaluate readTrusted( 'TestON/JenkinsFile/GeneralFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+
+fileRelated.init()
def initializeTrend( machine ){
table_name = "executed_test_tests"
@@ -9,7 +12,6 @@
this.machine = machine
isSCPF = false
isTrend = true
- generalFuncs.initBasicVars();
}
def initialize( type, SCPFfuncs ){
init( type )
@@ -22,8 +24,8 @@
SCPFfunc = null
table_name = "executed_test_tests"
result_name = "executed_test_results"
- trend_generator_file = generalFuncs.rScriptLocation + "testCategoryTrend.R"
- build_stats_generator_file = generalFuncs.rScriptLocation + "testCategoryBuildStats.R"
+ trend_generator_file = fileRelated.trendMultiple
+ build_stats_generator_file = fileRelated.histogramMultiple
isSCPF = false
}
def init( type ){
@@ -35,7 +37,6 @@
testType = type;
testMachine = "TestStation-" + machineType[ type ] + "s";
isTrend = false
- generalFuncs.initBasicVars();
}
def additionalInitForSR( branch ){
testMachine = ( ( new StringBuilder( testMachine ) ).insert( testMachine.size()-1, fabricOn( branch ) ) ).toString()
@@ -297,9 +298,9 @@
string( credentialsId: 'db_host', variable: 'host' ),
string( credentialsId: 'db_port', variable: 'port' ) ] ) {
sh '''#!/bin/bash
- ''' + generalFuncs.basicGraphPart( generalFuncs.rScriptLocation + stat_file, host, port, user, pass, type, branch ) + " \"" + testListPart + "\" latest " + save_path + '''
- ''' + getOverallPieGraph( generalFuncs.rScriptLocation + pie_file, host, port, user, pass, branch, type, pieTestListPart, 'y', save_path ) + '''
- ''' + getOverallPieGraph( generalFuncs.rScriptLocation + pie_file, host, port, user, pass, branch, type, pieTestListPart, 'n', save_path )
+ ''' + generalFuncs.basicGraphPart( stat_file, host, port, user, pass, type, branch ) + " \"" + testListPart + "\" latest " + save_path + '''
+ ''' + getOverallPieGraph( pie_file, host, port, user, pass, branch, type, pieTestListPart, 'y', save_path ) + '''
+ ''' + getOverallPieGraph( pie_file, host, port, user, pass, branch, type, pieTestListPart, 'n', save_path )
}
}
postResult( [], true )
diff --git a/TestON/JenkinsFile/JenkinsPathAndFiles.groovy b/TestON/JenkinsFile/JenkinsPathAndFiles.groovy
new file mode 100644
index 0000000..fc89730
--- /dev/null
+++ b/TestON/JenkinsFile/JenkinsPathAndFiles.groovy
@@ -0,0 +1,23 @@
+#!groovy
+
+def initLocation(){
+ jenkinsFolder = "~/OnosSystemTest/TestON/JenkinsFile/"
+ rScriptLocation = jenkinsFolder + "wikiGraphRScripts/"
+ jenkinsWorkspace = "/var/jenkins/workspace/"
+ SCPFSpecificLocation = rScriptLocation + "SCPFspecificGraphRScripts/"
+ CHOScriptDir = "~/CHO_Jenkins_Scripts/"
+}
+def initFiles(){
+ trendIndividual = rScriptLocation + "trendIndividualTest.R"
+ trendMultiple = rScriptLocation + "trendMultipleTests.R"
+ trendSCPF = rScriptLocation + "trendSCPF.R"
+ trendCHO = rScriptLocation + "trendCHO.R"
+ histogramMultiple = rScriptLocation + "histogramMultipleTestGroups.R"
+ pieMultiple = rScriptLocation + "pieMultipleTests.R"
+}
+def init(){
+ initLocation()
+ initFiles()
+}
+return this;
+
diff --git a/TestON/JenkinsFile/Overall_Graph_Generator b/TestON/JenkinsFile/Overall_Graph_Generator
index ba34a89..14fe796 100644
--- a/TestON/JenkinsFile/Overall_Graph_Generator
+++ b/TestON/JenkinsFile/Overall_Graph_Generator
@@ -1,10 +1,12 @@
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
-stat_graph_generator_file = "testCategoryBuildStats.R"
-pie_graph_generator_file = "testCategoryPiePassFail.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-VM/"
+fileRelated.init()
+stat_graph_generator_file = fileRelated.histogramMultiple
+pie_graph_generator_file = fileRelated.pieMultiple
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
funcs.initializeTrend( "VM" )
@@ -16,4 +18,4 @@
AllTheTests,
stat_graph_generator_file,
pie_graph_generator_file,
- graph_saved_directory )
\ No newline at end of file
+ graph_saved_directory )
diff --git a/TestON/JenkinsFile/PerformanceFuncs.groovy b/TestON/JenkinsFile/PerformanceFuncs.groovy
index 5077bd9..c5613f2 100644
--- a/TestON/JenkinsFile/PerformanceFuncs.groovy
+++ b/TestON/JenkinsFile/PerformanceFuncs.groovy
@@ -1,5 +1,7 @@
#!groovy
-//generalFuncs = evaluate readTrusted( 'TestON/JenkinsFile/GeneralFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+
+fileRelated.init()
def init(){
none = [ "" ]
batches = [ 1, 100, 1000 ]
@@ -24,7 +26,7 @@
SCPFintentInstallWithdrawLatWithFlowObj: [ flows:true, test:'SCPFintentInstallWithdrawLat --params TEST/flowObj=True', table:'intent_latency_fobj_tests', results:'intent_latency_fobj_results', file:'IntentInstallWithdrawLatDBWFO', rFile:'SCPFIntentInstallWithdrawRerouteLat.R y', extra:batches, finalResult:0 ],
SCPFmastershipFailoverLat: [ flows:false, test:'SCPFmastershipFailoverLat', table:'mastership_failover_tests', results:'mastership_failover_results', file:'mastershipFailoverLatDB', rFile:'SCPFmastershipFailoverLat.R', extra:none, finalResult:1, graphTitle:[ 'Mastership Failover Test' ], dbCols:[ 'kill_deact_avg,deact_role_avg' ], dbWhere:'AND scale=5', y_axis:'Latency (ms)' ]
]
- graph_saved_directory = "/var/jenkins/workspace/postjob-BM/"
+ graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
}
def getGraphCommand( rFileName, extras, host, port, user, pass, testName, branchName, isOldFlow ){
result = ""
@@ -35,14 +37,14 @@
}
def generateGraph( rFileName, batch, host, port, user, pass, testName, branchName, isOldFlow ){
- return generalFuncs.basicGraphPart( generalFuncs.rScriptLocation + rFileName, host, port, user, pass, testName, branchName ) +
+ 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 ){
result = ""
for ( int i=0; i< SCPF[ testName ][ 'graphTitle' ].size(); i++ ){
- result += generalFuncs.basicGraphPart( generalFuncs.rScriptLocation + "SCPFLineGraph.R", host, port, user, pass, "\"" + SCPF[ testName ][ 'graphTitle' ][ i ] + "\"", branchName ) +
+ result += generalFuncs.basicGraphPart( fileRelated.trendSCPF, host, port, user, pass, "\"" + SCPF[ testName ][ 'graphTitle' ][ i ] + "\"", branchName ) +
" " + 50 + " \"SELECT " + checkIfList( testName, 'dbCols', i ) + ", build FROM " + SCPF[ testName ][ 'table' ] + " WHERE branch=\'" + branchName + "\' " + sqlOldFlow( isOldFlow, testName ) +
checkIfList( testName, 'dbWhere', i ) + " ORDER BY date DESC LIMIT 50\" \"" + SCPF[ testName ][ 'y_axis' ] + "\" " + hasOldFlow( isOldFlow, testName ) + graph_saved_directory + ";"
}
diff --git a/TestON/JenkinsFile/SRJenkinsFile b/TestON/JenkinsFile/SRJenkinsFile
index a583774..95b18d5 100644
--- a/TestON/JenkinsFile/SRJenkinsFile
+++ b/TestON/JenkinsFile/SRJenkinsFile
@@ -1,7 +1,9 @@
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
funcs.initialize( "SR" );
jobName = env.JOB_NAME
funcs.additionalInitForSR( jobName )
@@ -10,8 +12,8 @@
prop = funcs.getProperties()
SR = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "SR" ]
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-Fabric" + funcs.fabricOn( prop[ "ONOSBranch" ] ) + "/"
echo( "Testcases:" )
def testsToRun = null
diff --git a/TestON/JenkinsFile/Trend_Graph_Generator b/TestON/JenkinsFile/Trend_Graph_Generator
index 5f3ccfd..52fc77f 100644
--- a/TestON/JenkinsFile/Trend_Graph_Generator
+++ b/TestON/JenkinsFile/Trend_Graph_Generator
@@ -1,5 +1,8 @@
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+
+fileRelated.init()
nodeCluster = params.NodeCluster
funcs.initializeTrend( nodeCluster );
@@ -12,8 +15,8 @@
prop[ "ONOSBranch" ] = params.ONOSbranch
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-" + nodeCluster + ( nodeCluster == "Fabric" ? funcs.fabricOn( prop[ "ONOSBranch" ] ) : "" ) + "/"
+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 )
diff --git a/TestON/JenkinsFile/USECASEJenkinsFile b/TestON/JenkinsFile/USECASEJenkinsFile
index 34abfa9..af56bc5 100644
--- a/TestON/JenkinsFile/USECASEJenkinsFile
+++ b/TestON/JenkinsFile/USECASEJenkinsFile
@@ -1,15 +1,17 @@
#!groovy
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
funcs.initialize( "USECASE" );
// This is a Jenkinsfile for a scripted pipeline for the USECASE tests
def prop = null
prop = funcs.getProperties()
USECASE = test_lists.getAllTheTests( prop[ "WikiPrefix" ] )[ "USECASE" ]
-graph_generator_file = "~/OnosSystemTest/TestON/JenkinsFile/scripts/testCaseGraphGenerator.R"
-graph_saved_directory = "/var/jenkins/workspace/postjob-BM/"
+graph_generator_file = fileRelated.trendIndividual
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-BM/"
echo( "Testcases:" )
def testsToRun = null
@@ -29,4 +31,4 @@
tests[ test ].call()
}
funcs.sendResultToSlack( start, prop[ "manualRun" ], prop[ "WikiPrefix" ] )
-funcs.generateOverallGraph( prop, USECASE, graph_saved_directory )
\ No newline at end of file
+funcs.generateOverallGraph( prop, USECASE, graph_saved_directory )
diff --git a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
index 3d03048..b90faed 100644
--- a/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
+++ b/TestON/JenkinsFile/VM_BMJenkinsfileTrigger
@@ -3,7 +3,9 @@
funcs = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsCommonFuncs.groovy' )
test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
+fileRelated = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsPathAndFiles.groovy' )
+fileRelated.init()
current_version = "master"
previous_version = "1.13"
before_previous_version = "1.12"
@@ -56,9 +58,9 @@
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-VM/"
+stat_graph_generator_file = fileRelated.histogramMultiple
+pie_graph_generator_file = fileRelated.pieMultiple
+graph_saved_directory = fileRelated.jenkinsWorkspace + "postjob-VM/"
post_result = params.PostResult
if( !manually_run ){
@@ -381,7 +383,7 @@
}
def postToWiki( contents ){
node( testMachine ){
- workspace = "/var/jenkins/workspace/all-pipeline-trigger/"
+ workspace = fileRelated.jenkinsWorkspace + "all-pipeline-trigger/"
filename = "jenkinsSchedule.txt"
writeFile file: workspace + filename, text: contents
funcs.publishToConfluence( "false", "true",
diff --git a/TestON/bin/.pylint b/TestON/bin/.pylint
index 469a744..57208b9 100644
--- a/TestON/bin/.pylint
+++ b/TestON/bin/.pylint
@@ -13,7 +13,7 @@
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
-#init-hook=
+init-hook='import sys;sys.path.append("/home/sdn/TestON")'
# Profiled execution.
profile=no
@@ -136,7 +136,7 @@
bad-names=foo,bar,baz,toto,tutu,tata
# List of builtins function names that should not be used, separated by a comma
-bad-functions=map,filter,apply,inpu
+bad-functions=map,filter,apply,inpu,in,list,str
# try to find bugs in the code using type inference
@@ -244,7 +244,7 @@
# Create a graph of every (i.e. internal and external) dependencies in the
# given file (report R0402 must not be disabled)
-import-graph=
+import-graph=y
# Create a graph of external dependencies in the given file (report R0402 mus
# not be disabled)
@@ -281,7 +281,7 @@
[MISCELLANEOUS]
# List of note tags to take in consideration, separated by a comma.
-notes=FIXME,XXX,TODO
+notes=FIXME,XXX,TODO,NOTE
# checks for similarities and duplicated code. This computation may be
diff --git a/TestON/bin/codecheck b/TestON/bin/codecheck
index e3769da..51b9649 100755
--- a/TestON/bin/codecheck
+++ b/TestON/bin/codecheck
@@ -30,16 +30,16 @@
autopep8 --in-place -a -a $file --ignore=$EXCLUDE,$P8IGN
elif [ -z "$2" ] || [ "$2" = "--reason" ] || [ "$2" = "--relaxed" ]; then
echo "Running pyflakes..."
- #Pyflakes is a source checker. It doesn't run the code so it is safer than other programs
- #ignoring some errors due to TestON
- pyflakes $1 | grep -v "undefined name 'main'" | grep -v "undefined name 'utilities'"
+ # Pyflakes is a source checker. It doesn't run the code so it is safer than other programs
+ # ignoring some errors due to TestON
+ pyflakes $1 | grep -v "undefined name 'main'" | grep -v "undefined name 'utilities'" | grep -v "unable to detect undefined names"
echo "Running pylint..."
- #Pylint is a static code checker
- #ignoring some errors due to TestON
+ # Pylint is a static code checker
+ # ignoring some errors due to TestON
pylint -E --rcfile=$(dirname "${BASH_SOURCE}")/.pylint $1 | grep -v "Undefined variable 'main'" | grep -v "Undefined variable 'utilities'"
echo "Running PEP8..."
- #PEP8 is a the most common python coding style standard
+ # PEP8 is a the most common python coding style standard
if [ "$2" = "--reason" ]; then
pep8 --repeat --show-source --show-pep8 --ignore=$P8IGN $1
elif [ "$2" = "--relaxed" ]; then
diff --git a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
index f04e878..886c672 100644
--- a/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
+++ b/TestON/tests/HA/HAfullNetPartition/HAfullNetPartition.py
@@ -249,6 +249,7 @@
utilities.assert_equals( expect=main.TRUE, actual=partitionResults,
onpass="Firewall rules set successfully",
onfail="Error setting firewall rules" )
+ main.Cluster.reset()
main.step( "Sleeping 60 seconds" )
time.sleep( 60 )
@@ -277,6 +278,7 @@
for node in main.partition:
main.Cluster.runningNodes[ node ].active = True
+ main.Cluster.reset()
main.step( "Checking ONOS nodes" )
nodeResults = utilities.retry( main.Cluster.nodesCheck,
diff --git a/TestON/tests/HA/HAscaling/HAscaling.py b/TestON/tests/HA/HAscaling/HAscaling.py
index e46271d..4e18b30 100644
--- a/TestON/tests/HA/HAscaling/HAscaling.py
+++ b/TestON/tests/HA/HAscaling/HAscaling.py
@@ -226,7 +226,7 @@
activeNodes = range( 0, main.Cluster.numCtrls )
newNodes = [ x for x in activeNodes if x not in prevNodes ]
- main.Cluster.resetActive()
+ main.Cluster.clearActive()
main.step( "Start new nodes" ) # OR stop old nodes?
started = main.TRUE
for i in newNodes:
diff --git a/TestON/tests/HA/HAstopNodes/HAstopNodes.py b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
index bbb8db7..62b8ee5 100644
--- a/TestON/tests/HA/HAstopNodes/HAstopNodes.py
+++ b/TestON/tests/HA/HAstopNodes/HAstopNodes.py
@@ -196,6 +196,7 @@
killResults = killResults and\
ctrl.onosStop( ctrl.ipAddress )
ctrl.active = False
+ main.Cluster.reset()
utilities.assert_equals( expect=main.TRUE, actual=killResults,
onpass="ONOS nodes stopped successfully",
onfail="ONOS nodes NOT successfully stopped" )
diff --git a/TestON/tests/HA/HAswapNodes/HAswapNodes.py b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
index 9c2d180..bf1a589 100644
--- a/TestON/tests/HA/HAswapNodes/HAswapNodes.py
+++ b/TestON/tests/HA/HAswapNodes/HAswapNodes.py
@@ -222,7 +222,7 @@
onpass="New cluster metadata file generated",
onfail="Failled to generate new metadata file" )
time.sleep( 5 ) # Give time for nodes to read new file
- main.Cluster.resetActive()
+ main.Cluster.clearActive()
# Note : done up to this point.
main.step( "Start new nodes" ) # OR stop old nodes?
started = main.TRUE
diff --git a/TestON/tests/dependencies/Cluster.py b/TestON/tests/dependencies/Cluster.py
index 61c141c..a67bad5 100644
--- a/TestON/tests/dependencies/Cluster.py
+++ b/TestON/tests/dependencies/Cluster.py
@@ -72,12 +72,10 @@
return ips
- def resetActive( self ):
+ def clearActive( self ):
"""
Description:
- reset the activeness of the cluster to be false
- Required:
- Returns:
+ Sets the activeness of each cluster node to be False
"""
for ctrl in self.controllers:
ctrl.active = False
@@ -126,14 +124,16 @@
def next( self ):
"""
- An iterator for the cluster's controllers that
+ An iterator for the cluster's active controllers that
resets when there are no more elements.
Returns the next controller in the cluster
"""
try:
- return self.iterator.next()
- except StopIteration:
+ node = self.iterator.next()
+ assert node.active
+ return node
+ except ( StopIteration, AssertionError ):
self.reset()
try:
return self.iterator.next()