diff --git a/TestON/bin/unpep8 b/TestON/bin/unpep8
index ff911e8..733d5a3 100755
--- a/TestON/bin/unpep8
+++ b/TestON/bin/unpep8
@@ -179,6 +179,7 @@
 def convertFromPep8( program ):
    oldProgram = program
    # Program text transforms
+   program = reinstateCapWords( program )  # Turning off for now
    program = reinstateCapWords( program )
    program = fixKeywords( program )
    program = insertExtraSpaces( program )
diff --git a/TestON/drivers/common/cli/.onosclidriver.py.swo b/TestON/drivers/common/cli/.onosclidriver.py.swo
new file mode 100644
index 0000000..87ea889
--- /dev/null
+++ b/TestON/drivers/common/cli/.onosclidriver.py.swo
Binary files differ
diff --git a/TestON/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index 944eded..d275df0 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -53,12 +53,12 @@
         self.name = self.options[ 'name' ]
         self.handle = \
             super( LincOEDriver, self ).connect(
-                user_name=self.user_name,
-                ip_address=self.ip_address,
+                userName=self.userName,
+                ipAddress=self.ipAddress,
                 port=None,
                 pwd=self.pwd )
 
-        self.ssh_handle = self.handle
+        self.sshHandle = self.handle
 
         if self.handle:
             main.log.info( "Handle successfully created" )
@@ -67,40 +67,18 @@
             self.handle.sendline( "cd " + self.home )
             self.handle.expect( "oe$" )
 
-            #self.handle.sendline( "pgrep -g linc" )
-            # self.handle.expect( "\$" )
             print "handle = ", self.handle.before
 
             return main.TRUE
-            """
-            main.log.info( "Building Linc-OE" )
-            self.handle.sendline( "make rel" )
-            i = self.handle.expect( [ "ERROR","linc-oe\$" ],timeout=60 )
-            if i == 0:
-                self.handle.sendline( "sudo pkill -9 epmd" )
-                self.handle.expect( "\$" )
-                self.handle.sendline( "make rel" )
-                x = self.handle.expect( [ "\$",pexpect.EOF,pexpect.TIMEOUT ] )
-                main.log.info( "make rel returned: "+ str( x ) )
-            else:
-
-            main.log.info( self.name+": Starting Linc-OE CLI.. This may take a while" )
-            time.sleep( 30 )
-            self.handle.sendline( "sudo ./rel/linc/bin/linc console" )
-            j = self.handle.expect( [ "linc@",pexpect.EOF,pexpect.TIMEOUT ] )
-            if j == 0:
-                main.log.info( "Linc-OE CLI started" )
-                return main.TRUE
-            """
         else:
             main.log.error( self.name +
                             ": Connection failed to the host " +
-                            self.user_name + "@" + self.ip_address )
+                            self.userName + "@" + self.ipAddress )
             main.log.error( self.name +
                             ": Failed to connect to Linc-OE" )
             return main.FALSE
 
-    def start_console( self ):
+    def startConsole( self ):
         import time
         main.log.info(
             self.name +
@@ -108,7 +86,7 @@
         time.sleep( 30 )
         self.handle.sendline( "sudo ./rel/linc/bin/linc console" )
         j = self.handle.expect( [ "linc@", pexpect.EOF, pexpect.TIMEOUT ] )
-        start_result = self.handle.before
+        startResult = self.handle.before
         if j == 0:
             main.log.info( "Linc-OE CLI started" )
             return main.TRUE
@@ -116,9 +94,9 @@
             main.log.error(
                 self.name +
                 ": Connection failed to the host " +
-                self.user_name +
+                self.userName +
                 "@" +
-                self.ip_address )
+                self.ipAddress )
             main.log.error( self.name +
                             ": Failed to connect to Linc-OE" )
             return main.FALSE
@@ -134,8 +112,6 @@
                 "\$" ] )
 
             if i == 0:
-                # If error, try to resolve the most common error
-                #( epmd running and cannot compile )
                 self.handle.sendline( "sudo pkill -9 epmd" )
                 self.handle.sendline( "make rel" )
                 self.handle.expect( "\$" )
@@ -153,12 +129,12 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def set_interface_up( self, intfs ):
+    def setInterfaceUp( self, intfs ):
         """
         Specify interface to bring up.
         When Linc-OE is started, tap interfaces should
@@ -179,17 +155,17 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def start_switch( self, sw_id ):
+    def startSwitch( self, swId ):
         """
         Start a logical switch using switch id
         """
         try:
-            self.handle.sendline( "linc:start_switch(" + str( sw_id ) + ")." )
+            self.handle.sendline( "linc:start_switch(" + str( swId ) + ")." )
             self.handle.expect( "linc@" )
 
             handle = self.handle.before
@@ -201,17 +177,17 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def stop_switch( self, sw_id ):
+    def stopSwitch( self, swId ):
         """
         Stop a logical switch using switch id
         """
         try:
-            self.handle.sendline( "linc:stop_switch(" + str( sw_id ) + ")." )
+            self.handle.sendline( "linc:stop_switch(" + str( swId ) + ")." )
             self.handle.expect( "linc@" )
 
             handle = self.handle.before
@@ -223,18 +199,18 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def get_datapath_id( self, sw_id ):
+    def getDatapathId( self, swId ):
         """
         Get datapath id of a specific switch by switch id
         """
         try:
             self.handle.sendline( "linc_logic:get_datapath_id(" +
-                                  str( sw_id ) + ")." )
+                                  str( swId ) + ")." )
             self.handle.expect( "linc@" )
 
             handle = self.handle.before
@@ -246,17 +222,17 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def list_ports( self, sw_id ):
+    def listPorts( self, swId ):
         """
         List all ports of a switch by switch id
         """
         try:
-            self.handle.sendline( "linc:ports(" + str( sw_id ) + ")." )
+            self.handle.sendline( "linc:ports(" + str( swId ) + ")." )
             self.handle.expect( "linc@" )
 
             handle = self.handle.before
@@ -268,18 +244,18 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def port_up( self, sw_id, pt_id ):
+    def portUp( self, swId, ptId ):
         """
         Bring port up using switch id and port id
         """
         try:
             self.handle.sendline( "linc:port_up(" +
-                                  str( sw_id ) + ", " + str( pt_id ) + ")." )
+                                  str( swId ) + ", " + str( ptId ) + ")." )
             self.handle.expect( "linc@" )
 
             handle = self.handle.before
@@ -291,18 +267,18 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def port_down( self, sw_id, pt_id ):
+    def portDown( self, swId, ptId ):
         """
         Bring port down using switch id and port id
         """
         try:
             self.handle.sendline( "linc:port_down(" +
-                                  str( sw_id ) + ", " + str( pt_id ) + ")." )
+                                  str( swId ) + ", " + str( ptId ) + ")." )
             self.handle.expect( "linc@" )
 
             handle = self.handle.before
@@ -314,7 +290,7 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
@@ -361,7 +337,7 @@
             main.exit()
         except:
             main.log.info( self.name + " :::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index d82a58e..4b30f4d 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -66,12 +66,12 @@
         self.handle = super(
             MininetCliDriver,
             self ).connect(
-            user_name=self.user_name,
-            ip_address=self.ip_address,
+            userName=self.userName,
+            ipAddress=self.ipAddress,
             port=None,
             pwd=self.pwd )
 
-        self.ssh_handle = self.handle
+        self.sshHandle = self.handle
 
         if self.handle:
             main.log.info(
@@ -148,13 +148,13 @@
             main.log.error(
                 self.name +
                 ": Connection failed to the host " +
-                self.user_name +
+                self.userName +
                 "@" +
-                self.ip_address )
+                self.ipAddress )
             main.log.error( self.name + ": Failed to connect to the Mininet" )
             return main.FALSE
 
-    def num_switches_n_links( self, topoType, depth, fanout ):
+    def numSwitchesNlinks( self, topoType, depth, fanout ):
         if topoType == 'tree':
             # In tree topology, if fanout arg is not given, by default it is 2
             if fanout is None:
@@ -164,36 +164,36 @@
             while( k <= depth - 1 ):
                 count = count + pow( fanout, k )
                 k = k + 1
-                num_switches = count
+                numSwitches = count
             while( k <= depth - 2 ):
                 # depth-2 gives you only core links and not considering
                 # edge links as seen by ONOS. If all the links including
                 # edge links are required, do depth-1
                 count = count + pow( fanout, k )
                 k = k + 1
-            num_links = count * fanout
+            numLinks = count * fanout
             # print "num_switches for %s(%d,%d) = %d and links=%d" %(
-            # topoType,depth,fanout,num_switches,num_links )
+            # topoType,depth,fanout,numSwitches,numLinks )
 
         elif topoType == 'linear':
-            # In linear topology, if fanout or num_hosts_per_sw is not given,
+            # In linear topology, if fanout or numHostsPerSw is not given,
             # by default it is 1
             if fanout is None:
                 fanout = 1
-            num_switches = depth
-            num_hosts_per_sw = fanout
-            total_num_hosts = num_switches * num_hosts_per_sw
-            num_links = total_num_hosts + ( num_switches - 1 )
+            numSwitches = depth
+            numHostsPerSw = fanout
+            totalNumHosts = numSwitches * numHostsPerSw
+            numLinks = totalNumHosts + ( numSwitches - 1 )
             print "num_switches for %s(%d,%d) = %d and links=%d" %\
-                ( topoType, depth, fanout, num_switches, num_links )
+                ( topoType, depth, fanout, numSwitches, numLinks )
         topoDict = {}
         topoDict = {
-            "num_switches": int( num_switches ),
-            "num_corelinks": int( num_links ) }
+            "num_switches": int( numSwitches ),
+            "num_corelinks": int( numLinks ) }
         return topoDict
 
-    def calculate_sw_and_links( self ):
-        topoDict = self.num_switches_n_links( *topoArgList )
+    def calculateSwAndLinks( self ):
+        topoDict = self.numSwitchesN_links( *topoArgList )
         return topoDict
 
     def pingall( self, timeout=300 ):
@@ -227,13 +227,13 @@
             # NOTE: mininet's pingall rounds, so we will check the number of
             # passed and number of failed
             pattern = "Results\:\s0\%\sdropped\s\(" +\
-                "(?P<passed>[\d]+)/(?P=passed)"
+                      "(?P<passed>[\d]+)/(?P=passed)"
             if re.search( pattern, response ):
                 main.log.info( self.name + ": All hosts are reachable" )
                 return main.TRUE
             else:
                 main.log.error( self.name + ": Unable to reach all the hosts" )
-                main.log.info( "Pingall ouput: " + str( response ) )
+                main.log.info( "Pingall output: " + str( response ) )
                 # NOTE: Send ctrl-c to make sure pingall is done
                 self.handle.send( "\x03" )
                 self.handle.expect( "Interrupt" )
@@ -297,13 +297,13 @@
         main.log.info( self.name + ": Ping Response: " + response )
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": no packets lost, host is reachable" )
-            main.last_result = main.TRUE
+            main.lastResult = main.TRUE
             return main.TRUE
         else:
             main.log.error(
                 self.name +
                 ": PACKET LOST, HOST IS NOT REACHABLE" )
-            main.last_result = main.FALSE
+            main.lastResult = main.FALSE
             return main.FALSE
 
     def checkIP( self, host ):
@@ -468,15 +468,15 @@
                 main.exit()
 
             pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
-            mac_address_search = re.search( pattern, response, re.I )
-            mac_address = mac_address_search.group().split( " " )[ 1 ]
+            macAddressSearch = re.search( pattern, response, re.I )
+            macAddress = macAddressSearch.group().split( " " )[ 1 ]
             main.log.info(
                 self.name +
                 ": Mac-Address of Host " +
                 host +
                 " is " +
-                mac_address )
-            return mac_address
+                macAddress )
+            return macAddress
         else:
             main.log.error( self.name + ": Connection failed to the host" )
 
@@ -494,19 +494,19 @@
                 main.exit()
 
             pattern = r'HWaddr\s([0-9A-F]{2}[:-]){5}([0-9A-F]{2})'
-            mac_address_search = re.search( pattern, response, re.I )
-            if mac_address_search is None:
+            macAddressSearch = re.search( pattern, response, re.I )
+            if macAddressSearch is None:
                 main.log.info( "No mac address found in %s" % response )
                 return main.FALSE
-            mac_address = mac_address_search.group().split( " " )[ 1 ]
+            macAddress = macAddressSearch.group().split( " " )[ 1 ]
             main.log.info(
                 "Mac-Address of " +
                 host +
                 ":" +
                 interface +
                 " is " +
-                mac_address )
-            return mac_address
+                macAddress )
+            return macAddress
         else:
             main.log.error( "Connection failed to the host" )
 
@@ -527,14 +527,14 @@
                 main.exit()
 
             pattern = "inet\saddr:(\d+\.\d+\.\d+\.\d+)"
-            ip_address_search = re.search( pattern, response )
+            ipAddressSearch = re.search( pattern, response )
             main.log.info(
                 self.name +
                 ": IP-Address of Host " +
                 host +
                 " is " +
-                ip_address_search.group( 1 ) )
-            return ip_address_search.group( 1 )
+                ipAddressSearch.group( 1 ) )
+            return ipAddressSearch.group( 1 )
         else:
             main.log.error( self.name + ": Connection failed to the host" )
 
@@ -710,11 +710,11 @@
 
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": Ping between two hosts SUCCESSFUL" )
-            main.last_result = main.TRUE
+            main.lastResult = main.TRUE
             return main.TRUE
         else:
             main.log.error( self.name + ": PACKET LOST, HOSTS NOT REACHABLE" )
-            main.last_result = main.FALSE
+            main.lastResult = main.FALSE
             return main.FALSE
 
     def link( self, **linkargs ):
@@ -804,17 +804,17 @@
             main.exit()
         return main.TRUE
 
-    def get_version( self ):
-        file_input = path + '/lib/Mininet/INSTALL'
-        version = super( Mininet, self ).get_version()
+    def getVersion( self ):
+        fileInput = path + '/lib/Mininet/INSTALL'
+        version = super( Mininet, self ).getVersion()
         pattern = 'Mininet\s\w\.\w\.\w\w*'
-        for line in open( file_input, 'r' ).readlines():
+        for line in open( fileInput, 'r' ).readlines():
             result = re.match( pattern, line )
             if result:
                 version = result.group( 0 )
         return version
 
-    def get_sw_controller( self, sw ):
+    def getSwController( self, sw ):
         """
         Parameters:
             sw: The name of an OVS switch. Example "s1"
@@ -837,7 +837,7 @@
             main.cleanup()
             main.exit()
 
-    def assign_sw_controller( self, **kwargs ):
+    def assignSwController( self, **kwargs ):
         """
            count is only needed if there is more than 1 controller"""
         args = utilities.parse_args( [ "COUNT" ], **kwargs )
@@ -882,12 +882,12 @@
             main.exit()
         except:
             main.log.info( self.name + ":" * 50 )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( ":" * 50 )
             main.cleanup()
             main.exit()
 
-    def delete_sw_controller( self, sw ):
+    def deleteSwController( self, sw ):
         """
            Removes the controller target from sw"""
         command = "sh ovs-vsctl del-controller " + str( sw )
@@ -904,7 +904,7 @@
         else:
             main.log.info( response )
 
-    def add_switch( self, sw, **kwargs ):
+    def addSwitch( self, sw, **kwargs ):
         """
         adds a switch to the mininet topology
         NOTE: This uses a custom mn function. MN repo should be on
@@ -940,7 +940,7 @@
             main.cleanup()
             main.exit()
 
-    def del_switch( self, sw ):
+    def delSwitch( self, sw ):
         """
         delete a switch from the mininet topology
         NOTE: This uses a custom mn function. MN repo should be on
@@ -971,7 +971,7 @@
             main.cleanup()
             main.exit()
 
-    def add_link( self, node1, node2 ):
+    def addLink( self, node1, node2 ):
         """
            add a link to the mininet topology
            NOTE: This uses a custom mn function. MN repo should be on
@@ -1004,7 +1004,7 @@
             main.cleanup()
             main.exit()
 
-    def del_link( self, node1, node2 ):
+    def delLink( self, node1, node2 ):
         """
            delete a link from the mininet topology
            NOTE: This uses a custom mn function. MN repo should be on
@@ -1036,7 +1036,7 @@
             main.cleanup()
             main.exit()
 
-    def add_host( self, hostname, **kwargs ):
+    def addHost( self, hostname, **kwargs ):
         """
         Add a host to the mininet topology
         NOTE: This uses a custom mn function. MN repo should be on
@@ -1075,7 +1075,7 @@
             main.cleanup()
             main.exit()
 
-    def del_host( self, hostname ):
+    def delHost( self, hostname ):
         """
            delete a host from the mininet topology
            NOTE: This uses a custom mn function. MN repo should be on
@@ -1176,10 +1176,10 @@
         else:
             main.log.error( "Connection failed to the Mininet host" )
 
-    def check_flows( self, sw, dump_format=None ):
-        if dump_format:
+    def checkFlows( self, sw, dumpFormat=None ):
+        if dumpFormat:
             command = "sh ovs-ofctl -F " + \
-                dump_format + " dump-flows " + str( sw )
+                dumpFormat + " dump-flows " + str( sw )
         else:
             command = "sh ovs-ofctl dump-flows " + str( sw )
         try:
@@ -1196,7 +1196,7 @@
         else:
             main.log.info( response )
 
-    def start_tcpdump( self, filename, intf="eth0", port="port 6633" ):
+    def startTcpdump( self, filename, intf="eth0", port="port 6633" ):
         """
            Runs tpdump on an intferface and saves the file
            intf can be specified, or the default eth0 is used"""
@@ -1250,12 +1250,12 @@
             main.exit()
         except:
             main.log.info( self.name + ":" * 50 )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( ":" * 50 )
             main.cleanup()
             main.exit()
 
-    def stop_tcpdump( self ):
+    def stopTcpdump( self ):
         "pkills tcpdump"
         try:
             self.handle.sendline( "sh sudo pkill tcpdump" )
@@ -1269,28 +1269,28 @@
             main.exit()
         except:
             main.log.info( self.name + ":" * 50 )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( ":" * 50 )
             main.cleanup()
             main.exit()
 
-    def compare_switches( self, topo, switches_json ):
+    def compareSwitches( self, topo, switchesJson ):
         """
            Compare mn and onos switches
            topo: sts TestONTopology object
-            switches_json: parsed json object from the onos devices api
+            switchesJson: parsed json object from the onos devices api
 
            This uses the sts TestONTopology object"""
-        # main.log.debug( "Switches_json string: ", switches_json )
+        # main.log.debug( "Switches_json string: ", switchesJson )
         output = { "switches": [] }
         # iterate through the MN topology and pull out switches and and port
         # info
         for switch in topo.graph.switches:
             ports = []
             for port in switch.ports.values():
