Fix typos and code style issues in drivers
diff --git a/TestON/drivers/common/cli/dpclidriver.py b/TestON/drivers/common/cli/dpclidriver.py
index ee26bde..81743d3 100644
--- a/TestON/drivers/common/cli/dpclidriver.py
+++ b/TestON/drivers/common/cli/dpclidriver.py
@@ -18,9 +18,9 @@
 
         self.name = self.options[ 'name' ]
         self.handle = super( DPCliDriver, self ).connect( user_name=self.user_name,
-         		ip_address=self.ip_address,
-         		port=self.port,
-         		pwd=self.pwd )
+                        ip_address=self.ip_address,
+                        port=self.port,
+                        pwd=self.pwd )
 
         if self.handle:
             return self.handle
@@ -30,11 +30,17 @@
 
     def create_interfaces( self, net, number, start ):
         """
-        Creates a number,specified by 'number,' of subinterfaces on eth0. Ip addresses start at 'net'.'start'.1.1 with a 24 bit netmask. Addresses increment sequentially in the third quad,
-        therefore all interfaces are in different subnets on the same machine. When the third quad reaches 255, it is reset to 1 and the second quad is incremented.
-        Every single ip address is placed in a file in /tmp titled 'ip_table{net}.txt'
-        The file is used by 'pingall_interfaces()' as a fping argument
-        This method returns true if all interfaces are created without a hitch, and false if a single interface has issues
+        Creates a number,specified by 'number,' of subinterfaces on eth0.
+        Ip addresses start at 'net'.'start'.1.1 with a 24 bit netmask.
+        Addresses increment sequentially in the third quad, therefore all
+        interfaces are in different subnets on the same machine. When the
+        third quad reaches 255, it is reset to 1 and the second quad is
+        incremented. Every single ip address is placed in a file in /tmp
+        titled 'ip_table{net}.txt'. The file is used by 'pingall_interfaces()'
+        as a fping argument
+
+        This method returns true if all interfaces are created without a hitch,
+        and false if a single interface has issues
         """
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
@@ -60,11 +66,11 @@
                     intf ) + " " + ip + " netmask 255.255.255.0" )
 
             i = self.handle.expect( [
-				    "\$",
+                                    "\$",
                                     "password",
                                     pexpect.TIMEOUT,
                                     pexpect.EOF ],
-                		    timeout=120 )
+                                    timeout=120 )
 
             if i == 0:
                 self.handle.sendline(
@@ -80,15 +86,20 @@
 
     def pingall_interfaces( self, netsrc, netstrt, netdst, destlogin, destip ):
         """
-        Copies the /tmp/ip_table{ net }.txt file from the machine you wish to ping, then runs fping with a source address of { netsrc }.{ netstrt }.1.1 on the copied file.
-        Check every single response for reachable or unreachable. If all are reachable, function returns true. If a SINGLE host is unreachable, then the function stops and returns false
-        If fping is not installed, this function will install fping then run the same command
+        Copies the /tmp/ip_table{ net }.txt file from the machine you wish to
+        ping, then runs fping with a source address of
+        { netsrc }.{ netstrt }.1.1 on the copied file.
+        Check every single response for reachable or unreachable. If all are
+        reachable, function returns true. If a SINGLE host is unreachable,
+        then the function stops and returns false. If fping is not installed,
+        this function will install fping then run the same command
         """
         self.handle.sendline( "" )
         self.handle.expect( "\$" )
 
         self.handle.sendline( "scp " + str( destlogin ) + "@" +
-                              str( destip ) + ":/tmp/local_ip.txt /tmp/ip_table" +
+                              str( destip ) +
+                              ":/tmp/local_ip.txt /tmp/ip_table" +
                               str( netsrc ) + ".txt" )
 
         i = self.handle.expect( [
@@ -145,11 +156,10 @@
             elif i == 5:
                 main.log.info( "fping not installed, installing fping" )
                 self.handle.sendline( "sudo apt-get install fping" )
-                i = self.handle.expect(
-                    [ "password",
-                                      "\$",
-                                      pexpect.TIMEOUT ],
-                    timeout=60 )
+                i = self.handle.expect( [ "password",
+                                          "\$",
+                                          pexpect.TIMEOUT ],
+                                        timeout=60 )
                 if i == 0:
                     self.handle.sendline( self.pwd )
                     self.handle.expect( "\$", timeout=30 )
@@ -176,7 +186,7 @@
         try:
             self.handle.sendline( "exit" )
             self.handle.expect( "closed" )
-        except Exception:
+        except pexpect.ExceptionPexpect:
             main.log.exception( "Connection failed to the host" )
             response = main.FALSE
         return response
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index eaed3a2..29265bf 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -51,6 +51,7 @@
     def __init__( self ):
         super( Emulator, self ).__init__()
         self.handle = self
+        self.name = None
         self.wrapped = sys.modules[ __name__ ]
         self.flag = 0
 
@@ -72,16 +73,16 @@
                 pwd=self.pwd )
 
             if self.handle:
-                main.log.info("Connection successful to the host " +
-                        self.user_name +
-                        "@" +
-                        self.ip_address )
+                main.log.info( "Connection successful to the host " +
+                               self.user_name +
+                               "@" +
+                               self.ip_address )
                 return main.TRUE
             else:
                 main.log.error( "Connection failed to the host " +
-                        self.user_name +
-                        "@" +
-                        self.ip_address )
+                                self.user_name +
+                                "@" +
+                                self.ip_address )
                 main.log.error( "Failed to connect to the Mininet CLI" )
                 return main.FALSE
         except pexpect.EOF:
@@ -94,11 +95,10 @@
             main.cleanup()
             main.exit()
 
-
-    def startNet( self, topoFile = '', args = '', timeout = 120 ):
+    def startNet( self, topoFile='', args='', timeout=120 ):
         """
         Starts Mininet accepts a topology(.py) file and/or an optional
-        arguement ,to start the mininet, as a parameter.
+        argument ,to start the mininet, as a parameter.
         Returns main.TRUE if the mininet starts successfully and
                 main.FALSE otherwise
         """
@@ -115,7 +115,7 @@
             if i == 0:
                 main.log.info( self.name + ": Sending sudo password" )
                 self.handle.sendline( self.pwd )
-                i = self.handle.expect( [ '%s:' % ( self.user ),
+                i = self.handle.expect( [ '%s:' % self.user,
                                           '\$',
                                           pexpect.EOF,
                                           pexpect.TIMEOUT ],
@@ -128,7 +128,7 @@
                 main.log.error(
                     self.name +
                     ": Something while cleaning MN took too long... " )
-            if topoFile == ''  and  args ==  '':
+            if topoFile == '' and args == '':
                 main.log.info( self.name + ": building fresh mininet" )
                 # for reactive/PARP enabled tests
                 cmdString = "sudo mn " + self.options[ 'arg1' ] +\
@@ -177,15 +177,14 @@
                 return main.TRUE
             else:
                 main.log.info( "Starting topo file " + topoFile )
-                if args == None:
+                if args is None:
                     args = ''
                 else:
                     main.log.info( "args = " + args)
                 self.handle.sendline( 'sudo ' + topoFile + ' ' + args)
-                i = 1
                 i = self.handle.expect( [ 'mininet>',
-                                        pexpect.EOF ,
-                                        pexpect.TIMEOUT ],
+                                          pexpect.EOF,
+                                          pexpect.TIMEOUT ],
                                         timeout)
                 if i == 0:
                     main.log.info(self.name + ": Network started")
@@ -241,10 +240,8 @@
             numLinks = totalNumHosts + ( numSwitches - 1 )
             print "num_switches for %s(%d,%d) = %d and links=%d" %\
                 ( topoType, depth, fanout, numSwitches, numLinks )
-        topoDict = {}
-        topoDict = {
-            "num_switches": int( numSwitches ),
-            "num_corelinks": int( numLinks ) }
+        topoDict = { "num_switches": int( numSwitches ),
+                     "num_corelinks": int( numLinks ) }
         return topoDict
 
     def calculateSwAndLinks( self ):
@@ -394,6 +391,7 @@
             main.log.error( self.name + ": Connection failed to the host" )
 
     def verifySSH( self, **connectargs ):
+        # FIXME: Who uses this and what is the purpose? seems very specific
         try:
             response = self.execute(
                 cmd="h1 /usr/sbin/sshd -D&",
@@ -434,17 +432,16 @@
         if self.handle:
             try:
                 # Bring link between oldSw-host down
-                cmd = "py net.configLinkStatus('" + oldSw + "'," + "'" + host + "'," +\
-                "'down')"
+                cmd = "py net.configLinkStatus('" + oldSw + "'," + "'"+ host +\
+                      "'," + "'down')"
                 print "cmd1= ", cmd
-                response = self.execute(
-                cmd=cmd,
-                prompt="mininet>",
-                timeout=10 )
+                response = self.execute( cmd=cmd,
+                                         prompt="mininet>",
+                                         timeout=10 )
      
                 # Determine hostintf and Oldswitchintf
                 cmd = "px hintf,sintf = " + host + ".connectionsTo(" + oldSw +\
-                ")[0]"
+                      ")[0]"
                 print "cmd2= ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )
@@ -474,7 +471,7 @@
  
                 # Determine hostintf and Newswitchintf
                 cmd = "px hintf,sintf = " + host + ".connectionsTo(" + newSw +\
-                ")[0]"
+                      ")[0]"
                 print "cmd6= ", cmd
                 self.handle.sendline( cmd )
                 self.handle.expect( "mininet>" )                 
@@ -563,7 +560,7 @@
 
     def addStaticMACAddress( self, host, GW, macaddr ):
         """
-           Changes the mac address of a geateway host"""
+           Changes the mac address of a gateway host"""
         if self.handle:
             try:
                 # h1  arp -s 10.0.1.254 00:00:00:00:11:11
@@ -573,7 +570,7 @@
                 response = self.handle.before
                 main.log.info( "response = " + response )
                 main.log.info(
-                    "Mac adrress of gateway " +
+                    "Mac address of gateway " +
                     GW +
                     " changed to " +
                     macaddr )
@@ -802,7 +799,7 @@
             self.handle.expect( "mininet>" )
             response = self.handle.before
             if re.search( 'Results:', response ):
-                main.log.info( self.name + ": iperf test succssful" )
+                main.log.info( self.name + ": iperf test successful" )
                 return main.TRUE
             else:
                 main.log.error( self.name + ": iperf test failed" )
@@ -1058,10 +1055,10 @@
             dynamic_topo branch
         NOTE: cannot currently specify what type of switch
         required params:
-            switchname = name of the new switch as a string
-        optional keyvalues:
+            sw = name of the new switch as a string
+        optional keywords:
             dpid = "dpid"
-        returns: main.FASLE on an error, else main.TRUE
+        returns: main.FALSE on an error, else main.TRUE
         """
         dpid = kwargs.get( 'dpid', '' )
         command = "addswitch " + str( sw ) + " " + str( dpid )
@@ -1093,8 +1090,8 @@
         NOTE: This uses a custom mn function. MN repo should be on
             dynamic_topo branch
         required params:
-            switchname = name of the switch as a string
-        returns: main.FASLE on an error, else main.TRUE"""
+            sw = name of the switch as a string
+        returns: main.FALSE on an error, else main.TRUE"""
         command = "delswitch " + str( sw )
         try:
             response = self.execute(
@@ -1127,7 +1124,7 @@
            required params:
            node1 = the string node name of the first endpoint of the link
            node2 = the string node name of the second endpoint of the link
-           returns: main.FASLE on an error, else main.TRUE"""
+           returns: main.FALSE on an error, else main.TRUE"""
         command = "addlink " + str( node1 ) + " " + str( node2 )
         try:
             response = self.execute(
@@ -1159,7 +1156,7 @@
            required params:
            node1 = the string node name of the first endpoint of the link
            node2 = the string node name of the second endpoint of the link
-           returns: main.FASLE on an error, else main.TRUE"""
+           returns: main.FALSE on an error, else main.TRUE"""
         command = "dellink " + str( node1 ) + " " + str( node2 )
         try:
             response = self.execute(
@@ -1193,7 +1190,7 @@
             hostname = the string hostname
         optional key-value params
             switch = "switch name"
-            returns: main.FASLE on an error, else main.TRUE
+            returns: main.FALSE on an error, else main.TRUE
         """
         switch = kwargs.get( 'switch', '' )
         command = "addhost " + str( hostname ) + " " + str( switch )
@@ -1230,7 +1227,7 @@
            NOTE: this uses a custom mn function
            required params:
            hostname = the string hostname
-           returns: main.FASLE on an error, else main.TRUE"""
+           returns: main.FALSE on an error, else main.TRUE"""
         command = "delhost " + str( hostname )
         try:
             response = self.execute(
@@ -1261,7 +1258,7 @@
         """
         self.handle.sendline('')
         i = self.handle.expect( [ 'mininet>', pexpect.EOF, pexpect.TIMEOUT ],
-                                timeout = 2)
+                                timeout=2)
         if i == 0:
             self.stopNet()
         elif i == 1:
@@ -1276,10 +1273,10 @@
             main.log.error( "Connection failed to the host" )
         return response
 
-    def stopNet( self , timeout = 5):
+    def stopNet( self, timeout=5):
         """
         Stops mininet.
-        Returns main.TRUE if the mininet succesfully stops and
+        Returns main.TRUE if the mininet successfully stops and
                 main.FALSE if the pexpect handle does not exist.
 
         Will cleanup and exit the test if mininet fails to stop
@@ -1325,8 +1322,6 @@
             response = main.FALSE
         return response
 
-
-
     def arping( self, src, dest, destmac ):
         self.handle.sendline( '' )
         self.handle.expect( [ "mininet", pexpect.EOF, pexpect.TIMEOUT ] )
@@ -1388,12 +1383,10 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
-        else:
-            main.log.info( response )
 
     def startTcpdump( self, filename, intf="eth0", port="port 6633" ):
         """
-           Runs tpdump on an intferface and saves the file
+           Runs tpdump on an interface and saves the file
            intf can be specified, or the default eth0 is used"""
         try:
             self.handle.sendline( "" )
@@ -1449,7 +1442,8 @@
             main.exit()
 
     def stopTcpdump( self ):
-        "pkills tcpdump"
+        """
+            pkills tcpdump"""
         try:
             self.handle.sendline( "sh sudo pkill tcpdump" )
             self.handle.expect( "mininet>" )
@@ -1480,8 +1474,7 @@
             ports = []
             for port in switch.ports.values():
                 ports.append( { 'of_port': port.port_no,
-                                'mac': str( port.hw_addr ).replace( '\'',
-                                                                   '' ),
+                                'mac': str( port.hw_addr ).replace( '\'', '' ),
                                 'name': port.name } )
             output[ 'switches' ].append( {
                 "name": switch.name,
@@ -1562,17 +1555,15 @@
             ports = []
             for port in switch.ports.values():
                 # print port.hw_addr.toStr( separator='' )
-                tmpPort = {}
-                tmpPort[ 'of_port' ] = port.port_no
-                tmpPort[ 'mac' ] = str( port.hw_addr ).replace( '\'', '' )
-                tmpPort[ 'name' ] = port.name
-                tmpPort[ 'enabled' ] = port.enabled
+                tmpPort = { 'of_port': port.port_no,
+                            'mac': str( port.hw_addr ).replace( '\'', '' ),
+                            'name': port.name,
+                            'enabled': port.enabled }
 
                 ports.append( tmpPort )
-            tmpSwitch = {}
-            tmpSwitch[ 'name' ] = switch.name
-            tmpSwitch[ 'dpid' ] = str( switch.dpid ).zfill( 16 )
-            tmpSwitch[ 'ports' ] = ports
+            tmpSwitch = { 'name': switch.name,
+                          'dpid': str( switch.dpid ).zfill( 16 ),
+                          'ports': ports }
 
             output[ 'switches' ].append( tmpSwitch )
 
@@ -1653,8 +1644,7 @@
 
            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
-        linkResults = main.TRUE
+        #        ONOS has what is in MN
         output = { "switches": [] }
         onos = linksJson
         # iterate through the MN topology and pull out switches and and port
@@ -1666,8 +1656,7 @@
             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( '\'',
-                                                                   '' ),
+                                'mac': str( port.hw_addr ).replace( '\'', '' ),
                                 'name': port.name } )
             output[ 'switches' ].append( {
                 "name": switch.name,
@@ -1743,7 +1732,7 @@
                         main.log.warn(
                             'The port numbers do not match for ' +
                             str( link ) +
-                            ' between ONOS and MN. When cheking ONOS for ' +
+                            ' between ONOS and MN. When checking ONOS for ' +
                             'link %s/%s -> %s/%s' %
                             ( node1,
                               port1,
@@ -1765,7 +1754,7 @@
                         main.log.warn(
                             'The port numbers do not match for ' +
                             str( link ) +
-                            ' between ONOS and MN. When cheking ONOS for ' +
+                            ' between ONOS and MN. When checking ONOS for ' +
                             'link %s/%s -> %s/%s' %
                             ( node2,
                               port2,
@@ -1818,7 +1807,7 @@
            updates the port address and status information for
            each port in mn"""
         # TODO: Add error checking. currently the mininet command has no output
-        main.log.info( "Updateing MN port information" )
+        main.log.info( "Updating MN port information" )
         try:
             self.handle.sendline( "" )
             self.handle.expect( "mininet>" )
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index d842cbb..8e445a9 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -39,6 +39,7 @@
     def __init__( self ):
         super( Emulator, self ).__init__()
         self.handle = self
+        self.name = None
         self.wrapped = sys.modules[ __name__ ]
         self.flag = 0
 
@@ -58,8 +59,6 @@
             port=None,
             pwd=self.pwd )
 
-        self.sshHandle = self.handle
-
         # Copying the readme file to process the
         if self.handle:
             return main.TRUE
@@ -98,7 +97,7 @@
 
     def pingLong( self, **pingParams ):
         """
-        Starts a continuous ping on the mininet host outputing
+        Starts a continuous ping on the mininet host outputting
         to a file in the /tmp dir.
         """
         self.handle.sendline( "" )
@@ -108,8 +107,9 @@
         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" ] + " &"
+                  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( "" )
@@ -181,7 +181,7 @@
 
     def pingHostOptical( self, **pingParams ):
         """
-        This function is only for Packey Optical related ping
+        This function is only for Packet Optical related ping
         Use the next pingHost() function for all normal scenarios )
         Ping from one mininet host to another
         Currently the only supported Params: SRC and TARGET
@@ -280,7 +280,7 @@
             port="port 6633",
             user="admin" ):
         """
-        Runs tpdump on an intferface and saves the file
+        Runs tcpdump on an interface and saves the file
         intf can be specified, or the default eth0 is used
         """
         try:
@@ -328,7 +328,8 @@
             main.exit()
 
     def stopTcpdump( self ):
-        "pkills tcpdump"
+        """
+            pkills tcpdump"""
         try:
             self.handle.sendline( "sudo pkill tcpdump" )
             self.handle.sendline( "" )
@@ -369,9 +370,9 @@
         if self.handle:
             # Close the ssh connection
             self.handle.sendline( "" )
-            #self.handle.expect( "\$" )
+            # self.handle.expect( "\$" )
             i = self.handle.expect( [ '\$', 'mininet>', pexpect.TIMEOUT ],
-                                timeout = 2)
+                                    timeout=2)
             if i == 0:
                 self.handle.sendline( "exit" )
                 self.handle.expect( "closed" )
@@ -390,7 +391,7 @@
     def getFlowTable( self, protoVersion, sw ):
         """
          TODO document usage
-         TODO add option to look at cookies. ignoreing them for now
+         TODO add option to look at cookies. ignoring them for now
 
          print "get_flowTable(" + str( protoVersion ) +" " + str( sw ) +")"
          NOTE: Use format to force consistent flow table output across
@@ -563,7 +564,7 @@
                             str( rule ) )
 
                         infoString = "Rules added to " + str( self.name )
-                        infoString += "iptable rule added to block IP: " + \
+                        infoString += "iptables rule added to block IP: " + \
                             str( dstIp )
                         infoString += "Port: " + \
                             str( dstPort ) + " Rule: " + str( rule )
diff --git a/TestON/drivers/common/cli/emulatordriver.py b/TestON/drivers/common/cli/emulatordriver.py
index bb8da7c..778a32b 100644
--- a/TestON/drivers/common/cli/emulatordriver.py
+++ b/TestON/drivers/common/cli/emulatordriver.py
@@ -19,12 +19,6 @@
 
 
 """
-import pexpect
-import struct
-import fcntl
-import os
-import sys
-import signal
 import sys
 sys.path.append( "../" )
 from drivers.common.clidriver import CLI
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 02922af..2d1ab22 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -31,6 +31,9 @@
         """
         Initialize client
         """
+        self.name = None
+        self.home = None
+        self.handle = None
         super( CLI, self ).__init__()
 
     def connect( self, **connectargs ):
@@ -81,6 +84,7 @@
         Called when Test is complete to disconnect the ONOS handle.
         """
         response = main.TRUE
+        # noinspection PyBroadException
         try:
             self.logout()
             self.handle.sendline( "" )
@@ -171,7 +175,7 @@
 
     def startOnosCli( self, ONOSIp, karafTimeout="" ):
         """
-        karafTimeout is an optional arugument. karafTimeout value passed
+        karafTimeout is an optional argument. 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.
@@ -247,11 +251,11 @@
             main.cleanup()
             main.exit()
 
-    def log( self, cmdStr , level = "" ):
+    def log( self, cmdStr, level="" ):
         """
             log  the commands in the onos CLI.
             returns main.TRUE on success
-            returns main.FALSE if Error occured
+            returns main.FALSE if Error occurred
             Available level: DEBUG, TRACE, INFO, WARN, ERROR
             Level defaults to INFO
         """
@@ -335,6 +339,7 @@
         Optional:
             * tcpPort
         """
+        # noinspection PyBroadException
         try:
             cmdStr = "add-node " + str( nodeId ) + " " +\
                 str( ONOSIp ) + " " + str( tcpPort )
@@ -413,7 +418,7 @@
     def topology( self ):
         """
         Shows the current state of the topology
-        by issusing command: 'onos> onos:topology'
+        by issuing command: 'onos> onos:topology'
         """
         try:
             # either onos:topology or 'topology' will work in CLI
@@ -474,7 +479,8 @@
                 self.sendline( cmdStr )
                 # TODO: Check for possible error responses from karaf
             else:
-                main.log.info( "Feature needs to be installed before uninstalling it" )
+                main.log.info( "Feature needs to be installed before " +
+                               "uninstalling it" )
             return main.TRUE
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
@@ -617,7 +623,7 @@
                 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 the following commads:
+                sequence using the following commands:
 
                 ansiEscape = re.compile( r'\r\r\n\x1b[^m]*m' )
                 handle1 = ansiEscape.sub( '', handle )
@@ -830,7 +836,7 @@
         """
         Return the first host from the hosts api whose 'id' contains 'mac'
 
-        Note: mac must be a colon seperated mac address, but could be a
+        Note: mac must be a colon separated mac address, but could be a
               partial mac address
 
         Return None if there is no match
@@ -911,7 +917,7 @@
             * hostIdOne: ONOS host id for host1
             * hostIdTwo: ONOS host id for host2
         Description:
-            Adds a host-to-host intent ( bidrectional ) by
+            Adds a host-to-host intent ( bidirectional ) by
             specifying the two hosts.
         Returns:
             A string of the intent id or None on Error
@@ -1031,8 +1037,6 @@
               intent via cli
         """
         try:
-            cmd = ""
-
             # If there are no optional arguments
             if not ethType and not ethSrc and not ethDst\
                     and not bandwidth and not lambdaAlloc \
@@ -1170,12 +1174,10 @@
             A string of the intent id or None on error
 
         NOTE: This function may change depending on the
-              options developers provide for multipointpoint-to-singlepoint
+              options developers provide for multipoint-to-singlepoint
               intent via cli
         """
         try:
-            cmd = ""
-
             # If there are no optional arguments
             if not ethType and not ethSrc and not ethDst\
                     and not bandwidth and not lambdaAlloc\
@@ -1283,8 +1285,8 @@
             main.cleanup()
             main.exit()
 
-    def removeIntent( self, intentId, app = 'org.onosproject.cli',
-        purge = False, sync = False ):
+    def removeIntent( self, intentId, app='org.onosproject.cli',
+                      purge=False, sync=False ):
         """
         Remove intent for specified application id and intent id
         Optional args:- 
@@ -1391,8 +1393,8 @@
             Accepts a single intent ID (string type) or a list of intent IDs.
             Returns the state(string type) of the id if a single intent ID is
             accepted.
-            Returns a dictionary with intent IDs as the key and its corresponding
-            states as the values
+            Returns a dictionary with intent IDs as the key and its
+            corresponding states as the values
             Parameters:
             intentId: intent ID (string type)
             intentsJson: parsed json object from the onos:intents api
@@ -1404,17 +1406,18 @@
         try:
             state = "State is Undefined"
             if not intentsJson:
-                intentsJsonTemp = json.loads(self.intents())
+                intentsJsonTemp = json.loads( self.intents() )
             else:
-                intentsJsonTemp = json.loads(intentsJson)
-            if isinstance(intentsId,types.StringType):
+                intentsJsonTemp = json.loads( intentsJson )
+            if isinstance( intentsId, types.StringType ):
                 for intent in intentsJsonTemp:
                     if intentsId == intent['id']:
                         state = intent['state']
                         return state
-                main.log.info("Cannot find intent ID" + str(intentsId) +" on the list")
+                main.log.info( "Cannot find intent ID" + str( intentsId ) +
+                               " on the list" )
                 return state
-            elif isinstance(intentsId,types.ListType):
+            elif isinstance( intentsId, types.ListType ):
                 dictList = []
                 for ID in intentsId:
                     stateDict = {}
@@ -1422,16 +1425,14 @@
                         if ID == intents['id']:
                             stateDict['state'] = intents['state']
                             stateDict['id'] = ID
-                            dictList.append(stateDict)
+                            dictList.append( stateDict )
                             break
-                if len(intentsId) != len(dictList):
-                    main.log.info("Cannot find some of the intent ID state")
+                if len( intentsId ) != len( dictList ):
+                    main.log.info( "Cannot find some of the intent ID state" )
                 return dictList
             else:
                 main.log.info("Invalid intents ID entry")
                 return None
-            main.log.info("Something went wrong getting intent ID state")
-            return None
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return None
@@ -1479,7 +1480,7 @@
             main.exit()
 
     def pushTestIntents( self, dpidSrc, dpidDst, numIntents,
-                          numMult="", appId="", report=True ):
+                         numMult="", appId="", report=True ):
         """
         Description:
             Push a number of intents in a batch format to
@@ -1775,21 +1776,21 @@
 
     def checkStatus( self, ip, numoswitch, numolink, logLevel="info" ):
         """
-        Checks the number of swithes & links that ONOS sees against the
+        Checks the number of switches & links that ONOS sees against the
         supplied values. By default this will report to main.log, but the
-        log level can be specifid.
+        log level can be specified.
 
         Params: ip = ip used for the onos cli
                 numoswitch = expected number of switches
-                numlink = expected number of links
+                numolink = expected number of links
                 logLevel = level to log to. Currently accepts
                 'info', 'warn' and 'report'
 
 
         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,
+        Returns: main.TRUE if the number of switches and links are correct,
+                 main.FALSE if the number of switches and links is incorrect,
                  and main.ERROR otherwise
         """
         try:
@@ -1807,13 +1808,12 @@
             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"
+                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 matc\
-                    h what was expected"
+                output += "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)" % (
@@ -2138,7 +2138,7 @@
 
     def intentSummary( self ):
         """
-        Returns a dictonary containing the current intent states and the count
+        Returns a dictionary containing the current intent states and the count
         """
         try:
             intents = self.intents( )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index ff331d4..04ef1f8 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -30,6 +30,9 @@
         """
         Initialize client
         """
+        self.name = None
+        self.home = None
+        self.handle = None
         super( CLI, self ).__init__()
 
     def connect( self, **connectargs ):
@@ -167,7 +170,7 @@
             while True:
                 i = self.handle.expect( [
                     'There\sis\sinsufficient\smemory\sfor\sthe\sJava\s' +
-                        'Runtime\sEnvironment\sto\scontinue',
+                    'Runtime\sEnvironment\sto\scontinue',
                     'BUILD\sFAILURE',
                     'BUILD\sSUCCESS',
                     'ONOS\$',
@@ -203,7 +206,7 @@
                     main.exit()
                 else:
                     main.log.error( self.name + ": unexpected response from " +
-                            "mvn clean install" )
+                                    "mvn clean install" )
                     # return main.FALSE
                     main.cleanup()
                     main.exit()
@@ -350,7 +353,7 @@
                   'Switched\sto\sbranch\s\'' + str( branch ),
                   pexpect.TIMEOUT,
                   'error: Your local changes to the following files' +
-                          'would be overwritten by checkout:',
+                  'would be overwritten by checkout:',
                   'error: you need to resolve your current index first',
                   "You are in 'detached HEAD' state.",
                   "HEAD is now at " ],
@@ -443,7 +446,7 @@
     def getVersion( self, report=False ):
         """
         Writes the COMMIT number to the report to be parsed
-                by Jenkins data collecter.
+                by Jenkins data collector.
         """
         try:
             self.handle.sendline( "" )
@@ -489,7 +492,7 @@
             main.exit()
 
     def createCellFile( self, benchIp, fileName, mnIpAddrs,
-                         extraFeatureString, *onosIpAddrs ):
+                        extraFeatureString, *onosIpAddrs ):
         """
         Creates a cell file based on arguments
         Required:
@@ -913,7 +916,7 @@
                     " not configured" )
                 return main.FALSE
             else:
-                main.log.info( "ONOS instasnce was not killed" )
+                main.log.info( "ONOS instance was not killed" )
                 return main.FALSE
 
         except pexpect.EOF:
@@ -1145,21 +1148,21 @@
             numolink,
             logLevel="info" ):
         """
-        Checks the number of swithes & links that ONOS sees against the
+        Checks the number of switches & links that ONOS sees against the
         supplied values. By default this will report to main.log, but the
-        log level can be specifid.
+        log level can be specific.
 
         Params: ip = ip used for the onos cli
                 numoswitch = expected number of switches
-                numlink = expected number of links
+                numolink = expected number of links
                 logLevel = level to log to.
                 Currently accepts 'info', 'warn' and 'report'
 
 
         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,
+        Returns: main.TRUE if the number of switches and links are correct,
+                 main.FALSE if the number of switches and links is incorrect,
                  and main.ERROR otherwise
         """
         try:
@@ -1175,7 +1178,7 @@
             switchCheck = ( int( devices ) == int( numoswitch ) )
             # Is the number of links is what we expected
             linkCheck = ( int( links ) == int( numolink ) )
-            if ( switchCheck and linkCheck ):
+            if switchCheck and linkCheck:
                 # We expected the correct numbers
                 output = output + "The number of links and switches match "\
                     + "what was expected"
@@ -1185,8 +1188,8 @@
                     "The number of links and switches does not match " + \
                     "what was expected"
                 result = main.FALSE
-            output = output + "\n ONOS sees %i devices" % int ( devices )
-            output = output + " (%i expected) " %  int( numoswitch )
+            output = output + "\n ONOS sees %i devices" % int( devices )
+            output = output + " (%i expected) " % int( numoswitch )
             output = output + "and %i links " % int( links )
             output = output + "(%i expected)" % int( numolink )
             if logLevel == "report":
@@ -1306,7 +1309,6 @@
             main.cleanup()
             main.exit()
 
-
     def tsharkStop( self ):
         """
         Removes wireshark files from /tmp and kills all tshark processes
@@ -1315,8 +1317,8 @@
         try:
             self.execute( cmd="sudo rm /tmp/wireshark*" )
             self.handle.sendline( "" )
-            self.handle.sendline( "sudo kill -9 `ps -ef | grep \"tshark -i\" |" +
-                                  " grep -v grep | awk '{print $2}'`" )
+            self.handle.sendline( "sudo kill -9 `ps -ef | grep \"tshark -i\"" +
+                                  " | grep -v grep | awk '{print $2}'`" )
             self.handle.sendline( "" )
             main.log.info( "Tshark stopped" )
         except pexpect.EOF:
@@ -1329,7 +1331,6 @@
             main.cleanup()
             main.exit()
 
-
     def ptpd( self, args ):
         """
         Initiate ptp with user-specified args.
@@ -1369,7 +1370,7 @@
             main.exit()
 
     def cpLogsToDir( self, logToCopy,
-                       destDir, copyFileName="" ):
+                     destDir, copyFileName="" ):
         """
         Copies logs to a desired directory.
         Current implementation of ONOS deletes its karaf
@@ -1421,7 +1422,6 @@
         except Exception:
             main.log.exception( "Copying files failed" )
 
-
     def checkLogs( self, onosIp ):
         """
         runs onos-check-logs on the given onos node
@@ -1479,7 +1479,7 @@
 
     def setIpTables( self, ip, port='', action='add', packet_type='tcp',
                      direction='INPUT', rule='DROP' ):
-        '''
+        """
         Description:
             add or remove iptables rule to DROP (default) packets from
             specific IP and PORT
@@ -1499,7 +1499,7 @@
         WARNING:
         * This function uses root privilege iptables command which may result
           in unwanted network errors. USE WITH CAUTION
-        '''
+        """
         import time
 
         # NOTE*********
@@ -1576,10 +1576,10 @@
             main.exit()
 
     def detailed_status(self, log_filename):
-        '''
+        """
         This method is used by STS to check the status of the controller
         Reports RUNNING, STARTING, STOPPED, FROZEN, ERROR (and reason)
-        '''
+        """
         import re
         try:
             self.handle.sendline( "" )
@@ -1604,7 +1604,7 @@
             #      return 'FROZEN'
             else:
                 main.log.warn( self.name +
-                               " WARNING: status recieved unknown response" )
+                               " WARNING: status received unknown response" )
                 main.log.warn( response )
                 return 'ERROR', "Unknown response: %s" % response
         except pexpect.TIMEOUT: