diff --git a/TestON/tests/ProdFunc/ProdFunc.py b/TestON/tests/ProdFunc/ProdFunc.py
old mode 100644
new mode 100755
index 62d1ec8..6f4b72b
--- a/TestON/tests/ProdFunc/ProdFunc.py
+++ b/TestON/tests/ProdFunc/ProdFunc.py
@@ -3,9 +3,9 @@
 # For sanity and driver functionality excercises only.
 
 import time
-import sys
-import os
-import re
+# import sys
+# import os
+# import re
 import json
 
 time.sleep( 1 )
@@ -28,9 +28,8 @@
         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' ]
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
         main.case( "Setting up test environment" )
         main.log.report(
@@ -38,55 +37,55 @@
         main.log.report( "__________________________________" )
 
         main.step( "Applying cell variable to environment" )
-        cell_result = main.ONOSbench.set_cell( cell_name )
-        verify_result = main.ONOSbench.verify_cell()
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
 
         main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onos_remove_raft_logs()
+        main.ONOSbench.onosRemoveRaftLogs()
 
         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.ONOSbench.gitCheckout( "master" )
+        gitPullResult = main.ONOSbench.gitPull()
+        main.log.info( "git_pull_result = " + gitPullResult )
+        main.ONOSbench.getVersion( report=True )
 
-        if git_pull_result == 1:
+        if gitPullResult == 1:
             main.step( "Using mvn clean & install" )
-            clean_install_result = main.ONOSbench.clean_install()
-            #clean_install_result = main.TRUE
-        elif git_pull_result == 0:
+            main.ONOSbench.cleanInstall()
+        elif gitPullResult == 0:
             main.log.report(
                 "Git Pull Failed, look into logs for detailed reason" )
             main.cleanup()
             main.exit()
 
         main.step( "Creating ONOS package" )
-        package_result = main.ONOSbench.onos_package()
+        packageResult = main.ONOSbench.onosPackage()
 
         main.step( "Installing ONOS package" )
-        onos_install_result = main.ONOSbench.onos_install()
-        if onos_install_result == main.TRUE:
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
             main.log.report( "Installing ONOS package successful" )
         else:
             main.log.report( "Installing ONOS package failed" )
 
-        onos1_isup = main.ONOSbench.isup()
-        if onos1_isup == main.TRUE:
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
             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 )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
 
-        main.ONOS2.start_onos_cli( ONOS_ip=main.params[ 'CTRL' ][ 'ip1' ] )
+        main.ONOS2.startOnosCli( ONOSIp=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" )
+        case1Result = ( packageResult and
+                        cellResult and verifyResult
+                        and onosInstallResult and
+                        onos1Isup and startResult )
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
+                                onpass="Test startup successful",
+                                onfail="Test startup NOT successful" )
 
     def CASE2( self, main ):
         """
@@ -94,13 +93,12 @@
         """
         # 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' ] )
+        switchSleep = int( main.params[ 'timers' ][ 'SwitchDiscovery' ] )
 
         description = "Killing a switch to ensure it is discovered correctly"
         main.log.report( description )
@@ -110,120 +108,125 @@
         main.step( "Kill s28 " )
         main.log.report( "Deleting s28" )
         # FIXME: use new dynamic topo functions
-        main.Mininet1.del_switch( "s28" )
+        main.Mininet1.delSwitch( "s28" )
         main.log.info(
             "Waiting " +
-            str( switch_sleep ) +
+            str( switchSleep ) +
             " seconds for switch down to be discovered" )
-        time.sleep( switch_sleep )
+        time.sleep( switchSleep )
         # Peek at the deleted switch
-        device = main.ONOS2.get_device( dpid="0028" )
+        device = main.ONOS2.getDevice( dpid="0028" )
         print "device = ", device
         if device[ u'available' ] == 'False':
-            case2_result = main.FALSE
+            case2Result = 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" )
+            case2Result = main.TRUE
+        utilities.assert_equals( expect=main.TRUE, actual=case2Result,
+                                onpass="Switch down discovery successful",
+                                onfail="Switch down discovery failed" )
 
     def CASE11( self, main ):
         """
         Cleanup sequence:
-        onos-service <node_ip> stop
+        onos-service <nodeIp> stop
         onos-uninstall
 
         TODO: Define rest of cleanup
 
         """
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
         main.case( "Cleaning up test environment" )
 
         main.step( "Testing ONOS kill function" )
-        kill_result = main.ONOSbench.onos_kill( ONOS1_ip )
+        killResult = main.ONOSbench.onosKill( ONOS1Ip )
 
         main.step( "Stopping ONOS service" )
-        stop_result = main.ONOSbench.onos_stop( ONOS1_ip )
+        stopResult = main.ONOSbench.onosStop( ONOS1Ip )
 
         main.step( "Uninstalling ONOS service" )
