Cleaned up emulator driver
diff --git a/TestON/drivers/common/cli/emulator/lincoedriver.py b/TestON/drivers/common/cli/emulator/lincoedriver.py
index 2cb7c98..944eded 100644
--- a/TestON/drivers/common/cli/emulator/lincoedriver.py
+++ b/TestON/drivers/common/cli/emulator/lincoedriver.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-'''
+"""
 This driver handles the optical switch emulator linc-oe.
 
 Please follow the coding style demonstrated by existing
@@ -13,8 +13,7 @@
     shreya@onlab.us
 
 OCT 20 2014
-'''
-
+"""
 import traceback
 import pexpect
 import struct
@@ -25,117 +24,122 @@
 import sys
 import core.teston
 import time
-sys.path.append("../")
+sys.path.append( "../" )
 from math import pow
 from drivers.common.cli.emulatordriver import Emulator
 from drivers.common.clidriver import CLI
 
-class LincOEDriver(Emulator):
-    '''
-    LincOEDriver class will handle all emulator functions    
-    '''
-    def __init__(self):
-        super(Emulator, self).__init__()
+
+class LincOEDriver( Emulator ):
+
+    """
+    LincOEDriver class will handle all emulator functions
+    """
+    def __init__( self ):
+        super( Emulator, self ).__init__()
         self.handle = self
-        self.wrapped = sys.modules[__name__]
+        self.wrapped = sys.modules[ __name__ ]
         self.flag = 0
 
-    def connect(self, **connectargs):
-        '''
+    def connect( self, **connectargs ):
+        """
         Create ssh handle for Linc-OE cli
-        '''
+        """
         import time
 
         for key in connectargs:
-            vars(self)[key] = connectargs[key]       
-        
-        self.name = self.options['name']
+            vars( self )[ key ] = connectargs[ key ]
+
+        self.name = self.options[ 'name' ]
         self.handle = \
-                super(LincOEDriver, self).connect(\
-                user_name = self.user_name,
-                ip_address = self.ip_address,
-                port = None, 
-                pwd = self.pwd)
-        
+            super( LincOEDriver, self ).connect(
+                user_name=self.user_name,
+                ip_address=self.ip_address,
+                port=None,
+                pwd=self.pwd )
+
         self.ssh_handle = self.handle
-        
-        if self.handle :
-            main.log.info("Handle successfully created")
+
+        if self.handle:
+            main.log.info( "Handle successfully created" )
             self.home = "~/linc-oe"
-         
-            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)
+
+            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])
+                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")
+                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) 
-            main.log.error(self.name+
-                    ": Failed to connect to Linc-OE")
+            main.log.error( self.name +
+                            ": Connection failed to the host " +
+                            self.user_name + "@" + self.ip_address )
+            main.log.error( self.name +
+                            ": Failed to connect to Linc-OE" )
             return main.FALSE
 
-
-    def start_console(self):
+    def start_console( self ):
         import time
-        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])
+        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 ] )
         start_result = self.handle.before
         if j == 0:
-            main.log.info("Linc-OE CLI started")
+            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)
-            main.log.error(self.name+
-            ": Failed to connect to Linc-OE")
+            main.log.error(
+                self.name +
+                ": Connection failed to the host " +
+                self.user_name +
+                "@" +
+                self.ip_address )
+            main.log.error( self.name +
+                            ": Failed to connect to Linc-OE" )
             return main.FALSE
 
-
-
-    def build(self):
-        '''
+    def build( self ):
+        """
         Build Linc-OE with the specified settings
-        '''
+        """
         try:
-            self.handle.sendline("make rel")
-            i = self.handle.expect([
+            self.handle.sendline( "make rel" )
+            i = self.handle.expect( [
                 "ERROR",
-                "\$"])
+                "\$" ] )
 
             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("\$")
-                    
+                # 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( "\$" )
+
                 handle = self.handle.before
                 return handle
 
@@ -143,226 +147,225 @@
                 return main.TRUE
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def set_interface_up(self, intfs):
-        '''
+    def set_interface_up( self, intfs ):
+        """
         Specify interface to bring up.
         When Linc-OE is started, tap interfaces should
         be created. They must be brought up manually
-        '''
+        """
         try:
-            self.handle.sendline("ifconfig "+str(intfs)+" up")
-            self.handle.expect("linc@")
-   
+            self.handle.sendline( "ifconfig " + str( intfs ) + " up" )
+            self.handle.expect( "linc@" )
+
             handle = self.handle.before
 
             return handle
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def start_switch(self, sw_id):
-        '''
+    def start_switch( self, sw_id ):
+        """
         Start a logical switch using switch id
-        '''
+        """
         try:
-            self.handle.sendline("linc:start_switch("+str(sw_id)+").")
-            self.handle.expect("linc@")
+            self.handle.sendline( "linc:start_switch(" + str( sw_id ) + ")." )
+            self.handle.expect( "linc@" )
 
             handle = self.handle.before
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def stop_switch(self, sw_id):
-        '''
+    def stop_switch( self, sw_id ):
+        """
         Stop a logical switch using switch id
-        '''
+        """
         try:
-            self.handle.sendline("linc:stop_switch("+str(sw_id)+").")
-            self.handle.expect("linc@")
+            self.handle.sendline( "linc:stop_switch(" + str( sw_id ) + ")." )
+            self.handle.expect( "linc@" )
 
             handle = self.handle.before
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
-     
-    def get_datapath_id(self, sw_id):
-        '''
+
+    def get_datapath_id( self, sw_id ):
+        """
         Get datapath id of a specific switch by switch id
-        '''
+        """
         try:
-            self.handle.sendline("linc_logic:get_datapath_id("+
-                    str(sw_id)+").")
-            self.handle.expect("linc@")
+            self.handle.sendline( "linc_logic:get_datapath_id(" +
+                                  str( sw_id ) + ")." )
+            self.handle.expect( "linc@" )
 
             handle = self.handle.before
-        
+
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def list_ports(self, sw_id):
-        '''
+    def list_ports( self, sw_id ):
+        """
         List all ports of a switch by switch id
