[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
index 9ee512c..1633c44 100644
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/SCPFscalingMaxIntents.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,12 +18,11 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
import sys
import json
import time
import os
-'''
+"""
SCPFscalingMaxIntents
Push test Intents to onos
CASE10: set up Null Provider
@@ -31,8 +30,9 @@
Check flows number, if flows number is not as except, finished this test iteration
Scale up when reach the Limited
Start from 1 nodes, 8 devices. Then Scale up to 3,5,7 nodes
-'''
+"""
class SCPFscalingMaxIntents:
+
def __init__( self ):
self.default = ''
@@ -63,7 +63,7 @@
main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] )
main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] )
- main.rerouteSleep = int ( main.params[ 'SLEEP' ][ 'reroute' ] )
+ main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
main.intentConfigRegiCfg = main.params[ 'CFG' ][ 'intentConfigRegi' ]
main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
main.linkCollectionIntentCfg = main.params[ 'CFG' ][ 'linkCollectionIntent' ]
@@ -97,6 +97,7 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
main.commit = main.commit.split( " " )[ 1 ]
+
def CASE1( self ):
copyResult = main.ONOSbench.copyMininetFile( main.topology,
main.dependencyPath,
@@ -133,25 +134,24 @@
# Setup the null-provider
main.step( "Configuring null-provider" )
cfgStatus = utilities.retry( main.ONOSbench.onosCfgSet,
- main.FALSE,
- [ main.Cluster.active( 0 ).ipAddress,
- main.nullProviderCfg, 'deviceCount 8' ],
- sleep=main.verifySleep,
- attempts = main.verifyAttempts )
+ main.FALSE,
+ [ main.Cluster.active( 0 ).ipAddress,
+ main.nullProviderCfg, 'deviceCount 8' ],
+ sleep=main.verifySleep,
+ attempts=main.verifyAttempts )
cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
main.FALSE,
[ main.Cluster.active( 0 ).ipAddress,
main.nullProviderCfg, 'topoShape reroute' ],
sleep=main.verifySleep,
- attempts = main.verifyAttempts )
+ attempts=main.verifyAttempts )
cfgStatus = cfgStatus and utilities.retry( main.ONOSbench.onosCfgSet,
main.FALSE,
[ main.Cluster.active( 0 ).ipAddress,
main.nullProviderCfg, 'enabled true' ],
sleep=main.verifySleep,
- attempts = main.verifyAttempts )
-
+ attempts=main.verifyAttempts )
utilities.assert_equals( expect=main.TRUE,
actual=cfgStatus,
@@ -197,9 +197,9 @@
main.setupSkipped = True
def CASE11( self, main ):
- '''
+ """
Setting up mininet
- '''
+ """
import json
import time
devices = []
@@ -210,10 +210,10 @@
time.sleep( main.startUpSleep )
if main.flowObj:
main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
- "useFlowObjectives", value="true" )
+ "useFlowObjectives", value="true" )
main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
- "defaultFlowObjectiveCompiler",
- value=main.linkCollectionIntentCfg )
+ "defaultFlowObjectiveCompiler",
+ value=main.linkCollectionIntentCfg )
main.step( 'Starting mininet topology' )
mnStatus = main.Mininet1.startNet( topoFile='~/mininet/custom/rerouteTopo.py' )
utilities.assert_equals( expect=main.TRUE,
@@ -277,8 +277,6 @@
if not caseResult:
main.setupSkipped = True
-
-
def CASE20( self, main ):
try:
from tests.dependencies.utils import Utils
@@ -330,9 +328,9 @@
# make sure the checkInterval divisible batchSize
main.checkInterval = int( int( main.checkInterval / main.batchSize ) * main.batchSize )
- flowTemp=0
+ flowTemp = 0
intentVerifyTemp = 0
- totalFlows=0
+ totalFlows = 0
for i in range( limit ):
# Threads pool
@@ -352,8 +350,8 @@
kwargs={ "offset": offtmp,
"options": "-i",
"timeout": main.timeout,
- "background":False,
- "noExit":True } )
+ "background": False,
+ "noExit": True } )
pool.append( t )
t.start()
main.threadID = main.threadID + 1
@@ -420,10 +418,10 @@
main.log.info( "Total Intents: {}".format( verifyTotalIntents ) )
break
- utilities.assert_equals( expect = main.TRUE,
- actual = intentsState,
- onpass = "Successfully pushed and verified intents",
- onfail = "Failed to push and verify intents" )
+ utilities.assert_equals( expect=main.TRUE,
+ actual=intentsState,
+ onpass="Successfully pushed and verified intents",
+ onfail="Failed to push and verify intents" )
main.log.info( "Total Intents Installed before crash: {}".format( totalIntents ) )
main.log.info( "Total Flows ADDED before crash: {}".format( totalFlows ) )
diff --git a/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/rerouteTopo.py b/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/rerouteTopo.py
old mode 100755
new mode 100644
index dace730..a5336f0
--- a/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/rerouteTopo.py
+++ b/TestON/tests/SCPF/SCPFscalingMaxIntents/dependencies/rerouteTopo.py
@@ -1,7 +1,7 @@
#!/usr/bin/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>,
@@ -10,7 +10,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,7 +20,6 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
"""
Custom topology for Mininet
"""
@@ -34,19 +33,20 @@
from mininet.util import dumpNodeConnections
from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
+
class MyTopo( Topo ):
def __init__( self ):
# Initialize topology
Topo.__init__( self )
- host1 = self.addHost('h1', ip='10.1.0.1/24')
- host2 = self.addHost('h2', ip='10.1.0.2/24')
- host3 = self.addHost('h3', ip='10.1.0.3/24')
- host4 = self.addHost('h4', ip='10.1.0.4/24')
- host5 = self.addHost('h5', ip='10.1.0.5/24')
- host6 = self.addHost('h6', ip='10.1.0.6/24')
- host7 = self.addHost('h7', ip='10.1.0.7/24')
+ host1 = self.addHost( 'h1', ip='10.1.0.1/24' )
+ host2 = self.addHost( 'h2', ip='10.1.0.2/24' )
+ host3 = self.addHost( 'h3', ip='10.1.0.3/24' )
+ host4 = self.addHost( 'h4', ip='10.1.0.4/24' )
+ host5 = self.addHost( 'h5', ip='10.1.0.5/24' )
+ host6 = self.addHost( 'h6', ip='10.1.0.6/24' )
+ host7 = self.addHost( 'h7', ip='10.1.0.7/24' )
s1 = self.addSwitch( 's1' )
s2 = self.addSwitch( 's2' )
@@ -57,39 +57,37 @@
s7 = self.addSwitch( 's7' )
s8 = self.addSwitch( 's8' )
+ self.addLink( s1, host1 )
+ self.addLink( s2, host2 )
+ self.addLink( s3, host3 )
+ self.addLink( s4, host4 )
+ self.addLink( s5, host5 )
+ self.addLink( s6, host6 )
+ self.addLink( s7, host7 )
- self.addLink(s1, host1)
- self.addLink(s2, host2)
- self.addLink(s3, host3)
- self.addLink(s4, host4)
- self.addLink(s5, host5)
- self.addLink(s6, host6)
- self.addLink(s7, host7)
-
-
-
- self.addLink(s1,s2)
- self.addLink(s2,s3)
- self.addLink(s3,s4)
- self.addLink(s4,s5)
- self.addLink(s5,s6)
- self.addLink(s6,s7)
- self.addLink(s4,s8)
- self.addLink(s8,s5)
+ self.addLink( s1, s2 )
+ self.addLink( s2, s3 )
+ self.addLink( s3, s4 )
+ self.addLink( s4, s5 )
+ self.addLink( s5, s6 )
+ self.addLink( s6, s7 )
+ self.addLink( s4, s8 )
+ self.addLink( s8, s5 )
topos = { 'mytopo': ( lambda: MyTopo() ) }
# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
+
def setupNetwork():
"Create network"
topo = MyTopo()
- network = Mininet(topo=topo, autoSetMacs=True, controller=None)
+ network = Mininet( topo=topo, autoSetMacs=True, controller=None )
network.start()
CLI( network )
network.stop()
if __name__ == '__main__':
- setLogLevel('info')
- #setLogLevel('debug')
+ setLogLevel( 'info' )
+ # setLogLevel( 'debug' )
setupNetwork()