-        uninstall_result = main.ONOSbench.onos_uninstall()
+        uninstallResult = main.ONOSbench.onosUninstall()
+
+        case11Result = killResult and stopResult and uninstallResult
+        utilities.assert_equals( expect=main.TRUE, actual=case11Result,
+                                onpass="Cleanup successful",
+                                onfail="Cleanup failed" )
 
     def CASE3( self, main ):
         """
         Test 'onos' command and its functionality in driver
         """
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
         main.case( "Testing 'onos' command" )
 
         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 )
+        cmdResult1 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr1 )
+        main.log.info( "onos command returned: " + cmdResult1 )
 
         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 )
+        cmdResult2 = main.ONOSbench.onosCli( ONOS1Ip, cmdstr2 )
+        main.log.info( "onos command returned: " + cmdResult2 )
 
     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' ]
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
-        main.log.report(
-            "This testcase exits the mininet cli and reinstalls ONOS to switch over to Packet Optical topology" )
+        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()
+        mininetDisconnect = main.Mininet1.disconnect()
 
         main.step( "Removing raft logs before a clen installation of ONOS" )
-        main.ONOSbench.onos_remove_raft_logs()
+        main.ONOSbench.onosRemoveRaftLogs()
 
         main.step( "Applying cell variable to environment" )
-        cell_result = main.ONOSbench.set_cell( cell_name )
-        verify_result = main.ONOSbench.verify_cell()
+        cellResult = main.ONOSbench.setCell( cellName )
+        verifyResult = main.ONOSbench.verifyCell()
 
-        onos_install_result = main.ONOSbench.onos_install()
-        if onos_install_result == main.TRUE:
+        onosInstallResult = main.ONOSbench.onosInstall()
+        if onosInstallResult == main.TRUE:
             main.log.report( "Installing ONOS package successful" )
         else:
             main.log.report( "Installing ONOS package failed" )
 
-        onos1_isup = main.ONOSbench.isup()
-        if onos1_isup == main.TRUE:
+        onos1Isup = main.ONOSbench.isup()
+        if onos1Isup == main.TRUE:
             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 )
+        startResult = main.ONOSbench.onosStart( ONOS1Ip )
 
-        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
+        main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        case20Result = mininetDisconnect and cellResult and verifyResult \
+            and onosInstallResult and onos1Isup and \
+            startResult
         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" )