-                ports.append( { 'of_port': port.port_no,
-                                'mac': str( port.hw_addr ).replace( '\'',
-                                                                    '' ),
+                ports.append( { 'of_port': port.portNo,
+                                'mac': str( port.hwAddr ).replace( '\'',
+                                                                   '' ),
                                 'name': port.name } )
             output[ 'switches' ].append( {
                 "name": switch.name,
@@ -1299,12 +1299,12 @@
 
         # print "mn"
         # print json.dumps( output,
-        #                   sort_keys=True,
+        #                   sortKeys=True,
         #                   indent=4,
         #                   separators=( ',', ': ' ) )
         # print "onos"
-        # print json.dumps( switches_json,
-        #                   sort_keys=True,
+        # print json.dumps( switchesJson,
+        #                   sortKeys=True,
         #                   indent=4,
         #                   separators=( ',', ': ' ) )
 
@@ -1315,12 +1315,12 @@
         mnDPIDs.sort()
         # print "List of Mininet switch DPID's"
         # print mnDPIDs
-        if switches_json == "":  # if rest call fails
+        if switchesJson == "":  # if rest call fails
             main.log.error(
                 self.name +
                 ".compare_switches(): Empty JSON object given from ONOS" )
             return main.FALSE
-        onos = switches_json
+        onos = switchesJson
         onosDPIDs = []
         for switch in onos:
             if switch[ 'available' ]:
@@ -1338,7 +1338,7 @@
         # print onosDPIDs
 
         if mnDPIDs != onosDPIDs:
-            switch_results = main.FALSE
+            switchResults = main.FALSE
             main.log.report( "Switches in MN but not in ONOS:" )
             list1 = [ switch for switch in mnDPIDs if switch not in onosDPIDs ]
             main.log.report( str( list1 ) )
@@ -1346,14 +1346,14 @@
             list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
             main.log.report( str( list2 ) )
         else:  # list of dpid's match in onos and mn
-            switch_results = main.TRUE
-        return switch_results
+            switchResults = main.TRUE
+        return switchResults
 
-    def compare_ports( self, topo, ports_json ):
+    def comparePorts( self, topo, portsJson ):
         """
         Compare mn and onos ports
         topo: sts TestONTopology object
-        ports_json: parsed json object from the onos ports api
+        portsJson: parsed json object from the onos ports api
 
         Dependencies:
             1. This uses the sts TestONTopology object
@@ -1363,109 +1363,109 @@
         # FIXME: this does not look for extra ports in ONOS, only checks that
         # ONOS has what is in MN
         from numpy import uint64
-        ports_results = main.TRUE
+        portsResults = main.TRUE
         output = { "switches": [] }
         # iterate through the MN topology and pull out switches and and port
         # info
         for switch in topo.graph.switches:
             ports = []
             for port in switch.ports.values():
-                # print port.hw_addr.toStr( separator='' )
-                tmp_port = {}
-                tmp_port[ 'of_port' ] = port.port_no
-                tmp_port[ 'mac' ] = str( port.hw_addr ).replace( '\'', '' )
-                tmp_port[ 'name' ] = port.name
-                tmp_port[ 'enabled' ] = port.enabled
+                # print port.hwAddr.toStr( separator='' )
+                tmpPort = {}
+                tmpPort[ 'of_port' ] = port.portNo
+                tmpPort[ 'mac' ] = str( port.hwAddr ).replace( '\'', '' )
+                tmpPort[ 'name' ] = port.name
+                tmpPort[ 'enabled' ] = port.enabled
 
-                ports.append( tmp_port )
-            tmp_switch = {}
-            tmp_switch[ 'name' ] = switch.name
-            tmp_switch[ 'dpid' ] = str( switch.dpid ).zfill( 16 )
-            tmp_switch[ 'ports' ] = ports
+                ports.append( tmpPort )
+            tmpSwitch = {}
+            tmpSwitch[ 'name' ] = switch.name
+            tmpSwitch[ 'dpid' ] = str( switch.dpid ).zfill( 16 )
+            tmpSwitch[ 'ports' ] = ports
 
-            output[ 'switches' ].append( tmp_switch )
+            output[ 'switches' ].append( tmpSwitch )
 
         # PORTS
-        for mn_switch in output[ 'switches' ]:
-            mn_ports = []
-            onos_ports = []
-            switch_result = main.TRUE
-            for port in mn_switch[ 'ports' ]:
+        for mnSwitch in output[ 'switches' ]:
+            mnPorts = []
+            onosPorts = []
+            switchResult = main.TRUE
+            for port in mnSwitch[ 'ports' ]:
                 if port[ 'enabled' ]:
-                    mn_ports.append( port[ 'of_port' ] )
-            for onos_switch in ports_json:
+                    mnPorts.append( port[ 'of_port' ] )
+            for onosSwitch in portsJson:
                 # print "Iterating through a new switch as seen by ONOS"
-                # print onos_switch
-                if onos_switch[ 'device' ][ 'available' ]:
-                    if onos_switch[ 'device' ][ 'id' ].replace(
+                # print onosSwitch
+                if onosSwitch[ 'device' ][ 'available' ]:
+                    if onosSwitch[ 'device' ][ 'id' ].replace(
                             ':',
                             '' ).replace(
                             "of",
-                            '' ) == mn_switch[ 'dpid' ]:
-                        for port in onos_switch[ 'ports' ]:
+                            '' ) == mnSwitch[ 'dpid' ]:
+                        for port in onosSwitch[ 'ports' ]:
                             if port[ 'isEnabled' ]:
                                 if port[ 'port' ] == 'local':
-                                    # onos_ports.append( 'local' )
-                                    onos_ports.append( long( uint64( -2 ) ) )
+                                    # onosPorts.append( 'local' )
+                                    onosPorts.append( long( uint64( -2 ) ) )
                                 else:
-                                    onos_ports.append( int( port[ 'port' ] ) )
+                                    onosPorts.append( int( port[ 'port' ] ) )
                         break
-            mn_ports.sort( key=float )
-            onos_ports.sort( key=float )
-            # print "\nPorts for Switch %s:" % ( mn_switch[ 'name' ] )
-            # print "\tmn_ports[] = ", mn_ports
-            # print "\tonos_ports[] = ", onos_ports
-            mn_ports_log = mn_ports
-            onos_ports_log = onos_ports
-            mn_ports = [ x for x in mn_ports ]
-            onos_ports = [ x for x in onos_ports ]
+            mnPorts.sort( key=float )
+            onosPorts.sort( key=float )
+            # print "\nPorts for Switch %s:" % ( mnSwitch[ 'name' ] )
+            # print "\tmn_ports[] = ", mnPorts
+            # print "\tonos_ports[] = ", onosPorts
+            mnPortsLog = mnPorts
+            onosPortsLog = onosPorts
+            mnPorts = [ x for x in mnPorts ]
+            onosPorts = [ x for x in onosPorts ]
 
             # TODO: handle other reserved port numbers besides LOCAL
             # NOTE: Reserved ports
             # Local port: -2 in Openflow, ONOS shows 'local', we store as
             # long( uint64( -2 ) )
-            for mn_port in mn_ports_log:
-                if mn_port in onos_ports:
+            for mnPort in mnPortsLog:
+                if mnPort in onosPorts:
                     # don't set results to true here as this is just one of
                     # many checks and it might override a failure
-                    mn_ports.remove( mn_port )
-                    onos_ports.remove( mn_port )
+                    mnPorts.remove( mnPort )
+                    onosPorts.remove( mnPort )
                 # NOTE: OVS reports this as down since there is no link
                 #      So ignoring these for now
                 # TODO: Come up with a better way of handling these
-                if 65534 in mn_ports:
-                    mn_ports.remove( 65534 )
-                if long( uint64( -2 ) ) in onos_ports:
-                    onos_ports.remove( long( uint64( -2 ) ) )
-            if len( mn_ports ):  # the ports of this switch don't match
-                switch_result = main.FALSE
-                main.log.warn( "Ports in MN but not ONOS: " + str( mn_ports ) )
-            if len( onos_ports ):  # the ports of this switch don't match
-                switch_result = main.FALSE
+                if 65534 in mnPorts:
+                    mnPorts.remove( 65534 )
+                if long( uint64( -2 ) ) in onosPorts:
+                    onosPorts.remove( long( uint64( -2 ) ) )
+            if len( mnPorts ):  # the ports of this switch don't match
+                switchResult = main.FALSE
+                main.log.warn( "Ports in MN but not ONOS: " + str( mnPorts ) )
+            if len( onosPorts ):  # the ports of this switch don't match
+                switchResult = main.FALSE
                 main.log.warn(
                     "Ports in ONOS but not MN: " +
-                    str( onos_ports ) )
-            if switch_result == main.FALSE:
+                    str( onosPorts ) )
+            if switchResult == main.FALSE:
                 main.log.report(
                     "The list of ports for switch %s(%s) does not match:" %
-                    ( mn_switch[ 'name' ], mn_switch[ 'dpid' ] ) )
-                main.log.warn( "mn_ports[]  =  " + str( mn_ports_log ) )
-                main.log.warn( "onos_ports[] = " + str( onos_ports_log ) )
-            ports_results = ports_results and switch_result
-        return ports_results
+                    ( mnSwitch[ 'name' ], mnSwitch[ 'dpid' ] ) )
+                main.log.warn( "mn_ports[]  =  " + str( mnPortsLog ) )
+                main.log.warn( "onos_ports[] = " + str( onosPortsLog ) )
+            portsResults = portsResults and switchResult
+        return portsResults
 
-    def compare_links( self, topo, links_json ):
+    def compareLinks( self, topo, linksJson ):
         """
            Compare mn and onos links
            topo: sts TestONTopology object
-           links_json: parsed json object from the onos links api
+           linksJson: parsed json object from the onos links api
 
            This uses the sts TestONTopology object"""
         # FIXME: this does not look for extra links in ONOS, only checks that
         # ONOS has what is in MN
-        link_results = main.TRUE
+        linkResults = main.TRUE
         output = { "switches": [] }
-        onos = links_json
+        onos = linksJson
         # iterate through the MN topology and pull out switches and and port
         # info
         for switch in topo.graph.switches:
@@ -1473,10 +1473,10 @@
             # print switch
             ports = []
             for port in switch.ports.values():
-                # print port.hw_addr.toStr( separator='' )
-                ports.append( { 'of_port': port.port_no,
-                                'mac': str( port.hw_addr ).replace( '\'',
-                                                                    '' ),
+                # print port.hwAddr.toStr( separator='' )
+                ports.append( { 'of_port': port.portNo,
+                                'mac': str( port.hwAddr ).replace( '\'',
+                                                                   '' ),
                                 'name': port.name } )
             output[ 'switches' ].append( {
                 "name": switch.name,
@@ -1484,33 +1484,33 @@
                 "ports": ports } )
         # LINKS
 
-        mn_links = [
-            link for link in topo.patch_panel.network_links if (
+        mnLinks = [
+            link for link in topo.patchPanel.networkLinks if (
                 link.port1.enabled and link.port2.enabled ) ]
-        if 2 * len( mn_links ) == len( onos ):
-            link_results = main.TRUE
+        if 2 * len( mnLinks ) == len( onos ):
+            linkResults = main.TRUE
         else:
-            link_results = main.FALSE
+            linkResults = main.FALSE
             main.log.report(
                 "Mininet has %i bidirectional links and " +
                 "ONOS has %i unidirectional links" %
-                ( len( mn_links ), len( onos ) ) )
+                ( len( mnLinks ), len( onos ) ) )
 
         # iterate through MN links and check if an ONOS link exists in
         # both directions
         # NOTE: Will currently only show mn links as down if they are
         #       cut through STS. We can either do everything through STS or
-        #       wait for up_network_links and down_network_links to be
+        #       wait for upNetworkLinks and downNetworkLinks to be
         #       fully implemented.
-        for link in mn_links:
+        for link in mnLinks:
             # print "Link: %s" % link
             # TODO: Find a more efficient search method
             node1 = None
             port1 = None
             node2 = None
             port2 = None
-            first_dir = main.FALSE
-            second_dir = main.FALSE
+            firstDir = main.FALSE
+            secondDir = main.FALSE
             for switch in output[ 'switches' ]:
                 # print "Switch: %s" % switch[ 'name' ]
                 if switch[ 'name' ] == link.node1.name:
@@ -1528,26 +1528,26 @@
                     if node1 is not None and node2 is not None:
                         break
 
-            for onos_link in onos:
-                onos_node1 = onos_link[ 'src' ][ 'device' ].replace(
+            for onosLink in onos:
+                onosNode1 = onosLink[ 'src' ][ 'device' ].replace(
                     ":",
                     '' ).replace(
                     "of",
                     '' )
-                onos_node2 = onos_link[ 'dst' ][ 'device' ].replace(
+                onosNode2 = onosLink[ 'dst' ][ 'device' ].replace(
                     ":",
                     '' ).replace(
                     "of",
                     '' )
-                onos_port1 = onos_link[ 'src' ][ 'port' ]
-                onos_port2 = onos_link[ 'dst' ][ 'port' ]
+                onosPort1 = onosLink[ 'src' ][ 'port' ]
+                onosPort2 = onosLink[ 'dst' ][ 'port' ]
 
                 # check onos link from node1 to node2
-                if str( onos_node1 ) == str( node1 ) and str(
-                        onos_node2 ) == str( node2 ):
-                    if int( onos_port1 ) == int( port1 ) and int(
-                            onos_port2 ) == int( port2 ):
-                        first_dir = main.TRUE
+                if str( onosNode1 ) == str( node1 ) and str(
+                        onosNode2 ) == str( node2 ):
+                    if int( onosPort1 ) == int( port1 ) and int(
+                            onosPort2 ) == int( port2 ):
+                        firstDir = main.TRUE
                     else:
                         main.log.warn(
                             'The port numbers do not match for ' +
@@ -1559,17 +1559,17 @@
                               node2,
                               port2 ) +
                             ' ONOS has the values %s/%s -> %s/%s' %
-                            ( onos_node1,
-                              onos_port1,
-                              onos_node2,
-                              onos_port2 ) )
+                            ( onosNode1,
+                              onosPort1,
+                              onosNode2,
+                              onosPort2 ) )
 
                 # check onos link from node2 to node1
-                elif ( str( onos_node1 ) == str( node2 ) and
-                        str( onos_node2 ) == str( node1 ) ):
-                    if ( int( onos_port1 ) == int( port2 )
-                            and int( onos_port2 ) == int( port1 ) ):
-                        second_dir = main.TRUE
+                elif ( str( onosNode1 ) == str( node2 ) and
+                        str( onosNode2 ) == str( node1 ) ):
+                    if ( int( onosPort1 ) == int( port2 )
+                            and int( onosPort2 ) == int( port1 ) ):
+                        secondDir = main.TRUE
                     else:
                         main.log.warn(
                             'The port numbers do not match for ' +
@@ -1581,24 +1581,24 @@
                               node1,
                               port1 ) +
                             ' ONOS has the values %s/%s -> %s/%s' %
-                            ( onos_node2,
-                              onos_port2,
-                              onos_node1,
-                              onos_port1 ) )
+                            ( onosNode2,
+                              onosPort2,
+                              onosNode1,
+                              onosPort1 ) )
                 else:  # this is not the link you're looking for
                     pass
-            if not first_dir:
+            if not firstDir:
                 main.log.report(
                     'ONOS does not have the link %s/%s -> %s/%s' %
                     ( node1, port1, node2, port2 ) )
-            if not second_dir:
+            if not secondDir:
                 main.log.report(
                     'ONOS does not have the link %s/%s -> %s/%s' %
                     ( node2, port2, node1, port1 ) )
-            link_results = link_results and first_dir and second_dir
-        return link_results
+            linkResults = linkResults and firstDir and secondDir
+        return linkResults
 
-    def get_hosts( self ):
+    def getHosts( self ):
         """
            Returns a list of all hosts
            Don't ask questions just use it"""
@@ -1608,19 +1608,19 @@
         self.handle.sendline( "py [ host.name for host in net.hosts ]" )
         self.handle.expect( "mininet>" )
 
-        handle_py = self.handle.before
-        handle_py = handle_py.split( "]\r\n", 1 )[ 1 ]
-        handle_py = handle_py.rstrip()
+        handlePy = self.handle.before
+        handlePy = handlePy.split( "]\r\n", 1 )[ 1 ]
+        handlePy = handlePy.rstrip()
 
         self.handle.sendline( "" )
         self.handle.expect( "mininet>" )
 
-        host_str = handle_py.replace( "]", "" )
-        host_str = host_str.replace( "'", "" )
-        host_str = host_str.replace( "[", "" )
-        host_list = host_str.split( "," )
+        hostStr = handlePy.replace( "]", "" )
+        hostStr = hostStr.replace( "'", "" )
+        hostStr = hostStr.replace( "[", "" )
+        hostList = hostStr.split( "," )
 
-        return host_list
+        return hostList
 
     def update( self ):
         """
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index a8aedea..e2e00e1 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -32,9 +32,10 @@
 class RemoteMininetDriver( Emulator ):
 
     """
-    RemoteMininetCliDriver is the basic driver which will handle the Mininet functions
-    The main different between this and the MininetCliDriver is that this one does not build the mininet.
-    It assumes that there is already a mininet running on the target.
+    RemoteMininetCliDriver is the basic driver which will handle the Mininet
+    functions. The main different between this and the MininetCliDriver is that
+    this one does not build the mininet. It assumes that there is already a
+    mininet running on the target.
     """
     def __init__( self ):
         super( Emulator, self ).__init__()
@@ -43,9 +44,9 @@
         self.flag = 0
 
     def connect( self, **connectargs ):
-        #,user_name, ip_address, pwd,options ):
-        # Here the main is the TestON instance after creating all the log
-        # handles.
+        """,userName, ipAddress, pwd,options ):
+         Here the main is the TestON instance after creating all the log
+         handles."""
         for key in connectargs:
             vars( self )[ key ] = connectargs[ key ]
 
@@ -53,12 +54,12 @@
         self.handle = super(
             RemoteMininetDriver,
             self ).connect(
-            user_name=self.user_name,
-            ip_address=self.ip_address,
+            userName=self.userName,
+            ipAddress=self.ipAddress,
             port=None,
             pwd=self.pwd )
 
-        self.ssh_handle = self.handle
+        self.sshHandle = self.handle
 
         # Copying the readme file to process the
         if self.handle:
@@ -67,32 +68,20 @@
         else:
             main.log.error(
                 "Connection failed to the host " +
-                self.user_name +
+                self.userName +
                 "@" +
-                self.ip_address )
+                self.ipAddress )
             main.log.error( "Failed to connect to the Mininet" )
             return main.FALSE
 
-#*************************************************************************
-#*************************************************************************
-# checkForLoss will determine if any of the pings had any packets lost during the course of
-# the pingLong.
-#*************************************************************************
-#*************************************************************************
-
     def checkForLoss( self, pingList ):
         """
         Returns main.FALSE for 0% packet loss and
         Returns main.ERROR if "found multiple mininet" is found and
         Returns main.TRUE else
         """
-        # TODO: maybe we want to return the % loss instead? This way we can set an acceptible loss %.
-        # EX: 393 packets transmitted, 380 received, 3% packet loss, time 78519ms
-        # we may need to return a float to get around rounding errors
-
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
-        # Clear any output waiting in the bg from killing pings
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
         self.handle.sendline( "cat " + pingList )
@@ -110,7 +99,8 @@
 
     def pingLong( self, **pingParams ):
         """
-        Starts a continuous ping on the mininet host outputing to a file in the /tmp dir.
+        Starts a continuous ping on the mininet host outputing
+        to a file in the /tmp dir.
         """
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
@@ -118,8 +108,9 @@
             [ "SRC", "TARGET", "PINGTIME" ], **pingParams )
         precmd = "sudo rm /tmp/ping." + args[ "SRC" ]
         self.execute( cmd=precmd, prompt="(.*)", timeout=10 )
-        command = "sudo mininet/util/m " + args[ "SRC" ] + " ping " + args[
-            "TARGET" ] + " -i .2 -w " + str( args[ 'PINGTIME' ] ) + " -D > /tmp/ping." + args[ "SRC" ] + " &"
+        command = "sudo mininet/util/m " + args[ "SRC" ] + " ping " +\
+                args[ "TARGET" ] + " -i .2 -w " + str( args[ 'PINGTIME' ] ) +\
+                " -D > /tmp/ping." + args[ "SRC" ] + " &"
         main.log.info( command )
         self.execute( cmd=command, prompt="(.*)", timeout=10 )
         self.handle.sendline( "" )
@@ -128,7 +119,8 @@
 
     def pingstatus( self, **pingParams ):
         """
-        Tails the respective ping output file and check that there is a moving "64 bytes"
+        Tails the respective ping output file and check that
+        there is a moving "64 bytes"
         """
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
@@ -196,12 +188,10 @@
         Currently the only supported Params: SRC and TARGET
         """
         args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
-        #command = args[ "SRC" ] + " ping -" + args[ "CONTROLLER" ] + " " +args [ "TARGET" ]
         command = args[ "SRC" ] + " ping " + \
             args[ "TARGET" ] + " -c 1 -i 1 -W 8"
         try:
             main.log.warn( "Sending: " + command )
-            #response = self.execute( cmd=command,prompt="mininet",timeout=10 )
             self.handle.sendline( command )
             i = self.handle.expect( [ command, pexpect.TIMEOUT ] )
             if i == 1:
@@ -222,18 +212,15 @@
             main.cleanup()
             main.exit()
         main.log.info( self.name + ": Ping Response: " + response )
-        # if utilities.assert_matches(
-        # expect=',\s0\%\spacket\sloss',actual=response,onpass="No Packet
-        # loss",onfail="Host is not reachable" ):
         if re.search( ',\s0\%\spacket\sloss', response ):
             main.log.info( self.name + ": no packets lost, host is reachable" )
-            main.last_result = main.TRUE
+            main.lastResult = main.TRUE
             return main.TRUE
         else:
             main.log.error(
                 self.name +
                 ": PACKET LOST, HOST IS NOT REACHABLE" )
-            main.last_result = main.FALSE
+            main.lastResult = main.FALSE
             return main.FALSE
 
     def pingHost( self, **pingParams ):
@@ -243,24 +230,21 @@
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
         args = utilities.parse_args( [ "SRC", "TARGET" ], **pingParams )
-        #command = "mininet/util/m " + args[ "SRC" ] + " ping "+args [ "TARGET" ]+" -c 4 -W 1 -i .2"
         command = "mininet/util/m " + \
             args[ "SRC" ] + " ping " + args[ "TARGET" ] + " -c 4 -W 1 -i .2"
         main.log.info( command )
         response = self.execute( cmd=command, prompt="rtt", timeout=10 )
-        # self.handle.sendline( "" )
-        # self.handle.expect( "\$" )
         if utilities.assert_matches(
                 expect=',\s0\%\spacket\sloss',
                 actual=response,
                 onpass="No Packet loss",
                 onfail="Host is not reachable" ):
             main.log.info( "NO PACKET LOSS, HOST IS REACHABLE" )
-            main.last_result = main.TRUE
+            main.lastResult = main.TRUE
             return main.TRUE
         else:
             main.log.error( "PACKET LOST, HOST IS NOT REACHABLE" )
-            main.last_result = main.FALSE
+            main.lastResult = main.FALSE
             return main.FALSE
 
     def checknum( self, num ):
@@ -290,7 +274,7 @@
         else:
             main.log.error( "Connection failed to the host" )
 
-    def start_tcpdump(
+    def startTcpdump(
             self,
             filename,
             intf="eth0",
@@ -314,23 +298,19 @@
                 "  &" )
             self.handle.sendline( "" )
             self.handle.sendline( "" )
-            i = self.handle.expect(
-                [ 'No\ssuch\device', 'listening\son', pexpect.TIMEOUT, "\$" ], timeout=10 )
+            i = self.handle.expect( [ 'No\ssuch\device', 'listening\son',
+                                    pexpect.TIMEOUT, "\$" ], timeout=10 )
             main.log.warn( self.handle.before + self.handle.after )
             if i == 0:
-                main.log.error(
-                    self.name +
-                    ": tcpdump - No such device exists. tcpdump attempted on: " +
-                    intf )
+                main.log.error( self.name + ": tcpdump - No such device exists.\
+                        tcpdump attempted on: " + intf )
                 return main.FALSE
             elif i == 1:
                 main.log.info( self.name + ": tcpdump started on " + intf )
                 return main.TRUE
             elif i == 2:
-                main.log.error(
-                    self.name +
-                    ": tcpdump command timed out! Check interface name, given interface was: " +
-                    intf )
+                main.log.error( self.name + ": tcpdump command timed out!\
+                        Check interface name, given interface was: " + intf )
                 return main.FALSE
             elif i == 3:
                 main.log.info( self.name + ": " + self.handle.before )
@@ -345,15 +325,13 @@
             main.exit()
         except:
             main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+                    self.name + ":" * 60 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 80 )
             main.cleanup()
             main.exit()
 
-    def stop_tcpdump( self ):
+    def stopTcpdump( self ):
         "pkills tcpdump"
         try:
             self.handle.sendline( "sudo pkill tcpdump" )
@@ -367,19 +345,17 @@
             main.exit()
         except:
             main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+                    self.name + ":" * 60 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 80 )
             main.cleanup()
             main.exit()
 
-    def run_optical_mn_script( self ):
+    def runOpticalMnScript( self ):
         """
             This function is only meant for Packet Optical.
-            It runs the python script "optical.py" to create the packet layer( mn )
-            topology
+            It runs the python script "optical.py" to create the
+            packet layer( mn )  topology
         """
         try:
             self.handle.sendline( "" )
@@ -411,17 +387,20 @@
             response = main.FALSE
         return response
 
-    def get_flowTable( self, protoVersion, sw ):
-        # TODO document usage
-        # TODO add option to look at cookies. ignoreing them for now
+    def getFlowTable( self, protoVersion, sw ):
+        """
+         TODO document usage
+         TODO add option to look at cookies. ignoreing them for now
+
+         print "get_flowTable(" + str( protoVersion ) +" " + str( sw ) +")"
+         NOTE: Use format to force consistent flow table output across
+         versions"""
         self.handle.sendline( "cd" )
         self.handle.expect( [ "\$", pexpect.EOF, pexpect.TIMEOUT ] )
-        # print "get_flowTable(" + str( protoVersion ) +" " + str( sw ) +")"
-        # NOTE: Use format to force consistent flow table output across
-        # versions
         if protoVersion == 1.0:
             command = "sudo ovs-ofctl dump-flows " + sw + \
-                " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1  $3  $6  $7  $8}' | cut -d ',' -f 2- | sort -n -k1 -r"
+                " -F OpenFlow10-table_id | awk '{OFS=\",\" ; print $1  $3  $6 \
+                $7  $8}' | cut -d ',' -f 2- | sort -n -k1 -r"
             self.handle.sendline( command )
             self.handle.expect( [ "k1 -r", pexpect.EOF, pexpect.TIMEOUT ] )
             self.handle.expect(
@@ -431,7 +410,8 @@
             return response
         elif protoVersion == 1.3:
             command = "sudo ovs-ofctl dump-flows " + sw + \
-                " -O OpenFlow13  | awk '{OFS=\",\" ; print $1  $3  $6  $7}' | cut -d ',' -f 2- | sort -n -k1 -r"
+                " -O OpenFlow13  | awk '{OFS=\",\" ; print $1  $3  $6  $7}'\
+                | cut -d ',' -f 2- | sort -n -k1 -r"
             self.handle.sendline( command )
             self.handle.expect( [ "k1 -r", pexpect.EOF, pexpect.TIMEOUT ] )
             self.handle.expect(
@@ -445,10 +425,10 @@
                 str(
                     type( protoVersion ) ) +
                 ") '" +
-                str(protoVersion) +
+                str( protoVersion ) +
                 "'" )
 
-    def flow_comp( self, flow1, flow2 ):
+    def flowComp( self, flow1, flow2 ):
         if flow1 == flow2:
             return main.TRUE
         else:
@@ -459,27 +439,23 @@
             main.log.info( flow2 )
             return main.FALSE
 
-    def setIpTablesOUTPUT(
-            self,
-            dst_ip,
-            dst_port,
-            action='add',
-            packet_type='tcp',
-            rule='DROP' ):
+    def setIpTablesOUTPUT( self, dstIp, dstPort, action='add',
+                           packetType='tcp', rule='DROP' ):
         """
         Description:
-            add or remove iptables rule to DROP ( default )  packets from specific IP and PORT
+            add or remove iptables rule to DROP ( default )
+            packets from specific IP and PORT
         Usage:
         * specify action ( 'add' or 'remove' )
           when removing, pass in the same argument as you would add. It will
           delete that specific rule.
-        * specify the destination ip to block with dst_ip
-        * specify destination port to block to dst_port
+        * specify the destination ip to block with dstIp
+        * specify destination port to block to dstPort
         * optional packet type to block ( default tcp )
         * optional iptables rule ( default DROP )
         WARNING:
-        * This function uses root privilege iptables command which may result in
-          unwanted network errors. USE WITH CAUTION
+        * This function uses root privilege iptables command which may result
+        in unwanted network errors. USE WITH CAUTION
         """
         import re
         import time
@@ -488,14 +464,15 @@
         #   The strict checking methods of this driver function is intentional
         #   to discourage any misuse or error of iptables, which can cause
         #   severe network errors
-        #*************
+        # *************
 
-        # NOTE: Sleep needed to give some time for rule to be added and registered
+        # NOTE: Sleep needed to give some time
+        # for rule to be added and registered
         #      to the instance
         time.sleep( 5 )
 
-        action_type = action.lower()
-        if action_type != 'add' and action_type != 'remove':
+        actionType = action.lower()
+        if actionType != 'add' and actionType != 'remove':
             main.log.error(
                 "Invalid action type. 'add' or 'remove' table rule" )
             if rule != 'DROP' and rule != 'ACCEPT' and rule != 'LOG':
@@ -507,27 +484,28 @@
         else:
 
             # If there is no existing rule in the iptables, we will see an
-            #'iptables:'... message. We expect to see this message.
+            # 'iptables:'... message. We expect to see this message.
             # Otherwise, if there IS an existing rule, we will get the prompt
             # back, hence why we expect $ for remove type. We want to remove
             # an already existing rule
 
-            if action_type == 'add':
-                # NOTE: "iptables:" expect is a result of return from the command
-                #      iptables -C ...
-                #      Any changes by the iptables command return string
-                #      will result in failure of the function. ( deemed unlikely
-                #      at the time of writing this function )
+            if actionType == 'add':
+                # NOTE: "iptables:" expect is a result of
+                # return from the command
+                # iptables -C ...
+                # Any changes by the iptables command return string
+                # will result in failure of the function. ( deemed unlikely
+                # at the time of writing this function )
                 # Check for existing rules on current input
                 self.handle.sendline( "" )
                 self.handle.expect( "\$" )
                 self.handle.sendline(
                     "sudo iptables -C OUTPUT -p " +
-                    str( packet_type ) +
+                    str( packetType ) +
                     " -d " +
-                    str( dst_ip ) +
+                    str( dstIp ) +
                     " --dport " +
-                    str( dst_port ) +
+                    str( dstPort ) +
                     " -j " +
                     str( rule ) )
                 i = self.handle.expect( [ "iptables:", "\$" ] )
@@ -536,61 +514,61 @@
                 print "after: "
                 print self.handle.after
 
-            elif action_type == 'remove':
+            elif actionType == 'remove':
                 # Check for existing rules on current input
                 self.handle.sendline( "" )
                 self.handle.expect( "\$" )
                 self.handle.sendline(
                     "sudo iptables -C OUTPUT -p " +
-                    str( packet_type ) +
+                    str( packetType ) +
                     " -d " +
-                    str( dst_ip ) +
+                    str( dstIp ) +
                     " --dport " +
-                    str( dst_port ) +
+                    str( dstPort ) +
                     " -j " +
                     str( rule ) )
                 self.handle.expect( "\$" )
             print "before: "
             print self.handle.before
-            actual_string = self.handle.after
-            expect_string = "iptables:"
+            actualString = self.handle.after
+            expectString = "iptables:"
             print "Actual String:"
-            print actual_string
+            print actualString
 
-            if re.search( expect_string, actual_string ):
-                match_result = main.TRUE
+            if re.search( expectString, actualString ):
+                matchResult = main.TRUE
             else:
-                match_result = main.FALSE
-            # If match_result is main.TRUE, it means there is no matching rule.
+                matchResult = main.FALSE
+            # If matchResult is main.TRUE, it means there is no matching rule.
 
-            # If tables does not exist and expected prompt is returned, go ahead and
-            # add iptables rule
-            if match_result == main.TRUE:
+            # If tables does not exist and expected prompt is returned,
+            # go ahead and add iptables rule
+            if matchResult == main.TRUE:
                 # Ensure action type is add
-                if action_type == 'add':
-                    #-A is the 'append' action of iptables
-                    action_add = '-A'
+                if actionType == 'add':
+                    # -A is the 'append' action of iptables
+                    actionAdd = '-A'
                     try:
                         self.handle.sendline( "" )
                         self.handle.sendline(
                             "sudo iptables " +
-                            action_add +
+                            actionAdd +
                             " OUTPUT -p " +
-                            str( packet_type ) +
+                            str( packetType ) +
                             " -d " +
-                            str( dst_ip ) +
+                            str( dstIp ) +
                             " --dport " +
-                            str( dst_port ) +
+                            str( dstPort ) +
                             " -j " +
                             str( rule ) )
 
-                        info_string = "Rules added to " + str( self.name )
-                        info_string += "iptable rule added to block IP: " + \
-                            str( dst_ip )
-                        info_string += "Port: " + \
-                            str( dst_port ) + " Rule: " + str( rule )
+                        infoString = "Rules added to " + str( self.name )
+                        infoString += "iptable rule added to block IP: " + \
+                            str( dstIp )
+                        infoString += "Port: " + \
+                            str( dstPort ) + " Rule: " + str( rule )
 
-                        main.log.info( info_string )
+                        main.log.info( infoString )
 
                         self.handle.expect(
                             [ "\$", pexpect.EOF, pexpect.TIMEOUT ] )
@@ -599,40 +577,41 @@
                             self.name +
                             ": Timeout exception in setIpTables function" )
                     except:
-                        main.log.error( traceback.print_exc() )
+                        main.log.error( traceback.printExc() )
                         main.cleanup()
                         main.exit()
                 else:
                     main.log.error(
                         "Given rule already exists, but attempted to add it" )
-            # If match_result is 0, it means there IS a matching rule provided
-            elif match_result == main.FALSE:
+            # If matchResult is 0, it means there IS a matching rule provided
+            elif matchResult == main.FALSE:
                 # Ensure action type is remove
-                if action_type == 'remove':
-                    #-D is the 'delete' rule of iptables
-                    action_remove = '-D'
+                if actionType == 'remove':
+                    # -D is the 'delete' rule of iptables
+                    actionRemove = '-D'
                     try:
                         self.handle.sendline( "" )
                         # Delete a specific rule specified into the function
                         self.handle.sendline(
                             "sudo iptables " +
-                            action_remove +
+                            actionRemove +
                             " OUTPUT -p " +
-                            str( packet_type ) +
+                            str( packetType ) +
                             " -d " +
-                            str( dst_ip ) +
+                            str( dstIp ) +
                             " --dport " +
-                            str( dst_port ) +
+                            str( dstPort ) +
                             " -j " +
                             str( rule ) )
 
-                        info_string = "Rules removed from " + str( self.name )
-                        info_string += " iptables rule removed from blocking IP: " + \
-                            str( dst_ip )
-                        info_string += " Port: " + \
-                            str( dst_port ) + " Rule: " + str( rule )
+                        infoString = "Rules removed from " + str( self.name )
+                        infoString += " iptables rule removed \
+                                      from blocking IP: " + \
+                                      str( dstIp )
+                        infoString += " Port: " + \
+                            str( dstPort ) + " Rule: " + str( rule )
 
-                        main.log.info( info_string )
+                        main.log.info( infoString )
 
                         self.handle.expect(
                             [ "\$", pexpect.EOF, pexpect.TIMEOUT ] )
@@ -641,12 +620,13 @@
                             self.name +
                             ": Timeout exception in setIpTables function" )
                     except:
-                        main.log.error( traceback.print_exc() )
+                        main.log.error( traceback.printExc() )
                         main.cleanup()
                         main.exit()
                 else:
                     main.log.error(
-                        "Given rule does not exist, but attempted to remove it" )
+                        "Given rule does not exist,\
+                                but attempted to remove it" )
             else:
                 # NOTE: If a bad usage of this function occurs, exit the entire
                 # test
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index b8a2bd5..abe064f 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -20,7 +20,6 @@
 import pexpect
 import re
 import traceback
