[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
index ef5eb99..cb80126 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/FUNCnetCfg.py
@@ -1,5 +1,5 @@
"""
-Copyright 2015 Open Networking Foundation (ONF)
+Copyright 2015 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,7 +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/>.
"""
-
# Testing the basic intent functionality of ONOS
@@ -36,7 +35,6 @@
- Checkout ONOS master branch
- Pull latest ONOS code
"""
-
try:
from tests.dependencies.ONOSSetup import ONOSSetup
main.testSetUp = ONOSSetup()
@@ -222,7 +220,6 @@
" not discovered yet. One device is allowed" +\
", the other disallowed."
-
pprint = main.Cluster.active( 0 ).REST.pprint
main.step( "Add Net Cfg for switch1" )
@@ -241,14 +238,14 @@
subjectKey="of:0000000000000001",
configKey="basic" )
s1Result = False
- #Wait 5 secs after set up netCfg
+ # Wait 5 secs after set up netCfg
time.sleep( main.SetNetCfgSleep )
if setS1Allow:
getS1 = utilities.retry( f=main.Cluster.active( 0 ).REST.getNetCfg,
retValue=False,
- kwargs={"subjectClass":"devices",
- "subjectKey" : "of:0000000000000001",
- "configKey" : "basic"},
+ kwargs={ "subjectClass": "devices",
+ "subjectKey": "of:0000000000000001",
+ "configKey": "basic" },
attempts=main.retrytimes,
sleep=main.retrysleep )
onosCfg = pprint( getS1 )
@@ -290,9 +287,9 @@
# Check what we set is what is in ONOS
getS3 = utilities.retry( f=main.Cluster.active( 0 ).REST.getNetCfg,
retValue=False,
- kwargs={"subjectClass": "devices",
- "subjectKey": "of:0000000000000003",
- "configKey": "basic"},
+ kwargs={ "subjectClass": "devices",
+ "subjectKey": "of:0000000000000003",
+ "configKey": "basic" },
attempts=main.retrytimes,
sleep=main.retrysleep )
onosCfg = pprint( getS3 )
@@ -400,9 +397,9 @@
# Check what we set is what is in ONOS
getS2 = utilities.retry( f=main.Cluster.active( 1 ).REST.getNetCfg,
retValue=False,
- kwargs={"subjectClass": "devices",
- "subjectKey": "of:0000000000000002",
- "configKey": "basic"},
+ kwargs={ "subjectClass": "devices",
+ "subjectKey": "of:0000000000000002",
+ "configKey": "basic" },
attempts=main.retrytimes,
sleep=main.retrysleep )
onosCfg = pprint( getS2 )
@@ -432,17 +429,17 @@
main.log.info( "s4Json:" + str( s4Json ) )
main.s4Json = s4Json
setS4Disallow = main.Cluster.active( 2 ).REST.setNetCfg( s4Json,
- subjectClass="devices",
- subjectKey="of:0000000000000004",
- configKey="basic" )
+ subjectClass="devices",
+ subjectKey="of:0000000000000004",
+ configKey="basic" )
s4Result = False
if setS4Disallow:
# Check what we set is what is in ONOS
getS4 = utilities.retry( f=main.Cluster.active( 2 ).REST.getNetCfg,
retValue=False,
- kwargs={"subjectClass": "devices",
- "subjectKey": "of:0000000000000004",
- "configKey": "basic"},
+ kwargs={ "subjectClass": "devices",
+ "subjectKey": "of:0000000000000004",
+ "configKey": "basic" },
attempts=main.retrytimes,
sleep=main.retrysleep )
@@ -511,8 +508,6 @@
onpass="Configured devices' annotations are correct",
onfail="Incorrect annotations for configured devices." )
-
-
def CASE24( self, main ):
"""
Testing removal of configurations
@@ -616,8 +611,8 @@
main.step( "Assert the net config for devices is empty" )
get = utilities.retry( f=main.Cluster.active( 2 ).REST.getNetCfg,
- retValue = False,
- kwargs={"subjectClass":"devices"},
+ retValue=False,
+ kwargs={ "subjectClass": "devices" },
sleep=main.retrysleep,
attempts=main.retrytimes )
@@ -746,9 +741,9 @@
if setS6Disallow:
getS6 = utilities.retry( f=main.Cluster.active( 0 ).REST.getNetCfg,
retValue=False,
- kwargs={"subjectClass":"devices",
- "subjectKey" : "of:0000000000000006",
- "configKey" : "basic"},
+ kwargs={ "subjectClass": "devices",
+ "subjectKey": "of:0000000000000006",
+ "configKey": "basic" },
sleep=main.retrysleep,
attempts=main.retrytimes )
onosCfg = pprint( getS6 )
diff --git a/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py b/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
index 0cc46e8..9523e81 100644
--- a/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
+++ b/TestON/tests/FUNC/FUNCnetCfg/dependencies/netCfg.py
@@ -1,5 +1,5 @@
"""
-Copyright 2015 Open Networking Foundation (ONF)
+Copyright 2015 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
@@ -35,19 +35,19 @@
responses = []
result = utilities.retry( f=checkNodeResponses,
retValue=False,
- kwargs={'main' : main,'responses' : responses},
- sleep = main.retrysleep,
- attempts = main.retrytimes )
+ kwargs={ 'main': main, 'responses': responses },
+ sleep=main.retrysleep,
+ attempts=main.retrytimes )
utilities.assert_equals( expect=True,
actual=result,
onpass="Net Cfg is the same on all nodes",
onfail="Check Net Cfg failed. Check above messages." )
-def checkNodeResponses ( main, responses ):
+def checkNodeResponses( main, responses ):
numberOfFailedNodes = 0 # Tracks the number of nodes that failed to get net configuration
for ctrl in main.Cluster.active():
- response = ctrl.REST.getNetCfg( )
+ response = ctrl.REST.getNetCfg()
responses.append( ctrl.REST.pprint( response ) )
if response == main.FALSE:
numberOfFailedNodes += 1
@@ -65,24 +65,25 @@
main.log.debug( i )
return False
+
def checkDeviceAnnotations( main, jsonObj, sw ):
id = str( sw.get( 'id' ) )
keys = [ 'name', 'owner', 'rackAddress' ]
correct = True
for k in keys:
- if str( sw.get( 'annotations', {} ).get( k ) ) != str( jsonObj[ k ] ) :
+ if str( sw.get( 'annotations', {} ).get( k ) ) != str( jsonObj[ k ] ):
correct = False
main.log.debug( "{} is wrong on switch: ".format( k ) + id )
if not correct:
- main.log.error( "Annotations for switch " + id + " are incorrect: {}".format( sw ) )
+ main.log.error( "Annotations for switch " + id + " are incorrect: {}".format( sw ) )
return correct
def checkAllDeviceAnnotations( main, json ):
- devices = main.Cluster.active( 0 ).REST.devices( )
+ devices = main.Cluster.active( 0 ).REST.devices()
id = "of:0000000000000001"
i = 1
- result = [ ]
+ result = []
try:
for sw in json.loads( devices ):
if id in sw.get( 'id' ):