+            actual=case20Result,
+            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
+            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
             from the json config file
         """
         main.log.report(
@@ -231,42 +234,47 @@
         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' ] )
+        startConsoleResult = main.LincOE1.startConsole()
+        opticalMnScript = main.LincOE2.runOpticalMnScript()
+        onosTopoCfgResult = main.ONOSbench.runOnosTopoCfg(
+            instanceName=main.params[ 'CTRL' ][ 'ip1' ],
+            jsonFile=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
+        print "start_console_result =", startConsoleResult
+        print "optical_mn_script = ", opticalMnScript
+        print "onos_topo_cfg_result =", onosTopoCfgResult
 
-        case21_result = start_console_result and optical_mn_script and onos_topo_cfg_result
+        case21Result = startConsoleResult and opticalMnScript and \
+            onosTopoCfgResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case21_result,
+            actual=case21Result,
             onpass="Packet optical topology spawned successsfully",
             onfail="Packet optical topology spawning failed" )
 
     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
+            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 and 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" )
+            "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.ONOS3.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        devicesResult = main.ONOS3.devices( jsonFormat=False )
 
-        print "devices_result = ", devices_result
-        devices_linewise = devices_result.split( "\n" )
-        devices_linewise = devices_linewise[ 1:-1 ]
+        print "devices_result = ", devicesResult
+        devicesLinewise = devicesResult.split( "\n" )
+        devicesLinewise = devicesLinewise[ 1:-1 ]
         roadmCount = 0
         packetLayerSWCount = 0
-        for line in devices_linewise:
+        for line in devicesLinewise:
             components = line.split( "," )
             availability = components[ 1 ].split( "=" )[ 1 ]
             type = components[ 3 ].split( "=" )[ 1 ]
@@ -275,93 +283,101 @@
             elif availability == 'true' and type == 'SWITCH':
                 packetLayerSWCount += 1
         if roadmCount == 4:
-            print "Number of Optical Switches = %d and is correctly detected" % roadmCount
+            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
+            opticalSWResult = main.TRUE
         else:
-            print "Number of Optical Switches = %d and is wrong" % roadCount
+            print "Number of Optical Switches = %d and is wrong" % roadmCount
             main.log.info(
                 "Number of Optical Switches = " +
                 str( roadmCount ) +
                 " and is wrong" )
-            opticalSW_result = main.FALSE
+            opticalSWResult = main.FALSE
 
         if packetLayerSWCount == 2:
-            print "Number of Packet layer or mininet Switches = %d and is correctly detected" % packetLayerSWCount
+            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
+            packetSWResult = main.TRUE
         else:
-            print "Number of Packet layer or mininet Switches = %d and is wrong" % packetLayerSWCount
+            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
+            packetSWResult = main.FALSE
         print "_________________________________"
 
-        links_result = main.ONOS3.links( json_format=False )
-        print "links_result = ", links_result
+        linksResult = main.ONOS3.links( jsonFormat=False )
+        print "links_result = ", linksResult
         print "_________________________________"
 
-        # NOTE:Since only point intents are added, there is no requirement to discover the hosts
+        # 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()
+        pingallResult = main.LincOE2.pingall()
 
-        hosts_result = main.ONOS3.hosts( json_format=False )
-        main.log.info( "hosts_result = "+hosts_result )
+        hostsResult = main.ONOS3.hosts( jsonFormat=False )
+        main.log.info( "hosts_result = "+hostsResult )
         main.log.info( "_________________________________" )
-        hosts_linewise = hosts_result.split( "\n" )
-        hosts_linewise = hosts_linewise[ 1:-1 ]
+        hostsLinewise = hostsResult.split( "\n" )
+        hostsLinewise = hostsLinewise[ 1:-1 ]
         hostCount = 0
-        for line in hosts_linewise:
+        for line in hostsLinewise:
             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
+        case22Result = opticalSWResult and packetSWResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case22_result,
+            actual=case22Result,
             onpass="Packet optical topology discovery successful",
             onfail="Packet optical topology discovery failed" )
 
     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" )
+            "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(
+        ptpIntentResult = main.ONOS3.addPointIntent(
             "of:0000ffffffff0001/1",
             "of:0000ffffffff0002/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS3.intents( json_format=False )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
             main.log.info( "Point to point intent install successful" )
 
-        ptp_intent_result = main.ONOS3.add_point_intent(
+        ptpIntentResult = main.ONOS3.addPointIntent(
             "of:0000ffffffff0002/1",
             "of:0000ffffffff0001/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS3.intents( json_format=False )
+        if ptpIntentResult == main.TRUE:
+            main.ONOS3.intents( jsonFormat=False )
             main.log.info( "Point to point intent install successful" )
 
         time.sleep( 10 )
@@ -370,17 +386,17 @@
 
         # Sleep for 30 seconds to provide time for the intent state to change
         time.sleep( 30 )
-        intentHandle = main.ONOS3.intents( json_format=False )
+        intentHandle = main.ONOS3.intents( jsonFormat=False )
         main.log.info( "intents :" + intentHandle )
 
-        Ping_Result = main.TRUE
+        PingResult = main.TRUE
         count = 1
         main.log.info( "\n\nh1 is Pinging h2" )
         ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
-        #ping = main.LincOE2.pinghost()
+        # ping = main.LincOE2.pinghost()
         if ping == main.FALSE and count < 5:
             count += 1
-            Ping_Result = main.FALSE
+            PingResult = main.FALSE
             main.log.info(
                 "Ping between h1 and h2  failed. Making attempt number " +
                 str( count ) +
@@ -388,82 +404,91 @@
             time.sleep( 2 )
         elif ping == main.FALSE:
             main.log.info( "All ping attempts between h1 and h2 have failed" )
-            Ping_Result = main.FALSE
+            PingResult = main.FALSE
         elif ping == main.TRUE:
             main.log.info( "Ping test between h1 and h2 passed!" )
-            Ping_Result = main.TRUE
+            PingResult = main.TRUE
         else:
             main.log.info( "Unknown error" )
-            Ping_Result = main.ERROR
+            PingResult = main.ERROR
 
-        if Ping_Result == main.FALSE:
+        if PingResult == main.FALSE:
             main.log.report(
-                "Point intents for packet optical have not ben installed correctly. Cleaning up" )
-        if Ping_Result == main.TRUE:
+                "Point intents for packet optical have not ben installed\
+                correctly. Cleaning up" )
+        if PingResult == main.TRUE:
             main.log.report(
-                "Point Intents for packet optical have been installed correctly" )
+                "Point Intents for packet optical have been\
+                installed correctly" )
 
-        case23_result = Ping_Result
+        case23Result = PingResult
         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" )
+            actual=case23Result,
+            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 ):
         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
-            and do a ping test. If rerouting is successful, ping should pass. also check the flows
+            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.LincOE1.portDown( swId="1", ptId="22" )
+        linksNonjson = main.ONOS3.links( jsonFormat=False )
+        main.log.info( "links = " + linksNonjson )
 
         links = main.ONOS3.links()
         main.log.info( "links = " + links )
 
-        links_result = json.loads( links )
-        links_state_result = main.FALSE
-        for item in links_result:
+        linksResult = json.loads( links )
+        linksStateResult = main.FALSE
+        for item in linksResult:
             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":
+                    linksState = item[ 'state' ]
+                    if linksState == "INACTIVE":
                         main.log.info(
-                            "Links state is inactive as expected due to one of the ports being down" )
+                            "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
+                            "Links state is inactive as expected due to one \
+                            of the ports being down" )
+                        linksStateResult = main.TRUE
                         break
                     else:
                         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
+                        linksStateResult = main.FALSE
 
-        print "links_state_result = ", links_state_result
+        print "links_state_result = ", linksStateResult
         time.sleep( 10 )
         flowHandle = main.ONOS3.flows()
         main.log.info( "flows :" + flowHandle )
 
         main.step( "Verify Rerouting by a ping test" )
-        Ping_Result = main.TRUE
+        PingResult = main.TRUE
         count = 1
         main.log.info( "\n\nh1 is Pinging h2" )
         ping = main.LincOE2.pingHostOptical( src="h1", target="h2" )
-        #ping = main.LincOE2.pinghost()
+        # ping = main.LincOE2.pinghost()
         if ping == main.FALSE and count < 5:
             count += 1
-            Ping_Result = main.FALSE
+            PingResult = main.FALSE
             main.log.info(
                 "Ping between h1 and h2  failed. Making attempt number " +
                 str( count ) +
@@ -471,159 +496,163 @@
             time.sleep( 2 )
         elif ping == main.FALSE:
             main.log.info( "All ping attempts between h1 and h2 have failed" )
-            Ping_Result = main.FALSE
+            PingResult = main.FALSE
         elif ping == main.TRUE:
             main.log.info( "Ping test between h1 and h2 passed!" )
-            Ping_Result = main.TRUE
+            PingResult = main.TRUE
         else:
             main.log.info( "Unknown error" )
-            Ping_Result = main.ERROR
+            PingResult = main.ERROR
 
-        if Ping_Result == main.TRUE:
+        if PingResult == main.TRUE:
             main.log.report( "Ping test successful " )
-        if Ping_Result == main.FALSE:
+        if PingResult == 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" )
+        case24Result = PingResult and linksStateResult
+        utilities.assert_equals( expect=main.TRUE, actual=case24Result,
+                                onpass="Packet optical rerouting successful",
+                                onfail="Packet optical rerouting failed" )
 
     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( "This testcase is testing the assignment of \
+                         all the switches to all the controllers and \
+                         discovering the hists in reactive mode" )
         main.log.report( "__________________________________" )
         main.case( "Pingall Test" )
         main.step( "Assigning switches to controllers" )
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
         for i in range( 1, 29 ):
             if i == 1:
-                main.Mininet1.assign_sw_controller(
+                main.Mininet1.assignSwController(
                     sw=str( i ),
-                    ip1=ONOS1_ip,
-                    port1=ONOS1_port )
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
             elif i >= 2 and i < 5:
-                main.Mininet1.assign_sw_controller(
+                main.Mininet1.assignSwController(
                     sw=str( i ),
-                    ip1=ONOS1_ip,
-                    port1=ONOS1_port )
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
             elif i >= 5 and i < 8:
-                main.Mininet1.assign_sw_controller(
+                main.Mininet1.assignSwController(
                     sw=str( i ),
-                    ip1=ONOS1_ip,
-                    port1=ONOS1_port )
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
             elif i >= 8 and i < 18:
-                main.Mininet1.assign_sw_controller(
+                main.Mininet1.assignSwController(
                     sw=str( i ),
-                    ip1=ONOS1_ip,
-                    port1=ONOS1_port )
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
             elif i >= 18 and i < 28:
-                main.Mininet1.assign_sw_controller(
+                main.Mininet1.assignSwController(
                     sw=str( i ),
-                    ip1=ONOS1_ip,
-                    port1=ONOS1_port )
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
             else:
-                main.Mininet1.assign_sw_controller(
+                main.Mininet1.assignSwController(
                     sw=str( i ),
-                    ip1=ONOS1_ip,
-                    port1=ONOS1_port )
-        Switch_Mastership = main.TRUE
+                    ip1=ONOS1Ip,
+                    port1=ONOS1Port )
+        SwitchMastership = main.TRUE
         for i in range( 1, 29 ):
             if i == 1:
-                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                response = main.Mininet1.getSwController( "s" + str( i ) )
                 print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1_ip, response ):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
                 else:
-                    Switch_Mastership = main.FALSE
+                    SwitchMastership = main.FALSE
             elif i >= 2 and i < 5:
-                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                response = main.Mininet1.getSwController( "s" + str( i ) )
                 print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1_ip, response ):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
                 else:
-                    Switch_Mastership = main.FALSE
+                    SwitchMastership = main.FALSE
             elif i >= 5 and i < 8:
-                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                response = main.Mininet1.getSwController( "s" + str( i ) )
                 print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1_ip, response ):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
                 else:
-                    Switch_Mastership = main.FALSE
+                    SwitchMastership = main.FALSE
             elif i >= 8 and i < 18:
-                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                response = main.Mininet1.getSwController( "s" + str( i ) )
                 print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1_ip, response ):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
                 else:
-                    Switch_Mastership = main.FALSE
+                    SwitchMastership = main.FALSE
             elif i >= 18 and i < 28:
-                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                response = main.Mininet1.getSwController( "s" + str( i ) )
                 print( "Response is " + str( response ) )
-                if re.search( "tcp:" + ONOS1_ip, response ):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
                 else:
-                    Switch_Mastership = main.FALSE
+                    SwitchMastership = main.FALSE
             else:
-                response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+                response = main.Mininet1.getSwController( "s" + str( i ) )
                 print( "Response is" + str( response ) )
-                if re.search( "tcp:" + ONOS1_ip, response ):
-                    Switch_Mastership = Switch_Mastership and main.TRUE
+                if re.search( "tcp:" + ONOS1Ip, response ):
+                    SwitchMastership = SwitchMastership and main.TRUE
                 else:
-                    Switch_Mastership = main.FALSE
+                    SwitchMastership = main.FALSE
 
-        if Switch_Mastership == main.TRUE:
+        if SwitchMastership == main.TRUE:
             main.log.report( "Controller assignmnet successful" )
         else:
             main.log.report( "Controller assignmnet failed" )
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=Switch_Mastership,
+            actual=SwitchMastership,
             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 )
+            main.Mininet1.assignSwController( sw=str( i ),count=5,
+                    ip1=ONOS1Ip,port1=ONOS1Port,
+                    ip2=ONOS2Ip,port2=ONOS2Port,
+                    ip3=ONOS3Ip,port3=ONOS3Port,
+                    ip4=ONOS4Ip,port4=ONOS4Port,
+                    ip5=ONOS5Ip,port5=ONOS5Port )
         """
         # REACTIVE FWD test
 
         main.step( "Get list of hosts from Mininet" )