-#import os.path
 sys.path.append( "../" )
 from drivers.common.clidriver import CLI
 
@@ -48,8 +47,8 @@
 
             self.name = self.options[ 'name' ]
             self.handle = super( OnosCliDriver, self ).connect(
-                user_name=self.user_name,
-                ip_address=self.ip_address,
+                userName=self.userName,
+                ipAddress=self.ipAddress,
                 port=self.port,
                 pwd=self.pwd,
                 home=self.home )
@@ -127,7 +126,7 @@
             main.cleanup()
             main.exit()
 
-    def set_cell( self, cellname ):
+    def setCell( self, cellname ):
         """
         Calls 'cell <name>' to set the environment variables on ONOSbench
 
@@ -140,19 +139,19 @@
                 main.exit()
             else:
                 self.handle.sendline( "cell " + str( cellname ) )
-                # Expect the cellname in the ONOS_CELL variable.
+                # Expect the cellname in the ONOSCELL variable.
                 # Note that this variable name is subject to change
                 #   and that this driver will have to change accordingly
                 self.handle.expect( "ONOS_CELL=" + str( cellname ) )
-                handle_before = self.handle.before
-                handle_after = self.handle.after
+                handleBefore = self.handle.before
+                handleAfter = self.handle.after
                 # Get the rest of the handle
                 self.handle.sendline( "" )
                 self.handle.expect( "\$" )
-                handle_more = self.handle.before
+                handleMore = self.handle.before
 
-                main.log.info( "Cell call returned: " + handle_before +
-                               handle_after + handle_more )
+                main.log.info( "Cell call returned: " + handleBefore +
+                               handleAfter + handleMore )
 
                 return main.TRUE
 
@@ -168,17 +167,20 @@
             main.cleanup()
             main.exit()
 
-    def start_onos_cli( self, ONOS_ip, karafTimeout="" ):
+    def startOnosCli( self, ONOSIp, karafTimeout="" ):
         """
-        karafTimeout is an optional arugument. karafTimeout value passed by user would be used to set the
-        current karaf shell idle timeout. Note that when ever this property is modified the shell will exit and
+        karafTimeout is an optional arugument. karafTimeout value passed
+        by user would be used to set the current karaf shell idle timeout.
+        Note that when ever this property is modified the shell will exit and
         the subsequent login would reflect new idle timeout.
-        Below is an example to start a session with 60 seconds idle timeout ( input value is in milliseconds ):
+        Below is an example to start a session with 60 seconds idle timeout
+        ( input value is in milliseconds ):
 
         tValue = "60000"
-        main.ONOScli1.start_onos_cli( ONOS_ip, karafTimeout=tValue )
+        main.ONOScli1.startOnosCli( ONOSIp, karafTimeout=tValue )
 
-        Note: karafTimeout is left as str so that this could be read and passed to start_onos_cli from PARAMS file as str.
+        Note: karafTimeout is left as str so that this could be read
+        and passed to startOnosCli from PARAMS file as str.
         """
         try:
             self.handle.sendline( "" )
@@ -190,42 +192,44 @@
                 return main.TRUE
 
             # Wait for onos start ( -w ) and enter onos cli
-            self.handle.sendline( "onos -w " + str( ONOS_ip ) )
+            self.handle.sendline( "onos -w " + str( ONOSIp ) )
             i = self.handle.expect( [
                 "onos>",
                 pexpect.TIMEOUT ], timeout=60 )
 
             if i == 0:
-                main.log.info( str( ONOS_ip ) + " CLI Started successfully" )
+                main.log.info( str( ONOSIp ) + " CLI Started successfully" )
                 if karafTimeout:
                     self.handle.sendline(
-                        "config:property-set -p org.apache.karaf.shell sshIdleTimeout " +
+                        "config:property-set -p org.apache.karaf.shel\
+                                l sshIdleTimeout " +
                         karafTimeout )
                     self.handle.expect( "\$" )
-                    self.handle.sendline( "onos -w " + str( ONOS_ip ) )
+                    self.handle.sendline( "onos -w " + str( ONOSIp ) )
                     self.handle.expect( "onos>" )
                 return main.TRUE
             else:
                 # If failed, send ctrl+c to process and try again
                 main.log.info( "Starting CLI failed. Retrying..." )
                 self.handle.send( "\x03" )
-                self.handle.sendline( "onos -w " + str( ONOS_ip ) )
+                self.handle.sendline( "onos -w " + str( ONOSIp ) )
                 i = self.handle.expect( [ "onos>", pexpect.TIMEOUT ],
                                         timeout=30 )
                 if i == 0:
-                    main.log.info( str( ONOS_ip ) + " CLI Started " +
+                    main.log.info( str( ONOSIp ) + " CLI Started " +
                                    "successfully after retry attempt" )
                     if karafTimeout:
                         self.handle.sendline(
-                            "config:property-set -p org.apache.karaf.shell sshIdleTimeout " +
+                            "config:property-set -p org.apache.karaf.shell\
+                                    sshIdleTimeout " +
                             karafTimeout )
                         self.handle.expect( "\$" )
-                        self.handle.sendline( "onos -w " + str( ONOS_ip ) )
+                        self.handle.sendline( "onos -w " + str( ONOSIp ) )
                         self.handle.expect( "onos>" )
                     return main.TRUE
                 else:
                     main.log.error( "Connection to CLI " +
-                                    str( ONOS_ip ) + " timeout" )
+                                    str( ONOSIp ) + " timeout" )
                     return main.FALSE
 
         except pexpect.EOF:
@@ -240,7 +244,7 @@
             main.cleanup()
             main.exit()
 
-    def sendline( self, cmd_str ):
+    def sendline( self, cmdStr ):
         """
         Send a completely user specified string to
         the onos> prompt. Use this function if you have
@@ -254,10 +258,10 @@
             self.handle.expect( "onos>" )
 
             self.handle.sendline( "log:log \"Sending CLI command: '"
-                                  + cmd_str + "'\"" )
+                                  + cmdStr + "'\"" )
             self.handle.expect( "onos>" )
-            self.handle.sendline( cmd_str )
-            self.handle.expect( cmd_str )
+            self.handle.sendline( cmdStr )
+            self.handle.expect( cmdStr )
             self.handle.expect( "onos>" )
 
             handle = self.handle.before
@@ -265,13 +269,10 @@
             self.handle.sendline( "" )
             self.handle.expect( "onos>" )
 
-            #handle += self.handle.before
-            #handle += self.handle.after
-
-            main.log.info( "Command '" + str(cmd_str) + "' sent to "
+            main.log.info( "Command '" + str( cmdStr ) + "' sent to "
                            + self.name + "." )
-            ansi_escape = re.compile( r'\x1b[^m]*m' )
-            handle = ansi_escape.sub( '', handle )
+            ansiEscape = re.compile( r'\x1b[^m]*m' )
+            handle = ansiEscape.sub( '', handle )
 
             return handle
         except pexpect.EOF:
@@ -288,30 +289,30 @@
 
     # IMPORTANT NOTE:
     # For all cli commands, naming convention should match
-    # the cli command replacing ':' with '_'.
-    # Ex ) onos:topology > onos_topology
-    #    onos:links    > onos_links
-    #    feature:list  > feature_list
+    # the cli command changing 'a:b' with 'aB'.
+    # Ex ) onos:topology > onosTopology
+    #    onos:links    > onosLinks
+    #    feature:list  > featureList
 
-    def add_node( self, node_id, ONOS_ip, tcp_port="" ):
+    def addNode( self, nodeId, ONOSIp, tcpPort="" ):
         """
         Adds a new cluster node by ID and address information.
         Required:
-            * node_id
-            * ONOS_ip
+            * nodeId
+            * ONOSIp
         Optional:
-            * tcp_port
+            * tcpPort
         """
         try:
-            cmd_str = "add-node " + str( node_id ) + " " +\
-                str( ONOS_ip ) + " " + str( tcp_port )
-            handle = self.sendline( cmd_str )
+            cmdStr = "add-node " + str( nodeId ) + " " +\
+                str( ONOSIp ) + " " + str( tcpPort )
+            handle = self.sendline( cmdStr )
             if re.search( "Error", handle ):
                 main.log.error( "Error in adding node" )
                 main.log.error( handle )
                 return main.FALSE
             else:
-                main.log.info( "Node " + str( ONOS_ip ) + " added" )
+                main.log.info( "Node " + str( ONOSIp ) + " added" )
                 return main.TRUE
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -325,17 +326,17 @@
             main.cleanup()
             main.exit()
 
-    def remove_node( self, node_id ):
+    def removeNode( self, nodeId ):
         """
         Removes a cluster by ID
         Issues command: 'remove-node [<node-id>]'
         Required:
-            * node_id
+            * nodeId
         """
         try:
 
-            cmd_str = "remove-node " + str( node_id )
-            self.sendline( cmd_str )
+            cmdStr = "remove-node " + str( nodeId )
+            self.sendline( cmdStr )
             # TODO: add error checking. Does ONOS give any errors?
 
             return main.TRUE
@@ -359,8 +360,8 @@
         Returns: entire handle of list of nodes
         """
         try:
-            cmd_str = "nodes"
-            handle = self.sendline( cmd_str )
+            cmdStr = "nodes"
+            handle = self.sendline( cmdStr )
             return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -381,8 +382,8 @@
         """
         try:
             # either onos:topology or 'topology' will work in CLI
-            cmd_str = "onos:topology"
-            handle = self.sendline( cmd_str )
+            cmdStr = "onos:topology"
+            handle = self.sendline( cmdStr )
             main.log.info( "onos:topology returned: " + str( handle ) )
             return handle
         except pexpect.EOF:
@@ -397,14 +398,14 @@
             main.cleanup()
             main.exit()
 
-    def feature_install( self, feature_str ):
+    def featureInstall( self, featureStr ):
         """
         Installs a specified feature
         by issuing command: 'onos> feature:install <feature_str>'
         """
         try:
-            cmd_str = "feature:install " + str( feature_str )
-            self.sendline( cmd_str )
+            cmdStr = "feature:install " + str( featureStr )
+            self.sendline( cmdStr )
             # TODO: Check for possible error responses from karaf
             return main.TRUE
         except pexpect.EOF:
@@ -423,14 +424,14 @@
             main.cleanup()
             main.exit()
 
-    def feature_uninstall( self, feature_str ):
+    def featureUninstall( self, featureStr ):
         """
         Uninstalls a specified feature
         by issuing command: 'onos> feature:uninstall <feature_str>'
         """
         try:
-            cmd_str = "feature:uninstall " + str( feature_str )
-            self.sendline( cmd_str )
+            cmdStr = "feature:uninstall " + str( featureStr )
+            self.sendline( cmdStr )
             # TODO: Check for possible error responses from karaf
             return main.TRUE
         except pexpect.EOF:
@@ -445,16 +446,16 @@
             main.cleanup()
             main.exit()
 
-    def devices( self, json_format=True ):
+    def devices( self, jsonFormat=True ):
         """
         Lists all infrastructure devices or switches
         Optional argument:
-            * json_format - boolean indicating if you want output in json
+            * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            if json_format:
-                cmd_str = "devices -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "devices -j"
+                handle = self.sendline( cmdStr )
                 """
                 handle variable here contains some ANSI escape color code
                 sequences at the end which are invisible in the print command
@@ -465,15 +466,15 @@
                 json.loads would fail with the escape sequence. So we take off
                 that escape sequence using:
 
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 """
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 return handle1
             else:
-                cmd_str = "devices"
-                handle = self.sendline( cmd_str )
+                cmdStr = "devices"
+                handle = self.sendline( cmdStr )
                 return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -487,15 +488,15 @@
             main.cleanup()
             main.exit()
 
-    def balance_masters( self ):
+    def balanceMasters( self ):
         """
         This balances the devices across all controllers
         by issuing command: 'onos> onos:balance-masters'
         If required this could be extended to return devices balanced output.
         """
         try:
-            cmd_str = "onos:balance-masters"
-            self.sendline( cmd_str )
+            cmdStr = "onos:balance-masters"
+            self.sendline( cmdStr )
             # TODO: Check for error responses from ONOS
             return main.TRUE
         except pexpect.EOF:
@@ -510,16 +511,16 @@
             main.cleanup()
             main.exit()
 
-    def links( self, json_format=True ):
+    def links( self, jsonFormat=True ):
         """
         Lists all core links
         Optional argument:
-            * json_format - boolean indicating if you want output in json
+            * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            if json_format:
-                cmd_str = "links -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "links -j"
+                handle = self.sendline( cmdStr )
                 """
                 handle variable here contains some ANSI escape color code
                 sequences at the end which are invisible in the print command
@@ -530,15 +531,15 @@
                 fail with the escape sequence. So we take off that escape
                 sequence using:
 
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 """
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 return handle1
             else:
-                cmd_str = "links"
-                handle = self.sendline( cmd_str )
+                cmdStr = "links"
+                handle = self.sendline( cmdStr )
                 return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -552,16 +553,16 @@
             main.cleanup()
             main.exit()
 
-    def ports( self, json_format=True ):
+    def ports( self, jsonFormat=True ):
         """
         Lists all ports
         Optional argument:
-            * json_format - boolean indicating if you want output in json
+            * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            if json_format:
-                cmd_str = "ports -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "ports -j"
+                handle = self.sendline( cmdStr )
                 """
                 handle variable here contains some ANSI escape color code
                 sequences at the end which are invisible in the print command
@@ -572,16 +573,16 @@
                 fail with the escape sequence. So we take off that escape
                 sequence using the following commads:
 
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 """
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 return handle1
 
             else:
-                cmd_str = "ports"
-                handle = self.sendline( cmd_str )
+                cmdStr = "ports"
+                handle = self.sendline( cmdStr )
                 return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -595,16 +596,16 @@
             main.cleanup()
             main.exit()
 
-    def roles( self, json_format=True ):
+    def roles( self, jsonFormat=True ):
         """
         Lists all devices and the controllers with roles assigned to them
         Optional argument:
-            * json_format - boolean indicating if you want output in json
+            * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            if json_format:
-                cmd_str = "roles -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "roles -j"
+                handle = self.sendline( cmdStr )
                 """
                 handle variable here contains some ANSI escape color code
                 sequences at the end which are invisible in the print command
@@ -617,16 +618,16 @@
                 So we take off that escape sequence using the following
                 commads:
 
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 """
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 return handle1
 
             else:
-                cmd_str = "roles"
-                handle = self.sendline( cmd_str )
+                cmdStr = "roles"
+                handle = self.sendline( cmdStr )
                 return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -640,7 +641,7 @@
             main.cleanup()
             main.exit()
 
-    def get_role( self, device_id ):
+    def getRole( self, deviceId ):
         """
         Given the a string containing the json representation of the "roles"
         cli command and a partial or whole device id, returns a json object
@@ -653,15 +654,15 @@
         """
         try:
             import json
-            if device_id is None:
+            if deviceId is None:
                 return None
             else:
-                raw_roles = self.roles()
-                roles_json = json.loads( raw_roles )
+                rawRoles = self.roles()
+                rolesJson = json.loads( rawRoles )
                 # search json for the device with id then return the device
-                for device in roles_json:
+                for device in rolesJson:
                     # print device
-                    if str( device_id ) in device[ 'id' ]:
+                    if str( deviceId ) in device[ 'id' ]:
                         return device
             return None
 
@@ -677,7 +678,7 @@
             main.cleanup()
             main.exit()
 
-    def roles_not_null( self ):
+    def rolesNotNull( self ):
         """
         Iterates through each device and checks if there is a master assigned
         Returns: main.TRUE if each device has a master
@@ -685,10 +686,10 @@
         """
         try:
             import json
-            raw_roles = self.roles()
-            roles_json = json.loads( raw_roles )
+            rawRoles = self.roles()
+            rolesJson = json.loads( rawRoles )
             # search json for the device with id then return the device
-            for device in roles_json:
+            for device in rolesJson:
                 # print device
                 if device[ 'master' ] == "none":
                     main.log.warn( "Device has no master: " + str( device ) )
@@ -707,14 +708,14 @@
             main.cleanup()
             main.exit()
 
-    def paths( self, src_id, dst_id ):
+    def paths( self, srcId, dstId ):
         """
         Returns string of paths, and the cost.
         Issues command: onos:paths <src> <dst>
         """
         try:
-            cmd_str = "onos:paths " + str( src_id ) + " " + str( dst_id )
-            handle = self.sendline( cmd_str )
+            cmdStr = "onos:paths " + str( srcId ) + " " + str( dstId )
+            handle = self.sendline( cmdStr )
             if re.search( "Error", handle ):
                 main.log.error( "Error in getting paths" )
                 return ( handle, "Error" )
@@ -734,16 +735,16 @@
             main.cleanup()
             main.exit()
 
-    def hosts( self, json_format=True ):
+    def hosts( self, jsonFormat=True ):
         """
         Lists all discovered hosts
         Optional argument:
-            * json_format - boolean indicating if you want output in json
+            * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            if json_format:
-                cmd_str = "hosts -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "hosts -j"
+                handle = self.sendline( cmdStr )
                 """
                 handle variable here contains some ANSI escape color code
                 sequences at the end which are invisible in the print command
@@ -754,15 +755,15 @@
                 fail with the escape sequence. So we take off that escape
                 sequence using:
 
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 """
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 return handle1
             else:
-                cmd_str = "hosts"
-                handle = self.sendline( cmd_str )
+                cmdStr = "hosts"
+                handle = self.sendline( cmdStr )
                 return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -776,7 +777,7 @@
             main.cleanup()
             main.exit()
 
-    def get_host( self, mac ):
+    def getHost( self, mac ):
         """
         Return the first host from the hosts api whose 'id' contains 'mac'
 
@@ -791,10 +792,10 @@
                 return None
             else:
                 mac = mac
-                raw_hosts = self.hosts()
-                hosts_json = json.loads( raw_hosts )
+                rawHosts = self.hosts()
+                hostsJson = json.loads( rawHosts )
                 # search json for the host with mac then return the device
-                for host in hosts_json:
+                for host in hostsJson:
                     # print "%s in  %s?" % ( mac, host[ 'id' ] )
                     if mac in host[ 'id' ]:
                         return host
@@ -811,13 +812,13 @@
             main.cleanup()
             main.exit()
 
-    def get_hosts_id( self, host_list ):
+    def getHostsId( self, hostList ):
         """
         Obtain list of hosts
         Issues command: 'onos> hosts'
 
         Required:
-            * host_list: List of hosts obtained by Mininet
+            * hostList: List of hosts obtained by Mininet
         IMPORTANT:
             This function assumes that you started your
             topology with the option '--mac'.
@@ -827,18 +828,18 @@
             ONOS format ( 00:00:00:00:00:01/-1 , ... )
         """
         try:
-            onos_host_list = []
+            onosHostList = []
 
-            for host in host_list:
+            for host in hostList:
                 host = host.replace( "h", "" )
-                host_hex = hex( int( host ) ).zfill( 12 )
-                host_hex = str( host_hex ).replace( 'x', '0' )
-                i = iter( str( host_hex ) )
-                host_hex = ":".join( a + b for a, b in zip( i, i ) )
-                host_hex = host_hex + "/-1"
-                onos_host_list.append( host_hex )
+                hostHex = hex( int( host ) ).zfill( 12 )
+                hostHex = str( hostHex ).replace( 'x', '0' )
+                i = iter( str( hostHex ) )
+                hostHex = ":".join( a + b for a, b in zip( i, i ) )
+                hostHex = hostHex + "/-1"
+                onosHostList.append( hostHex )
 
-            return onos_host_list
+            return onosHostList
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -852,21 +853,21 @@
             main.cleanup()
             main.exit()
 
-    def add_host_intent( self, host_id_one, host_id_two ):
+    def addHostIntent( self, hostIdOne, hostIdTwo ):
         """
         Required:
-            * host_id_one: ONOS host id for host1
-            * host_id_two: ONOS host id for host2
+            * hostIdOne: ONOS host id for host1
+            * hostIdTwo: ONOS host id for host2
         Description:
             Adds a host-to-host intent ( bidrectional ) by
             specifying the two hosts.
         """
         try:
-            cmd_str = "add-host-intent " + str( host_id_one ) +\
-                " " + str( host_id_two )
-            handle = self.sendline( cmd_str )
+            cmdStr = "add-host-intent " + str( hostIdOne ) +\
+                " " + str( hostIdTwo )
+            handle = self.sendline( cmdStr )
             main.log.info( "Host intent installed between " +
-                           str( host_id_one ) + " and " + str( host_id_two ) )
+                           str( hostIdOne ) + " and " + str( hostIdTwo ) )
             return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -880,18 +881,18 @@
             main.cleanup()
             main.exit()
 
-    def add_optical_intent( self, ingress_device, egress_device ):
+    def addOpticalIntent( self, ingressDevice, egressDevice ):
         """
         Required:
-            * ingress_device: device id of ingress device
-            * egress_device: device id of egress device
+            * ingressDevice: device id of ingress device
+            * egressDevice: device id of egress device
         Optional:
             TODO: Still needs to be implemented via dev side
         """
         try:
-            cmd_str = "add-optical-intent " + str( ingress_device ) +\
-                " " + str( egress_device )
-            handle = self.sendline( cmd_str )
+            cmdStr = "add-optical-intent " + str( ingressDevice ) +\
+                " " + str( egressDevice )
+            handle = self.sendline( cmdStr )
             # If error, return error message
             if re.search( "Error", handle ):
                 return handle
@@ -909,17 +910,17 @@
             main.cleanup()
             main.exit()
 
