[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
index 00d5cab..aa298ab 100644
--- a/TestON/tests/FUNC/FUNCoptical/FUNCoptical.py
+++ b/TestON/tests/FUNC/FUNCoptical/FUNCoptical.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
@@ -90,16 +89,15 @@
"""
Start Mininet opticalTest Topology
"""
-
main.case( "Mininet with Linc-OE startup" )
main.step( "Push TopoDDriver.json to ONOS through onos-netcfg" )
topoResult = True
for ctrl in main.Cluster.active():
topoResult = topoResult and \
- main.ONOSbench.onosNetCfg(controllerIp=ctrl.ipAddress,
- path=main.dependencyPath,
- fileName="TopoDDriver.json")
- #Exit if topology did not load properly
+ main.ONOSbench.onosNetCfg( controllerIp=ctrl.ipAddress,
+ path=main.dependencyPath,
+ fileName="TopoDDriver.json" )
+ # Exit if topology did not load properly
if not topoResult:
main.cleanAndExit()
@@ -190,6 +188,7 @@
except ( NameError, AttributeError ):
main.Utils = Utils()
main.Utils.copyKarafLog( "cycle" + str( main.cycle ) )
+
def CASE21( self, main ):
"""
Run pingall to discover all hosts
@@ -219,7 +218,7 @@
arpingHostResults = main.TRUE
for host in hosts:
- if main.LincOE.arping( host, ethDevice=host+"-eth0" ):
+ if main.LincOE.arping( host, ethDevice=host + "-eth0" ):
main.log.info( "Successfully reached host {} with arping".format( host ) )
else:
main.log.error( "Could not reach host {} with arping".format( host ) )
@@ -371,7 +370,6 @@
onpass="ONOS correctly discovered the topology",
onfail="ONOS incorrectly discovered the topology" )
-
def CASE31( self, main ):
import time
"""
@@ -404,8 +402,8 @@
intentsId=main.pIntentsId )
time.sleep( 10 )
checkStateResult = utilities.retry( f=main.Cluster.active( 0 ).CLI.checkIntentState,
- retValue=main.FALSE, args=( main.pIntentsId, "INSTALLED" ),
- sleep=main.checkIntentSleep, attempts=10 )
+ retValue=main.FALSE, args=( main.pIntentsId, "INSTALLED" ),
+ sleep=main.checkIntentSleep, attempts=10 )
main.log.info( "Checking flows state" )
checkFlowResult = main.Cluster.active( 0 ).CLI.checkFlowsState()
# Sleep for 10 seconds to provide time for the intent state to change
@@ -453,11 +451,11 @@
time.sleep( 15 )
for ctrl in main.Cluster.active():
- if not any ( intent.get('state') == 'WITHDRAWING' for intent
- in json.loads( ctrl.CLI.intents() ) ):
- main.log.debug( json.loads( ctrl.CLI.intents() ) )
- removeResult = main.FALSE
- break
+ if not any( intent.get( 'state' ) == 'WITHDRAWING' for intent
+ in json.loads( ctrl.CLI.intents() ) ):
+ main.log.debug( json.loads( ctrl.CLI.intents() ) )
+ removeResult = main.FALSE
+ break
else:
removeResult = main.TRUE
except ( TypeError, ValueError ):
@@ -547,11 +545,11 @@
time.sleep( 15 )
for ctrl in main.Cluster.active():
- if not any ( intent.get('state') == 'WITHDRAWING' for intent
- in json.loads( ctrl.CLI.intents() ) ):
- main.log.debug( json.loads( ctrl.CLI.intents() ) )
- removeResult = main.FALSE
- break
+ if not any( intent.get( 'state' ) == 'WITHDRAWING' for intent
+ in json.loads( ctrl.CLI.intents() ) ):
+ main.log.debug( json.loads( ctrl.CLI.intents() ) )
+ removeResult = main.FALSE
+ break
else:
removeResult = main.TRUE
except ( TypeError, ValueError ):
diff --git a/TestON/tests/FUNC/FUNCoptical/dependencies/ectopo.py b/TestON/tests/FUNC/FUNCoptical/dependencies/ectopo.py
index 576eb51..9413c98 100644
--- a/TestON/tests/FUNC/FUNCoptical/dependencies/ectopo.py
+++ b/TestON/tests/FUNC/FUNCoptical/dependencies/ectopo.py
@@ -1,5 +1,6 @@
+# !/usr/bin/env python
"""
-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 +9,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,8 +20,6 @@
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-#!/usr/bin/env python
-
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.node import Host, RemoteController
@@ -29,9 +28,11 @@
from opticalUtils import LINCSwitch, LINCLink
+
class OpticalTopo( Topo ):
+
"""
- A simple optical topology of three LINC nodes(OE*), two OVS switches(ps*), and two hosts:
+ A simple optical topology of three LINC nodes( OE* ), two OVS switches( ps* ), and two hosts:
OE3
/\
@@ -51,19 +52,19 @@
# set up ROADMs, add them to oel[]
oel = []
an = { "durable": "true" }
- for i in range (1,4):
+ for i in range( 1, 4 ):
oean = { "optical.regens": 0 }
- oel.append( self.addSwitch('OE%s' % i, dpid='0000ffffffffff0%s' % i, annotations=oean, cls=LINCSwitch) )
+ oel.append( self.addSwitch( 'OE%s' % i, dpid='0000ffffffffff0%s' % i, annotations=oean, cls=LINCSwitch ) )
# ROADM port numbers are built as: OE1 <-> OE2 = 1200
# leaving port number up to 100 open for use by Och port
- self.addLink( oel[0], oel[1], port1=1200, port2=2100, annotations=an, cls=LINCLink )
- self.addLink( oel[1], oel[2], port1=2300, port2=3200, annotations=an, cls=LINCLink )
- self.addLink( oel[2], oel[0], port1=3100, port2=1300, annotations=an, cls=LINCLink )
+ self.addLink( oel[ 0 ], oel[ 1 ], port1=1200, port2=2100, annotations=an, cls=LINCLink )
+ self.addLink( oel[ 1 ], oel[ 2 ], port1=2300, port2=3200, annotations=an, cls=LINCLink )
+ self.addLink( oel[ 2 ], oel[ 0 ], port1=3100, port2=1300, annotations=an, cls=LINCLink )
# cross-connects between OVSes and LINCs
- self.addLink( s1, oel[0], port1=2, port2=1, annotations=an, cls=LINCLink )
- self.addLink( s2, oel[1], port1=2, port2=1, annotations=an, cls=LINCLink )
+ self.addLink( s1, oel[ 0 ], port1=2, port2=1, annotations=an, cls=LINCLink )
+ self.addLink( s2, oel[ 1 ], port1=2, port2=1, annotations=an, cls=LINCLink )
def setup( ctls ):
@@ -71,7 +72,7 @@
i = 1
for ctl in ctls:
net.addController( RemoteController( 'c%d' % i, ip=ctl ) )
- i+=1
+ i += 1
net.start()
LINCSwitch.bootOE( net )
@@ -80,11 +81,11 @@
LINCSwitch.shutdownOE()
-if __name__ == "__main__" :
+if __name__ == "__main__":
import sys
- if len( sys.argv ) >= 2 :
+ if len( sys.argv ) >= 2:
setLogLevel( 'info' )
ctls = sys.argv[ 1: ]
setup( ctls )
else:
- print('./ectopo.py [IP1] [IP2]...\n')
+ print( './ectopo.py [IP1] [IP2]...\n' )