-        host_list = main.Mininet1.get_hosts()
-        main.log.info( host_list )
+        hostList = main.Mininet1.getHosts()
+        main.log.info( hostList )
 
         main.step( "Get host list in ONOS format" )
-        host_onos_list = main.ONOS2.get_hosts_id( host_list )
-        main.log.info( host_onos_list )
+        hostOnosList = main.ONOS2.getHostsId( hostList )
+        main.log.info( hostOnosList )
         # time.sleep( 5 )
 
         main.step( "Pingall" )
-        ping_result = main.FALSE
-        while ping_result == main.FALSE:
+        pingResult = main.FALSE
+        while pingResult == main.FALSE:
             time1 = time.time()
-            ping_result = main.Mininet1.pingall()
+            pingResult = 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
+        # 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' ] )
+        main.ONOS2.startOnosCli( ONOSIp=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" )
+        case4Result = SwitchMastership and pingResult
+        if pingResult == main.TRUE:
+            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,
+            actual=case4Result,
             onpass="Controller assignment and Pingall Test successful",
             onfail="Controller assignment and Pingall Test NOT successful" )
 
@@ -633,74 +662,87 @@
         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" )
+        appUninstallResult = main.ONOS2.featureUninstall( "onos-app-fwd" )
         main.log.info( "onos-app-fwd uninstalled" )
 