-    def add_point_intent(
+    def addPointIntent(
             self,
-            ingress_device,
-            egress_device,
-            port_ingress="",
-            port_egress="",
+            ingressDevice,
+            egressDevice,
+            portIngress="",
+            portEgress="",
             ethType="",
             ethSrc="",
             ethDst="",
             bandwidth="",
-            lambda_alloc=False,
+            lambdaAlloc=False,
             ipProto="",
             ipSrc="",
             ipDst="",
@@ -927,14 +928,14 @@
             tcpDst="" ):
         """
         Required:
-            * ingress_device: device id of ingress device
-            * egress_device: device id of egress device
+            * ingressDevice: device id of ingress device
+            * egressDevice: device id of egress device
         Optional:
             * ethType: specify ethType
             * ethSrc: specify ethSrc ( i.e. src mac addr )
             * ethDst: specify ethDst ( i.e. dst mac addr )
             * bandwidth: specify bandwidth capacity of link
-            * lambda_alloc: if True, intent will allocate lambda
+            * lambdaAlloc: if True, intent will allocate lambda
               for the specified intent
             * ipProto: specify ip protocol
             * ipSrc: specify ip source address
@@ -954,7 +955,7 @@
 
             # If there are no optional arguments
             if not ethType and not ethSrc and not ethDst\
-                    and not bandwidth and not lambda_alloc \
+                    and not bandwidth and not lambdaAlloc \
                     and not ipProto and not ipSrc and not ipDst \
                     and not tcpSrc and not tcpDst:
                 cmd = "add-point-intent"
@@ -970,7 +971,7 @@
                     cmd += " --ethDst " + str( ethDst )
                 if bandwidth:
                     cmd += " --bandwidth " + str( bandwidth )
-                if lambda_alloc:
+                if lambdaAlloc:
                     cmd += " --lambda "
                 if ipProto:
                     cmd += " --ipProto " + str( ipProto )
@@ -985,30 +986,30 @@
 
             # Check whether the user appended the port
             # or provided it as an input
-            if "/" in ingress_device:
-                cmd += " " + str( ingress_device )
+            if "/" in ingressDevice:
+                cmd += " " + str( ingressDevice )
             else:
-                if not port_ingress:
+                if not portIngress:
                     main.log.error( "You must specify " +
                                     "the ingress port" )
                     # TODO: perhaps more meaningful return
                     return main.FALSE
 
                 cmd += " " + \
-                    str( ingress_device ) + "/" +\
-                    str( port_ingress ) + " "
+                    str( ingressDevice ) + "/" +\
+                    str( portIngress ) + " "
 
-            if "/" in egress_device:
-                cmd += " " + str( egress_device )
+            if "/" in egressDevice:
+                cmd += " " + str( egressDevice )
             else:
-                if not port_egress:
+                if not portEgress:
                     main.log.error( "You must specify " +
                                     "the egress port" )
                     return main.FALSE
 
                 cmd += " " +\
-                    str( egress_device ) + "/" +\
-                    str( port_egress )
+                    str( egressDevice ) + "/" +\
+                    str( portEgress )
 
             handle = self.sendline( cmd )
             if re.search( "Error", handle ):
@@ -1028,18 +1029,18 @@
             main.cleanup()
             main.exit()
 
-    def add_multipoint_to_singlepoint_intent(
+    def addMultipointToSinglepointIntent(
             self,
-            ingress_device1,
-            ingress_device2,
-            egress_device,
-            port_ingress="",
-            port_egress="",
+            ingressDevice1,
+            ingressDevice2,
+            egressDevice,
+            portIngress="",
+            portEgress="",
             ethType="",
             ethSrc="",
             ethDst="",
             bandwidth="",
-            lambda_alloc=False,
+            lambdaAlloc=False,
             ipProto="",
             ipSrc="",
             ipDst="",
@@ -1053,15 +1054,15 @@
             one egress device. For more number of ingress devices, this
             function needs to be modified
         Required:
-            * ingress_device1: device id of ingress device1
-            * ingress_device2: device id of ingress device2
-            * egress_device: device id of egress device
+            * ingressDevice1: device id of ingress device1
+            * ingressDevice2: device id of ingress device2
+            * egressDevice: device id of egress device
         Optional:
             * ethType: specify ethType
             * ethSrc: specify ethSrc ( i.e. src mac addr )
             * ethDst: specify ethDst ( i.e. dst mac addr )
             * bandwidth: specify bandwidth capacity of link
-            * lambda_alloc: if True, intent will allocate lambda
+            * lambdaAlloc: if True, intent will allocate lambda
               for the specified intent
             * ipProto: specify ip protocol
             * ipSrc: specify ip source address
@@ -1083,7 +1084,7 @@
 
             # If there are no optional arguments
             if not ethType and not ethSrc and not ethDst\
-                    and not bandwidth and not lambda_alloc\
+                    and not bandwidth and not lambdaAlloc\
                     and not ipProto and not ipSrc and not ipDst\
                     and not tcpSrc and not tcpDst and not setEthSrc\
                     and not setEthDst:
@@ -1100,7 +1101,7 @@
                     cmd += " --ethDst " + str( ethDst )
                 if bandwidth:
                     cmd += " --bandwidth " + str( bandwidth )
-                if lambda_alloc:
+                if lambdaAlloc:
                     cmd += " --lambda "
                 if ipProto:
                     cmd += " --ipProto " + str( ipProto )
@@ -1119,43 +1120,43 @@
 
             # Check whether the user appended the port
             # or provided it as an input
-            if "/" in ingress_device1:
-                cmd += " " + str( ingress_device1 )
+            if "/" in ingressDevice1:
+                cmd += " " + str( ingressDevice1 )
             else:
-                if not port_ingress1:
+                if not portIngress1:
                     main.log.error( "You must specify " +
                                     "the ingress port1" )
                     # TODO: perhaps more meaningful return
                     return main.FALSE
 
                 cmd += " " + \
-                    str( ingress_device1 ) + "/" +\
-                    str( port_ingress1 ) + " "
+                    str( ingressDevice1 ) + "/" +\
+                    str( portIngress1 ) + " "
 
-            if "/" in ingress_device2:
-                cmd += " " + str( ingress_device2 )
+            if "/" in ingressDevice2:
+                cmd += " " + str( ingressDevice2 )
             else:
-                if not port_ingress2:
+                if not portIngress2:
                     main.log.error( "You must specify " +
                                     "the ingress port2" )
                     # TODO: perhaps more meaningful return
                     return main.FALSE
 
                 cmd += " " + \
-                    str( ingress_device2 ) + "/" +\
-                    str( port_ingress2 ) + " "
+                    str( ingressDevice2 ) + "/" +\
+                    str( portIngress2 ) + " "
 
-            if "/" in egress_device:
-                cmd += " " + str( egress_device )
+            if "/" in egressDevice:
+                cmd += " " + str( egressDevice )
             else:
-                if not port_egress:
+                if not portEgress:
                     main.log.error( "You must specify " +
                                     "the egress port" )
                     return main.FALSE
 
                 cmd += " " +\
-                    str( egress_device ) + "/" +\
-                    str( port_egress )
+                    str( egressDevice ) + "/" +\
+                    str( portEgress )
             print "cmd= ", cmd
             handle = self.sendline( cmd )
             if re.search( "Error", handle ):
@@ -1175,7 +1176,7 @@
             main.cleanup()
             main.exit()
 
-    def remove_intent( self, intent_id ):
+    def removeIntent( self, intentId ):
         """
         Remove intent for specified intent id
 
@@ -1184,8 +1185,8 @@
             cli output otherwise
         """
         try:
-            cmd_str = "remove-intent " + str( intent_id )
-            handle = self.sendline( cmd_str )
+            cmdStr = "remove-intent " + str( intentId )
+            handle = self.sendline( cmdStr )
             if re.search( "Error", handle ):
                 main.log.error( "Error in removing intent" )
                 return main.FALSE
@@ -1204,24 +1205,24 @@
             main.cleanup()
             main.exit()
 
-    def routes( self, json_format=False ):
+    def routes( self, jsonFormat=False ):
         """
         NOTE: This method should be used after installing application:
               onos-app-sdnip
         Optional:
-            * json_format: enable output formatting in json
+            * jsonFormat: enable output formatting in json
         Description:
             Obtain all routes in the system
         """
         try:
-            if json_format:
-                cmd_str = "routes -j"
-                handle_tmp = self.sendline( cmd_str )
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle = ansi_escape.sub( '', handle_tmp )
+            if jsonFormat:
+                cmdStr = "routes -j"
+                handleTmp = self.sendline( cmdStr )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle = ansiEscape.sub( '', handleTmp )
             else:
-                cmd_str = "routes"
-                handle = self.sendline( cmd_str )
+                cmdStr = "routes"
+                handle = self.sendline( cmdStr )
             return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1235,22 +1236,22 @@
             main.cleanup()
             main.exit()
 
-    def intents( self, json_format=True ):
+    def intents( self, jsonFormat=True ):
         """
         Optional:
-            * json_format: enable output formatting in json
+            * jsonFormat: enable output formatting in json
         Description:
             Obtain intents currently installed
         """
         try:
-            if json_format:
-                cmd_str = "intents -j"
-                handle = self.sendline( cmd_str )
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle = ansi_escape.sub( '', handle )
+            if jsonFormat:
+                cmdStr = "intents -j"
+                handle = self.sendline( cmdStr )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle = ansiEscape.sub( '', handle )
             else:
-                cmd_str = "intents"
-                handle = self.sendline( cmd_str )
+                cmdStr = "intents"
+                handle = self.sendline( cmdStr )
             return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1264,22 +1265,22 @@
             main.cleanup()
             main.exit()
 
-    def flows( self, json_format=True ):
+    def flows( self, jsonFormat=True ):
         """
         Optional:
-            * json_format: enable output formatting in json
+            * jsonFormat: enable output formatting in json
         Description:
             Obtain flows currently installed
         """
         try:
-            if json_format:
-                cmd_str = "flows -j"
-                handle = self.sendline( cmd_str )
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle = ansi_escape.sub( '', handle )
+            if jsonFormat:
+                cmdStr = "flows -j"
+                handle = self.sendline( cmdStr )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle = ansiEscape.sub( '', handle )
             else:
-                cmd_str = "flows"
-                handle = self.sendline( cmd_str )
+                cmdStr = "flows"
+                handle = self.sendline( cmdStr )
             if re.search( "Error\sexecuting\scommand:", handle ):
                 main.log.error( self.name + ".flows() response: " +
                                 str( handle ) )
@@ -1296,40 +1297,38 @@
             main.cleanup()
             main.exit()
 
-    def push_test_intents( self, dpid_src, dpid_dst, num_intents,
-                           num_mult="", app_id="", report=True ):
+    def pushTestIntents( self, dpidSrc, dpidDst, numIntents,
+                          numMult="", appId="", report=True ):
         """
         Description:
             Push a number of intents in a batch format to
             a specific point-to-point intent definition
         Required:
-            * dpid_src: specify source dpid
-            * dpid_dst: specify destination dpid
-            * num_intents: specify number of intents to push
+            * dpidSrc: specify source dpid
+            * dpidDst: specify destination dpid
+            * numIntents: specify number of intents to push
         Optional:
-            * num_mult: number multiplier for multiplying
+            * numMult: number multiplier for multiplying
               the number of intents specified
-            * app_id: specify the application id init to further
+            * appId: specify the application id init to further
               modularize the intents
             * report: default True, returns latency information
         """
         try:
             cmd = "push-test-intents " +\
-                  str( dpid_src ) + " " + str( dpid_dst ) + " " +\
-                  str( num_intents )
-            if num_mult:
-                cmd += " " + str( num_mult )
-                # If app id is specified, then num_mult
+                  str( dpidSrc ) + " " + str( dpidDst ) + " " +\
+                  str( numIntents )
+            if numMult:
+                cmd += " " + str( numMult )
+                # If app id is specified, then numMult
                 # must exist because of the way this command
-                #takes in arguments
-                if app_id:
-                    cmd += " " + str( app_id )
+                if appId:
+                    cmd += " " + str( appId )
             handle = self.sendline( cmd )
-            # Some color thing that we want to escape
-            ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-            handle = ansi_escape.sub( '', handle )
+            ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+            handle = ansiEscape.sub( '', handle )
             if report:
-                lat_result = []
+                latResult = []
                 main.log.info( handle )
                 # Split result by newline
                 newline = handle.split( "\r\r\n" )
@@ -1339,9 +1338,9 @@
                 for result in newline:
                     result = result.split( ": " )
                     # Append the first result of second parse
-                    lat_result.append( result[ 1 ].split( " " )[ 0 ] )
-                main.log.info( lat_result )
-                return lat_result
+                    latResult.append( result[ 1 ].split( " " )[ 0 ] )
+                main.log.info( latResult )
+                return latResult
             else:
                 return main.TRUE
         except pexpect.EOF:
@@ -1356,22 +1355,22 @@
             main.cleanup()
             main.exit()
 
-    def intents_events_metrics( self, json_format=True ):
+    def intentsEventsMetrics( self, jsonFormat=True ):
         """
         Description:Returns topology metrics
         Optional:
-            * json_format: enable json formatting of output
+            * jsonFormat: enable json formatting of output
         """
         try:
-            if json_format:
-                cmd_str = "intents-events-metrics -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "intents-events-metrics -j"
+                handle = self.sendline( cmdStr )
                 # Some color thing that we want to escape
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle = ansiEscape.sub( '', handle )
             else:
-                cmd_str = "intents-events-metrics"
-                handle = self.sendline( cmd_str )
+                cmdStr = "intents-events-metrics"
+                handle = self.sendline( cmdStr )
             return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1385,22 +1384,22 @@
             main.cleanup()
             main.exit()
 
-    def topology_events_metrics( self, json_format=True ):
+    def topologyEventsMetrics( self, jsonFormat=True ):
         """
         Description:Returns topology metrics
         Optional:
-            * json_format: enable json formatting of output
+            * jsonFormat: enable json formatting of output
         """
         try:
-            if json_format:
-                cmd_str = "topology-events-metrics -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "topology-events-metrics -j"
+                handle = self.sendline( cmdStr )
                 # Some color thing that we want to escape
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle = ansiEscape.sub( '', handle )
             else:
-                cmd_str = "topology-events-metrics"
-                handle = self.sendline( cmd_str )
+                cmdStr = "topology-events-metrics"
+                handle = self.sendline( cmdStr )
             return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1421,37 +1420,37 @@
     # a normal driver function, and parse it
     # using a wrapper function
 
-    def get_all_intents_id( self ):
+    def getAllIntentsId( self ):
         """
         Description:
             Obtain all intent id's in a list
         """
         try:
             # Obtain output of intents function
-            intents_str = self.intents()
-            all_intent_list = []
-            intent_id_list = []
+            intentsStr = self.intents()
+            allIntentList = []
+            intentIdList = []
 
             # Parse the intents output for ID's
-            intents_list = [ s.strip() for s in intents_str.splitlines() ]
-            for intents in intents_list:
+            intentsList = [ s.strip() for s in intentsStr.splitlines() ]
+            for intents in intentsList:
                 if "onos>" in intents:
                     continue
                 elif "intents" in intents:
                     continue
                 else:
-                    line_list = intents.split( " " )
-                    all_intent_list.append( line_list[ 0 ] )
+                    lineList = intents.split( " " )
+                    allIntentList.append( lineList[ 0 ] )
 
-            all_intent_list = all_intent_list[ 1:-2 ]
+            allIntentList = allIntentList[ 1:-2 ]
 
-            for intents in all_intent_list:
+            for intents in allIntentList:
                 if not intents:
                     continue
                 else:
-                    intent_id_list.append( intents )
+                    intentIdList.append( intents )
 
-            return intent_id_list
+            return intentIdList
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1465,7 +1464,7 @@
             main.cleanup()
             main.exit()
 
-    def get_all_devices_id( self ):
+    def getAllDevicesId( self ):
         """
         Use 'devices' function to obtain list of all devices
         and parse the result to obtain a list of all device
@@ -1480,23 +1479,23 @@
         """
         try:
             # Call devices and store result string
-            devices_str = self.devices( json_format=False )
-            id_list = []
+            devicesStr = self.devices( jsonFormat=False )
+            idList = []
 
-            if not devices_str:
+            if not devicesStr:
                 main.log.info( "There are no devices to get id from" )
-                return id_list
+                return idList
 
             # Split the string into list by comma
-            device_list = devices_str.split( "," )
+            deviceList = devicesStr.split( "," )
             # Get temporary list of all arguments with string 'id='
-            temp_list = [ dev for dev in device_list if "id=" in dev ]
+            tempList = [ dev for dev in deviceList if "id=" in dev ]
             # Split list further into arguments before and after string
             # 'id='. Get the latter portion ( the actual device id ) and
-            # append to id_list
-            for arg in temp_list:
-                id_list.append( arg.split( "id=" )[ 1 ] )
-            return id_list
+            # append to idList
+            for arg in tempList:
+                idList.append( arg.split( "id=" )[ 1 ] )
+            return idList
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1510,7 +1509,7 @@
             main.cleanup()
             main.exit()
 
-    def get_all_nodes_id( self ):
+    def getAllNodesId( self ):
         """
         Uses 'nodes' function to obtain list of all nodes
         and parse the result of nodes to obtain just the
@@ -1519,23 +1518,23 @@
             list of node id's
         """
         try:
-            nodes_str = self.nodes()
-            id_list = []
+            nodesStr = self.nodes()
+            idList = []
 
-            if not nodes_str:
+            if not nodesStr:
                 main.log.info( "There are no nodes to get id from" )
-                return id_list
+                return idList
 
-            # Sample nodes_str output
+            # Sample nodesStr output
             # id=local, address=127.0.0.1:9876, state=ACTIVE *
 
             # Split the string into list by comma
-            nodes_list = nodes_str.split( "," )
-            temp_list = [ node for node in nodes_list if "id=" in node ]
-            for arg in temp_list:
-                id_list.append( arg.split( "id=" )[ 1 ] )
+            nodesList = nodesStr.split( "," )
+            tempList = [ node for node in nodesList if "id=" in node ]
+            for arg in tempList:
+                idList.append( arg.split( "id=" )[ 1 ] )
 
-            return id_list
+            return idList
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1549,7 +1548,7 @@
             main.cleanup()
             main.exit()
 
-    def get_device( self, dpid=None ):
+    def getDevice( self, dpid=None ):
         """
         Return the first device from the devices api whose 'id' contains 'dpid'
         Return None if there is no match
@@ -1560,10 +1559,10 @@
                 return None
             else:
                 dpid = dpid.replace( ':', '' )
-                raw_devices = self.devices()
-                devices_json = json.loads( raw_devices )
+                rawDevices = self.devices()
+                devicesJson = json.loads( rawDevices )
                 # search json for the device with dpid then return the device
-                for device in devices_json:
+                for device in devicesJson:
                     # print "%s in  %s?" % ( dpid, device[ 'id' ] )
                     if dpid in device[ 'id' ]:
                         return device
@@ -1580,7 +1579,7 @@
             main.cleanup()
             main.exit()
 
-    def check_status( self, ip, numoswitch, numolink, log_level="info" ):
+    def checkStatus( self, ip, numoswitch, numolink, logLevel="info" ):
         """
         Checks the number of swithes & links that ONOS sees against the
         supplied values. By default this will report to main.log, but the
@@ -1589,17 +1588,18 @@
         Params: ip = ip used for the onos cli
                 numoswitch = expected number of switches
                 numlink = expected number of links
-                log_level = level to log to. Currently accepts 'info', 'warn' and 'report'
+                logLevel = level to log to. Currently accepts
+                'info', 'warn' and 'report'
 
 
-        log_level can
+        logLevel can
 
         Returns: main.TRUE if the number of switchs and links are correct,
                  main.FALSE if the numer of switches and links is incorrect,
                  and main.ERROR otherwise
         """
         try:
-            topology = self.get_topology( ip )
+            topology = self.getTopology( ip )
             if topology == {}:
                 return main.ERROR
             output = ""
@@ -1608,23 +1608,26 @@
             links = topology.get( 'links', False )
             if devices == False or links == False:
                 return main.ERROR
-            switch_check = ( int( devices ) == int( numoswitch ) )
+            switchCheck = ( int( devices ) == int( numoswitch ) )
             # Is the number of links is what we expected
-            link_check = ( int( links ) == int( numolink ) )
-            if ( switch_check and link_check ):
+            linkCheck = ( int( links ) == int( numolink ) )
+            if ( switchCheck and linkCheck ):
                 # We expected the correct numbers
                 output = output + "The number of links and switches match "\
                     + "what was expected"
                 result = main.TRUE
             else:
                 output = output + \
-                    "The number of links and switches does not match what was expected"
+                    "The number of links and switches does not matc\
+                    h what was expected"
                 result = main.FALSE
-            output = output + "\n ONOS sees %i devices (%i expected) and %i links (%i expected)" % (
-                int( devices ), int( numoswitch ), int( links ), int( numolink ) )
-            if log_level == "report":
+            output = output + "\n ONOS sees %i devices (%i expected) \
+                    and %i links (%i expected)" % (
+                int( devices ), int( numoswitch ), int( links ),
+                int( numolink ) )
+            if logLevel == "report":
                 main.log.report( output )
-            elif log_level == "warn":
+            elif logLevel == "warn":
                 main.log.warn( output )
             else:
                 main.log.info( output )
@@ -1641,11 +1644,11 @@
             main.cleanup()
             main.exit()
 
-    def device_role( self, device_id, onos_node, role="master" ):
+    def deviceRole( self, deviceId, onosNode, role="master" ):
         """
         Calls the device-role cli command.
-        device_id must be the id of a device as seen in the onos devices command
-        onos_node is the ip of one of the onos nodes in the cluster
+        deviceId must be the id of a device as seen in the onos devices command
+        onosNode is the ip of one of the onos nodes in the cluster
         role must be either master, standby, or none
 
         Returns:
@@ -1655,11 +1658,11 @@
         try:
             if role.lower() == "master" or role.lower() == "standby" or\
                     role.lower() == "none":
-                cmd_str = "device-role " +\
-                    str( device_id ) + " " +\
-                    str( onos_node ) +  " " +\
+                cmdStr = "device-role " +\
+                    str( deviceId ) + " " +\
+                    str( onosNode ) + " " +\
                     str( role )
-                handle = self.sendline( cmd_str )
+                handle = self.sendline( cmdStr )
                 if re.search( "Error", handle ):
                     # end color output to escape any colours
                     # from the cli
@@ -1683,35 +1686,35 @@
             main.cleanup()
             main.exit()
 
-    def clusters( self, json_format=True ):
+    def clusters( self, jsonFormat=True ):
         """
         Lists all clusters
         Optional argument:
-            * json_format - boolean indicating if you want output in json
+            * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            if json_format:
-                cmd_str = "clusters -j"
-                handle = self.sendline( cmd_str )
+            if jsonFormat:
+                cmdStr = "clusters -j"
+                handle = self.sendline( cmdStr )
                 """
                 handle variable here contains some ANSI escape color code
                 sequences at the end which are invisible in the print command
                 output. To make that escape sequence visible, use repr()
                 function. The repr( handle ) output when printed shows the ANSI
                 escape sequences. In json.loads( somestring ), this somestring
-                variable is actually repr( somestring ) and json.loads would fail
-                with the escape sequence. So we take off that escape sequence
-                using:
+                variable is actually repr( somestring ) and json.loads would
+                fail with the escape sequence. So we take off that escape
+                sequence using:
 
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 """
-                ansi_escape = re.compile( r'\r\r\n\x1b[^m]*m' )
-                handle1 = ansi_escape.sub( '', handle )
+                ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
+                handle1 = ansiEscape.sub( '', handle )
                 return handle1
             else:
-                cmd_str = "clusters"
-                handle = self.sendline( cmd_str )
+                cmdStr = "clusters"
+                handle = self.sendline( cmdStr )
                 return handle
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1725,7 +1728,7 @@
             main.cleanup()
             main.exit()
 
-    def election_test_leader( self ):
+    def electionTestLeader( self ):
         """
         CLI command to get the current leader for the Election test application
         NOTE: Requires installation of the onos-app-election feature
@@ -1734,22 +1737,22 @@
                  Main.FALSE on error
         """
         try:
-            cmd_str = "election-test-leader"
-            response = self.sendline( cmd_str )
+            cmdStr = "election-test-leader"
+            response = self.sendline( cmdStr )
             # Leader
             leaderPattern = "The\scurrent\sleader\sfor\sthe\sElection\s" +\
                 "app\sis\s(?P<node>.+)\."
-            node_search = re.search( leaderPattern, response )
-            if node_search:
-                node = node_search.group( 'node' )
+            nodeSearch = re.search( leaderPattern, response )
+            if nodeSearch:
+                node = nodeSearch.group( 'node' )
                 main.log.info( "Election-test-leader on " + str( self.name ) +
                                " found " + node + " as the leader" )
                 return node
             # no leader
             nullPattern = "There\sis\scurrently\sno\sleader\selected\sfor\s" +\
                 "the\sElection\sapp"
-            null_search = re.search( nullPattern, response )
-            if null_search:
+            nullSearch = re.search( nullPattern, response )
+            if nullSearch:
                 main.log.info( "Election-test-leader found no leader on " +
                                self.name )
                 return None
@@ -1776,7 +1779,7 @@
             main.cleanup()
             main.exit()
 
-    def election_test_run( self ):
+    def electionTestRun( self ):
         """
         CLI command to run for leadership of the Election test application.
         NOTE: Requires installation of the onos-app-election feature
@@ -1784,8 +1787,8 @@
                  Main.FALSE on error
         """
         try:
-            cmd_str = "election-test-run"
-            response = self.sendline( cmd_str )
+            cmdStr = "election-test-run"
+            response = self.sendline( cmdStr )
             # success
             successPattern = "Entering\sleadership\selections\sfor\sthe\s" +\
                 "Election\sapp."
@@ -1816,7 +1819,7 @@
             main.cleanup()
             main.exit()
 
-    def election_test_withdraw( self ):
+    def electionTestWithdraw( self ):
         """
          * CLI command to withdraw the local node from leadership election for
          * the Election test application.
@@ -1825,8 +1828,8 @@
                   Main.FALSE on error
         """
         try:
-            cmd_str = "election-test-withdraw"
-            response = self.sendline( cmd_str )
+            cmdStr = "election-test-withdraw"
+            response = self.sendline( cmdStr )
             # success
             successPattern = "Withdrawing\sfrom\sleadership\selections\sfor" +\
                 "\sthe\sElection\sapp."
@@ -1856,15 +1859,14 @@
             main.cleanup()
             main.exit()
 
-    #***********************************
     def getDevicePortsEnabledCount( self, dpid ):
         """
         Get the count of all enabled ports on a particular device/switch
         """
         try:
             dpid = str( dpid )
-            cmd_str = "onos:ports -e " + dpid + " | wc -l"
-            output = self.sendline( cmd_str )
+            cmdStr = "onos:ports -e " + dpid + " | wc -l"
+            output = self.sendline( cmdStr )
             if re.search( "No such device", output ):
                 main.log.error( "Error in getting ports" )
                 return ( output, "Error" )
@@ -1888,8 +1890,8 @@
         """
         try:
             dpid = str( dpid )
-            cmd_str = "onos:links " + dpid + " | grep ACTIVE | wc -l"
-            output = self.sendline( cmd_str )
+            cmdStr = "onos:links " + dpid + " | grep ACTIVE | wc -l"
+            output = self.sendline( cmdStr )
             if re.search( "No such device", output ):
                 main.log.error( "Error in getting ports " )
                 return ( output, "Error " )
@@ -1912,8 +1914,8 @@
         Return a list of all Intent IDs
         """
         try:
-            cmd_str = "onos:intents | grep id="
-            output = self.sendline( cmd_str )
+            cmdStr = "onos:intents | grep id="
+            output = self.sendline( cmdStr )
             if re.search( "Error", output ):
                 main.log.error( "Error in getting ports" )
                 return ( output, "Error" )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index d671f48..5eae84d 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -48,11 +48,11 @@
 
             self.name = self.options[ 'name' ]
             self.handle = super( OnosDriver, self ).connect(
-                user_name=self.user_name,
-                    ip_address=self.ip_address,
-                    port=self.port,
-                    pwd=self.pwd,
-                    home=self.home )
+                userName=self.userName,
+                ipAddress=self.ipAddress,
+                port=self.port,
+                pwd=self.pwd,
+                home=self.home )
 
             self.handle.sendline( "cd " + self.home )
             self.handle.expect( "\$" )
