[ONOS-7039] [ONOS-7044] Fix PEP8 Warnings in TestON

Change-Id: Ied79ff9caff5487a6df50466307f757468d7ca3a
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/Dependency/newFuncTopo.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/Dependency/newFuncTopo.py
old mode 100755
new mode 100644
index 0d72770..ad99198
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/Dependency/newFuncTopo.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/Dependency/newFuncTopo.py
@@ -1,7 +1,7 @@
 #!/usr/bin/python
 
 """
-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>,
@@ -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
 """
@@ -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,13 +58,16 @@
         self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
         return r
 
+
 class dualStackHost( Host ):
+
     def config( self, v6Addr='2000:1/64', **params ):
         r = super( Host, self ).config( **params )
         intf = self.defaultIntf()
         self.cmd( 'ip -6 addr add %s dev %s' % ( v6Addr, intf ) )
         return r
 
+
 class MyTopo( Topo ):
 
     def __init__( self ):
@@ -69,43 +75,43 @@
         Topo.__init__( self )
 
         # Switch S5 Hosts
-        host1=self.addHost( 'h1', ip='10.1.0.2/24' )
-        host2=self.addHost( 'h2', cls=IPv6Host, v6Addr='1000::2/64' )
-        host3=self.addHost( 'h3', ip='10.1.0.3/24', cls=dualStackHost, v6Addr='2000::2/64' )
-        #VLAN hosts
-        host4=self.addHost( 'h4', ip='100.1.0.2/24', cls=VLANHost, vlan=100 )
-        host5=self.addHost( 'h5', ip='200.1.0.2/24', cls=VLANHost, vlan=200 )
-        #VPN-1 and VPN-2 Hosts
-        host6=self.addHost( 'h6', ip='11.1.0.2/24' )
-        host7=self.addHost( 'h7', ip='12.1.0.2/24' )
-        #Multicast Sender
-        host8=self.addHost( 'h8', ip='10.1.0.4/24' )
+        host1 = self.addHost( 'h1', ip='10.1.0.2/24' )
+        host2 = self.addHost( 'h2', cls=IPv6Host, v6Addr='1000::2/64' )
+        host3 = self.addHost( 'h3', ip='10.1.0.3/24', cls=dualStackHost, v6Addr='2000::2/64' )
+        # VLAN hosts
+        host4 = self.addHost( 'h4', ip='100.1.0.2/24', cls=VLANHost, vlan=100 )
+        host5 = self.addHost( 'h5', ip='200.1.0.2/24', cls=VLANHost, vlan=200 )
+        # VPN-1 and VPN-2 Hosts
+        host6 = self.addHost( 'h6', ip='11.1.0.2/24' )
+        host7 = self.addHost( 'h7', ip='12.1.0.2/24' )
+        # Multicast Sender
+        host8 = self.addHost( 'h8', ip='10.1.0.4/24' )
 
         # Switch S6 Hosts
-        host9=self.addHost( 'h9', ip='10.1.0.5/24' )
-        host10=self.addHost( 'h10', cls=IPv6Host, v6Addr='1000::3/64' )
-        host11=self.addHost( 'h11', ip='10.1.0.6/24', cls=dualStackHost, v6Addr='2000::3/64' )
-        #VLAN hosts
-        host12=self.addHost( 'h12', ip='100.1.0.3/24', cls=VLANHost, vlan=100 )
-        host13=self.addHost( 'h13', ip='200.1.0.3/24', cls=VLANHost, vlan=200 )
-        #VPN-1 and VPN-2 Hosts
-        host14=self.addHost( 'h14', ip='11.1.0.3/24' )
-        host15=self.addHost( 'h15', ip='12.1.0.3/24' )
-        #Multicast Receiver
-        host16=self.addHost( 'h16', ip='10.1.0.7/24' )
+        host9 = self.addHost( 'h9', ip='10.1.0.5/24' )
+        host10 = self.addHost( 'h10', cls=IPv6Host, v6Addr='1000::3/64' )
+        host11 = self.addHost( 'h11', ip='10.1.0.6/24', cls=dualStackHost, v6Addr='2000::3/64' )
+        # VLAN hosts
+        host12 = self.addHost( 'h12', ip='100.1.0.3/24', cls=VLANHost, vlan=100 )
+        host13 = self.addHost( 'h13', ip='200.1.0.3/24', cls=VLANHost, vlan=200 )
+        # VPN-1 and VPN-2 Hosts
+        host14 = self.addHost( 'h14', ip='11.1.0.3/24' )
+        host15 = self.addHost( 'h15', ip='12.1.0.3/24' )
+        # Multicast Receiver
+        host16 = self.addHost( 'h16', ip='10.1.0.7/24' )
 
         # Switch S7 Hosts