-        # After reactive forwarding is disabled, the reactive flows on switches timeout in 10-15s
+        # 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 )
 
-        case10_result = appUninstall_result
+        case10Result = appUninstallResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case10_result,
+            actual=case10Result,
             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( "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" )
-        devices_id_list = main.ONOS2.get_all_devices_id()
-        # main.log.info( devices_id_list )
+        devicesIdList = main.ONOS2.getAllDevicesId()
+        main.log.info( devicesIdList )
 
-        # ONOS displays the hosts in hex format unlike mininet which does in decimal format
+        # 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 "_____________________________________________________________________________________"
+        main.step( "Add host-to-host intents for mininet hosts h8 and h18 or
+                    ONOS hosts h8 and h12" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:08/-1", "00:00:00:00:00:12/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:09/-1", "00:00:00:00:00:13/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0A/-1", "00:00:00:00:00:14/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0B/-1", "00:00:00:00:00:15/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0C/-1", "00:00:00:00:00:16/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0D/-1", "00:00:00:00:00:17/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0E/-1", "00:00:00:00:00:18/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:0F/-1", "00:00:00:00:00:19/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "00:00:00:00:00:10/-1", "00:00:00:00:00:1A/-1" )
+        hthIntentResult = main.ONOS2.addHostIntent(
+                            "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 ) )
+                "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 )
+            host1Id = main.ONOS2.getHost( host1 )[ 'id' ]
+            host2Id = main.ONOS2.getHost( host2 )[ 'id' ]
+            main.ONOS2.addHostIntent( host1Id, host2Id )
 
         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 )
+        hIntents = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intents:" + hIntents )
+        main.ONOS2.flows()
 
         count = 1
         i = 8
-        Ping_Result = main.TRUE
+        PingResult = main.TRUE
         # while i<10:
         while i < 18:
             main.log.info(
@@ -709,8 +751,8 @@
                 src="h" + str( i ), target="h" + str( i + 10 ) )
             if ping == main.FALSE and count < 5:
                 count += 1
-                #i = 8
-                Ping_Result = main.FALSE
+                # i = 8
+                PingResult = main.FALSE
                 main.log.report( "Ping between h" +
                                  str( i ) +
                                  " and h" +
@@ -728,7 +770,7 @@
                                       10 ) +
                                  "have failed" )
                 i = 19
