Finished test Clean up
diff --git a/TestON/tests/ClassTest/ClassTest.py b/TestON/tests/ClassTest/ClassTest.py
index 6d7a153..0fd8ccc 100644
--- a/TestON/tests/ClassTest/ClassTest.py
+++ b/TestON/tests/ClassTest/ClassTest.py
@@ -3,24 +3,25 @@
 import os
 import re
 
+
 class ClassTest:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
+    def CASE1( self, main ):
         import time
         import imp
 
-        init = imp.load_source('ClassInit',
-            '/home/admin/ONLabTest/TestON/tests/ClassTest/Dependency/ClassInit.py')
+        init = imp.load_source(
+            'ClassInit',
+            '/home/admin/ONLabTest/TestON/tests/ClassTest/Dependency/ClassInit.py' )
 
-        ip1_from_class = init.getIp1()  
-        init.printMain(main)
+        ip1_from_class = init.getIp1()
+        init.printMain( main )
 
-        main.log.info(ip1_from_class)
+        main.log.info( ip1_from_class )
 
-    def CASE2(self, main):
+    def CASE2( self, main ):
 
-
-        main.log.info("Case 2")
-
+        main.log.info( "Case 2" )
diff --git a/TestON/tests/OnosCHO/OnosCHO.py b/TestON/tests/OnosCHO/OnosCHO.py
index 228843e..3be5cbb 100644
--- a/TestON/tests/OnosCHO/OnosCHO.py
+++ b/TestON/tests/OnosCHO/OnosCHO.py
@@ -9,7 +9,7 @@
 
 class OnosCHO:
 
-    def __init__(self):
+    def __init__( self ):
         self.default = ''
         global deviceDPIDs
         global hostMACs
@@ -19,8 +19,8 @@
         global installedIntents
         global randomLink1, randomLink2, randomLink3, numSwitches, numLinks
 
-    def CASE1(self, main):
-        '''
+    def CASE1( self, main ):
+        """
         Startup sequence:
         git pull
         mvn clean install
@@ -29,168 +29,187 @@
         onos-verify-cell
         onos-install -f
         onos-wait-for-start
-        '''
+        """
         import time
-        cell_name = main.params['ENV']['cellName']
-        git_pull = main.params['GIT']['autoPull']
-        numCtrls = main.params['CTRL']['numCtrl']
-        git_branch = main.params['GIT']['branch']
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        git_pull = main.params[ 'GIT' ][ 'autoPull' ]
+        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+        git_branch = main.params[ 'GIT' ][ 'branch' ]
 
-        main.case("Set up test environment")
-        main.log.report("Set up test environment")
-        main.log.report("_______________________")
-                
-        main.step("Git checkout and pull "+git_branch)
+        main.case( "Set up test environment" )
+        main.log.report( "Set up test environment" )
+        main.log.report( "_______________________" )
+
+        main.step( "Git checkout and pull " + git_branch )
         if git_pull == 'on':
-            checkout_result = main.ONOSbench.git_checkout(git_branch)
+            checkout_result = main.ONOSbench.git_checkout( git_branch )
             pull_result = main.ONOSbench.git_pull()
-            cp_result = (checkout_result and pull_result)
+            cp_result = ( checkout_result and pull_result )
         else:
             checkout_result = main.TRUE
             pull_result = main.TRUE
-            main.log.info("Skipped git checkout and pull")
-            cp_result = (checkout_result and pull_result)
-        utilities.assert_equals(expect=main.TRUE, actual=cp_result,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
-		
-        main.step("mvn clean & install")
+            main.log.info( "Skipped git checkout and pull" )
+            cp_result = ( checkout_result and pull_result )
+        utilities.assert_equals( expect=main.TRUE, actual=cp_result,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
+
+        main.step( "mvn clean & install" )
         mvn_result = main.ONOSbench.clean_install()
-        utilities.assert_equals(expect=main.TRUE, actual=mvn_result,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
+        utilities.assert_equals( expect=main.TRUE, actual=mvn_result,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
 
-        main.ONOSbench.get_version(report=True)
+        main.ONOSbench.get_version( report=True )
 
-        main.step("Apply Cell environment for ONOS")
-        cell_result = main.ONOSbench.set_cell(cell_name)
-        utilities.assert_equals(expect=main.TRUE, actual=cell_result,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
+        main.step( "Apply Cell environment for ONOS" )
+        cell_result = main.ONOSbench.set_cell( cell_name )
+        utilities.assert_equals( expect=main.TRUE, actual=cell_result,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
 
-        main.step("Create ONOS package")
+        main.step( "Create ONOS package" )
         packageResult = main.ONOSbench.onos_package()
-        utilities.assert_equals(expect=main.TRUE, actual=packageResult,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
+        utilities.assert_equals( expect=main.TRUE, actual=packageResult,
+                                 onpass="Test step PASS",
+                                 onfail="Test step FAIL" )
 
-        main.step("Uninstall ONOS package on all Nodes")
-        uninstallResult=main.TRUE
-        for i in range(1,int(numCtrls)+1):
-            ONOS_ip = main.params['CTRL']['ip'+str(i)]
-            main.log.info("Unintsalling package on ONOS Node IP: "+ONOS_ip)
-            u_result= main.ONOSbench.onos_uninstall(ONOS_ip)
-            utilities.assert_equals(expect=main.TRUE, actual=u_result,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
-            uninstallResult=(uninstallResult and u_result)
+        main.step( "Uninstall ONOS package on all Nodes" )
+        uninstallResult = main.TRUE
+        for i in range( 1, int( numCtrls ) + 1 ):
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            main.log.info( "Unintsalling package on ONOS Node IP: " + ONOS_ip )
+            u_result = main.ONOSbench.onos_uninstall( ONOS_ip )
+            utilities.assert_equals( expect=main.TRUE, actual=u_result,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            uninstallResult = ( uninstallResult and u_result )
 
-        main.step("Removing copy-cat logs from ONOS nodes")
+        main.step( "Removing copy-cat logs from ONOS nodes" )
         main.ONOSbench.onos_remove_raft_logs()
 
-        main.step("Install ONOS package on all Nodes")
-        installResult=main.TRUE
-        for i in range(1,int(numCtrls)+1):
-            ONOS_ip = main.params['CTRL']['ip'+str(i)]
-            main.log.info("Intsalling package on ONOS Node IP: "+ONOS_ip)
-            i_result= main.ONOSbench.onos_install(node=ONOS_ip)
-            utilities.assert_equals(expect=main.TRUE, actual=i_result,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
-            installResult=(installResult and i_result)
+        main.step( "Install ONOS package on all Nodes" )
+        installResult = main.TRUE
+        for i in range( 1, int( numCtrls ) + 1 ):
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            main.log.info( "Intsalling package on ONOS Node IP: " + ONOS_ip )
+            i_result = main.ONOSbench.onos_install( node=ONOS_ip )
+            utilities.assert_equals( expect=main.TRUE, actual=i_result,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            installResult = ( installResult and i_result )
 
-        main.step("Verify ONOS nodes UP status")
-        statusResult=main.TRUE
-        for i in range(1,int(numCtrls)+1):
-            ONOS_ip = main.params['CTRL']['ip'+str(i)]
-            main.log.info("ONOS Node "+ONOS_ip+" status:")
-            onos_status = main.ONOSbench.onos_status(node=ONOS_ip)
-            utilities.assert_equals(expect=main.TRUE, actual=onos_status,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
-            statusResult=(statusResult and onos_status)   
+        main.step( "Verify ONOS nodes UP status" )
+        statusResult = main.TRUE
+        for i in range( 1, int( numCtrls ) + 1 ):
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            main.log.info( "ONOS Node " + ONOS_ip + " status:" )
+            onos_status = main.ONOSbench.onos_status( node=ONOS_ip )
+            utilities.assert_equals( expect=main.TRUE, actual=onos_status,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            statusResult = ( statusResult and onos_status )
 
-        main.step("Start ONOS CLI on all nodes")
+        main.step( "Start ONOS CLI on all nodes" )
         cliResult = main.TRUE
         karafTimeout = "3600000"
-        time.sleep(15) # need to wait here for sometime. This will be removed once ONOS is stable enough
-        for i in range(1,int(numCtrls)+1):
-            ONOS_ip = main.params['CTRL']['ip'+str(i)]
-            ONOScli = 'ONOScli'+str(i)
-            main.log.info("ONOS Node "+ONOS_ip+" cli start:")
-            exec "startcli=main."+ONOScli+".start_onos_cli(ONOS_ip, karafTimeout=karafTimeout)"
-            utilities.assert_equals(expect=main.TRUE, actual=startcli,
-                onpass="Test step PASS",
-                onfail="Test step FAIL")
-            cliResult = (cliResult and startcli) 
+        # need to wait here for sometime. This will be removed once ONOS is
+        # stable enough
+        time.sleep( 15 )
+        for i in range( 1, int( numCtrls ) + 1 ):
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            ONOScli = 'ONOScli' + str( i )
+            main.log.info( "ONOS Node " + ONOS_ip + " cli start:" )
+            exec "startcli=main." + ONOScli + \
+                ".start_onos_cli(ONOS_ip, karafTimeout=karafTimeout)"
+            utilities.assert_equals( expect=main.TRUE, actual=startcli,
+                                     onpass="Test step PASS",
+                                     onfail="Test step FAIL" )
+            cliResult = ( cliResult and startcli )
 
-        case1Result = (cp_result and cell_result 
-                and packageResult and installResult and statusResult and cliResult)
-        utilities.assert_equals(expect=main.TRUE, actual=case1Result,
-                onpass="Set up test environment PASS",
-                onfail="Set up test environment FAIL")
+        case1Result = ( cp_result and cell_result
+                        and packageResult and installResult and statusResult and cliResult )
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Set up test environment PASS",
+                                 onfail="Set up test environment FAIL" )
 
-    def CASE2(self, main):
-        ''' 
+    def CASE2( self, main ):
+        """
         This test script still needs more refactoring
-        '''
+        """
         import re
         import time
         import copy
-        numCtrls = main.params['CTRL']['numCtrl']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS4_ip = main.params['CTRL']['ip4']
-        ONOS5_ip = main.params['CTRL']['ip5']
-        ONOS1_port = main.params['CTRL']['port1']
-        ONOS2_port = main.params['CTRL']['port2']
-        ONOS3_port = main.params['CTRL']['port3']
-        ONOS4_port = main.params['CTRL']['port4']
-        ONOS5_port = main.params['CTRL']['port5']
+        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+        ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS2_port = main.params[ 'CTRL' ][ 'port2' ]
+        ONOS3_port = main.params[ 'CTRL' ][ 'port3' ]
+        ONOS4_port = main.params[ 'CTRL' ][ 'port4' ]
+        ONOS5_port = main.params[ 'CTRL' ][ 'port5' ]
 
-        numCtrls = main.params['CTRL']['numCtrl']
-        main.log.report("Assign and Balance all Mininet switches across controllers")
-        main.log.report("_________________________________________________________")
-        time.sleep(15) # need to wait here for sometime. This will be removed once ONOS is stable enough
-        main.case("Assign and Balance all Mininet switches across controllers")
-        main.step("Assign switches to controllers")
-        for i in range(1,26): #1 to (num of switches +1)
-            main.Mininet1.assign_sw_controller(sw=str(i),count=int(numCtrls), 
-                    ip1=ONOS1_ip, port1=ONOS1_port,
-                    ip2=ONOS2_ip, port2=ONOS2_port,
-		            ip3=ONOS3_ip, port3=ONOS3_port, ip4=ONOS4_ip, port4=ONOS4_port, 
-			    ip5=ONOS5_ip, port5=ONOS5_port)
+        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+        main.log.report(
+            "Assign and Balance all Mininet switches across controllers" )
+        main.log.report(
+            "_________________________________________________________" )
+        # need to wait here for sometime. This will be removed once ONOS is
+        # stable enough
+        time.sleep( 15 )
+        main.case(
+            "Assign and Balance all Mininet switches across controllers" )
+        main.step( "Assign switches to controllers" )
+        for i in range( 1, 26 ):  # 1 to ( num of switches +1 )
+            main.Mininet1.assign_sw_controller(
+                sw=str( i ),
+                count=int( numCtrls ),
+                ip1=ONOS1_ip,
+                port1=ONOS1_port,
+                ip2=ONOS2_ip,
+                port2=ONOS2_port,
+                ip3=ONOS3_ip,
+                port3=ONOS3_port,
+                ip4=ONOS4_ip,
+                port4=ONOS4_port,
+                ip5=ONOS5_ip,
+                port5=ONOS5_port )
 
         switch_mastership = main.TRUE
-        for i in range (1,26):
-            response = main.Mininet1.get_sw_controller("s"+str(i))
-            print("Response is " + str(response))
-            if re.search("tcp:"+ONOS1_ip,response):
+        for i in range( 1, 26 ):
+            response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+            print( "Response is " + str( response ) )
+            if re.search( "tcp:" + ONOS1_ip, response ):
                 switch_mastership = switch_mastership and main.TRUE
             else:
                 switch_mastership = main.FALSE
 
         if switch_mastership == main.TRUE:
-            main.log.report("Controller assignment successfull")
+            main.log.report( "Controller assignment successfull" )
         else:
-             main.log.report("Controller assignment failed")
-        time.sleep(5)
+            main.log.report( "Controller assignment failed" )
+        time.sleep( 5 )
 
-        main.step("Balance devices across controllers")
-        for i in range(int(numCtrls)):
+        main.step( "Balance devices across controllers" )
+        for i in range( int( numCtrls ) ):
             balanceResult = main.ONOScli1.balance_masters()
-            time.sleep(3) # giving some breathing time for ONOS to complete re-balance
+            # giving some breathing time for ONOS to complete re-balance
+            time.sleep( 3 )
 
-        utilities.assert_equals(expect=main.TRUE, actual=balanceResult,
-                onpass="Assign and Balance devices test PASS",
-                onfail="Assign and Balance devices test FAIL")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=balanceResult,
+            onpass="Assign and Balance devices test PASS",
+            onfail="Assign and Balance devices test FAIL" )
 
-    def CASE3(self,main) :
-        ''' 
+    def CASE3( self, main ):
+        """
         This Test case will be extended to collect and store more data related
         ONOS state.
-        '''
+        """
         import re
         import copy
         deviceDPIDs = []
@@ -199,118 +218,136 @@
         deviceActiveLinksCount = []
         devicePortsEnabledCount = []
 
-        main.log.report("Collect and Store topology details from ONOS before running any Tests")
-        main.log.report("____________________________________________________________________")        
-        main.case ("Collect and Store Topology Deatils from ONOS")
+        main.log.report(
+            "Collect and Store topology details from ONOS before running any Tests" )
+        main.log.report(
+            "____________________________________________________________________" )
+        main.case( "Collect and Store Topology Deatils from ONOS" )
 
-        main.step("Collect and store current number of switches and links")
+        main.step( "Collect and store current number of switches and links" )
         topology_output = main.ONOScli1.topology()
-        topology_result = main.ONOSbench.get_topology(topology_output)
-        numSwitches = topology_result['devices']
-        numLinks = topology_result['links']
-        main.log.info("Currently there are %s switches and %s links"  %(str(numSwitches), str(numLinks)))
+        topology_result = main.ONOSbench.get_topology( topology_output )
+        numSwitches = topology_result[ 'devices' ]
+        numLinks = topology_result[ 'links' ]
+        main.log.info(
+            "Currently there are %s switches and %s links" %
+            ( str( numSwitches ), str( numLinks ) ) )
 
-        main.step("Store Device DPIDs")
-        for i in range(1,26):
-            deviceDPIDs.append("of:00000000000000"+format(i, '02x'))
-        print "Device DPIDs in Store: \n", str(deviceDPIDs)
+        main.step( "Store Device DPIDs" )
+        for i in range( 1, 26 ):
+            deviceDPIDs.append( "of:00000000000000" + format( i, '02x' ) )
+        print "Device DPIDs in Store: \n", str( deviceDPIDs )
 
-        main.step("Store Host MACs")
-        for i in range(1,26):
-            hostMACs.append("00:00:00:00:00:"+format(i, '02x')+"/-1")
-        print "Host MACs in Store: \n", str(hostMACs)
+        main.step( "Store Host MACs" )
+        for i in range( 1, 26 ):
+            hostMACs.append( "00:00:00:00:00:" + format( i, '02x' ) + "/-1" )
+        print "Host MACs in Store: \n", str( hostMACs )
 
-        main.step("Collect and store all Devices Links")
-        linksResult = main.ONOScli1.links(json_format=False)
-        ansi_escape = re.compile(r'\x1b[^m]*m')
-        linksResult = ansi_escape.sub('', linksResult)
-        linksResult = linksResult.replace(" links","").replace("\r\r","")
-        linksResult=linksResult.splitlines()
-        linksResult = linksResult[1:]
-        deviceLinks = copy.copy(linksResult)
-        print "Device Links Stored: \n", str(deviceLinks)
-        print "Length of Links Store", len(deviceLinks) # this will be asserted to check with the params provided count of links
+        main.step( "Collect and store all Devices Links" )
+        linksResult = main.ONOScli1.links( json_format=False )
+        ansi_escape = re.compile( r'\x1b[^m]*m' )
+        linksResult = ansi_escape.sub( '', linksResult )
+        linksResult = linksResult.replace( " links", "" ).replace( "\r\r", "" )
+        linksResult = linksResult.splitlines()
+        linksResult = linksResult[ 1: ]
+        deviceLinks = copy.copy( linksResult )
+        print "Device Links Stored: \n", str( deviceLinks )
+        # this will be asserted to check with the params provided count of
+        # links
+        print "Length of Links Store", len( deviceLinks )
 
-        main.step("Collect and store each Device ports enabled Count")
-        for i in range(1,26):
-            portResult = main.ONOScli1.getDevicePortsEnabledCount("of:00000000000000"+format(i, '02x'))
-            portTemp = re.split(r'\t+', portResult)
-            portCount = portTemp[1].replace("\r\r\n\x1b[32m","")
-            devicePortsEnabledCount.append(portCount)
-        print "Device Enabled Port Counts Stored: \n", str(devicePortsEnabledCount)
+        main.step( "Collect and store each Device ports enabled Count" )
+        for i in range( 1, 26 ):
+            portResult = main.ONOScli1.getDevicePortsEnabledCount(
+                "of:00000000000000" +
+                format(
+                    i,
+                    '02x' ) )
+            portTemp = re.split( r'\t+', portResult )
+            portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+            devicePortsEnabledCount.append( portCount )
+        print "Device Enabled Port Counts Stored: \n", str( devicePortsEnabledCount )
 
-        main.step("Collect and store each Device active links Count")
-        for i in range(1,26):
-            linkCountResult = main.ONOScli1.getDeviceLinksActiveCount("of:00000000000000"+format(i, '02x'))
-            linkCountTemp = re.split(r'\t+', linkCountResult)
-            linkCount = linkCountTemp[1].replace("\r\r\n\x1b[32m","")
-            deviceActiveLinksCount.append(linkCount)
-        print "Device Active Links Count Stored: \n", str(deviceActiveLinksCount)
+        main.step( "Collect and store each Device active links Count" )
+        for i in range( 1, 26 ):
+            linkCountResult = main.ONOScli1.getDeviceLinksActiveCount(
+                "of:00000000000000" +
+                format(
+                    i,
+                    '02x' ) )
+            linkCountTemp = re.split( r'\t+', linkCountResult )
+            linkCount = linkCountTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+            deviceActiveLinksCount.append( linkCount )
+        print "Device Active Links Count Stored: \n", str( deviceActiveLinksCount )
 
-        caseResult = main.TRUE  # just returning TRUE for now as this one just collects data
-        utilities.assert_equals(expect=main.TRUE, actual=case1Result,
-                onpass="Saving ONOS topology data test PASS",
-                onfail="Saving ONOS topology data test FAIL")
+        # just returning TRUE for now as this one just collects data
+        caseResult = main.TRUE
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Saving ONOS topology data test PASS",
+                                 onfail="Saving ONOS topology data test FAIL" )
 
-    def CASE4(self,main) :
-        ''' 
-        Enable onos-app-fwd, Verify Reactive forwarding through ping all and Disable it 
-        '''
+    def CASE4( self, main ):
+        """
+        Enable onos-app-fwd, Verify Reactive forwarding through ping all and Disable it
+        """
         import re
         import copy
         import time
-        numCtrls = main.params['CTRL']['numCtrl']
-        main.log.report("Enable Reactive forwarding and Verify ping all")
-        main.log.report("______________________________________________")        
-        main.case ("Enable Reactive forwarding and Verify ping all")
-        main.step("Enable Reactive forwarding")
+        numCtrls = main.params[ 'CTRL' ][ 'numCtrl' ]
+        main.log.report( "Enable Reactive forwarding and Verify ping all" )
+        main.log.report( "______________________________________________" )
+        main.case( "Enable Reactive forwarding and Verify ping all" )
+        main.step( "Enable Reactive forwarding" )
         installResult = main.TRUE
-        for i in range(1,int(numCtrls)+1):
+        for i in range( 1, int( numCtrls ) + 1 ):
             onosFeature = 'onos-app-fwd'
-            ONOS_ip = main.params['CTRL']['ip'+str(i)]
-            ONOScli = 'ONOScli'+str(i)
-            main.log.info("Enabling Reactive mode on ONOS Node "+ONOS_ip)
-            exec "inResult=main."+ONOScli+".feature_install(onosFeature)"
-            time.sleep(3)
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            ONOScli = 'ONOScli' + str( i )
+            main.log.info( "Enabling Reactive mode on ONOS Node " + ONOS_ip )
+            exec "inResult=main." + ONOScli + ".feature_install(onosFeature)"
+            time.sleep( 3 )
             installResult = inResult and installResult
 
-        time.sleep(5)
+        time.sleep( 5 )
 
-        main.step("Verify Pingall")
+        main.step( "Verify Pingall" )
         ping_result = main.FALSE
         time1 = time.time()
         ping_result = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
 
         if ping_result == main.TRUE:
-            main.log.report("Pingall Test in Reactive mode successful")
+            main.log.report( "Pingall Test in Reactive mode successful" )
         else:
-            main.log.report("Pingall Test in Reactive mode failed")
+            main.log.report( "Pingall Test in Reactive mode failed" )
 
-        main.step("Disable Reactive forwarding")
+        main.step( "Disable Reactive forwarding" )
         uninstallResult = main.TRUE
-        for i in range(1,int(numCtrls)+1):
+        for i in range( 1, int( numCtrls ) + 1 ):
             onosFeature = 'onos-app-fwd'
-            ONOS_ip = main.params['CTRL']['ip'+str(i)]
-            ONOScli = 'ONOScli'+str(i)
-            main.log.info("Disabling Reactive mode on ONOS Node "+ONOS_ip)
-            exec "unResult=main."+ONOScli+".feature_uninstall(onosFeature)"
+            ONOS_ip = main.params[ 'CTRL' ][ 'ip' + str( i ) ]
+            ONOScli = 'ONOScli' + str( i )
+            main.log.info( "Disabling Reactive mode on ONOS Node " + ONOS_ip )
+            exec "unResult=main." + ONOScli + ".feature_uninstall(onosFeature)"
             uninstallResult = unResult and uninstallResult
 
-        #Waiting for reative flows to be cleared.
-        time.sleep(10)
+        # Waiting for reative flows to be cleared.
+        time.sleep( 10 )
 
         case3Result = installResult and ping_result and uninstallResult
-        utilities.assert_equals(expect=main.TRUE, actual=case3Result,
-                onpass="Reactive Mode Pingall test PASS",
-                onfail="Reactive Mode Pingall test FAIL")
+        utilities.assert_equals( expect=main.TRUE, actual=case3Result,
+                                 onpass="Reactive Mode Pingall test PASS",
+                                 onfail="Reactive Mode Pingall test FAIL" )
 
-    def CASE5(self,main) :
-        '''
+    def CASE5( self, main ):
+        """
         Compare current ONOS topology with reference data
-        '''  
+        """
         import re
         devicesDPID_tmp = []
         hostMACs_tmp = []
@@ -318,378 +355,529 @@
         deviceActiveLinksCount_tmp = []
         devicePortsEnabledCount_tmp = []
 
-        main.log.report("Compare ONOS topology with reference data in Stores")
-        main.log.report("__________________________________________________")        
-        main.case ("Compare ONOS topology with reference data")
-	     
-        main.step("Compare current Device ports enabled with reference")
-        for i in range(1,26):
-            portResult = main.ONOScli1.getDevicePortsEnabledCount("of:00000000000000"+format(i, '02x'))
-            portTemp = re.split(r'\t+', portResult)
-            portCount = portTemp[1].replace("\r\r\n\x1b[32m","")
-            devicePortsEnabledCount_tmp.append(portCount)
-            time.sleep(2)
-        print ("Device Enabled ports EXPECTED: \n"+ str(devicePortsEnabledCount))
-        print ("Device Enabled ports ACTUAL: \n"+ str(devicePortsEnabledCount_tmp))
-        if (cmp(devicePortsEnabledCount,devicePortsEnabledCount_tmp)==0):
+        main.log.report(
+            "Compare ONOS topology with reference data in Stores" )
+        main.log.report( "__________________________________________________" )
+        main.case( "Compare ONOS topology with reference data" )
+
+        main.step( "Compare current Device ports enabled with reference" )
+        for i in range( 1, 26 ):
+            portResult = main.ONOScli1.getDevicePortsEnabledCount(
+                "of:00000000000000" +
+                format(
+                    i,
+                    '02x' ) )
+            portTemp = re.split( r'\t+', portResult )
+            portCount = portTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+            devicePortsEnabledCount_tmp.append( portCount )
+            time.sleep( 2 )
+        print (
+            "Device Enabled ports EXPECTED: \n" +
+            str( devicePortsEnabledCount ) )
+        print (
+            "Device Enabled ports ACTUAL: \n" +
+            str( devicePortsEnabledCount_tmp ) )
+        if ( cmp( devicePortsEnabledCount,
+                  devicePortsEnabledCount_tmp ) == 0 ):
             stepResult1 = main.TRUE
         else:
             stepResult1 = main.FALSE
 
-        main.step("Compare Device active links with reference")
-        for i in range(1,26):
-            linkResult = main.ONOScli1.getDeviceLinksActiveCount("of:00000000000000"+format(i, '02x'))
-            linkTemp = re.split(r'\t+', linkResult)
-            linkCount = linkTemp[1].replace("\r\r\n\x1b[32m","")
-            deviceActiveLinksCount_tmp.append(linkCount)
-            time.sleep(3)
-        print ("Device Active links EXPECTED: \n"+str(deviceActiveLinksCount))
-        print ("Device Active links ACTUAL: \n"+str(deviceActiveLinksCount_tmp))
-        if (cmp(deviceActiveLinksCount,deviceActiveLinksCount_tmp)==0):
+        main.step( "Compare Device active links with reference" )
+        for i in range( 1, 26 ):
+            linkResult = main.ONOScli1.getDeviceLinksActiveCount(
+                "of:00000000000000" +
+                format(
+                    i,
+                    '02x' ) )
+            linkTemp = re.split( r'\t+', linkResult )
+            linkCount = linkTemp[ 1 ].replace( "\r\r\n\x1b[32m", "" )
+            deviceActiveLinksCount_tmp.append( linkCount )
+            time.sleep( 3 )
+        print (
+            "Device Active links EXPECTED: \n" +
+            str( deviceActiveLinksCount ) )
+        print (
+            "Device Active links ACTUAL: \n" +
+            str( deviceActiveLinksCount_tmp ) )
+        if ( cmp( deviceActiveLinksCount, deviceActiveLinksCount_tmp ) == 0 ):
             stepResult2 = main.TRUE
         else:
             stepResult2 = main.FALSE
 
-        '''
-        place holder for comparing devices, hosts and paths if required. 
+        """
+        place holder for comparing devices, hosts and paths if required.
         Links and ports data would be incorrect with out devices anyways.
-        '''
-
-        caseResult=(stepResult1 and stepResult2)
-        utilities.assert_equals(expect=main.TRUE, actual=case1Result,
-                onpass="Compare Topology test PASS",
-                onfail="Compare Topology test FAIL")
+        """
+        caseResult = ( stepResult1 and stepResult2 )
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                 onpass="Compare Topology test PASS",
+                                 onfail="Compare Topology test FAIL" )
         if caseResult == main.TRUE:
-            main.log.report("Compare Topology test Pass")
+            main.log.report( "Compare Topology test Pass" )
 
-    def CASE6(self):
-        '''
+    def CASE6( self ):
+        """
         Install 300 host intents and verify ping all
-        '''
-        main.log.report("Add 300 host intents and verify pingall")
-        main.log.report("_______________________________________")
+        """
+        main.log.report( "Add 300 host intents and verify pingall" )
+        main.log.report( "_______________________________________" )
         import itertools
-        main.case("Install 300 host intents")
-        main.step("Add host Intents")
-        intentResult=main.TRUE
-        hostCombos = list(itertools.combinations(hostMACs, 2))
-        for i in range(len(hostCombos)):
-            iResult = main.ONOScli1.add_host_intent(hostCombos[i][0],hostCombos[i][1])
-            intentResult=(intentResult and iResult)
+        main.case( "Install 300 host intents" )
+        main.step( "Add host Intents" )
+        intentResult = main.TRUE
+        hostCombos = list( itertools.combinations( hostMACs, 2 ) )
+        for i in range( len( hostCombos ) ):
+            iResult = main.ONOScli1.add_host_intent(
+                hostCombos[ i ][ 0 ],
+                hostCombos[ i ][ 1 ] )
+            intentResult = ( intentResult and iResult )
 
-        main.step("Verify Ping across all hosts")
+        main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
-        utilities.assert_equals(expect=main.TRUE, actual=pingResult,
-                onpass="PING ALL PASS",
-                onfail="PING ALL FAIL")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
 
-        case4Result=(intentResult and pingResult)
-        utilities.assert_equals(expect=main.TRUE, actual=case4Result,
-                onpass="Install 300 Host Intents and Ping All test PASS",
-                onfail="Install 300 Host Intents and Ping All test FAIL")
+        case4Result = ( intentResult and pingResult )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case4Result,
+            onpass="Install 300 Host Intents and Ping All test PASS",
+            onfail="Install 300 Host Intents and Ping All test FAIL" )
 
-    def CASE70(self,main):
-        '''
-        Randomly bring some core links down and verify ping all (Host Intents Scenario)
-        '''
+    def CASE70( self, main ):
+        """
+        Randomly bring some core links down and verify ping all ( Host Intents Scenario )
+        """
         import random
-        ONOS1_ip = main.params['CTRL']['ip1']
-        link1End1 = main.params['CORELINKS']['linkS3a']
-        link1End2 = main.params['CORELINKS']['linkS3b'].split(',')
-        link2End1 = main.params['CORELINKS']['linkS14a']
-        link2End2 = main.params['CORELINKS']['linkS14b'].split(',')
-        link3End1 = main.params['CORELINKS']['linkS18a']
-        link3End2 = main.params['CORELINKS']['linkS18b'].split(',')
-        switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
+        link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
+        link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
+        link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' )
+        link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
+        link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' )
+        switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.log.report("Host intents - Randomly bring some core links down and verify ping all")
-        main.log.report("_________________________________________________________________")        
-        main.case("Host intents - Randomly bring some core links down and verify ping all")
-        main.step("Verify number of Switch links to toggle on each Core Switch are between 1 - 5")
-        if (int(switchLinksToToggle) == 0 or int(switchLinksToToggle) > 5):
-            main.log.info("Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5")
+        main.log.report(
+            "Host intents - Randomly bring some core links down and verify ping all" )
+        main.log.report(
+            "_________________________________________________________________" )
+        main.case(
+            "Host intents - Randomly bring some core links down and verify ping all" )
+        main.step(
+            "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
+        if ( int( switchLinksToToggle ) ==
+             0 or int( switchLinksToToggle ) > 5 ):
+            main.log.info(
+                "Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
             main.cleanup()
             main.exit()
         else:
-            main.log.info("User provided Core switch links range to toggle is correct, proceeding to run the test")
+            main.log.info(
+                "User provided Core switch links range to toggle is correct, proceeding to run the test" )
 
-        main.step("Cut links on Core devices using user provided range")
-        randomLink1 = random.sample(link1End2,int(switchLinksToToggle))
-        randomLink2 = random.sample(link2End2,int(switchLinksToToggle))
-        randomLink3 = random.sample(link3End2,int(switchLinksToToggle))
-        for i in range(int(switchLinksToToggle)):
-            main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="down")
-            main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="down")
-            main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="down")
-        time.sleep(link_sleep)
+        main.step( "Cut links on Core devices using user provided range" )
+        randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
+        randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
+        randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
+        for i in range( int( switchLinksToToggle ) ):
+            main.Mininet1.link(
+                END1=link1End1,
+                END2=randomLink1[ i ],
+                OPTION="down" )
+            main.Mininet1.link(
+                END1=link2End1,
+                END2=randomLink2[ i ],
+                OPTION="down" )
+            main.Mininet1.link(
+                END1=link3End1,
+                END2=randomLink3[ i ],
+                OPTION="down" )
+        time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkDown = main.ONOSbench.check_status(topology_output,numSwitches,str(int(numLinks)-int(switchLinksToToggle)*6))
-        utilities.assert_equals(expect=main.TRUE,actual=linkDown,
-                onpass="Link Down discovered properly",
-                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+        linkDown = main.ONOSbench.check_status(
+            topology_output, numSwitches, str(
+                int( numLinks ) - int( switchLinksToToggle ) * 6 ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
 
-        main.step("Verify Ping across all hosts")
+        main.step( "Verify Ping across all hosts" )
         pingResultLinkDown = main.FALSE
         time1 = time.time()
         pingResultLinkDown = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
-        utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkDown,
-                onpass="PING ALL PASS",
-                onfail="PING ALL FAIL")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
 
         caseResult7 = linkDown and pingResultLinkDown
-        utilities.assert_equals(expect=main.TRUE, actual=caseResult7,
-                onpass="Random Link cut Test PASS",
-                onfail="Random Link cut Test FAIL")
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
+                                 onpass="Random Link cut Test PASS",
+                                 onfail="Random Link cut Test FAIL" )
 
-    def CASE80(self,main):
-        '''
-        Bring the core links up that are down and verify ping all (Host Intents Scenario)
-        '''
+    def CASE80( self, main ):
+        """
+        Bring the core links up that are down and verify ping all ( Host Intents Scenario )
+        """
         import random
-        ONOS1_ip = main.params['CTRL']['ip1']
-        link1End1 = main.params['CORELINKS']['linkS3a']
-        link2End1 = main.params['CORELINKS']['linkS14a']
-        link3End1 = main.params['CORELINKS']['linkS18a']
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
-        switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
+        link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
+        link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+        switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
 
-        main.log.report("Host intents - Bring the core links up that are down and verify ping all")
-        main.log.report("__________________________________________________________________")        
-        main.case("Host intents - Bring the core links up that are down and verify ping all")
-        main.step("Bring randomly cut links on Core devices up")
-        for i in range(int(switchLinksToToggle)): 
-            main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="up")
-            main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="up")
-            main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="up")
-        time.sleep(link_sleep)
+        main.log.report(
+            "Host intents - Bring the core links up that are down and verify ping all" )
+        main.log.report(
+            "__________________________________________________________________" )
+        main.case(
+            "Host intents - Bring the core links up that are down and verify ping all" )
+        main.step( "Bring randomly cut links on Core devices up" )
+        for i in range( int( switchLinksToToggle ) ):
+            main.Mininet1.link(
+                END1=link1End1,
+                END2=randomLink1[ i ],
+                OPTION="up" )
+            main.Mininet1.link(
+                END1=link2End1,
+                END2=randomLink2[ i ],
+                OPTION="up" )
+            main.Mininet1.link(
+                END1=link3End1,
+                END2=randomLink3[ i ],
+                OPTION="up" )
+        time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkUp = main.ONOSbench.check_status(topology_output,numSwitches,str(numLinks))
-        utilities.assert_equals(expect=main.TRUE,actual=linkUp,
-                onpass="Link up discovered properly",
-                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+        linkUp = main.ONOSbench.check_status(
+            topology_output,
+            numSwitches,
+            str( numLinks ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
 
-        main.step("Verify Ping across all hosts")
+        main.step( "Verify Ping across all hosts" )
         pingResultLinkUp = main.FALSE
         time1 = time.time()
         pingResultLinkUp = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
-        utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkUp,
-                onpass="PING ALL PASS",
-                onfail="PING ALL FAIL")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
 
         caseResult8 = linkUp and pingResultLinkUp
-        utilities.assert_equals(expect=main.TRUE, actual=caseResult8,
-                onpass="Link Up Test PASS",
-                onfail="Link Up Test FAIL")    
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult8,
+                                 onpass="Link Up Test PASS",
+                                 onfail="Link Up Test FAIL" )
 
-    def CASE71(self,main):
-        '''
-        Randomly bring some core links down and verify ping all (Point Intents Scenario)
-        '''
+    def CASE71( self, main ):
+        """
+        Randomly bring some core links down and verify ping all ( Point Intents Scenario )
+        """
         import random
-        ONOS1_ip = main.params['CTRL']['ip1']
-        link1End1 = main.params['CORELINKS']['linkS3a']
-        link1End2 = main.params['CORELINKS']['linkS3b'].split(',')
-        link2End1 = main.params['CORELINKS']['linkS14a']
-        link2End2 = main.params['CORELINKS']['linkS14b'].split(',')
-        link3End1 = main.params['CORELINKS']['linkS18a']
-        link3End2 = main.params['CORELINKS']['linkS18b'].split(',')
-        switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
+        link1End2 = main.params[ 'CORELINKS' ][ 'linkS3b' ].split( ',' )
+        link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
+        link2End2 = main.params[ 'CORELINKS' ][ 'linkS14b' ].split( ',' )
+        link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
+        link3End2 = main.params[ 'CORELINKS' ][ 'linkS18b' ].split( ',' )
+        switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.log.report("Point Intents - Randomly bring some core links down and verify ping all")
-        main.log.report("__________________________________________________________________")        
-        main.case("Point Intents - Randomly bring some core links down and verify ping all")
-        main.step("Verify number of Switch links to toggle on each Core Switch are between 1 - 5")
-        if (int(switchLinksToToggle) == 0 or int(switchLinksToToggle) > 5):
-            main.log.info("Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5")
+        main.log.report(
+            "Point Intents - Randomly bring some core links down and verify ping all" )
+        main.log.report(
+            "__________________________________________________________________" )
+        main.case(
+            "Point Intents - Randomly bring some core links down and verify ping all" )
+        main.step(
+            "Verify number of Switch links to toggle on each Core Switch are between 1 - 5" )
+        if ( int( switchLinksToToggle ) ==
+             0 or int( switchLinksToToggle ) > 5 ):
+            main.log.info(
+                "Please check you PARAMS file. Valid range for number of switch links to toggle is between 1 to 5" )
             main.cleanup()
             main.exit()
         else:
-            main.log.info("User provided Core switch links range to toggle is correct, proceeding to run the test")
+            main.log.info(
+                "User provided Core switch links range to toggle is correct, proceeding to run the test" )
 
-        main.step("Cut links on Core devices using user provided range")
-        randomLink1 = random.sample(link1End2,int(switchLinksToToggle))
-        randomLink2 = random.sample(link2End2,int(switchLinksToToggle))
-        randomLink3 = random.sample(link3End2,int(switchLinksToToggle))
-        for i in range(int(switchLinksToToggle)):
-            main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="down")
-            main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="down")
-            main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="down")
-        time.sleep(link_sleep)
+        main.step( "Cut links on Core devices using user provided range" )
+        randomLink1 = random.sample( link1End2, int( switchLinksToToggle ) )
+        randomLink2 = random.sample( link2End2, int( switchLinksToToggle ) )
+        randomLink3 = random.sample( link3End2, int( switchLinksToToggle ) )
+        for i in range( int( switchLinksToToggle ) ):
+            main.Mininet1.link(
+                END1=link1End1,
+                END2=randomLink1[ i ],
+                OPTION="down" )
+            main.Mininet1.link(
+                END1=link2End1,
+                END2=randomLink2[ i ],
+                OPTION="down" )
+            main.Mininet1.link(
+                END1=link3End1,
+                END2=randomLink3[ i ],
+                OPTION="down" )
+        time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkDown = main.ONOSbench.check_status(topology_output,numSwitches,str(int(numLinks)-int(switchLinksToToggle)*6))
-        utilities.assert_equals(expect=main.TRUE,actual=linkDown,
-                onpass="Link Down discovered properly",
-                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
+        linkDown = main.ONOSbench.check_status(
+            topology_output, numSwitches, str(
+                int( numLinks ) - int( switchLinksToToggle ) * 6 ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkDown,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
 
-        main.step("Verify Ping across all hosts")
+        main.step( "Verify Ping across all hosts" )
         pingResultLinkDown = main.FALSE
         time1 = time.time()
         pingResultLinkDown = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
-        utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkDown,
-                onpass="PING ALL PASS",
-                onfail="PING ALL FAIL")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
 
         caseResult7 = linkDown and pingResultLinkDown
-        utilities.assert_equals(expect=main.TRUE, actual=caseResult7,
-                onpass="Random Link cut Test PASS",
-                onfail="Random Link cut Test FAIL")
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
+                                 onpass="Random Link cut Test PASS",
+                                 onfail="Random Link cut Test FAIL" )
 
-    def CASE81(self,main):
-        '''
-        Bring the core links up that are down and verify ping all (Point Intents Scenario)
-        '''
+    def CASE81( self, main ):
+        """
+        Bring the core links up that are down and verify ping all ( Point Intents Scenario )
+        """
         import random
-        ONOS1_ip = main.params['CTRL']['ip1']
-        link1End1 = main.params['CORELINKS']['linkS3a']
-        link2End1 = main.params['CORELINKS']['linkS14a']
-        link3End1 = main.params['CORELINKS']['linkS18a']
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
-        switchLinksToToggle = main.params['CORELINKS']['toggleLinks']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        link1End1 = main.params[ 'CORELINKS' ][ 'linkS3a' ]
+        link2End1 = main.params[ 'CORELINKS' ][ 'linkS14a' ]
+        link3End1 = main.params[ 'CORELINKS' ][ 'linkS18a' ]
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
+        switchLinksToToggle = main.params[ 'CORELINKS' ][ 'toggleLinks' ]
 
-        main.log.report("Point intents - Bring the core links up that are down and verify ping all")
-        main.log.report("___________________________________________________________________")        
-        main.case("Point intents - Bring the core links up that are down and verify ping all")
-        main.step("Bring randomly cut links on Core devices up")
-        for i in range(int(switchLinksToToggle)): 
-            main.Mininet1.link(END1=link1End1,END2=randomLink1[i],OPTION="up")
-            main.Mininet1.link(END1=link2End1,END2=randomLink2[i],OPTION="up")
-            main.Mininet1.link(END1=link3End1,END2=randomLink3[i],OPTION="up")
-        time.sleep(link_sleep)
+        main.log.report(
+            "Point intents - Bring the core links up that are down and verify ping all" )
+        main.log.report(
+            "___________________________________________________________________" )
+        main.case(
+            "Point intents - Bring the core links up that are down and verify ping all" )
+        main.step( "Bring randomly cut links on Core devices up" )
+        for i in range( int( switchLinksToToggle ) ):
+            main.Mininet1.link(
+                END1=link1End1,
+                END2=randomLink1[ i ],
+                OPTION="up" )
+            main.Mininet1.link(
+                END1=link2End1,
+                END2=randomLink2[ i ],
+                OPTION="up" )
+            main.Mininet1.link(
+                END1=link3End1,
+                END2=randomLink3[ i ],
+                OPTION="up" )
+        time.sleep( link_sleep )
 
         topology_output = main.ONOScli2.topology()
-        linkUp = main.ONOSbench.check_status(topology_output,numSwitches,str(numLinks))
-        utilities.assert_equals(expect=main.TRUE,actual=linkUp,
-                onpass="Link up discovered properly",
-                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
+        linkUp = main.ONOSbench.check_status(
+            topology_output,
+            numSwitches,
+            str( numLinks ) )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=linkUp,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
 
-        main.step("Verify Ping across all hosts")
+        main.step( "Verify Ping across all hosts" )
         pingResultLinkUp = main.FALSE
         time1 = time.time()
         pingResultLinkUp = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
-        utilities.assert_equals(expect=main.TRUE, actual=pingResultLinkUp,
-                onpass="PING ALL PASS",
-                onfail="PING ALL FAIL")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
 
         caseResult8 = linkUp and pingResultLinkUp
-        utilities.assert_equals(expect=main.TRUE, actual=caseResult8,
-                onpass="Link Up Test PASS",
-                onfail="Link Up Test FAIL")
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult8,
+                                 onpass="Link Up Test PASS",
+                                 onfail="Link Up Test FAIL" )
 
-    def CASE9(self):
-        '''
+    def CASE9( self ):
+        """
         Install 114 point intents and verify Ping all works
-        '''
+        """
         import copy
-        main.log.report("Install 114 point intents and verify Ping all")
-        main.log.report("___________________________________________")        
-        main.case("Install 114 point intents and Ping all")
-        deviceLinks_copy = copy.copy(deviceLinks)
-        main.step("Install 114 point intents")
-        for i in range(len(deviceLinks_copy)):
-            pointLink = str(deviceLinks_copy[i]).replace("src=","").replace("dst=","").split(',')
-            point1 = pointLink[0].split('/')
-            point2 = pointLink[1].split('/')
-            installResult = main.ONOScli1.add_point_intent(point1[0],point2[0],int(point1[1]),int(point2[1]))
+        main.log.report( "Install 114 point intents and verify Ping all" )
+        main.log.report( "___________________________________________" )
+        main.case( "Install 114 point intents and Ping all" )
+        deviceLinks_copy = copy.copy( deviceLinks )
+        main.step( "Install 114 point intents" )
+        for i in range( len( deviceLinks_copy ) ):
+            pointLink = str(
+                deviceLinks_copy[ i ] ).replace(
+                "src=",
+                "" ).replace(
+                "dst=",
+                "" ).split( ',' )
+            point1 = pointLink[ 0 ].split( '/' )
+            point2 = pointLink[ 1 ].split( '/' )
+            installResult = main.ONOScli1.add_point_intent(
+                point1[ 0 ], point2[ 0 ], int(
+                    point1[ 1 ] ), int(
+                    point2[ 1 ] ) )
             if installResult == main.TRUE:
-                print "Installed Point intent between :",point1[0], int(point1[1]), point2[0], int(point2[1])
+                print "Installed Point intent between :", point1[ 0 ], int( point1[ 1 ] ), point2[ 0 ], int( point2[ 1 ] )
 
-        main.step("Obtain the intent id's")
+        main.step( "Obtain the intent id's" )
         intentsList = main.ONOScli1.getAllIntentIds()
-        ansi_escape = re.compile(r'\x1b[^m]*m')
-        intentsList = ansi_escape.sub('', intentsList)
-        intentsList = intentsList.replace(" onos:intents | grep id=","").replace("id=","").replace("\r\r","")
-        intentsList=intentsList.splitlines()
-        intentsList = intentsList[1:]
+        ansi_escape = re.compile( r'\x1b[^m]*m' )
+        intentsList = ansi_escape.sub( '', intentsList )
+        intentsList = intentsList.replace(
+            " onos:intents | grep id=",
+            "" ).replace(
+            "id=",
+            "" ).replace(
+            "\r\r",
+             "" )
+        intentsList = intentsList.splitlines()
+        intentsList = intentsList[ 1: ]
         intentIdList = []
-        for i in range(len(intentsList)):
-            intentsTemp = intentsList[i].split(',')
-            intentIdList.append(intentsTemp[0])
+        for i in range( len( intentsList ) ):
+            intentsTemp = intentsList[ i ].split( ',' )
+            intentIdList.append( intentsTemp[ 0 ] )
         print "Intent IDs: ", intentIdList
-        print "Total Intents installed: ", len(intentIdList)
+        print "Total Intents installed: ", len( intentIdList )
 
-        main.step("Verify Ping across all hosts")
+        main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
         pingResult = main.Mininet1.pingall()
         time2 = time.time()
-        timeDiff = round((time2-time1),2)
-        main.log.report("Time taken for Ping All: "+str(timeDiff)+" seconds")
-        utilities.assert_equals(expect=main.TRUE, actual=pingResult,
-                onpass="PING ALL PASS",
-                onfail="PING ALL FAIL")
+        timeDiff = round( ( time2 - time1 ), 2 )
+        main.log.report(
+            "Time taken for Ping All: " +
+            str( timeDiff ) +
+            " seconds" )
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
+                                 onpass="PING ALL PASS",
+                                 onfail="PING ALL FAIL" )
 
         case8_result = installResult and pingResult
-        utilities.assert_equals(expect=main.TRUE, actual=case8_result,
-                onpass="Ping all test after Point intents addition successful",
-                onfail="Ping all test after Point intents addition failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case8_result,
+            onpass="Ping all test after Point intents addition successful",
+            onfail="Ping all test after Point intents addition failed" )
 
-    def CASE10(self):
-        '''
+    def CASE10( self ):
+        """
          Remove all Intents
-        ''' 
-        main.log.report("Remove all intents that were installed previously")
-        main.log.report("______________________________________________")        
-        main.log.info("Remove all intents")
-        main.case("Removing intents")
-        main.step("Obtain the intent id's first")
+        """
+        main.log.report( "Remove all intents that were installed previously" )
+        main.log.report( "______________________________________________" )
+        main.log.info( "Remove all intents" )
+        main.case( "Removing intents" )
+        main.step( "Obtain the intent id's first" )
         intentsList = main.ONOScli1.getAllIntentIds()
-        ansi_escape = re.compile(r'\x1b[^m]*m')
-        intentsList = ansi_escape.sub('', intentsList)
-        intentsList = intentsList.replace(" onos:intents | grep id=","").replace("id=","").replace("\r\r","")
-        intentsList=intentsList.splitlines()
-        intentsList = intentsList[1:]
+        ansi_escape = re.compile( r'\x1b[^m]*m' )
+        intentsList = ansi_escape.sub( '', intentsList )
+        intentsList = intentsList.replace(
+            " onos:intents | grep id=",
+            "" ).replace(
+            "id=",
+            "" ).replace(
+            "\r\r",
+             "" )
+        intentsList = intentsList.splitlines()
+        intentsList = intentsList[ 1: ]
         intentIdList = []
         step1Result = main.TRUE
-        if (len(intentsList) > 1):
-            for i in range(len(intentsList)):
-                intentsTemp = intentsList[i].split(',')
-                intentIdList.append(intentsTemp[0])
+        if ( len( intentsList ) > 1 ):
+            for i in range( len( intentsList ) ):
+                intentsTemp = intentsList[ i ].split( ',' )
+                intentIdList.append( intentsTemp[ 0 ] )
             print "Intent IDs: ", intentIdList
-            for id in range(len(intentIdList)):
-                print "Removing intent id (round 1) :", intentIdList[id]
-                main.ONOScli1.remove_intent(intent_id = intentIdList[id])
-                time.sleep(1)
+            for id in range( len( intentIdList ) ):
+                print "Removing intent id (round 1) :", intentIdList[ id ]
+                main.ONOScli1.remove_intent( intent_id=intentIdList[ id ] )
+                time.sleep( 1 )
 
-            main.log.info("Verify all intents are removed and if any leftovers try remove one more time")
+            main.log.info(
+                "Verify all intents are removed and if any leftovers try remove one more time" )
             intentsList1 = main.ONOScli1.getAllIntentIds()
-            ansi_escape = re.compile(r'\x1b[^m]*m')
-            intentsList1 = ansi_escape.sub('', intentsList1)
-            intentsList1 = intentsList1.replace(" onos:intents | grep id=","").replace(" state=","").replace("\r\r","")
-            intentsList1=intentsList1.splitlines()
-            intentsList1 = intentsList1[1:]
+            ansi_escape = re.compile( r'\x1b[^m]*m' )
+            intentsList1 = ansi_escape.sub( '', intentsList1 )
+            intentsList1 = intentsList1.replace(
+                " onos:intents | grep id=",
+                "" ).replace(
+                " state=",
+                "" ).replace(
+                "\r\r",
+                "" )
+            intentsList1 = intentsList1.splitlines()
+            intentsList1 = intentsList1[ 1: ]
             print "Round 2 (leftover) intents to remove: ", intentsList1
             intentIdList1 = []
-            if (len(intentsList1) > 1):
-                for i in range(len(intentsList1)):
-                    intentsTemp1 = intentsList[i].split(',')
-                    intentIdList1.append(intentsTemp1[0])
+            if ( len( intentsList1 ) > 1 ):
+                for i in range( len( intentsList1 ) ):
+                    intentsTemp1 = intentsList[ i ].split( ',' )
+                    intentIdList1.append( intentsTemp1[ 0 ] )
                 print "Leftover Intent IDs: ", intentIdList1
-                for id in range(len(intentIdList1)):
-                    print "Removing intent id (round 2):", intentIdList1[id]
-                    main.ONOScli1.remove_intent(intent_id = intentIdList1[id])
-                    time.sleep(2)
+                for id in range( len( intentIdList1 ) ):
+                    print "Removing intent id (round 2):", intentIdList1[ id ]
+                    main.ONOScli1.remove_intent(
+                        intent_id=intentIdList1[ id ] )
+                    time.sleep( 2 )
             else:
                 print "There are no more intents that need to be removed"
                 step1Result = main.TRUE
@@ -698,6 +886,6 @@
             step1Result = main.FALSE
 
         caseResult7 = step1Result
-        utilities.assert_equals(expect=main.TRUE, actual=caseResult7,
-                onpass="Intent removal test successful",
-                onfail="Intent removal test failed")
\ No newline at end of file
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult7,
+                                 onpass="Intent removal test successful",
+                                 onfail="Intent removal test failed" )
diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
old mode 100755
new mode 100644
index a9a9bb6..62d1ec8
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -1,6 +1,6 @@
 
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
 
 import time
 import sys
@@ -8,13 +8,16 @@
 import re
 import json
 
-time.sleep(1)
+time.sleep( 1 )
+
+
 class ProdFunc:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
-        '''
+    def CASE1( self, main ):
+        """
         Startup sequence:
         cell <name>
         onos-verify-cell
@@ -24,1077 +27,1312 @@
         onos-package
         onos-install -f
         onos-wait-for-start
-        '''
-        
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.case("Setting up test environment")
-        main.log.report("This testcase is testing setting up test environment")
-        main.log.report("__________________________________") 
+        """
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
 
-        main.step("Applying cell variable to environment")
-        cell_result = main.ONOSbench.set_cell(cell_name)
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cell_result = main.ONOSbench.set_cell( cell_name )
         verify_result = main.ONOSbench.verify_cell()
-        
-        main.step("Removing raft logs before a clen installation of ONOS")
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
         main.ONOSbench.onos_remove_raft_logs()
 
-        main.step("Git checkout and pull master and get version")
-        main.ONOSbench.git_checkout("master")
+        main.step( "Git checkout and pull master and get version" )
+        main.ONOSbench.git_checkout( "master" )
         git_pull_result = main.ONOSbench.git_pull()
-        main.log.info("git_pull_result = " +git_pull_result)
-        version_result = main.ONOSbench.get_version(report=True)
-    
+        main.log.info( "git_pull_result = " + git_pull_result )
+        version_result = main.ONOSbench.get_version( report=True )
+
         if git_pull_result == 1:
-            main.step("Using mvn clean & install")
+            main.step( "Using mvn clean & install" )
             clean_install_result = main.ONOSbench.clean_install()
             #clean_install_result = main.TRUE
         elif git_pull_result == 0:
-            main.log.report("Git Pull Failed, look into logs for detailed reason")
+            main.log.report(
+                "Git Pull Failed, look into logs for detailed reason" )
             main.cleanup()
-            main.exit() 
-         
-        main.step("Creating ONOS package")
+            main.exit()
+
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-
-        main.step("Installing ONOS package")
+        main.step( "Installing ONOS package" )
         onos_install_result = main.ONOSbench.onos_install()
         if onos_install_result == main.TRUE:
-            main.log.report("Installing ONOS package successful")
+            main.log.report( "Installing ONOS package successful" )
         else:
-            main.log.report("Installing ONOS package failed")
+            main.log.report( "Installing ONOS package failed" )
 
         onos1_isup = main.ONOSbench.isup()
         if onos1_isup == main.TRUE:
-            main.log.report("ONOS instance is up and ready")  
+            main.log.report( "ONOS instance is up and ready" )
         else:
-            main.log.report("ONOS instance may not be up")  
-       
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-        
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])        
+            main.log.report( "ONOS instance may not be up" )
 
-        case1_result = (package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
+        main.step( "Starting ONOS service" )
+        start_result = main.ONOSbench.onos_start( ONOS1_ip )
 
-    def CASE2(self, main) :
-        '''  
+        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
+
+        case1_result = ( package_result and
+                         cell_result and verify_result and onos_install_result and
+                         onos1_isup and start_result )
+        utilities.assert_equals( expect=main.TRUE, actual=case1_result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+    def CASE2( self, main ):
+        """
         Switch Down
-        '''
-        #NOTE: You should probably run a topology check after this
-        import time 
+        """
+        # NOTE: You should probably run a topology check after this
+        import time
         import json
- 
-        main.case("Switch down discovery")
-        main.log.report("This testcase is testing a switch down discovery")
-        main.log.report("__________________________________")
 
-        switch_sleep = int(main.params['timers']['SwitchDiscovery'])
+        main.case( "Switch down discovery" )
+        main.log.report( "This testcase is testing a switch down discovery" )
+        main.log.report( "__________________________________" )
+
+        switch_sleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
 
         description = "Killing a switch to ensure it is discovered correctly"
-        main.log.report(description)
-        main.case(description)
+        main.log.report( description )
+        main.case( description )
 
-        #TODO: Make this switch parameterizable
-        main.step("Kill s28 ")
-        main.log.report("Deleting s28")
-        #FIXME: use new dynamic topo functions
-        main.Mininet1.del_switch("s28")
-        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
-        time.sleep(switch_sleep)
-        #Peek at the deleted switch
-        device = main.ONOS2.get_device(dpid="0028")
+        # TODO: Make this switch parameterizable
+        main.step( "Kill s28 " )
+        main.log.report( "Deleting s28" )
+        # FIXME: use new dynamic topo functions
+        main.Mininet1.del_switch( "s28" )
+        main.log.info(
+            "Waiting " +
+            str( switch_sleep ) +
+            " seconds for switch down to be discovered" )
+        time.sleep( switch_sleep )
+        # Peek at the deleted switch
+        device = main.ONOS2.get_device( dpid="0028" )
         print "device = ", device
-        if device[u'available'] == 'False':
+        if device[ u'available' ] == 'False':
             case2_result = main.FALSE
         else:
             case2_result = main.TRUE
-        utilities.assert_equals(expect=main.TRUE, actual=case2_result,
-                onpass="Switch down discovery successful",
-                onfail="Switch down discovery failed")
+        utilities.assert_equals( expect=main.TRUE, actual=case2_result,
+                                 onpass="Switch down discovery successful",
+                                 onfail="Switch down discovery failed" )
 
-    def CASE11(self, main):
-        '''
+    def CASE11( self, main ):
+        """
         Cleanup sequence:
         onos-service <node_ip> stop
         onos-uninstall
 
         TODO: Define rest of cleanup
-        
-        '''
 
-        ONOS1_ip = main.params['CTRL']['ip1']
+        """
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.case("Cleaning up test environment")
+        main.case( "Cleaning up test environment" )
 
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+        main.step( "Testing ONOS kill function" )
+        kill_result = main.ONOSbench.onos_kill( ONOS1_ip )
 
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+        main.step( "Stopping ONOS service" )
+        stop_result = main.ONOSbench.onos_stop( ONOS1_ip )
 
-        main.step("Uninstalling ONOS service") 
+        main.step( "Uninstalling ONOS service" )
         uninstall_result = main.ONOSbench.onos_uninstall()
 
-    def CASE3(self, main):
-        '''
+    def CASE3( self, main ):
+        """
         Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
+        """
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.case("Testing 'onos' command")
+        main.case( "Testing 'onos' command" )
 
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
         cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
+        cmd_result1 = main.ONOSbench.onos_cli( ONOS1_ip, cmdstr1 )
+        main.log.info( "onos command returned: " + cmd_result1 )
 
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
         cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
+        cmd_result2 = main.ONOSbench.onos_cli( ONOS1_ip, cmdstr2 )
+        main.log.info( "onos command returned: " + cmd_result2 )
 
-
-    def CASE20(self):
-        '''
+    def CASE20( self ):
+        """
             Exit from mininet cli
             reinstall ONOS
-        '''
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.log.report("This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology")
-        main.log.report("_____________________________________________")
-        main.case("Disconnecting mininet and restarting ONOS")
-        main.step("Disconnecting mininet and restarting ONOS")
+        """
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+
+        main.log.report(
+            "This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
         mininet_disconnect = main.Mininet1.disconnect()
 
-        main.step("Removing raft logs before a clen installation of ONOS")
+        main.step( "Removing raft logs before a clen installation of ONOS" )
         main.ONOSbench.onos_remove_raft_logs()
 
-        main.step("Applying cell variable to environment")
-        cell_result = main.ONOSbench.set_cell(cell_name)
+        main.step( "Applying cell variable to environment" )
+        cell_result = main.ONOSbench.set_cell( cell_name )
         verify_result = main.ONOSbench.verify_cell()
 
         onos_install_result = main.ONOSbench.onos_install()
         if onos_install_result == main.TRUE:
-            main.log.report("Installing ONOS package successful")
+            main.log.report( "Installing ONOS package successful" )
         else:
-            main.log.report("Installing ONOS package failed")
+            main.log.report( "Installing ONOS package failed" )
 
         onos1_isup = main.ONOSbench.isup()
         if onos1_isup == main.TRUE:
-            main.log.report("ONOS instance is up and ready")
+            main.log.report( "ONOS instance is up and ready" )
         else:
-            main.log.report("ONOS instance may not be up")
+            main.log.report( "ONOS instance may not be up" )
 
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-      
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1']) 
+        main.step( "Starting ONOS service" )
+        start_result = main.ONOSbench.onos_start( ONOS1_ip )
+
+        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
         print "mininet_disconnect =", mininet_disconnect
         print "onos_install_result =", onos_install_result
         print "onos1_isup =", onos1_isup
         print "start_result =", start_result
- 
-        case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
-        utilities.assert_equals(expect=main.TRUE, actual=case20_result,
-                onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
-                onfail="Exiting functionality mininet topology and reinstalling ONOS failed") 
 
-    def CASE21(self, main):
+        case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20_result,
+            onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
+            onfail="Exiting functionality mininet topology and reinstalling ONOS failed" )
+
+    def CASE21( self, main ):
         import time
-        '''
+        """
             On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
             which starts the rest and copies the links json file to the onos instance
-            Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt 
+            Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt
             from the json config file
-        ''' 
-        main.log.report("This testcase starts the packet layer topology and REST")
-        main.log.report("_____________________________________________")
-        main.case("Starting LINC-OE and other components")
-        main.step("Starting LINC-OE and other components")
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
         start_console_result = main.LincOE1.start_console()
         optical_mn_script = main.LincOE2.run_optical_mn_script()
-        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
-            
-        print "start_console_result =",start_console_result 
-        print "optical_mn_script = ",optical_mn_script 
-        print "onos_topo_cfg_result =",onos_topo_cfg_result 
+        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(
+            instance_name=main.params[ 'CTRL' ][ 'ip1' ],
+            json_file=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
+
+        print "start_console_result =", start_console_result
+        print "optical_mn_script = ", optical_mn_script
+        print "onos_topo_cfg_result =", onos_topo_cfg_result
 
         case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
-        utilities.assert_equals(expect=main.TRUE, actual=case21_result,
-                onpass="Packet optical topology spawned successsfully",
-                onfail="Packet optical topology spawning failed") 
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21_result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
 
-
-    def CASE22(self, main):
-        '''
+    def CASE22( self, main ):
+        """
             Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
              Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
             and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
-        '''
-
-        main.log.report("This testcase compares the optical+packet topology against what is expected")
-        main.case("Topology comparision")
-        main.step("Topology comparision")
-        main.ONOS3.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        devices_result = main.ONOS3.devices(json_format = False)
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        main.ONOS3.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
+        devices_result = main.ONOS3.devices( json_format=False )
 
         print "devices_result = ", devices_result
-        devices_linewise = devices_result.split("\n")
-        devices_linewise = devices_linewise[1:-1]
+        devices_linewise = devices_result.split( "\n" )
+        devices_linewise = devices_linewise[ 1:-1 ]
         roadmCount = 0
         packetLayerSWCount = 0
         for line in devices_linewise:
-            components = line.split(",")
-            availability = components[1].split("=")[1]
-            type = components[3].split("=")[1]
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
             if availability == 'true' and type == 'ROADM':
                 roadmCount += 1
-            elif availability == 'true' and type =='SWITCH':
+            elif availability == 'true' and type == 'SWITCH':
                 packetLayerSWCount += 1
         if roadmCount == 4:
-            print "Number of Optical Switches = %d and is correctly detected" %roadmCount
-            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
+            print "Number of Optical Switches = %d and is correctly detected" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
             opticalSW_result = main.TRUE
         else:
-            print "Number of Optical Switches = %d and is wrong" %roadCount
-            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
+            print "Number of Optical Switches = %d and is wrong" % roadCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
             opticalSW_result = main.FALSE
 
         if packetLayerSWCount == 2:
-            print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
-            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
+            print "Number of Packet layer or mininet Switches = %d and is correctly detected" % packetLayerSWCount
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
             packetSW_result = main.TRUE
         else:
-            print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
-            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
+            print "Number of Packet layer or mininet Switches = %d and is wrong" % packetLayerSWCount
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
             packetSW_result = main.FALSE
         print "_________________________________"
-        
-        links_result = main.ONOS3.links(json_format = False)
+
+        links_result = main.ONOS3.links( json_format=False )
         print "links_result = ", links_result
         print "_________________________________"
-        
-        #NOTE:Since only point intents are added, there is no requirement to discover the hosts
-                #Therfore, the below portion of the code is commented.
-        '''
+
+        # NOTE:Since only point intents are added, there is no requirement to discover the hosts
+        # Therfore, the below portion of the code is commented.
+        """
         #Discover hosts using pingall
-        pingall_result = main.LincOE2.pingall()    
-    
-        hosts_result = main.ONOS3.hosts(json_format = False)
-        main.log.info("hosts_result = "+hosts_result)   
-        main.log.info("_________________________________")
-        hosts_linewise = hosts_result.split("\n")
-        hosts_linewise = hosts_linewise[1:-1]
+        pingall_result = main.LincOE2.pingall()
+
+        hosts_result = main.ONOS3.hosts( json_format=False )
+        main.log.info( "hosts_result = "+hosts_result )
+        main.log.info( "_________________________________" )
+        hosts_linewise = hosts_result.split( "\n" )
+        hosts_linewise = hosts_linewise[ 1:-1 ]
         hostCount = 0
         for line in hosts_linewise:
-            hostid = line.split(",")[0].split("=")[1]
+            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
             hostCount +=1
         if hostCount ==2:
             print "Number of hosts = %d and is correctly detected" %hostCount
-            main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and is correctly detected" )
             hostDiscovery = main.TRUE
         else:
             print "Number of hosts = %d and is wrong" %hostCount
-            main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and is wrong" )
             hostDiscovery = main.FALSE
-        '''
-
+        """
         case22_result = opticalSW_result and packetSW_result
-        utilities.assert_equals(expect=main.TRUE, actual=case22_result,
-                onpass="Packet optical topology discovery successful",
-                onfail="Packet optical topology discovery failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22_result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
 
-    def CASE23(self, main):
+    def CASE23( self, main ):
         import time
-        '''
-            Add bidirectional point intents between 2 packet layer(mininet) devices and 
+        """
+            Add bidirectional point intents between 2 packet layer( mininet ) devices and
             ping mininet hosts
-        '''
-        main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
-        main.case("Topology comparision")
-        main.step("Adding point intents")
-        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0001/1", "of:0000ffffffff0002/1")
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptp_intent_result = main.ONOS3.add_point_intent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0002/1" )
         if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS3.intents(json_format = False)
-            main.log.info("Point to point intent install successful")
+            get_intent_result = main.ONOS3.intents( json_format=False )
+            main.log.info( "Point to point intent install successful" )
 
-        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0002/1", "of:0000ffffffff0001/1")
+        ptp_intent_result = main.ONOS3.add_point_intent(
+            "of:0000ffffffff0002/1",
+            "of:0000ffffffff0001/1" )
         if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS3.intents(json_format = False)
-            main.log.info("Point to point intent install successful")
+            get_intent_result = main.ONOS3.intents( json_format=False )
+            main.log.info( "Point to point intent install successful" )
 
-        time.sleep(10)
+        time.sleep( 10 )
         flowHandle = main.ONOS3.flows()
-        main.log.info("flows :" + flowHandle)
+        main.log.info( "flows :" + flowHandle )
 
         # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep(30)
-        intentHandle = main.ONOS3.intents(json_format = False)        
-        main.log.info("intents :" + intentHandle)        
- 
+        time.sleep( 30 )
+        intentHandle = main.ONOS3.intents( json_format=False )
+        main.log.info( "intents :" + intentHandle )
+
         Ping_Result = main.TRUE
         count = 1
-        main.log.info("\n\nh1 is Pinging h2")
-        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
         #ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count<5:
-            count+=1
+        if ping == main.FALSE and count < 5:
+            count += 1
             Ping_Result = main.FALSE
-            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
-            time.sleep(2)
-        elif ping==main.FALSE:
-            main.log.info("All ping attempts between h1 and h2 have failed")
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
             Ping_Result = main.FALSE
-        elif ping==main.TRUE:
-            main.log.info("Ping test between h1 and h2 passed!")
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
             Ping_Result = main.TRUE
         else:
-            main.log.info("Unknown error")
+            main.log.info( "Unknown error" )
             Ping_Result = main.ERROR
-        
-        if Ping_Result==main.FALSE:
-            main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
-        if Ping_Result==main.TRUE:
-            main.log.report("Point Intents for packet optical have been installed correctly")
+
+        if Ping_Result == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed correctly. Cleaning up" )
+        if Ping_Result == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been installed correctly" )
 
         case23_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case23_result,
-                onpass="Point intents addition for packet optical and Pingall Test successful",
-                onfail="Point intents addition for packet optical and Pingall Test NOT successful")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23_result,
+            onpass="Point intents addition for packet optical and Pingall Test successful",
+            onfail="Point intents addition for packet optical and Pingall Test NOT successful" )
 
-
-
-    def CASE24(self, main):
+    def CASE24( self, main ):
         import time
         import json
-        '''
-            Test Rerouting of Packet Optical by bringing a port down (port 22) of a switch(switchID=1), so that link (between switch1 port22 - switch4-port30) is inactive
+        """
+            Test Rerouting of Packet Optical by bringing a port down ( port 22 ) of a switch( switchID=1 ), so that link ( between switch1 port22 - switch4-port30 ) is inactive
             and do a ping test. If rerouting is successful, ping should pass. also check the flows
-        '''
-        main.log.report("This testcase tests rerouting and pings mininet hosts")
-        main.case("Test rerouting and pings mininet hosts")
-        main.step("Bring a port down and verify the link state")
-        main.LincOE1.port_down(sw_id="1", pt_id="22") 
-        links_nonjson = main.ONOS3.links(json_format = False)
-        main.log.info("links = " +links_nonjson)
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.port_down( sw_id="1", pt_id="22" )
+        links_nonjson = main.ONOS3.links( json_format=False )
+        main.log.info( "links = " + links_nonjson )
 
         links = main.ONOS3.links()
-        main.log.info("links = " +links)
-        
-        links_result = json.loads(links)
+        main.log.info( "links = " + links )
+
+        links_result = json.loads( links )
         links_state_result = main.FALSE
         for item in links_result:
-            if item['src']['device'] == "of:0000ffffffffff01" and item['src']['port'] == "22":
-                if item['dst']['device'] == "of:0000ffffffffff04" and item['dst']['port'] == "30":
-                    links_state = item['state']
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "22":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
+                        'dst' ][ 'port' ] == "30":
+                    links_state = item[ 'state' ]
                     if links_state == "INACTIVE":
-                        main.log.info("Links state is inactive as expected due to one of the ports being down")
-                        main.log.report("Links state is inactive as expected due to one of the ports being down")
+                        main.log.info(
+                            "Links state is inactive as expected due to one of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one of the ports being down" )
                         links_state_result = main.TRUE
                         break
                     else:
-                        main.log.info("Links state is not inactive as expected")
-                        main.log.report("Links state is not inactive as expected")
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
                         links_state_result = main.FALSE
 
         print "links_state_result = ", links_state_result
-        time.sleep(10)
+        time.sleep( 10 )
         flowHandle = main.ONOS3.flows()
-        main.log.info("flows :" + flowHandle)
+        main.log.info( "flows :" + flowHandle )
 
-        main.step("Verify Rerouting by a ping test")
+        main.step( "Verify Rerouting by a ping test" )
         Ping_Result = main.TRUE
-        count = 1        
-        main.log.info("\n\nh1 is Pinging h2")
-        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
         #ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count<5:
-            count+=1
+        if ping == main.FALSE and count < 5:
+            count += 1
             Ping_Result = main.FALSE
-            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
-            time.sleep(2)
-        elif ping==main.FALSE:
-            main.log.info("All ping attempts between h1 and h2 have failed")
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
             Ping_Result = main.FALSE
-        elif ping==main.TRUE:
-            main.log.info("Ping test between h1 and h2 passed!")
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
             Ping_Result = main.TRUE
         else:
-            main.log.info("Unknown error")
+            main.log.info( "Unknown error" )
             Ping_Result = main.ERROR
 
-        if Ping_Result==main.TRUE:
-            main.log.report("Ping test successful ")
-        if Ping_Result==main.FALSE:
-            main.log.report("Ping test failed")
+        if Ping_Result == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if Ping_Result == main.FALSE:
+            main.log.report( "Ping test failed" )
 
         case24_result = Ping_Result and links_state_result
-        utilities.assert_equals(expect=main.TRUE, actual=case24_result,
-                onpass="Packet optical rerouting successful",
-                onfail="Packet optical rerouting failed")
+        utilities.assert_equals( expect=main.TRUE, actual=case24_result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
 
-    def CASE4(self, main):
+    def CASE4( self, main ):
         import re
         import time
-        main.log.report("This testcase is testing the assignment of all the switches to all the controllers and discovering the hosts in reactive mode")
-        main.log.report("__________________________________")
-        main.case("Pingall Test")
-        main.step("Assigning switches to controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+        main.log.report(
+            "This testcase is testing the assignment of all the switches to all the controllers and discovering the hosts in reactive mode" )
+        main.log.report( "__________________________________" )
+        main.case( "Pingall Test" )
+        main.step( "Assigning switches to controllers" )
+        for i in range( 1, 29 ):
+            if i == 1:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 2 and i < 5:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 5 and i < 8:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 8 and i < 18:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 18 and i < 28:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
             else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
         Switch_Mastership = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+        for i in range( 1, 29 ):
+            if i == 1:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 2 and i < 5:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 5 and i < 8:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 8 and i < 18:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 18 and i < 28:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
             else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +ONOS1_ip,response):
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is" + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
 
         if Switch_Mastership == main.TRUE:
-            main.log.report("Controller assignmnet successful")
+            main.log.report( "Controller assignmnet successful" )
         else:
-            main.log.report("Controller assignmnet failed")
-        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
-                onpass="MasterControllers assigned correctly")
-        '''
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
+            main.log.report( "Controller assignmnet failed" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Switch_Mastership,
+            onpass="MasterControllers assigned correctly" )
+        """
+        for i in range ( 1,29 ):
+            main.Mininet1.assign_sw_controller( sw=str( i ),count=5,
                     ip1=ONOS1_ip,port1=ONOS1_port,
                     ip2=ONOS2_ip,port2=ONOS2_port,
                     ip3=ONOS3_ip,port3=ONOS3_port,
                     ip4=ONOS4_ip,port4=ONOS4_port,
-                    ip5=ONOS5_ip,port5=ONOS5_port)
-        '''
-        #REACTIVE FWD test
+                    ip5=ONOS5_ip,port5=ONOS5_port )
+        """
+        # REACTIVE FWD test
 
-        main.step("Get list of hosts from Mininet")
+        main.step( "Get list of hosts from Mininet" )
         host_list = main.Mininet1.get_hosts()
-        main.log.info(host_list)
+        main.log.info( host_list )
 
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOS2.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-        #time.sleep(5)
-        
-        main.step("Pingall")
+        main.step( "Get host list in ONOS format" )
+        host_onos_list = main.ONOS2.get_hosts_id( host_list )
+        main.log.info( host_onos_list )
+        # time.sleep( 5 )
+
+        main.step( "Pingall" )
         ping_result = main.FALSE
         while ping_result == main.FALSE:
             time1 = time.time()
             ping_result = main.Mininet1.pingall()
             time2 = time.time()
-            print "Time for pingall: %2f seconds" % (time2 - time1)
-      
-        #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
-        #if there was no activity
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+            print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        # Start onos cli again because u might have dropped out of onos prompt to the shell prompt
+        # if there was no activity
+        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
 
         case4_result = Switch_Mastership and ping_result
         if ping_result == main.TRUE:
-            main.log.report("Pingall Test in reactive mode to discover the hosts successful") 
+            main.log.report(
+                "Pingall Test in reactive mode to discover the hosts successful" )
         else:
-            main.log.report("Pingall Test in reactive mode to discover the hosts failed")
+            main.log.report(
+                "Pingall Test in reactive mode to discover the hosts failed" )
 
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")   
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case4_result,
+            onpass="Controller assignment and Pingall Test successful",
+            onfail="Controller assignment and Pingall Test NOT successful" )
 
-    def CASE10(self):
-        main.log.report("This testcase uninstalls the reactive forwarding app")
-        main.log.report("__________________________________")
-        main.case("Uninstalling reactive forwarding app")
-        #Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
-        main.log.info("onos-app-fwd uninstalled")
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result = main.ONOS2.feature_uninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
 
-        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
-        #So sleep for 15s
-        time.sleep(15)
+        # After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
 
         flows = main.ONOS2.flows()
-        main.log.info(flows)
+        main.log.info( flows )
 
         case10_result = appUninstall_result
-        utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed") 
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10_result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
 
-    
-    def CASE6(self):
-        main.log.report("This testcase is testing the addition of host intents and then does pingall")
-        main.log.report("__________________________________")
-        main.case("Obtaining host id's")
-        main.step("Get hosts")
+    def CASE6( self ):
+        main.log.report(
+            "This testcase is testing the addition of host intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.case( "Obtaining host id's" )
+        main.step( "Get hosts" )
         hosts = main.ONOS2.hosts()
-        #main.log.info(hosts)
+        # main.log.info( hosts )
 
-        main.step("Get all devices id")
+        main.step( "Get all devices id" )
         devices_id_list = main.ONOS2.get_all_devices_id()
-        #main.log.info(devices_id_list)
-        
-        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
-        #So take care while adding intents
-        '''
-        main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-        print "_____________________________________________________________________________________"
-        '''
-        
-        for i in range(8,18):
-            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
-            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
-            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
-            #NOTE: get host can return None
-            #TODO: handle this
-            host1_id = main.ONOS2.get_host(host1)['id']
-            host2_id = main.ONOS2.get_host(host2)['id']
-            tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )        
+        # main.log.info( devices_id_list )
 
-        time.sleep(10)
-        h_intents = main.ONOS2.intents(json_format = False)
-        main.log.info("intents:" +h_intents)
+        # ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        # So take care while adding intents
+        """
+        main.step( "Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+        print "_____________________________________________________________________________________"
+        """
+        for i in range( 8, 18 ):
+            main.log.info(
+                "Adding host intent between h" + str( i ) + " and h" + str( i + 10 ) )
+            host1 = "00:00:00:00:00:" + \
+                str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+            host2 = "00:00:00:00:00:" + \
+                str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+            # NOTE: get host can return None
+            # TODO: handle this
+            host1_id = main.ONOS2.get_host( host1 )[ 'id' ]
+            host2_id = main.ONOS2.get_host( host2 )[ 'id' ]
+            tmp_result = main.ONOS2.add_host_intent( host1_id, host2_id )
+
+        time.sleep( 10 )
+        h_intents = main.ONOS2.intents( json_format=False )
+        main.log.info( "intents:" + h_intents )
         flowHandle = main.ONOS2.flows()
-        #main.log.info("flow:" +flowHandle)
+        #main.log.info( "flow:" +flowHandle )
 
         count = 1
         i = 8
         Ping_Result = main.TRUE
-        #while i<10:
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping == main.FALSE and count <5:
-                count+=1
+        # while i<10:
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
                 #i = 8
                 Ping_Result = main.FALSE
-                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
-                i=19
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
                 Ping_Result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
-                i+=1
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
                 Ping_Result = main.TRUE
             else:
-                main.log.info("Unknown error")
+                main.log.info( "Unknown error" )
                 Ping_Result = main.ERROR
-        if Ping_Result==main.FALSE:
-            main.log.report("Ping all test after Host intent addition failed. Cleaning up")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.TRUE:
-            main.log.report("Ping all test after Host intent addition successful")
-            
+        if Ping_Result == main.FALSE:
+            main.log.report(
+                "Ping all test after Host intent addition failed. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if Ping_Result == main.TRUE:
+            main.log.report(
+                "Ping all test after Host intent addition successful" )
+
         case6_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case6_result,
-                onpass="Pingall Test after Host intents addition successful",
-                onfail="Pingall Test after Host intents addition failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case6_result,
+            onpass="Pingall Test after Host intents addition successful",
+            onfail="Pingall Test after Host intents addition failed" )
 
-
-    def CASE5(self,main) :
+    def CASE5( self, main ):
         import json
         from subprocess import Popen, PIPE
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        # assumes that sts is already in you PYTHONPATH
+        from sts.topology.teston_topology import TestONTopology
+        # main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
         deviceResult = main.ONOS2.devices()
         linksResult = main.ONOS2.links()
         #portsResult = main.ONOS2.ports()
         print "**************"
 
-        main.log.report("This testcase is testing if all ONOS nodes are in topology sync with mininet")
-        main.log.report("__________________________________")
-        main.case("Comparing Mininet topology with the topology of ONOS")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],
-                            target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],
-                            target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],
-                            target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],
-                            target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],
-                            target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],
-                            target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],
-                            target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],
-                            target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],
-                            target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],
-                            target=main.params['PING']['target10'],pingTime=500)
+        main.log.report(
+            "This testcase is testing if all ONOS nodes are in topology sync with mininet" )
+        main.log.report( "__________________________________" )
+        main.case( "Comparing Mininet topology with the topology of ONOS" )
+        main.step( "Start continuous pings" )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source1' ],
+            target=main.params[ 'PING' ][ 'target1' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source2' ],
+            target=main.params[ 'PING' ][ 'target2' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source3' ],
+            target=main.params[ 'PING' ][ 'target3' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source4' ],
+            target=main.params[ 'PING' ][ 'target4' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source5' ],
+            target=main.params[ 'PING' ][ 'target5' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source6' ],
+            target=main.params[ 'PING' ][ 'target6' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source7' ],
+            target=main.params[ 'PING' ][ 'target7' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source8' ],
+            target=main.params[ 'PING' ][ 'target8' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source9' ],
+            target=main.params[ 'PING' ][ 'target9' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source10' ],
+            target=main.params[ 'PING' ][ 'target10' ],
+            pingTime=500 )
 
-        main.step("Create TestONTopology object")
+        main.step( "Create TestONTopology object" )
         global ctrls
         ctrls = []
         count = 1
         while True:
             temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
+            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+                temp = temp + ( "ONOS" + str( count ), )
+                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+                temp = temp + \
+                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+                ctrls.append( temp )
                 count = count + 1
             else:
                 break
         global MNTopo
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
         MNTopo = Topo
 
         Topology_Check = main.TRUE
-        main.step("Compare ONOS Topology to MN Topology")
+        main.step( "Compare ONOS Topology to MN Topology" )
         devices_json = main.ONOS2.devices()
         links_json = main.ONOS2.links()
         #ports_json = main.ONOS2.ports()
         print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
+
+        result1 = main.Mininet1.compare_switches(
+            MNTopo,
+            json.loads( devices_json ) )
+        result2 = main.Mininet1.compare_links(
+            MNTopo,
+            json.loads( links_json ) )
+        #result3 = main.Mininet1.compare_ports( MNTopo, json.loads( ports_json ) )
+
         #result = result1 and result2 and result3
         result = result1 and result2
-        
+
         print "***********************"
         if result == main.TRUE:
-            main.log.report("ONOS"+ " Topology matches MN Topology")
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
         else:
-            main.log.report("ONOS"+ " Topology does not match MN Topology") 
+            main.log.report( "ONOS" + " Topology does not match MN Topology" )
 
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-            onpass="ONOS" + " Topology matches MN Topology",
-            onfail="ONOS" + " Topology does not match MN Topology")
-        
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
         Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Topology_Check,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
 
-    def CASE7 (self,main):
-       
-        ONOS1_ip = main.params['CTRL']['ip1']
+    def CASE7( self, main ):
 
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.log.report("This testscase is killing a link to ensure that link discovery is consistent")
-        main.log.report("__________________________________")
-        main.log.report("Killing a link to ensure that link discovery is consistent")
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        '''
-        main.step("Start continuous pings")
-       
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],
-                            target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],
-                            target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],
-                            target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],
-                            target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],
-                            target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],
-                            target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],
-                            target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],
-                            target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],
-                            target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],
-                            target=main.params['PING']['target10'],pingTime=500)
-        '''
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.step("Determine the current number of switches and links")
+        main.log.report(
+            "This testscase is killing a link to ensure that link discovery is consistent" )
+        main.log.report( "__________________________________" )
+        main.log.report(
+            "Killing a link to ensure that link discovery is consistent" )
+        main.case(
+            "Killing a link to Ensure that Link Discovery is Working Properly" )
+        """
+        main.step( "Start continuous pings" )
+
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+                            target=main.params[ 'PING' ][ 'target1' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+                            target=main.params[ 'PING' ][ 'target2' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+                            target=main.params[ 'PING' ][ 'target3' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+                            target=main.params[ 'PING' ][ 'target4' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+                            target=main.params[ 'PING' ][ 'target5' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+                            target=main.params[ 'PING' ][ 'target6' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+                            target=main.params[ 'PING' ][ 'target7' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+                            target=main.params[ 'PING' ][ 'target8' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+                            target=main.params[ 'PING' ][ 'target9' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+                            target=main.params[ 'PING' ][ 'target10' ],pingTime=500 )
+        """
+        main.step( "Determine the current number of switches and links" )
         topology_output = main.ONOS2.topology()
-        topology_result = main.ONOS1.get_topology(topology_output)
-        activeSwitches = topology_result['devices']
-        links = topology_result['links']
-        print "activeSwitches = ", type(activeSwitches)
-        print "links = ", type(links)
-        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+        topology_result = main.ONOS1.get_topology( topology_output )
+        activeSwitches = topology_result[ 'devices' ]
+        links = topology_result[ 'links' ]
+        print "activeSwitches = ", type( activeSwitches )
+        print "links = ", type( links )
+        main.log.info(
+            "Currently there are %s switches and %s links" %
+            ( str( activeSwitches ), str( links ) ) )
 
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        time.sleep(link_sleep)
+        main.step( "Kill Link between s3 and s28" )
+        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+        time.sleep( link_sleep )
         topology_output = main.ONOS2.topology()
-        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
+        Link_Down = main.ONOS1.check_status(
+            topology_output, activeSwitches, str(
+                int( links ) - 2 ) )
         if Link_Down == main.TRUE:
-            main.log.report("Link Down discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
-                onpass="Link Down discovered properly",
-                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
-       
-        #Check ping result here..add code for it
-         
-        main.step("Bring link between s3 and s28 back up")
-        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-        time.sleep(link_sleep)
+            main.log.report( "Link Down discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Link_Down,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        # Check ping result here..add code for it
+
+        main.step( "Bring link between s3 and s28 back up" )
+        Link_Up = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+        time.sleep( link_sleep )
         topology_output = main.ONOS2.topology()
-        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
+        Link_Up = main.ONOS1.check_status(
+            topology_output,
+            activeSwitches,
+            str( links ) )
         if Link_Up == main.TRUE:
-            main.log.report("Link up discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
-                onpass="Link up discovered properly",
-                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
-            
-        #NOTE Check ping result here..add code for it
-        
-        
-        main.step("Compare ONOS Topology to MN Topology")
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+            main.log.report( "Link up discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Link_Up,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        # NOTE Check ping result here..add code for it
+
+        main.step( "Compare ONOS Topology to MN Topology" )
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
         MNTopo = Topo
         Topology_Check = main.TRUE
-        
+
         devices_json = main.ONOS2.devices()
         links_json = main.ONOS2.links()
         ports_json = main.ONOS2.ports()
         print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
+
+        result1 = main.Mininet1.compare_switches(
+            MNTopo,
+            json.loads( devices_json ) )
+        result2 = main.Mininet1.compare_links(
+            MNTopo,
+            json.loads( links_json ) )
+        #result3 = main.Mininet1.compare_ports( MNTopo, json.loads( ports_json ) )
+
         #result = result1 and result2 and result3
         result = result1 and result2
         print "***********************"
-        
+
         if result == main.TRUE:
-            main.log.report("ONOS"+ " Topology matches MN Topology")
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-            onpass="ONOS" + " Topology matches MN Topology",
-            onfail="ONOS" + " Topology does not match MN Topology")
-        
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
         Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Topology_Check,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
         result = Link_Down and Link_Up and Topology_Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-                onpass="Link failure is discovered correctly",
-                onfail="Link Discovery failed")
+        utilities.assert_equals( expect=main.TRUE, actual=result,
+                                 onpass="Link failure is discovered correctly",
+                                 onfail="Link Discovery failed" )
 
-
-    def CASE8(self):
-        '''
+    def CASE8( self ):
+        """
         Host intents removal
-        ''' 
-        main.log.report("This testcase removes any previously added intents before adding the same intents or point intents")
-        main.log.report("__________________________________")        
-        main.log.info("Host intents removal")
-        main.case("Removing host intents")
-        main.step("Obtain the intent id's")
-        intent_result = main.ONOS2.intents(json_format = False)
-        main.log.info("intent_result = " +intent_result)        
- 
-        intent_linewise = intent_result.split("\n")
+        """
+        main.log.report(
+            "This testcase removes any previously added intents before adding the same intents or point intents" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Host intents removal" )
+        main.case( "Removing host intents" )
+        main.step( "Obtain the intent id's" )
+        intent_result = main.ONOS2.intents( json_format=False )
+        main.log.info( "intent_result = " + intent_result )
+
+        intent_linewise = intent_result.split( "\n" )
         intentList = []
         for line in intent_linewise:
-            if line.startswith("id="):
-                intentList.append(line)
-        
+            if line.startswith( "id=" ):
+                intentList.append( line )
+
         intentids = []
         for line in intentList:
-            intentids.append(line.split(",")[0].split("=")[1])
+            intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] )
         for id in intentids:
             print "id = ", id
-        
-        main.step("Iterate through the intentids list and remove each intent")
+
+        main.step(
+            "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOS2.remove_intent(intent_id = id)
-        
-        intent_result = main.ONOS2.intents(json_format = False)
-        main.log.info("intent_result = " +intent_result)        
+            main.ONOS2.remove_intent( intent_id=id )
+
+        intent_result = main.ONOS2.intents( json_format=False )
+        main.log.info( "intent_result = " + intent_result )
 
         case8_result = main.TRUE
         if case8_result == main.TRUE:
-            main.log.report("Intent removal successful")
+            main.log.report( "Intent removal successful" )
         else:
-            main.log.report("Intent removal failed")
-       
+            main.log.report( "Intent removal failed" )
+
         Ping_Result = main.TRUE
         if case8_result == main.TRUE:
             i = 8
-            while i <18 :
-                main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-                ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-                if ping==main.TRUE:
+            while i < 18:
+                main.log.info(
+                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+                ping = main.Mininet1.pingHost(
+                    src="h" + str( i ), target="h" + str( i + 10 ) )
+                if ping == main.TRUE:
                     i = 19
                     Ping_Result = Ping_Result and main.TRUE
-                elif ping==main.FALSE:
-                    i+=1
+                elif ping == main.FALSE:
+                    i += 1
                     Ping_Result = Ping_Result and main.FALSE
                 else:
-                    main.log.info("Unknown error")
+                    main.log.info( "Unknown error" )
                     Ping_Result = main.ERROR
 
-            #Note: If the ping result failed, that means the intents have been withdrawn correctly.
-        if Ping_Result==main.TRUE:
-            main.log.report("Host intents have not been withdrawn correctly")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.FALSE:
-            main.log.report("Host intents have been withdrawn correctly")
+            # Note: If the ping result failed, that means the intents have been
+            # withdrawn correctly.
+        if Ping_Result == main.TRUE:
+            main.log.report( "Host intents have not been withdrawn correctly" )
+            # main.cleanup()
+            # main.exit()
+        if Ping_Result == main.FALSE:
+            main.log.report( "Host intents have been withdrawn correctly" )
 
         case8_result = case8_result and Ping_Result
 
         if case8_result == main.FALSE:
-            main.log.report("Intent removal successful")
+            main.log.report( "Intent removal successful" )
         else:
-            main.log.report("Intent removal failed")
+            main.log.report( "Intent removal failed" )
 
-        utilities.assert_equals(expect=main.FALSE, actual=case8_result,
-                onpass="Intent removal test failed",
-                onfail="Intent removal test passed")
+        utilities.assert_equals( expect=main.FALSE, actual=case8_result,
+                                 onpass="Intent removal test failed",
+                                 onfail="Intent removal test passed" )
 
+    def CASE9( self ):
+        main.log.report(
+            "This testcase adds point intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Adding point intents" )
+        main.case(
+            "Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)" )
+        main.step(
+            "Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003008/1",
+            "of:0000000000006018/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-    def CASE9(self):
-        main.log.report("This testcase adds point intents and then does pingall")
-        main.log.report("__________________________________") 
-        main.log.info("Adding point intents")
-        main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)") 
-        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006018/1",
+            "of:0000000000003008/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-        
-        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
+        main.step(
+            "Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003009/1",
+            "of:0000000000006019/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006019/1",
+            "of:0000000000003009/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-
-        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
+        main.step(
+            "Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003010/1",
+            "of:0000000000006020/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006020/1",
+            "of:0000000000003010/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-        print("_______________________________________________________________________________________")
+        main.step(
+            "Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003011/1",
+            "of:0000000000006021/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006021/1",
+            "of:0000000000003011/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003012/1",
+            "of:0000000000006022/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006022/1",
+            "of:0000000000003012/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003013/1",
+            "of:0000000000006023/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006023/1",
+            "of:0000000000003013/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003014/1",
+            "of:0000000000006024/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006024/1",
+            "of:0000000000003014/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003015/1",
+            "of:0000000000006025/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006025/1",
+            "of:0000000000003015/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003016/1",
+            "of:0000000000006026/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006026/1",
+            "of:0000000000003016/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003017/1",
+            "of:0000000000006027/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006027/1",
+            "of:0000000000003017/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        print(
+            "_______________________________________________________________________________________" )
 
         flowHandle = main.ONOS2.flows()
-        #print "flowHandle = ", flowHandle
-        main.log.info("flows :" + flowHandle)        
+        # print "flowHandle = ", flowHandle
+        main.log.info( "flows :" + flowHandle )
 
         count = 1
         i = 8
         Ping_Result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping == main.FALSE and count <5:
-                count+=1
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
                 #i = 8
                 Ping_Result = main.FALSE
-                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
-                i=19
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
                 Ping_Result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
-                i+=1
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
                 Ping_Result = main.TRUE
             else:
-                main.log.info("Unknown error")
+                main.log.info( "Unknown error" )
                 Ping_Result = main.ERROR
 
-        if Ping_Result==main.FALSE:
-            main.log.report("Point intents have not ben installed correctly. Cleaning up")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.TRUE:
-            main.log.report("Point Intents have been installed correctly")
+        if Ping_Result == main.FALSE:
+            main.log.report(
+                "Point intents have not ben installed correctly. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if Ping_Result == main.TRUE:
+            main.log.report( "Point Intents have been installed correctly" )
 
         case9_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case9_result,
-                onpass="Point intents addition and Pingall Test successful",
-                onfail="Point intents addition and Pingall Test NOT successful")
-
-
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case9_result,
+            onpass="Point intents addition and Pingall Test successful",
+            onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/ProdFunc13/ProdFunc13.py b/TestON/tests/ProdFunc13/ProdFunc13.py
old mode 100755
new mode 100644
index a815fea..1775ebb
--- a/TestON/tests/ProdFunc13/ProdFunc13.py
+++ b/TestON/tests/ProdFunc13/ProdFunc13.py
@@ -1,6 +1,6 @@
 
-#Testing the basic functionality of ONOS Next
-#For sanity and driver functionality excercises only.
+# Testing the basic functionality of ONOS Next
+# For sanity and driver functionality excercises only.
 
 import time
 import sys
@@ -8,13 +8,16 @@
 import re
 import json
 
-time.sleep(1)
+time.sleep( 1 )
+
+
 class ProdFunc13:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
-        '''
+    def CASE1( self, main ):
+        """
         Startup sequence:
         cell <name>
         onos-verify-cell
@@ -24,1077 +27,1312 @@
         onos-package
         onos-install -f
         onos-wait-for-start
-        '''
-        
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.case("Setting up test environment")
-        main.log.report("This testcase is testing setting up test environment")
-        main.log.report("__________________________________") 
+        """
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
 
-        main.step("Applying cell variable to environment")
-        cell_result = main.ONOSbench.set_cell(cell_name)
+        main.case( "Setting up test environment" )
+        main.log.report(
+            "This testcase is testing setting up test environment" )
+        main.log.report( "__________________________________" )
+
+        main.step( "Applying cell variable to environment" )
+        cell_result = main.ONOSbench.set_cell( cell_name )
         verify_result = main.ONOSbench.verify_cell()
-        
-        main.step("Removing raft logs before a clen installation of ONOS")
+
+        main.step( "Removing raft logs before a clen installation of ONOS" )
         main.ONOSbench.onos_remove_raft_logs()
 
-        main.step("Git checkout and pull master and get version")
-        main.ONOSbench.git_checkout("master")
+        main.step( "Git checkout and pull master and get version" )
+        main.ONOSbench.git_checkout( "master" )
         git_pull_result = main.ONOSbench.git_pull()
-        main.log.info("git_pull_result = " +git_pull_result)
-        version_result = main.ONOSbench.get_version(report=True)
-    
+        main.log.info( "git_pull_result = " + git_pull_result )
+        version_result = main.ONOSbench.get_version( report=True )
+
         if git_pull_result == 1:
-            main.step("Using mvn clean & install")
+            main.step( "Using mvn clean & install" )
             clean_install_result = main.ONOSbench.clean_install()
             #clean_install_result = main.TRUE
         elif git_pull_result == 0:
-            main.log.report("Git Pull Failed, look into logs for detailed reason")
+            main.log.report(
+                "Git Pull Failed, look into logs for detailed reason" )
             main.cleanup()
-            main.exit() 
-         
-        main.step("Creating ONOS package")
+            main.exit()
+
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-
-        main.step("Installing ONOS package")
+        main.step( "Installing ONOS package" )
         onos_install_result = main.ONOSbench.onos_install()
         if onos_install_result == main.TRUE:
-            main.log.report("Installing ONOS package successful")
+            main.log.report( "Installing ONOS package successful" )
         else:
-            main.log.report("Installing ONOS package failed")
+            main.log.report( "Installing ONOS package failed" )
 
         onos1_isup = main.ONOSbench.isup()
         if onos1_isup == main.TRUE:
-            main.log.report("ONOS instance is up and ready")  
+            main.log.report( "ONOS instance is up and ready" )
         else:
-            main.log.report("ONOS instance may not be up")  
-       
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-        
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])        
+            main.log.report( "ONOS instance may not be up" )
 
-        case1_result = (package_result and\
-                cell_result and verify_result and onos_install_result and\
-                onos1_isup and start_result )
-        utilities.assert_equals(expect=main.TRUE, actual=case1_result,
-                onpass="Test startup successful",
-                onfail="Test startup NOT successful")
+        main.step( "Starting ONOS service" )
+        start_result = main.ONOSbench.onos_start( ONOS1_ip )
 
-    def CASE2(self, main) :
-        '''  
+        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
+
+        case1_result = ( package_result and
+                         cell_result and verify_result and onos_install_result and
+                         onos1_isup and start_result )
+        utilities.assert_equals( expect=main.TRUE, actual=case1_result,
+                                 onpass="Test startup successful",
+                                 onfail="Test startup NOT successful" )
+
+    def CASE2( self, main ):
+        """
         Switch Down
-        '''
-        #NOTE: You should probably run a topology check after this
-        import time 
+        """
+        # NOTE: You should probably run a topology check after this
+        import time
         import json
- 
-        main.case("Switch down discovery")
-        main.log.report("This testcase is testing a switch down discovery")
-        main.log.report("__________________________________")
 
-        switch_sleep = int(main.params['timers']['SwitchDiscovery'])
+        main.case( "Switch down discovery" )
+        main.log.report( "This testcase is testing a switch down discovery" )
+        main.log.report( "__________________________________" )
+
+        switch_sleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
 
         description = "Killing a switch to ensure it is discovered correctly"
-        main.log.report(description)
-        main.case(description)
+        main.log.report( description )
+        main.case( description )
 
-        #TODO: Make this switch parameterizable
-        main.step("Kill s28 ")
-        main.log.report("Deleting s28")
-        #FIXME: use new dynamic topo functions
-        main.Mininet1.del_switch("s28")
-        main.log.info("Waiting " + str(switch_sleep) + " seconds for switch down to be discovered")
-        time.sleep(switch_sleep)
-        #Peek at the deleted switch
-        device = main.ONOS2.get_device(dpid="0028")
+        # TODO: Make this switch parameterizable
+        main.step( "Kill s28 " )
+        main.log.report( "Deleting s28" )
+        # FIXME: use new dynamic topo functions
+        main.Mininet1.del_switch( "s28" )
+        main.log.info(
+            "Waiting " +
+            str( switch_sleep ) +
+            " seconds for switch down to be discovered" )
+        time.sleep( switch_sleep )
+        # Peek at the deleted switch
+        device = main.ONOS2.get_device( dpid="0028" )
         print "device = ", device
-        if device[u'available'] == 'False':
+        if device[ u'available' ] == 'False':
             case2_result = main.FALSE
         else:
             case2_result = main.TRUE
-        utilities.assert_equals(expect=main.TRUE, actual=case2_result,
-                onpass="Switch down discovery successful",
-                onfail="Switch down discovery failed")
+        utilities.assert_equals( expect=main.TRUE, actual=case2_result,
+                                 onpass="Switch down discovery successful",
+                                 onfail="Switch down discovery failed" )
 
-    def CASE11(self, main):
-        '''
+    def CASE11( self, main ):
+        """
         Cleanup sequence:
         onos-service <node_ip> stop
         onos-uninstall
 
         TODO: Define rest of cleanup
-        
-        '''
 
-        ONOS1_ip = main.params['CTRL']['ip1']
+        """
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.case("Cleaning up test environment")
+        main.case( "Cleaning up test environment" )
 
-        main.step("Testing ONOS kill function")
-        kill_result = main.ONOSbench.onos_kill(ONOS1_ip)
+        main.step( "Testing ONOS kill function" )
+        kill_result = main.ONOSbench.onos_kill( ONOS1_ip )
 
-        main.step("Stopping ONOS service")
-        stop_result = main.ONOSbench.onos_stop(ONOS1_ip)
+        main.step( "Stopping ONOS service" )
+        stop_result = main.ONOSbench.onos_stop( ONOS1_ip )
 
-        main.step("Uninstalling ONOS service") 
+        main.step( "Uninstalling ONOS service" )
         uninstall_result = main.ONOSbench.onos_uninstall()
 
-    def CASE3(self, main):
-        '''
+    def CASE3( self, main ):
+        """
         Test 'onos' command and its functionality in driver
-        '''
-        
-        ONOS1_ip = main.params['CTRL']['ip1']
+        """
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.case("Testing 'onos' command")
+        main.case( "Testing 'onos' command" )
 
-        main.step("Sending command 'onos -w <onos-ip> system:name'")
+        main.step( "Sending command 'onos -w <onos-ip> system:name'" )
         cmdstr1 = "system:name"
-        cmd_result1 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr1) 
-        main.log.info("onos command returned: "+cmd_result1)
+        cmd_result1 = main.ONOSbench.onos_cli( ONOS1_ip, cmdstr1 )
+        main.log.info( "onos command returned: " + cmd_result1 )
 
-        main.step("Sending command 'onos -w <onos-ip> onos:topology'")
+        main.step( "Sending command 'onos -w <onos-ip> onos:topology'" )
         cmdstr2 = "onos:topology"
-        cmd_result2 = main.ONOSbench.onos_cli(ONOS1_ip, cmdstr2)
-        main.log.info("onos command returned: "+cmd_result2)
+        cmd_result2 = main.ONOSbench.onos_cli( ONOS1_ip, cmdstr2 )
+        main.log.info( "onos command returned: " + cmd_result2 )
 
-
-    def CASE20(self):
-        '''
+    def CASE20( self ):
+        """
             Exit from mininet cli
             reinstall ONOS
-        '''
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS1_port = main.params['CTRL']['port1']
-        
-        main.log.report("This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology")
-        main.log.report("_____________________________________________")
-        main.case("Disconnecting mininet and restarting ONOS")
-        main.step("Disconnecting mininet and restarting ONOS")
+        """
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+
+        main.log.report(
+            "This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Disconnecting mininet and restarting ONOS" )
+        main.step( "Disconnecting mininet and restarting ONOS" )
         mininet_disconnect = main.Mininet1.disconnect()
 
-        main.step("Removing raft logs before a clen installation of ONOS")
+        main.step( "Removing raft logs before a clen installation of ONOS" )
         main.ONOSbench.onos_remove_raft_logs()
 
-        main.step("Applying cell variable to environment")
-        cell_result = main.ONOSbench.set_cell(cell_name)
+        main.step( "Applying cell variable to environment" )
+        cell_result = main.ONOSbench.set_cell( cell_name )
         verify_result = main.ONOSbench.verify_cell()
 
         onos_install_result = main.ONOSbench.onos_install()
         if onos_install_result == main.TRUE:
-            main.log.report("Installing ONOS package successful")
+            main.log.report( "Installing ONOS package successful" )
         else:
-            main.log.report("Installing ONOS package failed")
+            main.log.report( "Installing ONOS package failed" )
 
         onos1_isup = main.ONOSbench.isup()
         if onos1_isup == main.TRUE:
-            main.log.report("ONOS instance is up and ready")
+            main.log.report( "ONOS instance is up and ready" )
         else:
-            main.log.report("ONOS instance may not be up")
+            main.log.report( "ONOS instance may not be up" )
 
-        main.step("Starting ONOS service")
-        start_result = main.ONOSbench.onos_start(ONOS1_ip)
-      
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1']) 
+        main.step( "Starting ONOS service" )
+        start_result = main.ONOSbench.onos_start( ONOS1_ip )
+
+        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
         print "mininet_disconnect =", mininet_disconnect
         print "onos_install_result =", onos_install_result
         print "onos1_isup =", onos1_isup
         print "start_result =", start_result
- 
-        case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
-        utilities.assert_equals(expect=main.TRUE, actual=case20_result,
-                onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
-                onfail="Exiting functionality mininet topology and reinstalling ONOS failed") 
 
-    def CASE21(self, main):
+        case20_result = mininet_disconnect and cell_result and onos_install_result and onos1_isup and start_result
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case20_result,
+            onpass="Exiting functionality mininet topology and reinstalling ONOS successful",
+            onfail="Exiting functionality mininet topology and reinstalling ONOS failed" )
+
+    def CASE21( self, main ):
         import time
-        '''
+        """
             On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg
             which starts the rest and copies the links json file to the onos instance
-            Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt 
+            Note that in case of Packet Optical, the links are not learnt from the topology, instead the links are learnt
             from the json config file
-        ''' 
-        main.log.report("This testcase starts the packet layer topology and REST")
-        main.log.report("_____________________________________________")
-        main.case("Starting LINC-OE and other components")
-        main.step("Starting LINC-OE and other components")
+        """
+        main.log.report(
+            "This testcase starts the packet layer topology and REST" )
+        main.log.report( "_____________________________________________" )
+        main.case( "Starting LINC-OE and other components" )
+        main.step( "Starting LINC-OE and other components" )
         start_console_result = main.LincOE1.start_console()
         optical_mn_script = main.LincOE2.run_optical_mn_script()
-        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(instance_name = main.params['CTRL']['ip1'], json_file = main.params['OPTICAL']['jsonfile'])
-            
-        print "start_console_result =",start_console_result 
-        print "optical_mn_script = ",optical_mn_script 
-        print "onos_topo_cfg_result =",onos_topo_cfg_result 
+        onos_topo_cfg_result = main.ONOSbench.run_onos_topo_cfg(
+            instance_name=main.params[ 'CTRL' ][ 'ip1' ],
+            json_file=main.params[ 'OPTICAL' ][ 'jsonfile' ] )
+
+        print "start_console_result =", start_console_result
+        print "optical_mn_script = ", optical_mn_script
+        print "onos_topo_cfg_result =", onos_topo_cfg_result
 
         case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
-        utilities.assert_equals(expect=main.TRUE, actual=case21_result,
-                onpass="Packet optical topology spawned successsfully",
-                onfail="Packet optical topology spawning failed") 
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case21_result,
+            onpass="Packet optical topology spawned successsfully",
+            onfail="Packet optical topology spawning failed" )
 
-
-    def CASE22(self, main):
-        '''
+    def CASE22( self, main ):
+        """
             Curretly we use, 4 linear switch optical topology and 2 packet layer mininet switches each with one host.
              Therefore, the roadmCount variable = 4, packetLayerSWCount variable = 2, hostCount =2
             and this is hardcoded in the testcase. If the topology changes, these hardcoded values need to be changed
-        '''
-
-        main.log.report("This testcase compares the optical+packet topology against what is expected")
-        main.case("Topology comparision")
-        main.step("Topology comparision")
-        main.ONOS3.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
-        devices_result = main.ONOS3.devices(json_format = False)
+        """
+        main.log.report(
+            "This testcase compares the optical+packet topology against what is expected" )
+        main.case( "Topology comparision" )
+        main.step( "Topology comparision" )
+        main.ONOS3.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
+        devices_result = main.ONOS3.devices( json_format=False )
 
         print "devices_result = ", devices_result
-        devices_linewise = devices_result.split("\n")
-        devices_linewise = devices_linewise[1:-1]
+        devices_linewise = devices_result.split( "\n" )
+        devices_linewise = devices_linewise[ 1:-1 ]
         roadmCount = 0
         packetLayerSWCount = 0
         for line in devices_linewise:
-            components = line.split(",")
-            availability = components[1].split("=")[1]
-            type = components[3].split("=")[1]
+            components = line.split( "," )
+            availability = components[ 1 ].split( "=" )[ 1 ]
+            type = components[ 3 ].split( "=" )[ 1 ]
             if availability == 'true' and type == 'ROADM':
                 roadmCount += 1
-            elif availability == 'true' and type =='SWITCH':
+            elif availability == 'true' and type == 'SWITCH':
                 packetLayerSWCount += 1
         if roadmCount == 4:
-            print "Number of Optical Switches = %d and is correctly detected" %roadmCount
-            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is correctly detected")
+            print "Number of Optical Switches = %d and is correctly detected" % roadmCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is correctly detected" )
             opticalSW_result = main.TRUE
         else:
-            print "Number of Optical Switches = %d and is wrong" %roadCount
-            main.log.info ("Number of Optical Switches = " +str(roadmCount) +" and is wrong")
+            print "Number of Optical Switches = %d and is wrong" % roadCount
+            main.log.info(
+                "Number of Optical Switches = " +
+                str( roadmCount ) +
+                " and is wrong" )
             opticalSW_result = main.FALSE
 
         if packetLayerSWCount == 2:
-            print "Number of Packet layer or mininet Switches = %d and is correctly detected" %packetLayerSWCount
-            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is correctly detected")
+            print "Number of Packet layer or mininet Switches = %d and is correctly detected" % packetLayerSWCount
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is correctly detected" )
             packetSW_result = main.TRUE
         else:
-            print "Number of Packet layer or mininet Switches = %d and is wrong" %packetLayerSWCount
-            main.log.info("Number of Packet layer or mininet Switches = " +str(packetLayerSWCount) + " and is wrong")
+            print "Number of Packet layer or mininet Switches = %d and is wrong" % packetLayerSWCount
+            main.log.info(
+                "Number of Packet layer or mininet Switches = " +
+                str( packetLayerSWCount ) +
+                " and is wrong" )
             packetSW_result = main.FALSE
         print "_________________________________"
-        
-        links_result = main.ONOS3.links(json_format = False)
+
+        links_result = main.ONOS3.links( json_format=False )
         print "links_result = ", links_result
         print "_________________________________"
-        
-        #NOTE:Since only point intents are added, there is no requirement to discover the hosts
-                #Therfore, the below portion of the code is commented.
-        '''
+
+        # NOTE:Since only point intents are added, there is no requirement to discover the hosts
+        # Therfore, the below portion of the code is commented.
+        """
         #Discover hosts using pingall
-        pingall_result = main.LincOE2.pingall()    
-    
-        hosts_result = main.ONOS3.hosts(json_format = False)
-        main.log.info("hosts_result = "+hosts_result)   
-        main.log.info("_________________________________")
-        hosts_linewise = hosts_result.split("\n")
-        hosts_linewise = hosts_linewise[1:-1]
+        pingall_result = main.LincOE2.pingall()
+
+        hosts_result = main.ONOS3.hosts( json_format=False )
+        main.log.info( "hosts_result = "+hosts_result )
+        main.log.info( "_________________________________" )
+        hosts_linewise = hosts_result.split( "\n" )
+        hosts_linewise = hosts_linewise[ 1:-1 ]
         hostCount = 0
         for line in hosts_linewise:
-            hostid = line.split(",")[0].split("=")[1]
+            hostid = line.split( "," )[ 0 ].split( "=" )[ 1 ]
             hostCount +=1
         if hostCount ==2:
             print "Number of hosts = %d and is correctly detected" %hostCount
-            main.log.info("Number of hosts = " + str(hostCount) +" and is correctly detected")
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and is correctly detected" )
             hostDiscovery = main.TRUE
         else:
             print "Number of hosts = %d and is wrong" %hostCount
-            main.log.info("Number of hosts = " + str(hostCount) +" and is wrong")
+            main.log.info( "Number of hosts = " + str( hostCount ) +" and is wrong" )
             hostDiscovery = main.FALSE
-        '''
-
+        """
         case22_result = opticalSW_result and packetSW_result
-        utilities.assert_equals(expect=main.TRUE, actual=case22_result,
-                onpass="Packet optical topology discovery successful",
-                onfail="Packet optical topology discovery failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case22_result,
+            onpass="Packet optical topology discovery successful",
+            onfail="Packet optical topology discovery failed" )
 
-    def CASE23(self, main):
+    def CASE23( self, main ):
         import time
-        '''
-            Add bidirectional point intents between 2 packet layer(mininet) devices and 
+        """
+            Add bidirectional point intents between 2 packet layer( mininet ) devices and
             ping mininet hosts
-        '''
-        main.log.report("This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts")
-        main.case("Topology comparision")
-        main.step("Adding point intents")
-        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0001/1", "of:0000ffffffff0002/1")
+        """
+        main.log.report(
+            "This testcase adds bidirectional point intents between 2 packet layer(mininet) devices and ping mininet hosts" )
+        main.case( "Topology comparision" )
+        main.step( "Adding point intents" )
+        ptp_intent_result = main.ONOS3.add_point_intent(
+            "of:0000ffffffff0001/1",
+            "of:0000ffffffff0002/1" )
         if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS3.intents(json_format = False)
-            main.log.info("Point to point intent install successful")
+            get_intent_result = main.ONOS3.intents( json_format=False )
+            main.log.info( "Point to point intent install successful" )
 
-        ptp_intent_result = main.ONOS3.add_point_intent("of:0000ffffffff0002/1", "of:0000ffffffff0001/1")
+        ptp_intent_result = main.ONOS3.add_point_intent(
+            "of:0000ffffffff0002/1",
+            "of:0000ffffffff0001/1" )
         if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS3.intents(json_format = False)
-            main.log.info("Point to point intent install successful")
+            get_intent_result = main.ONOS3.intents( json_format=False )
+            main.log.info( "Point to point intent install successful" )
 
-        time.sleep(10)
+        time.sleep( 10 )
         flowHandle = main.ONOS3.flows()
-        main.log.info("flows :" + flowHandle)
+        main.log.info( "flows :" + flowHandle )
 
         # Sleep for 30 seconds to provide time for the intent state to change
-        time.sleep(30)
-        intentHandle = main.ONOS3.intents(json_format = False)        
-        main.log.info("intents :" + intentHandle)        
- 
+        time.sleep( 30 )
+        intentHandle = main.ONOS3.intents( json_format=False )
+        main.log.info( "intents :" + intentHandle )
+
         Ping_Result = main.TRUE
         count = 1
-        main.log.info("\n\nh1 is Pinging h2")
-        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
         #ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count<5:
-            count+=1
+        if ping == main.FALSE and count < 5:
+            count += 1
             Ping_Result = main.FALSE
-            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
-            time.sleep(2)
-        elif ping==main.FALSE:
-            main.log.info("All ping attempts between h1 and h2 have failed")
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
             Ping_Result = main.FALSE
-        elif ping==main.TRUE:
-            main.log.info("Ping test between h1 and h2 passed!")
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
             Ping_Result = main.TRUE
         else:
-            main.log.info("Unknown error")
+            main.log.info( "Unknown error" )
             Ping_Result = main.ERROR
-        
-        if Ping_Result==main.FALSE:
-            main.log.report("Point intents for packet optical have not ben installed correctly. Cleaning up")
-        if Ping_Result==main.TRUE:
-            main.log.report("Point Intents for packet optical have been installed correctly")
+
+        if Ping_Result == main.FALSE:
+            main.log.report(
+                "Point intents for packet optical have not ben installed correctly. Cleaning up" )
+        if Ping_Result == main.TRUE:
+            main.log.report(
+                "Point Intents for packet optical have been installed correctly" )
 
         case23_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case23_result,
-                onpass="Point intents addition for packet optical and Pingall Test successful",
-                onfail="Point intents addition for packet optical and Pingall Test NOT successful")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case23_result,
+            onpass="Point intents addition for packet optical and Pingall Test successful",
+            onfail="Point intents addition for packet optical and Pingall Test NOT successful" )
 
-
-
-    def CASE24(self, main):
+    def CASE24( self, main ):
         import time
         import json
-        '''
-            Test Rerouting of Packet Optical by bringing a port down (port 22) of a switch(switchID=1), so that link (between switch1 port22 - switch4-port30) is inactive
+        """
+            Test Rerouting of Packet Optical by bringing a port down ( port 22 ) of a switch( switchID=1 ), so that link ( between switch1 port22 - switch4-port30 ) is inactive
             and do a ping test. If rerouting is successful, ping should pass. also check the flows
-        '''
-        main.log.report("This testcase tests rerouting and pings mininet hosts")
-        main.case("Test rerouting and pings mininet hosts")
-        main.step("Bring a port down and verify the link state")
-        main.LincOE1.port_down(sw_id="1", pt_id="22") 
-        links_nonjson = main.ONOS3.links(json_format = False)
-        main.log.info("links = " +links_nonjson)
+        """
+        main.log.report(
+            "This testcase tests rerouting and pings mininet hosts" )
+        main.case( "Test rerouting and pings mininet hosts" )
+        main.step( "Bring a port down and verify the link state" )
+        main.LincOE1.port_down( sw_id="1", pt_id="22" )
+        links_nonjson = main.ONOS3.links( json_format=False )
+        main.log.info( "links = " + links_nonjson )
 
         links = main.ONOS3.links()
-        main.log.info("links = " +links)
-        
-        links_result = json.loads(links)
+        main.log.info( "links = " + links )
+
+        links_result = json.loads( links )
         links_state_result = main.FALSE
         for item in links_result:
-            if item['src']['device'] == "of:0000ffffffffff01" and item['src']['port'] == "22":
-                if item['dst']['device'] == "of:0000ffffffffff04" and item['dst']['port'] == "30":
-                    links_state = item['state']
+            if item[ 'src' ][ 'device' ] == "of:0000ffffffffff01" and item[
+                    'src' ][ 'port' ] == "22":
+                if item[ 'dst' ][ 'device' ] == "of:0000ffffffffff04" and item[
+                        'dst' ][ 'port' ] == "30":
+                    links_state = item[ 'state' ]
                     if links_state == "INACTIVE":
-                        main.log.info("Links state is inactive as expected due to one of the ports being down")
-                        main.log.report("Links state is inactive as expected due to one of the ports being down")
+                        main.log.info(
+                            "Links state is inactive as expected due to one of the ports being down" )
+                        main.log.report(
+                            "Links state is inactive as expected due to one of the ports being down" )
                         links_state_result = main.TRUE
                         break
                     else:
-                        main.log.info("Links state is not inactive as expected")
-                        main.log.report("Links state is not inactive as expected")
+                        main.log.info(
+                            "Links state is not inactive as expected" )
+                        main.log.report(
+                            "Links state is not inactive as expected" )
                         links_state_result = main.FALSE
 
         print "links_state_result = ", links_state_result
-        time.sleep(10)
+        time.sleep( 10 )
         flowHandle = main.ONOS3.flows()
-        main.log.info("flows :" + flowHandle)
+        main.log.info( "flows :" + flowHandle )
 
-        main.step("Verify Rerouting by a ping test")
+        main.step( "Verify Rerouting by a ping test" )
         Ping_Result = main.TRUE
-        count = 1        
-        main.log.info("\n\nh1 is Pinging h2")
-        ping = main.LincOE2.pingHostOptical(src="h1", target="h2")
+        count = 1
+        main.log.info( "\n\nh1 is Pinging h2" )
+        ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
         #ping = main.LincOE2.pinghost()
-        if ping == main.FALSE and count<5:
-            count+=1
+        if ping == main.FALSE and count < 5:
+            count += 1
             Ping_Result = main.FALSE
-            main.log.info("Ping between h1 and h2  failed. Making attempt number "+str(count) + " in 2 seconds")
-            time.sleep(2)
-        elif ping==main.FALSE:
-            main.log.info("All ping attempts between h1 and h2 have failed")
+            main.log.info(
+                "Ping between h1 and h2  failed. Making attempt number " +
+                str( count ) +
+                " in 2 seconds" )
+            time.sleep( 2 )
+        elif ping == main.FALSE:
+            main.log.info( "All ping attempts between h1 and h2 have failed" )
             Ping_Result = main.FALSE
-        elif ping==main.TRUE:
-            main.log.info("Ping test between h1 and h2 passed!")
+        elif ping == main.TRUE:
+            main.log.info( "Ping test between h1 and h2 passed!" )
             Ping_Result = main.TRUE
         else:
-            main.log.info("Unknown error")
+            main.log.info( "Unknown error" )
             Ping_Result = main.ERROR
 
-        if Ping_Result==main.TRUE:
-            main.log.report("Ping test successful ")
-        if Ping_Result==main.FALSE:
-            main.log.report("Ping test failed")
+        if Ping_Result == main.TRUE:
+            main.log.report( "Ping test successful " )
+        if Ping_Result == main.FALSE:
+            main.log.report( "Ping test failed" )
 
         case24_result = Ping_Result and links_state_result
-        utilities.assert_equals(expect=main.TRUE, actual=case24_result,
-                onpass="Packet optical rerouting successful",
-                onfail="Packet optical rerouting failed")
+        utilities.assert_equals( expect=main.TRUE, actual=case24_result,
+                                 onpass="Packet optical rerouting successful",
+                                 onfail="Packet optical rerouting failed" )
 
-    def CASE4(self, main):
+    def CASE4( self, main ):
         import re
         import time
-        main.log.report("This testcase is testing the assignment of all the switches to all the controllers and discovering the hosts in reactive mode")
-        main.log.report("__________________________________")
-        main.case("Pingall Test")
-        main.step("Assigning switches to controllers")
-        for i in range(1,29):
-            if i ==1:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=2 and i<5:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=5 and i<8:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=8 and i<18:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
-            elif i>=18 and i<28:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+        main.log.report(
+            "This testcase is testing the assignment of all the switches to all the controllers and discovering the hosts in reactive mode" )
+        main.log.report( "__________________________________" )
+        main.case( "Pingall Test" )
+        main.step( "Assigning switches to controllers" )
+        for i in range( 1, 29 ):
+            if i == 1:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 2 and i < 5:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 5 and i < 8:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 8 and i < 18:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
+            elif i >= 18 and i < 28:
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
             else:
-                main.Mininet1.assign_sw_controller(sw=str(i),ip1=ONOS1_ip,port1=ONOS1_port)
+                main.Mininet1.assign_sw_controller(
+                    sw=str( i ),
+                    ip1=ONOS1_ip,
+                    port1=ONOS1_port )
         Switch_Mastership = main.TRUE
-        for i in range (1,29):
-            if i==1:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+        for i in range( 1, 29 ):
+            if i == 1:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=2 and i<5:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 2 and i < 5:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=5 and i<8:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 5 and i < 8:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=8 and i<18:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 8 and i < 18:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
-            elif i>=18 and i<28:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is " + str(response))
-                if re.search("tcp:"+ONOS1_ip,response):
+            elif i >= 18 and i < 28:
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is " + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
             else:
-                response = main.Mininet1.get_sw_controller("s"+str(i))
-                print("Response is" + str(response))
-                if re.search("tcp:" +ONOS1_ip,response):
+                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                print( "Response is" + str( response ) )
+                if re.search( "tcp:" + ONOS1_ip, response ):
                     Switch_Mastership = Switch_Mastership and main.TRUE
                 else:
                     Switch_Mastership = main.FALSE
 
         if Switch_Mastership == main.TRUE:
-            main.log.report("Controller assignmnet successful")
+            main.log.report( "Controller assignmnet successful" )
         else:
-            main.log.report("Controller assignmnet failed")
-        utilities.assert_equals(expect = main.TRUE,actual=Switch_Mastership,
-                onpass="MasterControllers assigned correctly")
-        '''
-        for i in range (1,29):
-            main.Mininet1.assign_sw_controller(sw=str(i),count=5,
+            main.log.report( "Controller assignmnet failed" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Switch_Mastership,
+            onpass="MasterControllers assigned correctly" )
+        """
+        for i in range ( 1,29 ):
+            main.Mininet1.assign_sw_controller( sw=str( i ),count=5,
                     ip1=ONOS1_ip,port1=ONOS1_port,
                     ip2=ONOS2_ip,port2=ONOS2_port,
                     ip3=ONOS3_ip,port3=ONOS3_port,
                     ip4=ONOS4_ip,port4=ONOS4_port,
-                    ip5=ONOS5_ip,port5=ONOS5_port)
-        '''
-        #REACTIVE FWD test
+                    ip5=ONOS5_ip,port5=ONOS5_port )
+        """
+        # REACTIVE FWD test
 
-        main.step("Get list of hosts from Mininet")
+        main.step( "Get list of hosts from Mininet" )
         host_list = main.Mininet1.get_hosts()
-        main.log.info(host_list)
+        main.log.info( host_list )
 
-        main.step("Get host list in ONOS format")
-        host_onos_list = main.ONOS2.get_hosts_id(host_list)
-        main.log.info(host_onos_list)
-        #time.sleep(5)
-        
-        main.step("Pingall")
+        main.step( "Get host list in ONOS format" )
+        host_onos_list = main.ONOS2.get_hosts_id( host_list )
+        main.log.info( host_onos_list )
+        # time.sleep( 5 )
+
+        main.step( "Pingall" )
         ping_result = main.FALSE
         while ping_result == main.FALSE:
             time1 = time.time()
             ping_result = main.Mininet1.pingall()
             time2 = time.time()
-            print "Time for pingall: %2f seconds" % (time2 - time1)
-      
-        #Start onos cli again because u might have dropped out of onos prompt to the shell prompt
-        #if there was no activity
-        main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+            print "Time for pingall: %2f seconds" % ( time2 - time1 )
+
+        # Start onos cli again because u might have dropped out of onos prompt to the shell prompt
+        # if there was no activity
+        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
 
         case4_result = Switch_Mastership and ping_result
         if ping_result == main.TRUE:
-            main.log.report("Pingall Test in reactive mode to discover the hosts successful") 
+            main.log.report(
+                "Pingall Test in reactive mode to discover the hosts successful" )
         else:
-            main.log.report("Pingall Test in reactive mode to discover the hosts failed")
+            main.log.report(
+                "Pingall Test in reactive mode to discover the hosts failed" )
 
-        utilities.assert_equals(expect=main.TRUE, actual=case4_result,onpass="Controller assignment and Pingall Test successful",onfail="Controller assignment and Pingall Test NOT successful")   
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case4_result,
+            onpass="Controller assignment and Pingall Test successful",
+            onfail="Controller assignment and Pingall Test NOT successful" )
 
-    def CASE10(self):
-        main.log.report("This testcase uninstalls the reactive forwarding app")
-        main.log.report("__________________________________")
-        main.case("Uninstalling reactive forwarding app")
-        #Unistall onos-app-fwd app to disable reactive forwarding
-        appUninstall_result = main.ONOS2.feature_uninstall("onos-app-fwd")
-        main.log.info("onos-app-fwd uninstalled")
+    def CASE10( self ):
+        main.log.report(
+            "This testcase uninstalls the reactive forwarding app" )
+        main.log.report( "__________________________________" )
+        main.case( "Uninstalling reactive forwarding app" )
+        # Unistall onos-app-fwd app to disable reactive forwarding
+        appUninstall_result = main.ONOS2.feature_uninstall( "onos-app-fwd" )
+        main.log.info( "onos-app-fwd uninstalled" )
 
-        #After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
-        #So sleep for 15s
-        time.sleep(15)
+        # After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        # So sleep for 15s
+        time.sleep( 15 )
 
         flows = main.ONOS2.flows()
-        main.log.info(flows)
+        main.log.info( flows )
 
         case10_result = appUninstall_result
-        utilities.assert_equals(expect=main.TRUE, actual=case10_result,onpass="Reactive forwarding app uninstallation successful",onfail="Reactive forwarding app uninstallation failed") 
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case10_result,
+            onpass="Reactive forwarding app uninstallation successful",
+            onfail="Reactive forwarding app uninstallation failed" )
 
-    
-    def CASE6(self):
-        main.log.report("This testcase is testing the addition of host intents and then does pingall")
-        main.log.report("__________________________________")
-        main.case("Obtaining host id's")
-        main.step("Get hosts")
+    def CASE6( self ):
+        main.log.report(
+            "This testcase is testing the addition of host intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.case( "Obtaining host id's" )
+        main.step( "Get hosts" )
         hosts = main.ONOS2.hosts()
-        #main.log.info(hosts)
+        # main.log.info( hosts )
 
-        main.step("Get all devices id")
+        main.step( "Get all devices id" )
         devices_id_list = main.ONOS2.get_all_devices_id()
-        #main.log.info(devices_id_list)
-        
-        #ONOS displays the hosts in hex format unlike mininet which does in decimal format
-        #So take care while adding intents
-        '''
-        main.step("Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1")
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1") 
-        hth_intent_result = main.ONOS2.add_host_intent("00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1")
-        print "_____________________________________________________________________________________"
-        '''
-        
-        for i in range(8,18):
-            main.log.info("Adding host intent between h"+str(i)+" and h"+str(i+10))
-            host1 =  "00:00:00:00:00:" + str(hex(i)[2:]).zfill(2).upper()
-            host2 =  "00:00:00:00:00:" + str(hex(i+10)[2:]).zfill(2).upper()
-            #NOTE: get host can return None
-            #TODO: handle this
-            host1_id = main.ONOS2.get_host(host1)['id']
-            host2_id = main.ONOS2.get_host(host2)['id']
-            tmp_result = main.ONOS2.add_host_intent(host1_id, host2_id )        
+        # main.log.info( devices_id_list )
 
-        time.sleep(10)
-        h_intents = main.ONOS2.intents(json_format = False)
-        main.log.info("intents:" +h_intents)
+        # ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        # So take care while adding intents
+        """
+        main.step( "Add host-to-host intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+        hth_intent_result = main.ONOS2.add_host_intent( "00:00:00:00:00:11/-1", "00:00:00:00:00:1B/-1" )
+        print "_____________________________________________________________________________________"
+        """
+        for i in range( 8, 18 ):
+            main.log.info(
+                "Adding host intent between h" + str( i ) + " and h" + str( i + 10 ) )
+            host1 = "00:00:00:00:00:" + \
+                str( hex( i )[ 2: ] ).zfill( 2 ).upper()
+            host2 = "00:00:00:00:00:" + \
+                str( hex( i + 10 )[ 2: ] ).zfill( 2 ).upper()
+            # NOTE: get host can return None
+            # TODO: handle this
+            host1_id = main.ONOS2.get_host( host1 )[ 'id' ]
+            host2_id = main.ONOS2.get_host( host2 )[ 'id' ]
+            tmp_result = main.ONOS2.add_host_intent( host1_id, host2_id )
+
+        time.sleep( 10 )
+        h_intents = main.ONOS2.intents( json_format=False )
+        main.log.info( "intents:" + h_intents )
         flowHandle = main.ONOS2.flows()
-        #main.log.info("flow:" +flowHandle)
+        #main.log.info( "flow:" +flowHandle )
 
         count = 1
         i = 8
         Ping_Result = main.TRUE
-        #while i<10:
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping == main.FALSE and count <5:
-                count+=1
+        # while i<10:
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
                 #i = 8
                 Ping_Result = main.FALSE
-                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
-                i=19
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
                 Ping_Result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
-                i+=1
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
                 Ping_Result = main.TRUE
             else:
-                main.log.info("Unknown error")
+                main.log.info( "Unknown error" )
                 Ping_Result = main.ERROR
-        if Ping_Result==main.FALSE:
-            main.log.report("Ping all test after Host intent addition failed. Cleaning up")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.TRUE:
-            main.log.report("Ping all test after Host intent addition successful")
-            
+        if Ping_Result == main.FALSE:
+            main.log.report(
+                "Ping all test after Host intent addition failed. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if Ping_Result == main.TRUE:
+            main.log.report(
+                "Ping all test after Host intent addition successful" )
+
         case6_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case6_result,
-                onpass="Pingall Test after Host intents addition successful",
-                onfail="Pingall Test after Host intents addition failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case6_result,
+            onpass="Pingall Test after Host intents addition successful",
+            onfail="Pingall Test after Host intents addition failed" )
 
-
-    def CASE5(self,main) :
+    def CASE5( self, main ):
         import json
         from subprocess import Popen, PIPE
-        from sts.topology.teston_topology import TestONTopology # assumes that sts is already in you PYTHONPATH
-        #main.ONOS2.start_onos_cli(ONOS_ip=main.params['CTRL']['ip1'])
+        # assumes that sts is already in you PYTHONPATH
+        from sts.topology.teston_topology import TestONTopology
+        # main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
         deviceResult = main.ONOS2.devices()
         linksResult = main.ONOS2.links()
         #portsResult = main.ONOS2.ports()
         print "**************"
 
-        main.log.report("This testcase is testing if all ONOS nodes are in topology sync with mininet")
-        main.log.report("__________________________________")
-        main.case("Comparing Mininet topology with the topology of ONOS")
-        main.step("Start continuous pings")
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],
-                            target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],
-                            target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],
-                            target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],
-                            target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],
-                            target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],
-                            target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],
-                            target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],
-                            target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],
-                            target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],
-                            target=main.params['PING']['target10'],pingTime=500)
+        main.log.report(
+            "This testcase is testing if all ONOS nodes are in topology sync with mininet" )
+        main.log.report( "__________________________________" )
+        main.case( "Comparing Mininet topology with the topology of ONOS" )
+        main.step( "Start continuous pings" )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source1' ],
+            target=main.params[ 'PING' ][ 'target1' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source2' ],
+            target=main.params[ 'PING' ][ 'target2' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source3' ],
+            target=main.params[ 'PING' ][ 'target3' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source4' ],
+            target=main.params[ 'PING' ][ 'target4' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source5' ],
+            target=main.params[ 'PING' ][ 'target5' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source6' ],
+            target=main.params[ 'PING' ][ 'target6' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source7' ],
+            target=main.params[ 'PING' ][ 'target7' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source8' ],
+            target=main.params[ 'PING' ][ 'target8' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source9' ],
+            target=main.params[ 'PING' ][ 'target9' ],
+            pingTime=500 )
+        main.Mininet2.pingLong(
+            src=main.params[ 'PING' ][ 'source10' ],
+            target=main.params[ 'PING' ][ 'target10' ],
+            pingTime=500 )
 
-        main.step("Create TestONTopology object")
+        main.step( "Create TestONTopology object" )
         global ctrls
         ctrls = []
         count = 1
         while True:
             temp = ()
-            if ('ip' + str(count)) in main.params['CTRL']:
-                temp = temp + (getattr(main,('ONOS' + str(count))),)
-                temp = temp + ("ONOS"+str(count),)
-                temp = temp + (main.params['CTRL']['ip'+str(count)],)
-                temp = temp + (eval(main.params['CTRL']['port'+str(count)]),)
-                ctrls.append(temp)
+            if ( 'ip' + str( count ) ) in main.params[ 'CTRL' ]:
+                temp = temp + ( getattr( main, ( 'ONOS' + str( count ) ) ), )
+                temp = temp + ( "ONOS" + str( count ), )
+                temp = temp + ( main.params[ 'CTRL' ][ 'ip' + str( count ) ], )
+                temp = temp + \
+                    ( eval( main.params[ 'CTRL' ][ 'port' + str( count ) ] ), )
+                ctrls.append( temp )
                 count = count + 1
             else:
                 break
         global MNTopo
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
         MNTopo = Topo
 
         Topology_Check = main.TRUE
-        main.step("Compare ONOS Topology to MN Topology")
+        main.step( "Compare ONOS Topology to MN Topology" )
         devices_json = main.ONOS2.devices()
         links_json = main.ONOS2.links()
         #ports_json = main.ONOS2.ports()
         print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
+
+        result1 = main.Mininet1.compare_switches(
+            MNTopo,
+            json.loads( devices_json ) )
+        result2 = main.Mininet1.compare_links(
+            MNTopo,
+            json.loads( links_json ) )
+        #result3 = main.Mininet1.compare_ports( MNTopo, json.loads( ports_json ) )
+
         #result = result1 and result2 and result3
         result = result1 and result2
-        
+
         print "***********************"
         if result == main.TRUE:
-            main.log.report("ONOS"+ " Topology matches MN Topology")
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
         else:
-            main.log.report("ONOS"+ " Topology does not match MN Topology") 
+            main.log.report( "ONOS" + " Topology does not match MN Topology" )
 
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-            onpass="ONOS" + " Topology matches MN Topology",
-            onfail="ONOS" + " Topology does not match MN Topology")
-        
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
         Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Topology_Check,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
 
-    def CASE7 (self,main):
-       
-        ONOS1_ip = main.params['CTRL']['ip1']
+    def CASE7( self, main ):
 
-        link_sleep = int(main.params['timers']['LinkDiscovery'])
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.log.report("This testscase is killing a link to ensure that link discovery is consistent")
-        main.log.report("__________________________________")
-        main.log.report("Killing a link to ensure that link discovery is consistent")
-        main.case("Killing a link to Ensure that Link Discovery is Working Properly")
-        '''
-        main.step("Start continuous pings")
-       
-        main.Mininet2.pingLong(src=main.params['PING']['source1'],
-                            target=main.params['PING']['target1'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source2'],
-                            target=main.params['PING']['target2'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source3'],
-                            target=main.params['PING']['target3'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source4'],
-                            target=main.params['PING']['target4'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source5'],
-                            target=main.params['PING']['target5'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source6'],
-                            target=main.params['PING']['target6'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source7'],
-                            target=main.params['PING']['target7'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source8'],
-                            target=main.params['PING']['target8'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source9'],
-                            target=main.params['PING']['target9'],pingTime=500)
-        main.Mininet2.pingLong(src=main.params['PING']['source10'],
-                            target=main.params['PING']['target10'],pingTime=500)
-        '''
+        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        main.step("Determine the current number of switches and links")
+        main.log.report(
+            "This testscase is killing a link to ensure that link discovery is consistent" )
+        main.log.report( "__________________________________" )
+        main.log.report(
+            "Killing a link to ensure that link discovery is consistent" )
+        main.case(
+            "Killing a link to Ensure that Link Discovery is Working Properly" )
+        """
+        main.step( "Start continuous pings" )
+
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source1' ],
+                            target=main.params[ 'PING' ][ 'target1' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
+                            target=main.params[ 'PING' ][ 'target2' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
+                            target=main.params[ 'PING' ][ 'target3' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
+                            target=main.params[ 'PING' ][ 'target4' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
+                            target=main.params[ 'PING' ][ 'target5' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
+                            target=main.params[ 'PING' ][ 'target6' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
+                            target=main.params[ 'PING' ][ 'target7' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
+                            target=main.params[ 'PING' ][ 'target8' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
+                            target=main.params[ 'PING' ][ 'target9' ],pingTime=500 )
+        main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
+                            target=main.params[ 'PING' ][ 'target10' ],pingTime=500 )
+        """
+        main.step( "Determine the current number of switches and links" )
         topology_output = main.ONOS2.topology()
-        topology_result = main.ONOS1.get_topology(topology_output)
-        activeSwitches = topology_result['devices']
-        links = topology_result['links']
-        print "activeSwitches = ", type(activeSwitches)
-        print "links = ", type(links)
-        main.log.info("Currently there are %s switches and %s links"  %(str(activeSwitches), str(links)))
+        topology_result = main.ONOS1.get_topology( topology_output )
+        activeSwitches = topology_result[ 'devices' ]
+        links = topology_result[ 'links' ]
+        print "activeSwitches = ", type( activeSwitches )
+        print "links = ", type( links )
+        main.log.info(
+            "Currently there are %s switches and %s links" %
+            ( str( activeSwitches ), str( links ) ) )
 
-        main.step("Kill Link between s3 and s28")
-        main.Mininet1.link(END1="s3",END2="s28",OPTION="down")
-        time.sleep(link_sleep)
+        main.step( "Kill Link between s3 and s28" )
+        main.Mininet1.link( END1="s3", END2="s28", OPTION="down" )
+        time.sleep( link_sleep )
         topology_output = main.ONOS2.topology()
-        Link_Down = main.ONOS1.check_status(topology_output,activeSwitches,str(int(links)-2))
+        Link_Down = main.ONOS1.check_status(
+            topology_output, activeSwitches, str(
+                int( links ) - 2 ) )
         if Link_Down == main.TRUE:
-            main.log.report("Link Down discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Down,
-                onpass="Link Down discovered properly",
-                onfail="Link down was not discovered in "+ str(link_sleep) + " seconds")
-       
-        #Check ping result here..add code for it
-         
-        main.step("Bring link between s3 and s28 back up")
-        Link_Up = main.Mininet1.link(END1="s3",END2="s28",OPTION="up")
-        time.sleep(link_sleep)
+            main.log.report( "Link Down discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Link_Down,
+            onpass="Link Down discovered properly",
+            onfail="Link down was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        # Check ping result here..add code for it
+
+        main.step( "Bring link between s3 and s28 back up" )
+        Link_Up = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+        time.sleep( link_sleep )
         topology_output = main.ONOS2.topology()
-        Link_Up = main.ONOS1.check_status(topology_output,activeSwitches,str(links))
+        Link_Up = main.ONOS1.check_status(
+            topology_output,
+            activeSwitches,
+            str( links ) )
         if Link_Up == main.TRUE:
-            main.log.report("Link up discovered properly")
-        utilities.assert_equals(expect=main.TRUE,actual=Link_Up,
-                onpass="Link up discovered properly",
-                onfail="Link up was not discovered in "+ str(link_sleep) + " seconds")
-            
-        #NOTE Check ping result here..add code for it
-        
-        
-        main.step("Compare ONOS Topology to MN Topology")
-        Topo = TestONTopology(main.Mininet1, ctrls) # can also add Intent API info for intent operations
+            main.log.report( "Link up discovered properly" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Link_Up,
+            onpass="Link up discovered properly",
+            onfail="Link up was not discovered in " +
+            str( link_sleep ) +
+            " seconds" )
+
+        # NOTE Check ping result here..add code for it
+
+        main.step( "Compare ONOS Topology to MN Topology" )
+        Topo = TestONTopology(
+            main.Mininet1,
+            ctrls )  # can also add Intent API info for intent operations
         MNTopo = Topo
         Topology_Check = main.TRUE
-        
+
         devices_json = main.ONOS2.devices()
         links_json = main.ONOS2.links()
         ports_json = main.ONOS2.ports()
         print "devices_json= ", devices_json
-        
-        result1 = main.Mininet1.compare_switches(MNTopo, json.loads(devices_json))
-        result2 = main.Mininet1.compare_links(MNTopo, json.loads(links_json))
-        #result3 = main.Mininet1.compare_ports(MNTopo, json.loads(ports_json))
-            
+
+        result1 = main.Mininet1.compare_switches(
+            MNTopo,
+            json.loads( devices_json ) )
+        result2 = main.Mininet1.compare_links(
+            MNTopo,
+            json.loads( links_json ) )
+        #result3 = main.Mininet1.compare_ports( MNTopo, json.loads( ports_json ) )
+
         #result = result1 and result2 and result3
         result = result1 and result2
         print "***********************"
-        
+
         if result == main.TRUE:
-            main.log.report("ONOS"+ " Topology matches MN Topology")
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-            onpass="ONOS" + " Topology matches MN Topology",
-            onfail="ONOS" + " Topology does not match MN Topology")
-        
+            main.log.report( "ONOS" + " Topology matches MN Topology" )
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=result,
+            onpass="ONOS" +
+            " Topology matches MN Topology",
+            onfail="ONOS" +
+            " Topology does not match MN Topology" )
+
         Topology_Check = Topology_Check and result
-        utilities.assert_equals(expect=main.TRUE,actual=Topology_Check,
-            onpass="Topology checks passed", onfail="Topology checks failed")
-    
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=Topology_Check,
+            onpass="Topology checks passed",
+            onfail="Topology checks failed" )
+
         result = Link_Down and Link_Up and Topology_Check
-        utilities.assert_equals(expect=main.TRUE,actual=result,
-                onpass="Link failure is discovered correctly",
-                onfail="Link Discovery failed")
+        utilities.assert_equals( expect=main.TRUE, actual=result,
+                                 onpass="Link failure is discovered correctly",
+                                 onfail="Link Discovery failed" )
 
-
-    def CASE8(self):
-        '''
+    def CASE8( self ):
+        """
         Host intents removal
-        ''' 
-        main.log.report("This testcase removes any previously added intents before adding the same intents or point intents")
-        main.log.report("__________________________________")        
-        main.log.info("Host intents removal")
-        main.case("Removing host intents")
-        main.step("Obtain the intent id's")
-        intent_result = main.ONOS2.intents(json_format = False)
-        main.log.info("intent_result = " +intent_result)        
- 
-        intent_linewise = intent_result.split("\n")
+        """
+        main.log.report(
+            "This testcase removes any previously added intents before adding the same intents or point intents" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Host intents removal" )
+        main.case( "Removing host intents" )
+        main.step( "Obtain the intent id's" )
+        intent_result = main.ONOS2.intents( json_format=False )
+        main.log.info( "intent_result = " + intent_result )
+
+        intent_linewise = intent_result.split( "\n" )
         intentList = []
         for line in intent_linewise:
-            if line.startswith("id="):
-                intentList.append(line)
-        
+            if line.startswith( "id=" ):
+                intentList.append( line )
+
         intentids = []
         for line in intentList:
-            intentids.append(line.split(",")[0].split("=")[1])
+            intentids.append( line.split( "," )[ 0 ].split( "=" )[ 1 ] )
         for id in intentids:
             print "id = ", id
-        
-        main.step("Iterate through the intentids list and remove each intent")
+
+        main.step(
+            "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOS2.remove_intent(intent_id = id)
-        
-        intent_result = main.ONOS2.intents(json_format = False)
-        main.log.info("intent_result = " +intent_result)        
+            main.ONOS2.remove_intent( intent_id=id )
+
+        intent_result = main.ONOS2.intents( json_format=False )
+        main.log.info( "intent_result = " + intent_result )
 
         case8_result = main.TRUE
         if case8_result == main.TRUE:
-            main.log.report("Intent removal successful")
+            main.log.report( "Intent removal successful" )
         else:
-            main.log.report("Intent removal failed")
-       
+            main.log.report( "Intent removal failed" )
+
         Ping_Result = main.TRUE
         if case8_result == main.TRUE:
             i = 8
-            while i <18 :
-                main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-                ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-                if ping==main.TRUE:
+            while i < 18:
+                main.log.info(
+                    "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+                ping = main.Mininet1.pingHost(
+                    src="h" + str( i ), target="h" + str( i + 10 ) )
+                if ping == main.TRUE:
                     i = 19
                     Ping_Result = Ping_Result and main.TRUE
-                elif ping==main.FALSE:
-                    i+=1
+                elif ping == main.FALSE:
+                    i += 1
                     Ping_Result = Ping_Result and main.FALSE
                 else:
-                    main.log.info("Unknown error")
+                    main.log.info( "Unknown error" )
                     Ping_Result = main.ERROR
 
-            #Note: If the ping result failed, that means the intents have been withdrawn correctly.
-        if Ping_Result==main.TRUE:
-            main.log.report("Host intents have not been withdrawn correctly")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.FALSE:
-            main.log.report("Host intents have been withdrawn correctly")
+            # Note: If the ping result failed, that means the intents have been
+            # withdrawn correctly.
+        if Ping_Result == main.TRUE:
+            main.log.report( "Host intents have not been withdrawn correctly" )
+            # main.cleanup()
+            # main.exit()
+        if Ping_Result == main.FALSE:
+            main.log.report( "Host intents have been withdrawn correctly" )
 
         case8_result = case8_result and Ping_Result
 
         if case8_result == main.FALSE:
-            main.log.report("Intent removal successful")
+            main.log.report( "Intent removal successful" )
         else:
-            main.log.report("Intent removal failed")
+            main.log.report( "Intent removal failed" )
 
-        utilities.assert_equals(expect=main.FALSE, actual=case8_result,
-                onpass="Intent removal test failed",
-                onfail="Intent removal test passed")
+        utilities.assert_equals( expect=main.FALSE, actual=case8_result,
+                                 onpass="Intent removal test failed",
+                                 onfail="Intent removal test passed" )
 
+    def CASE9( self ):
+        main.log.report(
+            "This testcase adds point intents and then does pingall" )
+        main.log.report( "__________________________________" )
+        main.log.info( "Adding point intents" )
+        main.case(
+            "Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)" )
+        main.step(
+            "Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003008/1",
+            "of:0000000000006018/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-    def CASE9(self):
-        main.log.report("This testcase adds point intents and then does pingall")
-        main.log.report("__________________________________") 
-        main.log.info("Adding point intents")
-        main.case("Adding bidirectional point for mn hosts(h8-h18,h9-h19,h10-h20,h11-h21,h12-h22,h13-h23,h14-h24,h15-h25,h16-h26,h17-h27)") 
-        main.step("Add point-to-point intents for mininet hosts h8 and h18 or ONOS hosts h8 and h12")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003008/1", "of:0000000000006018/1")
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006018/1",
+            "of:0000000000003008/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006018/1", "of:0000000000003008/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        main.step("Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003009/1", "of:0000000000006019/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006019/1", "of:0000000000003009/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-        
-        main.step("Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003010/1", "of:0000000000006020/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006020/1", "of:0000000000003010/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-        main.step("Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003011/1", "of:0000000000006021/1")
+        main.step(
+            "Add point-to-point intents for mininet hosts h9 and h19 or ONOS hosts h9 and h13" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003009/1",
+            "of:0000000000006019/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006021/1", "of:0000000000003011/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003012/1", "of:0000000000006022/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006022/1", "of:0000000000003012/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003013/1", "of:0000000000006023/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006023/1", "of:0000000000003013/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-        main.step("Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003014/1", "of:0000000000006024/1")
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006019/1",
+            "of:0000000000003009/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006024/1", "of:0000000000003014/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003015/1", "of:0000000000006025/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006025/1", "of:0000000000003015/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-            
-        main.step("Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003016/1", "of:0000000000006026/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006026/1", "of:0000000000003016/1")
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-
-        main.step("Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B")
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000003017/1", "of:0000000000006027/1")
+        main.step(
+            "Add point-to-point intents for mininet hosts h10 and h20 or ONOS hosts hA and h14" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003010/1",
+            "of:0000000000006020/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
-       
-        ptp_intent_result = main.ONOS2.add_point_intent("of:0000000000006027/1", "of:0000000000003017/1")
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006020/1",
+            "of:0000000000003010/1" )
         if ptp_intent_result == main.TRUE:
             get_intent_result = main.ONOS2.intents()
-            main.log.info("Point to point intent install successful")
-            #main.log.info(get_intent_result)
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
 
-        print("_______________________________________________________________________________________")
+        main.step(
+            "Add point-to-point intents for mininet hosts h11 and h21 or ONOS hosts hB and h15" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003011/1",
+            "of:0000000000006021/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006021/1",
+            "of:0000000000003011/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h12 and h22 or ONOS hosts hC and h16" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003012/1",
+            "of:0000000000006022/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006022/1",
+            "of:0000000000003012/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h13 and h23 or ONOS hosts hD and h17" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003013/1",
+            "of:0000000000006023/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006023/1",
+            "of:0000000000003013/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h14 and h24 or ONOS hosts hE and h18" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003014/1",
+            "of:0000000000006024/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006024/1",
+            "of:0000000000003014/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h15 and h25 or ONOS hosts hF and h19" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003015/1",
+            "of:0000000000006025/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006025/1",
+            "of:0000000000003015/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h16 and h26 or ONOS hosts h10 and h1A" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003016/1",
+            "of:0000000000006026/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006026/1",
+            "of:0000000000003016/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        main.step(
+            "Add point-to-point intents for mininet hosts h17 and h27 or ONOS hosts h11 and h1B" )
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000003017/1",
+            "of:0000000000006027/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        ptp_intent_result = main.ONOS2.add_point_intent(
+            "of:0000000000006027/1",
+            "of:0000000000003017/1" )
+        if ptp_intent_result == main.TRUE:
+            get_intent_result = main.ONOS2.intents()
+            main.log.info( "Point to point intent install successful" )
+            # main.log.info( get_intent_result )
+
+        print(
+            "_______________________________________________________________________________________" )
 
         flowHandle = main.ONOS2.flows()
-        #print "flowHandle = ", flowHandle
-        main.log.info("flows :" + flowHandle)        
+        # print "flowHandle = ", flowHandle
+        main.log.info( "flows :" + flowHandle )
 
         count = 1
         i = 8
         Ping_Result = main.TRUE
-        while i <18 :
-            main.log.info("\n\nh"+str(i)+" is Pinging h" + str(i+10))
-            ping = main.Mininet1.pingHost(src="h"+str(i),target="h"+str(i+10))
-            if ping == main.FALSE and count <5:
-                count+=1
+        while i < 18:
+            main.log.info(
+                "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
+            ping = main.Mininet1.pingHost(
+                src="h" + str( i ), target="h" + str( i + 10 ) )
+            if ping == main.FALSE and count < 5:
+                count += 1
                 #i = 8
                 Ping_Result = main.FALSE
-                main.log.report("Ping between h" + str(i) + " and h" + str(i+10) + " failed. Making attempt number "+str(count) + " in 2 seconds")
-                time.sleep(2)
-            elif ping==main.FALSE:
-                main.log.report("All ping attempts between h" + str(i) + " and h" + str(i+10) +"have failed")
-                i=19
+                main.log.report( "Ping between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 " failed. Making attempt number " +
+                                 str( count ) +
+                                 " in 2 seconds" )
+                time.sleep( 2 )
+            elif ping == main.FALSE:
+                main.log.report( "All ping attempts between h" +
+                                 str( i ) +
+                                 " and h" +
+                                 str( i +
+                                      10 ) +
+                                 "have failed" )
+                i = 19
                 Ping_Result = main.FALSE
-            elif ping==main.TRUE:
-                main.log.info("Ping test between h" + str(i) + " and h" + str(i+10) + "passed!")
-                i+=1
+            elif ping == main.TRUE:
+                main.log.info( "Ping test between h" +
+                               str( i ) +
+                               " and h" +
+                               str( i +
+                                    10 ) +
+                               "passed!" )
+                i += 1
                 Ping_Result = main.TRUE
             else:
-                main.log.info("Unknown error")
+                main.log.info( "Unknown error" )
                 Ping_Result = main.ERROR
 
-        if Ping_Result==main.FALSE:
-            main.log.report("Point intents have not ben installed correctly. Cleaning up")
-            #main.cleanup()
-            #main.exit()
-        if Ping_Result==main.TRUE:
-            main.log.report("Point Intents have been installed correctly")
+        if Ping_Result == main.FALSE:
+            main.log.report(
+                "Point intents have not ben installed correctly. Cleaning up" )
+            # main.cleanup()
+            # main.exit()
+        if Ping_Result == main.TRUE:
+            main.log.report( "Point Intents have been installed correctly" )
 
         case9_result = Ping_Result
-        utilities.assert_equals(expect=main.TRUE, actual=case9_result,
-                onpass="Point intents addition and Pingall Test successful",
-                onfail="Point intents addition and Pingall Test NOT successful")
-
-
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=case9_result,
+            onpass="Point intents addition and Pingall Test successful",
+            onfail="Point intents addition and Pingall Test NOT successful" )
diff --git a/TestON/tests/SdnIpTest/SdnIpTest.py b/TestON/tests/SdnIpTest/SdnIpTest.py
old mode 100755
new mode 100644
index 4f55c02..081b1ca
--- a/TestON/tests/SdnIpTest/SdnIpTest.py
+++ b/TestON/tests/SdnIpTest/SdnIpTest.py
@@ -2,13 +2,14 @@
 
 # Testing the basic functionality of SDN-IP
 
+
 class SdnIpTest:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
-
-        '''
+    def CASE1( self, main ):
+        """
         Test the SDN-IP functionality
         allRoutes_expected: all expected routes for all BGP peers
         routeIntents_expected: all expected MultiPointToSinglePointIntent intents
@@ -16,230 +17,272 @@
         allRoutes_actual: all routes from ONOS LCI
         routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
         bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
-        '''
+        """
         import time
         import json
         from operator import eq
         # from datetime import datetime
         from time import localtime, strftime
 
-        main.case("The test case is to help to setup the TestON environment and test new drivers")
+        main.case(
+            "The test case is to help to setup the TestON environment and test new drivers" )
         SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
         # all expected routes for all BGP peers
         allRoutes_expected = []
-        main.step("Start to generate routes for all BGP peers")
+        main.step( "Start to generate routes for all BGP peers" )
         # bgpPeerHosts = []
-        # for i in range(3, 5):
-        #    bgpPeerHosts.append("host" + str(i))
-        # main.log.info("BGP Peer Hosts are:" + bgpPeerHosts)
+        # for i in range( 3, 5 ):
+        #    bgpPeerHosts.append( "host" + str( i ) )
+        # main.log.info( "BGP Peer Hosts are:" + bgpPeerHosts )
 
-        # for i in range(3, 5):
-         #   QuaggaCliHost = "QuaggaCliHost" + str(i)
-          #  prefixes = main.QuaggaCliHost.generate_prefixes(3, 10)
+        # for i in range( 3, 5 ):
+        #   QuaggaCliHost = "QuaggaCliHost" + str( i )
+        #  prefixes = main.QuaggaCliHost.generate_prefixes( 3, 10 )
 
-           # main.log.info(prefixes)
-            # allRoutes_expected.append(prefixes)
-        main.log.info("Generate prefixes for host3")
-        prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
-        main.log.info(prefixes_host3)
+        # main.log.info( prefixes )
+        # allRoutes_expected.append( prefixes )
+        main.log.info( "Generate prefixes for host3" )
+        prefixes_host3 = main.QuaggaCliHost3.generate_prefixes( 3, 10 )
+        main.log.info( prefixes_host3 )
         # generate route with next hop
         for prefix in prefixes_host3:
-            allRoutes_expected.append(prefix + "/" + "192.168.20.1")
-        routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
+            allRoutes_expected.append( prefix + "/" + "192.168.20.1" )
+        routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(
+            prefixes_host3,
+            "192.168.20.1",
+            "00:00:00:00:02:02",
+            SDNIP_JSON_FILE_PATH )
 
-        main.log.info("Generate prefixes for host4")
-        prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
-        main.log.info(prefixes_host4)
+        main.log.info( "Generate prefixes for host4" )
+        prefixes_host4 = main.QuaggaCliHost4.generate_prefixes( 4, 10 )
+        main.log.info( prefixes_host4 )
         # generate route with next hop
         for prefix in prefixes_host4:
-            allRoutes_expected.append(prefix + "/" + "192.168.30.1")
-        routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+            allRoutes_expected.append( prefix + "/" + "192.168.30.1" )
+        routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(
+            prefixes_host4,
+            "192.168.30.1",
+            "00:00:00:00:03:01",
+            SDNIP_JSON_FILE_PATH )
 
-        routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
+        routeIntents_expected = routeIntents_expected_host3 + \
+            routeIntents_expected_host4
 
-
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        main.step("Set cell for ONOS-cli environment")
-        main.ONOScli.set_cell(cell_name)
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        main.step( "Set cell for ONOS-cli environment" )
+        main.ONOScli.set_cell( cell_name )
         verify_result = main.ONOSbench.verify_cell()
-        main.log.report("Removing raft logs")
+        main.log.report( "Removing raft logs" )
         main.ONOSbench.onos_remove_raft_logs()
-        main.log.report("Uninstalling ONOS")
-        main.ONOSbench.onos_uninstall(ONOS1_ip)
-        main.step("Creating ONOS package")
+        main.log.report( "Uninstalling ONOS" )
+        main.ONOSbench.onos_uninstall( ONOS1_ip )
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-        main.step("Starting ONOS service")
+        main.step( "Starting ONOS service" )
         # TODO: start ONOS from Mininet Script
-        # start_result = main.ONOSbench.onos_start("127.0.0.1")
-        main.step("Installing ONOS package")
-        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+        # start_result = main.ONOSbench.onos_start( "127.0.0.1" )
+        main.step( "Installing ONOS package" )
+        onos1_install_result = main.ONOSbench.onos_install(
+            options="-f",
+            node=ONOS1_ip )
 
-        main.step("Checking if ONOS is up yet")
-        time.sleep(60)
-        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        main.step( "Checking if ONOS is up yet" )
+        time.sleep( 60 )
+        onos1_isup = main.ONOSbench.isup( ONOS1_ip )
         if not onos1_isup:
-            main.log.report("ONOS1 didn't start!")
+            main.log.report( "ONOS1 didn't start!" )
 
-        main.step("Start ONOS-cli")
+        main.step( "Start ONOS-cli" )
         # TODO: change the hardcode in start_onos_cli method in ONOS CLI driver
 
-        main.ONOScli.start_onos_cli(ONOS1_ip)
+        main.ONOScli.start_onos_cli( ONOS1_ip )
 
-        main.step("Get devices in the network")
-        list_result = main.ONOScli.devices(json_format=False)
-        main.log.info(list_result)
-        time.sleep(10)
-        main.log.info("Installing sdn-ip feature")
-        main.ONOScli.feature_install("onos-app-sdnip")
-        time.sleep(10)
-        main.step("Login all BGP peers and add routes into peers")
-        main.log.info("Login Quagga CLI on host3")
-        main.QuaggaCliHost3.loginQuagga("1.168.30.2")
-        main.log.info("Enter configuration model of Quagga CLI on host3")
-        main.QuaggaCliHost3.enter_config(64514)
-        main.log.info("Add routes to Quagga on host3")
-        main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
+        main.step( "Get devices in the network" )
+        list_result = main.ONOScli.devices( json_format=False )
+        main.log.info( list_result )
+        time.sleep( 10 )
+        main.log.info( "Installing sdn-ip feature" )
+        main.ONOScli.feature_install( "onos-app-sdnip" )
+        time.sleep( 10 )
+        main.step( "Login all BGP peers and add routes into peers" )
+        main.log.info( "Login Quagga CLI on host3" )
+        main.QuaggaCliHost3.loginQuagga( "1.168.30.2" )
+        main.log.info( "Enter configuration model of Quagga CLI on host3" )
+        main.QuaggaCliHost3.enter_config( 64514 )
+        main.log.info( "Add routes to Quagga on host3" )
+        main.QuaggaCliHost3.add_routes( prefixes_host3, 1 )
 
-        main.log.info("Login Quagga CLI on host4")
-        main.QuaggaCliHost4.loginQuagga("1.168.30.3")
-        main.log.info("Enter configuration model of Quagga CLI on host4")
-        main.QuaggaCliHost4.enter_config(64516)
-        main.log.info("Add routes to Quagga on host4")
-        main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
-        time.sleep(60)
+        main.log.info( "Login Quagga CLI on host4" )
+        main.QuaggaCliHost4.loginQuagga( "1.168.30.3" )
+        main.log.info( "Enter configuration model of Quagga CLI on host4" )
+        main.QuaggaCliHost4.enter_config( 64516 )
+        main.log.info( "Add routes to Quagga on host4" )
+        main.QuaggaCliHost4.add_routes( prefixes_host4, 1 )
+        time.sleep( 60 )
 
         # get all routes inside SDN-IP
-        get_routes_result = main.ONOScli.routes(json_format=True)
+        get_routes_result = main.ONOScli.routes( json_format=True )
 
         # parse routes from ONOS CLI
-        allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+        allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
+            get_routes_result )
 
-        allRoutes_str_expected = str(sorted(allRoutes_expected))
-        allRoutes_str_actual = str(allRoutes_actual).replace('u', "")
-        main.step("Check routes installed")
-        main.log.info("Routes expected:")
-        main.log.info(allRoutes_str_expected)
-        main.log.info("Routes get from ONOS CLI:")
-        main.log.info(allRoutes_str_actual)
-        utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
-                                onpass="***Routes in SDN-IP are correct!***",
-                                onfail="***Routes in SDN-IP are wrong!***")
-        if(eq(allRoutes_str_expected, allRoutes_str_actual)):
-            main.log.report("***Routes in SDN-IP after adding routes are correct!***")
+        allRoutes_str_expected = str( sorted( allRoutes_expected ) )
+        allRoutes_str_actual = str( allRoutes_actual ).replace( 'u', "" )
+        main.step( "Check routes installed" )
+        main.log.info( "Routes expected:" )
+        main.log.info( allRoutes_str_expected )
+        main.log.info( "Routes get from ONOS CLI:" )
+        main.log.info( allRoutes_str_actual )
+        utilities.assert_equals(
+            expect=allRoutes_str_expected,
+            actual=allRoutes_str_actual,
+            onpass="***Routes in SDN-IP are correct!***",
+            onfail="***Routes in SDN-IP are wrong!***" )
+        if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+            main.log.report(
+                "***Routes in SDN-IP after adding routes are correct!***" )
         else:
-            main.log.report("***Routes in SDN-IP after adding routes are wrong!***")
+            main.log.report(
+                "***Routes in SDN-IP after adding routes are wrong!***" )
 
-        time.sleep(20)
-        get_intents_result = main.ONOScli.intents(json_format=True)
+        time.sleep( 20 )
+        get_intents_result = main.ONOScli.intents( json_format=True )
 
-
-        main.step("Check MultiPointToSinglePointIntent intents installed")
+        main.step( "Check MultiPointToSinglePointIntent intents installed" )
         # route_intents_expected are generated when generating routes
         # get rpoute intents from ONOS CLI
-        routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
-        routeIntents_str_expected = str(sorted(routeIntents_expected))
-        routeIntents_str_actual = str(routeIntents_actual).replace('u', "")
-        main.log.info("MultiPointToSinglePoint intents expected:")
-        main.log.info(routeIntents_str_expected)
-        main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
-        main.log.info(routeIntents_str_actual)
-        utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
-                                onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
-                                onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
+        routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
+            get_intents_result )
+        routeIntents_str_expected = str( sorted( routeIntents_expected ) )
+        routeIntents_str_actual = str( routeIntents_actual ).replace( 'u', "" )
+        main.log.info( "MultiPointToSinglePoint intents expected:" )
+        main.log.info( routeIntents_str_expected )
+        main.log.info( "MultiPointToSinglePoint intents get from ONOS CLI:" )
+        main.log.info( routeIntents_str_actual )
+        utilities.assert_equals(
+            expect=True,
+            actual=eq(
+                routeIntents_str_expected,
+                routeIntents_str_actual ),
+            onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
+            onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***" )
 
-        if(eq(routeIntents_str_expected, routeIntents_str_actual)):
-            main.log.report("***MultiPointToSinglePoint Intents before deleting routes correct!***")
+        if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+            main.log.report(
+                "***MultiPointToSinglePoint Intents before deleting routes correct!***" )
         else:
-            main.log.report("***MultiPointToSinglePoint Intents before deleting routes wrong!***")
+            main.log.report(
+                "***MultiPointToSinglePoint Intents before deleting routes wrong!***" )
 
-        main.step("Check BGP PointToPointIntent intents installed")
+        main.step( "Check BGP PointToPointIntent intents installed" )
         # bgp intents expected
-        bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+        bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(
+            SDNIP_JSON_FILE_PATH )
         # get BGP intents from ONOS CLI
-        bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
+        bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(
+            get_intents_result )
 
-        bgpIntents_str_expected = str(bgpIntents_expected).replace('u', "")
-        bgpIntents_str_actual = str(bgpIntents_actual)
-        main.log.info("PointToPointIntent intents expected:")
-        main.log.info(bgpIntents_str_expected)
-        main.log.info("PointToPointIntent intents get from ONOS CLI:")
-        main.log.info(bgpIntents_str_actual)
+        bgpIntents_str_expected = str( bgpIntents_expected ).replace( 'u', "" )
+        bgpIntents_str_actual = str( bgpIntents_actual )
+        main.log.info( "PointToPointIntent intents expected:" )
+        main.log.info( bgpIntents_str_expected )
+        main.log.info( "PointToPointIntent intents get from ONOS CLI:" )
+        main.log.info( bgpIntents_str_actual )
 
-        utilities.assert_equals(expect=True, actual=eq(bgpIntents_str_expected, bgpIntents_str_actual),
-                                onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
-                                onfail="***PointToPointIntent Intents in SDN-IP are wrong!***")
+        utilities.assert_equals(
+            expect=True,
+            actual=eq(
+                bgpIntents_str_expected,
+                bgpIntents_str_actual ),
+            onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
+            onfail="***PointToPointIntent Intents in SDN-IP are wrong!***" )
 
-
-        if (eq(bgpIntents_str_expected, bgpIntents_str_actual)):
-            main.log.report("***PointToPointIntent Intents in SDN-IP are correct!***")
+        if ( eq( bgpIntents_str_expected, bgpIntents_str_actual ) ):
+            main.log.report(
+                "***PointToPointIntent Intents in SDN-IP are correct!***" )
         else:
-            main.log.report("***PointToPointIntent Intents in SDN-IP are wrong!***")
-
-
+            main.log.report(
+                "***PointToPointIntent Intents in SDN-IP are wrong!***" )
 
         #============================= Ping Test ========================
         # wait until all MultiPointToSinglePoint
-        time.sleep(20)
+        time.sleep( 20 )
         ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
-        ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
-        ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
-        main.log.info(ping_test_results)
+        ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-before-delete-routes-" + \
+            strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+        ping_test_results = main.QuaggaCliHost.ping_test(
+            "1.168.30.100",
+            ping_test_script,
+            ping_test_results_file )
+        main.log.info( ping_test_results )
 
         # ping test
 
         #============================= Deleting Routes ==================
-        main.step("Check deleting routes installed")
-        main.QuaggaCliHost3.delete_routes(prefixes_host3, 1)
-        main.QuaggaCliHost4.delete_routes(prefixes_host4, 1)
+        main.step( "Check deleting routes installed" )
+        main.QuaggaCliHost3.delete_routes( prefixes_host3, 1 )
+        main.QuaggaCliHost4.delete_routes( prefixes_host4, 1 )
 
-        # main.log.info("main.ONOScli.get_routes_num() = " )
-        # main.log.info(main.ONOScli.get_routes_num())
-        # utilities.assert_equals(expect = "Total SDN-IP routes = 1", actual= main.ONOScli.get_routes_num(),
-        get_routes_result = main.ONOScli.routes(json_format=True)
-        allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
-        main.log.info("allRoutes_actual = ")
-        main.log.info(allRoutes_actual)
+        # main.log.info( "main.ONOScli.get_routes_num() = " )
+        # main.log.info( main.ONOScli.get_routes_num() )
+        # utilities.assert_equals( expect="Total SDN-IP routes = 1", actual=
+        # main.ONOScli.get_routes_num(),
+        get_routes_result = main.ONOScli.routes( json_format=True )
+        allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
+            get_routes_result )
+        main.log.info( "allRoutes_actual = " )
+        main.log.info( allRoutes_actual )
 
-        utilities.assert_equals(expect="[]", actual=str(allRoutes_actual),
-                                onpass="***Route number in SDN-IP is 0, correct!***",
-                                onfail="***Routes number in SDN-IP is not 0, wrong!***")
+        utilities.assert_equals(
+            expect="[]",
+            actual=str( allRoutes_actual ),
+            onpass="***Route number in SDN-IP is 0, correct!***",
+            onfail="***Routes number in SDN-IP is not 0, wrong!***" )
 
-        if(eq(allRoutes_str_expected, allRoutes_str_actual)):
-            main.log.report("***Routes in SDN-IP after deleting correct!***")
+        if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+            main.log.report( "***Routes in SDN-IP after deleting correct!***" )
         else:
-            main.log.report("***Routes in SDN-IP after deleting wrong!***")
+            main.log.report( "***Routes in SDN-IP after deleting wrong!***" )
 
-        main.step("Check intents after deleting routes")
-        get_intents_result = main.ONOScli.intents(json_format=True)
-        routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
-        main.log.info("main.ONOScli.intents()= ")
-        main.log.info(routeIntents_actual)
-        utilities.assert_equals(expect="[]", actual=str(routeIntents_actual),
-                                onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
-                                onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***")
+        main.step( "Check intents after deleting routes" )
+        get_intents_result = main.ONOScli.intents( json_format=True )
+        routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
+            get_intents_result )
+        main.log.info( "main.ONOScli.intents()= " )
+        main.log.info( routeIntents_actual )
+        utilities.assert_equals(
+            expect="[]",
+            actual=str( routeIntents_actual ),
+            onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
+            onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***" )
 
-        if(eq(routeIntents_str_expected, routeIntents_str_actual)):
-            main.log.report("***MultiPointToSinglePoint Intents after deleting routes correct!***")
+        if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+            main.log.report(
+                "***MultiPointToSinglePoint Intents after deleting routes correct!***" )
         else:
-            main.log.report("***MultiPointToSinglePoint Intents after deleting routes wrong!***")
+            main.log.report(
+                "***MultiPointToSinglePoint Intents after deleting routes wrong!***" )
 
-        time.sleep(20)
+        time.sleep( 20 )
         ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
-        ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
-        ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
-        main.log.info(ping_test_results)
-        time.sleep(30)
+        ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE1-ping-results-after-delete-routes-" + \
+            strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+        ping_test_results = main.QuaggaCliHost.ping_test(
+            "1.168.30.100",
+            ping_test_script,
+            ping_test_results_file )
+        main.log.info( ping_test_results )
+        time.sleep( 30 )
 
-        # main.step("Test whether Mininet is started")
-        # main.Mininet2.handle.sendline("xterm host1")
-        # main.Mininet2.handle.expect("mininet>")
+        # main.step( "Test whether Mininet is started" )
+        # main.Mininet2.handle.sendline( "xterm host1" )
+        # main.Mininet2.handle.expect( "mininet>" )
 
-
-    def CASE2(self, main):
-
-        '''
+    def CASE2( self, main ):
+        """
         Test the SDN-IP functionality
         allRoutes_expected: all expected routes for all BGP peers
         routeIntents_expected: all expected MultiPointToSinglePointIntent intents
@@ -247,217 +290,266 @@
         allRoutes_actual: all routes from ONOS LCI
         routeIntents_actual: actual MultiPointToSinglePointIntent intents from ONOS CLI
         bgpIntents_actual: actual PointToPointIntent intents from ONOS CLI
-        '''
+        """
         import time
         import json
         from operator import eq
         from time import localtime, strftime
 
-        main.case("The test case is to help to setup the TestON environment and test new drivers")
+        main.case(
+            "The test case is to help to setup the TestON environment and test new drivers" )
         SDNIP_JSON_FILE_PATH = "../tests/SdnIpTest/sdnip.json"
         # all expected routes for all BGP peers
         allRoutes_expected = []
-        main.step("Start to generate routes for all BGP peers")
+        main.step( "Start to generate routes for all BGP peers" )
 
-        main.log.info("Generate prefixes for host3")
-        prefixes_host3 = main.QuaggaCliHost3.generate_prefixes(3, 10)
-        main.log.info(prefixes_host3)
+        main.log.info( "Generate prefixes for host3" )
+        prefixes_host3 = main.QuaggaCliHost3.generate_prefixes( 3, 10 )
+        main.log.info( prefixes_host3 )
         # generate route with next hop
         for prefix in prefixes_host3:
-            allRoutes_expected.append(prefix + "/" + "192.168.20.1")
-        routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(prefixes_host3, "192.168.20.1", "00:00:00:00:02:02", SDNIP_JSON_FILE_PATH)
+            allRoutes_expected.append( prefix + "/" + "192.168.20.1" )
+        routeIntents_expected_host3 = main.QuaggaCliHost3.generate_expected_onePeerRouteIntents(
+            prefixes_host3,
+            "192.168.20.1",
+            "00:00:00:00:02:02",
+            SDNIP_JSON_FILE_PATH )
 
-        main.log.info("Generate prefixes for host4")
-        prefixes_host4 = main.QuaggaCliHost4.generate_prefixes(4, 10)
-        main.log.info(prefixes_host4)
+        main.log.info( "Generate prefixes for host4" )
+        prefixes_host4 = main.QuaggaCliHost4.generate_prefixes( 4, 10 )
+        main.log.info( prefixes_host4 )
         # generate route with next hop
         for prefix in prefixes_host4:
-            allRoutes_expected.append(prefix + "/" + "192.168.30.1")
-        routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(prefixes_host4, "192.168.30.1", "00:00:00:00:03:01", SDNIP_JSON_FILE_PATH)
+            allRoutes_expected.append( prefix + "/" + "192.168.30.1" )
+        routeIntents_expected_host4 = main.QuaggaCliHost4.generate_expected_onePeerRouteIntents(
+            prefixes_host4,
+            "192.168.30.1",
+            "00:00:00:00:03:01",
+            SDNIP_JSON_FILE_PATH )
 
-        routeIntents_expected = routeIntents_expected_host3 + routeIntents_expected_host4
+        routeIntents_expected = routeIntents_expected_host3 + \
+            routeIntents_expected_host4
 
-        main.log.report("Removing raft logs")
+        main.log.report( "Removing raft logs" )
         main.ONOSbench.onos_remove_raft_logs()
-        main.log.report("Uninstalling ONOS")
-        main.ONOSbench.onos_uninstall(ONOS1_ip)
+        main.log.report( "Uninstalling ONOS" )
+        main.ONOSbench.onos_uninstall( ONOS1_ip )
 
-        cell_name = main.params['ENV']['cellName']
-        ONOS1_ip = main.params['CTRL']['ip1']
-        main.step("Set cell for ONOS-cli environment")
-        main.ONOScli.set_cell(cell_name)
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        main.step( "Set cell for ONOS-cli environment" )
+        main.ONOScli.set_cell( cell_name )
         verify_result = main.ONOSbench.verify_cell()
-        #main.log.report("Removing raft logs")
-        #main.ONOSbench.onos_remove_raft_logs()
-        #main.log.report("Uninstalling ONOS")
-        #main.ONOSbench.onos_uninstall(ONOS1_ip)
-        main.step("Creating ONOS package")
+        #main.log.report( "Removing raft logs" )
+        # main.ONOSbench.onos_remove_raft_logs()
+        #main.log.report( "Uninstalling ONOS" )
+        # main.ONOSbench.onos_uninstall( ONOS1_ip )
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-        main.step("Installing ONOS package")
-        onos1_install_result = main.ONOSbench.onos_install(options="-f", node=ONOS1_ip)
+        main.step( "Installing ONOS package" )
+        onos1_install_result = main.ONOSbench.onos_install(
+            options="-f",
+            node=ONOS1_ip )
 
-        main.step("Checking if ONOS is up yet")
-        time.sleep(60)
-        onos1_isup = main.ONOSbench.isup(ONOS1_ip)
+        main.step( "Checking if ONOS is up yet" )
+        time.sleep( 60 )
+        onos1_isup = main.ONOSbench.isup( ONOS1_ip )
         if not onos1_isup:
-            main.log.report("ONOS1 didn't start!")
+            main.log.report( "ONOS1 didn't start!" )
 
-        main.step("Start ONOS-cli")
-        main.ONOScli.start_onos_cli(ONOS1_ip)
+        main.step( "Start ONOS-cli" )
+        main.ONOScli.start_onos_cli( ONOS1_ip )
 
-        main.step("Get devices in the network")
-        list_result = main.ONOScli.devices(json_format=False)
-        main.log.info(list_result)
-        time.sleep(10)
-        main.log.info("Installing sdn-ip feature")
-        main.ONOScli.feature_install("onos-app-sdnip")
-        time.sleep(10)
+        main.step( "Get devices in the network" )
+        list_result = main.ONOScli.devices( json_format=False )
+        main.log.info( list_result )
+        time.sleep( 10 )
+        main.log.info( "Installing sdn-ip feature" )
+        main.ONOScli.feature_install( "onos-app-sdnip" )
+        time.sleep( 10 )
 
-
-        main.step("Check BGP PointToPointIntent intents installed")
+        main.step( "Check BGP PointToPointIntent intents installed" )
         # bgp intents expected
-        bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(SDNIP_JSON_FILE_PATH)
+        bgpIntents_expected = main.QuaggaCliHost3.generate_expected_bgpIntents(
+            SDNIP_JSON_FILE_PATH )
         # get BGP intents from ONOS CLI
-        get_intents_result = main.ONOScli.intents(json_format=True)
-        bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(get_intents_result)
+        get_intents_result = main.ONOScli.intents( json_format=True )
+        bgpIntents_actual = main.QuaggaCliHost3.extract_actual_bgpIntents(
+            get_intents_result )
 
-        bgpIntents_str_expected = str(bgpIntents_expected).replace('u', "")
-        bgpIntents_str_actual = str(bgpIntents_actual)
-        main.log.info("PointToPointIntent intents expected:")
-        main.log.info(bgpIntents_str_expected)
-        main.log.info("PointToPointIntent intents get from ONOS CLI:")
-        main.log.info(bgpIntents_str_actual)
+        bgpIntents_str_expected = str( bgpIntents_expected ).replace( 'u', "" )
+        bgpIntents_str_actual = str( bgpIntents_actual )
+        main.log.info( "PointToPointIntent intents expected:" )
+        main.log.info( bgpIntents_str_expected )
+        main.log.info( "PointToPointIntent intents get from ONOS CLI:" )
+        main.log.info( bgpIntents_str_actual )
 
-        utilities.assert_equals(expect=True, actual=eq(bgpIntents_str_expected, bgpIntents_str_actual),
-                                onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
-                                onfail="***PointToPointIntent Intents in SDN-IP are wrong!***")
+        utilities.assert_equals(
+            expect=True,
+            actual=eq(
+                bgpIntents_str_expected,
+                bgpIntents_str_actual ),
+            onpass="***PointToPointIntent Intents in SDN-IP are correct!***",
+            onfail="***PointToPointIntent Intents in SDN-IP are wrong!***" )
 
-        if (eq(bgpIntents_str_expected, bgpIntents_str_actual)):
-            main.log.report("***PointToPointIntent Intents in SDN-IP are correct!***")
+        if ( eq( bgpIntents_str_expected, bgpIntents_str_actual ) ):
+            main.log.report(
+                "***PointToPointIntent Intents in SDN-IP are correct!***" )
         else:
-            main.log.report("***PointToPointIntent Intents in SDN-IP are wrong!***")
+            main.log.report(
+                "***PointToPointIntent Intents in SDN-IP are wrong!***" )
 
-
-        allRoutes_str_expected = str(sorted(allRoutes_expected))
-        routeIntents_str_expected = str(sorted(routeIntents_expected))
+        allRoutes_str_expected = str( sorted( allRoutes_expected ) )
+        routeIntents_str_expected = str( sorted( routeIntents_expected ) )
         ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
         # round_num = 0;
-        # while(True):
-        for round_num in range(1, 6):
+        # while( True ):
+        for round_num in range( 1, 6 ):
             # round = round + 1;
-            main.log.report("The Round " + str(round_num) + " test starts........................................")
+            main.log.report(
+                "The Round " +
+                str( round_num ) +
+                " test starts........................................" )
 
-            main.step("Login all BGP peers and add routes into peers")
-            main.log.info("Login Quagga CLI on host3")
-            main.QuaggaCliHost3.loginQuagga("1.168.30.2")
-            main.log.info("Enter configuration model of Quagga CLI on host3")
-            main.QuaggaCliHost3.enter_config(64514)
-            main.log.info("Add routes to Quagga on host3")
-            main.QuaggaCliHost3.add_routes(prefixes_host3, 1)
+            main.step( "Login all BGP peers and add routes into peers" )
+            main.log.info( "Login Quagga CLI on host3" )
+            main.QuaggaCliHost3.loginQuagga( "1.168.30.2" )
+            main.log.info( "Enter configuration model of Quagga CLI on host3" )
+            main.QuaggaCliHost3.enter_config( 64514 )
+            main.log.info( "Add routes to Quagga on host3" )
+            main.QuaggaCliHost3.add_routes( prefixes_host3, 1 )
 
-            main.log.info("Login Quagga CLI on host4")
-            main.QuaggaCliHost4.loginQuagga("1.168.30.3")
-            main.log.info("Enter configuration model of Quagga CLI on host4")
-            main.QuaggaCliHost4.enter_config(64516)
-            main.log.info("Add routes to Quagga on host4")
-            main.QuaggaCliHost4.add_routes(prefixes_host4, 1)
-            time.sleep(60)
+            main.log.info( "Login Quagga CLI on host4" )
+            main.QuaggaCliHost4.loginQuagga( "1.168.30.3" )
+            main.log.info( "Enter configuration model of Quagga CLI on host4" )
+            main.QuaggaCliHost4.enter_config( 64516 )
+            main.log.info( "Add routes to Quagga on host4" )
+            main.QuaggaCliHost4.add_routes( prefixes_host4, 1 )
+            time.sleep( 60 )
 
             # get all routes inside SDN-IP
-            get_routes_result = main.ONOScli.routes(json_format=True)
+            get_routes_result = main.ONOScli.routes( json_format=True )
 
             # parse routes from ONOS CLI
-            allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
+            allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
+                get_routes_result )
 
-            # allRoutes_str_expected = str(sorted(allRoutes_expected))
-            allRoutes_str_actual = str(allRoutes_actual).replace('u', "")
-            main.step("Check routes installed")
-            main.log.info("Routes expected:")
-            main.log.info(allRoutes_str_expected)
-            main.log.info("Routes get from ONOS CLI:")
-            main.log.info(allRoutes_str_actual)
-            utilities.assert_equals(expect=allRoutes_str_expected, actual=allRoutes_str_actual,
-                                    onpass="***Routes in SDN-IP are correct!***",
-                                    onfail="***Routes in SDN-IP are wrong!***")
-            if(eq(allRoutes_str_expected, allRoutes_str_actual)):
-                main.log.report("***Routes in SDN-IP after adding correct!***")
+            # allRoutes_str_expected = str( sorted( allRoutes_expected ) )
+            allRoutes_str_actual = str( allRoutes_actual ).replace( 'u', "" )
+            main.step( "Check routes installed" )
+            main.log.info( "Routes expected:" )
+            main.log.info( allRoutes_str_expected )
+            main.log.info( "Routes get from ONOS CLI:" )
+            main.log.info( allRoutes_str_actual )
+            utilities.assert_equals(
+                expect=allRoutes_str_expected,
+                actual=allRoutes_str_actual,
+                onpass="***Routes in SDN-IP are correct!***",
+                onfail="***Routes in SDN-IP are wrong!***" )
+            if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+                main.log.report(
+                    "***Routes in SDN-IP after adding correct!***" )
             else:
-                main.log.report("***Routes in SDN-IP after adding wrong!***")
+                main.log.report( "***Routes in SDN-IP after adding wrong!***" )
 
-            time.sleep(20)
-            get_intents_result = main.ONOScli.intents(json_format=True)
+            time.sleep( 20 )
+            get_intents_result = main.ONOScli.intents( json_format=True )
 
-
-            main.step("Check MultiPointToSinglePointIntent intents installed")
+            main.step(
+                "Check MultiPointToSinglePointIntent intents installed" )
             # route_intents_expected are generated when generating routes
             # get route intents from ONOS CLI
-            routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
-            # routeIntents_str_expected = str(sorted(routeIntents_expected))
-            routeIntents_str_actual = str(routeIntents_actual).replace('u', "")
-            main.log.info("MultiPointToSinglePoint intents expected:")
-            main.log.info(routeIntents_str_expected)
-            main.log.info("MultiPointToSinglePoint intents get from ONOS CLI:")
-            main.log.info(routeIntents_str_actual)
-            utilities.assert_equals(expect=True, actual=eq(routeIntents_str_expected, routeIntents_str_actual),
-                                    onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
-                                    onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***")
+            routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
+                get_intents_result )
+            # routeIntents_str_expected = str( sorted( routeIntents_expected ) )
+            routeIntents_str_actual = str(
+                routeIntents_actual ).replace( 'u', "" )
+            main.log.info( "MultiPointToSinglePoint intents expected:" )
+            main.log.info( routeIntents_str_expected )
+            main.log.info(
+                "MultiPointToSinglePoint intents get from ONOS CLI:" )
+            main.log.info( routeIntents_str_actual )
+            utilities.assert_equals(
+                expect=True,
+                actual=eq(
+                    routeIntents_str_expected,
+                    routeIntents_str_actual ),
+                onpass="***MultiPointToSinglePoint Intents in SDN-IP are correct!***",
+                onfail="***MultiPointToSinglePoint Intents in SDN-IP are wrong!***" )
 
-            if(eq(routeIntents_str_expected, routeIntents_str_actual)):
-                main.log.report("***MultiPointToSinglePoint Intents after adding routes correct!***")
+            if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+                main.log.report(
+                    "***MultiPointToSinglePoint Intents after adding routes correct!***" )
             else:
-                main.log.report("***MultiPointToSinglePoint Intents after adding routes wrong!***")
+                main.log.report(
+                    "***MultiPointToSinglePoint Intents after adding routes wrong!***" )
 
             #============================= Ping Test ========================
             # wait until all MultiPointToSinglePoint
-            time.sleep(20)
+            time.sleep( 20 )
             # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
-            ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + str(round_num) + "-ping-results-before-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
-            ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
-            main.log.info(ping_test_results)
+            ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + \
+                str( round_num ) + "-ping-results-before-delete-routes-" + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+            ping_test_results = main.QuaggaCliHost.ping_test(
+                "1.168.30.100",
+                ping_test_script,
+                ping_test_results_file )
+            main.log.info( ping_test_results )
             # ping test
 
             #============================= Deleting Routes ==================
-            main.step("Check deleting routes installed")
-            main.log.info("Delete routes to Quagga on host3")
-            main.QuaggaCliHost3.delete_routes(prefixes_host3, 1)
-            main.log.info("Delete routes to Quagga on host4")
-            main.QuaggaCliHost4.delete_routes(prefixes_host4, 1)
+            main.step( "Check deleting routes installed" )
+            main.log.info( "Delete routes to Quagga on host3" )
+            main.QuaggaCliHost3.delete_routes( prefixes_host3, 1 )
+            main.log.info( "Delete routes to Quagga on host4" )
+            main.QuaggaCliHost4.delete_routes( prefixes_host4, 1 )
 
-            get_routes_result = main.ONOScli.routes(json_format=True)
-            allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(get_routes_result)
-            main.log.info("allRoutes_actual = ")
-            main.log.info(allRoutes_actual)
+            get_routes_result = main.ONOScli.routes( json_format=True )
+            allRoutes_actual = main.QuaggaCliHost3.extract_actual_routes(
+                get_routes_result )
+            main.log.info( "allRoutes_actual = " )
+            main.log.info( allRoutes_actual )
 
-            utilities.assert_equals(expect="[]", actual=str(allRoutes_actual),
-                                    onpass="***Route number in SDN-IP is 0, correct!***",
-                                    onfail="***Routes number in SDN-IP is not 0, wrong!***")
+            utilities.assert_equals(
+                expect="[]",
+                actual=str( allRoutes_actual ),
+                onpass="***Route number in SDN-IP is 0, correct!***",
+                onfail="***Routes number in SDN-IP is not 0, wrong!***" )
 
-            if(eq(allRoutes_str_expected, allRoutes_str_actual)):
-                main.log.report("***Routes in SDN-IP after deleting correct!***")
+            if( eq( allRoutes_str_expected, allRoutes_str_actual ) ):
+                main.log.report(
+                    "***Routes in SDN-IP after deleting correct!***" )
             else:
-                main.log.report("***Routes in SDN-IP after deleting wrong!***")
+                main.log.report(
+                    "***Routes in SDN-IP after deleting wrong!***" )
 
-            main.step("Check intents after deleting routes")
-            get_intents_result = main.ONOScli.intents(json_format=True)
-            routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(get_intents_result)
-            main.log.info("main.ONOScli.intents()= ")
-            main.log.info(routeIntents_actual)
-            utilities.assert_equals(expect="[]", actual=str(routeIntents_actual),
-                                    onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
-                                    onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***")
+            main.step( "Check intents after deleting routes" )
+            get_intents_result = main.ONOScli.intents( json_format=True )
+            routeIntents_actual = main.QuaggaCliHost3.extract_actual_routeIntents(
+                get_intents_result )
+            main.log.info( "main.ONOScli.intents()= " )
+            main.log.info( routeIntents_actual )
+            utilities.assert_equals(
+                expect="[]",
+                actual=str( routeIntents_actual ),
+                onpass="***MultiPointToSinglePoint Intents number in SDN-IP is 0, correct!***",
+                onfail="***MultiPointToSinglePoint Intents number in SDN-IP is 0, wrong!***" )
 
-            if(eq(routeIntents_str_expected, routeIntents_str_actual)):
-                main.log.report("***MultiPointToSinglePoint Intents after deleting routes correct!***")
+            if( eq( routeIntents_str_expected, routeIntents_str_actual ) ):
+                main.log.report(
+                    "***MultiPointToSinglePoint Intents after deleting routes correct!***" )
             else:
-                main.log.report("***MultiPointToSinglePoint Intents after deleting routes wrong!***")
+                main.log.report(
+                    "***MultiPointToSinglePoint Intents after deleting routes wrong!***" )
 
-            time.sleep(20)
+            time.sleep( 20 )
             # ping_test_script = "~/SDNIP/SdnIpIntentDemo/CASE1-ping-as2host.sh"
-            ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + str(round_num) + "-ping-results-after-delete-routes-" + strftime("%Y-%m-%d_%H:%M:%S", localtime()) + ".txt"
-            ping_test_results = main.QuaggaCliHost.ping_test("1.168.30.100", ping_test_script, ping_test_results_file)
-            main.log.info(ping_test_results)
-            time.sleep(30)
-
-
-
+            ping_test_results_file = "~/SDNIP/SdnIpIntentDemo/log/CASE2-Round" + \
+                str( round_num ) + "-ping-results-after-delete-routes-" + strftime( "%Y-%m-%d_%H:%M:%S", localtime() ) + ".txt"
+            ping_test_results = main.QuaggaCliHost.ping_test(
+                "1.168.30.100",
+                ping_test_script,
+                ping_test_results_file )
+            main.log.info( ping_test_results )
+            time.sleep( 30 )
diff --git a/TestON/tests/TopoConvNext/TopoConvNext.py b/TestON/tests/TopoConvNext/TopoConvNext.py
index 68d7b5d..c114e48 100644
--- a/TestON/tests/TopoConvNext/TopoConvNext.py
+++ b/TestON/tests/TopoConvNext/TopoConvNext.py
@@ -1,153 +1,155 @@
-#TopoPerfNext
+# TopoPerfNext
 #
-#Topology Convergence scale-out test for ONOS-next
-#NOTE: This test supports up to 7 nodes scale-out scenario
+# Topology Convergence scale-out test for ONOS-next
+# NOTE: This test supports up to 7 nodes scale-out scenario
 #
-#NOTE: Ensure that you have 'tablet.json' file 
+# NOTE: Ensure that you have 'tablet.json' file
 #      in the onos/tools/package/config directory
-#NOTE: You must start this test initially with 3 nodes
+# NOTE: You must start this test initially with 3 nodes
 #
-#andrew@onlab.us
+# andrew@onlab.us
 
 import time
 import sys
 import os
 import re
 
+
 class TopoConvNext:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
-        '''
+    def CASE1( self, main ):
+        """
         ONOS startup sequence
-        '''
+        """
         import time
 
         #******
-        #Global cluster count for scale-out purposes
-        global cluster_count 
+        # Global cluster count for scale-out purposes
+        global cluster_count
         global topo_iteration
         topo_iteration = 1
-        cluster_count = 1 
+        cluster_count = 1
         #******
-        cell_name = main.params['ENV']['cellName']
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
 
-        git_pull = main.params['GIT']['autoPull']
-        checkout_branch = main.params['GIT']['checkout']
+        git_pull = main.params[ 'GIT' ][ 'autoPull' ]
+        checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS4_ip = main.params['CTRL']['ip4']
-        ONOS5_ip = main.params['CTRL']['ip5']
-        ONOS6_ip = main.params['CTRL']['ip6']
-        ONOS7_ip = main.params['CTRL']['ip7']
-        MN1_ip = main.params['MN']['ip1']
-        BENCH_ip = main.params['BENCH']['ip']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+        ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+        ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
+        ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
 
-        main.case("Setting up test environment")
-        main.log.info("copying topology event accumulator config file"+\
-                " to ONOS package/etc/ directory")
-        topo_config_name = main.params['TEST']['topo_config_name']
+        main.case( "Setting up test environment" )
+        main.log.info( "copying topology event accumulator config file" +
+                       " to ONOS package/etc/ directory" )
+        topo_config_name = main.params[ 'TEST' ][ 'topo_config_name' ]
         topo_config =\
-                main.params['TEST']['topo_accumulator_config']
-        main.ONOSbench.handle.sendline("cp ~/"+topo_config+\
-            " ~/ONOS/tools/package/etc/"+\
-            topo_config_name)
-        main.ONOSbench.handle.expect("\$")
+            main.params[ 'TEST' ][ 'topo_accumulator_config' ]
+        main.ONOSbench.handle.sendline( "cp ~/" + topo_config +
+                                        " ~/ONOS/tools/package/etc/" +
+                                        topo_config_name )
+        main.ONOSbench.handle.expect( "\$" )
 
-        main.log.info("Uninstalling previous instances")
-        #main.ONOSbench.onos_uninstall(node_ip = ONOS1_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS2_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS3_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip)
-      
-        main.log.report("Setting up test environment")
+        main.log.info( "Uninstalling previous instances" )
+        #main.ONOSbench.onos_uninstall( node_ip=ONOS1_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS2_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS3_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
 
-        main.step("Creating cell file")
+        main.log.report( "Setting up test environment" )
+
+        main.step( "Creating cell file" )
         cell_file_result = main.ONOSbench.create_cell_file(
-                BENCH_ip, cell_name, MN1_ip, 
-                "onos-core,onos-app-metrics", 
-                #ONOS1_ip, ONOS2_ip, ONOS3_ip)
-                ONOS1_ip)
-                    
-        main.step("Applying cell file to environment")
-        cell_apply_result = main.ONOSbench.set_cell(cell_name)
-        verify_cell_result = main.ONOSbench.verify_cell()
-        
-        main.step("Removing raft logs")
-        main.ONOSbench.onos_remove_raft_logs()
-        time.sleep(10)
+            BENCH_ip, cell_name, MN1_ip,
+            "onos-core,onos-app-metrics",
+            # ONOS1_ip, ONOS2_ip, ONOS3_ip )
+            ONOS1_ip )
 
-        main.step("Git checkout and pull "+checkout_branch)
+        main.step( "Applying cell file to environment" )
+        cell_apply_result = main.ONOSbench.set_cell( cell_name )
+        verify_cell_result = main.ONOSbench.verify_cell()
+
+        main.step( "Removing raft logs" )
+        main.ONOSbench.onos_remove_raft_logs()
+        time.sleep( 10 )
+
+        main.step( "Git checkout and pull " + checkout_branch )
         if git_pull == 'on':
             checkout_result = \
-                    main.ONOSbench.git_checkout(checkout_branch)
+                main.ONOSbench.git_checkout( checkout_branch )
             pull_result = main.ONOSbench.git_pull()
         else:
             checkout_result = main.TRUE
             pull_result = main.TRUE
-            main.log.info("Skipped git checkout and pull")
+            main.log.info( "Skipped git checkout and pull" )
 
-        main.log.report("Commit information - ")
+        main.log.report( "Commit information - " )
         main.ONOSbench.get_version()
 
-        main.step("Using mvn clean & install")
+        main.step( "Using mvn clean & install" )
         #mvn_result = main.ONOSbench.clean_install()
         mvn_result = main.TRUE
 
-        main.step("Set cell for ONOS cli env")
-        main.ONOS1cli.set_cell(cell_name)
-        #main.ONOS2cli.set_cell(cell_name)
-        #main.ONOS3cli.set_cell(cell_name)
-    
-        main.step("Creating ONOS package")
+        main.step( "Set cell for ONOS cli env" )
+        main.ONOS1cli.set_cell( cell_name )
+        # main.ONOS2cli.set_cell( cell_name )
+        # main.ONOS3cli.set_cell( cell_name )
+
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-        #Start test with single node only
-        main.step("Installing ONOS package")
-        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
-        #install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
-        #install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+        # Start test with single node only
+        main.step( "Installing ONOS package" )
+        install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
+        #install2_result = main.ONOSbench.onos_install( node=ONOS2_ip )
+        #install3_result = main.ONOSbench.onos_install( node=ONOS3_ip )
 
-        time.sleep(10)
+        time.sleep( 10 )
 
-        main.step("Start onos cli")
-        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
-        #cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
-        #cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
+        main.step( "Start onos cli" )
+        cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
+        #cli2 = main.ONOS2cli.start_onos_cli( ONOS2_ip )
+        #cli3 = main.ONOS3cli.start_onos_cli( ONOS3_ip )
 
-        main.step("Enable metrics feature")
-        #main.ONOS1cli.feature_install("onos-app-metrics")
+        main.step( "Enable metrics feature" )
+        # main.ONOS1cli.feature_install( "onos-app-metrics" )
 
-        utilities.assert_equals(expect=main.TRUE,
-                actual= cell_file_result and cell_apply_result and\
-                        verify_cell_result and checkout_result and\
-                        pull_result and mvn_result and\
-                        install1_result, #and install2_result and\
-                        #install3_result,
-                onpass="Test Environment setup successful",
-                onfail="Failed to setup test environment")
-    
-    def CASE2(self, main):
-        '''
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cell_file_result and cell_apply_result and
+                                 verify_cell_result and checkout_result and
+                                 pull_result and mvn_result and
+                                 install1_result,  # and install2_result and
+                                 # install3_result,
+                                 onpass="Test Environment setup successful",
+                                 onfail="Failed to setup test environment" )
+
+    def CASE2( self, main ):
+        """
         100 Switch discovery latency
 
         Important:
-            This test case can be potentially dangerous if 
+            This test case can be potentially dangerous if
             your machine has previously set iptables rules.
             One of the steps of the test case will flush
             all existing iptables rules.
         Note:
-            You can specify the number of switches in the 
+            You can specify the number of switches in the
             params file to adjust the switch discovery size
-            (and specify the corresponding topology in Mininet1 
-            .topo file)
-        '''
+            ( and specify the corresponding topology in Mininet1
+            .topo file )
+        """
         import time
         import subprocess
         import os
@@ -156,221 +158,241 @@
         import numpy
 
         ONOS_ip_list = []
-        ONOS_ip_list.append('0')
-        ONOS_ip_list.append(main.params['CTRL']['ip1'])
-        ONOS_ip_list.append(main.params['CTRL']['ip2'])
-        ONOS_ip_list.append(main.params['CTRL']['ip3'])
-        ONOS_ip_list.append(main.params['CTRL']['ip4'])
-        ONOS_ip_list.append(main.params['CTRL']['ip5'])
-        ONOS_ip_list.append(main.params['CTRL']['ip6'])
-        ONOS_ip_list.append(main.params['CTRL']['ip7'])
-        MN1_ip = main.params['MN']['ip1']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS_ip_list.append( '0' )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip1' ] )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip2' ] )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip3' ] )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip4' ] )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip5' ] )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip6' ] )
+        ONOS_ip_list.append( main.params[ 'CTRL' ][ 'ip7' ] )
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-        iter_ignore = int(main.params['TEST']['iterIgnore'])
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
+
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+        iter_ignore = int( main.params[ 'TEST' ][ 'iterIgnore' ] )
 
         #***********
-        #Global number of switches that change 
-        #throughout the test
+        # Global number of switches that change
+        # throughout the test
         global num_sw
-        global topo_iteration    
+        global topo_iteration
         global cluster_count
         if topo_iteration == 1:
-            num_sw = main.params['TEST']['numSwitch1']
+            num_sw = main.params[ 'TEST' ][ 'numSwitch1' ]
         elif topo_iteration == 2:
-            num_sw = main.params['TEST']['numSwitch2']
+            num_sw = main.params[ 'TEST' ][ 'numSwitch2' ]
         elif topo_iteration == 3:
-            num_sw = main.params['TEST']['numSwitch3']
+            num_sw = main.params[ 'TEST' ][ 'numSwitch3' ]
         elif topo_iteration == 4:
-            num_sw = main.params['TEST']['numSwitch4']
+            num_sw = main.params[ 'TEST' ][ 'numSwitch4' ]
         #***********
 
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
-        
-        #Threshold for this test case
-        sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold']
-        sw_disc_threshold_obj = sw_disc_threshold_str.split(",")
-        sw_disc_threshold_min = int(sw_disc_threshold_obj[0])
-        sw_disc_threshold_max = int(sw_disc_threshold_obj[1])
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        # Threshold for this test case
+        sw_disc_threshold_str = main.params[ 'TEST' ][ 'swDisc100Threshold' ]
+        sw_disc_threshold_obj = sw_disc_threshold_str.split( "," )
+        sw_disc_threshold_min = int( sw_disc_threshold_obj[ 0 ] )
+        sw_disc_threshold_max = int( sw_disc_threshold_obj[ 1 ] )
 
         assertion = main.TRUE
         sw_discovery_lat_list = []
         syn_ack_delta_list = []
 
-        main.case(str(num_sw)+" switches distributed across "+
-                str(cluster_count)+" nodes convergence latency")
-       
-        main.log.report("Large topology convergence and scale-out test")
-        main.log.report("Currently active ONOS node(s): ")
+        main.case( str( num_sw ) + " switches distributed across " +
+                   str( cluster_count ) + " nodes convergence latency" )
+
+        main.log.report( "Large topology convergence and scale-out test" )
+        main.log.report( "Currently active ONOS node(s): " )
         report_str = "Node "
-        for node in range(1, cluster_count+1):
-            report_str += (str(node) + " ") 
-        main.log.report(report_str)
-        main.log.report("Topology size: "+str(num_sw)+" switches")
+        for node in range( 1, cluster_count + 1 ):
+            report_str += ( str( node ) + " " )
+        main.log.report( report_str )
+        main.log.report( "Topology size: " + str( num_sw ) + " switches" )
 
-        main.step("Distributing "+num_sw+" switches to each ONOS")
-        index = 1 
-        for node in range(1, cluster_count+1):
-            for i in range(index, (int(num_sw)/cluster_count)+index):
+        main.step( "Distributing " + num_sw + " switches to each ONOS" )
+        index = 1
+        for node in range( 1, cluster_count + 1 ):
+            for i in range( index, ( int( num_sw ) / cluster_count ) + index ):
                 main.Mininet1.assign_sw_controller(
-                        sw=str(i),
-                        ip1=ONOS_ip_list[node],
-                        port1=default_sw_port)
-            index = i+1 
-        #for i in range(1, int(num_sw)+1):
-            #main.Mininet1.assign_sw_controller(
-                    #sw=str(i),
-                    #ip1="10.128.174.1",
-                    #            port1="6633")
+                    sw=str( i ),
+                    ip1=ONOS_ip_list[ node ],
+                    port1=default_sw_port )
+            index = i + 1
+        # for i in range( 1, int( num_sw )+1 ):
+            # main.Mininet1.assign_sw_controller(
+            # sw=str( i ),
+            # ip1="10.128.174.1",
+            #            port1="6633" )
 
-        main.log.info("Please check ptpd configuration to ensure "+\
-                "all nodes' system times are in sync")
+        main.log.info( "Please check ptpd configuration to ensure " +
+                       "all nodes' system times are in sync" )
 
-        time.sleep(10)
+        time.sleep( 10 )
 
-        for i in range(0, int(num_iter)):
-            main.step("Set iptables rule to block sw connections")
-               
-            #INPUT rules
+        for i in range( 0, int( num_iter ) ):
+            main.step( "Set iptables rule to block sw connections" )
+
+            # INPUT rules
             main.ONOS1.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS2.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS3.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS4.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS5.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS6.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS7.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
-               
-            #OUTPUT rules
+                "sudo iptables -A INPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
+
+            # OUTPUT rules
             main.ONOS1.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS2.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS3.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS4.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS5.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS6.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
             main.ONOS7.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+
-                    MN1_ip+" --dport "+default_sw_port+" -j DROP")
+                "sudo iptables -A OUTPUT -p tcp -s " +
+                MN1_ip + " --dport " + default_sw_port + " -j DROP" )
 
-            main.log.info("Please wait for switch connection to timeout")
-           
+            main.log.info( "Please wait for switch connection to timeout" )
 
-            #time.sleep(60)
-            #if cluster_count >= 3:
-            #    time.sleep(60)
-            #if cluster_count >= 5:
-            #    time.sleep(30)
-            #if cluster_count >= 6:
-            #    time.sleep(30)
+            # time.sleep( 60 )
+            # if cluster_count >= 3:
+            #    time.sleep( 60 )
+            # if cluster_count >= 5:
+            #    time.sleep( 30 )
+            # if cluster_count >= 6:
+            #    time.sleep( 30 )
 
             if cluster_count >= 3:
-                main.ONOS1.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos1_iter"+str(i)+".txt &")
-                main.ONOS2.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos2_iter"+str(i)+".txt &")
-                main.ONOS3.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos3_iter"+str(i)+".txt &")
+                main.ONOS1.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos1_iter" +
+                    str( i ) +
+                    ".txt &" )
+                main.ONOS2.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos2_iter" +
+                    str( i ) +
+                    ".txt &" )
+                main.ONOS3.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos3_iter" +
+                    str( i ) +
+                    ".txt &" )
             if cluster_count >= 4:
-                main.ONOS4.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos4_iter"+str(i)+".txt &")
+                main.ONOS4.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos4_iter" +
+                    str( i ) +
+                    ".txt &" )
             if cluster_count >= 5:
-                main.ONOS5.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos5_iter"+str(i)+".txt &")
+                main.ONOS5.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos5_iter" +
+                    str( i ) +
+                    ".txt &" )
             if cluster_count >= 6:
-                main.ONOS6.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos6_iter"+str(i)+".txt &")
+                main.ONOS6.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos6_iter" +
+                    str( i ) +
+                    ".txt &" )
             if cluster_count == 7:
-                main.ONOS7.handle.sendline("tshark -i eth0 -t e | "+
-                    "grep 'SYN, ACK' | grep '6633' >"+
-                    "/tmp/syn_ack_onos6_iter"+str(i)+".txt &")
-         
-            #NOTE:
-            #       Delay before checking devices to 
+                main.ONOS7.handle.sendline(
+                    "tshark -i eth0 -t e | " +
+                    "grep 'SYN, ACK' | grep '6633' >" +
+                    "/tmp/syn_ack_onos6_iter" +
+                    str( i ) +
+                    ".txt &" )
+
+            # NOTE:
+            #       Delay before checking devices to
             #       help prevent timing out from CLI
-            #       due to multiple command issuing 
-            time.sleep(20)
+            #       due to multiple command issuing
+            time.sleep( 20 )
 
             loop = True
             loop_count = 0
             device_count = 0
-            while loop_count < 60 and loop: 
-                main.log.info("Checking devices for device down")
-                
+            while loop_count < 60 and loop:
+                main.log.info( "Checking devices for device down" )
+
                 temp_len = 0
                 device_str1 = main.ONOS1cli.devices(
-                    node_ip=ONOS_ip_list[1])
-                device_json1 = json.loads(device_str1)
-                json_len = len(device_json1) 
-                
-                #NOTE: May want to check the rest of 
+                    node_ip=ONOS_ip_list[ 1 ] )
+                device_json1 = json.loads( device_str1 )
+                json_len = len( device_json1 )
+
+                # NOTE: May want to check the rest of
                 #      the ONOS instances for device down as well
 
-                for device1 in device_json1: 
+                for device1 in device_json1:
                     temp_len = temp_len + 1
-                    if device1['available'] == True:
+                    if device1[ 'available' ]:
                         loop = True
                         break
-                    #if I'm on the last json object and I still haven't
-                    #broken out of the loop, it means there were
-                    #no available devices
-                    elif temp_len == json_len-1:
-                        main.log.info("Temp length: "+str(temp_len))
-                        main.step("Flushing iptables and obtaining t0")
-                        t0_system = time.time()*1000
-                        
-                        main.ONOS1.handle.sendline("sudo iptables -F")
-                        main.ONOS2.handle.sendline("sudo iptables -F")
-                        main.ONOS3.handle.sendline("sudo iptables -F")
-                        main.ONOS4.handle.sendline("sudo iptables -F")
-                        main.ONOS5.handle.sendline("sudo iptables -F")
-                        main.ONOS6.handle.sendline("sudo iptables -F")
-                        main.ONOS7.handle.sendline("sudo iptables -F")
-                    
+                    # if I'm on the last json object and I still haven't
+                    # broken out of the loop, it means there were
+                    # no available devices
+                    elif temp_len == json_len - 1:
+                        main.log.info( "Temp length: " + str( temp_len ) )
+                        main.step( "Flushing iptables and obtaining t0" )
+                        t0_system = time.time() * 1000
+
+                        main.ONOS1.handle.sendline( "sudo iptables -F" )
+                        main.ONOS2.handle.sendline( "sudo iptables -F" )
+                        main.ONOS3.handle.sendline( "sudo iptables -F" )
+                        main.ONOS4.handle.sendline( "sudo iptables -F" )
+                        main.ONOS5.handle.sendline( "sudo iptables -F" )
+                        main.ONOS6.handle.sendline( "sudo iptables -F" )
+                        main.ONOS7.handle.sendline( "sudo iptables -F" )
+
                         loop = False
                         break
-                
-                loop_count += 1
-                time.sleep(1)
 
-            main.log.info("System time t0: "+str(t0_system))
+                loop_count += 1
+                time.sleep( 1 )
+
+            main.log.info( "System time t0: " + str( t0_system ) )
 
             counter_loop = 0
             counter_avail1 = 0
@@ -388,207 +410,213 @@
             onos6_dev = False
             onos7_dev = False
 
-            #TODO: Think of a more elegant way to check all 
+            # TODO: Think of a more elegant way to check all
             #      switches across all nodes
-            #Goodluck debugging this loop
+            # Goodluck debugging this loop
             while counter_loop < 60:
-                for node in range(1, cluster_count+1):
+                for node in range( 1, cluster_count + 1 ):
                     if node == 1 and not onos1_dev:
-                        main.log.info("Checking node 1 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 1 for device " +
+                                       "discovery" )
                         device_str_obj1 = main.ONOS1cli.devices(
-                            node_ip=ONOS_ip_list[1])
-                        device_json1 = json.loads(device_str_obj1)
+                            node_ip=ONOS_ip_list[ 1 ] )
+                        device_json1 = json.loads( device_str_obj1 )
                         for device1 in device_json1:
-                            if device1['available'] == True:
+                            if device1[ 'available' ]:
                                 counter_avail1 += 1
-                                if counter_avail1 == int(num_sw):
+                                if counter_avail1 == int( num_sw ):
                                     onos1_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS1")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS1" )
                             else:
                                 counter_avail1 = 0
                     if node == 2 and not onos2_dev:
-                        main.log.info("Checking node 2 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 2 for device " +
+                                       "discovery" )
                         device_str_obj2 = main.ONOS2cli.devices(
-                            node_ip=ONOS_ip_list[2])
-                        device_json2 = json.loads(device_str_obj2)
+                            node_ip=ONOS_ip_list[ 2 ] )
+                        device_json2 = json.loads( device_str_obj2 )
                         for device2 in device_json2:
-                            if device2['available'] == True:
+                            if device2[ 'available' ]:
                                 counter_avail2 += 1
-                                if counter_avail2 == int(num_sw):
+                                if counter_avail2 == int( num_sw ):
                                     onos2_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS2")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS2" )
                             else:
                                 counter_avail2 = 0
                     if node == 3 and not onos3_dev:
-                        main.log.info("Checking node 3 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 3 for device " +
+                                       "discovery" )
                         device_str_obj3 = main.ONOS3cli.devices(
-                            node_ip=ONOS_ip_list[3])
-                        device_json3 = json.loads(device_str_obj3)
+                            node_ip=ONOS_ip_list[ 3 ] )
+                        device_json3 = json.loads( device_str_obj3 )
                         for device3 in device_json3:
-                            if device3['available'] == True:
+                            if device3[ 'available' ]:
                                 counter_avail3 += 1
-                                if counter_avail3 == int(num_sw):
+                                if counter_avail3 == int( num_sw ):
                                     onos3_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS3")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS3" )
                             else:
                                 counter_avail3 = 0
                     if node == 4 and not onos4_dev:
-                        main.log.info("Checking node 4 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 4 for device " +
+                                       "discovery" )
                         device_str_obj4 = main.ONOS4cli.devices(
-                            node_ip=ONOS_ip_list[4])
-                        device_json4 = json.loads(device_str_obj4)
+                            node_ip=ONOS_ip_list[ 4 ] )
+                        device_json4 = json.loads( device_str_obj4 )
                         for device4 in device_json4:
-                            if device4['available'] == True:
+                            if device4[ 'available' ]:
                                 counter_avail4 += 1
-                                if counter_avail4 == int(num_sw):
+                                if counter_avail4 == int( num_sw ):
                                     onos4_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS4")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS4" )
                             else:
                                 counter_avail4 = 0
                     if node == 5 and not onos5_dev:
-                        main.log.info("Checking node 5 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 5 for device " +
+                                       "discovery" )
                         device_str_obj5 = main.ONOS5cli.devices(
-                            node_ip=ONOS_ip_list[5])
-                        device_json5 = json.loads(device_str_obj5)
+                            node_ip=ONOS_ip_list[ 5 ] )
+                        device_json5 = json.loads( device_str_obj5 )
                         for device5 in device_json5:
-                            if device5['available'] == True:
+                            if device5[ 'available' ]:
                                 counter_avail5 += 1
-                                if counter_avail5 == int(num_sw):
+                                if counter_avail5 == int( num_sw ):
                                     onos5_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS5")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS5" )
                             else:
                                 counter_avail5 = 0
                     if node == 6 and not onos6_dev:
-                        main.log.info("Checking node 6 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 6 for device " +
+                                       "discovery" )
                         device_str_obj6 = main.ONOS6cli.devices(
-                            node_ip=ONOS_ip_list[6])
-                        device_json6 = json.loads(device_str_obj6)
+                            node_ip=ONOS_ip_list[ 6 ] )
+                        device_json6 = json.loads( device_str_obj6 )
                         for device6 in device_json6:
-                            if device6['available'] == True:
+                            if device6[ 'available' ]:
                                 counter_avail6 += 1
-                                if counter_avail6 == int(num_sw):
+                                if counter_avail6 == int( num_sw ):
                                     onos6_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS6")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS6" )
                             else:
                                 counter_avail6 = 0
                     if node == 7 and not onos7_dev:
-                        main.log.info("Checking node 7 for device "+
-                            "discovery")
+                        main.log.info( "Checking node 7 for device " +
+                                       "discovery" )
                         device_str_obj7 = main.ONOS7cli.devices(
-                            node_ip=ONOS_ip_list[7])
-                        device_json7 = json.loads(device_str_obj7)
+                            node_ip=ONOS_ip_list[ 7 ] )
+                        device_json7 = json.loads( device_str_obj7 )
                         for device7 in device_json7:
-                            if device7['available'] == True:
+                            if device7[ 'available' ]:
                                 counter_avail7 += 1
-                                if counter_avail7 == int(num_sw):
+                                if counter_avail7 == int( num_sw ):
                                     onos7_dev = True
-                                    main.log.info("All devices have been"+
-                                            " discovered on ONOS7")
+                                    main.log.info( "All devices have been" +
+                                                   " discovered on ONOS7" )
                             else:
                                 counter_avail7 = 0
-                    #END node loop
-              
-                #TODO: clean up this mess of an if statements if possible
-                #Treat each if as a separate test case with the given
+                    # END node loop
+
+                # TODO: clean up this mess of an if statements if possible
+                # Treat each if as a separate test case with the given
                 #     cluster count. Hence when the cluster count changes
                 #     the desired calculations will be made
                 if cluster_count == 1:
                     if onos1_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all ONOS instances")
-                        time.sleep(5)
+                        main.log.info( "All devices have been discovered" +
+                                       " on all ONOS instances" )
+                        time.sleep( 5 )
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
-                        
+                            json_obj_1[ graphTimestamp ][ 'value' ]
+
                         graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
-                       
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
+                            int( graph_timestamp_1 ) - int( t0_system )
+
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
 
                         if graph_lat_1 > sw_disc_threshold_min\
-                            and graph_lat_1 < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and graph_lat_1 < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    graph_lat_1)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(graph_lat_1)+" ms")
+                                graph_lat_1 )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( graph_lat_1 ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(graph_lat_1)+" ms")
-                        #Break while loop 
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( graph_lat_1 ) + " ms" )
+                        # Break while loop
                         break
                 if cluster_count == 2:
                     if onos1_dev and onos2_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all "+str(cluster_count)+
-                            " ONOS instances")
-                        time.sleep(5)
+                        main.log.info( "All devices have been discovered" +
+                                       " on all " + str( cluster_count ) +
+                                       " ONOS instances" )
+                        time.sleep( 5 )
 
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
                         json_str_metrics_2 =\
                             main.ONOS2cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
-                        json_obj_2 = json.loads(json_str_metrics_2)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
+                        json_obj_2 = json.loads( json_str_metrics_2 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
+                            json_obj_1[ graphTimestamp ][ 'value' ]
                         graph_timestamp_2 =\
-                            json_obj_2[graphTimestamp]['value']
-                        
-                        graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
-                        graph_lat_2 = \
-                            int(graph_timestamp_2) - int(t0_system)
-                        
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
-                        main.log.info("Graph Timestamp ONOS2: "+
-                            str(graph_timestamp_2))
+                            json_obj_2[ graphTimestamp ][ 'value' ]
 
-                        max_graph_lat = max(graph_lat_1, 
-                            graph_lat_2, graph_lat_3)
+                        graph_lat_1 = \
+                            int( graph_timestamp_1 ) - int( t0_system )
+                        graph_lat_2 = \
+                            int( graph_timestamp_2 ) - int( t0_system )
+
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
+                        main.log.info( "Graph Timestamp ONOS2: " +
+                                       str( graph_timestamp_2 ) )
+
+                        max_graph_lat = max( graph_lat_1,
+                                             graph_lat_2, graph_lat_3 )
 
                         if max_graph_lat > sw_disc_threshold_min\
-                            and max_graph_lat < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and max_graph_lat < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    max_graph_lat)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(max_graph_lat)+" ms")
+                                max_graph_lat )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( max_graph_lat ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(max_graph_lat)+" ms")
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( max_graph_lat ) + " ms" )
                         break
                 if cluster_count == 3:
                     if onos1_dev and onos2_dev and onos3_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all "+str(cluster_count)+
-                            " ONOS instances")
-                        
-                        #TODO: Investigate this sleep
-                        #      added to 'pad' the results with 
+                        main.log.info( "All devices have been discovered" +
+                                       " on all " + str( cluster_count ) +
+                                       " ONOS instances" )
+
+                        # TODO: Investigate this sleep
+                        #      added to 'pad' the results with
                         #      plenty of time to 'catch up'
-                        time.sleep(5)
+                        time.sleep( 5 )
 
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
@@ -596,53 +624,56 @@
                             main.ONOS2cli.topology_events_metrics()
                         json_str_metrics_3 =\
                             main.ONOS3cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
-                        json_obj_2 = json.loads(json_str_metrics_2)
-                        json_obj_3 = json.loads(json_str_metrics_3)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
+                        json_obj_2 = json.loads( json_str_metrics_2 )
+                        json_obj_3 = json.loads( json_str_metrics_3 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
+                            json_obj_1[ graphTimestamp ][ 'value' ]
                         graph_timestamp_2 =\
-                            json_obj_2[graphTimestamp]['value']
+                            json_obj_2[ graphTimestamp ][ 'value' ]
                         graph_timestamp_3 =\
-                            json_obj_3[graphTimestamp]['value']
-                        
+                            json_obj_3[ graphTimestamp ][ 'value' ]
+
                         graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
+                            int( graph_timestamp_1 ) - int( t0_system )
                         graph_lat_2 = \
-                            int(graph_timestamp_2) - int(t0_system)
+                            int( graph_timestamp_2 ) - int( t0_system )
                         graph_lat_3 = \
-                            int(graph_timestamp_3) - int(t0_system)
+                            int( graph_timestamp_3 ) - int( t0_system )
 
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
-                        main.log.info("Graph Timestamp ONOS2: "+
-                            str(graph_timestamp_2))
-                        main.log.info("Graph Timestamp ONOS3: "+
-                            str(graph_timestamp_3))
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
+                        main.log.info( "Graph Timestamp ONOS2: " +
+                                       str( graph_timestamp_2 ) )
+                        main.log.info( "Graph Timestamp ONOS3: " +
+                                       str( graph_timestamp_3 ) )
 
-                        max_graph_lat = max(graph_lat_1, 
-                                graph_lat_2,
-                                graph_lat_3)
+                        max_graph_lat = max( graph_lat_1,
+                                             graph_lat_2,
+                                             graph_lat_3 )
 
                         if max_graph_lat > sw_disc_threshold_min\
-                            and max_graph_lat < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and max_graph_lat < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    max_graph_lat)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(max_graph_lat)+" ms")
+                                max_graph_lat )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( max_graph_lat ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(max_graph_lat)+" ms")
-                        
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( max_graph_lat ) + " ms" )
+
                         break
                 if cluster_count == 4:
                     if onos1_dev and onos2_dev and onos3_dev and\
                        onos4_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all ONOS instances")
+                        main.log.info( "All devices have been discovered" +
+                                       " on all ONOS instances" )
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
                         json_str_metrics_2 =\
@@ -651,67 +682,70 @@
                             main.ONOS3cli.topology_events_metrics()
                         json_str_metrics_4 =\
                             main.ONOS4cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
-                        json_obj_2 = json.loads(json_str_metrics_2)
-                        json_obj_3 = json.loads(json_str_metrics_3)
-                        json_obj_4 = json.loads(json_str_metrics_4)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
+                        json_obj_2 = json.loads( json_str_metrics_2 )
+                        json_obj_3 = json.loads( json_str_metrics_3 )
+                        json_obj_4 = json.loads( json_str_metrics_4 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
+                            json_obj_1[ graphTimestamp ][ 'value' ]
                         graph_timestamp_2 =\
-                            json_obj_2[graphTimestamp]['value']
+                            json_obj_2[ graphTimestamp ][ 'value' ]
                         graph_timestamp_3 =\
-                            json_obj_3[graphTimestamp]['value']
+                            json_obj_3[ graphTimestamp ][ 'value' ]
                         graph_timestamp_4 =\
-                            json_obj_4[graphTimestamp]['value']
-                        
-                        graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
-                        graph_lat_2 = \
-                            int(graph_timestamp_2) - int(t0_system)
-                        graph_lat_3 = \
-                            int(graph_timestamp_3) - int(t0_system)
-                        graph_lat_4 = \
-                            int(graph_timestamp_4) - int(t0_system)
-                        
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
-                        main.log.info("Graph Timestamp ONOS2: "+
-                            str(graph_timestamp_2))
-                        main.log.info("Graph Timestamp ONOS3: "+
-                            str(graph_timestamp_3))
-                        main.log.info("Graph Timestamp ONOS4: "+
-                            str(graph_timestamp_4))
+                            json_obj_4[ graphTimestamp ][ 'value' ]
 
-                        max_graph_lat = max(graph_lat_1,
-                                graph_lat_2,
-                                graph_lat_3,
-                                graph_lat_4)
-                        
+                        graph_lat_1 = \
+                            int( graph_timestamp_1 ) - int( t0_system )
+                        graph_lat_2 = \
+                            int( graph_timestamp_2 ) - int( t0_system )
+                        graph_lat_3 = \
+                            int( graph_timestamp_3 ) - int( t0_system )
+                        graph_lat_4 = \
+                            int( graph_timestamp_4 ) - int( t0_system )
+
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
+                        main.log.info( "Graph Timestamp ONOS2: " +
+                                       str( graph_timestamp_2 ) )
+                        main.log.info( "Graph Timestamp ONOS3: " +
+                                       str( graph_timestamp_3 ) )
+                        main.log.info( "Graph Timestamp ONOS4: " +
+                                       str( graph_timestamp_4 ) )
+
+                        max_graph_lat = max( graph_lat_1,
+                                             graph_lat_2,
+                                             graph_lat_3,
+                                             graph_lat_4 )
+
                         if max_graph_lat > sw_disc_threshold_min\
-                            and max_graph_lat < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and max_graph_lat < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    max_graph_lat)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(max_graph_lat)+" ms")
+                                max_graph_lat )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( max_graph_lat ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(max_graph_lat)+" ms")
-                
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( max_graph_lat ) + " ms" )
+
                         break
                 if cluster_count == 5:
                     if onos1_dev and onos2_dev and onos3_dev and\
                        onos4_dev and onos5_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all ONOS instances")
-                        
-                        #TODO: Investigate this sleep
-                        #      added to 'pad' the results with 
+                        main.log.info( "All devices have been discovered" +
+                                       " on all ONOS instances" )
+
+                        # TODO: Investigate this sleep
+                        #      added to 'pad' the results with
                         #      plenty of time to 'catch up'
-                        time.sleep(5)
-                        
+                        time.sleep( 5 )
+
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
                         json_str_metrics_2 =\
@@ -722,69 +756,72 @@
                             main.ONOS4cli.topology_events_metrics()
                         json_str_metrics_5 =\
                             main.ONOS5cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
-                        json_obj_2 = json.loads(json_str_metrics_2)
-                        json_obj_3 = json.loads(json_str_metrics_3)
-                        json_obj_4 = json.loads(json_str_metrics_4)
-                        json_obj_5 = json.loads(json_str_metrics_5)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
+                        json_obj_2 = json.loads( json_str_metrics_2 )
+                        json_obj_3 = json.loads( json_str_metrics_3 )
+                        json_obj_4 = json.loads( json_str_metrics_4 )
+                        json_obj_5 = json.loads( json_str_metrics_5 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
+                            json_obj_1[ graphTimestamp ][ 'value' ]
                         graph_timestamp_2 =\
-                            json_obj_2[graphTimestamp]['value']
+                            json_obj_2[ graphTimestamp ][ 'value' ]
                         graph_timestamp_3 =\
-                            json_obj_3[graphTimestamp]['value']
+                            json_obj_3[ graphTimestamp ][ 'value' ]
                         graph_timestamp_4 =\
-                            json_obj_4[graphTimestamp]['value']
+                            json_obj_4[ graphTimestamp ][ 'value' ]
                         graph_timestamp_5 =\
-                            json_obj_5[graphTimestamp]['value']
-                        
-                        graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
-                        graph_lat_2 = \
-                            int(graph_timestamp_2) - int(t0_system)
-                        graph_lat_3 = \
-                            int(graph_timestamp_3) - int(t0_system)
-                        graph_lat_4 = \
-                            int(graph_timestamp_4) - int(t0_system)
-                        graph_lat_5 = \
-                            int(graph_timestamp_5) - int(t0_system)
-                        
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
-                        main.log.info("Graph Timestamp ONOS2: "+
-                            str(graph_timestamp_2))
-                        main.log.info("Graph Timestamp ONOS3: "+
-                            str(graph_timestamp_3))
-                        main.log.info("Graph Timestamp ONOS4: "+
-                            str(graph_timestamp_4))
-                        main.log.info("Graph Timestamp ONOS5: "+
-                            str(graph_timestamp_5))
+                            json_obj_5[ graphTimestamp ][ 'value' ]
 
-                        max_graph_lat = max(graph_lat_1,
-                                graph_lat_2,
-                                graph_lat_3,
-                                graph_lat_4,
-                                graph_lat_5)
-                        
+                        graph_lat_1 = \
+                            int( graph_timestamp_1 ) - int( t0_system )
+                        graph_lat_2 = \
+                            int( graph_timestamp_2 ) - int( t0_system )
+                        graph_lat_3 = \
+                            int( graph_timestamp_3 ) - int( t0_system )
+                        graph_lat_4 = \
+                            int( graph_timestamp_4 ) - int( t0_system )
+                        graph_lat_5 = \
+                            int( graph_timestamp_5 ) - int( t0_system )
+
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
+                        main.log.info( "Graph Timestamp ONOS2: " +
+                                       str( graph_timestamp_2 ) )
+                        main.log.info( "Graph Timestamp ONOS3: " +
+                                       str( graph_timestamp_3 ) )
+                        main.log.info( "Graph Timestamp ONOS4: " +
+                                       str( graph_timestamp_4 ) )
+                        main.log.info( "Graph Timestamp ONOS5: " +
+                                       str( graph_timestamp_5 ) )
+
+                        max_graph_lat = max( graph_lat_1,
+                                             graph_lat_2,
+                                             graph_lat_3,
+                                             graph_lat_4,
+                                             graph_lat_5 )
+
                         if max_graph_lat > sw_disc_threshold_min\
-                            and max_graph_lat < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and max_graph_lat < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    max_graph_lat)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(max_graph_lat)+" ms")
+                                max_graph_lat )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( max_graph_lat ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(max_graph_lat)+" ms")
-                
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( max_graph_lat ) + " ms" )
+
                         break
                 if cluster_count == 6:
                     if onos1_dev and onos2_dev and onos3_dev and\
                        onos4_dev and onos5_dev and onos6_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all ONOS instances")
+                        main.log.info( "All devices have been discovered" +
+                                       " on all ONOS instances" )
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
                         json_str_metrics_2 =\
@@ -797,84 +834,87 @@
                             main.ONOS5cli.topology_events_metrics()
                         json_str_metrics_6 =\
                             main.ONOS6cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
-                        json_obj_2 = json.loads(json_str_metrics_2)
-                        json_obj_3 = json.loads(json_str_metrics_3)
-                        json_obj_4 = json.loads(json_str_metrics_4)
-                        json_obj_5 = json.loads(json_str_metrics_5)
-                        json_obj_6 = json.loads(json_str_metrics_6)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
+                        json_obj_2 = json.loads( json_str_metrics_2 )
+                        json_obj_3 = json.loads( json_str_metrics_3 )
+                        json_obj_4 = json.loads( json_str_metrics_4 )
+                        json_obj_5 = json.loads( json_str_metrics_5 )
+                        json_obj_6 = json.loads( json_str_metrics_6 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
+                            json_obj_1[ graphTimestamp ][ 'value' ]
                         graph_timestamp_2 =\
-                            json_obj_2[graphTimestamp]['value']
+                            json_obj_2[ graphTimestamp ][ 'value' ]
                         graph_timestamp_3 =\
-                            json_obj_3[graphTimestamp]['value']
+                            json_obj_3[ graphTimestamp ][ 'value' ]
                         graph_timestamp_4 =\
-                            json_obj_4[graphTimestamp]['value']
+                            json_obj_4[ graphTimestamp ][ 'value' ]
                         graph_timestamp_5 =\
-                            json_obj_5[graphTimestamp]['value']
+                            json_obj_5[ graphTimestamp ][ 'value' ]
                         graph_timestamp_6 =\
-                            json_obj_6[graphTimestamp]['value']
-                        
-                        graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
-                        graph_lat_2 = \
-                            int(graph_timestamp_2) - int(t0_system)
-                        graph_lat_3 = \
-                            int(graph_timestamp_3) - int(t0_system)
-                        graph_lat_4 = \
-                            int(graph_timestamp_4) - int(t0_system)
-                        graph_lat_5 = \
-                            int(graph_timestamp_5) - int(t0_system)
-                        graph_lat_6 = \
-                            int(graph_timestamp_6) - int(t0_system)
-                        
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
-                        main.log.info("Graph Timestamp ONOS2: "+
-                            str(graph_timestamp_2))
-                        main.log.info("Graph Timestamp ONOS3: "+
-                            str(graph_timestamp_3))
-                        main.log.info("Graph Timestamp ONOS4: "+
-                            str(graph_timestamp_4))
-                        main.log.info("Graph Timestamp ONOS5: "+
-                            str(graph_timestamp_5))
-                        main.log.info("Graph Timestamp ONOS6: "+
-                            str(graph_timestamp_6))
+                            json_obj_6[ graphTimestamp ][ 'value' ]
 
-                        max_graph_lat = max(graph_lat_1,
-                                graph_lat_2,
-                                graph_lat_3,
-                                graph_lat_4,
-                                graph_lat_5,
-                                graph_lat_6)
-                        
+                        graph_lat_1 = \
+                            int( graph_timestamp_1 ) - int( t0_system )
+                        graph_lat_2 = \
+                            int( graph_timestamp_2 ) - int( t0_system )
+                        graph_lat_3 = \
+                            int( graph_timestamp_3 ) - int( t0_system )
+                        graph_lat_4 = \
+                            int( graph_timestamp_4 ) - int( t0_system )
+                        graph_lat_5 = \
+                            int( graph_timestamp_5 ) - int( t0_system )
+                        graph_lat_6 = \
+                            int( graph_timestamp_6 ) - int( t0_system )
+
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
+                        main.log.info( "Graph Timestamp ONOS2: " +
+                                       str( graph_timestamp_2 ) )
+                        main.log.info( "Graph Timestamp ONOS3: " +
+                                       str( graph_timestamp_3 ) )
+                        main.log.info( "Graph Timestamp ONOS4: " +
+                                       str( graph_timestamp_4 ) )
+                        main.log.info( "Graph Timestamp ONOS5: " +
+                                       str( graph_timestamp_5 ) )
+                        main.log.info( "Graph Timestamp ONOS6: " +
+                                       str( graph_timestamp_6 ) )
+
+                        max_graph_lat = max( graph_lat_1,
+                                             graph_lat_2,
+                                             graph_lat_3,
+                                             graph_lat_4,
+                                             graph_lat_5,
+                                             graph_lat_6 )
+
                         if max_graph_lat > sw_disc_threshold_min\
-                            and max_graph_lat < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and max_graph_lat < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    max_graph_lat)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(max_graph_lat)+" ms")
+                                max_graph_lat )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( max_graph_lat ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(max_graph_lat)+" ms")
-                        
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( max_graph_lat ) + " ms" )
+
                         break
                 if cluster_count == 7:
                     if onos1_dev and onos2_dev and onos3_dev and\
                        onos4_dev and onos5_dev and onos6_dev and\
                        onos7_dev:
-                        main.log.info("All devices have been discovered"+
-                            " on all ONOS instances")
-                        
-                        #TODO: Investigate this sleep
-                        #      added to 'pad' the results with 
+                        main.log.info( "All devices have been discovered" +
+                                       " on all ONOS instances" )
+
+                        # TODO: Investigate this sleep
+                        #      added to 'pad' the results with
                         #      plenty of time to 'catch up'
-                        time.sleep(5)
-                        
+                        time.sleep( 5 )
+
                         json_str_metrics_1 =\
                             main.ONOS1cli.topology_events_metrics()
                         json_str_metrics_2 =\
@@ -889,390 +929,451 @@
                             main.ONOS6cli.topology_events_metrics()
                         json_str_metrics_7 =\
                             main.ONOS7cli.topology_events_metrics()
-                        json_obj_1 = json.loads(json_str_metrics_1)
-                        json_obj_2 = json.loads(json_str_metrics_2)
-                        json_obj_3 = json.loads(json_str_metrics_3)
-                        json_obj_4 = json.loads(json_str_metrics_4)
-                        json_obj_5 = json.loads(json_str_metrics_5)
-                        json_obj_6 = json.loads(json_str_metrics_6)
-                        json_obj_7 = json.loads(json_str_metrics_7)
+                        json_obj_1 = json.loads( json_str_metrics_1 )
+                        json_obj_2 = json.loads( json_str_metrics_2 )
+                        json_obj_3 = json.loads( json_str_metrics_3 )
+                        json_obj_4 = json.loads( json_str_metrics_4 )
+                        json_obj_5 = json.loads( json_str_metrics_5 )
+                        json_obj_6 = json.loads( json_str_metrics_6 )
+                        json_obj_7 = json.loads( json_str_metrics_7 )
                         graph_timestamp_1 =\
-                            json_obj_1[graphTimestamp]['value']
+                            json_obj_1[ graphTimestamp ][ 'value' ]
                         graph_timestamp_2 =\
-                            json_obj_2[graphTimestamp]['value']
+                            json_obj_2[ graphTimestamp ][ 'value' ]
                         graph_timestamp_3 =\
-                            json_obj_3[graphTimestamp]['value']
+                            json_obj_3[ graphTimestamp ][ 'value' ]
                         graph_timestamp_4 =\
-                            json_obj_4[graphTimestamp]['value']
+                            json_obj_4[ graphTimestamp ][ 'value' ]
                         graph_timestamp_5 =\
-                            json_obj_5[graphTimestamp]['value']
+                            json_obj_5[ graphTimestamp ][ 'value' ]
                         graph_timestamp_6 =\
-                            json_obj_6[graphTimestamp]['value']
+                            json_obj_6[ graphTimestamp ][ 'value' ]
                         graph_timestamp_7 =\
-                            json_obj_7[graphTimestamp]['value']
-                        
+                            json_obj_7[ graphTimestamp ][ 'value' ]
+
                         graph_lat_1 = \
-                            int(graph_timestamp_1) - int(t0_system)
+                            int( graph_timestamp_1 ) - int( t0_system )
                         graph_lat_2 = \
-                            int(graph_timestamp_2) - int(t0_system)
+                            int( graph_timestamp_2 ) - int( t0_system )
                         graph_lat_3 = \
-                            int(graph_timestamp_3) - int(t0_system)
+                            int( graph_timestamp_3 ) - int( t0_system )
                         graph_lat_4 = \
-                            int(graph_timestamp_4) - int(t0_system)
+                            int( graph_timestamp_4 ) - int( t0_system )
                         graph_lat_5 = \
-                            int(graph_timestamp_5) - int(t0_system)
+                            int( graph_timestamp_5 ) - int( t0_system )
                         graph_lat_6 = \
-                            int(graph_timestamp_6) - int(t0_system)
+                            int( graph_timestamp_6 ) - int( t0_system )
                         graph_lat_7 = \
-                            int(graph_timestamp_7) - int(t0_system)
+                            int( graph_timestamp_7 ) - int( t0_system )
 
-                        main.log.info("Graph Timestamp ONOS1: "+
-                            str(graph_timestamp_1))
-                        main.log.info("Graph Timestamp ONOS2: "+
-                            str(graph_timestamp_2))
-                        main.log.info("Graph Timestamp ONOS3: "+
-                            str(graph_timestamp_3))
-                        main.log.info("Graph Timestamp ONOS4: "+
-                            str(graph_timestamp_4))
-                        main.log.info("Graph Timestamp ONOS5: "+
-                            str(graph_timestamp_5))
-                        main.log.info("Graph Timestamp ONOS6: "+
-                            str(graph_timestamp_6))
-                        main.log.info("Graph Timestamp ONOS7: "+
-                            str(graph_timestamp_7))
+                        main.log.info( "Graph Timestamp ONOS1: " +
+                                       str( graph_timestamp_1 ) )
+                        main.log.info( "Graph Timestamp ONOS2: " +
+                                       str( graph_timestamp_2 ) )
+                        main.log.info( "Graph Timestamp ONOS3: " +
+                                       str( graph_timestamp_3 ) )
+                        main.log.info( "Graph Timestamp ONOS4: " +
+                                       str( graph_timestamp_4 ) )
+                        main.log.info( "Graph Timestamp ONOS5: " +
+                                       str( graph_timestamp_5 ) )
+                        main.log.info( "Graph Timestamp ONOS6: " +
+                                       str( graph_timestamp_6 ) )
+                        main.log.info( "Graph Timestamp ONOS7: " +
+                                       str( graph_timestamp_7 ) )
 
-                        max_graph_lat = max(graph_lat_1,
-                                graph_lat_2,
-                                graph_lat_3,
-                                graph_lat_4,
-                                graph_lat_5,
-                                graph_lat_6,
-                                graph_lat_7)
-                        
+                        max_graph_lat = max( graph_lat_1,
+                                             graph_lat_2,
+                                             graph_lat_3,
+                                             graph_lat_4,
+                                             graph_lat_5,
+                                             graph_lat_6,
+                                             graph_lat_7 )
+
                         if max_graph_lat > sw_disc_threshold_min\
-                            and max_graph_lat < sw_disc_threshold_max\
-                            and int(i) > iter_ignore:
+                                and max_graph_lat < sw_disc_threshold_max\
+                                and int( i ) > iter_ignore:
                             sw_discovery_lat_list.append(
-                                    max_graph_lat)
-                            main.log.info("Sw discovery latency of "+
-                                str(cluster_count)+" node(s): "+
-                                str(max_graph_lat)+" ms")
+                                max_graph_lat )
+                            main.log.info(
+                                "Sw discovery latency of " +
+                                str( cluster_count ) +
+                                " node(s): " +
+                                str( max_graph_lat ) +
+                                " ms" )
                         else:
-                            main.log.info("Switch discovery latency "+
-                                "exceeded the threshold.")
-                            main.log.info(str(max_graph_lat)+" ms")
-                        
+                            main.log.info( "Switch discovery latency " +
+                                           "exceeded the threshold." )
+                            main.log.info( str( max_graph_lat ) + " ms" )
+
                         break
-                
+
                 counter_loop += 1
-                time.sleep(3)
-                #END WHILE LOOP            
-          
-            #Below is used for reporting SYN / ACK timing
-            #of all switches 
+                time.sleep( 3 )
+                # END WHILE LOOP
+
+            # Below is used for reporting SYN / ACK timing
+            # of all switches
             main.ONOS1.tshark_stop()
             syn_ack_timestamp_list = []
             if cluster_count < 3:
-                #TODO: capture synack on nodes less than 3
-                syn_ack_timestamp_list.append(0)
+                # TODO: capture synack on nodes less than 3
+                syn_ack_timestamp_list.append( 0 )
 
             if cluster_count >= 3:
-                main.ONOS2.tshark_stop() 
+                main.ONOS2.tshark_stop()
                 main.ONOS3.tshark_stop()
-                time.sleep(5)
-                os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    "/tmp/syn_ack_onos1_iter"+str(i)+".txt /tmp/")
-                os.system("scp "+ONOS_user+"@"+ONOS2_ip+":"+
-                    "/tmp/syn_ack_onos2_iter"+str(i)+".txt /tmp/")
-                os.system("scp "+ONOS_user+"@"+ONOS3_ip+":"+
-                    "/tmp/syn_ack_onos3_iter"+str(i)+".txt /tmp/")
-                time.sleep(5)
-                #Read each of the files and append all
-                #SYN / ACK timestamps to the list
-                with open("/tmp/syn_ack_onos1_iter"+str(i)+".txt") as\
-                     f_onos1:
+                time.sleep( 5 )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS1_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos1_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS2_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos2_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS3_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos3_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                time.sleep( 5 )
+                # Read each of the files and append all
+                # SYN / ACK timestamps to the list
+                with open( "/tmp/syn_ack_onos1_iter" + str( i ) + ".txt" ) as\
+                        f_onos1:
                     for line in f_onos1:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
-                with open("/tmp/syn_ack_onos2_iter"+str(i)+".txt") as\
-                     f_onos2:
+                            main.log.info( "String cannot be converted" )
+                with open( "/tmp/syn_ack_onos2_iter" + str( i ) + ".txt" ) as\
+                        f_onos2:
                     for line in f_onos2:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
-                with open("/tmp/syn_ack_onos3_iter"+str(i)+".txt") as\
-                     f_onos3:
+                            main.log.info( "String cannot be converted" )
+                with open( "/tmp/syn_ack_onos3_iter" + str( i ) + ".txt" ) as\
+                        f_onos3:
                     for line in f_onos3:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
+                            main.log.info( "String cannot be converted" )
             if cluster_count >= 4:
-                main.ONOS4.tshark_stop() 
-                time.sleep(5)
-                os.system("scp "+ONOS_user+"@"+ONOS4_ip+":"+
-                    "/tmp/syn_ack_onos4_iter"+str(i)+".txt /tmp/")
-                time.sleep(5)
-                with open("/tmp/syn_ack_onos4_iter"+str(i)+".txt") as\
-                     f_onos4:
+                main.ONOS4.tshark_stop()
+                time.sleep( 5 )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS4_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos4_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                time.sleep( 5 )
+                with open( "/tmp/syn_ack_onos4_iter" + str( i ) + ".txt" ) as\
+                        f_onos4:
                     for line in f_onos4:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
+                            main.log.info( "String cannot be converted" )
             if cluster_count >= 5:
                 main.ONOS5.tshark_stop()
-                time.sleep(5)
-                os.system("scp "+ONOS_user+"@"+ONOS5_ip+":"+
-                    "/tmp/syn_ack_onos5_iter"+str(i)+".txt /tmp/")
-                time.sleep(5)
-                with open("/tmp/syn_ack_onos5_iter"+str(i)+".txt") as\
-                     f_onos5:
+                time.sleep( 5 )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS5_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos5_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                time.sleep( 5 )
+                with open( "/tmp/syn_ack_onos5_iter" + str( i ) + ".txt" ) as\
+                        f_onos5:
                     for line in f_onos5:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
+                            main.log.info( "String cannot be converted" )
             if cluster_count >= 6:
                 main.ONOS6.tshark_stop()
-                time.sleep(5)
-                os.system("scp "+ONOS_user+"@"+ONOS6_ip+":"+
-                    "/tmp/syn_ack_onos6_iter"+str(i)+".txt /tmp/")
-                time.sleep(5)
-                with open("/tmp/syn_ack_onos6_iter"+str(i)+".txt") as\
-                     f_onos6:
+                time.sleep( 5 )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS6_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos6_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                time.sleep( 5 )
+                with open( "/tmp/syn_ack_onos6_iter" + str( i ) + ".txt" ) as\
+                        f_onos6:
                     for line in f_onos6:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
+                            main.log.info( "String cannot be converted" )
             if cluster_count == 7:
                 main.ONOS7.tshark_stop()
-                time.sleep(5)
-                os.system("scp "+ONOS_user+"@"+ONOS7_ip+":"+
-                    "/tmp/syn_ack_onos7_iter"+str(i)+".txt /tmp/")
-                time.sleep(5)
-                with open("/tmp/syn_ack_onos7_iter"+str(i)+".txt") as\
-                     f_onos7:
+                time.sleep( 5 )
+                os.system(
+                    "scp " +
+                    ONOS_user +
+                    "@" +
+                    ONOS7_ip +
+                    ":" +
+                    "/tmp/syn_ack_onos7_iter" +
+                    str( i ) +
+                    ".txt /tmp/" )
+                time.sleep( 5 )
+                with open( "/tmp/syn_ack_onos7_iter" + str( i ) + ".txt" ) as\
+                        f_onos7:
                     for line in f_onos7:
-                        line = line.split(" ")
+                        line = line.split( " " )
                         try:
-                            float(line[1])
-                            syn_ack_timestamp_list.append(line[1])
+                            float( line[ 1 ] )
+                            syn_ack_timestamp_list.append( line[ 1 ] )
                         except ValueError:
-                            main.log.info("String cannot be converted")
-          
-            #Sort the list by timestamp
-            syn_ack_timestamp_list = sorted(syn_ack_timestamp_list)
-            print "syn_ack_-1  " + str(syn_ack_timestamp_list)
+                            main.log.info( "String cannot be converted" )
+
+            # Sort the list by timestamp
+            syn_ack_timestamp_list = sorted( syn_ack_timestamp_list )
+            print "syn_ack_-1  " + str( syn_ack_timestamp_list )
 
             syn_ack_delta =\
-                    int(float(syn_ack_timestamp_list[-1])*1000) -\
-                    int(float(syn_ack_timestamp_list[0])*1000) 
+                int( float( syn_ack_timestamp_list[ -1 ] ) * 1000 ) -\
+                int( float( syn_ack_timestamp_list[ 0 ] ) * 1000 )
 
-            main.log.info("Switch connection attempt delta iteration "+
-                    str(i)+": "+str(syn_ack_delta))
-            syn_ack_delta_list.append(syn_ack_delta)
-            #END ITERATION LOOP
-        #REPORT HERE 
+            main.log.info( "Switch connection attempt delta iteration " +
+                           str( i ) + ": " + str( syn_ack_delta ) )
+            syn_ack_delta_list.append( syn_ack_delta )
+            # END ITERATION LOOP
+        # REPORT HERE
 
-        if len(sw_discovery_lat_list) > 0:
-            sw_lat_avg = sum(sw_discovery_lat_list) / \
-                     len(sw_discovery_lat_list)
-            sw_lat_dev = numpy.std(sw_discovery_lat_list)
+        if len( sw_discovery_lat_list ) > 0:
+            sw_lat_avg = sum( sw_discovery_lat_list ) / \
+                len( sw_discovery_lat_list )
+            sw_lat_dev = numpy.std( sw_discovery_lat_list )
         else:
             sw_lat_avg = 0
             sw_lat_dev = 0
             assertion = main.FALSE
-        
-        main.log.report("Switch connection attempt time avg "+
-            "(last sw SYN/ACK time - first sw SYN/ACK time) "+
-            str(sum(syn_ack_delta_list)/len(syn_ack_delta_list)) +
-            " ms")
-        main.log.report(str(num_sw)+" Switch discovery lat for "+\
-            str(cluster_count)+" instance(s): ")
-        main.log.report("Avg: "+str(sw_lat_avg)+" ms  "+
-            "Std Deviation: "+str(round(sw_lat_dev,1))+" ms")
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Switch discovery convergence latency" +\
-                        " for "+str(cluster_count)+" nodes successful",
-                onfail="Switch discovery convergence latency" +\
-                        " test failed")
-        
-    def CASE3(self, main):
-        '''
+        main.log.report( "Switch connection attempt time avg " +
+                         "(last sw SYN/ACK time - first sw SYN/ACK time) " +
+                         str( sum( syn_ack_delta_list ) /
+                              len( syn_ack_delta_list ) ) +
+                         " ms" )
+        main.log.report( str( num_sw ) + " Switch discovery lat for " +
+                         str( cluster_count ) + " instance(s): " )
+        main.log.report( "Avg: " +
+                         str( sw_lat_avg ) +
+                         " ms  " +
+                         "Std Deviation: " +
+                         str( round( sw_lat_dev, 1 ) ) +
+                         " ms" )
+
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=assertion,
+            onpass="Switch discovery convergence latency" +
+            " for " +
+            str( cluster_count ) +
+            " nodes successful",
+            onfail="Switch discovery convergence latency" +
+            " test failed" )
+
+    def CASE3( self, main ):
+        """
         Increase number of nodes and initiate CLI
-        '''
+        """
         import time
         import subprocess
         import os
         import requests
         import json
-       
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS4_ip = main.params['CTRL']['ip4']
-        ONOS5_ip = main.params['CTRL']['ip5']
-        ONOS6_ip = main.params['CTRL']['ip6']
-        ONOS7_ip = main.params['CTRL']['ip7']
-        
-        cell_name = main.params['ENV']['cellName']
-        
-        MN1_ip = main.params['MN']['ip1']
-        BENCH_ip = main.params['BENCH']['ip']
 
-        #NOTE:We start with cluster_count at 3. The first 
-        #case already initialized ONOS1. Increase the
-        #cluster count and start from 3.
-        #You can optionally change the increment to
-        #test steps of node sizes, such as 3,5,7
-       
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+        ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+        ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
+        ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
+
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
+
+        # NOTE:We start with cluster_count at 3. The first
+        # case already initialized ONOS1. Increase the
+        # cluster count and start from 3.
+        # You can optionally change the increment to
+        # test steps of node sizes, such as 3,5,7
+
         global cluster_count
-        cluster_count += 2 
-        main.log.report("Increasing cluster size to "+
-            str(cluster_count))
+        cluster_count += 2
+        main.log.report( "Increasing cluster size to " +
+                         str( cluster_count ) )
 
         install_result = main.FALSE
-        #Supports up to 7 node configuration
-        #TODO: Cleanup this ridiculous repetitive code 
+        # Supports up to 7 node configuration
+        # TODO: Cleanup this ridiculous repetitive code
         if cluster_count == 3:
             install_result = \
-                main.ONOSbench.onos_install(node=ONOS2_ip)
+                main.ONOSbench.onos_install( node=ONOS2_ip )
             install_result = \
-                main.ONOSbench.onos_install(node=ONOS3_ip)
-            time.sleep(5)
-            main.log.info("Starting CLI")
-            main.ONOS2cli.start_onos_cli(ONOS2_ip)
-            main.ONOS3cli.start_onos_cli(ONOS3_ip)
-            main.ONOS1cli.add_node(ONOS2_ip, ONOS2_ip)
-            main.ONOS1cli.add_node(ONOS3_ip, ONOS3_ip)
-            
+                main.ONOSbench.onos_install( node=ONOS3_ip )
+            time.sleep( 5 )
+            main.log.info( "Starting CLI" )
+            main.ONOS2cli.start_onos_cli( ONOS2_ip )
+            main.ONOS3cli.start_onos_cli( ONOS3_ip )
+            main.ONOS1cli.add_node( ONOS2_ip, ONOS2_ip )
+            main.ONOS1cli.add_node( ONOS3_ip, ONOS3_ip )
+
         if cluster_count == 4:
-            main.log.info("Installing ONOS on node 4")
+            main.log.info( "Installing ONOS on node 4" )
             install_result = \
-                main.ONOSbench.onos_install(node=ONOS4_ip)
-            time.sleep(5)
-            main.log.info("Starting CLI")
-            main.ONOS4cli.start_onos_cli(ONOS4_ip)
-            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
-        
+                main.ONOSbench.onos_install( node=ONOS4_ip )
+            time.sleep( 5 )
+            main.log.info( "Starting CLI" )
+            main.ONOS4cli.start_onos_cli( ONOS4_ip )
+            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
+
         elif cluster_count == 5:
-            main.log.info("Installing ONOS on nodes 4 and 5")
+            main.log.info( "Installing ONOS on nodes 4 and 5" )
             install_result2 = \
-                main.ONOSbench.onos_install(options="",node=ONOS4_ip)
+                main.ONOSbench.onos_install( options="", node=ONOS4_ip )
             install_result3 = \
-                main.ONOSbench.onos_install(options="",node=ONOS5_ip)
-            time.sleep(5)
-            main.log.info("Starting CLI")
-            main.ONOS4cli.start_onos_cli(ONOS4_ip)
-            main.ONOS5cli.start_onos_cli(ONOS5_ip)
-            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
-            main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
+                main.ONOSbench.onos_install( options="", node=ONOS5_ip )
+            time.sleep( 5 )
+            main.log.info( "Starting CLI" )
+            main.ONOS4cli.start_onos_cli( ONOS4_ip )
+            main.ONOS5cli.start_onos_cli( ONOS5_ip )
+            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
+            main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
             install_result = install_result2 and install_result3
 
         elif cluster_count == 6:
-            main.log.info("Installing ONOS on nodes 4, 5,and 6")
+            main.log.info( "Installing ONOS on nodes 4, 5,and 6" )
             install_result1 = \
-                main.ONOSbench.onos_install(options="",node=ONOS4_ip)
+                main.ONOSbench.onos_install( options="", node=ONOS4_ip )
             install_result2 = \
-                main.ONOSbench.onos_install(options="",node=ONOS5_ip)
+                main.ONOSbench.onos_install( options="", node=ONOS5_ip )
             install_result3 = \
-                main.ONOSbench.onos_install(node=ONOS6_ip)
-            time.sleep(5)
-            main.log.info("Starting CLI")
-            main.ONOS4cli.start_onos_cli(ONOS4_ip)
-            main.ONOS5cli.start_onos_cli(ONOS5_ip)
-            main.ONOS6cli.start_onos_cli(ONOS6_ip)
-            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
-            main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
-            main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip)
+                main.ONOSbench.onos_install( node=ONOS6_ip )
+            time.sleep( 5 )
+            main.log.info( "Starting CLI" )
+            main.ONOS4cli.start_onos_cli( ONOS4_ip )
+            main.ONOS5cli.start_onos_cli( ONOS5_ip )
+            main.ONOS6cli.start_onos_cli( ONOS6_ip )
+            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
+            main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
+            main.ONOS1cli.add_node( ONOS6_ip, ONOS6_ip )
             install_result = install_result1 and install_result2 and\
-                    install_result3
+                install_result3
 
         elif cluster_count == 7:
-            main.log.info("Installing ONOS on nodes 4, 5, 6,and 7")
+            main.log.info( "Installing ONOS on nodes 4, 5, 6,and 7" )
             install_result3 = \
-                main.ONOSbench.onos_install(node=ONOS6_ip)
+                main.ONOSbench.onos_install( node=ONOS6_ip )
             install_result4 = \
-                main.ONOSbench.onos_install(node=ONOS7_ip)
-            main.log.info("Starting CLI")
-            main.ONOS4cli.start_onos_cli(ONOS4_ip)
-            main.ONOS5cli.start_onos_cli(ONOS5_ip)
-            main.ONOS6cli.start_onos_cli(ONOS6_ip)
-            main.ONOS7cli.start_onos_cli(ONOS7_ip) 
-            main.ONOS1cli.add_node(ONOS4_ip, ONOS4_ip)
-            main.ONOS1cli.add_node(ONOS5_ip, ONOS5_ip)
-            main.ONOS1cli.add_node(ONOS6_ip, ONOS6_ip)
-            main.ONOS1cli.add_node(ONOS7_ip, ONOS7_ip)
+                main.ONOSbench.onos_install( node=ONOS7_ip )
+            main.log.info( "Starting CLI" )
+            main.ONOS4cli.start_onos_cli( ONOS4_ip )
+            main.ONOS5cli.start_onos_cli( ONOS5_ip )
+            main.ONOS6cli.start_onos_cli( ONOS6_ip )
+            main.ONOS7cli.start_onos_cli( ONOS7_ip )
+            main.ONOS1cli.add_node( ONOS4_ip, ONOS4_ip )
+            main.ONOS1cli.add_node( ONOS5_ip, ONOS5_ip )
+            main.ONOS1cli.add_node( ONOS6_ip, ONOS6_ip )
+            main.ONOS1cli.add_node( ONOS7_ip, ONOS7_ip )
 
             install_result = \
-                    install_result3 and install_result4
+                install_result3 and install_result4
 
-        time.sleep(5)
+        time.sleep( 5 )
 
         if install_result == main.TRUE:
             assertion = main.TRUE
         else:
             assertion = main.FALSE
-        
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Scale out to "+str(cluster_count)+\
-                       " nodes successful",
-                onfail="Scale out to "+str(cluster_count)+\
-                       " nodes failed")
 
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=assertion,
+            onpass="Scale out to " +
+            str( cluster_count ) +
+            " nodes successful",
+            onfail="Scale out to " +
+            str( cluster_count ) +
+            " nodes failed" )
 
-    def CASE4(self, main):
-        '''
+    def CASE4( self, main ):
+        """
         Cleanup ONOS nodes and Increase topology size
-        '''
-        #TODO: use meaningful assertion
-        assertion=main.TRUE
+        """
+        # TODO: use meaningful assertion
+        assertion = main.TRUE
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS4_ip = main.params['CTRL']['ip4']
-        ONOS5_ip = main.params['CTRL']['ip5']
-        ONOS6_ip = main.params['CTRL']['ip6']
-        ONOS7_ip = main.params['CTRL']['ip7']
-        MN1_ip = main.params['MN']['ip1']
-        BENCH_ip = main.params['BENCH']['ip']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS4_ip = main.params[ 'CTRL' ][ 'ip4' ]
+        ONOS5_ip = main.params[ 'CTRL' ][ 'ip5' ]
+        ONOS6_ip = main.params[ 'CTRL' ][ 'ip6' ]
+        ONOS7_ip = main.params[ 'CTRL' ][ 'ip7' ]
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
 
-        main.log.info("Uninstalling previous instances")
-        main.ONOSbench.onos_uninstall(node_ip = ONOS2_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS3_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS4_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS5_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS6_ip)
-        main.ONOSbench.onos_uninstall(node_ip = ONOS7_ip)
-        
+        main.log.info( "Uninstalling previous instances" )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS2_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS3_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
+
         global topo_iteration
         global cluster_count
-        cluster_count = 1  
+        cluster_count = 1
         topo_iteration += 1
 
-        main.log.report("Increasing topology size")
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-            onpass="Topology size increased successfully",
-            onfail="Topology size was not increased")
-
-
-
+        main.log.report( "Increasing topology size" )
+        utilities.assert_equals( expect=main.TRUE, actual=assertion,
+                                 onpass="Topology size increased successfully",
+                                 onfail="Topology size was not increased" )
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.py b/TestON/tests/TopoPerfNext/TopoPerfNext.py
index 65bc7a9..87d7378 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.py
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.py
@@ -1,37 +1,39 @@
-#TopoPerfNext
+# TopoPerfNext
 #
-#Topology Performance test for ONOS-next
+# Topology Performance test for ONOS-next
 #
-#andrew@onlab.us
+# andrew@onlab.us
 #
-#If your machine does not come with numpy
-#run the following command:
-#sudo apt-get install python-numpy python-scipy 
+# If your machine does not come with numpy
+# run the following command:
+# sudo apt-get install python-numpy python-scipy
 
 import time
 import sys
 import os
 import re
 
+
 class TopoPerfNext:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
-        '''
+    def CASE1( self, main ):
+        """
         ONOS startup sequence
-        '''
+        """
         import time
-    
-        cell_name = main.params['ENV']['cellName']
 
-        git_pull = main.params['GIT']['autoPull']
-        checkout_branch = main.params['GIT']['checkout']
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        
+        git_pull = main.params[ 'GIT' ][ 'autoPull' ]
+        checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
+
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+
         #### Hardcoded ONOS nodes particular to my env ####
         ONOS4_ip = "10.128.174.4"
         ONOS5_ip = "10.128.174.5"
@@ -39,108 +41,108 @@
         ONOS7_ip = "10.128.174.7"
         #### ####
 
-        MN1_ip = main.params['MN']['ip1']
-        BENCH_ip = main.params['BENCH']['ip']
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
 
-        topo_cfg_file = main.params['TEST']['topo_config_file']
-        topo_cfg_name = main.params['TEST']['topo_config_name']
-        
-        main.case("Setting up test environment")
-        main.log.info("Copying topology event accumulator config"+\
-            " to ONOS /package/etc")
-        main.ONOSbench.handle.sendline("cp ~/"+\
-            topo_cfg_file+\
-            " ~/ONOS/tools/package/etc/"+\
-            topo_cfg_name)
-        main.ONOSbench.handle.expect("\$")
+        topo_cfg_file = main.params[ 'TEST' ][ 'topo_config_file' ]
+        topo_cfg_name = main.params[ 'TEST' ][ 'topo_config_name' ]
 
-        main.log.report("Setting up test environment")
+        main.case( "Setting up test environment" )
+        main.log.info( "Copying topology event accumulator config" +
+                       " to ONOS /package/etc" )
+        main.ONOSbench.handle.sendline( "cp ~/" +
+                                        topo_cfg_file +
+                                        " ~/ONOS/tools/package/etc/" +
+                                        topo_cfg_name )
+        main.ONOSbench.handle.expect( "\$" )
 
-        main.step("Cleaning previously installed ONOS if any")
-        main.ONOSbench.onos_uninstall(node_ip=ONOS4_ip)
-        main.ONOSbench.onos_uninstall(node_ip=ONOS5_ip)
-        main.ONOSbench.onos_uninstall(node_ip=ONOS6_ip)
-        main.ONOSbench.onos_uninstall(node_ip=ONOS7_ip)
+        main.log.report( "Setting up test environment" )
 
-        main.step("Creating cell file")
+        main.step( "Cleaning previously installed ONOS if any" )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS4_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS5_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS6_ip )
+        main.ONOSbench.onos_uninstall( node_ip=ONOS7_ip )
+
+        main.step( "Creating cell file" )
         cell_file_result = main.ONOSbench.create_cell_file(
-                BENCH_ip, cell_name, MN1_ip, "onos-core,onos-app-metrics",
-                ONOS1_ip, ONOS2_ip, ONOS3_ip)
+            BENCH_ip, cell_name, MN1_ip, "onos-core,onos-app-metrics",
+            ONOS1_ip, ONOS2_ip, ONOS3_ip )
 
-        main.step("Applying cell file to environment")
-        cell_apply_result = main.ONOSbench.set_cell(cell_name)
+        main.step( "Applying cell file to environment" )
+        cell_apply_result = main.ONOSbench.set_cell( cell_name )
         verify_cell_result = main.ONOSbench.verify_cell()
-        
-        #NOTE: This step may be removed after proper 
-        #      copy cat log functionality
-        main.step("Removing raft/copy-cat logs from ONOS nodes")
-        main.ONOSbench.onos_remove_raft_logs()
-        time.sleep(30)
 
-        main.step("Git checkout and pull "+checkout_branch)
+        # NOTE: This step may be removed after proper
+        #      copy cat log functionality
+        main.step( "Removing raft/copy-cat logs from ONOS nodes" )
+        main.ONOSbench.onos_remove_raft_logs()
+        time.sleep( 30 )
+
+        main.step( "Git checkout and pull " + checkout_branch )
         if git_pull == 'on':
             checkout_result = \
-                    main.ONOSbench.git_checkout(checkout_branch)
+                main.ONOSbench.git_checkout( checkout_branch )
             pull_result = main.ONOSbench.git_pull()
         else:
             checkout_result = main.TRUE
             pull_result = main.TRUE
-            main.log.info("Skipped git checkout and pull")
+            main.log.info( "Skipped git checkout and pull" )
 
-        #TODO: Uncomment when wiki posting works
-        #main.log.report("Commit information - ")
-        #main.ONOSbench.get_version(report=True)
+        # TODO: Uncomment when wiki posting works
+        #main.log.report( "Commit information - " )
+        # main.ONOSbench.get_version( report=True )
 
-        main.step("Using mvn clean & install")
+        main.step( "Using mvn clean & install" )
         #mvn_result = main.ONOSbench.clean_install()
         mvn_result = main.TRUE
 
-        main.step("Set cell for ONOS cli env")
-        main.ONOS1cli.set_cell(cell_name)
-        main.ONOS2cli.set_cell(cell_name)
-        main.ONOS3cli.set_cell(cell_name)
+        main.step( "Set cell for ONOS cli env" )
+        main.ONOS1cli.set_cell( cell_name )
+        main.ONOS2cli.set_cell( cell_name )
+        main.ONOS3cli.set_cell( cell_name )
 
-        main.step("Creating ONOS package")
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-        main.step("Installing ONOS package")
-        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
-        install2_result = main.ONOSbench.onos_install(node=ONOS2_ip)
-        install3_result = main.ONOSbench.onos_install(node=ONOS3_ip)
+        main.step( "Installing ONOS package" )
+        install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
+        install2_result = main.ONOSbench.onos_install( node=ONOS2_ip )
+        install3_result = main.ONOSbench.onos_install( node=ONOS3_ip )
 
-        time.sleep(10)
+        time.sleep( 10 )
 
-        main.step("Start onos cli")
-        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
-        cli2 = main.ONOS2cli.start_onos_cli(ONOS2_ip)
-        cli3 = main.ONOS3cli.start_onos_cli(ONOS3_ip)
+        main.step( "Start onos cli" )
+        cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
+        cli2 = main.ONOS2cli.start_onos_cli( ONOS2_ip )
+        cli3 = main.ONOS3cli.start_onos_cli( ONOS3_ip )
 
-        utilities.assert_equals(expect=main.TRUE,
-                actual= cell_file_result and cell_apply_result and\
-                        verify_cell_result and checkout_result and\
-                        pull_result and mvn_result and\
-                        install1_result and install2_result and\
-                        install3_result,
-                onpass="Test Environment setup successful",
-                onfail="Failed to setup test environment")
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cell_file_result and cell_apply_result and
+                                 verify_cell_result and checkout_result and
+                                 pull_result and mvn_result and
+                                 install1_result and install2_result and
+                                 install3_result,
+                                 onpass="Test Environment setup successful",
+                                 onfail="Failed to setup test environment" )
 
-    def CASE2(self, main):
-        '''
+    def CASE2( self, main ):
+        """
         Assign s1 to ONOS1 and measure latency
-        
+
         There are 4 levels of latency measurements to this test:
-        1) End-to-end measurement: Complete end-to-end measurement
-           from TCP (SYN/ACK) handshake to Graph change
-        2) OFP-to-graph measurement: 'ONOS processing' snippet of
+        1 ) End-to-end measurement: Complete end-to-end measurement
+           from TCP ( SYN/ACK ) handshake to Graph change
+        2 ) OFP-to-graph measurement: 'ONOS processing' snippet of
            measurement from OFP Vendor message to Graph change
-        3) OFP-to-device measurement: 'ONOS processing without 
+        3 ) OFP-to-device measurement: 'ONOS processing without
            graph change' snippet of measurement from OFP vendor
            message to Device change timestamp
-        4) T0-to-device measurement: Measurement that includes
-           the switch handshake to devices timestamp without 
-           the graph view change. (TCP handshake -> Device 
-           change)
-        '''
+        4 ) T0-to-device measurement: Measurement that includes
+           the switch handshake to devices timestamp without
+           the graph view change. ( TCP handshake -> Device
+           change )
+        """
         import time
         import subprocess
         import json
@@ -148,414 +150,436 @@
         import os
         import numpy
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-        #Number of first 'x' iterations to ignore:
-        iter_ignore = int(main.params['TEST']['iterIgnore'])
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
 
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+        # Number of first 'x' iterations to ignore:
+        iter_ignore = int( main.params[ 'TEST' ][ 'iterIgnore' ] )
 
-        debug_mode = main.params['TEST']['debugMode']
-        onos_log = main.params['TEST']['onosLogFile']
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
 
-        #Threshold for the test
-        threshold_str = main.params['TEST']['singleSwThreshold']
-        threshold_obj = threshold_str.split(",")
-        threshold_min = int(threshold_obj[0])
-        threshold_max = int(threshold_obj[1])
+        debug_mode = main.params[ 'TEST' ][ 'debugMode' ]
+        onos_log = main.params[ 'TEST' ][ 'onosLogFile' ]
 
-        #List of switch add latency collected from
-        #all iterations
+        # Threshold for the test
+        threshold_str = main.params[ 'TEST' ][ 'singleSwThreshold' ]
+        threshold_obj = threshold_str.split( "," )
+        threshold_min = int( threshold_obj[ 0 ] )
+        threshold_max = int( threshold_obj[ 1 ] )
+
+        # List of switch add latency collected from
+        # all iterations
         latency_end_to_end_list = []
         latency_ofp_to_graph_list = []
         latency_ofp_to_device_list = []
         latency_t0_to_device_list = []
         latency_tcp_to_ofp_list = []
 
-        #Directory/file to store tshark results
+        # Directory/file to store tshark results
         tshark_of_output = "/tmp/tshark_of_topo.txt"
         tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
 
-        #String to grep in tshark output
-        tshark_tcp_string = "TCP 74 "+default_sw_port
+        # String to grep in tshark output
+        tshark_tcp_string = "TCP 74 " + default_sw_port
         tshark_of_string = "OFP 86 Vendor"
-     
-        #Initialize assertion to TRUE
+
+        # Initialize assertion to TRUE
         assertion = main.TRUE
-      
-        local_time = time.strftime('%x %X')
-        local_time = local_time.replace("/","")
-        local_time = local_time.replace(" ","_")
-        local_time = local_time.replace(":","")
+
+        local_time = time.strftime( '%x %X' )
+        local_time = local_time.replace( "/", "" )
+        local_time = local_time.replace( " ", "_" )
+        local_time = local_time.replace( ":", "" )
         if debug_mode == 'on':
-            main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/single_sw_lat_pcap_"+local_time) 
+            main.ONOS1.tshark_pcap( "eth0",
+                                    "/tmp/single_sw_lat_pcap_" + local_time )
 
-            main.log.info("TEST")
+            main.log.info( "TEST" )
 
-        main.log.report("Latency of adding one switch to controller")
-        main.log.report("First "+str(iter_ignore)+" iterations ignored"+
-                " for jvm warmup time")
-        main.log.report("Total iterations of test: "+str(num_iter))
+        main.log.report( "Latency of adding one switch to controller" )
+        main.log.report(
+            "First " +
+            str( iter_ignore ) +
+            " iterations ignored" +
+            " for jvm warmup time" )
+        main.log.report( "Total iterations of test: " + str( num_iter ) )
 
-        for i in range(0, int(num_iter)):
-            main.log.info("Starting tshark capture")
+        for i in range( 0, int( num_iter ) ):
+            main.log.info( "Starting tshark capture" )
 
-            #* TCP [ACK, SYN] is used as t0_a, the
-            #  very first "exchange" between ONOS and 
+            #* TCP [ ACK, SYN ] is used as t0_a, the
+            #  very first "exchange" between ONOS and
             #  the switch for end-to-end measurement
-            #* OFP [Stats Reply] is used for t0_b
+            #* OFP [ Stats Reply ] is used for t0_b
             #  the very last OFP message between ONOS
             #  and the switch for ONOS measurement
-            main.ONOS1.tshark_grep(tshark_tcp_string,
-                    tshark_tcp_output)
-            main.ONOS1.tshark_grep(tshark_of_string,
-                    tshark_of_output)
+            main.ONOS1.tshark_grep( tshark_tcp_string,
+                                    tshark_tcp_output )
+            main.ONOS1.tshark_grep( tshark_of_string,
+                                    tshark_of_output )
 
-            #Wait and ensure tshark is started and 
-            #capturing
-            time.sleep(10)
+            # Wait and ensure tshark is started and
+            # capturing
+            time.sleep( 10 )
 
-            main.log.info("Assigning s1 to controller")
+            main.log.info( "Assigning s1 to controller" )
 
-            main.Mininet1.assign_sw_controller(sw="1",
-                    ip1=ONOS1_ip, port1=default_sw_port)
+            main.Mininet1.assign_sw_controller(
+                sw="1",
+                ip1=ONOS1_ip,
+                port1=default_sw_port )
 
-            #Wait and ensure switch is assigned
-            #before stopping tshark
-            time.sleep(30)
-   
-            main.log.info("Stopping all Tshark processes")
+            # Wait and ensure switch is assigned
+            # before stopping tshark
+            time.sleep( 30 )
+
+            main.log.info( "Stopping all Tshark processes" )
             main.ONOS1.stop_tshark()
 
-            #tshark output is saved in ONOS. Use subprocess
-            #to copy over files to TestON for parsing
-            main.log.info("Copying over tshark files")
-            
-            #TCP CAPTURE ****
-            #Copy the tshark output from ONOS machine to
-            #TestON machine in tshark_tcp_output directory>file
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_tcp_output+" /tmp/") 
-            tcp_file = open(tshark_tcp_output, 'r')
-            temp_text = tcp_file.readline()
-            temp_text = temp_text.split(" ")
+            # tshark output is saved in ONOS. Use subprocess
+            # to copy over files to TestON for parsing
+            main.log.info( "Copying over tshark files" )
 
-            main.log.info("Object read in from TCP capture: "+
-                    str(temp_text))
-            if len(temp_text) > 1:
-                t0_tcp = float(temp_text[1])*1000.0
+            # TCP CAPTURE ****
+            # Copy the tshark output from ONOS machine to
+            # TestON machine in tshark_tcp_output directory>file
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_tcp_output + " /tmp/" )
+            tcp_file = open( tshark_tcp_output, 'r' )
+            temp_text = tcp_file.readline()
+            temp_text = temp_text.split( " " )
+
+            main.log.info( "Object read in from TCP capture: " +
+                           str( temp_text ) )
+            if len( temp_text ) > 1:
+                t0_tcp = float( temp_text[ 1 ] ) * 1000.0
             else:
-                main.log.error("Tshark output file for TCP"+
-                        " returned unexpected results")
+                main.log.error( "Tshark output file for TCP" +
+                                " returned unexpected results" )
                 t0_tcp = 0
                 assertion = main.FALSE
-            
+
             tcp_file.close()
             #****************
 
-            #OF CAPTURE ****
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_of_output+" /tmp/")
-            of_file = open(tshark_of_output, 'r')
-           
+            # OF CAPTURE ****
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_of_output + " /tmp/" )
+            of_file = open( tshark_of_output, 'r' )
+
             line_ofp = ""
-            #Read until last line of file
+            # Read until last line of file
             while True:
                 temp_text = of_file.readline()
-                if temp_text !='':
+                if temp_text != '':
                     line_ofp = temp_text
                 else:
-                    break 
-            obj = line_ofp.split(" ")
-            
-            main.log.info("Object read in from OFP capture: "+
-                    str(line_ofp))
-    
-            if len(line_ofp) > 1:
-                t0_ofp = float(obj[1])*1000.0
+                    break
+            obj = line_ofp.split( " " )
+
+            main.log.info( "Object read in from OFP capture: " +
+                           str( line_ofp ) )
+
+            if len( line_ofp ) > 1:
+                t0_ofp = float( obj[ 1 ] ) * 1000.0
             else:
-                main.log.error("Tshark output file for OFP"+
-                        " returned unexpected results")
+                main.log.error( "Tshark output file for OFP" +
+                                " returned unexpected results" )
                 t0_ofp = 0
                 assertion = main.FALSE
-            
+
             of_file.close()
             #****************
-           
+
             json_str_1 = main.ONOS1cli.topology_events_metrics()
             json_str_2 = main.ONOS2cli.topology_events_metrics()
             json_str_3 = main.ONOS3cli.topology_events_metrics()
 
-            json_obj_1 = json.loads(json_str_1)
-            json_obj_2 = json.loads(json_str_2)
-            json_obj_3 = json.loads(json_str_3)
+            json_obj_1 = json.loads( json_str_1 )
+            json_obj_2 = json.loads( json_str_2 )
+            json_obj_3 = json.loads( json_str_3 )
 
-            #Obtain graph timestamp. This timestsamp captures
-            #the epoch time at which the topology graph was updated.
+            # Obtain graph timestamp. This timestsamp captures
+            # the epoch time at which the topology graph was updated.
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
             graph_timestamp_2 = \
-                    json_obj_2[graphTimestamp]['value']
+                json_obj_2[ graphTimestamp ][ 'value' ]
             graph_timestamp_3 = \
-                    json_obj_3[graphTimestamp]['value']
+                json_obj_3[ graphTimestamp ][ 'value' ]
 
-            #Obtain device timestamp. This timestamp captures
-            #the epoch time at which the device event happened
+            # Obtain device timestamp. This timestamp captures
+            # the epoch time at which the device event happened
             device_timestamp_1 = \
-                    json_obj_1[deviceTimestamp]['value'] 
+                json_obj_1[ deviceTimestamp ][ 'value' ]
             device_timestamp_2 = \
-                    json_obj_2[deviceTimestamp]['value'] 
+                json_obj_2[ deviceTimestamp ][ 'value' ]
             device_timestamp_3 = \
-                    json_obj_3[deviceTimestamp]['value'] 
+                json_obj_3[ deviceTimestamp ][ 'value' ]
 
-            #t0 to device processing latency 
-            delta_device_1 = int(device_timestamp_1) - int(t0_tcp)
-            delta_device_2 = int(device_timestamp_2) - int(t0_tcp)
-            delta_device_3 = int(device_timestamp_3) - int(t0_tcp)
-        
-            #Get average of delta from all instances
+            # t0 to device processing latency
+            delta_device_1 = int( device_timestamp_1 ) - int( t0_tcp )
+            delta_device_2 = int( device_timestamp_2 ) - int( t0_tcp )
+            delta_device_3 = int( device_timestamp_3 ) - int( t0_tcp )
+
+            # Get average of delta from all instances
             avg_delta_device = \
-                    (int(delta_device_1)+\
-                     int(delta_device_2)+\
-                     int(delta_device_3)) / 3
+                ( int( delta_device_1 ) +
+                  int( delta_device_2 ) +
+                  int( delta_device_3 ) ) / 3
 
-            #Ensure avg delta meets the threshold before appending
+            # Ensure avg delta meets the threshold before appending
             if avg_delta_device > 0.0 and avg_delta_device < 10000\
-                    and int(i) > iter_ignore:
-                latency_t0_to_device_list.append(avg_delta_device)
+                    and int( i ) > iter_ignore:
+                latency_t0_to_device_list.append( avg_delta_device )
             else:
-                main.log.info("Results for t0-to-device ignored"+\
-                        "due to excess in threshold / warmup iteration.")
+                main.log.info(
+                    "Results for t0-to-device ignored" +
+                    "due to excess in threshold / warmup iteration." )
 
-            #t0 to graph processing latency (end-to-end)
-            delta_graph_1 = int(graph_timestamp_1) - int(t0_tcp)
-            delta_graph_2 = int(graph_timestamp_2) - int(t0_tcp)
-            delta_graph_3 = int(graph_timestamp_3) - int(t0_tcp)
-        
-            #Get average of delta from all instances
+            # t0 to graph processing latency ( end-to-end )
+            delta_graph_1 = int( graph_timestamp_1 ) - int( t0_tcp )
+            delta_graph_2 = int( graph_timestamp_2 ) - int( t0_tcp )
+            delta_graph_3 = int( graph_timestamp_3 ) - int( t0_tcp )
+
+            # Get average of delta from all instances
             avg_delta_graph = \
-                    (int(delta_graph_1)+\
-                     int(delta_graph_2)+\
-                     int(delta_graph_3)) / 3
+                ( int( delta_graph_1 ) +
+                  int( delta_graph_2 ) +
+                  int( delta_graph_3 ) ) / 3
 
-            #Ensure avg delta meets the threshold before appending
+            # Ensure avg delta meets the threshold before appending
             if avg_delta_graph > 0.0 and avg_delta_graph < 10000\
-                    and int(i) > iter_ignore:
-                latency_end_to_end_list.append(avg_delta_graph)
+                    and int( i ) > iter_ignore:
+                latency_end_to_end_list.append( avg_delta_graph )
             else:
-                main.log.info("Results for end-to-end ignored"+\
-                        "due to excess in threshold")
+                main.log.info( "Results for end-to-end ignored" +
+                               "due to excess in threshold" )
 
-            #ofp to graph processing latency (ONOS processing)
-            delta_ofp_graph_1 = int(graph_timestamp_1) - int(t0_ofp)
-            delta_ofp_graph_2 = int(graph_timestamp_2) - int(t0_ofp)
-            delta_ofp_graph_3 = int(graph_timestamp_3) - int(t0_ofp)
-            
+            # ofp to graph processing latency ( ONOS processing )
+            delta_ofp_graph_1 = int( graph_timestamp_1 ) - int( t0_ofp )
+            delta_ofp_graph_2 = int( graph_timestamp_2 ) - int( t0_ofp )
+            delta_ofp_graph_3 = int( graph_timestamp_3 ) - int( t0_ofp )
+
             avg_delta_ofp_graph = \
-                    (int(delta_ofp_graph_1)+\
-                     int(delta_ofp_graph_2)+\
-                     int(delta_ofp_graph_3)) / 3
-            
+                ( int( delta_ofp_graph_1 ) +
+                  int( delta_ofp_graph_2 ) +
+                  int( delta_ofp_graph_3 ) ) / 3
+
             if avg_delta_ofp_graph > threshold_min \
                     and avg_delta_ofp_graph < threshold_max\
-                    and int(i) > iter_ignore:
-                latency_ofp_to_graph_list.append(avg_delta_ofp_graph)
-            elif avg_delta_ofp_graph > (-10) and \
+                    and int( i ) > iter_ignore:
+                latency_ofp_to_graph_list.append( avg_delta_ofp_graph )
+            elif avg_delta_ofp_graph > ( -10 ) and \
                     avg_delta_ofp_graph < 0.0 and\
-                    int(i) > iter_ignore:
-                main.log.info("Sub-millisecond result likely; "+
-                    "negative result was rounded to 0")
-                #NOTE: Current metrics framework does not 
-                #support sub-millisecond accuracy. Therefore,
-                #if the result is negative, we can reasonably
-                #conclude sub-millisecond results and just 
-                #append the best rounded effort - 0 ms. 
-                latency_ofp_to_graph_list.append(0)
+                    int( i ) > iter_ignore:
+                main.log.info( "Sub-millisecond result likely; " +
+                               "negative result was rounded to 0" )
+                # NOTE: Current metrics framework does not
+                # support sub-millisecond accuracy. Therefore,
+                # if the result is negative, we can reasonably
+                # conclude sub-millisecond results and just
+                # append the best rounded effort - 0 ms.
+                latency_ofp_to_graph_list.append( 0 )
             else:
-                main.log.info("Results for ofp-to-graph "+\
-                        "ignored due to excess in threshold")
+                main.log.info( "Results for ofp-to-graph " +
+                               "ignored due to excess in threshold" )
 
-            #ofp to device processing latency (ONOS processing)
-            delta_ofp_device_1 = float(device_timestamp_1) - float(t0_ofp)
-            delta_ofp_device_2 = float(device_timestamp_2) - float(t0_ofp)
-            delta_ofp_device_3 = float(device_timestamp_3) - float(t0_ofp)
-            
+            # ofp to device processing latency ( ONOS processing )
+            delta_ofp_device_1 = float( device_timestamp_1 ) - float( t0_ofp )
+            delta_ofp_device_2 = float( device_timestamp_2 ) - float( t0_ofp )
+            delta_ofp_device_3 = float( device_timestamp_3 ) - float( t0_ofp )
+
             avg_delta_ofp_device = \
-                    (float(delta_ofp_device_1)+\
-                     float(delta_ofp_device_2)+\
-                     float(delta_ofp_device_3)) / 3
-            
-            #NOTE: ofp - delta measurements are occasionally negative
-            #      due to system time misalignment.
-            latency_ofp_to_device_list.append(avg_delta_ofp_device)
+                ( float( delta_ofp_device_1 ) +
+                  float( delta_ofp_device_2 ) +
+                  float( delta_ofp_device_3 ) ) / 3
 
-            delta_ofp_tcp = int(t0_ofp) - int(t0_tcp)
+            # NOTE: ofp - delta measurements are occasionally negative
+            #      due to system time misalignment.
+            latency_ofp_to_device_list.append( avg_delta_ofp_device )
+
+            delta_ofp_tcp = int( t0_ofp ) - int( t0_tcp )
             if delta_ofp_tcp > threshold_min \
                     and delta_ofp_tcp < threshold_max and\
-                    int(i) > iter_ignore:
-                latency_tcp_to_ofp_list.append(delta_ofp_tcp)
+                    int( i ) > iter_ignore:
+                latency_tcp_to_ofp_list.append( delta_ofp_tcp )
             else:
-                main.log.info("Results fo tcp-to-ofp "+\
-                        "ignored due to excess in threshold")
+                main.log.info( "Results fo tcp-to-ofp " +
+                               "ignored due to excess in threshold" )
 
-            #TODO:
-            #Fetch logs upon threshold excess
+            # TODO:
+            # Fetch logs upon threshold excess
 
-            main.log.info("ONOS1 delta end-to-end: "+
-                    str(delta_graph_1) + " ms")
-            main.log.info("ONOS2 delta end-to-end: "+
-                    str(delta_graph_2) + " ms")
-            main.log.info("ONOS3 delta end-to-end: "+
-                    str(delta_graph_3) + " ms")
+            main.log.info( "ONOS1 delta end-to-end: " +
+                           str( delta_graph_1 ) + " ms" )
+            main.log.info( "ONOS2 delta end-to-end: " +
+                           str( delta_graph_2 ) + " ms" )
+            main.log.info( "ONOS3 delta end-to-end: " +
+                           str( delta_graph_3 ) + " ms" )
 
-            main.log.info("ONOS1 delta OFP - graph: "+
-                    str(delta_ofp_graph_1) + " ms")
-            main.log.info("ONOS2 delta OFP - graph: "+
-                    str(delta_ofp_graph_2) + " ms")
-            main.log.info("ONOS3 delta OFP - graph: "+
-                    str(delta_ofp_graph_3) + " ms")
-            
-            main.log.info("ONOS1 delta device - t0: "+
-                    str(delta_device_1) + " ms")
-            main.log.info("ONOS2 delta device - t0: "+
-                    str(delta_device_2) + " ms")
-            main.log.info("ONOS3 delta device - t0: "+
-                    str(delta_device_3) + " ms")
-         
-            main.log.info("TCP to OFP delta: "+
-                    str(delta_ofp_tcp) + " ms")
-            #main.log.info("ONOS1 delta OFP - device: "+
-            #        str(delta_ofp_device_1) + " ms")
-            #main.log.info("ONOS2 delta OFP - device: "+
-            #        str(delta_ofp_device_2) + " ms")
-            #main.log.info("ONOS3 delta OFP - device: "+
-            #        str(delta_ofp_device_3) + " ms")
+            main.log.info( "ONOS1 delta OFP - graph: " +
+                           str( delta_ofp_graph_1 ) + " ms" )
+            main.log.info( "ONOS2 delta OFP - graph: " +
+                           str( delta_ofp_graph_2 ) + " ms" )
+            main.log.info( "ONOS3 delta OFP - graph: " +
+                           str( delta_ofp_graph_3 ) + " ms" )
 
-            main.step("Remove switch from controller")
-            main.Mininet1.delete_sw_controller("s1")
+            main.log.info( "ONOS1 delta device - t0: " +
+                           str( delta_device_1 ) + " ms" )
+            main.log.info( "ONOS2 delta device - t0: " +
+                           str( delta_device_2 ) + " ms" )
+            main.log.info( "ONOS3 delta device - t0: " +
+                           str( delta_device_3 ) + " ms" )
 
-            time.sleep(5)
+            main.log.info( "TCP to OFP delta: " +
+                           str( delta_ofp_tcp ) + " ms" )
+            # main.log.info( "ONOS1 delta OFP - device: "+
+            #        str( delta_ofp_device_1 ) + " ms" )
+            # main.log.info( "ONOS2 delta OFP - device: "+
+            #        str( delta_ofp_device_2 ) + " ms" )
+            # main.log.info( "ONOS3 delta OFP - device: "+
+            #        str( delta_ofp_device_3 ) + " ms" )
 
-        #END of for loop iteration
+            main.step( "Remove switch from controller" )
+            main.Mininet1.delete_sw_controller( "s1" )
 
-        #If there is at least 1 element in each list,
-        #pass the test case
-        if len(latency_end_to_end_list) > 0 and\
-           len(latency_ofp_to_graph_list) > 0 and\
-           len(latency_ofp_to_device_list) > 0 and\
-           len(latency_t0_to_device_list) > 0 and\
-           len(latency_tcp_to_ofp_list) > 0:
+            time.sleep( 5 )
+
+        # END of for loop iteration
+
+        # If there is at least 1 element in each list,
+        # pass the test case
+        if len( latency_end_to_end_list ) > 0 and\
+           len( latency_ofp_to_graph_list ) > 0 and\
+           len( latency_ofp_to_device_list ) > 0 and\
+           len( latency_t0_to_device_list ) > 0 and\
+           len( latency_tcp_to_ofp_list ) > 0:
             assertion = main.TRUE
-        elif len(latency_end_to_end_list) == 0:
-            #The appending of 0 here is to prevent 
-            #the min,max,sum functions from failing 
-            #below
-            latency_end_to_end_list.append(0)
+        elif len( latency_end_to_end_list ) == 0:
+            # The appending of 0 here is to prevent
+            # the min,max,sum functions from failing
+            # below
+            latency_end_to_end_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_ofp_to_graph_list) == 0:
-            latency_ofp_to_graph_list.append(0)
+        elif len( latency_ofp_to_graph_list ) == 0:
+            latency_ofp_to_graph_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_ofp_to_device_list) == 0:
-            latency_ofp_to_device_list.append(0)
+        elif len( latency_ofp_to_device_list ) == 0:
+            latency_ofp_to_device_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_t0_to_device_list) == 0:
-            latency_t0_to_device_list.append(0)
+        elif len( latency_t0_to_device_list ) == 0:
+            latency_t0_to_device_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_tcp_to_ofp_list) == 0:
-            latency_tcp_to_ofp_list.append(0)
+        elif len( latency_tcp_to_ofp_list ) == 0:
+            latency_tcp_to_ofp_list.append( 0 )
             assertion = main.FALSE
 
-        #Calculate min, max, avg of latency lists
+        # Calculate min, max, avg of latency lists
         latency_end_to_end_max = \
-                int(max(latency_end_to_end_list))
+            int( max( latency_end_to_end_list ) )
         latency_end_to_end_min = \
-                int(min(latency_end_to_end_list))
+            int( min( latency_end_to_end_list ) )
         latency_end_to_end_avg = \
-                (int(sum(latency_end_to_end_list)) / \
-                 len(latency_end_to_end_list))
+            ( int( sum( latency_end_to_end_list ) ) /
+              len( latency_end_to_end_list ) )
         latency_end_to_end_std_dev = \
-                str(round(numpy.std(latency_end_to_end_list),1))
+            str( round( numpy.std( latency_end_to_end_list ), 1 ) )
 
         latency_ofp_to_graph_max = \
-                int(max(latency_ofp_to_graph_list))
+            int( max( latency_ofp_to_graph_list ) )
         latency_ofp_to_graph_min = \
-                int(min(latency_ofp_to_graph_list))
+            int( min( latency_ofp_to_graph_list ) )
         latency_ofp_to_graph_avg = \
-                (int(sum(latency_ofp_to_graph_list)) / \
-                 len(latency_ofp_to_graph_list))
+            ( int( sum( latency_ofp_to_graph_list ) ) /
+              len( latency_ofp_to_graph_list ) )
         latency_ofp_to_graph_std_dev = \
-                str(round(numpy.std(latency_ofp_to_graph_list),1))
+            str( round( numpy.std( latency_ofp_to_graph_list ), 1 ) )
 
         latency_ofp_to_device_max = \
-                int(max(latency_ofp_to_device_list))
+            int( max( latency_ofp_to_device_list ) )
         latency_ofp_to_device_min = \
-                int(min(latency_ofp_to_device_list))
+            int( min( latency_ofp_to_device_list ) )
         latency_ofp_to_device_avg = \
-                (int(sum(latency_ofp_to_device_list)) / \
-                 len(latency_ofp_to_device_list))
+            ( int( sum( latency_ofp_to_device_list ) ) /
+              len( latency_ofp_to_device_list ) )
         latency_ofp_to_device_std_dev = \
-                str(round(numpy.std(latency_ofp_to_device_list),1))
+            str( round( numpy.std( latency_ofp_to_device_list ), 1 ) )
 
         latency_t0_to_device_max = \
-                int(max(latency_t0_to_device_list))
+            int( max( latency_t0_to_device_list ) )
         latency_t0_to_device_min = \
-                int(min(latency_t0_to_device_list))
+            int( min( latency_t0_to_device_list ) )
         latency_t0_to_device_avg = \
-                (int(sum(latency_t0_to_device_list)) / \
-                 len(latency_t0_to_device_list))
+            ( int( sum( latency_t0_to_device_list ) ) /
+              len( latency_t0_to_device_list ) )
         latency_ofp_to_device_std_dev = \
-                str(round(numpy.std(latency_t0_to_device_list),1))
+            str( round( numpy.std( latency_t0_to_device_list ), 1 ) )
 
         latency_tcp_to_ofp_max = \
-                int(max(latency_tcp_to_ofp_list))
+            int( max( latency_tcp_to_ofp_list ) )
         latency_tcp_to_ofp_min = \
-                int(min(latency_tcp_to_ofp_list))
+            int( min( latency_tcp_to_ofp_list ) )
         latency_tcp_to_ofp_avg = \
-                (int(sum(latency_tcp_to_ofp_list)) / \
-                 len(latency_tcp_to_ofp_list))
+            ( int( sum( latency_tcp_to_ofp_list ) ) /
+              len( latency_tcp_to_ofp_list ) )
         latency_tcp_to_ofp_std_dev = \
-                str(round(numpy.std(latency_tcp_to_ofp_list),1))
+            str( round( numpy.std( latency_tcp_to_ofp_list ), 1 ) )
 
-        main.log.report("Switch add - End-to-end latency: "+\
-                "Avg: "+str(latency_end_to_end_avg)+" ms "+
-                "Std Deviation: "+latency_end_to_end_std_dev+" ms")
-        main.log.report("Switch add - OFP-to-Graph latency: "+\
-                "Note: results are not accurate to sub-millisecond. "+
-                "Any sub-millisecond results are rounded to 0 ms. ")
-        main.log.report("Avg: "+str(latency_ofp_to_graph_avg)+" ms "+
-                "Std Deviation: "+latency_ofp_to_graph_std_dev+" ms")
-        main.log.report("Switch add - TCP-to-OFP latency: "+\
-                "Avg: "+str(latency_tcp_to_ofp_avg)+" ms "+
-                "Std Deviation: "+latency_tcp_to_ofp_std_dev+" ms")
+        main.log.report(
+            "Switch add - End-to-end latency: " +
+            "Avg: " +
+            str( latency_end_to_end_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            latency_end_to_end_std_dev +
+            " ms" )
+        main.log.report(
+            "Switch add - OFP-to-Graph latency: " +
+            "Note: results are not accurate to sub-millisecond. " +
+            "Any sub-millisecond results are rounded to 0 ms. " )
+        main.log.report(
+            "Avg: " +
+            str( latency_ofp_to_graph_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            latency_ofp_to_graph_std_dev +
+            " ms" )
+        main.log.report(
+            "Switch add - TCP-to-OFP latency: " +
+            "Avg: " +
+            str( latency_tcp_to_ofp_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            latency_tcp_to_ofp_std_dev +
+            " ms" )
 
         if debug_mode == 'on':
-            main.ONOS1.cp_logs_to_dir("/opt/onos/log/karaf.log",
-                    "/tmp/", copy_file_name="sw_lat_karaf")
+            main.ONOS1.cp_logs_to_dir( "/opt/onos/log/karaf.log",
+                                       "/tmp/", copy_file_name="sw_lat_karaf" )
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Switch latency test successful",
-                onfail="Switch latency test failed")
+        utilities.assert_equals( expect=main.TRUE, actual=assertion,
+                                 onpass="Switch latency test successful",
+                                 onfail="Switch latency test failed" )
 
-    def CASE3(self, main):
-        '''
+    def CASE3( self, main ):
+        """
         Bring port up / down and measure latency.
         Port enable / disable is simulated by ifconfig up / down
-        
-        In ONOS-next, we must ensure that the port we are 
+
+        In ONOS-next, we must ensure that the port we are
         manipulating is connected to another switch with a valid
         connection. Otherwise, graph view will not be updated.
-        '''
+        """
         import time
         import subprocess
         import os
@@ -563,925 +587,961 @@
         import json
         import numpy
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-      
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
+
         assertion = main.TRUE
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-       
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
-        
-        debug_mode = main.params['TEST']['debugMode']
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
 
-        local_time = time.strftime('%x %X')
-        local_time = local_time.replace("/","")
-        local_time = local_time.replace(" ","_")
-        local_time = local_time.replace(":","")
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        debug_mode = main.params[ 'TEST' ][ 'debugMode' ]
+
+        local_time = time.strftime( '%x %X' )
+        local_time = local_time.replace( "/", "" )
+        local_time = local_time.replace( " ", "_" )
+        local_time = local_time.replace( ":", "" )
         if debug_mode == 'on':
-            main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/port_lat_pcap_"+local_time) 
+            main.ONOS1.tshark_pcap( "eth0",
+                                    "/tmp/port_lat_pcap_" + local_time )
 
-        #Threshold for this test case
-        up_threshold_str = main.params['TEST']['portUpThreshold']
-        down_threshold_str = main.params['TEST']['portDownThreshold']
-        
-        up_threshold_obj = up_threshold_str.split(",")
-        down_threshold_obj = down_threshold_str.split(",")
+        # Threshold for this test case
+        up_threshold_str = main.params[ 'TEST' ][ 'portUpThreshold' ]
+        down_threshold_str = main.params[ 'TEST' ][ 'portDownThreshold' ]
 
-        up_threshold_min = int(up_threshold_obj[0])
-        up_threshold_max = int(up_threshold_obj[1])
+        up_threshold_obj = up_threshold_str.split( "," )
+        down_threshold_obj = down_threshold_str.split( "," )
 
-        down_threshold_min = int(down_threshold_obj[0])
-        down_threshold_max = int(down_threshold_obj[1])
+        up_threshold_min = int( up_threshold_obj[ 0 ] )
+        up_threshold_max = int( up_threshold_obj[ 1 ] )
 
-        #NOTE: Some hardcoded variables you may need to configure
+        down_threshold_min = int( down_threshold_obj[ 0 ] )
+        down_threshold_max = int( down_threshold_obj[ 1 ] )
+
+        # NOTE: Some hardcoded variables you may need to configure
         #      besides the params
-            
+
         tshark_port_status = "OFP 130 Port Status"
 
         tshark_port_up = "/tmp/tshark_port_up.txt"
         tshark_port_down = "/tmp/tshark_port_down.txt"
         interface_config = "s1-eth1"
 
-        main.log.report("Port enable / disable latency")
-        main.log.report("Simulated by ifconfig up / down")
-        main.log.report("Total iterations of test: "+str(num_iter))
+        main.log.report( "Port enable / disable latency" )
+        main.log.report( "Simulated by ifconfig up / down" )
+        main.log.report( "Total iterations of test: " + str( num_iter ) )
 
-        main.step("Assign switches s1 and s2 to controller 1")
-        main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip,
-                port1=default_sw_port)
-        main.Mininet1.assign_sw_controller(sw="2",ip1=ONOS1_ip,
-                port1=default_sw_port)
+        main.step( "Assign switches s1 and s2 to controller 1" )
+        main.Mininet1.assign_sw_controller( sw="1", ip1=ONOS1_ip,
+                                            port1=default_sw_port )
+        main.Mininet1.assign_sw_controller( sw="2", ip1=ONOS1_ip,
+                                            port1=default_sw_port )
 
-        #Give enough time for metrics to propagate the 
-        #assign controller event. Otherwise, these events may
-        #carry over to our measurements
-        time.sleep(15)
+        # Give enough time for metrics to propagate the
+        # assign controller event. Otherwise, these events may
+        # carry over to our measurements
+        time.sleep( 15 )
 
         port_up_device_to_ofp_list = []
         port_up_graph_to_ofp_list = []
         port_down_device_to_ofp_list = []
         port_down_graph_to_ofp_list = []
 
-        for i in range(0, int(num_iter)):
-            main.step("Starting wireshark capture for port status down")
-            main.ONOS1.tshark_grep(tshark_port_status,
-                    tshark_port_down)
-            
-            time.sleep(5)
+        for i in range( 0, int( num_iter ) ):
+            main.step( "Starting wireshark capture for port status down" )
+            main.ONOS1.tshark_grep( tshark_port_status,
+                                    tshark_port_down )
 
-            #Disable interface that is connected to switch 2
-            main.step("Disable port: "+interface_config)
-            main.Mininet1.handle.sendline("sh ifconfig "+
-                    interface_config+" down")
-            main.Mininet1.handle.expect("mininet>")
+            time.sleep( 5 )
 
-            time.sleep(3)
+            # Disable interface that is connected to switch 2
+            main.step( "Disable port: " + interface_config )
+            main.Mininet1.handle.sendline( "sh ifconfig " +
+                                           interface_config + " down" )
+            main.Mininet1.handle.expect( "mininet>" )
+
+            time.sleep( 3 )
             main.ONOS1.tshark_stop()
-            
-            main.step("Obtain t1 by metrics call")
+
+            main.step( "Obtain t1 by metrics call" )
             json_str_up_1 = main.ONOS1cli.topology_events_metrics()
             json_str_up_2 = main.ONOS2cli.topology_events_metrics()
             json_str_up_3 = main.ONOS3cli.topology_events_metrics()
 
-            json_obj_1 = json.loads(json_str_up_1)
-            json_obj_2 = json.loads(json_str_up_2)
-            json_obj_3 = json.loads(json_str_up_3)
-            
-            #Copy tshark output file from ONOS to TestON instance
-            #/tmp directory
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_port_down+" /tmp/")
+            json_obj_1 = json.loads( json_str_up_1 )
+            json_obj_2 = json.loads( json_str_up_2 )
+            json_obj_3 = json.loads( json_str_up_3 )
 
-            f_port_down = open(tshark_port_down, 'r')
-            #Get first line of port down event from tshark
+            # Copy tshark output file from ONOS to TestON instance
+            #/tmp directory
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_port_down + " /tmp/" )
+
+            f_port_down = open( tshark_port_down, 'r' )
+            # Get first line of port down event from tshark
             f_line = f_port_down.readline()
-            obj_down = f_line.split(" ")
-            if len(f_line) > 0:
-                timestamp_begin_pt_down = int(float(obj_down[1])*1000)
-                main.log.info("Port down begin timestamp: "+
-                        str(timestamp_begin_pt_down))
+            obj_down = f_line.split( " " )
+            if len( f_line ) > 0:
+                timestamp_begin_pt_down = int( float( obj_down[ 1 ] ) * 1000 )
+                main.log.info( "Port down begin timestamp: " +
+                               str( timestamp_begin_pt_down ) )
             else:
-                main.log.info("Tshark output file returned unexpected"+
-                        " results: "+str(obj_down))
+                main.log.info( "Tshark output file returned unexpected" +
+                               " results: " + str( obj_down ) )
                 timestamp_begin_pt_down = 0
-            
+
             f_port_down.close()
 
-            main.log.info("TEST tshark obj: "+str(obj_down))
+            main.log.info( "TEST tshark obj: " + str( obj_down ) )
 
-            time.sleep(3)
+            time.sleep( 3 )
 
-            #Obtain graph timestamp. This timestsamp captures
-            #the epoch time at which the topology graph was updated.
+            # Obtain graph timestamp. This timestsamp captures
+            # the epoch time at which the topology graph was updated.
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
             graph_timestamp_2 = \
-                    json_obj_2[graphTimestamp]['value']
+                json_obj_2[ graphTimestamp ][ 'value' ]
             graph_timestamp_3 = \
-                    json_obj_3[graphTimestamp]['value']
+                json_obj_3[ graphTimestamp ][ 'value' ]
 
-            main.log.info("TEST graph timestamp ONOS1: "+
-                    str(graph_timestamp_1))
+            main.log.info( "TEST graph timestamp ONOS1: " +
+                           str( graph_timestamp_1 ) )
 
-            #Obtain device timestamp. This timestamp captures
-            #the epoch time at which the device event happened
+            # Obtain device timestamp. This timestamp captures
+            # the epoch time at which the device event happened
             device_timestamp_1 = \
-                    json_obj_1[deviceTimestamp]['value'] 
+                json_obj_1[ deviceTimestamp ][ 'value' ]
             device_timestamp_2 = \
-                    json_obj_2[deviceTimestamp]['value'] 
+                json_obj_2[ deviceTimestamp ][ 'value' ]
             device_timestamp_3 = \
-                    json_obj_3[deviceTimestamp]['value'] 
+                json_obj_3[ deviceTimestamp ][ 'value' ]
 
-            #Get delta between graph event and OFP 
-            pt_down_graph_to_ofp_1 = int(graph_timestamp_1) -\
-                    int(timestamp_begin_pt_down)
-            pt_down_graph_to_ofp_2 = int(graph_timestamp_2) -\
-                    int(timestamp_begin_pt_down)
-            pt_down_graph_to_ofp_3 = int(graph_timestamp_3) -\
-                    int(timestamp_begin_pt_down)
+            # Get delta between graph event and OFP
+            pt_down_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
+                int( timestamp_begin_pt_down )
+            pt_down_graph_to_ofp_2 = int( graph_timestamp_2 ) -\
+                int( timestamp_begin_pt_down )
+            pt_down_graph_to_ofp_3 = int( graph_timestamp_3 ) -\
+                int( timestamp_begin_pt_down )
 
-            #Get delta between device event and OFP
-            pt_down_device_to_ofp_1 = int(device_timestamp_1) -\
-                    int(timestamp_begin_pt_down)
-            pt_down_device_to_ofp_2 = int(device_timestamp_2) -\
-                    int(timestamp_begin_pt_down)
-            pt_down_device_to_ofp_3 = int(device_timestamp_3) -\
-                    int(timestamp_begin_pt_down)
-       
-            #Caluclate average across clusters
+            # Get delta between device event and OFP
+            pt_down_device_to_ofp_1 = int( device_timestamp_1 ) -\
+                int( timestamp_begin_pt_down )
+            pt_down_device_to_ofp_2 = int( device_timestamp_2 ) -\
+                int( timestamp_begin_pt_down )
+            pt_down_device_to_ofp_3 = int( device_timestamp_3 ) -\
+                int( timestamp_begin_pt_down )
+
+            # Caluclate average across clusters
             pt_down_graph_to_ofp_avg =\
-                    (int(pt_down_graph_to_ofp_1) +
-                     int(pt_down_graph_to_ofp_2) + 
-                     int(pt_down_graph_to_ofp_3)) / 3
+                ( int( pt_down_graph_to_ofp_1 ) +
+                  int( pt_down_graph_to_ofp_2 ) +
+                  int( pt_down_graph_to_ofp_3 ) ) / 3
             pt_down_device_to_ofp_avg = \
-                    (int(pt_down_device_to_ofp_1) + 
-                     int(pt_down_device_to_ofp_2) +
-                     int(pt_down_device_to_ofp_3)) / 3
+                ( int( pt_down_device_to_ofp_1 ) +
+                  int( pt_down_device_to_ofp_2 ) +
+                  int( pt_down_device_to_ofp_3 ) ) / 3
 
             if pt_down_graph_to_ofp_avg > down_threshold_min and \
                     pt_down_graph_to_ofp_avg < down_threshold_max:
                 port_down_graph_to_ofp_list.append(
-                    pt_down_graph_to_ofp_avg)
-                main.log.info("Port down: graph to ofp avg: "+
-                    str(pt_down_graph_to_ofp_avg) + " ms")
+                    pt_down_graph_to_ofp_avg )
+                main.log.info( "Port down: graph to ofp avg: " +
+                               str( pt_down_graph_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port down graph-to-ofp result" +
-                        " exceeded the threshold: "+
-                        str(pt_down_graph_to_ofp_avg))
+                main.log.info( "Average port down graph-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_down_graph_to_ofp_avg ) )
 
             if pt_down_device_to_ofp_avg > 0 and \
                     pt_down_device_to_ofp_avg < 1000:
                 port_down_device_to_ofp_list.append(
-                    pt_down_device_to_ofp_avg)
-                main.log.info("Port down: device to ofp avg: "+
-                    str(pt_down_device_to_ofp_avg) + " ms")
+                    pt_down_device_to_ofp_avg )
+                main.log.info( "Port down: device to ofp avg: " +
+                               str( pt_down_device_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port down device-to-ofp result" +
-                        " exceeded the threshold: "+
-                        str(pt_down_device_to_ofp_avg))
+                main.log.info( "Average port down device-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_down_device_to_ofp_avg ) )
 
-            #Port up events 
-            main.step("Enable port and obtain timestamp")
-            main.step("Starting wireshark capture for port status up")
-            main.ONOS1.tshark_grep(tshark_port_status, tshark_port_up)
-            time.sleep(5)
+            # Port up events
+            main.step( "Enable port and obtain timestamp" )
+            main.step( "Starting wireshark capture for port status up" )
+            main.ONOS1.tshark_grep( tshark_port_status, tshark_port_up )
+            time.sleep( 5 )
 
-            main.Mininet1.handle.sendline("sh ifconfig "+
-                    interface_config+" up")
-            main.Mininet1.handle.expect("mininet>")
-            
-            #Allow time for tshark to capture event
-            time.sleep(3)
+            main.Mininet1.handle.sendline( "sh ifconfig " +
+                                           interface_config + " up" )
+            main.Mininet1.handle.expect( "mininet>" )
+
+            # Allow time for tshark to capture event
+            time.sleep( 3 )
             main.ONOS1.tshark_stop()
 
-            #Obtain metrics shortly afterwards
-            #This timestsamp captures
-            #the epoch time at which the topology graph was updated.
-            main.step("Obtain t1 by REST call")
+            # Obtain metrics shortly afterwards
+            # This timestsamp captures
+            # the epoch time at which the topology graph was updated.
+            main.step( "Obtain t1 by REST call" )
             json_str_up_1 = main.ONOS1cli.topology_events_metrics()
             json_str_up_2 = main.ONOS2cli.topology_events_metrics()
             json_str_up_3 = main.ONOS3cli.topology_events_metrics()
-            
-            json_obj_1 = json.loads(json_str_up_1)
-            json_obj_2 = json.loads(json_str_up_2)
-            json_obj_3 = json.loads(json_str_up_3)
 
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_port_up+" /tmp/")
+            json_obj_1 = json.loads( json_str_up_1 )
+            json_obj_2 = json.loads( json_str_up_2 )
+            json_obj_3 = json.loads( json_str_up_3 )
 
-            f_port_up = open(tshark_port_up, 'r')
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_port_up + " /tmp/" )
+
+            f_port_up = open( tshark_port_up, 'r' )
             f_line = f_port_up.readline()
-            obj_up = f_line.split(" ")
-            if len(f_line) > 0:
-                timestamp_begin_pt_up = int(float(obj_up[1])*1000)
-                main.log.info("Port up begin timestamp: "+
-                        str(timestamp_begin_pt_up))
+            obj_up = f_line.split( " " )
+            if len( f_line ) > 0:
+                timestamp_begin_pt_up = int( float( obj_up[ 1 ] ) * 1000 )
+                main.log.info( "Port up begin timestamp: " +
+                               str( timestamp_begin_pt_up ) )
             else:
-                main.log.info("Tshark output file returned unexpected"+
-                        " results.")
+                main.log.info( "Tshark output file returned unexpected" +
+                               " results." )
                 timestamp_begin_pt_up = 0
-            
+
             f_port_up.close()
 
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
             graph_timestamp_2 = \
-                    json_obj_2[graphTimestamp]['value']
+                json_obj_2[ graphTimestamp ][ 'value' ]
             graph_timestamp_3 = \
-                    json_obj_3[graphTimestamp]['value']
+                json_obj_3[ graphTimestamp ][ 'value' ]
 
-            #Obtain device timestamp. This timestamp captures
-            #the epoch time at which the device event happened
+            # Obtain device timestamp. This timestamp captures
+            # the epoch time at which the device event happened
             device_timestamp_1 = \
-                    json_obj_1[deviceTimestamp]['value'] 
+                json_obj_1[ deviceTimestamp ][ 'value' ]
             device_timestamp_2 = \
-                    json_obj_2[deviceTimestamp]['value'] 
+                json_obj_2[ deviceTimestamp ][ 'value' ]
             device_timestamp_3 = \
-                    json_obj_3[deviceTimestamp]['value'] 
+                json_obj_3[ deviceTimestamp ][ 'value' ]
 
-            #Get delta between graph event and OFP 
-            pt_up_graph_to_ofp_1 = int(graph_timestamp_1) -\
-                    int(timestamp_begin_pt_up)
-            pt_up_graph_to_ofp_2 = int(graph_timestamp_2) -\
-                    int(timestamp_begin_pt_up)
-            pt_up_graph_to_ofp_3 = int(graph_timestamp_3) -\
-                    int(timestamp_begin_pt_up)
+            # Get delta between graph event and OFP
+            pt_up_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
+                int( timestamp_begin_pt_up )
+            pt_up_graph_to_ofp_2 = int( graph_timestamp_2 ) -\
+                int( timestamp_begin_pt_up )
+            pt_up_graph_to_ofp_3 = int( graph_timestamp_3 ) -\
+                int( timestamp_begin_pt_up )
 
-            #Get delta between device event and OFP
-            pt_up_device_to_ofp_1 = int(device_timestamp_1) -\
-                    int(timestamp_begin_pt_up)
-            pt_up_device_to_ofp_2 = int(device_timestamp_2) -\
-                    int(timestamp_begin_pt_up)
-            pt_up_device_to_ofp_3 = int(device_timestamp_3) -\
-                    int(timestamp_begin_pt_up)
+            # Get delta between device event and OFP
+            pt_up_device_to_ofp_1 = int( device_timestamp_1 ) -\
+                int( timestamp_begin_pt_up )
+            pt_up_device_to_ofp_2 = int( device_timestamp_2 ) -\
+                int( timestamp_begin_pt_up )
+            pt_up_device_to_ofp_3 = int( device_timestamp_3 ) -\
+                int( timestamp_begin_pt_up )
 
-            main.log.info("ONOS1 delta G2O: "+str(pt_up_graph_to_ofp_1))
-            main.log.info("ONOS2 delta G2O: "+str(pt_up_graph_to_ofp_2))
-            main.log.info("ONOS3 delta G2O: "+str(pt_up_graph_to_ofp_3))
+            main.log.info( "ONOS1 delta G2O: " + str( pt_up_graph_to_ofp_1 ) )
+            main.log.info( "ONOS2 delta G2O: " + str( pt_up_graph_to_ofp_2 ) )
+            main.log.info( "ONOS3 delta G2O: " + str( pt_up_graph_to_ofp_3 ) )
 
-            main.log.info("ONOS1 delta D2O: "+str(pt_up_device_to_ofp_1))
-            main.log.info("ONOS2 delta D2O: "+str(pt_up_device_to_ofp_2)) 
-            main.log.info("ONOS3 delta D2O: "+str(pt_up_device_to_ofp_3)) 
+            main.log.info( "ONOS1 delta D2O: " + str( pt_up_device_to_ofp_1 ) )
+            main.log.info( "ONOS2 delta D2O: " + str( pt_up_device_to_ofp_2 ) )
+            main.log.info( "ONOS3 delta D2O: " + str( pt_up_device_to_ofp_3 ) )
 
             pt_up_graph_to_ofp_avg = \
-                    (int(pt_up_graph_to_ofp_1) + 
-                     int(pt_up_graph_to_ofp_2) +
-                     int(pt_up_graph_to_ofp_3)) / 3
+                ( int( pt_up_graph_to_ofp_1 ) +
+                  int( pt_up_graph_to_ofp_2 ) +
+                  int( pt_up_graph_to_ofp_3 ) ) / 3
 
             pt_up_device_to_ofp_avg = \
-                    (int(pt_up_device_to_ofp_1) + 
-                     int(pt_up_device_to_ofp_2) +
-                     int(pt_up_device_to_ofp_3)) / 3
+                ( int( pt_up_device_to_ofp_1 ) +
+                  int( pt_up_device_to_ofp_2 ) +
+                  int( pt_up_device_to_ofp_3 ) ) / 3
 
             if pt_up_graph_to_ofp_avg > up_threshold_min and \
-                    pt_up_graph_to_ofp_avg < up_threshold_max: 
+                    pt_up_graph_to_ofp_avg < up_threshold_max:
                 port_up_graph_to_ofp_list.append(
-                        pt_up_graph_to_ofp_avg)
-                main.log.info("Port down: graph to ofp avg: "+
-                    str(pt_up_graph_to_ofp_avg) + " ms")
+                    pt_up_graph_to_ofp_avg )
+                main.log.info( "Port down: graph to ofp avg: " +
+                               str( pt_up_graph_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port up graph-to-ofp result"+
-                        " exceeded the threshold: "+
-                        str(pt_up_graph_to_ofp_avg))
-            
+                main.log.info( "Average port up graph-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_up_graph_to_ofp_avg ) )
+
             if pt_up_device_to_ofp_avg > up_threshold_min and \
                     pt_up_device_to_ofp_avg < up_threshold_max:
                 port_up_device_to_ofp_list.append(
-                        pt_up_device_to_ofp_avg)
-                main.log.info("Port up: device to ofp avg: "+
-                    str(pt_up_device_to_ofp_avg) + " ms")
+                    pt_up_device_to_ofp_avg )
+                main.log.info( "Port up: device to ofp avg: " +
+                               str( pt_up_device_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port up device-to-ofp result"+
-                        " exceeded the threshold: "+
-                        str(pt_up_device_to_ofp_avg))
-            
-            #END ITERATION FOR LOOP
-        
-        #Check all list for latency existence and set assertion
-        if (port_down_graph_to_ofp_list and port_down_device_to_ofp_list\
-           and port_up_graph_to_ofp_list and port_up_device_to_ofp_list):
+                main.log.info( "Average port up device-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_up_device_to_ofp_avg ) )
+
+            # END ITERATION FOR LOOP
+
+        # Check all list for latency existence and set assertion
+        if ( port_down_graph_to_ofp_list and port_down_device_to_ofp_list
+                and port_up_graph_to_ofp_list and port_up_device_to_ofp_list ):
             assertion = main.TRUE
 
-        #Calculate and report latency measurements
-        port_down_graph_to_ofp_min = min(port_down_graph_to_ofp_list)
-        port_down_graph_to_ofp_max = max(port_down_graph_to_ofp_list)
+        # Calculate and report latency measurements
+        port_down_graph_to_ofp_min = min( port_down_graph_to_ofp_list )
+        port_down_graph_to_ofp_max = max( port_down_graph_to_ofp_list )
         port_down_graph_to_ofp_avg = \
-                (sum(port_down_graph_to_ofp_list) / 
-                 len(port_down_graph_to_ofp_list))
+            ( sum( port_down_graph_to_ofp_list ) /
+              len( port_down_graph_to_ofp_list ) )
         port_down_graph_to_ofp_std_dev = \
-                str(round(numpy.std(port_down_graph_to_ofp_list),1))
-        
-        main.log.report("Port down graph-to-ofp "+
-                "Avg: "+str(port_down_graph_to_ofp_avg)+" ms "+
-                "Std Deviation: "+port_down_graph_to_ofp_std_dev+" ms")
-        
-        port_down_device_to_ofp_min = min(port_down_device_to_ofp_list)
-        port_down_device_to_ofp_max = max(port_down_device_to_ofp_list)
+            str( round( numpy.std( port_down_graph_to_ofp_list ), 1 ) )
+
+        main.log.report(
+            "Port down graph-to-ofp " +
+            "Avg: " +
+            str( port_down_graph_to_ofp_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            port_down_graph_to_ofp_std_dev +
+            " ms" )
+
+        port_down_device_to_ofp_min = min( port_down_device_to_ofp_list )
+        port_down_device_to_ofp_max = max( port_down_device_to_ofp_list )
         port_down_device_to_ofp_avg = \
-                (sum(port_down_device_to_ofp_list) /\
-                 len(port_down_device_to_ofp_list))
+            ( sum( port_down_device_to_ofp_list ) /
+              len( port_down_device_to_ofp_list ) )
         port_down_device_to_ofp_std_dev = \
-                str(round(numpy.std(port_down_device_to_ofp_list),1))
-        
-        main.log.report("Port down device-to-ofp "+
-                "Avg: "+str(port_down_device_to_ofp_avg)+" ms "+
-                "Std Deviation: "+port_down_device_to_ofp_std_dev+" ms")
-        
-        port_up_graph_to_ofp_min = min(port_up_graph_to_ofp_list)
-        port_up_graph_to_ofp_max = max(port_up_graph_to_ofp_list)
+            str( round( numpy.std( port_down_device_to_ofp_list ), 1 ) )
+
+        main.log.report(
+            "Port down device-to-ofp " +
+            "Avg: " +
+            str( port_down_device_to_ofp_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            port_down_device_to_ofp_std_dev +
+            " ms" )
+
+        port_up_graph_to_ofp_min = min( port_up_graph_to_ofp_list )
+        port_up_graph_to_ofp_max = max( port_up_graph_to_ofp_list )
         port_up_graph_to_ofp_avg = \
-                (sum(port_up_graph_to_ofp_list) /\
-                 len(port_up_graph_to_ofp_list))
+            ( sum( port_up_graph_to_ofp_list ) /
+              len( port_up_graph_to_ofp_list ) )
         port_up_graph_to_ofp_std_dev = \
-                str(round(numpy.std(port_up_graph_to_ofp_list),1))
-        
-        main.log.report("Port up graph-to-ofp "+
-                "Avg: "+str(port_up_graph_to_ofp_avg)+" ms "+
-                "Std Deviation: "+port_up_graph_to_ofp_std_dev+" ms")
-          
-        port_up_device_to_ofp_min = min(port_up_device_to_ofp_list)
-        port_up_device_to_ofp_max = max(port_up_device_to_ofp_list)
+            str( round( numpy.std( port_up_graph_to_ofp_list ), 1 ) )
+
+        main.log.report(
+            "Port up graph-to-ofp " +
+            "Avg: " +
+            str( port_up_graph_to_ofp_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            port_up_graph_to_ofp_std_dev +
+            " ms" )
+
+        port_up_device_to_ofp_min = min( port_up_device_to_ofp_list )
+        port_up_device_to_ofp_max = max( port_up_device_to_ofp_list )
         port_up_device_to_ofp_avg = \
-                (sum(port_up_device_to_ofp_list) /\
-                 len(port_up_device_to_ofp_list))
+            ( sum( port_up_device_to_ofp_list ) /
+              len( port_up_device_to_ofp_list ) )
         port_up_device_to_ofp_std_dev = \
-                str(round(numpy.std(port_up_device_to_ofp_list),1))
-        
-        main.log.report("Port up device-to-ofp "+
-                "Avg: "+str(port_up_device_to_ofp_avg)+" ms "+
-                "Std Deviation: "+port_up_device_to_ofp_std_dev+" ms")
+            str( round( numpy.std( port_up_device_to_ofp_list ), 1 ) )
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Port discovery latency calculation successful",
-                onfail="Port discovery test failed")
+        main.log.report(
+            "Port up device-to-ofp " +
+            "Avg: " +
+            str( port_up_device_to_ofp_avg ) +
+            " ms " +
+            "Std Deviation: " +
+            port_up_device_to_ofp_std_dev +
+            " ms" )
 
-    def CASE4(self, main):
-        '''
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=assertion,
+            onpass="Port discovery latency calculation successful",
+            onfail="Port discovery test failed" )
+
+    def CASE4( self, main ):
+        """
         Link down event using loss rate 100%
-        
+
         Important:
             Use a simple 2 switch topology with 1 link between
-            the two switches. Ensure that mac addresses of the 
+            the two switches. Ensure that mac addresses of the
             switches are 1 / 2 respectively
-        '''
+        """
         import time
         import subprocess
         import os
         import requests
         import json
-        import numpy 
-    
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        ONOS_user = main.params['CTRL']['user']
+        import numpy
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-       
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        linkTimestamp = main.params['JSON']['linkTimestamp'] 
-        graphTimestamp = main.params['JSON']['graphTimestamp']
-        
-        debug_mode = main.params['TEST']['debugMode']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        local_time = time.strftime('%x %X')
-        local_time = local_time.replace("/","")
-        local_time = local_time.replace(" ","_")
-        local_time = local_time.replace(":","")
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
+
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        linkTimestamp = main.params[ 'JSON' ][ 'linkTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        debug_mode = main.params[ 'TEST' ][ 'debugMode' ]
+
+        local_time = time.strftime( '%x %X' )
+        local_time = local_time.replace( "/", "" )
+        local_time = local_time.replace( " ", "_" )
+        local_time = local_time.replace( ":", "" )
         if debug_mode == 'on':
-            main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/link_lat_pcap_"+local_time) 
+            main.ONOS1.tshark_pcap( "eth0",
+                                    "/tmp/link_lat_pcap_" + local_time )
 
-        #Threshold for this test case
-        up_threshold_str = main.params['TEST']['linkUpThreshold']
-        down_threshold_str = main.params['TEST']['linkDownThreshold']
+        # Threshold for this test case
+        up_threshold_str = main.params[ 'TEST' ][ 'linkUpThreshold' ]
+        down_threshold_str = main.params[ 'TEST' ][ 'linkDownThreshold' ]
 
-        up_threshold_obj = up_threshold_str.split(",")
-        down_threshold_obj = down_threshold_str.split(",")
+        up_threshold_obj = up_threshold_str.split( "," )
+        down_threshold_obj = down_threshold_str.split( "," )
 
-        up_threshold_min = int(up_threshold_obj[0])
-        up_threshold_max = int(up_threshold_obj[1])
+        up_threshold_min = int( up_threshold_obj[ 0 ] )
+        up_threshold_max = int( up_threshold_obj[ 1 ] )
 
-        down_threshold_min = int(down_threshold_obj[0])
-        down_threshold_max = int(down_threshold_obj[1])
+        down_threshold_min = int( down_threshold_obj[ 0 ] )
+        down_threshold_max = int( down_threshold_obj[ 1 ] )
 
         assertion = main.TRUE
-        #Link event timestamp to system time list
+        # Link event timestamp to system time list
         link_down_link_to_system_list = []
         link_up_link_to_system_list = []
-        #Graph event timestamp to system time list
+        # Graph event timestamp to system time list
         link_down_graph_to_system_list = []
-        link_up_graph_to_system_list = [] 
+        link_up_graph_to_system_list = []
 
-        main.log.report("Link up / down discovery latency between "+
-                "two switches")
-        main.log.report("Simulated by setting loss-rate 100%")
-        main.log.report("'tc qdisc add dev <intfs> root netem loss 100%'") 
-        main.log.report("Total iterations of test: "+str(num_iter))
+        main.log.report( "Link up / down discovery latency between " +
+                         "two switches" )
+        main.log.report( "Simulated by setting loss-rate 100%" )
+        main.log.report( "'tc qdisc add dev <intfs> root netem loss 100%'" )
+        main.log.report( "Total iterations of test: " + str( num_iter ) )
 
-        main.step("Assign all switches")
-        main.Mininet1.assign_sw_controller(sw="1",
-                ip1=ONOS1_ip, port1=default_sw_port)
-        main.Mininet1.assign_sw_controller(sw="2",
-                ip1=ONOS1_ip, port1=default_sw_port)
+        main.step( "Assign all switches" )
+        main.Mininet1.assign_sw_controller(
+            sw="1",
+            ip1=ONOS1_ip,
+            port1=default_sw_port )
+        main.Mininet1.assign_sw_controller(
+            sw="2",
+            ip1=ONOS1_ip,
+            port1=default_sw_port )
 
-        main.step("Verifying switch assignment")
-        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
-        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
-          
-        #Allow time for events to finish before taking measurements
-        time.sleep(10)
+        main.step( "Verifying switch assignment" )
+        result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
+        result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
+
+        # Allow time for events to finish before taking measurements
+        time.sleep( 10 )
 
         link_down1 = False
         link_down2 = False
         link_down3 = False
-        #Start iteration of link event test
-        for i in range(0, int(num_iter)):
-            main.step("Getting initial system time as t0")
-            
-            timestamp_link_down_t0 = time.time() * 1000
-            #Link down is simulated by 100% loss rate using traffic 
-            #control command
-            main.Mininet1.handle.sendline(
-                    "sh tc qdisc add dev s1-eth1 root netem loss 100%")
+        # Start iteration of link event test
+        for i in range( 0, int( num_iter ) ):
+            main.step( "Getting initial system time as t0" )
 
-            #TODO: Iterate through 'links' command to verify that
-            #      link s1 -> s2 went down (loop timeout 30 seconds) 
+            timestamp_link_down_t0 = time.time() * 1000
+            # Link down is simulated by 100% loss rate using traffic
+            # control command
+            main.Mininet1.handle.sendline(
+                "sh tc qdisc add dev s1-eth1 root netem loss 100%" )
+
+            # TODO: Iterate through 'links' command to verify that
+            #      link s1 -> s2 went down ( loop timeout 30 seconds )
             #      on all 3 ONOS instances
-            main.log.info("Checking ONOS for link update")
+            main.log.info( "Checking ONOS for link update" )
             loop_count = 0
-            while( not (link_down1 and link_down2 and link_down3)\
+            while( not ( link_down1 and link_down2 and link_down3 )
                     and loop_count < 30 ):
                 json_str1 = main.ONOS1cli.links()
                 json_str2 = main.ONOS2cli.links()
                 json_str3 = main.ONOS3cli.links()
-                
-                if not (json_str1 and json_str2 and json_str3):
-                    main.log.error("CLI command returned error ")
+
+                if not ( json_str1 and json_str2 and json_str3 ):
+                    main.log.error( "CLI command returned error " )
                     break
                 else:
-                    json_obj1 = json.loads(json_str1)
-                    json_obj2 = json.loads(json_str2)
-                    json_obj3 = json.loads(json_str3)
+                    json_obj1 = json.loads( json_str1 )
+                    json_obj2 = json.loads( json_str2 )
+                    json_obj3 = json.loads( json_str3 )
                 for obj1 in json_obj1:
-                    if '01' not in obj1['src']['device']:
+                    if '01' not in obj1[ 'src' ][ 'device' ]:
                         link_down1 = True
-                        main.log.info("Link down from "+
-                                "s1 -> s2 on ONOS1 detected")
+                        main.log.info( "Link down from " +
+                                       "s1 -> s2 on ONOS1 detected" )
                 for obj2 in json_obj2:
-                    if '01' not in obj2['src']['device']:
+                    if '01' not in obj2[ 'src' ][ 'device' ]:
                         link_down2 = True
-                        main.log.info("Link down from "+
-                                "s1 -> s2 on ONOS2 detected")
+                        main.log.info( "Link down from " +
+                                       "s1 -> s2 on ONOS2 detected" )
                 for obj3 in json_obj3:
-                    if '01' not in obj3['src']['device']:
+                    if '01' not in obj3[ 'src' ][ 'device' ]:
                         link_down3 = True
-                        main.log.info("Link down from "+
-                                "s1 -> s2 on ONOS3 detected")
-                
+                        main.log.info( "Link down from " +
+                                       "s1 -> s2 on ONOS3 detected" )
+
                 loop_count += 1
-                #If CLI doesn't like the continuous requests
-                #and exits in this loop, increase the sleep here.
-                #Consequently, while loop timeout will increase
-                time.sleep(1)
-    
-            #Give time for metrics measurement to catch up
-            #NOTE: May need to be configured more accurately
-            time.sleep(10)
-            #If we exited the while loop and link down 1,2,3 are still 
-            #false, then ONOS has failed to discover link down event
-            if not (link_down1 and link_down2 and link_down3):
-                main.log.info("Link down discovery failed")
-                
+                # If CLI doesn't like the continuous requests
+                # and exits in this loop, increase the sleep here.
+                # Consequently, while loop timeout will increase
+                time.sleep( 1 )
+
+            # Give time for metrics measurement to catch up
+            # NOTE: May need to be configured more accurately
+            time.sleep( 10 )
+            # If we exited the while loop and link down 1,2,3 are still
+            # false, then ONOS has failed to discover link down event
+            if not ( link_down1 and link_down2 and link_down3 ):
+                main.log.info( "Link down discovery failed" )
+
                 link_down_lat_graph1 = 0
                 link_down_lat_graph2 = 0
                 link_down_lat_graph3 = 0
                 link_down_lat_device1 = 0
                 link_down_lat_device2 = 0
                 link_down_lat_device3 = 0
-                
+
                 assertion = main.FALSE
             else:
                 json_topo_metrics_1 =\
-                        main.ONOS1cli.topology_events_metrics()
+                    main.ONOS1cli.topology_events_metrics()
                 json_topo_metrics_2 =\
-                        main.ONOS2cli.topology_events_metrics()
+                    main.ONOS2cli.topology_events_metrics()
                 json_topo_metrics_3 =\
-                        main.ONOS3cli.topology_events_metrics()
-                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
-                json_topo_metrics_2 = json.loads(json_topo_metrics_2)
-                json_topo_metrics_3 = json.loads(json_topo_metrics_3)
+                    main.ONOS3cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
+                json_topo_metrics_2 = json.loads( json_topo_metrics_2 )
+                json_topo_metrics_3 = json.loads( json_topo_metrics_3 )
 
-                main.log.info("Obtaining graph and device timestamp")
+                main.log.info( "Obtaining graph and device timestamp" )
                 graph_timestamp_1 = \
-                    json_topo_metrics_1[graphTimestamp]['value']
+                    json_topo_metrics_1[ graphTimestamp ][ 'value' ]
                 graph_timestamp_2 = \
-                    json_topo_metrics_2[graphTimestamp]['value']
+                    json_topo_metrics_2[ graphTimestamp ][ 'value' ]
                 graph_timestamp_3 = \
-                    json_topo_metrics_3[graphTimestamp]['value']
+                    json_topo_metrics_3[ graphTimestamp ][ 'value' ]
 
                 link_timestamp_1 = \
-                    json_topo_metrics_1[linkTimestamp]['value']
+                    json_topo_metrics_1[ linkTimestamp ][ 'value' ]
                 link_timestamp_2 = \
-                    json_topo_metrics_2[linkTimestamp]['value']
+                    json_topo_metrics_2[ linkTimestamp ][ 'value' ]
                 link_timestamp_3 = \
-                    json_topo_metrics_3[linkTimestamp]['value']
+                    json_topo_metrics_3[ linkTimestamp ][ 'value' ]
 
                 if graph_timestamp_1 and graph_timestamp_2 and\
                         graph_timestamp_3 and link_timestamp_1 and\
                         link_timestamp_2 and link_timestamp_3:
-                    link_down_lat_graph1 = int(graph_timestamp_1) -\
-                            int(timestamp_link_down_t0)
-                    link_down_lat_graph2 = int(graph_timestamp_2) -\
-                            int(timestamp_link_down_t0)
-                    link_down_lat_graph3 = int(graph_timestamp_3) -\
-                            int(timestamp_link_down_t0)
-                
-                    link_down_lat_link1 = int(link_timestamp_1) -\
-                            int(timestamp_link_down_t0)
-                    link_down_lat_link2 = int(link_timestamp_2) -\
-                            int(timestamp_link_down_t0)
-                    link_down_lat_link3 = int(link_timestamp_3) -\
-                            int(timestamp_link_down_t0)
+                    link_down_lat_graph1 = int( graph_timestamp_1 ) -\
+                        int( timestamp_link_down_t0 )
+                    link_down_lat_graph2 = int( graph_timestamp_2 ) -\
+                        int( timestamp_link_down_t0 )
+                    link_down_lat_graph3 = int( graph_timestamp_3 ) -\
+                        int( timestamp_link_down_t0 )
+
+                    link_down_lat_link1 = int( link_timestamp_1 ) -\
+                        int( timestamp_link_down_t0 )
+                    link_down_lat_link2 = int( link_timestamp_2 ) -\
+                        int( timestamp_link_down_t0 )
+                    link_down_lat_link3 = int( link_timestamp_3 ) -\
+                        int( timestamp_link_down_t0 )
                 else:
-                    main.log.error("There was an error calculating"+
-                        " the delta for link down event")
+                    main.log.error( "There was an error calculating" +
+                                    " the delta for link down event" )
                     link_down_lat_graph1 = 0
                     link_down_lat_graph2 = 0
                     link_down_lat_graph3 = 0
-                    
+
                     link_down_lat_device1 = 0
                     link_down_lat_device2 = 0
                     link_down_lat_device3 = 0
-        
-            main.log.info("Link down latency ONOS1 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_down_lat_graph1)+" ms")
-            main.log.info("Link down latency ONOS2 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_down_lat_graph2)+" ms")
-            main.log.info("Link down latency ONOS3 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_down_lat_graph3)+" ms")
-            
-            main.log.info("Link down latency ONOS1 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_down_lat_link1)+" ms")
-            main.log.info("Link down latency ONOS2 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_down_lat_link2)+" ms")
-            main.log.info("Link down latency ONOS3 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_down_lat_link3))
-      
-            #Calculate avg of node calculations
-            link_down_lat_graph_avg =\
-                    (link_down_lat_graph1 +
-                     link_down_lat_graph2 +
-                     link_down_lat_graph3) / 3
-            link_down_lat_link_avg =\
-                    (link_down_lat_link1 +
-                     link_down_lat_link2 +
-                     link_down_lat_link3) / 3
 
-            #Set threshold and append latency to list
+            main.log.info( "Link down latency ONOS1 iteration " +
+                           str( i ) + " (end-to-end): " +
+                           str( link_down_lat_graph1 ) + " ms" )
+            main.log.info( "Link down latency ONOS2 iteration " +
+                           str( i ) + " (end-to-end): " +
+                           str( link_down_lat_graph2 ) + " ms" )
+            main.log.info( "Link down latency ONOS3 iteration " +
+                           str( i ) + " (end-to-end): " +
+                           str( link_down_lat_graph3 ) + " ms" )
+
+            main.log.info( "Link down latency ONOS1 iteration " +
+                           str( i ) + " (link-event-to-system-timestamp): " +
+                           str( link_down_lat_link1 ) + " ms" )
+            main.log.info( "Link down latency ONOS2 iteration " +
+                           str( i ) + " (link-event-to-system-timestamp): " +
+                           str( link_down_lat_link2 ) + " ms" )
+            main.log.info( "Link down latency ONOS3 iteration " +
+                           str( i ) + " (link-event-to-system-timestamp): " +
+                           str( link_down_lat_link3 ) )
+
+            # Calculate avg of node calculations
+            link_down_lat_graph_avg =\
+                ( link_down_lat_graph1 +
+                  link_down_lat_graph2 +
+                  link_down_lat_graph3 ) / 3
+            link_down_lat_link_avg =\
+                ( link_down_lat_link1 +
+                  link_down_lat_link2 +
+                  link_down_lat_link3 ) / 3
+
+            # Set threshold and append latency to list
             if link_down_lat_graph_avg > down_threshold_min and\
                link_down_lat_graph_avg < down_threshold_max:
                 link_down_graph_to_system_list.append(
-                        link_down_lat_graph_avg)
+                    link_down_lat_graph_avg )
             else:
-                main.log.info("Link down latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link down latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
             if link_down_lat_link_avg > down_threshold_min and\
                link_down_lat_link_avg < down_threshold_max:
                 link_down_link_to_system_list.append(
-                        link_down_lat_link_avg)
+                    link_down_lat_link_avg )
             else:
-                main.log.info("Link down latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link down latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
 
-            #NOTE: To remove loss rate and measure latency:
+            # NOTE: To remove loss rate and measure latency:
             #       'sh tc qdisc del dev s1-eth1 root'
             timestamp_link_up_t0 = time.time() * 1000
-            main.Mininet1.handle.sendline("sh tc qdisc del dev "+
-                    "s1-eth1 root")
-            main.Mininet1.handle.expect("mininet>")
-            
-            main.log.info("Checking ONOS for link update")
-            
+            main.Mininet1.handle.sendline( "sh tc qdisc del dev " +
+                                           "s1-eth1 root" )
+            main.Mininet1.handle.expect( "mininet>" )
+
+            main.log.info( "Checking ONOS for link update" )
+
             link_down1 = True
             link_down2 = True
             link_down3 = True
             loop_count = 0
-            while( (link_down1 and link_down2 and link_down3)\
+            while( ( link_down1 and link_down2 and link_down3 )
                     and loop_count < 30 ):
                 json_str1 = main.ONOS1cli.links()
                 json_str2 = main.ONOS2cli.links()
                 json_str3 = main.ONOS3cli.links()
-                if not (json_str1 and json_str2 and json_str3):
-                    main.log.error("CLI command returned error ")
+                if not ( json_str1 and json_str2 and json_str3 ):
+                    main.log.error( "CLI command returned error " )
                     break
                 else:
-                    json_obj1 = json.loads(json_str1)
-                    json_obj2 = json.loads(json_str2)
-                    json_obj3 = json.loads(json_str3)
-                
+                    json_obj1 = json.loads( json_str1 )
+                    json_obj2 = json.loads( json_str2 )
+                    json_obj3 = json.loads( json_str3 )
+
                 for obj1 in json_obj1:
-                    if '01' in obj1['src']['device']:
-                        link_down1 = False 
-                        main.log.info("Link up from "+
-                            "s1 -> s2 on ONOS1 detected")
+                    if '01' in obj1[ 'src' ][ 'device' ]:
+                        link_down1 = False
+                        main.log.info( "Link up from " +
+                                       "s1 -> s2 on ONOS1 detected" )
                 for obj2 in json_obj2:
-                    if '01' in obj2['src']['device']:
-                        link_down2 = False 
-                        main.log.info("Link up from "+
-                            "s1 -> s2 on ONOS2 detected")
+                    if '01' in obj2[ 'src' ][ 'device' ]:
+                        link_down2 = False
+                        main.log.info( "Link up from " +
+                                       "s1 -> s2 on ONOS2 detected" )
                 for obj3 in json_obj3:
-                    if '01' in obj3['src']['device']:
-                        link_down3 = False 
-                        main.log.info("Link up from "+
-                            "s1 -> s2 on ONOS3 detected")
-                
+                    if '01' in obj3[ 'src' ][ 'device' ]:
+                        link_down3 = False
+                        main.log.info( "Link up from " +
+                                       "s1 -> s2 on ONOS3 detected" )
+
                 loop_count += 1
-                time.sleep(1)
-            
-            if (link_down1 and link_down2 and link_down3):
-                main.log.info("Link up discovery failed")
-                
+                time.sleep( 1 )
+
+            if ( link_down1 and link_down2 and link_down3 ):
+                main.log.info( "Link up discovery failed" )
+
                 link_up_lat_graph1 = 0
                 link_up_lat_graph2 = 0
                 link_up_lat_graph3 = 0
                 link_up_lat_device1 = 0
                 link_up_lat_device2 = 0
                 link_up_lat_device3 = 0
-                
+
                 assertion = main.FALSE
             else:
                 json_topo_metrics_1 =\
-                        main.ONOS1cli.topology_events_metrics()
+                    main.ONOS1cli.topology_events_metrics()
                 json_topo_metrics_2 =\
-                        main.ONOS2cli.topology_events_metrics()
+                    main.ONOS2cli.topology_events_metrics()
                 json_topo_metrics_3 =\
-                        main.ONOS3cli.topology_events_metrics()
-                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
-                json_topo_metrics_2 = json.loads(json_topo_metrics_2)
-                json_topo_metrics_3 = json.loads(json_topo_metrics_3)
+                    main.ONOS3cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
+                json_topo_metrics_2 = json.loads( json_topo_metrics_2 )
+                json_topo_metrics_3 = json.loads( json_topo_metrics_3 )
 
-                main.log.info("Obtaining graph and device timestamp")
+                main.log.info( "Obtaining graph and device timestamp" )
                 graph_timestamp_1 = \
-                    json_topo_metrics_1[graphTimestamp]['value']
+                    json_topo_metrics_1[ graphTimestamp ][ 'value' ]
                 graph_timestamp_2 = \
-                    json_topo_metrics_2[graphTimestamp]['value']
+                    json_topo_metrics_2[ graphTimestamp ][ 'value' ]
                 graph_timestamp_3 = \
-                    json_topo_metrics_3[graphTimestamp]['value']
+                    json_topo_metrics_3[ graphTimestamp ][ 'value' ]
 
                 link_timestamp_1 = \
-                    json_topo_metrics_1[linkTimestamp]['value']
+                    json_topo_metrics_1[ linkTimestamp ][ 'value' ]
                 link_timestamp_2 = \
-                    json_topo_metrics_2[linkTimestamp]['value']
+                    json_topo_metrics_2[ linkTimestamp ][ 'value' ]
                 link_timestamp_3 = \
-                    json_topo_metrics_3[linkTimestamp]['value']
+                    json_topo_metrics_3[ linkTimestamp ][ 'value' ]
 
                 if graph_timestamp_1 and graph_timestamp_2 and\
                         graph_timestamp_3 and link_timestamp_1 and\
                         link_timestamp_2 and link_timestamp_3:
-                    link_up_lat_graph1 = int(graph_timestamp_1) -\
-                            int(timestamp_link_up_t0)
-                    link_up_lat_graph2 = int(graph_timestamp_2) -\
-                            int(timestamp_link_up_t0)
-                    link_up_lat_graph3 = int(graph_timestamp_3) -\
-                            int(timestamp_link_up_t0)
-                
-                    link_up_lat_link1 = int(link_timestamp_1) -\
-                            int(timestamp_link_up_t0)
-                    link_up_lat_link2 = int(link_timestamp_2) -\
-                            int(timestamp_link_up_t0)
-                    link_up_lat_link3 = int(link_timestamp_3) -\
-                            int(timestamp_link_up_t0)
+                    link_up_lat_graph1 = int( graph_timestamp_1 ) -\
+                        int( timestamp_link_up_t0 )
+                    link_up_lat_graph2 = int( graph_timestamp_2 ) -\
+                        int( timestamp_link_up_t0 )
+                    link_up_lat_graph3 = int( graph_timestamp_3 ) -\
+                        int( timestamp_link_up_t0 )
+
+                    link_up_lat_link1 = int( link_timestamp_1 ) -\
+                        int( timestamp_link_up_t0 )
+                    link_up_lat_link2 = int( link_timestamp_2 ) -\
+                        int( timestamp_link_up_t0 )
+                    link_up_lat_link3 = int( link_timestamp_3 ) -\
+                        int( timestamp_link_up_t0 )
                 else:
-                    main.log.error("There was an error calculating"+
-                        " the delta for link down event")
+                    main.log.error( "There was an error calculating" +
+                                    " the delta for link down event" )
                     link_up_lat_graph1 = 0
                     link_up_lat_graph2 = 0
                     link_up_lat_graph3 = 0
-                    
+
                     link_up_lat_device1 = 0
                     link_up_lat_device2 = 0
                     link_up_lat_device3 = 0
-       
-            if debug_mode == 'on':
-                main.log.info("Link up latency ONOS1 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_up_lat_graph1)+" ms")
-                main.log.info("Link up latency ONOS2 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_up_lat_graph2)+" ms")
-                main.log.info("Link up latency ONOS3 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_up_lat_graph3)+" ms")
-            
-                main.log.info("Link up latency ONOS1 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_up_lat_link1)+" ms")
-                main.log.info("Link up latency ONOS2 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_up_lat_link2)+" ms")
-                main.log.info("Link up latency ONOS3 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_up_lat_link3))
-      
-            #Calculate avg of node calculations
-            link_up_lat_graph_avg =\
-                    (link_up_lat_graph1 +
-                     link_up_lat_graph2 +
-                     link_up_lat_graph3) / 3
-            link_up_lat_link_avg =\
-                    (link_up_lat_link1 +
-                     link_up_lat_link2 +
-                     link_up_lat_link3) / 3
 
-            #Set threshold and append latency to list
+            if debug_mode == 'on':
+                main.log.info( "Link up latency ONOS1 iteration " +
+                               str( i ) + " (end-to-end): " +
+                               str( link_up_lat_graph1 ) + " ms" )
+                main.log.info( "Link up latency ONOS2 iteration " +
+                               str( i ) + " (end-to-end): " +
+                               str( link_up_lat_graph2 ) + " ms" )
+                main.log.info( "Link up latency ONOS3 iteration " +
+                               str( i ) + " (end-to-end): " +
+                               str( link_up_lat_graph3 ) + " ms" )
+
+                main.log.info(
+                    "Link up latency ONOS1 iteration " +
+                    str( i ) +
+                    " (link-event-to-system-timestamp): " +
+                    str( link_up_lat_link1 ) +
+                    " ms" )
+                main.log.info(
+                    "Link up latency ONOS2 iteration " +
+                    str( i ) +
+                    " (link-event-to-system-timestamp): " +
+                    str( link_up_lat_link2 ) +
+                    " ms" )
+                main.log.info(
+                    "Link up latency ONOS3 iteration " +
+                    str( i ) +
+                    " (link-event-to-system-timestamp): " +
+                    str( link_up_lat_link3 ) )
+
+            # Calculate avg of node calculations
+            link_up_lat_graph_avg =\
+                ( link_up_lat_graph1 +
+                  link_up_lat_graph2 +
+                  link_up_lat_graph3 ) / 3
+            link_up_lat_link_avg =\
+                ( link_up_lat_link1 +
+                  link_up_lat_link2 +
+                  link_up_lat_link3 ) / 3
+
+            # Set threshold and append latency to list
             if link_up_lat_graph_avg > up_threshold_min and\
                link_up_lat_graph_avg < up_threshold_max:
                 link_up_graph_to_system_list.append(
-                        link_up_lat_graph_avg)
+                    link_up_lat_graph_avg )
             else:
-                main.log.info("Link up latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link up latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
             if link_up_lat_link_avg > up_threshold_min and\
                link_up_lat_link_avg < up_threshold_max:
                 link_up_link_to_system_list.append(
-                        link_up_lat_link_avg)
+                    link_up_lat_link_avg )
             else:
-                main.log.info("Link up latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link up latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
 
-        #Calculate min, max, avg of list and report
-        link_down_min = min(link_down_graph_to_system_list)
-        link_down_max = max(link_down_graph_to_system_list)
-        link_down_avg = sum(link_down_graph_to_system_list) / \
-                        len(link_down_graph_to_system_list)
-        link_up_min = min(link_up_graph_to_system_list)
-        link_up_max = max(link_up_graph_to_system_list)
-        link_up_avg = sum(link_up_graph_to_system_list) / \
-                        len(link_up_graph_to_system_list)
+        # Calculate min, max, avg of list and report
+        link_down_min = min( link_down_graph_to_system_list )
+        link_down_max = max( link_down_graph_to_system_list )
+        link_down_avg = sum( link_down_graph_to_system_list ) / \
+            len( link_down_graph_to_system_list )
+        link_up_min = min( link_up_graph_to_system_list )
+        link_up_max = max( link_up_graph_to_system_list )
+        link_up_avg = sum( link_up_graph_to_system_list ) / \
+            len( link_up_graph_to_system_list )
         link_down_std_dev = \
-                str(round(numpy.std(link_down_graph_to_system_list),1))
+            str( round( numpy.std( link_down_graph_to_system_list ), 1 ) )
         link_up_std_dev = \
-                str(round(numpy.std(link_up_graph_to_system_list),1))
+            str( round( numpy.std( link_up_graph_to_system_list ), 1 ) )
 
-        main.log.report("Link down latency " +
-                "Avg: "+str(link_down_avg)+" ms "+
-                "Std Deviation: "+link_down_std_dev+" ms")
-        main.log.report("Link up latency "+
-                "Avg: "+str(link_up_avg)+" ms "+
-                "Std Deviation: "+link_up_std_dev+" ms")
+        main.log.report( "Link down latency " +
+                         "Avg: " + str( link_down_avg ) + " ms " +
+                         "Std Deviation: " + link_down_std_dev + " ms" )
+        main.log.report( "Link up latency " +
+                         "Avg: " + str( link_up_avg ) + " ms " +
+                         "Std Deviation: " + link_up_std_dev + " ms" )
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Link discovery latency calculation successful",
-                onfail="Link discovery latency case failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=assertion,
+            onpass="Link discovery latency calculation successful",
+            onfail="Link discovery latency case failed" )
 
-    def CASE5(self, main):
-        '''
+    def CASE5( self, main ):
+        """
         100 Switch discovery latency
 
         Important:
-            This test case can be potentially dangerous if 
+            This test case can be potentially dangerous if
             your machine has previously set iptables rules.
             One of the steps of the test case will flush
             all existing iptables rules.
         Note:
-            You can specify the number of switches in the 
+            You can specify the number of switches in the
             params file to adjust the switch discovery size
-            (and specify the corresponding topology in Mininet1 
-            .topo file)
-        '''
+            ( and specify the corresponding topology in Mininet1
+            .topo file )
+        """
         import time
         import subprocess
         import os
         import requests
         import json
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS2_ip = main.params['CTRL']['ip2']
-        ONOS3_ip = main.params['CTRL']['ip3']
-        MN1_ip = main.params['MN']['ip1']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS2_ip = main.params[ 'CTRL' ][ 'ip2' ]
+        ONOS3_ip = main.params[ 'CTRL' ][ 'ip3' ]
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-        num_sw = main.params['TEST']['numSwitch']
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
 
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
-        
-        debug_mode = main.params['TEST']['debugMode']
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+        num_sw = main.params[ 'TEST' ][ 'numSwitch' ]
 
-        local_time = time.strftime('%X')
-        local_time = local_time.replace("/","")
-        local_time = local_time.replace(" ","_")
-        local_time = local_time.replace(":","")
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        debug_mode = main.params[ 'TEST' ][ 'debugMode' ]
+
+        local_time = time.strftime( '%X' )
+        local_time = local_time.replace( "/", "" )
+        local_time = local_time.replace( " ", "_" )
+        local_time = local_time.replace( ":", "" )
         if debug_mode == 'on':
-            main.ONOS1.tshark_pcap("eth0",
-                    "/tmp/100_sw_lat_pcap_"+local_time) 
- 
-        #Threshold for this test case
-        sw_disc_threshold_str = main.params['TEST']['swDisc100Threshold']
-        sw_disc_threshold_obj = sw_disc_threshold_str.split(",")
-        sw_disc_threshold_min = int(sw_disc_threshold_obj[0])
-        sw_disc_threshold_max = int(sw_disc_threshold_obj[1])
+            main.ONOS1.tshark_pcap( "eth0",
+                                    "/tmp/100_sw_lat_pcap_" + local_time )
 
-        tshark_ofp_output = "/tmp/tshark_ofp_"+num_sw+"sw.txt"
-        tshark_tcp_output = "/tmp/tshark_tcp_"+num_sw+"sw.txt"
+        # Threshold for this test case
+        sw_disc_threshold_str = main.params[ 'TEST' ][ 'swDisc100Threshold' ]
+        sw_disc_threshold_obj = sw_disc_threshold_str.split( "," )
+        sw_disc_threshold_min = int( sw_disc_threshold_obj[ 0 ] )
+        sw_disc_threshold_max = int( sw_disc_threshold_obj[ 1 ] )
+
+        tshark_ofp_output = "/tmp/tshark_ofp_" + num_sw + "sw.txt"
+        tshark_tcp_output = "/tmp/tshark_tcp_" + num_sw + "sw.txt"
 
         tshark_ofp_result_list = []
         tshark_tcp_result_list = []
 
         sw_discovery_lat_list = []
 
-        main.case(num_sw+" Switch discovery latency")
-        main.step("Assigning all switches to ONOS1")
-        for i in range(1, int(num_sw)+1):
+        main.case( num_sw + " Switch discovery latency" )
+        main.step( "Assigning all switches to ONOS1" )
+        for i in range( 1, int( num_sw ) + 1 ):
             main.Mininet1.assign_sw_controller(
-                    sw=str(i),
-                    ip1=ONOS1_ip,
-                    port1=default_sw_port)
-        
-        #Ensure that nodes are configured with ptpd
-        #Just a warning message
-        main.log.info("Please check ptpd configuration to ensure"+\
-                " All nodes' system times are in sync")
-        time.sleep(5)
+                sw=str( i ),
+                ip1=ONOS1_ip,
+                port1=default_sw_port )
 
-        for i in range(0, int(num_iter)):
-            
-            main.step("Set iptables rule to block incoming sw connections")
-            #Set iptables rule to block incoming switch connections
-            #The rule description is as follows:
+        # Ensure that nodes are configured with ptpd
+        # Just a warning message
+        main.log.info( "Please check ptpd configuration to ensure" +
+                       " All nodes' system times are in sync" )
+        time.sleep( 5 )
+
+        for i in range( 0, int( num_iter ) ):
+
+            main.step( "Set iptables rule to block incoming sw connections" )
+            # Set iptables rule to block incoming switch connections
+            # The rule description is as follows:
             #   Append to INPUT rule,
             #   behavior DROP that matches following:
             #       * packet type: tcp
             #       * source IP: MN1_ip
             #       * destination PORT: 6633
             main.ONOS1.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+MN1_ip+
-                    " --dport "+default_sw_port+" -j DROP")
-            main.ONOS1.handle.expect("\$") 
-            #   Append to OUTPUT rule, 
+                "sudo iptables -A INPUT -p tcp -s " + MN1_ip +
+                " --dport " + default_sw_port + " -j DROP" )
+            main.ONOS1.handle.expect( "\$" )
+            #   Append to OUTPUT rule,
             #   behavior DROP that matches following:
             #       * packet type: tcp
             #       * source IP: MN1_ip
             #       * destination PORT: 6633
             main.ONOS1.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+MN1_ip+
-                    " --dport "+default_sw_port+" -j DROP")
-            main.ONOS1.handle.expect("\$")
-            #Give time to allow rule to take effect
-            #NOTE: Sleep period may need to be configured 
+                "sudo iptables -A OUTPUT -p tcp -s " + MN1_ip +
+                " --dport " + default_sw_port + " -j DROP" )
+            main.ONOS1.handle.expect( "\$" )
+            # Give time to allow rule to take effect
+            # NOTE: Sleep period may need to be configured
             #      based on the number of switches in the topology
-            main.log.info("Please wait for switch connection to "+
-                    "time out")
-            time.sleep(60)
-            
-            #Gather vendor OFP with tshark
-            main.ONOS1.tshark_grep("OFP 86 Vendor", 
-                    tshark_ofp_output)
-            main.ONOS1.tshark_grep("TCP 74 ",
-                    tshark_tcp_output)
+            main.log.info( "Please wait for switch connection to " +
+                           "time out" )
+            time.sleep( 60 )
 
-            #NOTE: Remove all iptables rule quickly (flush)
-            #      Before removal, obtain TestON timestamp at which 
+            # Gather vendor OFP with tshark
+            main.ONOS1.tshark_grep( "OFP 86 Vendor",
+                                    tshark_ofp_output )
+            main.ONOS1.tshark_grep( "TCP 74 ",
+                                    tshark_tcp_output )
+
+            # NOTE: Remove all iptables rule quickly ( flush )
+            #      Before removal, obtain TestON timestamp at which
             #      removal took place
-            #      (ensuring nodes are configured via ptp)
+            #      ( ensuring nodes are configured via ptp )
             #      sudo iptables -F
-            
+
             t0_system = time.time() * 1000
             main.ONOS1.handle.sendline(
-                    "sudo iptables -F")
+                "sudo iptables -F" )
 
-            #Counter to track loop count
+            # Counter to track loop count
             counter_loop = 0
             counter_avail1 = 0
             counter_avail2 = 0
@@ -1490,126 +1550,124 @@
             onos2_dev = False
             onos3_dev = False
             while counter_loop < 60:
-                #Continue to check devices for all device 
-                #availability. When all devices in all 3
-                #ONOS instances indicate that devices are available
-                #obtain graph event timestamp for t1.
+                # Continue to check devices for all device
+                # availability. When all devices in all 3
+                # ONOS instances indicate that devices are available
+                # obtain graph event timestamp for t1.
                 device_str_obj1 = main.ONOS1cli.devices()
                 device_str_obj2 = main.ONOS2cli.devices()
                 device_str_obj3 = main.ONOS3cli.devices()
 
-                device_json1 = json.loads(device_str_obj1)                
-                device_json2 = json.loads(device_str_obj2)                
-                device_json3 = json.loads(device_str_obj3)           
-                
+                device_json1 = json.loads( device_str_obj1 )
+                device_json2 = json.loads( device_str_obj2 )
+                device_json3 = json.loads( device_str_obj3 )
+
                 for device1 in device_json1:
-                    if device1['available'] == True:
+                    if device1[ 'available' ]:
                         counter_avail1 += 1
-                        if counter_avail1 == int(num_sw):
+                        if counter_avail1 == int( num_sw ):
                             onos1_dev = True
-                            main.log.info("All devices have been "+
-                                    "discovered on ONOS1")
+                            main.log.info( "All devices have been " +
+                                           "discovered on ONOS1" )
                     else:
                         counter_avail1 = 0
                 for device2 in device_json2:
-                    if device2['available'] == True:
+                    if device2[ 'available' ]:
                         counter_avail2 += 1
-                        if counter_avail2 == int(num_sw):
+                        if counter_avail2 == int( num_sw ):
                             onos2_dev = True
-                            main.log.info("All devices have been "+
-                                    "discovered on ONOS2")
+                            main.log.info( "All devices have been " +
+                                           "discovered on ONOS2" )
                     else:
                         counter_avail2 = 0
                 for device3 in device_json3:
-                    if device3['available'] == True:
+                    if device3[ 'available' ]:
                         counter_avail3 += 1
-                        if counter_avail3 == int(num_sw):
+                        if counter_avail3 == int( num_sw ):
                             onos3_dev = True
-                            main.log.info("All devices have been "+
-                                    "discovered on ONOS3")
+                            main.log.info( "All devices have been " +
+                                           "discovered on ONOS3" )
                     else:
                         counter_avail3 = 0
 
                 if onos1_dev and onos2_dev and onos3_dev:
-                    main.log.info("All devices have been discovered "+
-                            "on all ONOS instances")
+                    main.log.info( "All devices have been discovered " +
+                                   "on all ONOS instances" )
                     json_str_topology_metrics_1 =\
                         main.ONOS1cli.topology_events_metrics()
                     json_str_topology_metrics_2 =\
                         main.ONOS2cli.topology_events_metrics()
                     json_str_topology_metrics_3 =\
                         main.ONOS3cli.topology_events_metrics()
-                   
-                    #Exit while loop if all devices discovered
-                    break 
-                
+
+                    # Exit while loop if all devices discovered
+                    break
+
                 counter_loop += 1
-                #Give some time in between CLI calls
-                #(will not affect measurement)
-                time.sleep(3)
+                # Give some time in between CLI calls
+                #( will not affect measurement )
+                time.sleep( 3 )
 
             main.ONOS1.tshark_stop()
-            
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_ofp_output+" /tmp/") 
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_tcp_output+" /tmp/")
 
-            #TODO: Automate OFP output analysis
-            #Debug mode - print out packets captured at runtime     
-            if debug_mode == 'on': 
-                ofp_file = open(tshark_ofp_output, 'r')
-                main.log.info("Tshark OFP Vendor output: ")
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_ofp_output + " /tmp/" )
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_tcp_output + " /tmp/" )
+
+            # TODO: Automate OFP output analysis
+            # Debug mode - print out packets captured at runtime
+            if debug_mode == 'on':
+                ofp_file = open( tshark_ofp_output, 'r' )
+                main.log.info( "Tshark OFP Vendor output: " )
                 for line in ofp_file:
-                    tshark_ofp_result_list.append(line)
-                    main.log.info(line)
+                    tshark_ofp_result_list.append( line )
+                    main.log.info( line )
                 ofp_file.close()
 
-                tcp_file = open(tshark_tcp_output, 'r')
-                main.log.info("Tshark TCP 74 output: ")
+                tcp_file = open( tshark_tcp_output, 'r' )
+                main.log.info( "Tshark TCP 74 output: " )
                 for line in tcp_file:
-                    tshark_tcp_result_list.append(line)
-                    main.log.info(line)
+                    tshark_tcp_result_list.append( line )
+                    main.log.info( line )
                 tcp_file.close()
 
-            json_obj_1 = json.loads(json_str_topology_metrics_1)
-            json_obj_2 = json.loads(json_str_topology_metrics_2)
-            json_obj_3 = json.loads(json_str_topology_metrics_3)
+            json_obj_1 = json.loads( json_str_topology_metrics_1 )
+            json_obj_2 = json.loads( json_str_topology_metrics_2 )
+            json_obj_3 = json.loads( json_str_topology_metrics_3 )
 
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
             graph_timestamp_2 = \
-                    json_obj_2[graphTimestamp]['value']
+                json_obj_2[ graphTimestamp ][ 'value' ]
             graph_timestamp_3 = \
-                    json_obj_3[graphTimestamp]['value']
+                json_obj_3[ graphTimestamp ][ 'value' ]
 
-            graph_lat_1 = int(graph_timestamp_1) - int(t0_system)
-            graph_lat_2 = int(graph_timestamp_2) - int(t0_system)
-            graph_lat_3 = int(graph_timestamp_3) - int(t0_system)
+            graph_lat_1 = int( graph_timestamp_1 ) - int( t0_system )
+            graph_lat_2 = int( graph_timestamp_2 ) - int( t0_system )
+            graph_lat_3 = int( graph_timestamp_3 ) - int( t0_system )
 
             avg_graph_lat = \
-                    (int(graph_lat_1) +\
-                     int(graph_lat_2) +\
-                     int(graph_lat_3)) / 3
-    
+                ( int( graph_lat_1 ) +
+                  int( graph_lat_2 ) +
+                  int( graph_lat_3 ) ) / 3
+
             if avg_graph_lat > sw_disc_threshold_min \
                     and avg_graph_lat < sw_disc_threshold_max:
                 sw_discovery_lat_list.append(
-                        avg_graph_lat)
+                    avg_graph_lat )
             else:
-                main.log.info("100 Switch discovery latency "+
-                        "exceeded the threshold.")
-            
-            #END ITERATION FOR LOOP
+                main.log.info( "100 Switch discovery latency " +
+                               "exceeded the threshold." )
 
-        sw_lat_min = min(sw_discovery_lat_list)
-        sw_lat_max = max(sw_discovery_lat_list)
-        sw_lat_avg = sum(sw_discovery_lat_list) /\
-                     len(sw_discovery_lat_list)
+            # END ITERATION FOR LOOP
 
-        main.log.report("100 Switch discovery lat "+\
-                "Min: "+str(sw_lat_min)+" ms"+\
-                "Max: "+str(sw_lat_max)+" ms"+\
-                "Avg: "+str(sw_lat_avg)+" ms")
+        sw_lat_min = min( sw_discovery_lat_list )
+        sw_lat_max = max( sw_discovery_lat_list )
+        sw_lat_avg = sum( sw_discovery_lat_list ) /\
+            len( sw_discovery_lat_list )
 
-
+        main.log.report( "100 Switch discovery lat " +
+                         "Min: " + str( sw_lat_min ) + " ms" +
+                         "Max: " + str( sw_lat_max ) + " ms" +
+                         "Avg: " + str( sw_lat_avg ) + " ms" )
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
index d10c0ee..e81d905 100644
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
+++ b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.py
@@ -1,1108 +1,1113 @@
-#TopoPerfNext
+# TopoPerfNext
 #
-#Topology Performance test for ONOS-next
+# Topology Performance test for ONOS-next
 #*** Revised for single node operation ***
 #
-#andrew@onlab.us
+# andrew@onlab.us
 
 import time
 import sys
 import os
 import re
 
+
 class TopoPerfNextSingleNode:
-    def __init__(self):
+
+    def __init__( self ):
         self.default = ''
 
-    def CASE1(self, main):
-        '''
+    def CASE1( self, main ):
+        """
         ONOS startup sequence
-        '''
+        """
         import time
-    
-        cell_name = main.params['ENV']['cellName']
 
-        git_pull = main.params['GIT']['autoPull']
-        checkout_branch = main.params['GIT']['checkout']
+        cell_name = main.params[ 'ENV' ][ 'cellName' ]
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        MN1_ip = main.params['MN']['ip1']
-        BENCH_ip = main.params['BENCH']['ip']
+        git_pull = main.params[ 'GIT' ][ 'autoPull' ]
+        checkout_branch = main.params[ 'GIT' ][ 'checkout' ]
 
-        main.case("Setting up test environment")
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        BENCH_ip = main.params[ 'BENCH' ][ 'ip' ]
 
-        main.step("Creating cell file")
+        main.case( "Setting up test environment" )
+
+        main.step( "Creating cell file" )
         cell_file_result = main.ONOSbench.create_cell_file(
-                BENCH_ip, cell_name, MN1_ip, "onos-core",
-                ONOS1_ip)
+            BENCH_ip, cell_name, MN1_ip, "onos-core",
+            ONOS1_ip )
 
-        main.step("Applying cell file to environment")
-        cell_apply_result = main.ONOSbench.set_cell(cell_name)
+        main.step( "Applying cell file to environment" )
+        cell_apply_result = main.ONOSbench.set_cell( cell_name )
         verify_cell_result = main.ONOSbench.verify_cell()
-        
-        main.step("Git checkout and pull "+checkout_branch)
+
+        main.step( "Git checkout and pull " + checkout_branch )
         if git_pull == 'on':
             checkout_result = \
-                    main.ONOSbench.git_checkout(checkout_branch)
+                main.ONOSbench.git_checkout( checkout_branch )
             pull_result = main.ONOSbench.git_pull()
         else:
             checkout_result = main.TRUE
             pull_result = main.TRUE
-            main.log.info("Skipped git checkout and pull")
+            main.log.info( "Skipped git checkout and pull" )
 
-        main.step("Using mvn clean & install")
+        main.step( "Using mvn clean & install" )
         #mvn_result = main.ONOSbench.clean_install()
         mvn_result = main.TRUE
 
-        main.step("Creating ONOS package")
+        main.step( "Creating ONOS package" )
         package_result = main.ONOSbench.onos_package()
 
-        main.step("Installing ONOS package")
-        install1_result = main.ONOSbench.onos_install(node=ONOS1_ip)
+        main.step( "Installing ONOS package" )
+        install1_result = main.ONOSbench.onos_install( node=ONOS1_ip )
 
-        #NOTE: This step may be unnecessary
-        #main.step("Starting ONOS service")
-        #start_result = main.ONOSbench.onos_start(ONOS1_ip)
+        # NOTE: This step may be unnecessary
+        #main.step( "Starting ONOS service" )
+        #start_result = main.ONOSbench.onos_start( ONOS1_ip )
 
-        main.step("Set cell for ONOS cli env")
-        main.ONOS1cli.set_cell(cell_name)
+        main.step( "Set cell for ONOS cli env" )
+        main.ONOS1cli.set_cell( cell_name )
 
-        time.sleep(10)
+        time.sleep( 10 )
 
-        main.step("Start onos cli")
-        cli1 = main.ONOS1cli.start_onos_cli(ONOS1_ip)
+        main.step( "Start onos cli" )
+        cli1 = main.ONOS1cli.start_onos_cli( ONOS1_ip )
 
-        main.step("Enable metrics feature")
-        main.ONOS1cli.feature_install("onos-app-metrics")
+        main.step( "Enable metrics feature" )
+        main.ONOS1cli.feature_install( "onos-app-metrics" )
 
-        utilities.assert_equals(expect=main.TRUE,
-                actual= cell_file_result and cell_apply_result and\
-                        verify_cell_result and checkout_result and\
-                        pull_result and mvn_result and\
-                        install1_result, 
-                onpass="ONOS started successfully",
-                onfail="Failed to start ONOS")
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=cell_file_result and cell_apply_result and
+                                 verify_cell_result and checkout_result and
+                                 pull_result and mvn_result and
+                                 install1_result,
+                                 onpass="ONOS started successfully",
+                                 onfail="Failed to start ONOS" )
 
-    def CASE2(self, main):
-        '''
+    def CASE2( self, main ):
+        """
         Assign s1 to ONOS1 and measure latency
-        
+
         There are 4 levels of latency measurements to this test:
-        1) End-to-end measurement: Complete end-to-end measurement
-           from TCP (SYN/ACK) handshake to Graph change
-        2) OFP-to-graph measurement: 'ONOS processing' snippet of
+        1 ) End-to-end measurement: Complete end-to-end measurement
+           from TCP ( SYN/ACK ) handshake to Graph change
+        2 ) OFP-to-graph measurement: 'ONOS processing' snippet of
            measurement from OFP Vendor message to Graph change
-        3) OFP-to-device measurement: 'ONOS processing without 
+        3 ) OFP-to-device measurement: 'ONOS processing without
            graph change' snippet of measurement from OFP vendor
            message to Device change timestamp
-        4) T0-to-device measurement: Measurement that includes
-           the switch handshake to devices timestamp without 
-           the graph view change. (TCP handshake -> Device 
-           change)
-        '''
+        4 ) T0-to-device measurement: Measurement that includes
+           the switch handshake to devices timestamp without
+           the graph view change. ( TCP handshake -> Device
+           change )
+        """
         import time
         import subprocess
         import json
         import requests
         import os
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-       
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
 
-        #List of switch add latency collected from
-        #all iterations
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        # List of switch add latency collected from
+        # all iterations
         latency_end_to_end_list = []
         latency_ofp_to_graph_list = []
         latency_ofp_to_device_list = []
         latency_t0_to_device_list = []
 
-        #Directory/file to store tshark results
+        # Directory/file to store tshark results
         tshark_of_output = "/tmp/tshark_of_topo.txt"
         tshark_tcp_output = "/tmp/tshark_tcp_topo.txt"
 
-        #String to grep in tshark output
-        tshark_tcp_string = "TCP 74 "+default_sw_port
+        # String to grep in tshark output
+        tshark_tcp_string = "TCP 74 " + default_sw_port
         tshark_of_string = "OFP 86 Vendor"
-     
-        #Initialize assertion to TRUE
+
+        # Initialize assertion to TRUE
         assertion = main.TRUE
-        
-        main.log.report("Latency of adding one switch")
 
-        for i in range(0, int(num_iter)):
-            main.log.info("Starting tshark capture")
+        main.log.report( "Latency of adding one switch" )
 
-            #* TCP [ACK, SYN] is used as t0_a, the
-            #  very first "exchange" between ONOS and 
+        for i in range( 0, int( num_iter ) ):
+            main.log.info( "Starting tshark capture" )
+
+            #* TCP [ ACK, SYN ] is used as t0_a, the
+            #  very first "exchange" between ONOS and
             #  the switch for end-to-end measurement
-            #* OFP [Stats Reply] is used for t0_b
+            #* OFP [ Stats Reply ] is used for t0_b
             #  the very last OFP message between ONOS
             #  and the switch for ONOS measurement
-            main.ONOS1.tshark_grep(tshark_tcp_string,
-                    tshark_tcp_output)
-            main.ONOS1.tshark_grep(tshark_of_string,
-                    tshark_of_output)
+            main.ONOS1.tshark_grep( tshark_tcp_string,
+                                    tshark_tcp_output )
+            main.ONOS1.tshark_grep( tshark_of_string,
+                                    tshark_of_output )
 
-            #Wait and ensure tshark is started and 
-            #capturing
-            time.sleep(10)
+            # Wait and ensure tshark is started and
+            # capturing
+            time.sleep( 10 )
 
-            main.log.info("Assigning s1 to controller")
+            main.log.info( "Assigning s1 to controller" )
 
-            main.Mininet1.assign_sw_controller(sw="1",
-                    ip1=ONOS1_ip, port1=default_sw_port)
+            main.Mininet1.assign_sw_controller(
+                sw="1",
+                ip1=ONOS1_ip,
+                port1=default_sw_port )
 
-            #Wait and ensure switch is assigned
-            #before stopping tshark
-            time.sleep(30)
-   
-            main.log.info("Stopping all Tshark processes")
+            # Wait and ensure switch is assigned
+            # before stopping tshark
+            time.sleep( 30 )
+
+            main.log.info( "Stopping all Tshark processes" )
             main.ONOS1.stop_tshark()
 
-            #tshark output is saved in ONOS. Use subprocess
-            #to copy over files to TestON for parsing
-            main.log.info("Copying over tshark files")
-            
-            #TCP CAPTURE ****
-            #Copy the tshark output from ONOS machine to
-            #TestON machine in tshark_tcp_output directory>file
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_tcp_output+" /tmp/") 
-            tcp_file = open(tshark_tcp_output, 'r')
-            temp_text = tcp_file.readline()
-            temp_text = temp_text.split(" ")
+            # tshark output is saved in ONOS. Use subprocess
+            # to copy over files to TestON for parsing
+            main.log.info( "Copying over tshark files" )
 
-            main.log.info("Object read in from TCP capture: "+
-                    str(temp_text))
-            if len(temp_text) > 1:
-                t0_tcp = float(temp_text[1])*1000.0
+            # TCP CAPTURE ****
+            # Copy the tshark output from ONOS machine to
+            # TestON machine in tshark_tcp_output directory>file
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_tcp_output + " /tmp/" )
+            tcp_file = open( tshark_tcp_output, 'r' )
+            temp_text = tcp_file.readline()
+            temp_text = temp_text.split( " " )
+
+            main.log.info( "Object read in from TCP capture: " +
+                           str( temp_text ) )
+            if len( temp_text ) > 1:
+                t0_tcp = float( temp_text[ 1 ] ) * 1000.0
             else:
-                main.log.error("Tshark output file for TCP"+
-                        " returned unexpected results")
+                main.log.error( "Tshark output file for TCP" +
+                                " returned unexpected results" )
                 t0_tcp = 0
                 assertion = main.FALSE
-            
+
             tcp_file.close()
             #****************
 
-            #OF CAPTURE ****
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_of_output+" /tmp/")
-            of_file = open(tshark_of_output, 'r')
-           
+            # OF CAPTURE ****
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_of_output + " /tmp/" )
+            of_file = open( tshark_of_output, 'r' )
+
             line_ofp = ""
-            #Read until last line of file
+            # Read until last line of file
             while True:
                 temp_text = of_file.readline()
-                if temp_text !='':
+                if temp_text != '':
                     line_ofp = temp_text
                 else:
-                    break 
-            obj = line_ofp.split(" ")
-            
-            main.log.info("Object read in from OFP capture: "+
-                    str(line_ofp))
-    
-            if len(line_ofp) > 1:
-                t0_ofp = float(obj[1])*1000.0
+                    break
+            obj = line_ofp.split( " " )
+
+            main.log.info( "Object read in from OFP capture: " +
+                           str( line_ofp ) )
+
+            if len( line_ofp ) > 1:
+                t0_ofp = float( obj[ 1 ] ) * 1000.0
             else:
-                main.log.error("Tshark output file for OFP"+
-                        " returned unexpected results")
+                main.log.error( "Tshark output file for OFP" +
+                                " returned unexpected results" )
                 t0_ofp = 0
                 assertion = main.FALSE
-            
+
             of_file.close()
             #****************
-           
+
             json_str_1 = main.ONOS1cli.topology_events_metrics()
 
-            json_obj_1 = json.loads(json_str_1)
+            json_obj_1 = json.loads( json_str_1 )
 
-            #Obtain graph timestamp. This timestsamp captures
-            #the epoch time at which the topology graph was updated.
+            # Obtain graph timestamp. This timestsamp captures
+            # the epoch time at which the topology graph was updated.
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
 
-            #Obtain device timestamp. This timestamp captures
-            #the epoch time at which the device event happened
+            # Obtain device timestamp. This timestamp captures
+            # the epoch time at which the device event happened
             device_timestamp_1 = \
-                    json_obj_1[deviceTimestamp]['value'] 
-            
-            #t0 to device processing latency 
-            delta_device_1 = int(device_timestamp_1) - int(t0_tcp)
-        
-            #Get average of delta from all instances
-            avg_delta_device = (int(delta_device_1))
+                json_obj_1[ deviceTimestamp ][ 'value' ]
 
-            #Ensure avg delta meets the threshold before appending
+            # t0 to device processing latency
+            delta_device_1 = int( device_timestamp_1 ) - int( t0_tcp )
+
+            # Get average of delta from all instances
+            avg_delta_device = ( int( delta_device_1 ) )
+
+            # Ensure avg delta meets the threshold before appending
             if avg_delta_device > 0.0 and avg_delta_device < 10000:
-                latency_t0_to_device_list.append(avg_delta_device)
+                latency_t0_to_device_list.append( avg_delta_device )
             else:
-                main.log.info("Results for t0-to-device ignored"+\
-                        "due to excess in threshold")
+                main.log.info( "Results for t0-to-device ignored" +
+                               "due to excess in threshold" )
 
-            #t0 to graph processing latency (end-to-end)
-            delta_graph_1 = int(graph_timestamp_1) - int(t0_tcp)
-        
-            #Get average of delta from all instances
-            avg_delta_graph = int(delta_graph_1)
+            # t0 to graph processing latency ( end-to-end )
+            delta_graph_1 = int( graph_timestamp_1 ) - int( t0_tcp )
 
-            #Ensure avg delta meets the threshold before appending
+            # Get average of delta from all instances
+            avg_delta_graph = int( delta_graph_1 )
+
+            # Ensure avg delta meets the threshold before appending
             if avg_delta_graph > 0.0 and avg_delta_graph < 10000:
-                latency_end_to_end_list.append(avg_delta_graph)
+                latency_end_to_end_list.append( avg_delta_graph )
             else:
-                main.log.info("Results for end-to-end ignored"+\
-                        "due to excess in threshold")
+                main.log.info( "Results for end-to-end ignored" +
+                               "due to excess in threshold" )
 
-            #ofp to graph processing latency (ONOS processing)
-            delta_ofp_graph_1 = int(graph_timestamp_1) - int(t0_ofp)
-            
-            avg_delta_ofp_graph = int(delta_ofp_graph_1)
-            
+            # ofp to graph processing latency ( ONOS processing )
+            delta_ofp_graph_1 = int( graph_timestamp_1 ) - int( t0_ofp )
+
+            avg_delta_ofp_graph = int( delta_ofp_graph_1 )
+
             if avg_delta_ofp_graph > 0.0 and avg_delta_ofp_graph < 10000:
-                latency_ofp_to_graph_list.append(avg_delta_ofp_graph)
+                latency_ofp_to_graph_list.append( avg_delta_ofp_graph )
             else:
-                main.log.info("Results for ofp-to-graph "+\
-                        "ignored due to excess in threshold")
+                main.log.info( "Results for ofp-to-graph " +
+                               "ignored due to excess in threshold" )
 
-            #ofp to device processing latency (ONOS processing)
-            delta_ofp_device_1 = float(device_timestamp_1) - float(t0_ofp)
-            
-            avg_delta_ofp_device = float(delta_ofp_device_1)
-            
-            #NOTE: ofp - delta measurements are occasionally negative
+            # ofp to device processing latency ( ONOS processing )
+            delta_ofp_device_1 = float( device_timestamp_1 ) - float( t0_ofp )
+
+            avg_delta_ofp_device = float( delta_ofp_device_1 )
+
+            # NOTE: ofp - delta measurements are occasionally negative
             #      due to system time misalignment.
-            latency_ofp_to_device_list.append(avg_delta_ofp_device)
+            latency_ofp_to_device_list.append( avg_delta_ofp_device )
 
-            #TODO:
-            #Fetch logs upon threshold excess
+            # TODO:
+            # Fetch logs upon threshold excess
 
-            main.log.info("ONOS1 delta end-to-end: "+
-                    str(delta_graph_1) + " ms")
+            main.log.info( "ONOS1 delta end-to-end: " +
+                           str( delta_graph_1 ) + " ms" )
 
-            main.log.info("ONOS1 delta OFP - graph: "+
-                    str(delta_ofp_graph_1) + " ms")
-            
-            main.log.info("ONOS1 delta device - t0: "+
-                    str(delta_device_1) + " ms")
-          
-            main.step("Remove switch from controller")
-            main.Mininet1.delete_sw_controller("s1")
+            main.log.info( "ONOS1 delta OFP - graph: " +
+                           str( delta_ofp_graph_1 ) + " ms" )
 
-            time.sleep(5)
+            main.log.info( "ONOS1 delta device - t0: " +
+                           str( delta_device_1 ) + " ms" )
 
-        #END of for loop iteration
+            main.step( "Remove switch from controller" )
+            main.Mininet1.delete_sw_controller( "s1" )
 
-        #If there is at least 1 element in each list,
-        #pass the test case
-        if len(latency_end_to_end_list) > 0 and\
-           len(latency_ofp_to_graph_list) > 0 and\
-           len(latency_ofp_to_device_list) > 0 and\
-           len(latency_t0_to_device_list) > 0:
+            time.sleep( 5 )
+
+        # END of for loop iteration
+
+        # If there is at least 1 element in each list,
+        # pass the test case
+        if len( latency_end_to_end_list ) > 0 and\
+           len( latency_ofp_to_graph_list ) > 0 and\
+           len( latency_ofp_to_device_list ) > 0 and\
+           len( latency_t0_to_device_list ) > 0:
             assertion = main.TRUE
-        elif len(latency_end_to_end_list) == 0:
-            #The appending of 0 here is to prevent 
-            #the min,max,sum functions from failing 
-            #below
-            latency_end_to_end_list.append(0)
+        elif len( latency_end_to_end_list ) == 0:
+            # The appending of 0 here is to prevent
+            # the min,max,sum functions from failing
+            # below
+            latency_end_to_end_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_ofp_to_graph_list) == 0:
-            latency_ofp_to_graph_list.append(0)
+        elif len( latency_ofp_to_graph_list ) == 0:
+            latency_ofp_to_graph_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_ofp_to_device_list) == 0:
-            latency_ofp_to_device_list.append(0)
+        elif len( latency_ofp_to_device_list ) == 0:
+            latency_ofp_to_device_list.append( 0 )
             assertion = main.FALSE
-        elif len(latency_t0_to_device_list) == 0:
-            latency_t0_to_device_list.append(0)
+        elif len( latency_t0_to_device_list ) == 0:
+            latency_t0_to_device_list.append( 0 )
             assertion = main.FALSE
 
-        #Calculate min, max, avg of latency lists
+        # Calculate min, max, avg of latency lists
         latency_end_to_end_max = \
-                int(max(latency_end_to_end_list))
+            int( max( latency_end_to_end_list ) )
         latency_end_to_end_min = \
-                int(min(latency_end_to_end_list))
+            int( min( latency_end_to_end_list ) )
         latency_end_to_end_avg = \
-                (int(sum(latency_end_to_end_list)) / \
-                 len(latency_end_to_end_list))
-   
+            ( int( sum( latency_end_to_end_list ) ) /
+              len( latency_end_to_end_list ) )
+
         latency_ofp_to_graph_max = \
-                int(max(latency_ofp_to_graph_list))
+            int( max( latency_ofp_to_graph_list ) )
         latency_ofp_to_graph_min = \
-                int(min(latency_ofp_to_graph_list))
+            int( min( latency_ofp_to_graph_list ) )
         latency_ofp_to_graph_avg = \
-                (int(sum(latency_ofp_to_graph_list)) / \
-                 len(latency_ofp_to_graph_list))
+            ( int( sum( latency_ofp_to_graph_list ) ) /
+              len( latency_ofp_to_graph_list ) )
 
         latency_ofp_to_device_max = \
-                int(max(latency_ofp_to_device_list))
+            int( max( latency_ofp_to_device_list ) )
         latency_ofp_to_device_min = \
-                int(min(latency_ofp_to_device_list))
+            int( min( latency_ofp_to_device_list ) )
         latency_ofp_to_device_avg = \
-                (int(sum(latency_ofp_to_device_list)) / \
-                 len(latency_ofp_to_device_list))
+            ( int( sum( latency_ofp_to_device_list ) ) /
+              len( latency_ofp_to_device_list ) )
 
         latency_t0_to_device_max = \
-                float(max(latency_t0_to_device_list))
+            float( max( latency_t0_to_device_list ) )
         latency_t0_to_device_min = \
-                float(min(latency_t0_to_device_list))
+            float( min( latency_t0_to_device_list ) )
         latency_t0_to_device_avg = \
-                (float(sum(latency_t0_to_device_list)) / \
-                 len(latency_ofp_to_device_list))
+            ( float( sum( latency_t0_to_device_list ) ) /
+              len( latency_ofp_to_device_list ) )
 
-        main.log.report("Switch add - End-to-end latency: \n"+\
-                "Min: "+str(latency_end_to_end_min)+"\n"+\
-                "Max: "+str(latency_end_to_end_max)+"\n"+\
-                "Avg: "+str(latency_end_to_end_avg))
-        main.log.report("Switch add - OFP-to-Graph latency: \n"+\
-                "Min: "+str(latency_ofp_to_graph_min)+"\n"+\
-                "Max: "+str(latency_ofp_to_graph_max)+"\n"+\
-                "Avg: "+str(latency_ofp_to_graph_avg))
-        main.log.report("Switch add - t0-to-Device latency: \n"+\
-                "Min: "+str(latency_t0_to_device_min)+"\n"+\
-                "Max: "+str(latency_t0_to_device_max)+"\n"+\
-                "Avg: "+str(latency_t0_to_device_avg))
+        main.log.report( "Switch add - End-to-end latency: \n" +
+                         "Min: " + str( latency_end_to_end_min ) + "\n" +
+                         "Max: " + str( latency_end_to_end_max ) + "\n" +
+                         "Avg: " + str( latency_end_to_end_avg ) )
+        main.log.report( "Switch add - OFP-to-Graph latency: \n" +
+                         "Min: " + str( latency_ofp_to_graph_min ) + "\n" +
+                         "Max: " + str( latency_ofp_to_graph_max ) + "\n" +
+                         "Avg: " + str( latency_ofp_to_graph_avg ) )
+        main.log.report( "Switch add - t0-to-Device latency: \n" +
+                         "Min: " + str( latency_t0_to_device_min ) + "\n" +
+                         "Max: " + str( latency_t0_to_device_max ) + "\n" +
+                         "Avg: " + str( latency_t0_to_device_avg ) )
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Switch latency test successful",
-                onfail="Switch latency test failed")
+        utilities.assert_equals( expect=main.TRUE, actual=assertion,
+                                 onpass="Switch latency test successful",
+                                 onfail="Switch latency test failed" )
 
-    def CASE3(self, main):
-        '''
+    def CASE3( self, main ):
+        """
         Bring port up / down and measure latency.
         Port enable / disable is simulated by ifconfig up / down
-        
-        In ONOS-next, we must ensure that the port we are 
+
+        In ONOS-next, we must ensure that the port we are
         manipulating is connected to another switch with a valid
         connection. Otherwise, graph view will not be updated.
-        '''
+        """
         import time
         import subprocess
         import os
         import requests
         import json
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-      
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
+
         assertion = main.TRUE
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-       
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
 
-        #NOTE: Some hardcoded variables you may need to configure
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        # NOTE: Some hardcoded variables you may need to configure
         #      besides the params
-            
+
         tshark_port_status = "OFP 130 Port Status"
 
         tshark_port_up = "/tmp/tshark_port_up.txt"
         tshark_port_down = "/tmp/tshark_port_down.txt"
         interface_config = "s1-eth1"
 
-        main.log.report("Port enable / disable latency")
+        main.log.report( "Port enable / disable latency" )
 
-        main.step("Assign switches s1 and s2 to controller 1")
-        main.Mininet1.assign_sw_controller(sw="1",ip1=ONOS1_ip,
-                port1=default_sw_port)
-        main.Mininet1.assign_sw_controller(sw="2",ip1=ONOS1_ip,
-                port1=default_sw_port)
+        main.step( "Assign switches s1 and s2 to controller 1" )
+        main.Mininet1.assign_sw_controller( sw="1", ip1=ONOS1_ip,
+                                            port1=default_sw_port )
+        main.Mininet1.assign_sw_controller( sw="2", ip1=ONOS1_ip,
+                                            port1=default_sw_port )
 
-        #Give enough time for metrics to propagate the 
-        #assign controller event. Otherwise, these events may
-        #carry over to our measurements
-        time.sleep(10)
+        # Give enough time for metrics to propagate the
+        # assign controller event. Otherwise, these events may
+        # carry over to our measurements
+        time.sleep( 10 )
 
-        main.step("Verify switch is assigned correctly")
-        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
-        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
+        main.step( "Verify switch is assigned correctly" )
+        result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
+        result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
         if result_s1 == main.FALSE or result_s2 == main.FALSE:
-            main.log.info("Switch s1 was not assigned correctly")
+            main.log.info( "Switch s1 was not assigned correctly" )
             assertion = main.FALSE
         else:
-            main.log.info("Switch s1 was assigned correctly")
+            main.log.info( "Switch s1 was assigned correctly" )
 
         port_up_device_to_ofp_list = []
         port_up_graph_to_ofp_list = []
         port_down_device_to_ofp_list = []
         port_down_graph_to_ofp_list = []
 
-        for i in range(0, int(num_iter)):
-            main.step("Starting wireshark capture for port status down")
-            main.ONOS1.tshark_grep(tshark_port_status,
-                    tshark_port_down)
-            
-            time.sleep(10)
+        for i in range( 0, int( num_iter ) ):
+            main.step( "Starting wireshark capture for port status down" )
+            main.ONOS1.tshark_grep( tshark_port_status,
+                                    tshark_port_down )
 
-            #Disable interface that is connected to switch 2
-            main.step("Disable port: "+interface_config)
-            main.Mininet2.handle.sendline("sudo ifconfig "+
-                    interface_config+" down")
-            main.Mininet2.handle.expect("\$")
-            time.sleep(10)
+            time.sleep( 10 )
+
+            # Disable interface that is connected to switch 2
+            main.step( "Disable port: " + interface_config )
+            main.Mininet2.handle.sendline( "sudo ifconfig " +
+                                           interface_config + " down" )
+            main.Mininet2.handle.expect( "\$" )
+            time.sleep( 10 )
 
             main.ONOS1.tshark_stop()
-            time.sleep(5)
-            
-            #Copy tshark output file from ONOS to TestON instance
-            #/tmp directory
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_port_down+" /tmp/")
+            time.sleep( 5 )
 
-            f_port_down = open(tshark_port_down, 'r')
-            #Get first line of port down event from tshark
+            # Copy tshark output file from ONOS to TestON instance
+            #/tmp directory
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_port_down + " /tmp/" )
+
+            f_port_down = open( tshark_port_down, 'r' )
+            # Get first line of port down event from tshark
             f_line = f_port_down.readline()
-            obj_down = f_line.split(" ")
-            if len(f_line) > 0:
-                timestamp_begin_pt_down = int(float(obj_down[1]))*1000
-                main.log.info("Port down begin timestamp: "+
-                        str(timestamp_begin_pt_down))
+            obj_down = f_line.split( " " )
+            if len( f_line ) > 0:
+                timestamp_begin_pt_down = int( float( obj_down[ 1 ] ) ) * 1000
+                main.log.info( "Port down begin timestamp: " +
+                               str( timestamp_begin_pt_down ) )
             else:
-                main.log.info("Tshark output file returned unexpected"+
-                        " results: "+str(obj_down))
+                main.log.info( "Tshark output file returned unexpected" +
+                               " results: " + str( obj_down ) )
                 timestamp_begin_pt_down = 0
-            
+
             f_port_down.close()
 
-            main.log.info("TEST tshark obj: "+str(obj_down))
+            main.log.info( "TEST tshark obj: " + str( obj_down ) )
 
-            main.step("Obtain t1 by REST call")
+            main.step( "Obtain t1 by REST call" )
             json_str_1 = main.ONOS1cli.topology_events_metrics()
 
-            main.log.info("TEST json_str 1: "+str(json_str_1))
+            main.log.info( "TEST json_str 1: " + str( json_str_1 ) )
 
-            json_obj_1 = json.loads(json_str_1)
-           
-            time.sleep(5)
+            json_obj_1 = json.loads( json_str_1 )
 
-            #Obtain graph timestamp. This timestsamp captures
-            #the epoch time at which the topology graph was updated.
+            time.sleep( 5 )
+
+            # Obtain graph timestamp. This timestsamp captures
+            # the epoch time at which the topology graph was updated.
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
 
-            #Obtain device timestamp. This timestamp captures
-            #the epoch time at which the device event happened
+            # Obtain device timestamp. This timestamp captures
+            # the epoch time at which the device event happened
             device_timestamp_1 = \
-                    json_obj_1[deviceTimestamp]['value'] 
+                json_obj_1[ deviceTimestamp ][ 'value' ]
 
-            #Get delta between graph event and OFP 
-            pt_down_graph_to_ofp_1 = int(graph_timestamp_1) -\
-                    int(timestamp_begin_pt_down)
+            # Get delta between graph event and OFP
+            pt_down_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
+                int( timestamp_begin_pt_down )
 
-            #Get delta between device event and OFP
-            pt_down_device_to_ofp_1 = int(device_timestamp_1) -\
-                    int(timestamp_begin_pt_down)
-       
-            #Caluclate average across clusters
-            pt_down_graph_to_ofp_avg = int(pt_down_graph_to_ofp_1)
-            pt_down_device_to_ofp_avg = int(pt_down_device_to_ofp_1) 
+            # Get delta between device event and OFP
+            pt_down_device_to_ofp_1 = int( device_timestamp_1 ) -\
+                int( timestamp_begin_pt_down )
+
+            # Caluclate average across clusters
+            pt_down_graph_to_ofp_avg = int( pt_down_graph_to_ofp_1 )
+            pt_down_device_to_ofp_avg = int( pt_down_device_to_ofp_1 )
 
             if pt_down_graph_to_ofp_avg > 0.0 and \
                     pt_down_graph_to_ofp_avg < 1000:
                 port_down_graph_to_ofp_list.append(
-                    pt_down_graph_to_ofp_avg)
-                main.log.info("Port down: graph to ofp avg: "+
-                    str(pt_down_graph_to_ofp_avg) + " ms")
+                    pt_down_graph_to_ofp_avg )
+                main.log.info( "Port down: graph to ofp avg: " +
+                               str( pt_down_graph_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port down graph-to-ofp result" +
-                        " exceeded the threshold: "+
-                        str(pt_down_graph_to_ofp_avg))
+                main.log.info( "Average port down graph-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_down_graph_to_ofp_avg ) )
 
             if pt_down_device_to_ofp_avg > 0 and \
                     pt_down_device_to_ofp_avg < 1000:
                 port_down_device_to_ofp_list.append(
-                    pt_down_device_to_ofp_avg)
-                main.log.info("Port down: device to ofp avg: "+
-                    str(pt_down_device_to_ofp_avg) + " ms")
+                    pt_down_device_to_ofp_avg )
+                main.log.info( "Port down: device to ofp avg: " +
+                               str( pt_down_device_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port down device-to-ofp result" +
-                        " exceeded the threshold: "+
-                        str(pt_down_device_to_ofp_avg))
+                main.log.info( "Average port down device-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_down_device_to_ofp_avg ) )
 
-            #Port up events 
-            main.step("Enable port and obtain timestamp")
-            main.step("Starting wireshark capture for port status up")
-            main.ONOS1.tshark_grep("OFP 130 Port Status", tshark_port_up)
-            time.sleep(5)
+            # Port up events
+            main.step( "Enable port and obtain timestamp" )
+            main.step( "Starting wireshark capture for port status up" )
+            main.ONOS1.tshark_grep( "OFP 130 Port Status", tshark_port_up )
+            time.sleep( 5 )
 
-            main.Mininet2.handle.sendline("sudo ifconfig "+
-                    interface_config+" up")
-            main.Mininet2.handle.expect("\$")
-            time.sleep(10)
-            
+            main.Mininet2.handle.sendline( "sudo ifconfig " +
+                                           interface_config + " up" )
+            main.Mininet2.handle.expect( "\$" )
+            time.sleep( 10 )
+
             main.ONOS1.tshark_stop()
 
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_port_up+" /tmp/")
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_port_up + " /tmp/" )
 
-            f_port_up = open(tshark_port_up, 'r')
+            f_port_up = open( tshark_port_up, 'r' )
             f_line = f_port_up.readline()
-            obj_up = f_line.split(" ")
-            if len(f_line) > 0:
-                timestamp_begin_pt_up = int(float(obj_up[1]))*1000
-                main.log.info("Port up begin timestamp: "+
-                        str(timestamp_begin_pt_up))
+            obj_up = f_line.split( " " )
+            if len( f_line ) > 0:
+                timestamp_begin_pt_up = int( float( obj_up[ 1 ] ) ) * 1000
+                main.log.info( "Port up begin timestamp: " +
+                               str( timestamp_begin_pt_up ) )
             else:
-                main.log.info("Tshark output file returned unexpected"+
-                        " results.")
+                main.log.info( "Tshark output file returned unexpected" +
+                               " results." )
                 timestamp_begin_pt_up = 0
-            
+
             f_port_up.close()
 
-            main.step("Obtain t1 by REST call")
+            main.step( "Obtain t1 by REST call" )
             json_str_1 = main.ONOS1cli.topology_events_metrics()
 
-            json_obj_1 = json.loads(json_str_1)
+            json_obj_1 = json.loads( json_str_1 )
 
-            #Obtain graph timestamp. This timestsamp captures
-            #the epoch time at which the topology graph was updated.
+            # Obtain graph timestamp. This timestsamp captures
+            # the epoch time at which the topology graph was updated.
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
 
-            #Obtain device timestamp. This timestamp captures
-            #the epoch time at which the device event happened
+            # Obtain device timestamp. This timestamp captures
+            # the epoch time at which the device event happened
             device_timestamp_1 = \
-                    json_obj_1[deviceTimestamp]['value'] 
-            
-            #Get delta between graph event and OFP 
-            pt_up_graph_to_ofp_1 = int(graph_timestamp_1) -\
-                    int(timestamp_begin_pt_up)
+                json_obj_1[ deviceTimestamp ][ 'value' ]
 
-            #Get delta between device event and OFP
-            pt_up_device_to_ofp_1 = int(device_timestamp_1) -\
-                    int(timestamp_begin_pt_up)
+            # Get delta between graph event and OFP
+            pt_up_graph_to_ofp_1 = int( graph_timestamp_1 ) -\
+                int( timestamp_begin_pt_up )
 
-            pt_up_graph_to_ofp_avg = float(pt_up_graph_to_ofp_1) 
+            # Get delta between device event and OFP
+            pt_up_device_to_ofp_1 = int( device_timestamp_1 ) -\
+                int( timestamp_begin_pt_up )
 
-            pt_up_device_to_ofp_avg = float(pt_up_device_to_ofp_1) 
+            pt_up_graph_to_ofp_avg = float( pt_up_graph_to_ofp_1 )
+
+            pt_up_device_to_ofp_avg = float( pt_up_device_to_ofp_1 )
 
             if pt_up_graph_to_ofp_avg > 0 and \
                     pt_up_graph_to_ofp_avg < 1000:
                 port_up_graph_to_ofp_list.append(
-                        pt_up_graph_to_ofp_avg)
-                main.log.info("Port down: graph to ofp avg: "+
-                    str(pt_up_graph_to_ofp_avg) + " ms")
+                    pt_up_graph_to_ofp_avg )
+                main.log.info( "Port down: graph to ofp avg: " +
+                               str( pt_up_graph_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port up graph-to-ofp result"+
-                        " exceeded the threshold: "+
-                        str(pt_up_graph_to_ofp_avg))
-            
+                main.log.info( "Average port up graph-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_up_graph_to_ofp_avg ) )
+
             if pt_up_device_to_ofp_avg > 0 and \
                     pt_up_device_to_ofp_avg < 1000:
                 port_up_device_to_ofp_list.append(
-                        pt_up_device_to_ofp_avg)
-                main.log.info("Port up: device to ofp avg: "+
-                    str(pt_up_device_to_ofp_avg) + " ms")
+                    pt_up_device_to_ofp_avg )
+                main.log.info( "Port up: device to ofp avg: " +
+                               str( pt_up_device_to_ofp_avg ) + " ms" )
             else:
-                main.log.info("Average port up device-to-ofp result"+
-                        " exceeded the threshold: "+
-                        str(pt_up_device_to_ofp_avg))
-            
-            #END ITERATION FOR LOOP
-        
-        #Check all list for latency existence and set assertion
-        if (port_down_graph_to_ofp_list and port_down_device_to_ofp_list\
-           and port_up_graph_to_ofp_list and port_up_device_to_ofp_list):
+                main.log.info( "Average port up device-to-ofp result" +
+                               " exceeded the threshold: " +
+                               str( pt_up_device_to_ofp_avg ) )
+
+            # END ITERATION FOR LOOP
+
+        # Check all list for latency existence and set assertion
+        if ( port_down_graph_to_ofp_list and port_down_device_to_ofp_list
+                and port_up_graph_to_ofp_list and port_up_device_to_ofp_list ):
             assertion = main.TRUE
 
-        #Calculate and report latency measurements
-        port_down_graph_to_ofp_min = min(port_down_graph_to_ofp_list)
-        port_down_graph_to_ofp_max = max(port_down_graph_to_ofp_list)
+        # Calculate and report latency measurements
+        port_down_graph_to_ofp_min = min( port_down_graph_to_ofp_list )
+        port_down_graph_to_ofp_max = max( port_down_graph_to_ofp_list )
         port_down_graph_to_ofp_avg = \
-                (sum(port_down_graph_to_ofp_list) / 
-                 len(port_down_graph_to_ofp_list))
-        
-        main.log.report("Port down graph-to-ofp Min: "+
-                str(port_down_graph_to_ofp_min)+" ms  Max: "+
-                str(port_down_graph_to_ofp_max)+" ms  Avg: "+
-                str(port_down_graph_to_ofp_avg))
-        
-        port_down_device_to_ofp_min = min(port_down_device_to_ofp_list)
-        port_down_device_to_ofp_max = max(port_down_device_to_ofp_list)
+            ( sum( port_down_graph_to_ofp_list ) /
+              len( port_down_graph_to_ofp_list ) )
+
+        main.log.report( "Port down graph-to-ofp Min: " +
+                         str( port_down_graph_to_ofp_min ) + " ms  Max: " +
+                         str( port_down_graph_to_ofp_max ) + " ms  Avg: " +
+                         str( port_down_graph_to_ofp_avg ) )
+
+        port_down_device_to_ofp_min = min( port_down_device_to_ofp_list )
+        port_down_device_to_ofp_max = max( port_down_device_to_ofp_list )
         port_down_device_to_ofp_avg = \
-                (sum(port_down_device_to_ofp_list) /\
-                 len(port_down_device_to_ofp_list))
-        
-        main.log.report("Port down device-to-ofp Min: "+
-                str(port_down_device_to_ofp_min)+" ms  Max: "+
-                str(port_down_device_to_ofp_max)+" ms  Avg: "+
-                str(port_down_device_to_ofp_avg))
-        
-        port_up_graph_to_ofp_min = min(port_up_graph_to_ofp_list)
-        port_up_graph_to_ofp_max = max(port_up_graph_to_ofp_list)
+            ( sum( port_down_device_to_ofp_list ) /
+              len( port_down_device_to_ofp_list ) )
+
+        main.log.report( "Port down device-to-ofp Min: " +
+                         str( port_down_device_to_ofp_min ) + " ms  Max: " +
+                         str( port_down_device_to_ofp_max ) + " ms  Avg: " +
+                         str( port_down_device_to_ofp_avg ) )
+
+        port_up_graph_to_ofp_min = min( port_up_graph_to_ofp_list )
+        port_up_graph_to_ofp_max = max( port_up_graph_to_ofp_list )
         port_up_graph_to_ofp_avg = \
-                (sum(port_up_graph_to_ofp_list) /\
-                 len(port_up_graph_to_ofp_list))
-        
-        main.log.report("Port up graph-to-ofp Min: "+
-                str(port_up_graph_to_ofp_min)+" ms  Max: "+
-                str(port_up_graph_to_ofp_max)+" ms  Avg: "+
-                str(port_up_graph_to_ofp_avg))
-          
-        port_up_device_to_ofp_min = min(port_up_device_to_ofp_list)
-        port_up_device_to_ofp_max = max(port_up_device_to_ofp_list)
+            ( sum( port_up_graph_to_ofp_list ) /
+              len( port_up_graph_to_ofp_list ) )
+
+        main.log.report( "Port up graph-to-ofp Min: " +
+                         str( port_up_graph_to_ofp_min ) + " ms  Max: " +
+                         str( port_up_graph_to_ofp_max ) + " ms  Avg: " +
+                         str( port_up_graph_to_ofp_avg ) )
+
+        port_up_device_to_ofp_min = min( port_up_device_to_ofp_list )
+        port_up_device_to_ofp_max = max( port_up_device_to_ofp_list )
         port_up_device_to_ofp_avg = \
-                (sum(port_up_device_to_ofp_list) /\
-                 len(port_up_device_to_ofp_list))
-        
-        main.log.report("Port up device-to-ofp Min: "+
-                str(port_up_device_to_ofp_min)+" ms  Max: "+
-                str(port_up_device_to_ofp_max)+" ms  Avg: "+
-                str(port_up_device_to_ofp_avg))
+            ( sum( port_up_device_to_ofp_list ) /
+              len( port_up_device_to_ofp_list ) )
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Port discovery latency calculation successful",
-                onfail="Port discovery test failed")
+        main.log.report( "Port up device-to-ofp Min: " +
+                         str( port_up_device_to_ofp_min ) + " ms  Max: " +
+                         str( port_up_device_to_ofp_max ) + " ms  Avg: " +
+                         str( port_up_device_to_ofp_avg ) )
 
-    def CASE4(self, main):
-        '''
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=assertion,
+            onpass="Port discovery latency calculation successful",
+            onfail="Port discovery test failed" )
+
+    def CASE4( self, main ):
+        """
         Link down event using loss rate 100%
-        
+
         Important:
             Use a simple 2 switch topology with 1 link between
-            the two switches. Ensure that mac addresses of the 
+            the two switches. Ensure that mac addresses of the
             switches are 1 / 2 respectively
-        '''
+        """
         import time
         import subprocess
         import os
         import requests
         import json
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-       
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        linkTimestamp = main.params['JSON']['linkTimestamp'] 
-        graphTimestamp = main.params['JSON']['graphTimestamp']
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
+
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        linkTimestamp = main.params[ 'JSON' ][ 'linkTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
 
         assertion = main.TRUE
-        #Link event timestamp to system time list
+        # Link event timestamp to system time list
         link_down_link_to_system_list = []
         link_up_link_to_system_list = []
-        #Graph event timestamp to system time list
+        # Graph event timestamp to system time list
         link_down_graph_to_system_list = []
-        link_up_graph_to_system_list = [] 
+        link_up_graph_to_system_list = []
 
-        main.log.report("Add / remove link latency between "+
-                "two switches")
+        main.log.report( "Add / remove link latency between " +
+                         "two switches" )
 
-        main.step("Assign all switches")
-        main.Mininet1.assign_sw_controller(sw="1",
-                ip1=ONOS1_ip, port1=default_sw_port)
-        main.Mininet1.assign_sw_controller(sw="2",
-                ip1=ONOS1_ip, port1=default_sw_port)
+        main.step( "Assign all switches" )
+        main.Mininet1.assign_sw_controller(
+            sw="1",
+            ip1=ONOS1_ip,
+            port1=default_sw_port )
+        main.Mininet1.assign_sw_controller(
+            sw="2",
+            ip1=ONOS1_ip,
+            port1=default_sw_port )
 
-        main.step("Verifying switch assignment")
-        result_s1 = main.Mininet1.get_sw_controller(sw="s1")
-        result_s2 = main.Mininet1.get_sw_controller(sw="s2")
-          
-        #Allow time for events to finish before taking measurements
-        time.sleep(10)
+        main.step( "Verifying switch assignment" )
+        result_s1 = main.Mininet1.get_sw_controller( sw="s1" )
+        result_s2 = main.Mininet1.get_sw_controller( sw="s2" )
+
+        # Allow time for events to finish before taking measurements
+        time.sleep( 10 )
 
         link_down = False
-        #Start iteration of link event test
-        for i in range(0, int(num_iter)):
-            main.step("Getting initial system time as t0")
-            
-            timestamp_link_down_t0 = time.time() * 1000
-            #Link down is simulated by 100% loss rate using traffic 
-            #control command
-            main.Mininet1.handle.sendline(
-                    "sh tc qdisc add dev s1-eth1 root netem loss 100%")
+        # Start iteration of link event test
+        for i in range( 0, int( num_iter ) ):
+            main.step( "Getting initial system time as t0" )
 
-            #TODO: Iterate through 'links' command to verify that
-            #      link s1 -> s2 went down (loop timeout 30 seconds) 
+            timestamp_link_down_t0 = time.time() * 1000
+            # Link down is simulated by 100% loss rate using traffic
+            # control command
+            main.Mininet1.handle.sendline(
+                "sh tc qdisc add dev s1-eth1 root netem loss 100%" )
+
+            # TODO: Iterate through 'links' command to verify that
+            #      link s1 -> s2 went down ( loop timeout 30 seconds )
             #      on all 3 ONOS instances
-            main.log.info("Checking ONOS for link update")
+            main.log.info( "Checking ONOS for link update" )
             loop_count = 0
             while( not link_down and loop_count < 30 ):
                 json_str = main.ONOS1cli.links()
-                
+
                 if not json_str:
-                    main.log.error("CLI command returned error ")
+                    main.log.error( "CLI command returned error " )
                     break
                 else:
-                    json_obj = json.loads(json_str)
+                    json_obj = json.loads( json_str )
                 for obj in json_obj:
-                    if '01' not in obj['src']['device']:
+                    if '01' not in obj[ 'src' ][ 'device' ]:
                         link_down = True
-                        main.log.report("Link down from "+
-                                "s1 -> s2 on ONOS1 detected")
+                        main.log.report( "Link down from " +
+                                         "s1 -> s2 on ONOS1 detected" )
                 loop_count += 1
-                #If CLI doesn't like the continuous requests
-                #and exits in this loop, increase the sleep here.
-                #Consequently, while loop timeout will increase
-                time.sleep(1)
-    
-            #Give time for metrics measurement to catch up
-            #NOTE: May need to be configured more accurately
-            time.sleep(10)
-            #If we exited the while loop and link down 1,2,3 are still 
-            #false, then ONOS has failed to discover link down event
+                # If CLI doesn't like the continuous requests
+                # and exits in this loop, increase the sleep here.
+                # Consequently, while loop timeout will increase
+                time.sleep( 1 )
+
+            # Give time for metrics measurement to catch up
+            # NOTE: May need to be configured more accurately
+            time.sleep( 10 )
+            # If we exited the while loop and link down 1,2,3 are still
+            # false, then ONOS has failed to discover link down event
             if not link_down:
-                main.log.info("Link down discovery failed")
-                
+                main.log.info( "Link down discovery failed" )
+
                 link_down_lat_graph1 = 0
                 link_down_lat_device1 = 0
                 assertion = main.FALSE
             else:
                 json_topo_metrics_1 =\
-                        main.ONOS1cli.topology_events_metrics()
-                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
-                
-                main.log.info("Obtaining graph and device timestamp")
+                    main.ONOS1cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
+
+                main.log.info( "Obtaining graph and device timestamp" )
                 graph_timestamp_1 = \
-                    json_topo_metrics_1[graphTimestamp]['value']
+                    json_topo_metrics_1[ graphTimestamp ][ 'value' ]
 
                 link_timestamp_1 = \
-                    json_topo_metrics_1[linkTimestamp]['value']
+                    json_topo_metrics_1[ linkTimestamp ][ 'value' ]
 
                 if graph_timestamp_1 and link_timestamp_1:
-                    link_down_lat_graph1 = int(graph_timestamp_1) -\
-                            timestamp_link_down_t0
-                
-                    link_down_lat_link1 = int(link_timestamp_1) -\
-                            timestamp_link_down_t0
+                    link_down_lat_graph1 = int( graph_timestamp_1 ) -\
+                        timestamp_link_down_t0
+
+                    link_down_lat_link1 = int( link_timestamp_1 ) -\
+                        timestamp_link_down_t0
                 else:
-                    main.log.error("There was an error calculating"+
-                        " the delta for link down event")
+                    main.log.error( "There was an error calculating" +
+                                    " the delta for link down event" )
                     link_down_lat_graph1 = 0
-                    
+
                     link_down_lat_device1 = 0
-        
-            main.log.report("Link down latency ONOS1 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_down_lat_graph1)+" ms")
-            
-            main.log.report("Link down latency ONOS1 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_down_lat_link1)+" ms")
-      
-            #Calculate avg of node calculations
+
+            main.log.report( "Link down latency ONOS1 iteration " +
+                             str( i ) + " (end-to-end): " +
+                             str( link_down_lat_graph1 ) + " ms" )
+
+            main.log.report( "Link down latency ONOS1 iteration " +
+                             str( i ) + " (link-event-to-system-timestamp): " +
+                             str( link_down_lat_link1 ) + " ms" )
+
+            # Calculate avg of node calculations
             link_down_lat_graph_avg = link_down_lat_graph1
             link_down_lat_link_avg = link_down_lat_link1
 
-            #Set threshold and append latency to list
+            # Set threshold and append latency to list
             if link_down_lat_graph_avg > 0.0 and\
                link_down_lat_graph_avg < 30000:
                 link_down_graph_to_system_list.append(
-                        link_down_lat_graph_avg)
+                    link_down_lat_graph_avg )
             else:
-                main.log.info("Link down latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link down latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
             if link_down_lat_link_avg > 0.0 and\
                link_down_lat_link_avg < 30000:
                 link_down_link_to_system_list.append(
-                        link_down_lat_link_avg)
+                    link_down_lat_link_avg )
             else:
-                main.log.info("Link down latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link down latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
 
-            #NOTE: To remove loss rate and measure latency:
+            # NOTE: To remove loss rate and measure latency:
             #       'sh tc qdisc del dev s1-eth1 root'
             timestamp_link_up_t0 = time.time() * 1000
-            main.Mininet1.handle.sendline("sh tc qdisc del dev "+
-                    "s1-eth1 root")
-            main.Mininet1.handle.expect("mininet>")
-            
-            main.log.info("Checking ONOS for link update")
-            
+            main.Mininet1.handle.sendline( "sh tc qdisc del dev " +
+                                           "s1-eth1 root" )
+            main.Mininet1.handle.expect( "mininet>" )
+
+            main.log.info( "Checking ONOS for link update" )
+
             link_down1 = True
             loop_count = 0
             while( link_down1 and loop_count < 30 ):
                 json_str1 = main.ONOS1cli.links()
                 if not json_str1:
-                    main.log.error("CLI command returned error ")
+                    main.log.error( "CLI command returned error " )
                     break
                 else:
-                    json_obj1 = json.loads(json_str1)
-                
+                    json_obj1 = json.loads( json_str1 )
+
                 for obj1 in json_obj1:
-                    if '01' in obj1['src']['device']:
-                        link_down1 = False 
-                        main.log.report("Link up from "+
-                            "s1 -> s2 on ONOS1 detected")
+                    if '01' in obj1[ 'src' ][ 'device' ]:
+                        link_down1 = False
+                        main.log.report( "Link up from " +
+                                         "s1 -> s2 on ONOS1 detected" )
                 loop_count += 1
-                time.sleep(1)
-            
+                time.sleep( 1 )
+
             if link_down1:
-                main.log.info("Link up discovery failed")
+                main.log.info( "Link up discovery failed" )
                 link_up_lat_graph1 = 0
                 link_up_lat_device1 = 0
                 assertion = main.FALSE
             else:
                 json_topo_metrics_1 =\
-                        main.ONOS1cli.topology_events_metrics()
-                json_topo_metrics_1 = json.loads(json_topo_metrics_1)
+                    main.ONOS1cli.topology_events_metrics()
+                json_topo_metrics_1 = json.loads( json_topo_metrics_1 )
 
-                main.log.info("Obtaining graph and device timestamp")
+                main.log.info( "Obtaining graph and device timestamp" )
                 graph_timestamp_1 = \
-                    json_topo_metrics_1[graphTimestamp]['value']
-                
+                    json_topo_metrics_1[ graphTimestamp ][ 'value' ]
+
                 link_timestamp_1 = \
-                    json_topo_metrics_1[linkTimestamp]['value']
+                    json_topo_metrics_1[ linkTimestamp ][ 'value' ]
 
                 if graph_timestamp_1 and link_timestamp_1:
-                    link_up_lat_graph1 = int(graph_timestamp_1) -\
-                            timestamp_link_up_t0
-                    link_up_lat_link1 = int(link_timestamp_1) -\
-                            timestamp_link_up_t0
+                    link_up_lat_graph1 = int( graph_timestamp_1 ) -\
+                        timestamp_link_up_t0
+                    link_up_lat_link1 = int( link_timestamp_1 ) -\
+                        timestamp_link_up_t0
                 else:
-                    main.log.error("There was an error calculating"+
-                        " the delta for link down event")
+                    main.log.error( "There was an error calculating" +
+                                    " the delta for link down event" )
                     link_up_lat_graph1 = 0
                     link_up_lat_device1 = 0
-        
-            main.log.info("Link up latency ONOS1 iteration "+
-                    str(i)+" (end-to-end): "+
-                    str(link_up_lat_graph1)+" ms")
-            
-            main.log.info("Link up latency ONOS1 iteration "+
-                    str(i)+" (link-event-to-system-timestamp): "+
-                    str(link_up_lat_link1)+" ms")
-      
-            #Calculate avg of node calculations
+
+            main.log.info( "Link up latency ONOS1 iteration " +
+                           str( i ) + " (end-to-end): " +
+                           str( link_up_lat_graph1 ) + " ms" )
+
+            main.log.info( "Link up latency ONOS1 iteration " +
+                           str( i ) + " (link-event-to-system-timestamp): " +
+                           str( link_up_lat_link1 ) + " ms" )
+
+            # Calculate avg of node calculations
             link_up_lat_graph_avg = link_up_lat_graph1
             link_up_lat_link_avg = link_up_lat_link1
 
-            #Set threshold and append latency to list
+            # Set threshold and append latency to list
             if link_up_lat_graph_avg > 0.0 and\
                link_up_lat_graph_avg < 30000:
                 link_up_graph_to_system_list.append(
-                        link_up_lat_graph_avg)
+                    link_up_lat_graph_avg )
             else:
-                main.log.info("Link up latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link up latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
             if link_up_lat_link_avg > 0.0 and\
                link_up_lat_link_avg < 30000:
                 link_up_link_to_system_list.append(
-                        link_up_lat_link_avg)
+                    link_up_lat_link_avg )
             else:
-                main.log.info("Link up latency exceeded threshold")
-                main.log.info("Results for iteration "+str(i)+
-                        "have been omitted")
+                main.log.info( "Link up latency exceeded threshold" )
+                main.log.info( "Results for iteration " + str( i ) +
+                               "have been omitted" )
 
-        #Calculate min, max, avg of list and report
-        link_down_min = min(link_down_graph_to_system_list)
-        link_down_max = max(link_down_graph_to_system_list)
-        link_down_avg = sum(link_down_graph_to_system_list) / \
-                        len(link_down_graph_to_system_list)
-        link_up_min = min(link_up_graph_to_system_list)
-        link_up_max = max(link_up_graph_to_system_list)
-        link_up_avg = sum(link_up_graph_to_system_list) / \
-                        len(link_up_graph_to_system_list)
+        # Calculate min, max, avg of list and report
+        link_down_min = min( link_down_graph_to_system_list )
+        link_down_max = max( link_down_graph_to_system_list )
+        link_down_avg = sum( link_down_graph_to_system_list ) / \
+            len( link_down_graph_to_system_list )
+        link_up_min = min( link_up_graph_to_system_list )
+        link_up_max = max( link_up_graph_to_system_list )
+        link_up_avg = sum( link_up_graph_to_system_list ) / \
+            len( link_up_graph_to_system_list )
 
-        main.log.report("Link down latency - Min: "+
-                str(link_down_min)+"ms  Max: "+
-                str(link_down_max)+"ms  Avg: "+
-                str(link_down_avg)+"ms")
-        main.log.report("Link up latency - Min: "+
-                str(link_up_min)+"ms  Max: "+
-                str(link_up_max)+"ms  Avg: "+
-                str(link_up_avg)+"ms")
+        main.log.report( "Link down latency - Min: " +
+                         str( link_down_min ) + "ms  Max: " +
+                         str( link_down_max ) + "ms  Avg: " +
+                         str( link_down_avg ) + "ms" )
+        main.log.report( "Link up latency - Min: " +
+                         str( link_up_min ) + "ms  Max: " +
+                         str( link_up_max ) + "ms  Avg: " +
+                         str( link_up_avg ) + "ms" )
 
-        utilities.assert_equals(expect=main.TRUE, actual=assertion,
-                onpass="Link discovery latency calculation successful",
-                onfail="Link discovery latency case failed")
+        utilities.assert_equals(
+            expect=main.TRUE,
+            actual=assertion,
+            onpass="Link discovery latency calculation successful",
+            onfail="Link discovery latency case failed" )
 
-    def CASE5(self, main):
-        '''
+    def CASE5( self, main ):
+        """
         100 Switch discovery latency
 
         Important:
-            This test case can be potentially dangerous if 
+            This test case can be potentially dangerous if
             your machine has previously set iptables rules.
             One of the steps of the test case will flush
             all existing iptables rules.
         Note:
-            You can specify the number of switches in the 
+            You can specify the number of switches in the
             params file to adjust the switch discovery size
-            (and specify the corresponding topology in Mininet1 
-            .topo file)
-        '''
+            ( and specify the corresponding topology in Mininet1
+            .topo file )
+        """
         import time
         import subprocess
         import os
         import requests
         import json
 
-        ONOS1_ip = main.params['CTRL']['ip1']
-        MN1_ip = main.params['MN']['ip1']
-        ONOS_user = main.params['CTRL']['user']
+        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        MN1_ip = main.params[ 'MN' ][ 'ip1' ]
+        ONOS_user = main.params[ 'CTRL' ][ 'user' ]
 
-        default_sw_port = main.params['CTRL']['port1']
-       
-        #Number of iterations of case
-        num_iter = main.params['TEST']['numIter']
-        num_sw = main.params['TEST']['numSwitch']
+        default_sw_port = main.params[ 'CTRL' ][ 'port1' ]
 
-        #Timestamp 'keys' for json metrics output.
-        #These are subject to change, hence moved into params
-        deviceTimestamp = main.params['JSON']['deviceTimestamp']
-        graphTimestamp = main.params['JSON']['graphTimestamp']
-   
-        tshark_ofp_output = "/tmp/tshark_ofp_"+num_sw+"sw.txt"
-        tshark_tcp_output = "/tmp/tshark_tcp_"+num_sw+"sw.txt"
+        # Number of iterations of case
+        num_iter = main.params[ 'TEST' ][ 'numIter' ]
+        num_sw = main.params[ 'TEST' ][ 'numSwitch' ]
+
+        # Timestamp 'keys' for json metrics output.
+        # These are subject to change, hence moved into params
+        deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ]
+        graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ]
+
+        tshark_ofp_output = "/tmp/tshark_ofp_" + num_sw + "sw.txt"
+        tshark_tcp_output = "/tmp/tshark_tcp_" + num_sw + "sw.txt"
 
         tshark_ofp_result_list = []
         tshark_tcp_result_list = []
 
-        main.case(num_sw+" Switch discovery latency")
-        main.step("Assigning all switches to ONOS1")
-        for i in range(1, int(num_sw)+1):
+        main.case( num_sw + " Switch discovery latency" )
+        main.step( "Assigning all switches to ONOS1" )
+        for i in range( 1, int( num_sw ) + 1 ):
             main.Mininet1.assign_sw_controller(
-                    sw=str(i),
-                    ip1=ONOS1_ip,
-                    port1=default_sw_port)
-        
-        #Ensure that nodes are configured with ptpd
-        #Just a warning message
-        main.log.info("Please check ptpd configuration to ensure"+\
-                " All nodes' system times are in sync")
-        time.sleep(5)
+                sw=str( i ),
+                ip1=ONOS1_ip,
+                port1=default_sw_port )
 
-        for i in range(0, int(num_iter)):
-            
-            main.step("Set iptables rule to block incoming sw connections")
-            #Set iptables rule to block incoming switch connections
-            #The rule description is as follows:
+        # Ensure that nodes are configured with ptpd
+        # Just a warning message
+        main.log.info( "Please check ptpd configuration to ensure" +
+                       " All nodes' system times are in sync" )
+        time.sleep( 5 )
+
+        for i in range( 0, int( num_iter ) ):
+
+            main.step( "Set iptables rule to block incoming sw connections" )
+            # Set iptables rule to block incoming switch connections
+            # The rule description is as follows:
             #   Append to INPUT rule,
             #   behavior DROP that matches following:
             #       * packet type: tcp
             #       * source IP: MN1_ip
             #       * destination PORT: 6633
             main.ONOS1.handle.sendline(
-                    "sudo iptables -A INPUT -p tcp -s "+MN1_ip+
-                    " --dport "+default_sw_port+" -j DROP")
-            main.ONOS1.handle.expect("\$") 
-            #   Append to OUTPUT rule, 
+                "sudo iptables -A INPUT -p tcp -s " + MN1_ip +
+                " --dport " + default_sw_port + " -j DROP" )
+            main.ONOS1.handle.expect( "\$" )
+            #   Append to OUTPUT rule,
             #   behavior DROP that matches following:
             #       * packet type: tcp
             #       * source IP: MN1_ip
             #       * destination PORT: 6633
             main.ONOS1.handle.sendline(
-                    "sudo iptables -A OUTPUT -p tcp -s "+MN1_ip+
-                    " --dport "+default_sw_port+" -j DROP")
-            main.ONOS1.handle.expect("\$")
-            #Give time to allow rule to take effect
-            #NOTE: Sleep period may need to be configured 
+                "sudo iptables -A OUTPUT -p tcp -s " + MN1_ip +
+                " --dport " + default_sw_port + " -j DROP" )
+            main.ONOS1.handle.expect( "\$" )
+            # Give time to allow rule to take effect
+            # NOTE: Sleep period may need to be configured
             #      based on the number of switches in the topology
-            main.log.info("Please wait for switch connection to "+
-                    "time out")
-            time.sleep(60)
-            
-            #Gather vendor OFP with tshark
-            main.ONOS1.tshark_grep("OFP 86 Vendor", 
-                    tshark_ofp_output)
-            main.ONOS1.tshark_grep("TCP 74 ",
-                    tshark_tcp_output)
+            main.log.info( "Please wait for switch connection to " +
+                           "time out" )
+            time.sleep( 60 )
 
-            #NOTE: Remove all iptables rule quickly (flush)
-            #      Before removal, obtain TestON timestamp at which 
+            # Gather vendor OFP with tshark
+            main.ONOS1.tshark_grep( "OFP 86 Vendor",
+                                    tshark_ofp_output )
+            main.ONOS1.tshark_grep( "TCP 74 ",
+                                    tshark_tcp_output )
+
+            # NOTE: Remove all iptables rule quickly ( flush )
+            #      Before removal, obtain TestON timestamp at which
             #      removal took place
-            #      (ensuring nodes are configured via ptp)
+            #      ( ensuring nodes are configured via ptp )
             #      sudo iptables -F
-            
+
             t0_system = time.time() * 1000
             main.ONOS1.handle.sendline(
-                    "sudo iptables -F")
+                "sudo iptables -F" )
 
-            #Counter to track loop count
+            # Counter to track loop count
             counter_loop = 0
             counter_avail1 = 0
             onos1_dev = False
             while counter_loop < 60:
-                #Continue to check devices for all device 
-                #availability. When all devices in all 3
-                #ONOS instances indicate that devices are available
-                #obtain graph event timestamp for t1.
+                # Continue to check devices for all device
+                # availability. When all devices in all 3
+                # ONOS instances indicate that devices are available
+                # obtain graph event timestamp for t1.
                 device_str_obj1 = main.ONOS1cli.devices()
-                device_json1 = json.loads(device_str_obj1)                
-                
+                device_json1 = json.loads( device_str_obj1 )
+
                 for device1 in device_json1:
-                    if device1['available'] == True:
+                    if device1[ 'available' ]:
                         counter_avail1 += 1
-                        if counter_avail1 == int(num_sw):
+                        if counter_avail1 == int( num_sw ):
                             onos1_dev = True
-                            main.log.info("All devices have been "+
-                                    "discovered on ONOS1")
+                            main.log.info( "All devices have been " +
+                                           "discovered on ONOS1" )
                     else:
                         counter_avail1 = 0
 
-                if onos1_dev: 
-                    main.log.info("All devices have been discovered "+
-                            "on all ONOS instances")
+                if onos1_dev:
+                    main.log.info( "All devices have been discovered " +
+                                   "on all ONOS instances" )
                     json_str_topology_metrics_1 =\
                         main.ONOS1cli.topology_events_metrics()
-                    #Exit while loop if all devices discovered
-                    break 
-                
+                    # Exit while loop if all devices discovered
+                    break
+
                 counter_loop += 1
-                #Give some time in between CLI calls
-                #(will not affect measurement)
-                time.sleep(3)
+                # Give some time in between CLI calls
+                #( will not affect measurement )
+                time.sleep( 3 )
 
             main.ONOS1.tshark_stop()
-            
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_ofp_output+" /tmp/") 
-            os.system("scp "+ONOS_user+"@"+ONOS1_ip+":"+
-                    tshark_tcp_output+" /tmp/")
-            ofp_file = open(tshark_ofp_output, 'r')
 
-            #The following is for information purpose only.
-            #TODO: Automate OFP output analysis
-            main.log.info("Tshark OFP Vendor output: ")
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_ofp_output + " /tmp/" )
+            os.system( "scp " + ONOS_user + "@" + ONOS1_ip + ":" +
+                       tshark_tcp_output + " /tmp/" )
+            ofp_file = open( tshark_ofp_output, 'r' )
+
+            # The following is for information purpose only.
+            # TODO: Automate OFP output analysis
+            main.log.info( "Tshark OFP Vendor output: " )
             for line in ofp_file:
-                tshark_ofp_result_list.append(line)
-                main.log.info(line)
+                tshark_ofp_result_list.append( line )
+                main.log.info( line )
 
             ofp_file.close()
 
-            tcp_file = open(tshark_tcp_output, 'r')
-            main.log.info("Tshark TCP 74 output: ")
+            tcp_file = open( tshark_tcp_output, 'r' )
+            main.log.info( "Tshark TCP 74 output: " )
             for line in tcp_file:
-                tshark_tcp_result_list.append(line)
-                main.log.info(line)
+                tshark_tcp_result_list.append( line )
+                main.log.info( line )
 
             tcp_file.close()
 
-            json_obj_1 = json.loads(json_str_topology_metrics_1)
+            json_obj_1 = json.loads( json_str_topology_metrics_1 )
 
             graph_timestamp_1 = \
-                    json_obj_1[graphTimestamp]['value']
+                json_obj_1[ graphTimestamp ][ 'value' ]
 
             main.log.info(
-                    int(graph_timestamp_1) - int(t0_system))
-
-
-
-
-
-
-
+                int( graph_timestamp_1 ) - int( t0_system ) )