-        '''
+        """
         try:
-            self.handle.sendline("linc:ports("+str(sw_id)+").")
-            self.handle.expect("linc@")
+            self.handle.sendline( "linc:ports(" + str( sw_id ) + ")." )
+            self.handle.expect( "linc@" )
 
             handle = self.handle.before
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
-    def port_up(self, sw_id, pt_id):
-        '''
+    def port_up( self, sw_id, pt_id ):
+        """
         Bring port up using switch id and port id
-        '''
+        """
         try:
-            self.handle.sendline("linc:port_up("+
-                    str(sw_id)+", "+str(pt_id)+").")
-            self.handle.expect("linc@")
+            self.handle.sendline( "linc:port_up(" +
+                                  str( sw_id ) + ", " + str( pt_id ) + ")." )
+            self.handle.expect( "linc@" )
 
             handle = self.handle.before
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
-    
-    def port_down(self, sw_id, pt_id):
-        '''
+
+    def port_down( self, sw_id, pt_id ):
+        """
         Bring port down using switch id and port id
-        '''
+        """
         try:
-            self.handle.sendline("linc:port_down("+
-                    str(sw_id)+", "+str(pt_id)+").")
-            self.handle.expect("linc@")
+            self.handle.sendline( "linc:port_down(" +
+                                  str( sw_id ) + ", " + str( pt_id ) + ")." )
+            self.handle.expect( "linc@" )
 
             handle = self.handle.before
 
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
-    
-    def stopLincOEConsole(self):
-        '''
+
+    def stopLincOEConsole( self ):
+        """
         This function is only used for packet optical testing
         Send disconnect prompt to Linc-OE CLI
-        (CTRL+C) and kill the linc process
-        '''
+        ( CTRL+C ) and kill the linc process
+        """
         try:
             cmd = "pgrep -f linc"
-            self.handle.sendline("pgrep -f linc")
-            self.handle.expect("linc") 
+            self.handle.sendline( "pgrep -f linc" )
+            self.handle.expect( "linc" )
             print "stophandle = ", self.handle.before
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before) 
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
 
-    def disconnect(self):
-        '''
+    def disconnect( self ):
+        """
         Send disconnect prompt to Linc-OE CLI
-        (CTRL+C) and kill the linc process
-        '''
+        ( CTRL+C ) and kill the linc process
+        """
         try:
-            #Send CTRL+C twice to exit CLI
-            self.handle.send("\x03")
-            self.handle.send("\x03")
-            self.handle.expect("\$")
+            # Send CTRL+C twice to exit CLI
+            self.handle.send( "\x03" )
+            self.handle.send( "\x03" )
+            self.handle.expect( "\$" )
             handle1 = self.handle.before
             cmd = "pgrep -f linc"
-            self.handle.sendline(cmd)
-            self.handle.expect("\$")
+            self.handle.sendline( cmd )
+            self.handle.expect( "\$" )
             handle2 = self.handle.before
-            main.log.info("pid's = "+handle2)
+            main.log.info( "pid's = " + handle2 )
             cmd = "sudo kill -9 `pgrep -f linc`"
-            self.handle.sendline(cmd)
-            self.handle.expect("\$")
-            
+            self.handle.sendline( cmd )
+            self.handle.expect( "\$" )
+
         except pexpect.EOF:
-            main.log.error(self.name+ ": EOF exception")
-            main.log.error(self.name+ ":    " + self.handle.before)
+            main.log.error( self.name + ": EOF exception" )
+            main.log.error( self.name + ":    " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name+" :::::::")
-            main.log.error( traceback.print_exc())
-            main.log.info(self.name+" :::::::")
+            main.log.info( self.name + " :::::::" )
+            main.log.error( traceback.print_exc() )
+            main.log.info( self.name + " :::::::" )
             main.cleanup()
             main.exit()
 
 if __name__ != "__main__":
     import sys
-    sys.modules[__name__] = LincOEDriver()
-
+    sys.modules[ __name__ ] = LincOEDriver()
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index c125fca..bc0fcc5 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -88,10 +88,10 @@
             main.log.info( self.name + ": building fresh mininet" )
             # for reactive/PARP enabled tests
             cmdString = "sudo mn " + self.options[ 'arg1' ] +\
-                    " " + self.options[ 'arg2' ] +\
-                    " --mac --controller " +\
-                    self.options[ 'controller' ] + " " +\
-                    self.options[ 'arg3' ]
+                " " + self.options[ 'arg2' ] +\
+                " --mac --controller " +\
+                self.options[ 'controller' ] + " " +\
+                self.options[ 'arg3' ]
 
             argList = self.options[ 'arg1' ].split( "," )
             global topoArgList
@@ -170,7 +170,7 @@
             total_num_hosts = num_switches * num_hosts_per_sw
             num_links = total_num_hosts + ( num_switches - 1 )
             print "num_switches for %s(%d,%d) = %d and links=%d" %\