-                Ping_Result = main.FALSE
+                PingResult = main.FALSE
             elif ping == main.TRUE:
                 main.log.info( "Ping test between h" +
                                str( i ) +
@@ -737,39 +779,33 @@
                                     10 ) +
                                "passed!" )
                 i += 1
-                Ping_Result = main.TRUE
+                PingResult = main.TRUE
             else:
                 main.log.info( "Unknown error" )
-                Ping_Result = main.ERROR
-        if Ping_Result == main.FALSE:
+                PingResult = main.ERROR
+        if PingResult == main.FALSE:
             main.log.report(
                 "Ping all test after Host intent addition failed. Cleaning up" )
             # main.cleanup()
             # main.exit()
-        if Ping_Result == main.TRUE:
+        if PingResult == main.TRUE:
             main.log.report(
                 "Ping all test after Host intent addition successful" )
 
-        case6_result = Ping_Result
+        case6Result = PingResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case6_result,
+            actual=case6Result,
             onpass="Pingall Test after Host intents addition successful",
             onfail="Pingall Test after Host intents addition failed" )
 
     def CASE5( self, main ):
         import json
-        from subprocess import Popen, PIPE
         # 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" )
+        from sts.topology.testonTopology import TestONTopology
+        # main.ONOS2.startOnosCli( ONOSIp=main.params[ 'CTRL' ][ 'ip1' ] )
+        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" )
@@ -836,22 +872,22 @@
             ctrls )  # can also add Intent API info for intent operations
         MNTopo = Topo
 
-        Topology_Check = main.TRUE
+        TopologyCheck = main.TRUE
         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
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        # portsJson = main.ONOS2.ports()
 
-        result1 = main.Mininet1.compare_switches(
+        result1 = main.Mininet1.compareSwitches(
             MNTopo,
-            json.loads( devices_json ) )
-        result2 = main.Mininet1.compare_links(
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
             MNTopo,
-            json.loads( links_json ) )
-        #result3 = main.Mininet1.compare_ports( MNTopo, json.loads( ports_json ) )
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
 
-        #result = result1 and result2 and result3
+        # result = result1 and result2 and result3
         result = result1 and result2
 
         print "***********************"
@@ -868,55 +904,64 @@
             onfail="ONOS" +
             " Topology does not match MN Topology" )
 
-        Topology_Check = Topology_Check and result
+        TopologyCheck = TopologyCheck and result
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=Topology_Check,
+            actual=TopologyCheck,
             onpass="Topology checks passed",
             onfail="Topology checks failed" )
 
     def CASE7( self, main ):
+        from sts.topology.testonTopology import TestONTopology
 
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        linkSleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
 
-        link_sleep = int( main.params[ 'timers' ][ 'LinkDiscovery' ] )
-
-        main.log.report(
-            "This testscase is killing a link to ensure that link discovery is consistent" )
+        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.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 )
+                               target=main.params[ 'PING' ][ 'target1' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source2' ],
-                            target=main.params[ 'PING' ][ 'target2' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target2' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source3' ],
-                            target=main.params[ 'PING' ][ 'target3' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target3' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source4' ],
-                            target=main.params[ 'PING' ][ 'target4' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target4' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source5' ],
-                            target=main.params[ 'PING' ][ 'target5' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target5' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source6' ],
-                            target=main.params[ 'PING' ][ 'target6' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target6' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source7' ],
-                            target=main.params[ 'PING' ][ 'target7' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target7' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source8' ],
-                            target=main.params[ 'PING' ][ 'target8' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target8' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source9' ],
-                            target=main.params[ 'PING' ][ 'target9' ],pingTime=500 )
+                               target=main.params[ 'PING' ][ 'target9' ],
+                               pingTime=500 )
         main.Mininet2.pingLong( src=main.params[ 'PING' ][ 'source10' ],
-                            target=main.params[ 'PING' ][ 'target10' ],pingTime=500 )
+                               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' ]
+        topologyOutput = main.ONOS2.topology()
+        topologyResult = main.ONOS1.getTopology( topologyOutput )
+        activeSwitches = topologyResult[ 'devices' ]
+        links = topologyResult[ 'links' ]
         print "activeSwitches = ", type( activeSwitches )
         print "links = ", type( links )
         main.log.info(
@@ -925,39 +970,39 @@
 
         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(
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkDown = main.ONOS1.checkStatus(
+            topologyOutput, activeSwitches, str(
                 int( links ) - 2 ) )
-        if Link_Down == main.TRUE:
+        if LinkDown == main.TRUE:
             main.log.report( "Link Down discovered properly" )
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=Link_Down,
+            actual=LinkDown,
             onpass="Link Down discovered properly",
             onfail="Link down was not discovered in " +
-            str( link_sleep ) +
+            str( linkSleep ) +
             " 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,
+        LinkUp = main.Mininet1.link( END1="s3", END2="s28", OPTION="up" )
+        time.sleep( linkSleep )
+        topologyOutput = main.ONOS2.topology()
+        LinkUp = main.ONOS1.checkStatus(
+            topologyOutput,
             activeSwitches,
             str( links ) )
-        if Link_Up == main.TRUE:
+        if LinkUp == main.TRUE:
             main.log.report( "Link up discovered properly" )
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=Link_Up,
+            actual=LinkUp,
             onpass="Link up discovered properly",
             onfail="Link up was not discovered in " +
-            str( link_sleep ) +
+            str( linkSleep ) +
             " seconds" )
 
         # NOTE Check ping result here..add code for it
@@ -967,22 +1012,22 @@
             main.Mininet1,
             ctrls )  # can also add Intent API info for intent operations
         MNTopo = Topo