@@ -67,12 +67,9 @@
             main.cleanup()
             main.exit()
         except:
-            main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+            main.log.info( self.name + ":" * 30 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 30 )
             main.cleanup()
             main.exit()
 
@@ -94,7 +91,7 @@
             response = main.FALSE
         return response
 
-    def onos_package( self ):
+    def onosPackage( self ):
         """
         Produce a self-contained tar.gz file that can be deployed
         and executed on any platform with Java 7 JRE.
@@ -119,7 +116,7 @@
             main.cleanup()
             main.exit()
 
-    def onos_build( self ):
+    def onosBuild( self ):
         """
         Use the pre defined script to build onos via mvn
         """
@@ -127,10 +124,10 @@
             self.handle.sendline( "onos-build" )
             self.handle.expect( "onos-build" )
             i = self.handle.expect( [
-                                    "BUILD SUCCESS",
-                                    "ERROR",
-                                    "BUILD FAILED" ],
-                                    timeout=120 )
+                "BUILD SUCCESS",
+                "ERROR",
+                "BUILD FAILED" ],
+                timeout=120 )
             handle = str( self.handle.before )
 
             main.log.info( "onos-build command returned: " +
@@ -149,7 +146,7 @@
             main.cleanup()
             main.exit()
 
-    def clean_install( self ):
+    def cleanInstall( self ):
         """
         Runs mvn clean install in the root of the ONOS directory.
         This will clean all ONOS artifacts then compile each module
@@ -158,7 +155,8 @@
         On Failure, exits the test
         """
         try:
-            main.log.info( "Running 'mvn clean install' on " + str( self.name ) +
+            main.log.info( "Running 'mvn clean install' on " +
+                           str( self.name ) +
                            ". This may take some time." )
             self.handle.sendline( "cd " + self.home )
             self.handle.expect( "\$" )
@@ -216,26 +214,23 @@
             main.cleanup()
             main.exit()
         except:
-            main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+            main.log.info( self.name + ":" * 60 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 60 )
             main.cleanup()
             main.exit()
 
-    def git_pull( self, comp1="" ):
+    def gitPull( self, comp1="" ):
         """
         Assumes that "git pull" works without login
 
         This function will perform a git pull on the ONOS instance.
-        If used as git_pull( "NODE" ) it will do git pull + NODE. This is
+        If used as gitPull( "NODE" ) it will do git pull + NODE. This is
         for the purpose of pulling from other nodes if necessary.
 
         Otherwise, this function will perform a git pull in the
         ONOS repository. If it has any problems, it will return main.ERROR
-        If it successfully does a git_pull, it will return a 1 ( main.TRUE )
+        If it successfully does a gitPull, it will return a 1 ( main.TRUE )
         If it has no updates, it will return 3.
 
         """
@@ -249,19 +244,24 @@
             else:
                 self.handle.sendline( "git pull " + comp1 )
 
-            i = self.handle.expect( [ 'fatal',
-                                    'Username\sfor\s(.*):\s',
-                                      '\sfile(s*) changed,\s',
-                                      'Already up-to-date',
-                                      'Aborting',
-                                      'You\sare\snot\scurrently\son\sa\sbranch',
-                                      'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\sbranch\syou',
-                                      'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\sfiles',
-                                      pexpect.TIMEOUT ],
-                                    timeout=300 )
+            i = self.handle.expect(
+                [
+                    'fatal',
+                    'Username\sfor\s(.*):\s',
+                    '\sfile(s*) changed,\s',
+                    'Already up-to-date',
+                    'Aborting',
+                    'You\sare\snot\scurrently\son\sa\sbranch',
+                    'You\sasked\sme\sto\spull\swithout\stelling\sme\swhich\
+                            \sbranch\syou',
+                    'Pull\sis\snot\spossible\sbecause\syou\shave\sunmerged\
+                            \sfiles',
+                    pexpect.TIMEOUT ],
+                timeout=300 )
             # debug
-           # main.log.report( self.name +": DEBUG:  \n"+"git pull response: " +
-           # str( self.handle.before ) + str( self.handle.after ) )
+            # main.log.report( self.name +": DEBUG:  \n"+
+            # "git pull response: " +
+            # str( self.handle.before ) + str( self.handle.after ) )
             if i == 0:
                 main.log.error( self.name + ": Git pull had some issue..." )
                 return main.ERROR
@@ -275,29 +275,35 @@
                     self.name +
                     ": Git Pull - pulling repository now" )
                 self.handle.expect( "ONOS\$", 120 )
-                return main.TRUE  # So that only when git pull is done, we do mvn clean compile
+            # So that only when git pull is done, we do mvn clean compile
+                return main.TRUE
             elif i == 3:
                 main.log.info( self.name + ": Git Pull - Already up to date" )
                 return i
             elif i == 4:
                 main.log.info(
                     self.name +
-                    ": Git Pull - Aborting... Are there conflicting git files?" )
+                    ": Git Pull - Aborting...\
+                            Are there conflicting git files?" )
                 return main.ERROR
             elif i == 5:
                 main.log.info(
                     self.name +
-                    ": Git Pull - You are not currently on a branch so git pull failed!" )
+                    ": Git Pull - You are not currently\
+                            on a branch so git pull failed!" )
                 return main.ERROR
             elif i == 6:
                 main.log.info(
                     self.name +
-                    ": Git Pull - You have not configured an upstream branch to pull from. Git pull failed!" )
+                    ": Git Pull - You have not configured\
+                             an upstream branch to pull from\
+                             . Git pull failed!" )
                 return main.ERROR
             elif i == 7:
                 main.log.info(
                     self.name +
-                    ": Git Pull - Pull is not possible because you have unmerged files." )
+                    ": Git Pull - Pull is not possible\
+                            because you have unmerged files." )
                 return main.ERROR
             elif i == 8:
                 main.log.error( self.name + ": Git Pull - TIMEOUT" )
@@ -316,21 +322,19 @@
             main.cleanup()
             main.exit()
         except:
-            main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+            main.log.info( self.name + ":" * 60 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 80 )
             main.cleanup()
             main.exit()
 
-    def git_checkout( self, branch="master" ):
+    def gitCheckout( self, branch="master" ):
         """
         Assumes that "git pull" works without login
 
         This function will perform a git git checkout on the ONOS instance.
-        If used as git_checkout( "branch" ) it will do git checkout of the "branch".
+        If used as gitCheckout( "branch" ) it will do git checkout
+        of the "branch".
 
         Otherwise, this function will perform a git checkout of the master
         branch of the ONOS repository. If it has any problems, it will return
@@ -350,14 +354,18 @@
             cmd = "git checkout " + branch
             self.handle.sendline( cmd )
             self.handle.expect( cmd )