-                    ( topoType, depth, fanout, num_switches, num_links )
+                ( topoType, depth, fanout, num_switches, num_links )
         topoDict = {}
         topoDict = {
             "num_switches": int( num_switches ),
@@ -212,7 +212,7 @@
             # 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
@@ -308,11 +308,11 @@
                 main.exit()
 
             pattern = "inet\s(addr|Mask):([0-1]{1}[0-9]{1,2}|" +\
-                    "2[0-4][0-9]|25[0-5]|[0-9]{1,2}).([0-1]{1}" +\
-                    "[0-9]{1,2}|2[0-4][0-9]|25[0-5]|[0-9]{1,2})." +\
-                    "([0-1]{1}[0-9]{1,2}|2[0-4][0-9]|25[0-5]|" +\
-                    "[0-9]{1,2}).([0-1]{1}[0-9]{1,2}|2[0-4]" +\
-                    "[0-9]|25[0-5]|[0-9]{1,2})"
+                "2[0-4][0-9]|25[0-5]|[0-9]{1,2}).([0-1]{1}" +\
+                "[0-9]{1,2}|2[0-4][0-9]|25[0-5]|[0-9]{1,2})." +\
+                "([0-1]{1}[0-9]{1,2}|2[0-4][0-9]|25[0-5]|" +\
+                "[0-9]{1,2}).([0-1]{1}[0-9]{1,2}|2[0-4]" +\
+                "[0-9]|25[0-5]|[0-9]{1,2})"
             # pattern = "inet addr:10.0.0.6"
             if re.search( pattern, response ):
                 main.log.info( self.name + ": Host Ip configured properly" )
@@ -573,7 +573,7 @@
            return information dict about interfaces connected to the node"""
         if self.handle:
             cmd = 'py "\\n".join(["name=%s,mac=%s,ip=%s,enabled=%s"' +\
-                    ' % (i.name, i.MAC(), i.IP(), i.isUp())'
+                ' % (i.name, i.MAC(), i.IP(), i.isUp())'
             cmd += ' for i in %s.intfs.values()])' % node
             try:
                 response = self.execute(
@@ -836,7 +836,7 @@
 
         sw = args[ "SW" ] if args[ "SW" ] is not None else ""
         ptcpA = int( args[ "PORT1" ] ) + \
-                    int( sw ) if args[ "PORT1" ] is not None else ""
+            int( sw ) if args[ "PORT1" ] is not None else ""
         ptcpB = "ptcp:" + str( ptcpA ) if ptcpA != "" else ""
 
         command = "sh ovs-vsctl set-controller s" + \
@@ -856,7 +856,7 @@
                 "PORT" +
                 str( i ) ] is not None else ""
             tcp = "tcp:" + str( ip ) + ":" + str( port ) + \
-                               " " if ip != "" else ""
+                " " if ip != "" else ""
             command = command + tcp
         try:
             self.execute( cmd=command, prompt="mininet>", timeout=5 )
@@ -868,7 +868,7 @@
         except:
             main.log.info( self.name + ":" * 50 )
             main.log.error( traceback.print_exc() )
-            main.log.info(":" * 50 )
+            main.log.info( ":" * 50 )
             main.cleanup()
             main.exit()
 
@@ -1229,7 +1229,7 @@
         except:
             main.log.info( self.name + ":" * 50 )
             main.log.error( traceback.print_exc() )
-            main.log.info(":" * 50 )
+            main.log.info( ":" * 50 )
             main.cleanup()
             main.exit()
 
@@ -1248,7 +1248,7 @@
         except:
             main.log.info( self.name + ":" * 50 )
             main.log.error( traceback.print_exc() )
-            main.log.info(":" * 50 )
+            main.log.info( ":" * 50 )
             main.cleanup()
             main.exit()
 
@@ -1268,7 +1268,7 @@
             for port in switch.ports.values():
                 ports.append( { 'of_port': port.port_no,
                                 'mac': str( port.hw_addr ).replace( '\'',
-                                                                    ''),
+                                                                    '' ),
                                 'name': port.name } )
             output[ 'switches' ].append( {
                 "name": switch.name,
@@ -1322,7 +1322,7 @@
             main.log.report( str( list1 ) )
             main.log.report( "Switches in ONOS but not in MN:" )
             list2 = [ switch for switch in onosDPIDs if switch not in mnDPIDs ]
-            main.log.report(str( list2 ) )
+            main.log.report( str( list2 ) )
         else:  # list of dpid's match in onos and mn
             switch_results = main.TRUE
         return switch_results
@@ -1454,7 +1454,7 @@
                 # print port.hw_addr.toStr( separator='' )
                 ports.append( { 'of_port': port.port_no,
                                 'mac': str( port.hw_addr ).replace( '\'',
-                                                                    ''),
+                                                                    '' ),
                                 'name': port.name } )
             output[ 'switches' ].append( {
                 "name": switch.name,
@@ -1546,7 +1546,7 @@
                 elif ( str( onos_node1 ) == str( node2 ) and
                         str( onos_node2 ) == str( node1 ) ):
                     if ( int( onos_port1 ) == int( port2 )
-                         and int( onos_port2 ) == int( port1 ) ):
+                            and int( onos_port2 ) == int( port1 ) ):
                         second_dir = main.TRUE
                     else:
                         main.log.warn(
diff --git a/TestON/drivers/common/cli/emulator/poxclidriver.py b/TestON/drivers/common/cli/emulator/poxclidriver.py
index a562274..291e916 100644
--- a/TestON/drivers/common/cli/emulator/poxclidriver.py
+++ b/TestON/drivers/common/cli/emulator/poxclidriver.py
@@ -1,14 +1,14 @@
 #!/usr/bin/env python
-'''
+"""
 Created on 26-Oct-2012
-       
-@author: Raghav Kashyap(raghavkashyap@paxterrasolutions.com)
+
+author:: Raghav Kashyap( raghavkashyap@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.
+    ( 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
@@ -16,112 +16,141 @@
     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/>.		
+    along with TestON.  If not, see <http://www.gnu.org/licenses/>.
 
 
 pox driver provides the basic functions of POX controller
-'''
+"""
 import pexpect
-import struct, fcntl, os, sys, signal
+import struct
+import fcntl
+import os
+import sys
+import signal
 import sys
 from drivers.common.cli.emulatordriver import Emulator
 
-class PoxCliDriver(Emulator):
-    '''
-        PoxCliDriver driver provides the basic functions of POX controller
-    '''
-    def __init__(self):
-        super(Emulator, self).__init__()
-        self.handle = self
-        self.wrapped = sys.modules[__name__]
 
-    def connect(self, **connectargs):
-        #,user_name, ip_address, pwd,options):
-        '''
-          this subroutine is to launch pox controller . It must have arguments as : 
+class PoxCliDriver( Emulator ):
+
+    """
+        PoxCliDriver driver provides the basic functions of POX controller
+    """
+    def __init__( self ):
+        super( Emulator, self ).__init__()
+        self.handle = self
+        self.wrapped = sys.modules[ __name__ ]
+
+    def connect( self, **connectargs ):
+        #,user_name, ip_address, pwd,options ):
+        """
+          this subroutine is to launch pox controller . It must have arguments as :
           user_name  = host name ,
           ip_address = ip address of the host ,
           pwd = password of host ,
           options = it is a topology hash which will consists the component's details for the test run
 
           *** host is here a virtual mahine or system where pox framework hierarchy exists
-        '''
-        
+        """
         for key in connectargs:
-            vars(self)[key] = connectargs[key]       
-        
-        self.name = self.options['name']
-        
+            vars( self )[ key ] = connectargs[ key ]
+
+        self.name = self.options[ 'name' ]
+
         poxLibPath = 'default'
-        copy = super(PoxCliDriver, self).secureCopy(self.user_name, self.ip_address,'/home/openflow/pox/pox/core.py', self.pwd,path+'/lib/pox/')
-        self.handle = super(PoxCliDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = None, pwd = self.pwd)
-        
+        copy = super(
+            PoxCliDriver,
+            self ).secureCopy(
+            self.user_name,
+            self.ip_address,
+            '/home/openflow/pox/pox/core.py',
+            self.pwd,
+            path +
+            '/lib/pox/' )
+        self.handle = super(
+            PoxCliDriver,
+            self ).connect(
+            user_name=self.user_name,
+            ip_address=self.ip_address,
+            port=None,
+            pwd=self.pwd )
+
         if self.handle:
-            self.handle.expect("openflow")
-            command = self.getcmd(self.options)
-            #print command       
-            main.log.info("Entering into POX hierarchy")
-            if self.options['pox_lib_location'] != 'default':
-                self.execute(cmd="cd "+self.options['pox_lib_location'],prompt="/pox\$",timeout=120)
-            else:    
-                self.execute(cmd="cd ~/TestON/lib/pox/",prompt="/pox\$",timeout=120)
-            ### launching pox with components    
-            main.log.info("launching POX controller with given components")
-            self.execute(cmd=command,prompt="DEBUG:",timeout=120)
+            self.handle.expect( "openflow" )
+            command = self.getcmd( self.options )
+            # print command
+            main.log.info( "Entering into POX hierarchy" )
+            if self.options[ 'pox_lib_location' ] != 'default':
+                self.execute(
+                    cmd="cd " +
+                    self.options[ 'pox_lib_location' ],
+                    prompt="/pox\$",
+                    timeout=120 )
+            else:
+                self.execute(
+                    cmd="cd ~/TestON/lib/pox/",
+                    prompt="/pox\$",
+                    timeout=120 )
+            # launching pox with components
+            main.log.info( "launching POX controller with given components" )
+            self.execute( cmd=command, prompt="DEBUG:", timeout=120 )
             return main.TRUE
-        else :
-            main.log.error("Connection failed to the host "+self.user_name+"@"+self.ip_address)
-            main.log.error("Failed to connect to the POX controller")
+        else:
+            main.log.error(
+                "Connection failed to the host " +
+                self.user_name +
+                "@" +
+                self.ip_address )
+            main.log.error( "Failed to connect to the POX controller" )
             return main.FALSE
-    
-        
-    def disconnect(self,handle):
+
+    def disconnect( self, handle ):
         if self.handle:
-            self.execute(cmd="exit()",prompt="/pox\$",timeout=120)
-        else :
-            main.log.error("Connection failed to the host") 
+            self.execute( cmd="exit()", prompt="/pox\$", timeout=120 )
+        else:
+            main.log.error( "Connection failed to the host" )
 
-
-    def get_version(self):
-        file_input = path+'/lib/pox/core.py'
-        version = super(PoxCliDriver, self).get_version()
+    def get_version( self ):
+        file_input = path + '/lib/pox/core.py'
+        version = super( PoxCliDriver, self ).get_version()
         pattern = '\s*self\.version(.*)'
         import re
-        for line in open(file_input,'r').readlines():
-            result = re.match(pattern, line)
+        for line in open( file_input, 'r' ).readlines():
+            result = re.match( pattern, line )
             if result:
-                version = result.group(0)
-                version = re.sub("\s*self\.version\s*=\s*|\(|\)",'',version)
-                version = re.sub(",",'.',version)
-                version = "POX "+version
-            
-            
-        return version
-            
+                version = result.group( 0 )
+                version = re.sub(
+                    "\s*self\.version\s*=\s*|\(|\)",
+                    '',
+                    version )
+                version = re.sub( ",", '.', version )
+                version = "POX " + version
 
-    def getcmd(self,options):
-        command = "./pox.py " 
+        return version
+
+    def getcmd( self, options ):
+        command = "./pox.py "
         for item in options.keys():
-            if isinstance(options[item],dict):
+            if isinstance( options[ item ], dict ):
                 command = command + item
-                for items in options[item].keys():
-                    if options[item][items] == "None":
+                for items in options[ item ].keys():
+                    if options[ item ][ items ] == "None":
                         command = command + " --" + items + " "
-                    else :
-                        command = command + " --" + items + "=" + options[item][items] + " "
+                    else:
+                        command = command + " --" + items + \
+                            "=" + options[ item ][ items ] + " "
             else:
                 if item == 'pox_lib_location':
-                    poxLibPath = options[item]
+                    poxLibPath = options[ item ]
                 elif item == 'type' or item == 'name':
                     pass
-                else :
+                else:
                     command = command + item
 
+        return command
 
-        return command 
-            
 
 if __name__ != "__main__":
     import sys
 
-    sys.modules[__name__] = PoxCliDriver()    
+    sys.modules[ __name__ ] = PoxCliDriver()
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 48d3389..a8aedea 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -1,14 +1,14 @@
 #!/usr/bin/env python
-'''
+"""
 Created on 26-Oct-2012
 
-@author: Anil Kumar (anilkumar.s@paxterrasolutions.com)
+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.
+    ( at your option ) any later version.
 
     TestON is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -20,449 +20,536 @@
 
 
 MininetCliDriver is the basic driver which will handle the Mininet functions
-'''
+"""
 import traceback
 import pexpect
 import re
 import sys
-sys.path.append("../")
+sys.path.append( "../" )
 from drivers.common.cli.emulatordriver import Emulator
 
-class RemoteMininetDriver(Emulator):
-    '''
+
+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.
-    '''
-    def __init__(self):
-        super(Emulator, self).__init__()
+    """
+    def __init__( self ):
+        super( Emulator, self ).__init__()
         self.handle = self
-        self.wrapped = sys.modules[__name__]
+        self.wrapped = sys.modules[ __name__ ]
         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.
+    def connect( self, **connectargs ):
+        #,user_name, ip_address, pwd,options ):
+        # Here the main is the TestON instance after creating all the log
+        # handles.
         for key in connectargs:
-            vars(self)[key] = connectargs[key]
+            vars( self )[ key ] = connectargs[ key ]
 
-        self.name = self.options['name']
-        self.handle = super(RemoteMininetDriver, self).connect(user_name = self.user_name, ip_address = self.ip_address,port = None, pwd = self.pwd)
+        self.name = self.options[ 'name' ]
+        self.handle = super(
+            RemoteMininetDriver,
+            self ).connect(
+            user_name=self.user_name,
+            ip_address=self.ip_address,
+            port=None,
+            pwd=self.pwd )
 
         self.ssh_handle = self.handle
 
         # Copying the readme file to process the
-        if self.handle :
+        if self.handle:
             return main.TRUE
 
-        else :
-            main.log.error("Connection failed to the host "+self.user_name+"@"+self.ip_address)
-            main.log.error("Failed to connect to the Mininet")
+        else:
+            main.log.error(
+                "Connection failed to the host " +
+                self.user_name +
+                "@" +
+                self.ip_address )
+            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):
-        '''
+    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
+        """
+        # 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)
-        self.handle.expect(pingList)
-        self.handle.expect("\$")
+        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 )
+        self.handle.expect( pingList )
+        self.handle.expect( "\$" )
         outputs = self.handle.before + self.handle.after
-        if re.search(" 0% packet loss",outputs):
+        if re.search( " 0% packet loss", outputs ):
             return main.FALSE
-        elif re.search("found multiple mininet",outputs):
+        elif re.search( "found multiple mininet", outputs ):
             return main.ERROR
         else:
-            main.log.error("Error, unexpected output in the ping file")
+            main.log.error( "Error, unexpected output in the ping file" )
             main.log.warn( outputs )
             return main.TRUE
 
-
-
-    def pingLong(self,**pingParams):
-        '''
+    def pingLong( self, **pingParams ):
+        """
         Starts a continuous ping on the mininet host outputing to a file in the /tmp dir.
-        '''
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        args = utilities.parse_args(["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"] + " &"
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
+        args = utilities.parse_args(
+            [ "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" ] + " &"
         main.log.info( command )
-        self.execute(cmd=command,prompt="(.*)",timeout=10)
-        self.handle.sendline("")
-        self.handle.expect("\$")
+        self.execute( cmd=command, prompt="(.*)", timeout=10 )
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
         return main.TRUE
 
-    def pingstatus(self,**pingParams):
-        '''
+    def pingstatus( self, **pingParams ):
+        """
         Tails the respective ping output file and check that there is a moving "64 bytes"
-        '''
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        args = utilities.parse_args(["SRC"],**pingParams)
-        self.handle.sendline("tail /tmp/ping." + args["SRC"])
-        self.handle.expect("tail")
-        self.handle.expect("\$")
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
+        args = utilities.parse_args( [ "SRC" ], **pingParams )
+        self.handle.sendline( "tail /tmp/ping." + args[ "SRC" ] )
+        self.handle.expect( "tail" )
+        self.handle.expect( "\$" )
         result = self.handle.before + self.handle.after
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        if re.search('Unreachable', result ):
-            main.log.info("Unreachable found in ping logs...")
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
+        if re.search( 'Unreachable', result ):
+            main.log.info( "Unreachable found in ping logs..." )
             return main.FALSE
-        elif re.search('64\sbytes', result):
-            main.log.info("Pings look good")
+        elif re.search( '64\sbytes', result ):
+            main.log.info( "Pings look good" )
             return main.TRUE
         else:
-            main.log.info("No, or faulty ping data...")
+            main.log.info( "No, or faulty ping data..." )
             return main.FALSE
 
-    def pingKill(self, testONUser, testONIP):
-        '''
+    def pingKill( self, testONUser, testONIP ):
+        """
         Kills all continuous ping processes.
         Then copies all the ping files to the TestStation.
-        '''
-        self.handle.sendline("")
-        self.handle.expect("\$")
+        """
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
         command = "sudo kill -SIGINT `pgrep ping`"
         main.log.info( command )
-        self.execute(cmd=command,prompt="(.*)",timeout=10)
+        self.execute( cmd=command, prompt="(.*)", timeout=10 )
 
         main.log.info( "Transferring ping files to TestStation" )
-        command = "scp /tmp/ping.* "+ str(testONUser) + "@" + str(testONIP) + ":/tmp/"
-        self.execute(cmd=command,prompt="100%",timeout=20)
-        #Make sure the output is cleared
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("")
-        self.handle.expect("\$")
-        self.handle.sendline("")
-        i=self.handle.expect(["password","\$"])
+        command = "scp /tmp/ping.* " + \
+            str( testONUser ) + "@" + str( testONIP ) + ":/tmp/"
+        self.execute( cmd=command, prompt="100%", timeout=20 )
+        # Make sure the output is cleared
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
+        self.handle.sendline( "" )
+        i = self.handle.expect( [ "password", "\$" ] )
         if i == 0:
-            main.log.error("Error, sudo asking for password")
-            main.log.error(self.handle.before)
+            main.log.error( "Error, sudo asking for password" )
+            main.log.error( self.handle.before )
             return main.FALSE
         else:
             return main.TRUE
 
-    def pingLongKill(self):
-        self.handle.sendline("")
-        self.handle.expect("\$")
+    def pingLongKill( self ):
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
         command = "sudo kill -SIGING `pgrep ping`"
-        main.log.info(command)
-        self.execute(cmd=command,prompt="(.*)",timeout=10)
-        self.handle.sendline("")
-        self.handle.expect("\$")
+        main.log.info( command )
+        self.execute( cmd=command, prompt="(.*)", timeout=10 )
+        self.handle.sendline( "" )
+        self.handle.expect( "\$" )
         return main.TRUE
 
-    def pingHostOptical(self,**pingParams):
-        '''
+    def pingHostOptical( self, **pingParams ):
+        """
         This function is only for Packey Optical related ping
-        Use the next pingHost() function for all normal scenarios)
+        Use the next pingHost() function for all normal scenarios )
         Ping from one mininet host to another
         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"
+        """
+        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])
+            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:
-                main.log.error(self.name + ": timeout when waiting for response from mininet")
-                main.log.error("response: " + str(self.handle.before))
-            i = self.handle.expect(["mininet>",pexpect.TIMEOUT])
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response from mininet" )
+                main.log.error( "response: " + str( self.handle.before ) )
+            i = self.handle.expect( [ "mininet>", pexpect.TIMEOUT ] )
             if i == 1:
-                main.log.error(self.name + ": timeout when waiting for response from mininet")
-                main.log.error("response: " + str(self.handle.before))
+                main.log.error(
+                    self.name +
+                    ": timeout when waiting for response from mininet" )
+                main.log.error( "response: " + str( self.handle.before ) )
             response = self.handle.before
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             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.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
             return main.TRUE
-        else :
-            main.log.error(self.name+": PACKET LOST, HOST IS NOT REACHABLE")
+        else:
+            main.log.error(
+                self.name +
+                ": PACKET LOST, HOST IS NOT REACHABLE" )
             main.last_result = main.FALSE
             return main.FALSE
 
-    def pingHost(self,**pingParams):
-        '''
+    def pingHost( self, **pingParams ):
+        """
         Pings between two hosts on remote mininet
-        '''
-        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")
+        """
+        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
             return main.TRUE
-        else :
-            main.log.error("PACKET LOST, HOST IS NOT REACHABLE")
+        else:
+            main.log.error( "PACKET LOST, HOST IS NOT REACHABLE" )
             main.last_result = main.FALSE
             return main.FALSE
 
-
-    def checknum(self,num):
-        '''
+    def checknum( self, num ):
+        """
         Verifies the correct number of switches are running
-        '''
-        if self.handle :
-            self.handle.sendline("")
-            self.handle.expect("\$")
-            self.handle.sendline('ifconfig -a | grep "sw.. " | wc -l')
-            self.handle.expect("wc")
-            self.handle.expect("\$")
+        """
+        if self.handle:
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( 'ifconfig -a | grep "sw.. " | wc -l' )
+            self.handle.expect( "wc" )
+            self.handle.expect( "\$" )
             response = self.handle.before
-            self.handle.sendline('ps -ef | grep "bash -ms mininet:sw" | grep -v color | wc -l')
-            self.handle.expect("color")
-            self.handle.expect("\$")
+            self.handle.sendline(
+                'ps -ef | grep "bash -ms mininet:sw" | grep -v color | wc -l' )
+            self.handle.expect( "color" )
+            self.handle.expect( "\$" )
             response2 = self.handle.before
 
-            if re.search(num, response):
-                if re.search(num, response2):
+            if re.search( num, response ):
+                if re.search( num, response2 ):
                     return main.TRUE
                 else:
                     return main.FALSE
             else:
                 return main.FALSE
-        else :
-            main.log.error("Connection failed to the host")
+        else:
+            main.log.error( "Connection failed to the host" )
 
-    def start_tcpdump(self, filename, intf = "eth0", port = "port 6633", user="admin"):
-        '''
+    def start_tcpdump(
+            self,
+            filename,
+            intf="eth0",
+            port="port 6633",
+            user="admin" ):
+        """
         Runs tpdump on an intferface and saves the file
         intf can be specified, or the default eth0 is used
-        '''
+        """
         try:
-            self.handle.sendline("")
-            self.handle.sendline("sudo tcpdump -n -i "+ intf + " " + port + " -w " + filename.strip() + " -Z " + user + "  &")
-            self.handle.sendline("")
-            self.handle.sendline("")
-            i=self.handle.expect(['No\ssuch\device','listening\son',pexpect.TIMEOUT,"\$"],timeout=10)
-            main.log.warn(self.handle.before + self.handle.after)
+            self.handle.sendline( "" )
+            self.handle.sendline(
+                "sudo tcpdump -n -i " +
+                intf +
+                " " +
+                port +
+                " -w " +
+                filename.strip() +
+                " -Z " +
+                user +
+                "  &" )
+            self.handle.sendline( "" )
+            self.handle.sendline( "" )
+            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)
+                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)
+            elif i == 3:
+                main.log.info( self.name + ": " + self.handle.before )
                 return main.TRUE
             else:
-                main.log.error(self.name + ": tcpdump - unexpected response")
+                main.log.error( self.name + ": tcpdump - unexpected response" )
             return main.FALSE
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(
+                self.name +
+                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
             main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(
+                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
             main.cleanup()
             main.exit()
 
-    def stop_tcpdump(self):
+    def stop_tcpdump( self ):
         "pkills tcpdump"
         try:
-            self.handle.sendline("sudo pkill tcpdump")
-            self.handle.sendline("")
-            self.handle.sendline("")
-            self.handle.expect("\$")
+            self.handle.sendline( "sudo pkill tcpdump" )
+            self.handle.sendline( "" )
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             main.cleanup()
             main.exit()
         except:
-            main.log.info(self.name + ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(
+                self.name +
+                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
             main.log.error( traceback.print_exc() )
-            main.log.info(":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::")
+            main.log.info(
+                ":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::" )
             main.cleanup()
             main.exit()
 
-    def run_optical_mn_script(self):
-        '''
+    def run_optical_mn_script( self ):
+        """
             This function is only meant for Packet Optical.
-            It runs the python script "optical.py" to create the packet layer(mn)
+            It runs the python script "optical.py" to create the packet layer( mn )
             topology
-        '''
+        """
         try:
-            self.handle.sendline("")
-            self.handle.expect("\$")
-            self.handle.sendline("cd ~")
-            self.handle.expect("\$")
-            self.handle.sendline("sudo python optical.py")
-            self.handle.expect(">")
+            self.handle.sendline( "" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "cd ~" )
+            self.handle.expect( "\$" )
+            self.handle.sendline( "sudo python optical.py" )
+            self.handle.expect( ">" )
             return main.TRUE
         except pexpect.EOF:
-            main.log.error(self.name + ": EOF exception found")
-            main.log.error(self.name + ":     " + self.handle.before)
+            main.log.error( self.name + ": EOF exception found" )
+            main.log.error( self.name + ":     " + self.handle.before )
             return main.FALSE
 
-    def disconnect(self):
-        '''
+    def disconnect( self ):
+        """
         Called at the end of the test to disconnect the handle.
-        '''
+        """
         response = ''
-        #print "Disconnecting Mininet"
+        # print "Disconnecting Mininet"
         if self.handle:
-            self.handle.sendline("exit")
-            self.handle.expect("exit")
-            self.handle.expect("(.*)")
+            self.handle.sendline( "exit" )
+            self.handle.expect( "exit" )
+            self.handle.expect( "(.*)" )
             response = self.handle.before
 
-        else :
-            main.log.error("Connection failed to the host")
+        else:
+            main.log.error( "Connection failed to the host" )
             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
-        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"
-            self.handle.sendline(command)
-            self.handle.expect(["k1 -r",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
+    def get_flowTable( self, protoVersion, sw ):
+        # TODO document usage
+        # TODO add option to look at cookies. ignoreing them for now
+        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"
+            self.handle.sendline( command )
+            self.handle.expect( [ "k1 -r", pexpect.EOF, pexpect.TIMEOUT ] )
+            self.handle.expect(
+                [ "OFPST_FLOW", pexpect.EOF, pexpect.TIMEOUT ] )
             response = self.handle.before
-            #print "response=", response
+            # print "response=", response
             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"
-            self.handle.sendline(command)
-            self.handle.expect(["k1 -r",pexpect.EOF,pexpect.TIMEOUT])
-            self.handle.expect(["OFPST_FLOW",pexpect.EOF,pexpect.TIMEOUT])
+        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"
+            self.handle.sendline( command )
+            self.handle.expect( [ "k1 -r", pexpect.EOF, pexpect.TIMEOUT ] )
+            self.handle.expect(
+                [ "OFPST_FLOW", pexpect.EOF, pexpect.TIMEOUT ] )
             response = self.handle.before
-            #print "response=", response
+            # print "response=", response
             return response
         else:
-            main.log.error("Unknown  protoVersion in get_flowTable(). given: ("+str(type(protoVersion))+") '"+str(protoVersion)+"'")
+            main.log.error(
+                "Unknown  protoVersion in get_flowTable(). given: (" +
+                str(
+                    type( protoVersion ) ) +
+                ") '" +
+                str(protoVersion) +
+                "'" )
 
-
-    def flow_comp(self,flow1,flow2):
-        if flow1==flow2:
+    def flow_comp( self, flow1, flow2 ):
+        if flow1 == flow2:
             return main.TRUE
         else:
-            main.log.info("Flow tables do not match, printing tables:")
-            main.log.info("Flow Table 1:")
-            main.log.info(flow1)
-            main.log.info("Flow Table 2:")
-            main.log.info(flow2)
+            main.log.info( "Flow tables do not match, printing tables:" )
+            main.log.info( "Flow Table 1:" )
+            main.log.info( flow1 )
+            main.log.info( "Flow Table 2:" )
+            main.log.info( flow2 )
             return main.FALSE
 
-    def setIpTablesOUTPUT(self, dst_ip, dst_port, action='add', packet_type='tcp',rule='DROP'):
-        '''
+    def setIpTablesOUTPUT(
+            self,
+            dst_ip,
+            dst_port,
+            action='add',
+            packet_type='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')
+        * 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
-        * optional packet type to block (default tcp)
-        * optional iptables rule (default DROP)
+        * 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
-        '''
+        """
         import re
         import time
 
-        #NOTE*********
+        # NOTE*********
         #   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)
+        time.sleep( 5 )
 
         action_type = action.lower()
-        if action_type != 'add' and action_type !='remove':
-            main.log.error("Invalid action type. 'add' or 'remove' table rule")
+        if action_type != 'add' and action_type != 'remove':
+            main.log.error(
+                "Invalid action type. 'add' or 'remove' table rule" )
             if rule != 'DROP' and rule != 'ACCEPT' and rule != 'LOG':
-                #NOTE: Currently only supports rules DROP, ACCEPT, and LOG
-                main.log.error("Invalid rule. 'DROP' or 'ACCEPT' or 'LOG' only.")
+                # NOTE: Currently only supports rules DROP, ACCEPT, and LOG
+                main.log.error(
+                    "Invalid rule. 'DROP' or 'ACCEPT' or 'LOG' only." )
                 return
             return
         else:
 
-            #If there is no existing rule in the iptables, we will see an
+            # If there is no existing rule in the iptables, we will see an
             #'iptables:'... message. We expect to see this message.
-            #Otherwise, if there IS an existing rule, we will get the prompt
+            # 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
+                # 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)+
-                        " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
-                i = self.handle.expect(["iptables:", "\$"])
+                #      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 ) +
+                    " -d " +
+                    str( dst_ip ) +
+                    " --dport " +
+                    str( dst_port ) +
+                    " -j " +
+                    str( rule ) )
+                i = self.handle.expect( [ "iptables:", "\$" ] )
                 print i
                 print self.handle.before
                 print "after: "
                 print self.handle.after
 
             elif action_type == '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)+
-                        " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
-                self.handle.expect("\$")
+                # Check for existing rules on current input
+                self.handle.sendline( "" )
+                self.handle.expect( "\$" )
+                self.handle.sendline(
+                    "sudo iptables -C OUTPUT -p " +
+                    str( packet_type ) +
+                    " -d " +
+                    str( dst_ip ) +
+                    " --dport " +
+                    str( dst_port ) +
+                    " -j " +
+                    str( rule ) )
+                self.handle.expect( "\$" )
             print "before: "
             print self.handle.before
             actual_string = self.handle.after
@@ -470,73 +557,104 @@
             print "Actual String:"
             print actual_string
 
-            if re.search(expect_string, actual_string):
+            if re.search( expect_string, actual_string ):
                 match_result = main.TRUE
             else:
                 match_result = main.FALSE
-            #If match_result is main.TRUE, it means there is no matching rule.
+            # If match_result 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 tables does not exist and expected prompt is returned, go ahead and
+            # add iptables rule
             if match_result == main.TRUE:
-                #Ensure action type is add
+                # Ensure action type is add
                 if action_type == 'add':
                     #-A is the 'append' action of iptables
                     action_add = '-A'
                     try:
-                        self.handle.sendline("")
-                        self.handle.sendline("sudo iptables "+action_add+" OUTPUT -p "+str(packet_type)+
-                            " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
+                        self.handle.sendline( "" )
+                        self.handle.sendline(
+                            "sudo iptables " +
+                            action_add +
+                            " OUTPUT -p " +
+                            str( packet_type ) +
+                            " -d " +
+                            str( dst_ip ) +
+                            " --dport " +
+                            str( dst_port ) +
+                            " -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)
+                        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 )
 
-                        main.log.info(info_string)
+                        main.log.info( info_string )
 
-                        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+                        self.handle.expect(
+                            [ "\$", pexpect.EOF, pexpect.TIMEOUT ] )
                     except pexpect.TIMEOUT:
-                        main.log.error(self.name + ": Timeout exception in setIpTables function")
+                        main.log.error(
+                            self.name +
+                            ": Timeout exception in setIpTables function" )
                     except:
-                        main.log.error( traceback.print_exc())
+                        main.log.error( traceback.print_exc() )
                         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
+                    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:
-                #Ensure action type is remove
+                # Ensure action type is remove
                 if action_type == 'remove':
                     #-D is the 'delete' rule of iptables
                     action_remove = '-D'
                     try:
-                        self.handle.sendline("")
-                        #Delete a specific rule specified into the function
-                        self.handle.sendline("sudo iptables "+action_remove+" OUTPUT -p "+str(packet_type)+
-                            " -d "+ str(dst_ip)+" --dport "+str(dst_port)+" -j "+str(rule))
+                        self.handle.sendline( "" )
+                        # Delete a specific rule specified into the function
+                        self.handle.sendline(
+                            "sudo iptables " +
+                            action_remove +
+                            " OUTPUT -p " +
+                            str( packet_type ) +
+                            " -d " +
+                            str( dst_ip ) +
+                            " --dport " +
+                            str( dst_port ) +
+                            " -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)
+                        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 )
 
-                        main.log.info(info_string)
+                        main.log.info( info_string )
 
-                        self.handle.expect(["\$",pexpect.EOF,pexpect.TIMEOUT])
+                        self.handle.expect(
+                            [ "\$", pexpect.EOF, pexpect.TIMEOUT ] )
                     except pexpect.TIMEOUT:
-                        main.log.error(self.name + ": Timeout exception in setIpTables function")
+                        main.log.error(
+                            self.name +
+                            ": Timeout exception in setIpTables function" )
                     except:
-                        main.log.error( traceback.print_exc())
+                        main.log.error( traceback.print_exc() )
                         main.cleanup()
                         main.exit()
                 else:
-                    main.log.error("Given rule does not exist, but attempted to remove it")
+                    main.log.error(
+                        "Given rule does not exist, but attempted to remove it" )
             else:
-                #NOTE: If a bad usage of this function occurs, exit the entire test
-                main.log.error("Bad rule given for iptables. Exiting...")
+                # NOTE: If a bad usage of this function occurs, exit the entire
+                # test
+                main.log.error( "Bad rule given for iptables. Exiting..." )
                 main.cleanup()
                 main.exit()
 
 
 if __name__ != "__main__":
     import sys
-    sys.modules[__name__] = RemoteMininetDriver()
+    sys.modules[ __name__ ] = RemoteMininetDriver()