[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON
Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/FUNC/FUNCflow/FUNCflow.py b/TestON/tests/FUNC/FUNCflow/FUNCflow.py
index 9b504ba..e900648 100644
--- a/TestON/tests/FUNC/FUNCflow/FUNCflow.py
+++ b/TestON/tests/FUNC/FUNCflow/FUNCflow.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/>.
"""
-
class FUNCflow:
def __init__( self ):
@@ -42,7 +41,6 @@
- Checkout ONOS master branch
- Pull latest ONOS code
"""
-
main.testSetUp.envSetupDescription()
stepResult = main.FALSE
try:
@@ -71,7 +69,7 @@
main.checkingFlow = CheckingFlow()
except ImportError as e:
print e
- main.log.error("CheckingFlow not found exiting the test")
+ main.log.error( "CheckingFlow not found exiting the test" )
main.cleanAndExit()
copyResult = main.ONOSbench.scp( main.Mininet1,
main.dependencyPath + main.topology,
@@ -89,7 +87,6 @@
main.testSetUp.envSetupException( e )
main.testSetUp.evnSetupConclusion( stepResult )
-
def CASE2( self, main ):
"""
- Set up cell
@@ -788,7 +785,7 @@
udpDst = main.params[ 'TEST' ][ 'udpDst' ]
main.log.info( "Add a flow that connects host1 on port1 to host2 on port2" )
- stepResult =ctrl.REST.addFlow( deviceId=main.swDPID,
+ stepResult = ctrl.REST.addFlow( deviceId=main.swDPID,
egressPort=egress,
ingressPort=ingress,
ethType=ethType,
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py b/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
index 4209947..37ae8b6 100644
--- a/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/checkingFlow.py
@@ -1,12 +1,14 @@
import json
import time
+
+
class CheckingFlow:
def __init__( self ):
self.default = ''
def checkFlow( self ):
- main.step("Check flow is in the ADDED state")
+ main.step( "Check flow is in the ADDED state" )
main.log.info( "Get the flows from ONOS" )
try:
flows = json.loads( main.Cluster.active( 0 ).REST.flows() )
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/mplsClass.py b/TestON/tests/FUNC/FUNCflow/dependencies/mplsClass.py
index 66d4664..ec9ebaa 100644
--- a/TestON/tests/FUNC/FUNCflow/dependencies/mplsClass.py
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/mplsClass.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,14 +18,14 @@
You should have received a copy of the GNU General Public License
along with TestON. If not, see <http://www.gnu.org/licenses/>.
"""
-
import scapy
-class MPLS(Packet):
- name = "MPLS"
- fields_desc = [
- BitField("label", 3, 20),
- BitField("experimental_bits", 0, 3),
- BitField("bottom_of_label_stack", 1, 1), # Now we're at the bottom
- ByteField("TTL", 255)
- ]
+
+class MPLS( Packet ):
+ name = "MPLS"
+ fields_desc = [
+ BitField( "label", 3, 20 ),
+ BitField( "experimental_bits", 0, 3 ),
+ BitField( "bottom_of_label_stack", 1, 1 ), # Now we're at the bottom
+ ByteField( "TTL", 255 )
+ ]
diff --git a/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py b/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py
old mode 100755
new mode 100644
index 8a5e402..0dbaa80
--- a/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py
+++ b/TestON/tests/FUNC/FUNCflow/dependencies/topo-flow.py
@@ -1,5 +1,6 @@
+# !/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>,
@@ -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/python
-
"""
Custom topology for Mininet
"""
@@ -35,19 +34,23 @@
from mininet.util import dumpNodeConnections
from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
+
class VLANHost( Host ):
+
def config( self, vlan=100, **params ):
r = super( Host, self ).config( **params )
intf = self.defaultIntf()
self.cmd( 'ifconfig %s inet 0' % intf )
self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
- self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
+ self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params[ 'ip' ] ) )
newName = '%s.%d' % ( intf, vlan )
intf.name = newName
self.nameToIntf[ newName ] = intf
return r
+
class IPv6Host( Host ):
+
def config( self, v6Addr='1000:1/64', **params ):
r = super( Host, self ).config( **params )
intf = self.defaultIntf()
@@ -55,45 +58,46 @@
self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
return r
+
class MyTopo( Topo ):
def __init__( self, **opts ):
# Initialize topology
- Topo.__init__( self, **opts)
+ Topo.__init__( self, **opts )
# IPv4 hosts
- host1=self.addHost( 'h1', ip='10.0.0.1/24' )
- host2=self.addHost( 'h2', ip='10.0.0.2/24' )
+ host1 = self.addHost( 'h1', ip='10.0.0.1/24' )
+ host2 = self.addHost( 'h2', ip='10.0.0.2/24' )
# VLAN hosts
- host3=self.addHost( 'h3', ip='10.0.0.3/24', cls=VLANHost, vlan=10 )
- host4=self.addHost( 'h4', ip='10.0.0.4/24', cls=VLANHost, vlan=10 )
+ host3 = self.addHost( 'h3', ip='10.0.0.3/24', cls=VLANHost, vlan=10 )
+ host4 = self.addHost( 'h4', ip='10.0.0.4/24', cls=VLANHost, vlan=10 )
- #IPv6 hosts
- host5=self.addHost( 'h5', ip='10.0.0.5/24', cls=IPv6Host, v6Addr='1000::5/64')
- host6=self.addHost( 'h6', ip='10.0.0.6/24', cls=IPv6Host, v6Addr='1000::6/64')
+ # IPv6 hosts
+ host5 = self.addHost( 'h5', ip='10.0.0.5/24', cls=IPv6Host, v6Addr='1000::5/64' )
+ host6 = self.addHost( 'h6', ip='10.0.0.6/24', cls=IPv6Host, v6Addr='1000::6/64' )
s1 = self.addSwitch( 's1' )
- self.addLink(s1, host1)
- self.addLink(s1, host2)
- self.addLink(s1, host3)
- self.addLink(s1, host4)
- self.addLink(s1, host5)
- self.addLink(s1, host6)
-
+ self.addLink( s1, host1 )
+ self.addLink( s1, host2 )
+ self.addLink( s1, host3 )
+ self.addLink( s1, host4 )
+ self.addLink( s1, host5 )
+ self.addLink( s1, host6 )
topos = { 'mytopo': ( lambda: MyTopo() ) }
+
def setupNetwork():
"Create network"
topo = MyTopo()
- network = Mininet(topo=topo, autoSetMacs=True, autoStaticArp=True, controller=None)
+ network = Mininet( topo=topo, autoSetMacs=True, autoStaticArp=True, controller=None )
network.start()
CLI( network )
network.stop()
if __name__ == '__main__':
- setLogLevel('info')
- #setLogLevel('debug')
+ setLogLevel( 'info' )
+ # setLogLevel( 'debug' )
setupNetwork()