-        Topology_Check = main.TRUE
+        TopologyCheck = main.TRUE
 
-        devices_json = main.ONOS2.devices()
-        links_json = main.ONOS2.links()
-        ports_json = main.ONOS2.ports()
-        print "devices_json= ", devices_json
+        devicesJson = main.ONOS2.devices()
+        linksJson = main.ONOS2.links()
+        portsJson = main.ONOS2.ports()
 
-        result1 = main.Mininet1.compare_switches(
+        result1 = main.Mininet1.compareSwitches(
             MNTopo,
-            json.loads( devices_json ) )
-        result2 = main.Mininet1.compare_links(
+            json.loads( devicesJson ) )
+        result2 = main.Mininet1.compareLinks(
             MNTopo,
-            json.loads( links_json ) )
-        #result3 = main.Mininet1.compare_ports( MNTopo, json.loads( ports_json ) )
+            json.loads( linksJson ) )
+        # result3 = main.Mininet1.comparePorts(
+        # MNTopo, json.loads( portsJson ) )
 
-        #result = result1 and result2 and result3
+        # result = result1 and result2 and result3
         result = result1 and result2
         print "***********************"
 
@@ -996,34 +1041,34 @@
             onfail="ONOS" +
             " Topology does not match MN Topology" )
 
-        Topology_Check = Topology_Check and result
+        TopologyCheck = TopologyCheck and result
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=Topology_Check,
+            actual=TopologyCheck,
             onpass="Topology checks passed",
             onfail="Topology checks failed" )
 
-        result = Link_Down and Link_Up and Topology_Check
+        result = LinkDown and LinkUp and TopologyCheck
         utilities.assert_equals( expect=main.TRUE, actual=result,
-                                 onpass="Link failure is discovered correctly",
-                                 onfail="Link Discovery failed" )
+                                onpass="Link failure is discovered correctly",
+                                onfail="Link Discovery failed" )
 
     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( "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 )
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
 
-        intent_linewise = intent_result.split( "\n" )
+        intentLinewise = intentResult.split( "\n" )
         intentList = []
-        for line in intent_linewise:
+        for line in intentLinewise:
             if line.startswith( "id=" ):
                 intentList.append( line )
 
@@ -1036,19 +1081,19 @@
         main.step(
             "Iterate through the intentids list and remove each intent" )
         for id in intentids:
-            main.ONOS2.remove_intent( intent_id=id )
+            main.ONOS2.removeIntent( intentId=id )
 
-        intent_result = main.ONOS2.intents( json_format=False )
-        main.log.info( "intent_result = " + intent_result )
+        intentResult = main.ONOS2.intents( jsonFormat=False )
+        main.log.info( "intent_result = " + intentResult )
 
-        case8_result = main.TRUE
-        if case8_result == main.TRUE:
+        case8Result = main.TRUE
+        if case8Result == main.TRUE:
             main.log.report( "Intent removal successful" )
         else:
             main.log.report( "Intent removal failed" )
 
-        Ping_Result = main.TRUE
-        if case8_result == main.TRUE:
+        PingResult = main.TRUE
+        if case8Result == main.TRUE:
             i = 8
             while i < 18:
                 main.log.info(
@@ -1057,33 +1102,33 @@
                     src="h" + str( i ), target="h" + str( i + 10 ) )
                 if ping == main.TRUE:
                     i = 19
-                    Ping_Result = Ping_Result and main.TRUE
+                    PingResult = PingResult and main.TRUE
                 elif ping == main.FALSE:
                     i += 1
-                    Ping_Result = Ping_Result and main.FALSE
+                    PingResult = PingResult and main.FALSE
                 else:
                     main.log.info( "Unknown error" )
-                    Ping_Result = main.ERROR
+                    PingResult = main.ERROR
 
             # Note: If the ping result failed, that means the intents have been
             # withdrawn correctly.
-        if Ping_Result == main.TRUE:
+        if PingResult == main.TRUE:
             main.log.report( "Host intents have not been withdrawn correctly" )
             # main.cleanup()
             # main.exit()
-        if Ping_Result == main.FALSE:
+        if PingResult == main.FALSE:
             main.log.report( "Host intents have been withdrawn correctly" )
 
-        case8_result = case8_result and Ping_Result
+        case8Result = case8Result and PingResult
 
-        if case8_result == main.FALSE:
+        if case8Result == main.FALSE:
             main.log.report( "Intent removal successful" )
         else:
             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=case8Result,
+                                onpass="Intent removal test failed",
+                                onfail="Intent removal test passed" )
 
     def CASE9( self ):
         main.log.report(
@@ -1091,189 +1136,201 @@
         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)" )