-            i = self.handle.expect( [ 'fatal',
-                                    'Username\sfor\s(.*):\s',
-                                      'Already\son\s\'',
-                                      'Switched\sto\sbranch\s\'' +
-                                          str( branch ),
-                                      pexpect.TIMEOUT,
-                                      'error: Your local changes to the following files would be overwritten by checkout:',
-                                      'error: you need to resolve your current index first' ], timeout=60 )
+            i = self.handle.expect(
+                [
+                    'fatal',
+                    'Username\sfor\s(.*):\s',
+                    'Already\son\s\'',
+                    'Switched\sto\sbranch\s\'' +
+                    str( branch ),
+                    pexpect.TIMEOUT,
+                    'error: Your local changes to the following files\
+                            would be overwritten by checkout:',
+                    'error: you need to resolve your current index first' ],
+                timeout=60 )
 
             if i == 0:
                 main.log.error(
@@ -366,9 +374,11 @@
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.ERROR
             elif i == 1:
-                main.log.error( self.name + ": Git checkout asking for username."
-                                + " Please configure your local git repository to be able "
-                                + "to access your remote repository passwordlessly" )
+                main.log.error(
+                    self.name +
+                    ": Git checkout asking for username." +
+                    " Please configure your local git repository to be able " +
+                    "to access your remote repository passwordlessly" )
                 return main.ERROR
             elif i == 2:
                 main.log.info(
@@ -396,21 +406,28 @@
                 return main.ERROR
             elif i == 5:
                 self.handle.expect( "Aborting" )
-                main.log.error( self.name + ": Git checkout error: \n" +
-                                "Your local changes to the following files would be overwritten by checkout:" +
-                                str( self.handle.before ) )
+                main.log.error(
+                    self.name +
+                    ": Git checkout error: \n" +
+                    "Your local changes to the following\
+                            files would be overwritten by checkout:" +
+                    str(
+                        self.handle.before ) )
                 self.handle.expect( "ONOS\$" )
                 return main.ERROR
             elif i == 6:
-                main.log.error( self.name + ": Git checkout error: \n" +
-                                "You need to resolve your current index first:" +
+                main.log.error( self.name +
+                                ": Git checkout error: \n" +
+                                "You need to resolve your\
+                                        current index first:" +
                                 str( self.handle.before ) )
                 self.handle.expect( "ONOS\$" )
                 return main.ERROR
             else:
                 main.log.error(
                     self.name +
-                    ": Git Checkout - Unexpected response, check for pull errors" )
+                    ": Git Checkout - Unexpected response,\
+                            check for pull errors" )
                 main.log.error( self.name + ":     " + self.handle.before )
                 return main.ERROR
 
@@ -420,18 +437,16 @@
             main.cleanup()
             main.exit()
         except:
-            main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+            main.log.info( self.name + ":" * 60 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 80 )
             main.cleanup()
             main.exit()
 
-    def get_version( self, report=False ):
+    def getVersion( self, report=False ):
         """
-        Writes the COMMIT number to the report to be parsed by Jenkins data collecter.
+        Writes the COMMIT number to the report to be parsed\
+                by Jenkins data collecter.
         """
         try:
             self.handle.sendline( "export TERM=xterm-256color" )
@@ -442,7 +457,8 @@
             self.handle.sendline(
                 "cd " +
                 self.home +
-                "; git log -1 --pretty=fuller --decorate=short | grep -A 6 \"commit\" --color=never" )
+                "; git log -1 --pretty=fuller --decorate=short | grep -A 6\
+                        \"commit\" --color=never" )
             # NOTE: for some reason there are backspaces inserted in this
             # phrase when run from Jenkins on some tests
             self.handle.expect( "never" )
@@ -474,76 +490,73 @@
             main.cleanup()
             main.exit()
         except:
-            main.log.info(
-                self.name +
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
-            main.log.error( traceback.print_exc() )
-            main.log.info(
-                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
+            main.log.info( self.name + ":" * 60 )
+            main.log.error( traceback.printExc() )
+            main.log.info( ":" * 80 )
             main.cleanup()
             main.exit()
 
-    def create_cell_file( self, bench_ip, file_name, mn_ip_addrs,
-                          extra_feature_string, *onos_ip_addrs ):
+    def createCellFile( self, benchIp, fileName, mnIpAddrs,
+                         extraFeatureString, *onosIpAddrs ):
         """
         Creates a cell file based on arguments
         Required:
-            * Bench IP address ( bench_ip )
+            * Bench IP address ( benchIp )
                 - Needed to copy the cell file over
-            * File name of the cell file ( file_name )
-            * Mininet IP address ( mn_ip_addrs )
+            * File name of the cell file ( fileName )
+            * Mininet IP address ( mnIpAddrs )
                 - Note that only 1 ip address is
                   supported currently
-            * ONOS IP addresses ( onos_ip_addrs )
+            * ONOS IP addresses ( onosIpAddrs )
                 - Must be passed in as last arguments
 
         NOTE: Assumes cells are located at:
             ~/<self.home>/tools/test/cells/
         """
         # Variable initialization
-        cell_directory = self.home + "/tools/test/cells/"
+        cellDirectory = self.home + "/tools/test/cells/"
         # We want to create the cell file in the dependencies directory
         # of TestON first, then copy over to ONOS bench
-        temp_directory = "/tmp/"
+        tempDirectory = "/tmp/"
         # Create the cell file in the directory for writing ( w+ )
-        cell_file = open( temp_directory + file_name, 'w+' )
+        cellFile = open( tempDirectory + fileName, 'w+' )
 
         # Feature string is hardcoded environment variables
         # That you may wish to use by default on startup.
         # Note that you  may not want certain features listed
         # on here.
-        core_feature_string = "export ONOS_FEATURES=webconsole,onos-api," +\
-            "onos-cli,onos-openflow," + extra_feature_string
-        mn_string = "export OCN="
-        onos_string = "export OC"
-        temp_count = 1
+        coreFeatureString = "export ONOS_FEATURES=webconsole,onos-api," +\
+            "onos-cli,onos-openflow," + extraFeatureString
+        mnString = "export OCN="
+        onosString = "export OC"
+        tempCount = 1
 
-        # Create ONOS_NIC ip address prefix
-        temp_onos_ip = onos_ip_addrs[ 0 ]
-        temp_list = []
-        temp_list = temp_onos_ip.split( "." )
+        # Create ONOSNIC ip address prefix
+        tempOnosIp = onosIpAddrs[ 0 ]
+        tempList = []
+        tempList = tempOnosIp.split( "." )
         # Omit last element of list to format for NIC
-        temp_list = temp_list[ :-1 ]
+        tempList = tempList[ :-1 ]
         # Structure the nic string ip
-        nic_addr = ".".join( temp_list ) + ".*"
-        onos_nic_string = "export ONOS_NIC=" + nic_addr
+        nicAddr = ".".join( tempList ) + ".*"
+        onosNicString = "export ONOS_NIC=" + nicAddr
 
         try:
             # Start writing to file
-            cell_file.write( onos_nic_string + "\n" )
+            cellFile.write( onosNicString + "\n" )
 
-            for arg in onos_ip_addrs:
-                # For each argument in onos_ip_addrs, write to file
+            for arg in onosIpAddrs:
+                # For each argument in onosIpAddrs, write to file
                 # Output should look like the following:
                 #   export OC1="10.128.20.11"
                 #   export OC2="10.128.20.12"
-                cell_file.write( onos_string + str( temp_count ) +
-                                 "=" + "\"" + arg + "\"" + "\n" )
-                temp_count = temp_count + 1
+                cellFile.write( onosString + str( tempCount ) +
+                                "=" + "\"" + arg + "\"" + "\n" )
+                tempCount = tempCount + 1
 
-            cell_file.write( mn_string + "\"" + mn_ip_addrs + "\"" + "\n" )
-            cell_file.write( core_feature_string + "\n" )
-            cell_file.close()
+            cellFile.write( mnString + "\"" + mnIpAddrs + "\"" + "\n" )
+            cellFile.write( coreFeatureString + "\n" )
+            cellFile.close()
 
             # We use os.system to send the command to TestON cluster
             # to account for the case in which TestON is not located
@@ -551,8 +564,8 @@
             # Note that even if TestON is located on the same cluster
             # as ONOS bench, you must setup passwordless ssh
             # between TestON and ONOS bench in order to automate the test.
-            os.system( "scp " + temp_directory + file_name +
-                       " admin@" + bench_ip + ":" + cell_directory )
+            os.system( "scp " + tempDirectory + fileName +
+                       " admin@" + benchIp + ":" + cellDirectory )
 
             return main.TRUE
 
@@ -563,12 +576,12 @@
             main.exit()
         except:
             main.log.info( self.name + ":::::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( ":::::::" )
             main.cleanup()
             main.exit()
 
-    def set_cell( self, cellname ):
+    def setCell( self, cellname ):
         """
         Calls 'cell <name>' to set the environment variables on ONOSbench
         """
@@ -579,19 +592,19 @@
                 main.exit()
             else:
                 self.handle.sendline( "cell " + str( cellname ) )
-                # Expect the cellname in the ONOS_CELL variable.
+                # Expect the cellname in the ONOSCELL variable.
                 # Note that this variable name is subject to change
                 #   and that this driver will have to change accordingly
                 self.handle.expect( "ONOS_CELL=" + str( cellname ) )
-                handle_before = self.handle.before
-                handle_after = self.handle.after
+                handleBefore = self.handle.before
+                handleAfter = self.handle.after
                 # Get the rest of the handle
                 self.handle.sendline( "" )
                 self.handle.expect( "\$" )
-                handle_more = self.handle.before
+                handleMore = self.handle.before
 
-                main.log.info( "Cell call returned: " + handle_before +
-                               handle_after + handle_more )
+                main.log.info( "Cell call returned: " + handleBefore +
+                               handleAfter + handleMore )
 
                 return main.TRUE
 
@@ -602,12 +615,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def verify_cell( self ):
+    def verifyCell( self ):
         """
         Calls 'onos-verify-cell' to check for cell installation
         """
@@ -619,15 +632,15 @@
             self.handle.expect( "\$" )
             self.handle.sendline( "onos-verify-cell" )
             self.handle.expect( "\$" )
-            handle_before = self.handle.before
-            handle_after = self.handle.after
+            handleBefore = self.handle.before
+            handleAfter = self.handle.after
             # Get the rest of the handle
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            handle_more = self.handle.before
+            handleMore = self.handle.before
 
-            main.log.info( "Verify cell returned: " + handle_before +
-                           handle_after + handle_more )
+            main.log.info( "Verify cell returned: " + handleBefore +
+                           handleAfter + handleMore )
 
             return main.TRUE
         except pexpect.EOF:
@@ -637,16 +650,16 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_cli( self, ONOS_ip, cmdstr ):
+    def onosCli( self, ONOSIp, cmdstr ):
         """
         Uses 'onos' command to send various ONOS CLI arguments.
         Required:
-            * ONOS_ip: specify the ip of the cell machine
+            * ONOSIp: specify the ip of the cell machine
             * cmdstr: specify the command string to send
 
         This function is intended to expose the entire karaf
@@ -659,7 +672,7 @@
         available commands.
         """
         try:
-            if not ONOS_ip:
+            if not ONOSIp:
                 main.log.error( "You must specify the IP address" )
                 return main.FALSE
             if not cmdstr:
@@ -670,26 +683,26 @@
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
 
-            self.handle.sendline( "onos -w " + ONOS_ip + " " + cmdstr )
+            self.handle.sendline( "onos -w " + ONOSIp + " " + cmdstr )
             self.handle.expect( "\$" )
 
-            handle_before = self.handle.before
+            handleBefore = self.handle.before
             print "handle_before = ", self.handle.before
-            # handle_after = str( self.handle.after )
+            # handleAfter = str( self.handle.after )
 
             # self.handle.sendline( "" )
             # self.handle.expect( "\$" )
-            # handle_more = str( self.handle.before )
+            # handleMore = str( self.handle.before )
 
             main.log.info( "Command sent successfully" )
 
             # Obtain return handle that consists of result from
             # the onos command. The string may need to be
             # configured further.
-            # return_string = handle_before + handle_after
-            return_string = handle_before
-            print "return_string = ", return_string
-            return return_string
+            # returnString = handleBefore + handleAfter
+            returnString = handleBefore
+            print "return_string = ", returnString
+            return returnString
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -698,12 +711,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_install( self, options="-f", node="" ):
+    def onosInstall( self, options="-f", node="" ):
         """
         Installs ONOS bits on the designated cell machine.
         If -f option is provided, it also forces an uninstall.
@@ -723,7 +736,7 @@
             # NOTE: this timeout may need to change depending on the network
             # and size of ONOS
             i = self.handle.expect( [ "Network\sis\sunreachable",
-                                    "onos\sstart/running,\sprocess",
+                                      "onos\sstart/running,\sprocess",
                                       "ONOS\sis\salready\sinstalled",
                                       pexpect.TIMEOUT ], timeout=60 )
 
@@ -753,12 +766,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_start( self, node_ip ):
+    def onosStart( self, nodeIp ):
         """
         Calls onos command: 'onos-service [<node-ip>] start'
         This command is a remote management of the ONOS upstart daemon
@@ -766,7 +779,7 @@
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            self.handle.sendline( "onos-service " + str( node_ip ) +
+            self.handle.sendline( "onos-service " + str( nodeIp ) +
                                   " start" )
             i = self.handle.expect( [
                 "Job\sis\salready\srunning",
@@ -791,12 +804,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_stop( self, node_ip ):
+    def onosStop( self, nodeIp ):
         """
         Calls onos command: 'onos-service [<node-ip>] stop'
         This command is a remote management of the ONOS upstart daemon
@@ -804,7 +817,7 @@
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            self.handle.sendline( "onos-service " + str( node_ip ) +
+            self.handle.sendline( "onos-service " + str( nodeIp ) +
                                   " stop" )
             i = self.handle.expect( [
                 "stop/waiting",
@@ -816,7 +829,7 @@
                 return main.TRUE
             elif i == 1:
                 main.log.info( "Unknown ONOS instance specified: " +
-                               str( node_ip ) )
+                               str( nodeIp ) )
                 return main.FALSE
             else:
                 main.log.error( "ONOS service failed to stop" )
@@ -829,12 +842,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_uninstall( self, node_ip="" ):
+    def onosUninstall( self, nodeIp="" ):
         """
         Calls the command: 'onos-uninstall'
         Uninstalls ONOS from the designated cell machine, stopping
@@ -843,10 +856,10 @@
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            self.handle.sendline( "onos-uninstall " + str( node_ip ) )
+            self.handle.sendline( "onos-uninstall " + str( nodeIp ) )
             self.handle.expect( "\$" )
 
-            main.log.info( "ONOS " + node_ip + " was uninstalled" )
+            main.log.info( "ONOS " + nodeIp + " was uninstalled" )
 
             # onos-uninstall command does not return any text
             return main.TRUE
@@ -858,12 +871,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_die( self, node_ip ):
+    def onosDie( self, nodeIp ):
         """
         Issues the command 'onos-die <node-ip>'
         This command calls onos-kill and also stops the node
@@ -871,14 +884,14 @@
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            cmd_str = "onos-kill " + str( node_ip )
-            self.handle.sendline( cmd_str )
+            cmdStr = "onos-kill " + str( nodeIp )
+            self.handle.sendline( cmdStr )
             i = self.handle.expect( [
                 "Killing\sONOS",
                 "ONOS\sprocess\sis\snot\srunning",
                 pexpect.TIMEOUT ], timeout=20 )
             if i == 0:
-                main.log.info( "ONOS instance " + str( node_ip ) +
+                main.log.info( "ONOS instance " + str( nodeIp ) +
                                " was killed and stopped" )
                 return main.TRUE
             elif i == 1:
@@ -891,12 +904,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_kill( self, node_ip ):
+    def onosKill( self, nodeIp ):
         """
         Calls the command: 'onos-kill [<node-ip>]'
         "Remotely, and unceremoniously kills the ONOS instance running on
@@ -905,7 +918,7 @@
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
-            self.handle.sendline( "onos-kill " + str( node_ip ) )
+            self.handle.sendline( "onos-kill " + str( nodeIp ) )
             i = self.handle.expect( [
                 "\$",
                 "No\sroute\sto\shost",
@@ -915,14 +928,16 @@
             if i == 0:
                 main.log.info(
                     "ONOS instance " + str(
-                        node_ip ) + " was killed" )
+                        nodeIp ) + " was killed" )
                 return main.TRUE
             elif i == 1:
                 main.log.info( "No route to host" )
                 return main.FALSE
             elif i == 2:
-                main.log.info( "Passwordless login for host: " + str( node_ip ) +
-                               " not configured" )
+                main.log.info(
+                    "Passwordless login for host: " +
+                    str( nodeIp ) +
+                    " not configured" )
                 return main.FALSE
             else:
                 main.log.info( "ONOS instasnce was not killed" )
@@ -935,12 +950,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_remove_raft_logs( self ):
+    def onosRemoveRaftLogs( self ):
         """
         Removes Raft / Copy cat files from ONOS to ensure
         a cleaner environment.
@@ -972,12 +987,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def onos_start_network( self, mntopo ):
+    def onosStartNetwork( self, mntopo ):
         """
         Calls the command 'onos-start-network [ <mininet-topo> ]
         "remotely starts the specified topology on the cell's
@@ -1011,7 +1026,7 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
@@ -1045,54 +1060,62 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def push_test_intents_shell( self, dpid_src, dpid_dst, num_intents,
-                                 dir_file, onos_ip, num_mult="", app_id="", report=True,
-                                 options="" ):
+    def pushTestIntentsShell(
+            self,
+            dpidSrc,
+            dpidDst,
+            numIntents,
+            dirFile,
+            onosIp,
+            numMult="",
+            appId="",
+            report=True,
+            options="" ):
         """
         Description:
             Use the linux prompt to push test intents to
             better parallelize the results than the CLI
         Required:
-            * dpid_src: specify source dpid
-            * dpid_dst: specify destination dpid
-            * num_intents: specify number of intents to push
-            * dir_file: specify directory and file name to save
+            * dpidSrc: specify source dpid
+            * dpidDst: specify destination dpid
+            * numIntents: specify number of intents to push
+            * dirFile: specify directory and file name to save
               results
-            * onos_ip: specify the IP of ONOS to install on
+            * onosIp: specify the IP of ONOS to install on
         NOTE:
             You must invoke this command at linux shell prompt
         """
         try:
             # Create the string to sendline
             if options:
-                base_cmd = "onos " + str( onos_ip ) + " push-test-intents " +\
+                baseCmd = "onos " + str( onosIp ) + " push-test-intents " +\
                     options + " "
             else:
-                base_cmd = "onos " + str( onos_ip ) + " push-test-intents "
+                baseCmd = "onos " + str( onosIp ) + " push-test-intents "
 
-            add_dpid = base_cmd + str( dpid_src ) + " " + str( dpid_dst )
-            if not num_mult:
-                add_intents = add_dpid + " " + str( num_intents )
-            elif num_mult:
-                add_intents = add_dpid + " " + str( num_intents ) + " " +\
-                    str( num_mult )
-                if app_id:
-                    add_app = add_intents + " " + str( app_id )
+            addDpid = baseCmd + str( dpidSrc ) + " " + str( dpidDst )
+            if not numMult:
+                addIntents = addDpid + " " + str( numIntents )
+            elif numMult:
+                addIntents = addDpid + " " + str( numIntents ) + " " +\
+                    str( numMult )
+                if appId:
+                    addApp = addIntents + " " + str( appId )
                 else:
-                    add_app = add_intents
+                    addApp = addIntents
 
             if report:
-                send_cmd = add_app + " > " + str( dir_file ) + " &"
+                sendCmd = addApp + " > " + str( dirFile ) + " &"
             else:
-                send_cmd = add_app + " &"
-            main.log.info( "Send cmd: " + send_cmd )
+                sendCmd = addApp + " &"
+            main.log.info( "Send cmd: " + sendCmd )
 
-            self.handle.sendline( send_cmd )
+            self.handle.sendline( sendCmd )
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1101,12 +1124,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def get_topology( self, topology_output ):
+    def getTopology( self, topologyOutput ):
         """
         parses the onos:topology output
         Returns: a topology dict populated by the key values found in
@@ -1115,13 +1138,13 @@
         try:
             # call the cli to get the topology summary
             # cmdstr = "onos:topology"
-            # cli_result = self.onos_cli( ip, cmdstr )
-            # print "cli_result = ", cli_result
+            # cliResult = self.onosCli( ip, cmdstr )
+            # print "cli_result = ", cliResult
 
             # Parse the output
             topology = {}
-            # for line in cli_result.split( "\n" ):
-            for line in topology_output.splitlines():
+            # for line in cliResult.split( "\n" ):
+            for line in topologyOutput.splitlines():
                 if not line.startswith( "time=" ):
                     continue
                 # else
@@ -1149,17 +1172,17 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def check_status(
-        self,
-        topology_result,
-        numoswitch,
-        numolink,
-        log_level="info" ):
+    def checkStatus(
+            self,
+            topologyResult,
+            numoswitch,
+            numolink,
+            logLevel="info" ):
         """
         Checks the number of swithes & links that ONOS sees against the
         supplied values. By default this will report to main.log, but the
@@ -1168,42 +1191,46 @@
         Params: ip = ip used for the onos cli
                 numoswitch = expected number of switches
                 numlink = expected number of links
-                log_level = level to log to. Currently accepts 'info', 'warn' and 'report'
+                logLevel = level to log to.
+                Currently accepts 'info', 'warn' and 'report'
 
 
-        log_level can
+        logLevel can
 
         Returns: main.TRUE if the number of switchs and links are correct,
                  main.FALSE if the numer of switches and links is incorrect,
                  and main.ERROR otherwise
         """
         try:
-            topology = self.get_topology( topology_result )
+            topology = self.getTopology( topologyResult )
             if topology == {}:
                 return main.ERROR
             output = ""
             # Is the number of switches is what we expected
             devices = topology.get( 'devices', False )
             links = topology.get( 'links', False )
-            if devices == False or links == False:
+            if not devices or not links:
                 return main.ERROR
-            switch_check = ( int( devices ) == int( numoswitch ) )
+            switchCheck = ( int( devices ) == int( numoswitch ) )
             # Is the number of links is what we expected
-            link_check = ( int( links ) == int( numolink ) )
-            if ( switch_check and link_check ):
+            linkCheck = ( int( links ) == int( numolink ) )
+            if ( switchCheck and linkCheck ):
                 # We expected the correct numbers
                 output = output + "The number of links and switches match "\
                     + "what was expected"
                 result = main.TRUE
             else:
                 output = output + \
-                    "The number of links and switches does not match what was expected"
+                    "The number of links and switches does not match\
+                    what was expected"
                 result = main.FALSE
-            output = output + "\n ONOS sees %i devices (%i expected) and %i links (%i expected)"\
-                % ( int( devices ), int( numoswitch ), int( links ), int( numolink ) )
-            if log_level == "report":
+            output = output + "\n ONOS sees %i devices (%i expected)\
+                     and %i links (%i expected)" %\
+                     ( int( devices ), int( numoswitch ),
+                       int( links ), int( numolink ) )
+            if logLevel == "report":
                 main.log.report( output )
-            elif log_level == "warn":
+            elif logLevel == "warn":
                 main.log.warn( output )
             else:
                 main.log.info( output )
@@ -1215,12 +1242,12 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def tshark_pcap( self, interface, dir_file ):
+    def tsharkPcap( self, interface, dirFile ):
         """
         Capture all packet activity and store in specified
         directory/file
@@ -1233,7 +1260,7 @@
         self.handle.expect( "\$" )
 
         self.handle.sendline( "tshark -i " + str( interface ) +
-                              " -t e -w " + str( dir_file ) + " &" )
+                              " -t e -w " + str( dirFile ) + " &" )
         self.handle.sendline( "\r" )
         self.handle.expect( "Capturing on" )
         self.handle.sendline( "\r" )
@@ -1241,19 +1268,21 @@
 
         main.log.info( "Tshark started capturing files on " +
                        str( interface ) + " and saving to directory: " +
-                       str( dir_file ) )
+                       str( dirFile ) )
 
-    def run_onos_topo_cfg( self, instance_name, json_file ):
+    def runOnosTopoCfg( self, instanceName, jsonFile ):
         """
-         On ONOS bench, run this command: ./~/ONOS/tools/test/bin/onos-topo-cfg $OC1 filename
-            which starts the rest and copies the json file to the onos instance
+         On ONOS bench, run this command:
+         ./~/ONOS/tools/test/bin/onos-topo-cfg $OC1 filename
+         which starts the rest and copies
+         the json file to the onos instance
         """
         try:
             self.handle.sendline( "" )
             self.handle.expect( "\$" )
             self.handle.sendline( "cd ~/ONOS/tools/test/bin" )
             self.handle.expect( "/bin$" )
-            cmd = "./onos-topo-cfg " + instance_name + " " + json_file
+            cmd = "./onos-topo-cfg " + instanceName + " " + jsonFile
             print "cmd = ", cmd
             self.handle.sendline( cmd )
             self.handle.expect( "\$" )
@@ -1263,7 +1292,7 @@
         except:
             return main.FALSE
 
-    def tshark_grep( self, grep, directory, interface='eth0' ):
+    def tsharkGrep( self, grep, directory, interface='eth0' ):
         """
         Required:
             * grep string
@@ -1278,14 +1307,20 @@
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
         self.handle.sendline( "" )
-        self.handle.sendline( "tshark -i " + str( interface ) +
-                              " -t e | grep --line-buffered \"" + str(grep) + "\" >" + directory + " &" )
+        self.handle.sendline(
+            "tshark -i " +
+            str( interface ) +
+            " -t e | grep --line-buffered \"" +
+            str(grep) +
+            "\" >" +
+            directory +
+            " &" )
         self.handle.sendline( "\r" )
         self.handle.expect( "Capturing on" )
         self.handle.sendline( "\r" )
         self.handle.expect( "\$" )
 
-    def tshark_stop( self ):
+    def tsharkStop( self ):
         """
         Removes wireshark files from /tmp and kills all tshark processes
         """
@@ -1332,13 +1367,13 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
 
-    def cp_logs_to_dir( self, log_to_copy,
-                        dest_dir, copy_file_name="" ):
+    def cpLogsToDir( self, logToCopy,
+                       destDir, copyFileName="" ):
         """
         Copies logs to a desired directory.
         Current implementation of ONOS deletes its karaf
@@ -1348,17 +1383,17 @@
         Localtime will be attached to the filename
 
         Required:
-            * log_to_copy: specify directory and log name to
+            * logToCopy: specify directory and log name to
               copy.
               ex ) /opt/onos/log/karaf.log.1
-              For copying multiple files, leave copy_file_name
-              empty and only specify dest_dir -
+              For copying multiple files, leave copyFileName
+              empty and only specify destDir -
               ex ) /opt/onos/log/karaf*
-            * dest_dir: specify directory to copy to.
+            * destDir: specify directory to copy to.
               ex ) /tmp/
         Optional:
-            * copy_file_name: If you want to rename the log
-              file, specify copy_file_name. This will not work
+            * copyFileName: If you want to rename the log
+              file, specify copyFileName. This will not work
               with multiple file copying
         """
         try:
@@ -1366,18 +1401,22 @@
             localtime = localtime.replace( "/", "" )
             localtime = localtime.replace( " ", "_" )
             localtime = localtime.replace( ":", "" )
-            if dest_dir[ -1: ] != "/":
-                dest_dir += "/"
+            if destDir[ -1: ] != "/":
+                destDir += "/"
 
-            if copy_file_name:
-                self.handle.sendline( "cp " + str( log_to_copy ) +
-                                      " " + str( dest_dir ) + str( copy_file_name ) +
-                                      localtime )
+            if copyFileName:
+                self.handle.sendline(
+                    "cp " +
+                    str( logToCopy ) +
+                    " " +
+                    str( destDir ) +
+                    str( copyFileName ) +
+                    localtime )
                 self.handle.expect( "cp" )
                 self.handle.expect( "\$" )
             else:
-                self.handle.sendline( "cp " + str( log_to_copy ) +
-                                      " " + str( dest_dir ) )
+                self.handle.sendline( "cp " + str( logToCopy ) +
+                                      " " + str( destDir ) )
                 self.handle.expect( "cp" )
                 self.handle.expect( "\$" )
 
@@ -1390,16 +1429,16 @@
         except:
             main.log.error( "Copying files failed" )
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
 
-    def check_logs( self, onos_ip ):
+    def checkLogs( self, onosIp ):
         """
         runs onos-check-logs on the given onos node
         returns the response
         """
         try:
-            cmd = "onos-check-logs " + str( onos_ip )
+            cmd = "onos-check-logs " + str( onosIp )
             self.handle.sendline( cmd )
             self.handle.expect( cmd )
             self.handle.expect( "\$" )
@@ -1412,10 +1451,10 @@
         except:
             main.log.error( "Some error in check_logs:" )
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
 
-    def onos_status( self, node="" ):
+    def onosStatus( self, node="" ):
         """
         Calls onos command: 'onos-service [<node-ip>] status'
         """
@@ -1446,7 +1485,7 @@
             main.exit()
         except:
             main.log.info( self.name + " ::::::" )
-            main.log.error( traceback.print_exc() )
+            main.log.error( traceback.printExc() )
             main.log.info( self.name + " ::::::" )
             main.cleanup()
             main.exit()
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py b/TestON/drivers/common/cli/quaggaclidriver.py
index 28f95af..f0cfecc 100644
--- a/TestON/drivers/common/cli/quaggaclidriver.py
+++ b/TestON/drivers/common/cli/quaggaclidriver.py
@@ -26,21 +26,21 @@
 
         self.name = self.options[ 'name' ]
         # self.handle = super( QuaggaCliDriver,self ).connect(
-        # user_name=self.user_name, ip_address=self.ip_address,port=self.port,
+        # userName=self.userName, ipAddress=self.ipAddress,port=self.port,
         # pwd=self.pwd )
         self.handle = super(
             QuaggaCliDriver,
             self ).connect(
-                user_name=self.user_name,
-         ip_address="1.1.1.1",
-         port=self.port,
-         pwd=self.pwd )
+                userName=self.userName,
+            ipAddress="1.1.1.1",
+            port=self.port,
+            pwd=self.pwd )
         main.log.info(
             "connect parameters:" + str(
-                self.user_name ) + ";" + str(
-                    self.ip_address ) + ";" + str(
-                 self.port ) + ";" + str(
-                     self.pwd ) )
+                self.userName ) + ";" + str(
+                    self.ipAddress ) + ";" + str(
+                self.port ) + ";" + str(
+                self.pwd ) )
 
         if self.handle:
             # self.handle.expect( "",timeout=10 )
@@ -59,13 +59,19 @@
             main.log.info( "NO HANDLE" )
             return main.FALSE
 
-    def loginQuagga( self, ip_address ):
+    def loginQuagga( self, ipAddress ):
         self.name = self.options[ 'name' ]
         self.handle = super( QuaggaCliDriver, self ).connect(
-            user_name=self.user_name, ip_address=ip_address,
+            userName=self.userName, ipAddress=ipAddress,
             port=self.port, pwd=self.pwd )
-        main.log.info( "connect parameters:" + str( self.user_name ) + ";"
-                       + str( self.ip_address ) + ";" + str( self.port ) + ";" + str( self.pwd ) )
+        main.log.info( "connect parameters:" +
+                       str( self.userName ) +
+                       ";" +
+                       str( self.ipAddress ) +
+                       ";" +
+                       str( self.port ) +
+                       ";" +
+                       str( self.pwd ) )
 
         if self.handle:
             # self.handle.expect( "" )
@@ -79,14 +85,14 @@
             self.handle.sendline( "enable" )
             # self.handle.expect( "bgpd#", timeout=5 )
             self.handle.expect( "bgpd#" )
-            main.log.info( "I in quagga on host " + str( ip_address ) )
+            main.log.info( "I in quagga on host " + str( ipAddress ) )
 
             return self.handle
         else:
             main.log.info( "NO HANDLE" )
             return main.FALSE
 
-    def enter_config( self, asn ):
+    def enterConfig( self, asn ):
         main.log.info( "I am in enter_config method!" )
         try:
             self.handle.sendline( "" )
@@ -105,13 +111,14 @@
         except:
             return main.FALSE
 
-    def generate_prefixes( self, net, numRoutes ):
+    def generatePrefixes( self, net, numRoutes ):
         main.log.info( "I am in generate_prefixes method!" )
 
-        # each IP prefix will be composed by "net" + "." + m + "." + n + "." + x
+        # each IP prefix will be composed by
+        #"net" + "." + m + "." + n + "." + x
         # the length of each IP prefix is 24
         routes = []
-        routes_gen = 0
+        routesGen = 0
         m = numRoutes / 256
         n = numRoutes % 256
 
@@ -122,14 +129,14 @@
                         i ) + "." + str(
                             j ) + ".0/24"
                 routes.append( network )
-                routes_gen = routes_gen + 1
+                routesGen = routesGen + 1
 
         for j in range( 0, n ):
             network = str( net ) + "." + str( m ) + "." + str( j ) + ".0/24"
             routes.append( network )
-            routes_gen = routes_gen + 1
+            routesGen = routesGen + 1
 
-        if routes_gen == numRoutes:
+        if routesGen == numRoutes:
             main.log.info( "Successfully generated " + str( numRoutes )
                            + " prefixes!" )
             return routes
@@ -137,17 +144,25 @@
 
     # This method generates a multiple to single point intent(
     # MultiPointToSinglePointIntent ) for a given route
-    def generate_expected_singleRouteIntent( self, prefix, nextHop, nextHopMac, sdnip_data ):
+    def generateExpectedSingleRouteIntent(
+            self,
+            prefix,
+            nextHop,
+            nextHopMac,
+            sdnipData ):
 
         ingress = []
         egress = ""
-        for peer in sdnip_data[ 'bgpPeers' ]:
+        for peer in sdnipData[ 'bgpPeers' ]:
             if peer[ 'ipAddress' ] == nextHop:
-                egress = "of:" + str( peer[ 'attachmentDpid' ] ).replace( ":", "" ) + ":" + str( peer[ 'attachmentPort' ] )
+                egress = "of:" + \
+                    str( peer[ 'attachmentDpid' ] ).replace( ":", "" ) + ":" +\
+                    str( peer[ 'attachmentPort' ] )
             else:
-                ingress.append( "of:" +  \
-                         str( peer[ 'attachmentDpid' ] ).replace( ":",
-                         "" ) + ":" + str( peer[ 'attachmentPort' ] ) )
+                ingress.append( "of:" +
+                                str( peer[ 'attachmentDpid' ] ).replace( ":",
+                                     "" ) + ":" +
+                                str( peer[ 'attachmentPort' ] ) )
 
         selector = "ETH_TYPE{ethType=800},IPV4_DST{ip=" + prefix + "}"
         treatment = "[ETH_DST{mac=" + str( nextHopMac ) + "}]"
@@ -156,57 +171,63 @@
             str( sorted( ingress ) ) + "/" + selector + "/" + treatment
         return intent
 
-    def generate_expected_onePeerRouteIntents( self, prefixes, nextHop, nextHopMac, sdnip_json_file_path ):
+    def generateExpectedOnePeerRouteIntents(
+            self,
+            prefixes,
+            nextHop,
+            nextHopMac,
+            sdnipJsonFilePath ):
         intents = []
-        sdnip_json_file = open( sdnip_json_file_path ).read()
+        sdnipJsonFile = open( sdnipJsonFilePath ).read()
 
-        sdnip_data = json.loads( sdnip_json_file )
+        sdnipData = json.loads( sdnipJsonFile )
 
         for prefix in prefixes:
             intents.append(
-                self.generate_expected_singleRouteIntent(
+                self.generateExpectedSingleRouteIntent(
                     prefix,
                     nextHop,
                     nextHopMac,
-                    sdnip_data ) )
+                    sdnipData ) )
         return sorted( intents )
 
     # TODO
     # This method generates all expected route intents for all BGP peers
-    def generate_expected_routeIntents( self ):
+    def generateExpectedRouteIntents( self ):
         intents = []
         return intents
 
     # This method extracts all actual routes from ONOS CLI
-    def extract_actual_routes( self, get_routes_result ):
-        routes_json_obj = json.loads( get_routes_result )
+    def extractActualRoutes( self, getRoutesResult ):
+        routesJsonObj = json.loads( getRoutesResult )
 
-        allRoutes_actual = []
-        for route in routes_json_obj:
+        allRoutesActual = []
+        for route in routesJsonObj:
             if route[ 'prefix' ] == '172.16.10.0/24':
                 continue
-            allRoutes_actual.append(
+            allRoutesActual.append(
                 route[ 'prefix' ] + "/" + route[ 'nextHop' ] )
 
-        return sorted( allRoutes_actual )
+        return sorted( allRoutesActual )
 
     # This method extracts all actual route intents from ONOS CLI
-    def extract_actual_routeIntents( self, get_intents_result ):
+    def extractActualRouteIntents( self, getIntentsResult ):
         intents = []
         # TODO: delete the line below when change to Mininet demo script
-        # get_intents_result=open( "../tests/SdnIpTest/intents.json" ).read()
-        intents_json_obj = json.loads( get_intents_result )
+        # getIntentsResult=open( "../tests/SdnIpTest/intents.json" ).read()
+        intentsJsonObj = json.loads( getIntentsResult )
 
-        for intent in intents_json_obj:
+        for intent in intentsJsonObj:
             if intent[ 'appId' ] != "org.onosproject.sdnip":
                 continue
-            if intent[ 'type' ] == "MultiPointToSinglePointIntent" and intent[ 'state' ] == 'INSTALLED':
+            if intent[ 'type' ] == "MultiPointToSinglePointIntent" and intent[
+                    'state' ] == 'INSTALLED':
                 egress = str( intent[ 'egress' ][ 'device' ] ) + ":" + str(
                     intent[ 'egress' ][ 'port' ] )
                 ingress = []
                 for attachmentPoint in intent[ 'ingress' ]:
-                    ingress.append(
-                        str( attachmentPoint[ 'device' ] ) + ":" + str( attachmentPoint[ 'port' ] ) )
+                    ingress.append( str( attachmentPoint[ 'device' ] ) +
+                            ":" + str( attachmentPoint[ 'port' ] ) )
 
                 selector = intent[ 'selector' ].replace(
                     "[", "" ).replace( "]", "" ).replace( " ", "" )
@@ -216,27 +237,34 @@
 
                 intent = egress + "/" + \
                     str( sorted( ingress ) ) + "/" + \
-                        selector + "/" + intent[ 'treatment' ]
+                    selector + "/" + intent[ 'treatment' ]
                 intents.append( intent )
         return sorted( intents )
 
     # This method extracts all actual BGP intents from ONOS CLI
-    def extract_actual_bgpIntents( self, get_intents_result ):
+    def extractActualBgpIntents( self, getIntentsResult ):
         intents = []
         # TODO: delete the line below when change to Mininet demo script
-        # get_intents_result=open( "../tests/SdnIpTest/intents.json" ).read()
-        intents_json_obj = json.loads( get_intents_result )
+        # getIntentsResult=open( "../tests/SdnIpTest/intents.json" ).read()
+        intentsJsonObj = json.loads( getIntentsResult )
 
-        for intent in intents_json_obj:
+        for intent in intentsJsonObj:
             if intent[ 'appId' ] != "org.onosproject.sdnip":
                 continue
-            if intent[ 'type' ] == "PointToPointIntent" and "protocol=6" in str( intent[ 'selector' ] ):
+            if intent[ 'type' ] == "PointToPointIntent" and "protocol=6"\
+                    in str(  intent[ 'selector' ] ):
                 ingress = str( intent[ 'ingress' ][ 'device' ] ) + ":" + str(
                     intent[ 'ingress' ][ 'port' ] )
                 egress = str( intent[ 'egress' ][ 'device' ] ) + ":" + str(
                     intent[ 'egress' ][ 'port' ] )
                 selector = str(
-                    intent[ 'selector' ] ).replace( " ", "" ).replace( "[", "" ).replace( "]", "" ).split( "," )
+                    intent[ 'selector' ] ).replace(
+                    " ",
+                    "" ).replace(
+                    "[",
+                    "" ).replace(
+                    "]",
+                    "" ).split( "," )
                 intent = ingress + "/" + egress + \
                     "/" + str( sorted( selector ) )
                 intents.append( intent )
@@ -245,28 +273,35 @@
 
     # This method generates a single point to single point intent(
     # PointToPointIntent ) for BGP path
-    def generate_expected_bgpIntents( self, sdnip_json_file_path ):
+    def generateExpectedBgpIntents( self, sdnipJsonFilePath ):
         from operator import eq
 
-        sdnip_json_file = open( sdnip_json_file_path ).read()
-        sdnip_data = json.loads( sdnip_json_file )
+        sdnipJsonFile = open( sdnipJsonFilePath ).read()
+        sdnipData = json.loads( sdnipJsonFile )
 
         intents = []
         bgpPeerAttachmentPoint = ""
         bgpSpeakerAttachmentPoint = "of:" + str(
-            sdnip_data[ 'bgpSpeakers' ][ 0 ][ 'attachmentDpid' ] ).replace( ":",
-                                                                            "" ) + ":" + str( sdnip_data[ 'bgpSpeakers' ][ 0 ][ 'attachmentPort' ] )
-        for peer in sdnip_data[ 'bgpPeers' ]:
-            bgpPeerAttachmentPoint = "of:" + str(
-                peer[ 'attachmentDpid' ] ).replace( ":", "" ) + ":" + str( peer[ 'attachmentPort' ] )
+            sdnipData[ 'bgpSpeakers' ][ 0 ][ 'attachmentDpid' ] ).replace( ":",
+             "" ) + ":" +\
+                     str( sdnipData[ 'bgpSpeakers' ][ 0 ][ 'attachmentPort' ] )
+        for peer in sdnipData[ 'bgpPeers' ]:
+            bgpPeerAttachmentPoint = "of:" + \
+                str( peer[ 'attachmentDpid' ] ).replace( ":", "" ) +\
+                ":" + str( peer[ 'attachmentPort' ] )
             # find out the BGP speaker IP address for this BGP peer
             bgpSpeakerIpAddress = ""
-            for interfaceAddress in sdnip_data[ 'bgpSpeakers' ][ 0 ][ 'interfaceAddresses' ]:
-                # if eq( interfaceAddress[ 'interfaceDpid' ],sdnip_data[
+            for interfaceAddress in sdnipData[
+                    'bgpSpeakers' ][ 0 ][ 'interfaceAddresses' ]:
+                # if eq( interfaceAddress[ 'interfaceDpid' ],sdnipData[
                 # 'bgpSpeakers' ][ 0 ][ 'attachmentDpid' ] ) and eq(
-                # interfaceAddress[ 'interfacePort' ], sdnip_data[
+                # interfaceAddress[ 'interfacePort' ], sdnipData[
                 # 'bgpSpeakers' ][ 0 ][ 'attachmentPort' ] ):
-                if eq( interfaceAddress[ 'interfaceDpid' ], peer[ 'attachmentDpid' ] ) and eq( interfaceAddress[ 'interfacePort' ], peer[ 'attachmentPort' ] ):
+                if eq(
+                        interfaceAddress[ 'interfaceDpid' ],
+                        peer[ 'attachmentDpid' ] ) and eq(
+                        interfaceAddress[ 'interfacePort' ],
+                        peer[ 'attachmentPort' ] ):
                     bgpSpeakerIpAddress = interfaceAddress[ 'ipAddress' ]
                     break
                 else:
@@ -274,17 +309,21 @@
 
             # from bgpSpeakerAttachmentPoint to bgpPeerAttachmentPoint
             # direction
-            selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer[
-                'ipAddress' ] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
+            selectorStr = "IPV4_SRC{ip=" + bgpSpeakerIpAddress +\
+                    "/32}," + "IPV4_DST{ip=" + peer[ 'ipAddress' ] + "/32}," +\
+                        "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800},\
+                        TCP_DST{tcpPort=179}"
+            selector = selectorStr.replace( " ", "" ).replace(
                 "[", "" ).replace( "]", "" ).split( "," )
             intent = bgpSpeakerAttachmentPoint + "/" + \
                 bgpPeerAttachmentPoint + "/" + str( sorted( selector ) )
             intents.append( intent )
 
-            selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer[
-                'ipAddress' ] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
+            selectorStr = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," +\
+                    "IPV4_DST{ip=" + peer[ 'ipAddress' ] + "/32}," +\
+                    "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800},\
+                    TCP_SRC{tcpPort=179}"
+            selector = selectorStr.replace( " ", "" ).replace(
                 "[", "" ).replace( "]", "" ).split( "," )
             intent = bgpSpeakerAttachmentPoint + "/" + \
                 bgpPeerAttachmentPoint + "/" + str( sorted( selector ) )
@@ -292,17 +331,21 @@
 
             # from bgpPeerAttachmentPoint to bgpSpeakerAttachmentPoint
             # direction
-            selector_str = "IPV4_SRC{ip=" + peer[ 'ipAddress' ] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + \
-                "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
+            selectorStr = "IPV4_SRC{ip=" + peer[ 'ipAddress' ] + "/32}," +\
+                    "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + \
+                    "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800},\
+                    TCP_DST{tcpPort=179}"
+            selector = selectorStr.replace( " ", "" ).replace(
                 "[", "" ).replace( "]", "" ).split( "," )
             intent = bgpPeerAttachmentPoint + "/" + \
                 bgpSpeakerAttachmentPoint + "/" + str( sorted( selector ) )
             intents.append( intent )
 
-            selector_str = "IPV4_SRC{ip=" + peer[ 'ipAddress' ] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + \
-                "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
+            selectorStr = "IPV4_SRC{ip=" + peer[ 'ipAddress' ] + "/32}," +\
+                    "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," +\
+                    "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800},\
+                     TCP_SRC{tcpPort=179}"
+            selector = selectorStr.replace( " ", "" ).replace(
                 "[", "" ).replace( "]", "" ).split( "," )
             intent = bgpPeerAttachmentPoint + "/" + \
                 bgpSpeakerAttachmentPoint + "/" + str( sorted( selector ) )
@@ -310,10 +353,10 @@
 
         return sorted( intents )
 
-    def add_routes( self, routes, routeRate ):
+    def addRoutes( self, routes, routeRate ):
         main.log.info( "I am in add_routes method!" )
 
-        routes_added = 0
+        routesAdded = 0
         try:
             self.handle.sendline( "" )
             # self.handle.expect( "config-router" )
@@ -333,15 +376,15 @@
                 self.disconnect()
             waitTimer = 1.00 / routeRate
             time.sleep( waitTimer )
-        if routes_added == len( routes ):
+        if routesAdded == len( routes ):
             main.log.info( "Finished adding routes" )
             return main.TRUE
         return main.FALSE
 
-    def delete_routes( self, routes, routeRate ):
+    def deleteRoutes( self, routes, routeRate ):
         main.log.info( "I am in delete_routes method!" )
 
-        routes_added = 0
+        routesAdded = 0
         try:
             self.handle.sendline( "" )
             # self.handle.expect( "config-router" )
@@ -361,34 +404,40 @@
                 self.disconnect()
             waitTimer = 1.00 / routeRate
             time.sleep( waitTimer )
-        if routes_added == len( routes ):
+        if routesAdded == len( routes ):
             main.log.info( "Finished deleting routes" )
             return main.TRUE
         return main.FALSE
 
-    def ping_test( self, ip_address, ping_test_file, ping_test_result_file ):
-        main.log.info( "Start the ping test on host:" + str( ip_address ) )
+    def pingTest( self, ipAddress, pingTestFile, pingTestResultFile ):
+        main.log.info( "Start the ping test on host:" + str( ipAddress ) )
 
         self.name = self.options[ 'name' ]
         self.handle = super( QuaggaCliDriver, self ).connect(
-            user_name=self.user_name, ip_address=ip_address,
+            userName=self.userName, ipAddress=ipAddress,
             port=self.port, pwd=self.pwd )
-        main.log.info( "connect parameters:" + str( self.user_name ) + ";"
-                       + str( self.ip_address ) + ";" + str( self.port ) + ";" + str( self.pwd ) )
+        main.log.info( "connect parameters:" +
+                       str( self.userName ) +
+                       ";" +
+                       str( self.ipAddress ) +
+                       ";" +
+                       str( self.port ) +
+                       ";" +
+                       str( self.pwd ) )
 
         if self.handle:
             # self.handle.expect( "" )
             # self.handle.expect( "\$" )
-            main.log.info( "I in host " + str( ip_address ) )
+            main.log.info( "I in host " + str( ipAddress ) )
             main.log.info(
-                ping_test_file +
+                pingTestFile +
                 " > " +
-                ping_test_result_file +
+                pingTestResultFile +
                 " &" )
             self.handle.sendline(
-                ping_test_file +
+                pingTestFile +
                 " > " +
-                ping_test_result_file +
+                pingTestResultFile +
                 " &" )
             self.handle.expect( "\$", timeout=60 )
             handle = self.handle.before
@@ -398,8 +447,8 @@
             main.log.info( "NO HANDLE" )
             return main.FALSE
 
-    # Please use the generate_routes plus add_routes instead of this one
-    def add_route( self, net, numRoutes, routeRate ):
+    # Please use the generateRoutes plus addRoutes instead of this one
+    def addRoute( self, net, numRoutes, routeRate ):
         try:
             self.handle.sendline( "" )
             self.handle.expect( "config-router" )
@@ -413,12 +462,13 @@
             numRoutes = numRoutes - 255
             j = j + 1
         k = numRoutes % 254
-        routes_added = 0
+        routesAdded = 0
         if numRoutes > 255:
             numRoutes = 255
         for m in range( 1, j + 1 ):
             for n in range( 1, numRoutes + 1 ):
-                network = str( net ) + "." + str( m ) + "." + str( n ) + ".0/24"
+                network = str( net ) + "." + str( m ) + \
+                              "." + str( n ) + ".0/24"
                 routeCmd = "network " + network
                 try:
                     self.handle.sendline( routeCmd )
@@ -428,7 +478,7 @@
                     self.disconnect()
                 waitTimer = 1.00 / routeRate
                 time.sleep( waitTimer )
-                routes_added = routes_added + 1
+                routesAdded = routesAdded + 1
         for d in range( j + 1, j + 2 ):
             for e in range( 1, k + 1 ):
                 network = str(
@@ -444,12 +494,12 @@
                     self.disconnect
                 waitTimer = 1.00 / routeRate
                 time.sleep( waitTimer )
-                routes_added = routes_added + 1
-        if routes_added == numRoutes:
+                routesAdded = routesAdded + 1
+        if routesAdded == numRoutes:
             return main.TRUE
         return main.FALSE
 
-    def del_route( self, net, numRoutes, routeRate ):
+    def delRoute( self, net, numRoutes, routeRate ):
         try:
             self.handle.sendline( "" )
             self.handle.expect( "config-router" )
@@ -463,12 +513,13 @@
             numRoutes = numRoutes - 255
             j = j + 1
         k = numRoutes % 254
-        routes_deleted = 0
+        routesDeleted = 0
         if numRoutes > 255:
             numRoutes = 255
         for m in range( 1, j + 1 ):
             for n in range( 1, numRoutes + 1 ):
-                network = str( net ) + "." + str( m ) + "." + str( n ) + ".0/24"
+                network = str( net ) + "." + str( m ) + \
+                              "." + str( n ) + ".0/24"
                 routeCmd = "no network " + network
                 try:
                     self.handle.sendline( routeCmd )
@@ -478,10 +529,11 @@
                     self.disconnect()
                 waitTimer = 1.00 / routeRate
                 time.sleep( waitTimer )
-                routes_deleted = routes_deleted + 1
+                routesDeleted = routesDeleted + 1
         for d in range( j + 1, j + 2 ):
             for e in range( 1, k + 1 ):
-                network = str( net ) + "." + str( d ) + "." + str( e ) + ".0/24"
+                network = str( net ) + "." + str( d ) + \
+                              "." + str( e ) + ".0/24"
                 routeCmd = "no network " + network
                 try:
                     self.handle.sendline( routeCmd )
@@ -491,12 +543,12 @@
                     self.disconnect()
                 waitTimer = 1.00 / routeRate
                 time.sleep( waitTimer )
-                routes_deleted = routes_deleted + 1
-        if routes_deleted == numRoutes:
+                routesDeleted = routesDeleted + 1
+        if routesDeleted == numRoutes:
             return main.TRUE
         return main.FALSE
 
-    def check_routes( self, brand, ip, user, pw ):
+    def checkRoutes( self, brand, ip, user, pw ):
         def pronto( ip, user, passwd ):
             print "Connecting to Pronto switch"
             child = pexpect.spawn( "telnet " + ip )
@@ -520,8 +572,8 @@
             while True:
                 i = child.expect(
                     [ '17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}',
-                                'CLI#',
-                                pexpect.TIMEOUT ] )
+                      'CLI#',
+                      pexpect.TIMEOUT ] )
                 if i == 0:
                     count = count + 1
                 elif i == 1:
@@ -568,4 +620,3 @@
             main.log.error( "Connection failed to the host" )
             response = main.FALSE
         return response
-
diff --git a/TestON/drivers/common/cli/quaggaclidriver.py.fixed b/TestON/drivers/common/cli/quaggaclidriver.py.fixed
deleted file mode 100644
index 09b7614..0000000
--- a/TestON/drivers/common/cli/quaggaclidriver.py.fixed
+++ /dev/null
@@ -1,596 +0,0 @@
-#!/usr/bin/env python
-
-import time
-import pexpect
-import struct
-import fcntl
-import os
-import sys
-import signal
-import sys
-import re
-import json
-sys.path.append( "../" )
-from drivers.common.clidriver import CLI
-
-
-class QuaggaCliDriver( CLI ):
-
-    def __init__( self ):
-        super( CLI, self ).__init__()
-
-    # TODO: simplify this method
-    def connect( self, **connectargs ):
-        for key in connectargs:
-            vars( self )[ key ] = connectargs[ key ]
-
-        self.name = self.options[ 'name' ]
-        # self.handle = super( QuaggaCliDriver,self ).connect(
-        # user_name=self.user_name, ip_address=self.ip_address,port=self.port,
-        # pwd=self.pwd )
-        self.handle = super(
-            QuaggaCliDriver,
-            self ).connect(
-                user_name=self.user_name,
-         ip_address="1.1.1.1",
-         port=self.port,
-         pwd=self.pwd )
-        main.log.info(
-            "connect parameters:" + str(
-                self.user_name ) + ";" + str(
-                    self.ip_address ) + ";" + str(
-                 self.port ) + ";" + str(
-                     self.pwd ) )
-
-        if self.handle:
-            # self.handle.expect( "",timeout=10 )
-            # self.handle.expect( "\$",timeout=10 )
-            self.handle.sendline( "telnet localhost 2605" )
-            # self.handle.expect( "Password:", timeout=5 )
-            self.handle.expect( "Password:" )
-            self.handle.sendline( "hello" )
-            # self.handle.expect( "bgpd", timeout=5 )
-            self.handle.expect( "bgpd" )
-            self.handle.sendline( "enable" )
-            # self.handle.expect( "bgpd#", timeout=5 )
-            self.handle.expect( "bgpd#" )
-            return self.handle
-        else:
-            main.log.info( "NO HANDLE" )
-            return main.FALSE
-
-    def loginQuagga( self, ip_address ):
-        self.name = self.options[ 'name' ]
-        self.handle = super( QuaggaCliDriver, self ).connect(
-            user_name=self.user_name, ip_address=ip_address,
-            port=self.port, pwd=self.pwd )
-        main.log.info( "connect parameters:" + str( self.user_name ) + ";"
-                       + str( self.ip_address ) + ";" + str( self.port ) + ";" + str( self.pwd ) )
-
-        if self.handle:
-            # self.handle.expect( "" )
-            # self.handle.expect( "\$" )
-            self.handle.sendline( "telnet localhost 2605" )
-            # self.handle.expect( "Password:", timeout=5 )
-            self.handle.expect( "Password:" )
-            self.handle.sendline( "hello" )
-            # self.handle.expect( "bgpd", timeout=5 )
-            self.handle.expect( "bgpd" )
-            self.handle.sendline( "enable" )
-            # self.handle.expect( "bgpd#", timeout=5 )
-            self.handle.expect( "bgpd#" )
-            main.log.info( "I in quagga on host " + str( ip_address ) )
-
-            return self.handle
-        else:
-            main.log.info( "NO HANDLE" )
-            return main.FALSE
-
-    def enter_config( self, asn ):
-        main.log.info( "I am in enter_config method!" )
-        try:
-            self.handle.sendline( "" )
-            self.handle.expect( "bgpd#" )
-        except:
-            main.log.warn( "Probably not currently in enable mode!" )
-            self.disconnect()
-            return main.FALSE
-        self.handle.sendline( "configure terminal" )
-        self.handle.expect( "config", timeout=5 )
-        routerAS = "router bgp " + str( asn )
-        try:
-            self.handle.sendline( routerAS )
-            self.handle.expect( "config-router", timeout=5 )
-            return main.TRUE
-        except:
-            return main.FALSE
-
-    def generate_prefixes( self, net, numRoutes ):
-        main.log.info( "I am in generate_prefixes method!" )
-
-        # each IP prefix will be composed by "net" + "." + m + "." + n + "." + x
-        # the length of each IP prefix is 24
-        routes = []
-        routes_gen = 0
-        m = numRoutes / 256
-        n = numRoutes % 256
-
-        for i in range( 0, m ):
-            for j in range( 0, 256 ):
-                network = str(
-                    net ) + "." + str(
-                        i ) + "." + str(
-                            j ) + ".0/24"
-                routes.append( network )
-                routes_gen = routes_gen + 1
-
-        for j in range( 0, n ):
-            network = str( net ) + "." + str( m ) + "." + str( j ) + ".0/24"
-            routes.append( network )
-            routes_gen = routes_gen + 1
-
-        if routes_gen == numRoutes:
-            main.log.info( "Successfully generated " + str( numRoutes )
-                           + " prefixes!" )
-            return routes
-        return main.FALSE
-
-    # This method generates a multiple to single point intent(
-    # MultiPointToSinglePointIntent ) for a given route
-    def generate_expected_singleRouteIntent(
-        self,
-     prefix,
-     nextHop,
-     nextHopMac,
-     sdnip_data ):
-
-        ingress = []
-        egress = ""
-        for peer in sdnip_data[ 'bgpPeers' ]:
-            if peer[ 'ipAddress' ] == nextHop:
-                egress = "of:" + str(
-                    peer[ 'attachmentDpid' ] ).replace( ":",
-                                                        "" ) + ":" + str( peer[ 'attachmentPort' ] )
-            else:
-                ingress.append(
-                    "of:" + str( peer[ 'attachmentDpid' ] ).replace( ":",
-                                                                     "" ) + ":" + str( peer[ 'attachmentPort' ] ) )
-
-        selector = "ETH_TYPE{ethType=800},IPV4_DST{ip=" + prefix + "}"
-        treatment = "[ETH_DST{mac=" + str( nextHopMac ) + "}]"
-
-        intent = egress + "/" + \
-            str( sorted( ingress ) ) + "/" + selector + "/" + treatment
-        return intent
-
-    def generate_expected_onePeerRouteIntents(
-        self,
-     prefixes,
-     nextHop,
-     nextHopMac,
-     sdnip_json_file_path ):
-        intents = []
-        sdnip_json_file = open( sdnip_json_file_path ).read()
-
-        sdnip_data = json.loads( sdnip_json_file )
-
-        for prefix in prefixes:
-            intents.append(
-                self.generate_expected_singleRouteIntent(
-                    prefix,
-                    nextHop,
-                    nextHopMac,
-                    sdnip_data ) )
-        return sorted( intents )
-
-    # TODO
-    # This method generates all expected route intents for all BGP peers
-    def generate_expected_routeIntents( self ):
-        intents = []
-        return intents
-
-    # This method extracts all actual routes from ONOS CLI
-    def extract_actual_routes( self, get_routes_result ):
-        routes_json_obj = json.loads( get_routes_result )
-
-        allRoutes_actual = []
-        for route in routes_json_obj:
-            if route[ 'prefix' ] == '172.16.10.0/24':
-                continue
-            allRoutes_actual.append(
-                route[ 'prefix' ] + "/" + route[ 'nextHop' ] )
-
-        return sorted( allRoutes_actual )
-
-    # This method extracts all actual route intents from ONOS CLI
-    def extract_actual_routeIntents( self, get_intents_result ):
-        intents = []
-        # TODO: delete the line below when change to Mininet demo script
-        # get_intents_result=open( "../tests/SdnIpTest/intents.json" ).read()
-        intents_json_obj = json.loads( get_intents_result )
-
-        for intent in intents_json_obj:
-            if intent[ 'appId' ] != "org.onosproject.sdnip":
-                continue
-            if intent[ 'type' ] == "MultiPointToSinglePointIntent" and intent[ 'state' ] == 'INSTALLED':
-                egress = str( intent[ 'egress' ][ 'device' ] ) + ":" + str(
-                    intent[ 'egress' ][ 'port' ] )
-                ingress = []
-                for attachmentPoint in intent[ 'ingress' ]:
-                    ingress.append(
-                        str( attachmentPoint[ 'device' ] ) + ":" + str( attachmentPoint[ 'port' ] ) )
-
-                selector = intent[ 'selector' ].replace(
-                    "[", "" ).replace( "]", "" ).replace( " ", "" )
-                if str( selector ).startswith( "IPV4" ):
-                    str1, str2 = str( selector ).split( "," )
-                    selector = str2 + "," + str1
-
-                intent = egress + "/" + \
-                    str( sorted( ingress ) ) + "/" + \
-                        selector + "/" + intent[ 'treatment' ]
-                intents.append( intent )
-        return sorted( intents )
-
-    # This method extracts all actual BGP intents from ONOS CLI
-    def extract_actual_bgpIntents( self, get_intents_result ):
-        intents = []
-        # TODO: delete the line below when change to Mininet demo script
-        # get_intents_result=open( "../tests/SdnIpTest/intents.json" ).read()
-        intents_json_obj = json.loads( get_intents_result )
-
-        for intent in intents_json_obj:
-            if intent[ 'appId' ] != "org.onosproject.sdnip":
-                continue
-            if intent[ 'type' ] == "PointToPointIntent" and "protocol=6" in str( intent[ 'selector' ] ):
-                ingress = str( intent[ 'ingress' ][ 'device' ] ) + ":" + str(
-                    intent[ 'ingress' ][ 'port' ] )
-                egress = str( intent[ 'egress' ][ 'device' ] ) + ":" + str(
-                    intent[ 'egress' ][ 'port' ] )
-                selector = str(
-                    intent[ 'selector' ] ).replace( " ",
-                                                    "" ).replace( "[",
-                                                                  "" ).replace( "]",
-                                                                                "" ).split( "," )
-                intent = ingress + "/" + egress + \
-                    "/" + str( sorted( selector ) )
-                intents.append( intent )
-
-        return sorted( intents )
-
-    # This method generates a single point to single point intent(
-    # PointToPointIntent ) for BGP path
-    def generate_expected_bgpIntents( self, sdnip_json_file_path ):
-        from operator import eq
-
-        sdnip_json_file = open( sdnip_json_file_path ).read()
-        sdnip_data = json.loads( sdnip_json_file )
-
-        intents = []
-        bgpPeerAttachmentPoint = ""
-        bgpSpeakerAttachmentPoint = "of:" + str(
-            sdnip_data[ 'bgpSpeakers' ][ 0 ][ 'attachmentDpid' ] ).replace( ":",
-                                                                            "" ) + ":" + str( sdnip_data[ 'bgpSpeakers' ][ 0 ][ 'attachmentPort' ] )
-        for peer in sdnip_data[ 'bgpPeers' ]:
-            bgpPeerAttachmentPoint = "of:" + str(
-                peer[ 'attachmentDpid' ] ).replace( ":",
-                                                    "" ) + ":" + str( peer[ 'attachmentPort' ] )
-            # find out the BGP speaker IP address for this BGP peer
-            bgpSpeakerIpAddress = ""
-            for interfaceAddress in sdnip_data[ 'bgpSpeakers' ][ 0 ][ 'interfaceAddresses' ]:
-                # if eq( interfaceAddress[ 'interfaceDpid' ],sdnip_data[
-                # 'bgpSpeakers' ][ 0 ][ 'attachmentDpid' ] ) and eq(
-                # interfaceAddress[ 'interfacePort' ], sdnip_data[
-                # 'bgpSpeakers' ][ 0 ][ 'attachmentPort' ] ):
-                if eq( interfaceAddress[ 'interfaceDpid' ], peer[ 'attachmentDpid' ] ) and eq( interfaceAddress[ 'interfacePort' ], peer[ 'attachmentPort' ] ):
-                    bgpSpeakerIpAddress = interfaceAddress[ 'ipAddress' ]
-                    break
-                else:
-                    continue
-
-            # from bgpSpeakerAttachmentPoint to bgpPeerAttachmentPoint
-            # direction
-            selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer[
-                'ipAddress' ] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
-                "[", "" ).replace( "]", "" ).split( "," )
-            intent = bgpSpeakerAttachmentPoint + "/" + \
-                bgpPeerAttachmentPoint + "/" + str( sorted( selector ) )
-            intents.append( intent )
-
-            selector_str = "IPV4_SRC{ip=" + bgpSpeakerIpAddress + "/32}," + "IPV4_DST{ip=" + peer[
-                'ipAddress' ] + "/32}," + "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
-                "[", "" ).replace( "]", "" ).split( "," )
-            intent = bgpSpeakerAttachmentPoint + "/" + \
-                bgpPeerAttachmentPoint + "/" + str( sorted( selector ) )
-            intents.append( intent )
-
-            # from bgpPeerAttachmentPoint to bgpSpeakerAttachmentPoint
-            # direction
-            selector_str = "IPV4_SRC{ip=" + peer[ 'ipAddress' ] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + \
-                "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_DST{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
-                "[", "" ).replace( "]", "" ).split( "," )
-            intent = bgpPeerAttachmentPoint + "/" + \
-                bgpSpeakerAttachmentPoint + "/" + str( sorted( selector ) )
-            intents.append( intent )
-
-            selector_str = "IPV4_SRC{ip=" + peer[ 'ipAddress' ] + "/32}," + "IPV4_DST{ip=" + bgpSpeakerIpAddress + "/32}," + \
-                "IP_PROTO{protocol=6}, ETH_TYPE{ethType=800}, TCP_SRC{tcpPort=179}"
-            selector = selector_str.replace( " ", "" ).replace(
-                "[", "" ).replace( "]", "" ).split( "," )
-            intent = bgpPeerAttachmentPoint + "/" + \
-                bgpSpeakerAttachmentPoint + "/" + str( sorted( selector ) )
-            intents.append( intent )
-
-        return sorted( intents )
-
-    def add_routes( self, routes, routeRate ):
-        main.log.info( "I am in add_routes method!" )
-
-        routes_added = 0
-        try:
-            self.handle.sendline( "" )
-            # self.handle.expect( "config-router" )
-            self.handle.expect( "config-router", timeout=5 )
-        except:
-            main.log.warn( "Probably not in config-router mode!" )
-            self.disconnect()
-        main.log.info( "Start to add routes" )
-
-        for i in range( 0, len( routes ) ):
-            routeCmd = "network " + routes[ i ]
-            try:
-                self.handle.sendline( routeCmd )
-                self.handle.expect( "bgpd", timeout=5 )
-            except:
-                main.log.warn( "Failed to add route" )
-                self.disconnect()
-            waitTimer = 1.00 / routeRate
-            time.sleep( waitTimer )
-        if routes_added == len( routes ):
-            main.log.info( "Finished adding routes" )
-            return main.TRUE
-        return main.FALSE
-
-    def delete_routes( self, routes, routeRate ):
-        main.log.info( "I am in delete_routes method!" )
-
-        routes_added = 0
-        try:
-            self.handle.sendline( "" )
-            # self.handle.expect( "config-router" )
-            self.handle.expect( "config-router", timeout=5 )
-        except:
-            main.log.warn( "Probably not in config-router mode!" )
-            self.disconnect()
-        main.log.info( "Start to delete routes" )
-
-        for i in range( 0, len( routes ) ):
-            routeCmd = "no network " + routes[ i ]
-            try:
-                self.handle.sendline( routeCmd )
-                self.handle.expect( "bgpd", timeout=5 )
-            except:
-                main.log.warn( "Failed to add route" )
-                self.disconnect()
-            waitTimer = 1.00 / routeRate
-            time.sleep( waitTimer )
-        if routes_added == len( routes ):
-            main.log.info( "Finished deleting routes" )
-            return main.TRUE
-        return main.FALSE
-
-    def ping_test( self, ip_address, ping_test_file, ping_test_result_file ):
-        main.log.info( "Start the ping test on host:" + str( ip_address ) )
-
-        self.name = self.options[ 'name' ]
-        self.handle = super( QuaggaCliDriver, self ).connect(
-            user_name=self.user_name, ip_address=ip_address,
-            port=self.port, pwd=self.pwd )
-        main.log.info( "connect parameters:" + str( self.user_name ) + ";"
-                       + str( self.ip_address ) + ";" + str( self.port ) + ";" + str( self.pwd ) )
-
-        if self.handle:
-            # self.handle.expect( "" )
-            # self.handle.expect( "\$" )
-            main.log.info( "I in host " + str( ip_address ) )
-            main.log.info(
-                ping_test_file +
-                " > " +
-                ping_test_result_file +
-                " &" )
-            self.handle.sendline(
-                ping_test_file +
-                " > " +
-                ping_test_result_file +
-                " &" )
-            self.handle.expect( "\$", timeout=60 )
-            handle = self.handle.before
-
-            return handle
-        else:
-            main.log.info( "NO HANDLE" )
-            return main.FALSE
-
-    # Please use the generate_routes plus add_routes instead of this one
-    def add_route( self, net, numRoutes, routeRate ):
-        try:
-            self.handle.sendline( "" )
-            self.handle.expect( "config-router" )
-        except:
-            main.log.warn( "Probably not in config-router mode!" )
-            self.disconnect()
-        main.log.info( "Adding Routes" )
-        j = 0
-        k = 0
-        while numRoutes > 255:
-            numRoutes = numRoutes - 255
-            j = j + 1
-        k = numRoutes % 254
-        routes_added = 0
-        if numRoutes > 255:
-            numRoutes = 255
-        for m in range( 1, j + 1 ):
-            for n in range( 1, numRoutes + 1 ):
-                network = str(
-                    net ) + "." + str(
-                        m ) + "." + str(
-                            n ) + ".0/24"
-                routeCmd = "network " + network
-                try:
-                    self.handle.sendline( routeCmd )
-                    self.handle.expect( "bgpd" )
-                except:
-                    main.log.warn( "failed to add route" )
-                    self.disconnect()
-                waitTimer = 1.00 / routeRate
-                time.sleep( waitTimer )
-                routes_added = routes_added + 1
-        for d in range( j + 1, j + 2 ):
-            for e in range( 1, k + 1 ):
-                network = str(
-                    net ) + "." + str(
-                        d ) + "." + str(
-                            e ) + ".0/24"
-                routeCmd = "network " + network
-                try:
-                    self.handle.sendline( routeCmd )
-                    self.handle.expect( "bgpd" )
-                except:
-                    main.log.warn( "failed to add route" )
-                    self.disconnect
-                waitTimer = 1.00 / routeRate
-                time.sleep( waitTimer )
-                routes_added = routes_added + 1
-        if routes_added == numRoutes:
-            return main.TRUE
-        return main.FALSE
-
-    def del_route( self, net, numRoutes, routeRate ):
-        try:
-            self.handle.sendline( "" )
-            self.handle.expect( "config-router" )
-        except:
-            main.log.warn( "Probably not in config-router mode!" )
-            self.disconnect()
-        main.log.info( "Deleting Routes" )
-        j = 0
-        k = 0
-        while numRoutes > 255:
-            numRoutes = numRoutes - 255
-            j = j + 1
-        k = numRoutes % 254
-        routes_deleted = 0
-        if numRoutes > 255:
-            numRoutes = 255
-        for m in range( 1, j + 1 ):
-            for n in range( 1, numRoutes + 1 ):
-                network = str(
-                    net ) + "." + str(
-                        m ) + "." + str(
-                            n ) + ".0/24"
-                routeCmd = "no network " + network
-                try:
-                    self.handle.sendline( routeCmd )
-                    self.handle.expect( "bgpd" )
-                except:
-                    main.log.warn( "Failed to delete route" )
-                    self.disconnect()
-                waitTimer = 1.00 / routeRate
-                time.sleep( waitTimer )
-                routes_deleted = routes_deleted + 1
-        for d in range( j + 1, j + 2 ):
-            for e in range( 1, k + 1 ):
-                network = str(
-                    net ) + "." + str(
-                        d ) + "." + str(
-                            e ) + ".0/24"
-                routeCmd = "no network " + network
-                try:
-                    self.handle.sendline( routeCmd )
-                    self.handle.expect( "bgpd" )
-                except:
-                    main.log.warn( "Failed to delete route" )
-                    self.disconnect()
-                waitTimer = 1.00 / routeRate
-                time.sleep( waitTimer )
-                routes_deleted = routes_deleted + 1
-        if routes_deleted == numRoutes:
-            return main.TRUE
-        return main.FALSE
-
-    def check_routes( self, brand, ip, user, pw ):
-        def pronto( ip, user, passwd ):
-            print "Connecting to Pronto switch"
-            child = pexpect.spawn( "telnet " + ip )
-            i = child.expect( [ "login:", "CLI#", pexpect.TIMEOUT ] )
-            if i == 0:
-                print "Username and password required. Passing login info."
-                child.sendline( user )
-                child.expect( "Password:" )
-                child.sendline( passwd )
-                child.expect( "CLI#" )
-            print "Logged in, getting flowtable."
-            child.sendline( "flowtable brief" )
-            for t in range( 9 ):
-                t2 = 9 - t
-                print "\r" + str( t2 )
-                sys.stdout.write( "\033[F" )
-                time.sleep( 1 )
-            print "Scanning flowtable"
-            child.expect( "Flow table show" )
-            count = 0
-            while True:
-                i = child.expect(
-                    [ '17\d\.\d{1,3}\.\d{1,3}\.\d{1,3}',
-                                'CLI#',
-                                pexpect.TIMEOUT ] )
-                if i == 0:
-                    count = count + 1
-                elif i == 1:
-                    print "Pronto flows: " + str( count ) + "\nDone\n"
-                    break
-                else:
-                    break
-
-        def cisco( ip, user, passwd ):
-            print "Establishing Cisco switch connection"
-            child = pexpect.spawn( "ssh " + user + "@" + ip )
-            i = child.expect( [ "Password:", "CLI#", pexpect.TIMEOUT ] )
-            if i == 0:
-                print "Password required. Passing now."
-                child.sendline( passwd )
-                child.expect( "#" )
-            print "Logged in. Retrieving flow table then counting flows."
-            child.sendline( "show openflow switch all flows all" )
-            child.expect( "Logical Openflow Switch" )
-            print "Flow table retrieved. Counting flows"
-            count = 0
-            while True:
-                i = child.expect( [ "nw_src=17", "#", pexpect.TIMEOUT ] )
-                if i == 0:
-                    count = count + 1
-                elif i == 1:
-                    print "Cisco flows: " + str( count ) + "\nDone\n"
-                    break
-                else:
-                    break
-            if brand == "pronto" or brand == "PRONTO":
-                pronto( ip, user, passwd )
-            # elif brand  == "cisco" or brand == "CISCO":
-            #    cisco( ip,user,passwd )
-
-    def disconnect( self ):
-        """
-        Called when Test is complete to disconnect the Quagga handle.
-        """
-        response = ''
-        try:
-            self.handle.close()
-        except:
-            main.log.error( "Connection failed to the host" )
-            response = main.FALSE
-        return response
-
diff --git a/TestON/drivers/common/cli/remotetestbed/hpswitchclidriver.py b/TestON/drivers/common/cli/remotetestbed/hpswitchclidriver.py
deleted file mode 100644
index 24d9696..0000000
--- a/TestON/drivers/common/cli/remotetestbed/hpswitchclidriver.py
+++ /dev/null
@@ -1,230 +0,0 @@
-#!/usr/bin/env python
-'''
-Created on 24-June-2013 
-
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)      
-
-    TestON is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 2 of the License, or
-    (at your option) any later version.
-
-    TestON is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with TestON.  If not, see <http://www.gnu.org/licenses/>.        
-
-
-''' 
-import time
-import pexpect
-import struct, fcntl, os, sys, signal
-import sys
-import re
-sys.path.append("../")
-from drivers.common.clidriver import CLI
-
-class HPSwitch(CLI):
-    
-    def __init__(self):
-        super(CLI, self).__init__()
-        
-    def connect(self,**connectargs):
-        for key in connectargs:
-           vars(self)[key] = connectargs[key]
-
-        self.name = self.options['name']
-        self.handle = super(HPSwitch,self).connect(user_name = self.user_name, ip_address = self.ip_address,port = self.port, pwd = self.pwd)
-
-        return main.TRUE
-
-    def configure(self):
-        self.execute(cmd='configure', prompt = '\(config\)',timeout = 3)
-        if re.search('\(config\)', main.last_response):
-            main.log.info("Configure mode enabled"+main.last_response)
-        else : 
-            main.log.warn("Fail to enable configure mode"+main.last_response)
-        
-
-    def set_up_vlan(self,**vlanargs):
-        '''
-        Configure vlan.
-        '''
-        for key in vlanargs:
-           vars(self)[key] = vlanargs[key]
-           
-        self.execute(cmd='vlan '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
-        if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
-            main.log.info("Configuring VLAN "+self.vlan_id)
-        else : 
-            main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
-            return main.FALSE
-        
-        if self.vlan_name :
-            self.execute(cmd='name '+self.vlan_name, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
-            if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
-                main.log.info("Configuring "+self.vlan_id)
-                return main.TRUE
-            else : 
-                main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
-                return main.FALSE
-        else :
-            main.log.error("Vlan Name not specified")
-            return main.FALSE
-        
-    def vlan_tagged(self, **taggedargs):
-        for key in taggedargs:
-           vars(self)[key] = taggedargs[key]
-        if self.vlan_id :
-            self.execute(cmd='vlan '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
-            
-            if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
-                main.log.info("Configuring "+self.vlan_id)
-            else : 
-                main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
-                return main.FALSE
-            if self.tagged :
-                self.execute(cmd='tagged '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
-                if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
-                    main.log.info("VLAN tagged done "+self.tagged)
-                    return main.TRUE
-                else : 
-                    main.log.warn("Fail to tagged Vlan"+self.vlan_id+main.last_response)
-                    return main.FALSE
-            
-    def vlan_untagged(self, **untaggedargs):
-        for key in untaggedargs:
-           vars(self)[key] = untaggedargs[key]
-        if self.vlan_id :
-            self.execute(cmd='vlan '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
-            
-            if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
-                main.log.info("Configuring "+self.vlan_id)
-            else : 
-                main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
-                return main.FALSE
-            if self.tagged :
-                self.execute(cmd='untagged '+self.vlan_id, prompt = '\(vlan-'+self.vlan_id+'\)',timeout = 3)
-                if re.search('\(vlan-'+self.vlan_id+'\)', main.last_response):
-                    main.log.info("VLAN untagged done "+self.tagged)
-                    return main.TRUE
-                else : 
-                    main.log.warn("Fail to untagged Vlan"+self.vlan_id+main.last_response)
-                    return main.FALSE
-                
-    def openflow_mode(self):
-        self.configure()
-        self.execute(cmd='openflow', prompt = '\(openflow\)',timeout = 3)
-        if re.search('\(openflow\)', main.last_response):
-            main.log.info("Openflow mode enabled"+main.last_response)
-            return main.TRUE
-        else : 
-            main.log.warn("Fail to enable Openflow mode"+main.last_response)
-            return main.FALSE
-
-
-    def add_openflow_controller(self,**controllerargs):
-        for key in controllerargs:
-           vars(self)[key] = controllerargs[key]
-           
-        if not self.openflow_mode():
-            return main.FALSE
-            
-        contoller_details = 'controller-id '+ self.controller_id+'ip '+self.controller_ip + 'controller-interface vlan '+self.interface_vlan_id  
-        self.execute(cmd=contoller_details, prompt = '\(openflow\)',timeout = 3)
-        
-        if re.search('already\sconfigured', main.last_response):
-            main.log.warn("A controller is already configured with this ID."+main.last_response)
-            return main.FALSE
-        elif re.search('Incomplete\sinput',main.last_response ) :             
-            main.log.warn("Incomplete\sinput"+main.last_response)
-            return main.FALSE
-        else:
-            main.log.info("Successfully added Openflow Controller")
-            return main.TRUE
-        
-        
-    def create_openflow_instance(self,**instanceargs):
-        for key in instanceargs:
-           vars(self)[key] = instanceargs[key]
-        
-        if not self.openflow_mode():
-            return main.FALSE
-        
-        if self.instance_name :
-            self.execute(cmd='instance '+self.instance_name, prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3)
-            
-            if re.search('\(of-inst-'+self.instance_name+'\)', main.last_response):
-                main.log.info("Configuring Openflow instance "+self.instance_name)
-            else : 
-                main.log.warn("Fail to configure Openflow instance"+self.instance_name+"\n\n"+main.last_response)
-                return main.FALSE
-        if self.controller_id :
-            self.execute(cmd='controller-id '+self.controller_id, prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3)
-            main.log.info(main.last_response)
-        
-        if self.member :
-            self.execute(cmd='member vlan '+self.member_vlan_id, prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3)
-            main.log.info(main.last_response)
-    
-        if self.execute(cmd='enable', prompt = '\(of-inst-'+self.instance_name+'\)',timeout = 3):
-            return main.TRUE
-        else :
-            return main.FALSE
-    
-    def pair_vlan_with_openflow_instance(self,vlan_id):
-        self.configure()
-        self.execute(cmd='vlan '+vlan_id, prompt = '\(vlan-'+vlan_id+'\)',timeout = 3)
-        if re.search('\(vlan-'+vlan_id+'\)', main.last_response):
-            main.log.info("Configuring VLAN "+vlan_id)
-        else : 
-            main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
-            return main.FALSE
-        
-        self.execute(cmd='openflow enable', prompt = '\(vlan-'+vlan_id+'\)',timeout = 3)
-        if re.search('\(vlan-'+vlan_id+'\)', main.last_response):
-            main.log.info("Configuring VLAN "+vlan_id)
-        else : 
-            main.log.warn("Fail to configure Vlan"+self.vlan_id+main.last_response)
-            return main.FALSE
-        
-    def show_openflow_instance(self,instance_name):
-        
-        self.execute(cmd='show openflow instance '+instance_name, prompt = '#',timeout = 3)
-        return main.TRUE
-    
-    def show(self, command):
-        self.execute(cmd=command, prompt = '#',timeout = 3)
-        return main.TRUE
-    
-    
-    def openflow_enable(self):
-        self.configure()
-        self.execute(cmd='openflow enable', prompt = '#',timeout = 3)
-        return main.TRUE
-    
-    def openflow_disable(self):
-        self.configure()
-        self.execute(cmd='openflow enable', prompt = '#',timeout = 3)
-        return main.TRUE
-    
-    def remove_controller(self,controller_id):
-        self.configure()
-        self.execute(cmd='no controller-id '+controller_id, prompt = '#',timeout = 3)
-        return main.TRUE
-    
-    def remove_vlan(self,vlan_id):
-        self.configure()
-        if self.execute(cmd='no vlan '+vlan_id, prompt = '#',timeout = 3):
-            return main.TRUE
-        else :
-            self.execute(cmd=' '+vlan_id, prompt = '#',timeout = 3)
-            return main.TRUE
-    
-    def remove_openflow_instance(self,instance_name):
-        self.configure()
-        self.execute(cmd='no openflow instance '+instance_name, prompt = '#',timeout = 3)
-        return main.TRUE
diff --git a/TestON/tests/ClassTest/ClassTest.topo b/TestON/tests/ClassTest/ClassTest.topo
index 4ecb7ed..1c8bc4f 100644
--- a/TestON/tests/ClassTest/ClassTest.topo
+++ b/TestON/tests/ClassTest/ClassTest.topo
@@ -1,18 +1,18 @@
 <TOPOLOGY>
     <COMPONENT>
         <ONOSbench>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOSbench>
         
         <Mininet1>
-            <host>10.128.10.90</host>
+            <host>10.128.10.24</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>MininetCliDriver</type>
             <connect_order>2</connect_order>
             <COMPONENTS>
diff --git a/TestON/tests/PingallExample/PingallExample.py b/TestON/tests/PingallExample/PingallExample.py
index faf374f..bb2b1cf 100644
--- a/TestON/tests/PingallExample/PingallExample.py
+++ b/TestON/tests/PingallExample/PingallExample.py
@@ -8,10 +8,10 @@
 """
 class PingallExample:
 
-    def __init__( self ) :
+    def __init__( self ):
         self.default = ''
 
-    def CASE1( self, main ) :
+    def CASE1( self, main ):
         """
            CASE1 is to compile ONOS and push it to the test machines
 
@@ -29,73 +29,73 @@
         main.case( "Setting up test environment" )
 
         # load some vairables from the params file
-        PULL_CODE = False
+        PULLCODE = False
         if main.params[ 'Git' ] == 'True':
-            PULL_CODE = True
-        cell_name = main.params[ 'ENV' ][ 'cellName' ]
+            PULLCODE = True
+        cellName = main.params[ 'ENV' ][ 'cellName' ]
 
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
 
         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.log.report( "Uninstalling ONOS" )
-        main.ONOSbench.onos_uninstall( ONOS1_ip )
+        main.ONOSbench.onosUninstall( ONOS1Ip )
 
-        clean_install_result = main.TRUE
-        git_pull_result = main.TRUE
+        cleanInstallResult = main.TRUE
+        gitPullResult = main.TRUE
 
         main.step( "Compiling the latest version of ONOS" )
-        if PULL_CODE:
+        if PULLCODE:
             main.step( "Git checkout and pull master" )
-            main.ONOSbench.git_checkout( "master" )
-            git_pull_result = main.ONOSbench.git_pull()
+            main.ONOSbench.gitCheckout( "master" )
+            gitPullResult = main.ONOSbench.gitPull()
 
             main.step( "Using mvn clean & install" )
-            clean_install_result = main.TRUE
-            if git_pull_result == main.TRUE:
-                clean_install_result = main.ONOSbench.clean_install()
+            cleanInstallResult = main.TRUE
+            if gitPullResult == main.TRUE:
+                cleanInstallResult = main.ONOSbench.cleanInstall()
             else:
                 main.log.warn( "Did not pull new code so skipping mvn " +
                                "clean install" )
-        main.ONOSbench.get_version( report=True )
+        main.ONOSbench.getVersion( report=True )
 
-        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( "Creating ONOS package" )
-        package_result = main.ONOSbench.onos_package()
+        packageResult = main.ONOSbench.onosPackage()
 
         main.step( "Installing ONOS package" )
-        onos1_install_result = main.ONOSbench.onos_install( options="-f",
-                                                            node=ONOS1_ip )
+        onos1InstallResult = main.ONOSbench.onosInstall( options="-f",
+                                                           node=ONOS1Ip )
 
         main.step( "Checking if ONOS is up yet" )
         for i in range( 2 ):
-            onos1_isup = main.ONOSbench.isup( ONOS1_ip )
-            if onos1_isup:
+            onos1Isup = main.ONOSbench.isup( ONOS1Ip )
+            if onos1Isup:
                 break
-        if not onos1_isup:
+        if not onos1Isup:
             main.log.report( "ONOS1 didn't start!" )
 
         # TODO: if it becomes an issue, we can retry this step  a few times
 
-        cli_result = main.ONOScli1.start_onos_cli( ONOS1_ip )
+        cliResult = main.ONOScli1.startOnosCli( ONOS1Ip )
 
-        case1_result = ( clean_install_result and package_result and
-                         cell_result and verify_result and
-                         onos1_install_result and
-                         onos1_isup and cli_result )
+        case1Result = ( cleanInstallResult and packageResult and
+                        cellResult and verifyResult and
+                        onos1InstallResult and
+                        onos1Isup and cliResult )
 
-        utilities.assert_equals( expect=main.TRUE, actual=case1_result,
+        utilities.assert_equals( expect=main.TRUE, actual=case1Result,
                                  onpass="Test startup successful",
                                  onfail="Test startup NOT successful" )
 
-        if case1_result == main.FALSE:
+        if case1Result == main.FALSE:
             main.cleanup()
             main.exit()
 
-    def CASE2( self, main ) :
+    def CASE2( self, main ):
         """
            Assign mastership to controller
         """
@@ -105,35 +105,35 @@
         main.case( "Assigning Controller" )
         main.step( "Assign switches to controller" )
 
-        ONOS1_ip = main.params[ 'CTRL' ][ 'ip1' ]
-        ONOS1_port = main.params[ 'CTRL' ][ 'port1' ]
+        ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
+        ONOS1Port = main.params[ 'CTRL' ][ 'port1' ]
 
         for i in range( 1, 14 ):
-            main.Mininet1.assign_sw_controller(
+            main.Mininet1.assignSwController(
                 sw=str( i ),
-                ip1=ONOS1_ip,
-                port1=ONOS1_port )
+                ip1=ONOS1Ip,
+                port1=ONOS1Port )
 
-        mastership_check = main.TRUE
+        mastershipCheck = main.TRUE
         for i in range( 1, 14 ):
-            response = main.Mininet1.get_sw_controller( "s" + str( i ) )
+            response = main.Mininet1.getSwController( "s" + str( i ) )
             try:
                 main.log.info( str( response ) )
             except:
                 main.log.info( repr( response ) )
-            if re.search( "tcp:" + ONOS1_ip, response ):
-                mastership_check = mastership_check and main.TRUE
+            if re.search( "tcp:" + ONOS1Ip, response ):
+                mastershipCheck = mastershipCheck and main.TRUE
             else:
-                mastership_check = main.FALSE
-        if mastership_check == main.TRUE:
+                mastershipCheck = main.FALSE
+        if mastershipCheck == main.TRUE:
             main.log.report( "Switch mastership assigned correctly" )
         utilities.assert_equals(
             expect=main.TRUE,
-            actual=mastership_check,
+            actual=mastershipCheck,
             onpass="Switch mastership assigned correctly",
             onfail="Switches not assigned correctly to controllers" )
 
-    def CASE3( self, main ) :
+    def CASE3( self, main ):
         """
            Assign intents
         """
@@ -144,19 +144,19 @@
 
         # install onos-app-fwd
         main.log.info( "Install reactive forwarding app" )
-        main.ONOScli1.feature_install( "onos-app-fwd" )
+        main.ONOScli1.featureInstall( "onos-app-fwd" )
 
         # REACTIVE FWD test
-        ping_result = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        ping_result = main.Mininet1.pingall()
+        pingResult = main.Mininet1.pingall()
         time2 = time.time()
         main.log.info( "Time for pingall: %2f seconds" % ( time2 - time1 ) )
 
         # uninstall onos-app-fwd
         main.log.info( "Uninstall reactive forwarding app" )
-        main.ONOScli1.feature_uninstall( "onos-app-fwd" )
+        main.ONOScli1.featureUninstall( "onos-app-fwd" )
 
-        utilities.assert_equals( expect=main.TRUE, actual=ping_result,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="All hosts are reachable",
                                  onfail="Some pings failed" )
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" )
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.params b/TestON/tests/TopoPerfNext/TopoPerfNext.params
index 851522c..08a3158 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.params
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.params
@@ -2,7 +2,7 @@
     <testcases>1,2,3</testcases>
 
     <ENV>
-        <cellName>topo_perf_test</cellName>
+        <cellName>kelvin2</cellName>
     </ENV>
 
     <GIT>
@@ -13,21 +13,21 @@
 
     <CTRL>
         <user>admin</user>
-        <ip1>10.128.174.1</ip1>
+        <ip1>10.128.10.21</ip1>
         <port1>6633</port1>
-        <ip2>10.128.174.2</ip2>
+        <ip2>10.128.10.22</ip2>
         <port2>6633</port2>
-        <ip3>10.128.174.3</ip3>
+        <ip3>10.128.10.23</ip3>
         <port3>6633</port3>
     </CTRL>
 
     <MN>
-        <ip1>10.128.10.90</ip1>
-        <ip2>10.128.10.91</ip2>
+        <ip1>10.128.10.24</ip1>
+        <ip2>10.128.10.24</ip2>
     </MN>
 
     <BENCH>
-        <ip>10.128.174.10</ip>
+        <ip>10.128.10.20</ip>
     </BENCH>
 
     <TEST>
diff --git a/TestON/tests/TopoPerfNext/TopoPerfNext.topo b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
index 4ee44e2..896e991 100644
--- a/TestON/tests/TopoPerfNext/TopoPerfNext.topo
+++ b/TestON/tests/TopoPerfNext/TopoPerfNext.topo
@@ -2,72 +2,72 @@
     <COMPONENT>
         
         <ONOSbench>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosCliDriver</type>
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1cli>
 
         <ONOS2cli>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosCliDriver</type>
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS2cli>
         
         <ONOS3cli>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosCliDriver</type>
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS3cli>
 
         <ONOS1>
-            <host>10.128.174.1</host>
+            <host>10.128.10.21</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>3</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1>
 
         <ONOS2>
-            <host>10.128.174.2</host>
+            <host>10.128.10.22</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>3</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS2>
 
         <ONOS3>
-            <host>10.128.174.3</host>
+            <host>10.128.10.23</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>3</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS3>
 
         <Mininet1>
-            <host>10.128.10.90</host>
+            <host>10.128.10.24</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>MininetCliDriver</type>
             <connect_order>4</connect_order>
             <COMPONENTS>
@@ -79,9 +79,9 @@
         </Mininet1>
 
         <Mininet2>
-            <host>10.128.10.90</host>
+            <host>10.128.10.24</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>RemoteMininetDriver</type>
             <connect_order>5</connect_order>
             <COMPONENTS> </COMPONENTS>
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
index f797706..0db0459 100644
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
+++ b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.params
@@ -2,7 +2,7 @@
     <testcases>1,2,3,4,5</testcases>
 
     <ENV>
-        <cellName>topo_perf_test</cellName>
+        <cellName>kelvin2</cellName>
     </ENV>
 
     <GIT>
@@ -13,21 +13,21 @@
 
     <CTRL>
         <user>admin</user>
-        <ip1>10.128.174.1</ip1>
+        <ip1>10.128.10.21</ip1>
         <port1>6633</port1>
-        <ip2>10.128.174.2</ip2>
+        <ip2>10.128.10.22</ip2>
         <port2>6633</port2>
-        <ip3>10.128.174.3</ip3>
+        <ip3>10.128.10.23</ip3>
         <port3>6633</port3>
     </CTRL>
 
     <MN>
-        <ip1>10.128.10.90</ip1>
-        <ip2>10.128.10.91</ip2>
+        <ip1>10.128.10.20</ip1>
+        <ip2>10.128.10.25</ip2>
     </MN>
 
     <BENCH>
-        <ip>10.128.174.10</ip>
+        <ip>10.128.10.20</ip>
     </BENCH>
 
     <TEST>
diff --git a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
index 3fc7bdc..ecf46d3 100644
--- a/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
+++ b/TestON/tests/TopoPerfNextSingleNode/TopoPerfNextSingleNode.topo
@@ -2,36 +2,36 @@
     <COMPONENT>
         
         <ONOSbench>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>1</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOSbench>
 
         <ONOS1cli>
-            <host>10.128.174.10</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosCliDriver</type>
             <connect_order>2</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1cli>
         
         <ONOS1>
-            <host>10.128.174.1</host>
+            <host>10.128.20.21</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>OnosDriver</type>
             <connect_order>3</connect_order>
             <COMPONENTS> </COMPONENTS>
         </ONOS1>
 
         <Mininet1>
-            <host>10.128.10.90</host>
+            <host>10.128.10.20</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>MininetCliDriver</type>
             <connect_order>4</connect_order>
             <COMPONENTS>
@@ -43,9 +43,9 @@
         </Mininet1>
 
         <Mininet2>
-            <host>10.128.10.90</host>
+            <host>10.128.10.25</host>
             <user>admin</user>
-            <password>onos_test</password>
+            <password></password>
             <type>RemoteMininetDriver</type>
             <connect_order>5</connect_order>
             <COMPONENTS> </COMPONENTS>