-        host17=self.addHost( 'h17', ip='10.1.0.8/24' )
-        host18=self.addHost( 'h18', cls=IPv6Host, v6Addr='1000::4/64' )
-        host19=self.addHost( 'h19', ip='10.1.0.9/24', cls=dualStackHost, v6Addr='2000::4/64' )
-        #VLAN hosts
-        host20=self.addHost( 'h20', ip='100.1.0.4/24', cls=VLANHost, vlan=100 )
-        host21=self.addHost( 'h21', ip='200.1.0.4/24', cls=VLANHost, vlan=200 )
-        #VPN-1 and VPN-2 Hosts
-        host22=self.addHost( 'h22', ip='11.1.0.4/24' )
-        host23=self.addHost( 'h23', ip='12.1.0.4/24' )
-        #Multicast Receiver
-        host24=self.addHost( 'h24', ip='10.1.0.10/24' )
+        host17 = self.addHost( 'h17', ip='10.1.0.8/24' )
+        host18 = self.addHost( 'h18', cls=IPv6Host, v6Addr='1000::4/64' )
+        host19 = self.addHost( 'h19', ip='10.1.0.9/24', cls=dualStackHost, v6Addr='2000::4/64' )
+        # VLAN hosts
+        host20 = self.addHost( 'h20', ip='100.1.0.4/24', cls=VLANHost, vlan=100 )
+        host21 = self.addHost( 'h21', ip='200.1.0.4/24', cls=VLANHost, vlan=200 )
+        # VPN-1 and VPN-2 Hosts
+        host22 = self.addHost( 'h22', ip='11.1.0.4/24' )
+        host23 = self.addHost( 'h23', ip='12.1.0.4/24' )
+        # Multicast Receiver
+        host24 = self.addHost( 'h24', ip='10.1.0.10/24' )
 
         s1 = self.addSwitch( 's1' )
         s2 = self.addSwitch( 's2' )
@@ -115,59 +121,60 @@
         s6 = self.addSwitch( 's6' )
         s7 = self.addSwitch( 's7' )
 
-        self.addLink(s5,host1)
-        self.addLink(s5,host2)
-        self.addLink(s5,host3)
-        self.addLink(s5,host4)
-        self.addLink(s5,host5)
-        self.addLink(s5,host6)
-        self.addLink(s5,host7)
-        self.addLink(s5,host8)
+        self.addLink( s5, host1 )
+        self.addLink( s5, host2 )
+        self.addLink( s5, host3 )
+        self.addLink( s5, host4 )
+        self.addLink( s5, host5 )
+        self.addLink( s5, host6 )
+        self.addLink( s5, host7 )
+        self.addLink( s5, host8 )
 
-        self.addLink(s6,host9)
-        self.addLink(s6,host10)
-        self.addLink(s6,host11)
-        self.addLink(s6,host12)
-        self.addLink(s6,host13)
-        self.addLink(s6,host14)
-        self.addLink(s6,host15)
-        self.addLink(s6,host16)
+        self.addLink( s6, host9 )
+        self.addLink( s6, host10 )
+        self.addLink( s6, host11 )
+        self.addLink( s6, host12 )
+        self.addLink( s6, host13 )
+        self.addLink( s6, host14 )
+        self.addLink( s6, host15 )
+        self.addLink( s6, host16 )
 
-        self.addLink(s7,host17)
-        self.addLink(s7,host18)
-        self.addLink(s7,host19)
-        self.addLink(s7,host20)
-        self.addLink(s7,host21)
-        self.addLink(s7,host22)
-        self.addLink(s7,host23)
-        self.addLink(s7,host24)
+        self.addLink( s7, host17 )
+        self.addLink( s7, host18 )
+        self.addLink( s7, host19 )
+        self.addLink( s7, host20 )
+        self.addLink( s7, host21 )
+        self.addLink( s7, host22 )
+        self.addLink( s7, host23 )
+        self.addLink( s7, host24 )
 
-        self.addLink(s1,s2)
-        self.addLink(s1,s3)
-        self.addLink(s1,s4)
-        self.addLink(s1,s5)
+        self.addLink( s1, s2 )
+        self.addLink( s1, s3 )
+        self.addLink( s1, s4 )
+        self.addLink( s1, s5 )
 
-        self.addLink(s2,s3)
-        self.addLink(s2,s5)
-        self.addLink(s2,s6)
+        self.addLink( s2, s3 )
+        self.addLink( s2, s5 )
+        self.addLink( s2, s6 )
 