+            "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(
+            "Add point intents for mininet hosts h8 and h18 or \
+                  ONOS hosts h8 and h12" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003008/1",
             "of:0000000000006018/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006018/1",
             "of:0000000000003008/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h9 and h19 or \
+                  ONOS hosts h9 and h13" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003009/1",
             "of:0000000000006019/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006019/1",
             "of:0000000000003009/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h10 and h20 or \
+                  ONOS hosts hA and h14" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003010/1",
             "of:0000000000006020/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006020/1",
             "of:0000000000003010/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h11 and h21 or \
+                  ONOS hosts hB and h15" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003011/1",
             "of:0000000000006021/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006021/1",
             "of:0000000000003011/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h12 and h22 \
+                  ONOS hosts hC and h16" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003012/1",
             "of:0000000000006022/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006022/1",
             "of:0000000000003012/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h13 and h23 or \
+                  ONOS hosts hD and h17" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003013/1",
             "of:0000000000006023/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006023/1",
             "of:0000000000003013/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h14 and h24 or \
+                  ONOS hosts hE and h18" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003014/1",
             "of:0000000000006024/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006024/1",
             "of:0000000000003014/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h15 and h25 or \
+                  ONOS hosts hF and h19" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003015/1",
             "of:0000000000006025/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006025/1",
             "of:0000000000003015/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add intents for mininet hosts h16 and h26 or \
+                  ONOS hosts h10 and h1A" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003016/1",
             "of:0000000000006026/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006026/1",
             "of:0000000000003016/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            # main.log.info( getIntentResult )
 
         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(
+            "Add point intents for mininet hosts h17 and h27 or \
+                  ONOS hosts h11 and h1B" )
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000003017/1",
             "of:0000000000006027/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            main.log.info( getIntentResult )
 
-        ptp_intent_result = main.ONOS2.add_point_intent(
+        ptpIntentResult = main.ONOS2.addPointIntent(
             "of:0000000000006027/1",
             "of:0000000000003017/1" )
-        if ptp_intent_result == main.TRUE:
-            get_intent_result = main.ONOS2.intents()
+        if ptpIntentResult == main.TRUE:
+            getIntentResult = main.ONOS2.intents()
             main.log.info( "Point to point intent install successful" )
-            # main.log.info( get_intent_result )
+            main.log.info( getIntentResult )
 
         print(
-            "_______________________________________________________________________________________" )
+            "___________________________________________________________" )
 
         flowHandle = main.ONOS2.flows()
         # print "flowHandle = ", flowHandle
@@ -1281,7 +1338,7 @@
 
         count = 1
         i = 8
-        Ping_Result = main.TRUE
+        PingResult = main.TRUE
         while i < 18:
             main.log.info(
                 "\n\nh" + str( i ) + " is Pinging h" + str( i + 10 ) )
@@ -1289,8 +1346,8 @@
                 src="h" + str( i ), target="h" + str( i + 10 ) )
             if ping == main.FALSE and count < 5:
                 count += 1
-                #i = 8
-                Ping_Result = main.FALSE
+                # i = 8
+                PingResult = main.FALSE
                 main.log.report( "Ping between h" +
                                  str( i ) +
                                  " and h" +
@@ -1308,7 +1365,7 @@
                                       10 ) +
                                  "have failed" )
                 i = 19
-                Ping_Result = main.FALSE
+                PingResult = main.FALSE
             elif ping == main.TRUE:
                 main.log.info( "Ping test between h" +
                                str( i ) +
@@ -1317,22 +1374,22 @@
                                     10 ) +
                                "passed!" )
                 i += 1
-                Ping_Result = main.TRUE
+                PingResult = main.TRUE
             else:
                 main.log.info( "Unknown error" )
-                Ping_Result = main.ERROR
+                PingResult = main.ERROR
 
-        if Ping_Result == main.FALSE:
+        if PingResult == main.FALSE:
             main.log.report(
                 "Point intents have not ben installed correctly. Cleaning up" )
             # main.cleanup()
             # main.exit()
-        if Ping_Result == main.TRUE:
+        if PingResult == main.TRUE:
             main.log.report( "Point Intents have been installed correctly" )
 
-        case9_result = Ping_Result
+        case9Result = PingResult
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=case9_result,
+            actual=case9Result,
             onpass="Point intents addition and Pingall Test successful",
             onfail="Point intents addition and Pingall Test NOT successful" )
