[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
index 0c18564..180d860 100644
--- a/TestON/tests/SCPF/SCPFportLat/SCPFportLat.py
+++ b/TestON/tests/SCPF/SCPFportLat/SCPFportLat.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,23 +18,23 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
-'''
+"""
SCPFportLat test
Test latency for port status change
Up & Down:
PortStatus --- Device --- Link --- Graph
yunpeng@onlab.us
-'''
+"""
class SCPFportLat:
+
def __init__( self ):
self.default = ''
def CASE0( self, main ):
import os
import imp
- '''
+ """
- GIT
- BUILDING ONOS
Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
@@ -42,7 +42,7 @@
test env. We want Jenkins jobs to pull&build for flexibility to handle
different versions of ONOS.
- Construct tests variables
- '''
+ """
try:
from tests.dependencies.ONOSSetup import ONOSSetup
main.testSetUp = ONOSSetup()
@@ -87,9 +87,9 @@
resultsDB.close()
main.portFunc = imp.load_source( main.dependencyFunc,
- main.dependencyPath +
- main.dependencyFunc +
- ".py" )
+ main.dependencyPath +
+ main.dependencyFunc +
+ ".py" )
except Exception as e:
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
@@ -111,9 +111,9 @@
time.sleep( 1 )
main.log.info( "Copy topology file to Mininet" )
main.ONOSbench.copyMininetFile( main.topoName,
- main.dependencyPath,
- main.Mininet1.user_name,
- main.Mininet1.ip_address )
+ main.dependencyPath,
+ main.Mininet1.user_name,
+ main.Mininet1.ip_address )
try:
from tests.dependencies.utils import Utils
except ImportError:
@@ -140,7 +140,7 @@
import time
import numpy
# dictionary for each node and each timestamps
- resultDict = { 'up' : {}, 'down' : {} }
+ resultDict = { 'up': {}, 'down': {} }
for d in resultDict:
for i in range( 1, main.Cluster.numCtrls + 1 ):
resultDict[ d ][ 'node' + str( i ) ] = {}
@@ -152,7 +152,7 @@
resultDict[ d ][ 'node' + str( i ) ][ 'LtoG' ] = []
for i in range( 0, main.sampleSize + main.warmUp ):
main.log.info( "==========================================" )
- main.log.info( "================iteration:{}==============".format( str ( i + 1 ) ) )
+ main.log.info( "================iteration:{}==============".format( str( i + 1 ) ) )
if i >= main.warmUp:
# Portdown iteration
main.portFunc.capturePortStatusPack( main,
@@ -185,7 +185,7 @@
True )
# Dictionary for result
- maxDict = {}
+ maxDict = {}
maxDict[ 'down' ] = {}
maxDict[ 'up' ] = {}
maxDict[ 'down' ][ 'max' ] = 0
diff --git a/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py b/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
index f773da3..4c94193 100644
--- a/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
+++ b/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.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,15 +18,13 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
import time
import json
-'''
+"""
Warp function for SCPFportLat test
-'''
-
+"""
def capturePortStatusPack( main, deviceName, interface, portStatus, resultDict, warmup ):
- '''
+ """
Change device port status and use tshark to capture openflow port package
Args:
main: TestON class
@@ -36,10 +34,10 @@
resultDict: put result to dictionary
warmup: if warmup, ignore results
- '''
+ """
main.log.info( "Clean up tshark" )
with open( main.tsharkResultPath, "w" ) as tshark:
- tshark.write("")
+ tshark.write( "" )
main.log.info( "Starting tshark capture" )
main.ONOSbench.tsharkGrep( main.ofportStatus, main.tsharkResultPath )
time.sleep( main.measurementSleep )
@@ -55,7 +53,7 @@
main.log.info( "Capture result:" + resultText )
resultText = resultText.split( " " )
if len( resultText ) > 1:
- tsharkResultTime = int( float( resultText[1] ) * 1000.0 )
+ tsharkResultTime = int( float( resultText[ 1 ] ) * 1000.0 )
resultFile.close()
for i in range( 1, main.Cluster.numCtrls + 1 ):
main.log.info( "================================================" )
@@ -92,9 +90,9 @@
else:
# put result to dictionary
if not warmup:
- resultDict[ portStatus ][ 'node' + str(i) ]['EtoE'].append( EtoE )
- resultDict[ portStatus ][ 'node' + str(i) ]['PtoD'].append( PtoD )
- resultDict[ portStatus ][ 'node' + str(i) ]['DtoL'].append( DtoL )
- resultDict[ portStatus ][ 'node' + str(i) ]['LtoG'].append( LtoG )
+ resultDict[ portStatus ][ 'node' + str( i ) ][ 'EtoE' ].append( EtoE )
+ resultDict[ portStatus ][ 'node' + str( i ) ][ 'PtoD' ].append( PtoD )
+ resultDict[ portStatus ][ 'node' + str( i ) ][ 'DtoL' ].append( DtoL )
+ resultDict[ portStatus ][ 'node' + str( i ) ][ 'LtoG' ].append( LtoG )
else:
main.log.error( "Unexpected tshark output file" )
diff --git a/TestON/tests/SCPF/SCPFportLat/dependencies/topo-perf-2sw.py b/TestON/tests/SCPF/SCPFportLat/dependencies/topo-perf-2sw.py
index 828e44a..7efed0c 100644
--- a/TestON/tests/SCPF/SCPFportLat/dependencies/topo-perf-2sw.py
+++ b/TestON/tests/SCPF/SCPFportLat/dependencies/topo-perf-2sw.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,18 +18,18 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
-'''
+"""
Simple 2 switch topology for topologoy performance test
-'''
-
+"""
from mininet.topo import Topo
+
class MyTopo( Topo ):
- def __init__(self):
- Topo.__init__(self)
- s1 = self.addSwitch( "s1", dpid="0000000000000001")
- s2 = self.addSwitch( "s2", dpid="0000000000000002")
+
+ def __init__( self ):
+ Topo.__init__( self )
+ s1 = self.addSwitch( "s1", dpid="0000000000000001" )
+ s2 = self.addSwitch( "s2", dpid="0000000000000002" )
h1 = self.addHost( "h1" )
h2 = self.addHost( "h2" )