-        self.addLink(s3,s4)
-        self.addLink(s3,s6)
+        self.addLink( s3, s4 )
+        self.addLink( s3, s6 )
 
-        self.addLink(s4,s7)
+        self.addLink( s4, s7 )
         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()
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index 553fa8e..cb5019c 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.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,23 +18,22 @@
     You should have received a copy of the GNU General Public License
     along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 """
-
 # This is a sample template that starts up ONOS cluster, this template
 # can be use as a base script for ONOS System Testing.
 
+
 class SAMPstartTemplate_3node:
 
     def __init__( self ):
         self.default = ''
 
-
-    def CASE0(self, main):
-        '''
+    def CASE0( self, main ):
+        """
             Pull specific ONOS branch, then Build ONOS on ONOS Bench.
             This step is usually skipped. Because in a Jenkins driven automated
             test env. We want Jenkins jobs to pull&build for flexibility to handle
             different versions of ONOS.
-        '''
+        """
         try:
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
@@ -47,13 +46,12 @@
 
         main.testSetUp.gitPulling()
 
-
     def CASE1( self, main ):
-        '''
+        """
             Set up global test variables;
             Uninstall all running cells in test env defined in .topo file
 
-        '''
+        """
         try:
             from tests.dependencies.ONOSSetup import ONOSSetup
         except ImportError:
@@ -67,23 +65,21 @@
         main.testSetUp.envSetupDescription()
         stepResult = main.FALSE
         try:
-            main.onosStartupSleep = float(main.params['CASE1']['SleepTimers']['onosStartup'])
-            main.onosCfgSleep = float(main.params['CASE1']['SleepTimers']['onosCfg'])
-            main.mnStartupSleep = float(main.params['CASE1']['SleepTimers']['mnStartup'])
-            main.mnCfgSleep = float(main.params['CASE1']['SleepTimers']['mnCfg'])
+            main.onosStartupSleep = float( main.params[ 'CASE1' ][ 'SleepTimers' ][ 'onosStartup' ] )
+            main.onosCfgSleep = float( main.params[ 'CASE1' ][ 'SleepTimers' ][ 'onosCfg' ] )
+            main.mnStartupSleep = float( main.params[ 'CASE1' ][ 'SleepTimers' ][ 'mnStartup' ] )
+            main.mnCfgSleep = float( main.params[ 'CASE1' ][ 'SleepTimers' ][ 'mnCfg' ] )
             stepResult = main.testSetUp.envSetup( includeGitPull=False )
         except Exception as e:
             main.testSetUp.envSetupException( e )
         main.testSetUp.evnSetupConclusion( stepResult )
 
-
-
     def CASE2( self, main ):
-        '''
+        """
             Report errors/warnings/exceptions
-        '''
-        main.log.info("Error report: \n" )
-        main.ONOSbench.logReport( main.Cluster.runningNodes[0].ipAddress,
+        """
+        main.log.info( "Error report: \n" )
+        main.ONOSbench.logReport( main.Cluster.runningNodes[ 0 ].ipAddress,
                                   [ "INFO",
                                     "FOLLOWER",
                                     "WARN",
@@ -94,10 +90,10 @@
 
     def CASE10( self, main ):
         """
-        Start ONOS cluster (3 nodes in this example) in three steps:
-        1) start a basic cluster with drivers app via ONOSDriver;
-        2) activate apps via ONOSCliDriver;
-        3) configure onos via ONOSCliDriver;
+        Start ONOS cluster ( 3 nodes in this example ) in three steps:
+        1 ) start a basic cluster with drivers app via ONOSDriver;
+        2 ) activate apps via ONOSCliDriver;
+        3 ) configure onos via ONOSCliDriver;
         """
         try:
             from tests.dependencies.ONOSSetup import ONOSSetup
@@ -113,9 +109,9 @@
 
         main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster." )
 
-        main.step( "Start ONOS cluster with basic (drivers) app.")
+        main.step( "Start ONOS cluster with basic (drivers) app." )
         stepResult = main.ONOSbench.startBasicONOS( nodeList=main.Cluster.getIps(), opSleep=200,
-                                               onosUser=main.ONOScell.karafUser )
+                                                    onosUser=main.ONOScell.karafUser )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
@@ -123,13 +119,13 @@
 
         main.testSetUp.startOnosClis()
 
-        main.step( "Activate onos apps.")
-        main.apps = main.params['CASE10'].get( 'Apps' )
+        main.step( "Activate onos apps." )
+        main.apps = main.params[ 'CASE10' ].get( 'Apps' )
         if main.apps:
             main.log.info( "Apps to activate: " + main.apps )
             activateResult = main.TRUE
-            for a in main.apps.split(","):
-                activateResult = activateResult & main.Cluster.active( 0 ).CLI.activateApp(a)
+            for a in main.apps.split( "," ):
+                activateResult = activateResult & main.Cluster.active( 0 ).CLI.activateApp( a )
             # TODO: check this worked
             time.sleep( main.onosCfgSleep )  # wait for apps to activate
         else:
@@ -140,14 +136,14 @@
                                  onfail="Failed to set config" )
 
         main.step( "Set ONOS configurations" )
-        config = main.params['CASE10'].get( 'ONOS_Configuration' )
+        config = main.params[ 'CASE10' ].get( 'ONOS_Configuration' )
         if config:
             main.log.debug( config )
             checkResult = main.TRUE
             for component in config:
-                for setting in config[component]:
-                    value = config[component][setting]
-                    check = main.Cluster.runningNodes[0].setCfg( component, setting, value )
+                for setting in config[ component ]:
+                    value = config[ component ][ setting ]
+                    check = main.Cluster.runningNodes[ 0 ].setCfg( component, setting, value )
                     main.log.info( "Value was changed? {}".format( main.TRUE == check ) )
                     checkResult = check and checkResult
             utilities.assert_equals( expect=main.TRUE,
@@ -163,12 +159,12 @@
         """
         import time
 
