[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/dependencies/Cluster.py b/TestON/tests/dependencies/Cluster.py
index 16dfd79..210134f 100644
--- a/TestON/tests/dependencies/Cluster.py
+++ b/TestON/tests/dependencies/Cluster.py
@@ -1,5 +1,5 @@
"""
-Copyright 2017 Open Networking Foundation (ONF)
+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>,
@@ -8,7 +8,7 @@
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.
+ ( 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
@@ -18,8 +18,6 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
-
class Cluster():
def __str__( self ):
@@ -33,14 +31,14 @@
return "%s[%s]" % ( self.name, ", ".join( controllers ) )
def __init__( self, ctrlList=[], name="Cluster" ):
- '''
+ """
controllers : All the nodes
runningNodes : Node that are specifically running from the test.
- ie) When the test is testing different number of nodes on each
+ ie ) When the test is testing different number of nodes on each
run.
numCtrls : number of runningNodes
maxCtrls : number of controllers
- '''
+ """
self.controllers = ctrlList
self.runningNodes = ctrlList
self.numCtrls = len( self.runningNodes )
@@ -107,7 +105,7 @@
Returns:
"""
self.runningNodes = []
- for i in numCtrls if isinstance( numCtrls, list ) else range( numCtrls ) :
+ for i in numCtrls if isinstance( numCtrls, list ) else range( numCtrls ):
self.runningNodes.append( self.controllers[ i ] )
self.numCtrls = len( numCtrls ) if isinstance( numCtrls, list ) else numCtrls
@@ -158,13 +156,13 @@
* cellName - The name of the cell.
* Mininet - a mininet driver that will be used.
* useSSH - True for using ssh when creating a cell
- * ips - ip(s) of the node(s).
+ * ips - ip( s ) of the node( s ).
Returns:
"""
self.command( "createCellFile",
args=[ main.ONOSbench.ip_address,
cellName,
- Mininet if isinstance(Mininet, str) else
+ Mininet if isinstance( Mininet, str ) else
Mininet.ip_address,
main.apps,
ips,
@@ -203,7 +201,6 @@
Returns:
Returns main.TRUE if it successfully set and verify cell.
"""
-
setCellResult = self.command( "setCell",
args=[ cellName ],
specificDriver=1,
@@ -254,7 +251,7 @@
max number of the nodes.
Required:
* killRemoveMax - The boolean that will decide either to kill
- only running nodes (False) or max number of nodes (True).
+ only running nodes ( False ) or max number of nodes ( True ).
* stopOnos - If wish to stop onos before killing it. True for
enable stop , False for disable stop.
Returns:
@@ -439,7 +436,7 @@
funcArgs = []
funcKwargs = {}
f = getattr( ( ctrl if not specificDriver else
- getattr( ctrl, drivers[ specificDriver ] ) ), function )
+ getattr( ctrl, drivers[ specificDriver ] ) ), function )
if funcFromCtrl:
if args:
for i in range( len( args ) ):
diff --git a/TestON/tests/dependencies/ONOSSetup.py b/TestON/tests/dependencies/ONOSSetup.py
index 8a73e32..750dde6 100644
--- a/TestON/tests/dependencies/ONOSSetup.py
+++ b/TestON/tests/dependencies/ONOSSetup.py
@@ -1,5 +1,5 @@
"""
-Copyright 2016 Open Networking Foundation (ONF)
+Copyright 2016 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>,
@@ -8,7 +8,7 @@
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.
+ ( 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
@@ -20,6 +20,7 @@
"""
import re
+
class ONOSSetup:
main = None
@@ -84,7 +85,7 @@
Returns:
Returns main.TRUE
"""
- if includeGitPull :
+ if includeGitPull:
self.gitPulling()
try:
@@ -151,7 +152,7 @@
Required:
* cluster - the cluster driver that will be used.
* killRemoveMax - The boolean that will decide either to kill
- only running nodes (False) or max number of nodes (True).
+ only running nodes ( False ) or max number of nodes ( True ).
* stopOnos - If wish to stop onos before killing it. True for
enable stop , False for disable stop.
Returns:
@@ -173,7 +174,7 @@
* cellName - The name of the cell.
* Mininet - a mininet driver that will be used.
* useSSH - True for using ssh when creating a cell
- * ips - ip(s) of the node(s).
+ * ips - ip( s ) of the node( s ).
Returns:
Returns main.TRUE if it successfully executed.
"""
@@ -324,8 +325,8 @@
Initial ONOS setting up of the tests. It will also verify the result of each steps.
The procedures will be:
killing onos
- creating (optional) /applying cell
- removing raft logs (optional)
+ creating ( optional ) /applying cell
+ removing raft logs ( optional )
uninstalling onos
extra procedure to be applied( optional )
building onos
@@ -342,10 +343,10 @@
* newCell - True for making a new cell and False for not making it.
* cellName - Name of the cell that will be used.
* removeLog - True if wish to remove raft logs
- * extraApply - Function(s) that will be called before building ONOS. Default to None.
- * applyArgs - argument of the functon(s) of the extraApply. Should be in list.
- * extraClean - Function(s) that will be called after building ONOS. Defaults to None.
- * cleanArgs - argument of the functon(s) of the extraClean. Should be in list.
+ * extraApply - Function( s ) that will be called before building ONOS. Default to None.
+ * applyArgs - argument of the functon( s ) of the extraApply. Should be in list.
+ * extraClean - Function( s ) that will be called after building ONOS. Defaults to None.
+ * cleanArgs - argument of the functon( s ) of the extraClean. Should be in list.
* skipPack - True if wish to skip some packing.
* installMax - True if wish to install onos max number of nodes
False if wish to install onos of running nodes only
@@ -378,7 +379,7 @@
useSSH, tempOnosIp,
installMax )
if removeLog:
- main.log.info("Removing raft logs")
+ main.log.info( "Removing raft logs" )
main.ONOSbench.onosRemoveRaftLogs()
onosUninstallResult = self.uninstallOnos( cluster, killRemoveMax )
diff --git a/TestON/tests/dependencies/topology.py b/TestON/tests/dependencies/topology.py
index 2a81987..96109d3 100644
--- a/TestON/tests/dependencies/topology.py
+++ b/TestON/tests/dependencies/topology.py
@@ -1,5 +1,5 @@
"""
-Copyright 2016 Open Networking Foundation (ONF)
+Copyright 2016 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>,
@@ -8,7 +8,7 @@
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.
+ ( 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
@@ -22,6 +22,8 @@
import re
import imp
import json
+
+
class Topology:
def __init__( self ):
@@ -47,7 +49,7 @@
for ctrl in main.Cluster.active():
func = getattr( ctrl.CLI, function )
t = main.Thread( target=utilities.retry if needRetry else func,
- name= function + "-" + str( ctrl ),
+ name=function + "-" + str( ctrl ),
args=[ func, [ None ] ] if needRetry else [],
kwargs=kwargs )
threads.append( t )
@@ -116,10 +118,10 @@
if isinstance( compareArg, list ):
compareArg.append( json.loads( compareElem[ controller ] ) )
else:
- compareArg = [compareArg, json.loads( compareElem[ controller ] ) ]
+ compareArg = [ compareArg, json.loads( compareElem[ controller ] ) ]
currentCompareResult = compareF( *compareArg )
- except(TypeError, ValueError):
+ except( TypeError, ValueError ):
main.log.error(
"Could not load json: {0} or {1}".format( str( compareElem[ controller ] ) ) )
currentCompareResult = main.FALSE
diff --git a/TestON/tests/dependencies/utils.py b/TestON/tests/dependencies/utils.py
index 240d4b2..5e15c2a 100644
--- a/TestON/tests/dependencies/utils.py
+++ b/TestON/tests/dependencies/utils.py
@@ -1,5 +1,5 @@
"""
-Copyright 2016 Open Networking Foundation (ONF)
+Copyright 2016 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>,
@@ -8,7 +8,7 @@
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.
+ ( 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
@@ -19,6 +19,7 @@
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
class Utils:
+
def __init__( self ):
self.default = ''