[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
index 7c9905e..4f8d159 100644
--- a/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.py
+++ b/TestON/tests/USECASE/VPLS/VPLSBasic/VPLSBasic.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
@@ -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/>.
"""
-
# CASE1: Startup
# CASE2: Load vpls topology and configurations from demo script
# CASE3: Test CLI commands
@@ -94,7 +93,6 @@
onpass="Mininet Started",
onfail="Error starting Mininet" )
-
main.step( "Activate apps defined in the params file" )
# get data from the params
apps = main.params.get( 'apps' )
@@ -140,7 +138,7 @@
main.step( "App Ids check" )
appCheck = main.Cluster.command( "appToIDCheck", returnBool=True )
- if appCheck != True:
+ if not appCheck:
main.log.warn( main.Cluster.active( 0 ).CLI.apps() )
main.log.warn( main.Cluster.active( 0 ).CLI.appIDs() )
utilities.assert_equals( expect=True, actual=appCheck,
@@ -199,7 +197,7 @@
result = False
getPorts = utilities.retry( f=main.Cluster.active( 0 ).REST.getNetCfg,
retValue=False,
- kwargs={ "subjectClass" :"ports" },
+ kwargs={ "subjectClass": "ports" },
sleep=main.sleep )
onosCfg = pprint( getPorts )
sentCfg = pprint( originalCfg.get( "ports" ) )
@@ -233,14 +231,13 @@
main.step( "Remove an interface from a vpls network" )
main.Cluster.active( 0 ).CLI.vplsRemIface( 'VPLS1', 'h1' )
time.sleep( main.sleep )
- #update master config json
+ # update master config json
for network in main.vplsConfig:
if network.get( 'name' ) == 'VPLS1':
ifaces = network.get( 'interfaces' )
ifaces.remove( 'h1' )
main.vpls.verify( main )
-
def CASE11( self, main ):
"""
Clean all VPLS configurations
@@ -251,7 +248,6 @@
main.vplsConfig = []
main.vpls.verify( main )
-
def CASE12( self, main ):
"""
Create a new VPLS network.
@@ -264,7 +260,6 @@
main.vplsConfig.append( network1 )
main.vpls.verify( main )
-
def CASE13( self, main ):
"""
Add interfaces to the new VPLS network.
@@ -292,7 +287,6 @@
network[ 'interfaces' ] = ifaces
main.vpls.verify( main )
-
def CASE14( self, main ):
"""
Add MPLS encapsulation.
@@ -306,7 +300,6 @@
time.sleep( main.sleep )
main.vpls.verify( main )
-
def CASE15( self, main ):
"""
Change an encapsulation type.
@@ -320,7 +313,6 @@
time.sleep( main.sleep )
main.vpls.verify( main )
-
def CASE16( self, main ):
"""
Remove encapsulation.
diff --git a/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py b/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py
index bda1ecd..55c9e2c 100644
--- a/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.py
+++ b/TestON/tests/USECASE/VPLS/VPLSfailsafe/VPLSfailsafe.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,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 various connectivity failures for VPLS.
@@ -31,13 +30,11 @@
CASE310: Kill 1 ONOS node at a time and test connectivity.
CASE400: Bring down 1 link at a time and test connectivity.
"""
-
class VPLSfailsafe:
def __init__( self ):
self.default = ''
-
def CASE1( self, main ):
"""
CASE1 is to compile ONOS and push it to the test machines
@@ -103,7 +100,6 @@
onpass="Mininet Started",
onfail="Error starting Mininet" )
-
main.step( "Activate apps defined in the params file" )
# get data from the params
apps = main.params.get( 'apps' )
@@ -149,7 +145,7 @@
main.step( "App Ids check" )
appCheck = main.Cluster.command( "appToIDCheck", returnBool=True )
- if appCheck != True:
+ if appCheck is not True:
main.log.warn( main.Cluster.active( 0 ).CLI.apps() )
main.log.warn( main.Cluster.active( 0 ).CLI.appIDs() )
utilities.assert_equals( expect=True, actual=appCheck,
@@ -185,7 +181,7 @@
utilities.assert_equals( expect=main.TRUE,
actual=loadVPLSResult,
onpass="Loaded vpls configuration.",
- onfail="Failed to load vpls configuration.")
+ onfail="Failed to load vpls configuration." )
# Time for netcfg to load data
time.sleep( SLEEP )
@@ -211,7 +207,7 @@
result = False
getPorts = utilities.retry( f=main.ONOSrest1.getNetCfg,
retValue=False,
- kwargs={ "subjectClass" : "ports" },
+ kwargs={ "subjectClass": "ports" },
sleep=SLEEP )
onosCfg = pprint( getPorts )
sentCfg = pprint( originalCfg.get( "ports" ) )
@@ -239,8 +235,6 @@
onpass="Loaded vpls configuration.",
onfail="Failed to load vpls configuration." )
-
-
def CASE50( self, main ):
"""
Initial connectivity check
@@ -253,7 +247,6 @@
onpass="Connectivity is as expected.",
onfail="Connectivity is NOT as expected." )
-
def CASE100( self, main ):
"""
Bring down 1 host at a time and test connectivity
@@ -301,7 +294,7 @@
utilities.assert_equals( expect=main.TRUE, actual=result,
onpass="Connectivity is as expected.",
- onfail="Connectivity is NOT as expected.")
+ onfail="Connectivity is NOT as expected." )
def CASE200( self, main ):
"""
@@ -310,7 +303,7 @@
assert vpls, "vpls not defined"
main.case( "Bring down one switch at a time and test connectivity." )
- links = main.Mininet1.getLinks( ) # Obtain links here
+ links = main.Mininet1.getLinks() # Obtain links here
result = main.TRUE
for i in range( 5, hosts + 1 ):
@@ -318,7 +311,7 @@
stri = str( i )
# Bring switch down
- main.step( "Delete s" + stri + ".")
+ main.step( "Delete s" + stri + "." )
delSwitchResult = main.Mininet1.delSwitch( sw="s" + stri )
# Check if switch was deleted
@@ -332,17 +325,17 @@
result = result and connectivityResult
# Bring switch up
- main.step( "Add s" + stri + ".")
+ main.step( "Add s" + stri + "." )
addSwitchResult = main.Mininet1.addSwitch( sw="s" + stri )
# Check if switch was added
utilities.assert_equals( expect=main.TRUE, actual=addSwitchResult,
onpass="Successfully added switch.",
- onfail="Failed to add switch.")
+ onfail="Failed to add switch." )
result = result and addSwitchResult
# Reconnect links
- main.step( "Reconnecting links on s" + stri + ".")
+ main.step( "Reconnecting links on s" + stri + "." )
for j in links:
if ( j[ 'node1' ] == "s" + stri and j[ 'node2' ][ 0 ] == "s" ) or \
( j[ 'node2' ] == "s" + stri and j[ 'node1' ][ 0 ] == "s" ):
@@ -355,7 +348,6 @@
connectivityResult = vpls.testConnectivityVpls( main )
result = result and connectivityResult
-
utilities.assert_equals( expect=main.TRUE,
actual=result,
onpass="Connectivity is as expected.",
@@ -381,7 +373,7 @@
ip_address = main.Cluster.active( i ).ipAddress
# Stop an ONOS node: i
- main.step( "Stop ONOS node " + stri + ".")
+ main.step( "Stop ONOS node " + stri + "." )
stopResult = main.ONOSbench.onosStop( ip_address )
main.Cluster.runningNodes[ i ].active = False
@@ -394,7 +386,7 @@
result = result and connectivityResult
# Restart ONOS node
- main.step( "Restart ONOS node " + stri + " and checking status of restart.")
+ main.step( "Restart ONOS node " + stri + " and checking status of restart." )
startResult = main.ONOSbench.onosStart( ip_address )
utilities.assert_equals( expect=main.TRUE, actual=startResult,
@@ -451,7 +443,6 @@
onpass="Connectivity is as expected.",
onfail="Connectivity is NOT as expected." )
-
def CASE310( self, main ):
"""
Kill 1 ONOS node at a time and test connectivity
@@ -484,8 +475,7 @@
utilities.assert_equals( expect=main.TRUE,
actual=result,
onpass="Connectivity is as expected.",
- onfail="Connectivity is NOT as expected.")
-
+ onfail="Connectivity is NOT as expected." )
def CASE400( self, main ):
"""
@@ -493,7 +483,6 @@
"""
assert vpls, "vpls not defined"
-
main.case( "Bring down one link at a time and test connectivity." )
result = main.TRUE
diff --git a/TestON/tests/USECASE/VPLS/dependencies/vpls.py b/TestON/tests/USECASE/VPLS/dependencies/vpls.py
index 6240cb3..5c057bf 100644
--- a/TestON/tests/USECASE/VPLS/dependencies/vpls.py
+++ b/TestON/tests/USECASE/VPLS/dependencies/vpls.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
@@ -17,9 +17,7 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
-"""
-"""
Functions for the vpls tests
"""
import time
@@ -65,8 +63,6 @@
NOTE: This requires the expected/sent network config json for the vpls
application be stored in main.vplsConfig
"""
-
-
# Variables
app = main.params[ 'vpls' ][ 'name' ]
pprint = main.Cluster.active( 0 ).REST.pprint
@@ -78,7 +74,7 @@
result = False
getVPLS = utilities.retry( f=ctrl.REST.getNetCfg,
retValue=False,
- kwargs={"subjectClass":"apps", "subjectKey":app},
+ kwargs={ "subjectClass": "apps", "subjectKey": app },
sleep=SLEEP )
onosCfg = json.loads( getVPLS ).get( 'vpls' ).get( 'vplsList' )
onosCfg = pprint( sanitizeConfig( onosCfg ) )
@@ -100,7 +96,7 @@
clusterResult = True
for ctrl in main.Cluster.active():
result = False
- #TODO Read from vpls show and match to pushed json
+ # TODO Read from vpls show and match to pushed json
vpls = ctrl.CLI.parseVplsShow()
parsedVpls = pprint( sanitizeConfig( vpls ) )
sentVpls = pprint( sanitizeConfig( main.vplsConfig ) )
@@ -142,7 +138,7 @@
if pingResult != expected:
connectivityCheck = False
main.log.error( "%s <-> %s: %s; Expected: %s" %
- ( src, dst, pingResult, expected ) )
+ ( src, dst, pingResult, expected ) )
utilities.assert_equals( expect=True,
actual=connectivityCheck,
onpass="Connectivity is as expected",
@@ -151,7 +147,8 @@
# TODO: if encapsulation is set, look for that
# TODO: can we look at the intent keys?
-def checkIntentState( main , bl=[] ):
+
+def checkIntentState( main, bl=[] ):
# Print the intent states
intents = main.Cluster.active( 0 ).CLI.intents()
count = 0
@@ -179,7 +176,7 @@
result = {}
vplsConfig = main.vplsConfig
for v in vplsConfig:
- interfaces = v[ 'interfaces' ][:]
+ interfaces = v[ 'interfaces' ][ : ]
for i in bl:
if i in interfaces:
interfaces.remove( i )