-        topology = main.params['CASE11']['topo']
+        topology = main.params[ 'CASE11' ][ 'topo' ]
         main.log.report( "Start Mininet topology" )
         main.case( "Start Mininet topology" )
 
         main.step( "Starting Mininet Topology" )
-        topoResult = main.Mininet1.startNet(mnCmd=topology )
+        topoResult = main.Mininet1.startNet( mnCmd=topology )
         stepResult = topoResult
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
@@ -178,25 +174,23 @@
         if not topoResult:
             main.cleanAndExit()
 
-        main.step( "Assign switches to controllers.")
+        main.step( "Assign switches to controllers." )
         assignResult = main.TRUE
-        for i in range(1, 8):
+        for i in range( 1, 8 ):
             assignResult = assignResult & main.Mininet1.assignSwController( sw="s" + str( i ),
                                                                             ip=main.Cluster.getIps(),
                                                                             port='6653' )
-        time.sleep(main.mnCfgSleep)
+        time.sleep( main.mnCfgSleep )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully assign switches to controllers",
                                  onfail="Failed to assign switches to controllers" )
 
-
     def CASE12( self, main ):
         """
             Tests using through ONOS CLI handles
         """
-
-        main.case( "Test some onos commands through CLI. ")
+        main.case( "Test some onos commands through CLI. " )
         main.log.debug( main.Cluster.active( 0 ).CLI.sendline( "summary" ) )
         main.log.debug( main.Cluster.active( 1 ).CLI.sendline( "devices" ) )
 
@@ -204,8 +198,7 @@
         """
             Tests using ONOS REST API handles
         """
-
-        main.case( " Sample tests using ONOS REST API handles. ")
+        main.case( " Sample tests using ONOS REST API handles. " )
         main.log.debug( main.Cluster.active( 0 ).REST.send( "/devices" ) )
         main.log.debug( main.Cluster.active( 2 ).REST.apps() )
 
@@ -221,17 +214,17 @@
         installResults = main.Cluster.active( 0 ).CLI.activateApp( "org.onosproject.fwd" )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=installResults,
-                                 onpass= "Configure fwd successful",
-                                 onfail= "Configure fwd failed" )
+                                 onpass="Configure fwd successful",
+                                 onfail="Configure fwd failed" )
         main.step( "Run pingall to check connectivity. " )
         pingResult = main.FALSE
         passMsg = "Reactive Pingall test passed"
         pingResult = main.Mininet1.pingall()
         if not pingResult:
-           main.log.warn("First pingall failed. Trying again...")
-           pingResult = main.Mininet1.pingall()
-           passMsg += "on the second try"
+            main.log.warn( "First pingall failed. Trying again..." )
+            pingResult = main.Mininet1.pingall()
+            passMsg += "on the second try"
         utilities.assert_equals( expect=main.TRUE,
                                  actual=pingResult,
                                  onpass=passMsg,
-                                 onfail= "Reactive Pingall failed, " + "one or more ping pairs failed" )
+                                 onfail="Reactive Pingall failed, " + "one or more ping pairs failed" )