Reverting core/ and drivers/ directories before change 15514

This reverts commit 23fb21617769f4320de93b5b1805c6ec3ca9b809.

Change-Id: I0c116f8d7195c75c7ef17f296843924d3e2a0961
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
old mode 100644
new mode 100755
index dadc78d..eed4057
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -30,7 +30,6 @@
 from requests.models import Response
 from drivers.common.clidriver import CLI
 
-
 class OnosDriver( CLI ):
 
     def __init__( self ):
@@ -73,9 +72,10 @@
                     break
                 self.maxNodes = None
 
-            if self.maxNodes is None or self.maxNodes == "":
+            if self.maxNodes == None or self.maxNodes == "":
                 self.maxNodes = 100
 
+
             # Grabs all OC environment variables based on max number of nodes
             self.onosIps = {}  # Dictionary of all possible ONOS ip
 
@@ -110,7 +110,7 @@
                 main.log.error( "Uncaught exception: " + str( inst ) )
 
             try:
-                if os.getenv( str( self.ip_address ) ) is not None:
+                if os.getenv( str( self.ip_address ) ) != None:
                     self.ip_address = os.getenv( str( self.ip_address ) )
                 else:
                     main.log.info( self.name +
@@ -172,7 +172,7 @@
         Returns milliseconds since epoch
 
         When checking multiple nodes in a for loop,
-        around a hundred milliseconds of difference ( ascending ) is
+        around a hundred milliseconds of difference (ascending) is
         generally acceptable due to calltime of the function.
         Few seconds, however, is not and it means clocks
         are off sync.
@@ -213,7 +213,7 @@
                     ret = main.FALSE
                     continue  # expect again
                 elif i == 2:
-                    # File( s ) not found
+                    # File(s) not found
                     main.log.error( "onos-package could not find a file or directory" )
                     ret = main.FALSE
                     continue  # expect again
@@ -305,7 +305,7 @@
                     'Runtime\sEnvironment\sto\scontinue',
                     'BUILD\sFAILURE',
                     'BUILD\sSUCCESS',
-                    'onos' + self.prompt,  # TODO: fix this to be more generic?
+                    'onos' + self.prompt,  #TODO: fix this to be more generic?
                     'ONOS' + self.prompt,
                     pexpect.TIMEOUT ], mciTimeout )
                 if i == 0:
@@ -417,7 +417,7 @@
             self.handle.expect( self.prompt )
             cmd = "git pull"
             if comp1 != "":
-                cmd += ' ' + comp1
+                cmd += ' ' +  comp1
             if fastForward:
                 cmd += ' ' + " --ff-only"
             self.handle.sendline( cmd )
@@ -498,7 +498,7 @@
                     self.handle.expect( self.prompt )
                     return main.ERROR
                 except Exception:
-                    main.log.exception( "Couldn't exit editor prompt!" )
+                    main.log.exception( "Couldn't exit editor prompt!")
 
                     main.cleanAndExit()
             elif i == 10:  # In the middle of a merge commit
@@ -652,11 +652,11 @@
             self.handle.sendline( "git name-rev --name-only HEAD" )
             self.handle.expect( "git name-rev --name-only HEAD" )
             self.handle.expect( self.prompt )
-            lines = self.handle.before.splitlines()
-            if lines[ 1 ] == "master" or re.search( "^onos-\d+(\.\d+)+$", lines[ 1 ] ):
-                return lines[ 1 ]
+            lines =  self.handle.before.splitlines()
+            if lines[1] == "master" or re.search( "^onos-\d+(\.\d+)+$", lines[1] ):
+                return lines[1]
             else:
-                main.log.info( lines[ 1 ] )
+                main.log.info( lines[1] )
                 return "unexpected ONOS branch"
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -702,11 +702,11 @@
                     # as xml specific tags that cause errors
                     line = line.replace( "<", "[" )
                     line = line.replace( ">", "]" )
-                    # main.log.wiki( "\t" + line )
+                    #main.log.wiki( "\t" + line )
                     main.log.wiki( line + "<br /> " )
                     main.log.summary( line )
                 main.log.wiki( "</blockquote>" )
-                main.log.summary( "\n" )
+                main.log.summary("\n")
             return lines[ 2 ]
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -733,7 +733,7 @@
                   supported currently
             * ONOS IP addresses ( onosIpAddrs )
                 - Must be passed in as last arguments
-            * ONOS USER ( onosUser )
+            * ONOS USER (onosUser)
                 - optional argument to set ONOS_USER environment variable
 
         NOTE: Assumes cells are located at:
@@ -837,14 +837,14 @@
                 handleAfter = self.handle.after
                 # Get the rest of the handle
                 self.handle.expect( self.prompt )
-                time.sleep( 10 )
+                time.sleep(10)
                 handleMore = self.handle.before
 
                 cell_result = handleBefore + handleAfter + handleMore
-                # print cell_result
+                #print cell_result
                 if( re.search( "No such cell", cell_result ) ):
                     main.log.error( "Cell call returned: " + handleBefore +
-                                    handleAfter + handleMore )
+                               handleAfter + handleMore )
 
                     main.cleanAndExit()
                 return main.TRUE
@@ -886,7 +886,7 @@
         Uses 'onos <node-ip> cfg set' to change a parameter value of an
         application.
 
-        ex )
+        ex)
             onos 10.0.0.1 cfg set org.onosproject.myapp appSetting 1
         ONOSIp = '10.0.0.1'
         configName = 'org.onosproject.myapp'
@@ -899,11 +899,11 @@
             self.handle.sendline( "" )
             self.handle.expect( ":~" )
             self.handle.sendline( cfgStr )
-            self.handle.expect( "cfg set" )
+            self.handle.expect("cfg set")
             self.handle.expect( ":~" )
 
-            paramValue = configParam.split( " " )[ 1 ]
-            paramName = configParam.split( " " )[ 0 ]
+            paramValue = configParam.split(" ")[1]
+            paramName = configParam.split(" ")[0]
 
             checkStr = 'onos {} cfg get " {} {} " '.format( ONOSIp, configName, paramName )
 
@@ -911,7 +911,7 @@
             self.handle.expect( ":~" )
 
             if "value=" + paramValue + "," in self.handle.before:
-                main.log.info( "cfg " + configName + " successfully set to " + configParam )
+                main.log.info("cfg " + configName + " successfully set to " + configParam)
                 return main.TRUE
         except pexpect.ExceptionPexpect as e:
             main.log.exception( self.name + ": Pexpect exception found: " )
@@ -967,7 +967,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def onosSecureSSH( self, userName="onos", userPWD="rocks", node="" ):
+    def onosSecureSSH( self, userName="onos", userPWD="rocks", node=""):
         """
         Enables secure access to ONOS console
         by removing default users & keys.
@@ -976,6 +976,7 @@
 
         Returns: main.TRUE on success and main.FALSE on failure
         """
+
         try:
             self.handle.sendline( "" )
             self.handle.expect( self.prompt )
@@ -984,9 +985,9 @@
             # NOTE: this timeout may need to change depending on the network
             # and size of ONOS
             # TODO: Handle the other possible error
-            i = self.handle.expect( [ "Network\sis\sunreachable",
-                                      self.prompt,
-                                      pexpect.TIMEOUT ], timeout=180 )
+            i = self.handle.expect([ "Network\sis\sunreachable",
+                                     self.prompt,
+                                     pexpect.TIMEOUT ], timeout=180 )
             if i == 0:
                 # can't reach ONOS node
                 main.log.warn( "Network is unreachable" )
@@ -995,8 +996,8 @@
             elif i == 1:
                 # Process started
                 main.log.info(
-                    "Secure SSH performed on " +
-                    node )
+                "Secure SSH performed on " +
+                node)
                 return main.TRUE
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
@@ -1006,6 +1007,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
+
     def onosInstall( self, options="-f", node="" ):
         """
         Installs ONOS bits on the designated cell machine.
@@ -1327,7 +1329,7 @@
     def isup( self, node="", timeout=240 ):
         """
         Run's onos-wait-for-start which only returns once ONOS is at run
-        level 100( ready for use )
+        level 100(ready for use)
 
         Returns: main.TRUE if ONOS is running and main.FALSE on timeout
         """
@@ -1335,7 +1337,7 @@
             self.handle.sendline( "onos-wait-for-start " + node )
             self.handle.expect( "onos-wait-for-start" )
             # NOTE: this timeout is arbitrary"
-            i = self.handle.expect( [ self.prompt, pexpect.TIMEOUT ], timeout )
+            i = self.handle.expect([self.prompt, pexpect.TIMEOUT], timeout)
             if i == 0:
                 main.log.info( self.name + ": " + node + " is up" )
                 return main.TRUE
@@ -1374,6 +1376,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
+
     def pushTestIntentsShell(
             self,
             dpidSrc,
@@ -1515,7 +1518,7 @@
             self.handle.expect( self.prompt )
             self.handle.sendline( "" )
             if grepOptions:
-                grepStr = "grep " + str( grepOptions )
+                grepStr = "grep "+str(grepOptions)
             else:
                 grepStr = "grep"
 
@@ -1524,12 +1527,12 @@
                 str( interface ) +
                 " -t e | " +
                 grepStr + " --line-buffered \"" +
-                str( grep ) +
+                str(grep) +
                 "\" >" +
                 directory +
                 " &" )
-            self.handle.sendline( cmd )
-            main.log.info( cmd )
+            self.handle.sendline(cmd)
+            main.log.info(cmd)
             self.handle.expect( "Capturing on" )
             self.handle.sendline( "\n" )
             self.handle.expect( self.prompt )
@@ -1597,7 +1600,7 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def dumpONOSCmd( self, ONOSIp, CMD, destDir, filename, options="" ):
+    def dumpONOSCmd(self, ONOSIp, CMD, destDir, filename, options=""):
         """
         Dump Cmd to a desired directory.
         For debugging purposes, you may want to use
@@ -1612,14 +1615,15 @@
             * fileName: Name of the file
             * options: Options for ONOS command
         """
+
         localtime = time.strftime( '%x %X' )
         localtime = localtime.replace( "/", "" )
         localtime = localtime.replace( " ", "_" )
         localtime = localtime.replace( ":", "" )
         if destDir[ -1: ] != "/":
             destDir += "/"
-        cmd = CMD + " " + options + " > " + str( destDir ) + str( filename ) + localtime
-        return self.onosCli( ONOSIp, cmd )
+        cmd=CMD + " " + options + " > " + str( destDir ) + str( filename ) + localtime
+        return self.onosCli(ONOSIp, cmd)
 
     def cpLogsToDir( self, logToCopy,
                      destDir, copyFileName="" ):
@@ -1674,7 +1678,7 @@
         except Exception:
             main.log.exception( "Copying files failed" )
 
-    def checkLogs( self, onosIp, restart=False ):
+    def checkLogs( self, onosIp, restart=False):
         """
         runs onos-check-logs on the given onos node
         If restart is True, use the old version of onos-check-logs which
@@ -1737,17 +1741,17 @@
                      direction='INPUT', rule='DROP', states=True ):
         """
         Description:
-            add or remove iptables rule to DROP ( default ) packets from
+            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 ip to block
-        * specify the destination port to block ( defaults to all ports )
-        * optional packet type to block ( default tcp )
-        * optional iptables rule ( default DROP )
-        * optional direction to block ( default 'INPUT' )
+        * specify the destination port to block (defaults to all ports)
+        * optional packet type to block (default tcp)
+        * optional iptables rule (default DROP)
+        * optional direction to block (default 'INPUT')
         * States boolean toggles adding all supported tcp states to the
           firewall rule
         Returns:
@@ -1758,6 +1762,7 @@
         * This function uses root privilege iptables command which may result
           in unwanted network errors. USE WITH CAUTION
         """
+
         # NOTE*********
         #   The strict checking methods of this driver function is intentional
         #   to discourage any misuse or error of iptables, which can cause
@@ -1799,13 +1804,14 @@
             cmd = "sudo iptables " + actionFlag + " " +\
                   direction +\
                   " -s " + str( ip )
+                  # " -p " + str( packet_type ) +\
             if packet_type:
                 cmd += " -p " + str( packet_type )
             if port:
                 cmd += " --dport " + str( port )
             if states:
                 cmd += " -m state --state="
-                # FIXME- Allow user to configure which states to block
+                #FIXME- Allow user to configure which states to block
                 cmd += "INVALID,ESTABLISHED,NEW,RELATED,UNTRACKED"
             cmd += " -j " + str( rule )
 
@@ -1834,10 +1840,10 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def detailed_status( self, log_filename ):
+    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 )
+        Reports RUNNING, STARTING, STOPPED, FROZEN, ERROR (and reason)
         """
         import re
         try:
@@ -1878,8 +1884,8 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def createLinkGraphFile( self, benchIp, ONOSIpList, deviceCount ):
-        """
+    def createLinkGraphFile( self, benchIp, ONOSIpList, deviceCount):
+        '''
             Create/formats the LinkGraph.cfg file based on arguments
                 -only creates a linear topology and connects islands
                 -evenly distributes devices
@@ -1888,113 +1894,115 @@
                 ONOSIpList - list of all of the node IPs to be used
 
                 deviceCount - number of switches to be assigned
-        """
-        main.log.info( "Creating link graph configuration file." )
+        '''
+        main.log.info("Creating link graph configuration file." )
         linkGraphPath = self.home + "/tools/package/etc/linkGraph.cfg"
         tempFile = "/tmp/linkGraph.cfg"
 
-        linkGraph = open( tempFile, 'w+' )
-        linkGraph.write( "# NullLinkProvider topology description (config file).\n" )
-        linkGraph.write( "# The NodeId is only added if the destination is another node's device.\n" )
-        linkGraph.write( "# Bugs: Comments cannot be appended to a line to be read.\n" )
+        linkGraph = open(tempFile, 'w+')
+        linkGraph.write("# NullLinkProvider topology description (config file).\n")
+        linkGraph.write("# The NodeId is only added if the destination is another node's device.\n")
+        linkGraph.write("# Bugs: Comments cannot be appended to a line to be read.\n")
 
-        clusterCount = len( ONOSIpList )
+        clusterCount = len(ONOSIpList)
 
-        if isinstance( deviceCount, int ) or isinstance( deviceCount, str ):
-            deviceCount = int( deviceCount )
-            switchList = [ 0 ] * ( clusterCount + 1 )
-            baselineSwitchCount = deviceCount / clusterCount
+        if type(deviceCount) is int or type(deviceCount) is str:
+            deviceCount = int(deviceCount)
+            switchList = [0]*(clusterCount+1)
+            baselineSwitchCount = deviceCount/clusterCount
 
-            for node in range( 1, clusterCount + 1 ):
-                switchList[ node ] = baselineSwitchCount
+            for node in range(1, clusterCount + 1):
+                switchList[node] = baselineSwitchCount
 
-            for node in range( 1, ( deviceCount % clusterCount ) + 1 ):
-                switchList[ node ] += 1
+            for node in range(1, (deviceCount%clusterCount)+1):
+                switchList[node] += 1
 
-        if isinstance( deviceCount, list ):
-            main.log.info( "Using provided device distribution" )
-            switchList = [ 0 ]
+        if type(deviceCount) is list:
+            main.log.info("Using provided device distribution")
+            switchList = [0]
             for i in deviceCount:
-                switchList.append( int( i ) )
+                switchList.append(int(i))
 
-        tempList = [ '0' ]
-        tempList.extend( ONOSIpList )
+        tempList = ['0']
+        tempList.extend(ONOSIpList)
         ONOSIpList = tempList
 
         myPort = 6
         lastSwitch = 0
-        for node in range( 1, clusterCount + 1 ):
-            if switchList[ node ] == 0:
+        for node in range(1, clusterCount+1):
+            if switchList[node] == 0:
                 continue
 
-            linkGraph.write( "graph " + ONOSIpList[ node ] + " {\n" )
+            linkGraph.write("graph " + ONOSIpList[node] + " {\n")
 
             if node > 1:
-                # connect to last device on previous node
-                line = ( "\t0:5 -> " + str( lastSwitch ) + ":6:" + lastIp + "\n" )  # ONOSIpList[ node-1 ]
-                linkGraph.write( line )
+                #connect to last device on previous node
+                line = ("\t0:5 -> " + str(lastSwitch) + ":6:" + lastIp + "\n")     #ONOSIpList[node-1]
+                linkGraph.write(line)
 
             lastSwitch = 0
-            for switch in range( 0, switchList[ node ] - 1 ):
+            for switch in range (0, switchList[node]-1):
                 line = ""
-                line = ( "\t" + str( switch ) + ":" + str( myPort ) )
+                line = ("\t" + str(switch) + ":" + str(myPort))
                 line += " -- "
-                line += ( str( switch + 1 ) + ":" + str( myPort - 1 ) + "\n" )
-                linkGraph.write( line )
-                lastSwitch = switch + 1
-            lastIp = ONOSIpList[ node ]
+                line += (str(switch+1) + ":" + str(myPort-1) + "\n")
+                linkGraph.write(line)
+                lastSwitch = switch+1
+            lastIp = ONOSIpList[node]
 
-            # lastSwitch += 1
-            if node < ( clusterCount ):
-                # connect to first device on the next node
-                line = ( "\t" + str( lastSwitch ) + ":6 -> 0:5:" + ONOSIpList[ node + 1 ] + "\n" )
-                linkGraph.write( line )
+            #lastSwitch += 1
+            if node < (clusterCount):
+                #connect to first device on the next node
+                line = ("\t" + str(lastSwitch) + ":6 -> 0:5:" + ONOSIpList[node+1] + "\n")
+                linkGraph.write(line)
 
-            linkGraph.write( "}\n" )
+            linkGraph.write("}\n")
         linkGraph.close()
 
-        # SCP
-        os.system( "scp " + tempFile + " " + self.user_name + "@" + benchIp + ":" + linkGraphPath )
-        main.log.info( "linkGraph.cfg creation complete" )
+        #SCP
+        os.system( "scp " + tempFile + " " + self.user_name + "@" + benchIp + ":" + linkGraphPath)
+        main.log.info("linkGraph.cfg creation complete")
 
-    def configNullDev( self, ONOSIpList, deviceCount, numPorts=10 ):
-        """
+    def configNullDev( self, ONOSIpList, deviceCount, numPorts=10):
+
+        '''
             ONOSIpList = list of Ip addresses of nodes switches will be devided amongst
             deviceCount = number of switches to distribute, or list of values to use as custom distribution
             numPorts = number of ports per device. Defaults to 10 both in this function and in ONOS. Optional arg
-        """
-        main.log.info( "Configuring Null Device Provider" )
-        clusterCount = len( ONOSIpList )
+        '''
+
+        main.log.info("Configuring Null Device Provider" )
+        clusterCount = len(ONOSIpList)
 
         try:
 
-            if isinstance( deviceCount, int ) or isinstance( deviceCount, str ):
-                main.log.info( "Creating device distribution" )
-                deviceCount = int( deviceCount )
-                switchList = [ 0 ] * ( clusterCount + 1 )
-                baselineSwitchCount = deviceCount / clusterCount
+            if type(deviceCount) is int or type(deviceCount) is str:
+                main.log.info("Creating device distribution")
+                deviceCount = int(deviceCount)
+                switchList = [0]*(clusterCount+1)
+                baselineSwitchCount = deviceCount/clusterCount
 
-                for node in range( 1, clusterCount + 1 ):
-                    switchList[ node ] = baselineSwitchCount
+                for node in range(1, clusterCount + 1):
+                    switchList[node] = baselineSwitchCount
 
-                for node in range( 1, ( deviceCount % clusterCount ) + 1 ):
-                    switchList[ node ] += 1
+                for node in range(1, (deviceCount%clusterCount)+1):
+                    switchList[node] += 1
 
-            if isinstance( deviceCount, list ):
-                main.log.info( "Using provided device distribution" )
+            if type(deviceCount) is list:
+                main.log.info("Using provided device distribution")
 
-                if len( deviceCount ) == clusterCount:
-                    switchList = [ '0' ]
-                    switchList.extend( deviceCount )
+                if len(deviceCount) == clusterCount:
+                    switchList = ['0']
+                    switchList.extend(deviceCount)
 
-                if len( deviceCount ) == ( clusterCount + 1 ):
-                    if deviceCount[ 0 ] == '0' or deviceCount[ 0 ] == 0:
+                if len(deviceCount) == (clusterCount + 1):
+                    if deviceCount[0] == '0' or deviceCount[0] == 0:
                         switchList = deviceCount
 
-                assert len( switchList ) == ( clusterCount + 1 )
+                assert len(switchList) == (clusterCount + 1)
 
         except AssertionError:
-            main.log.error( "Bad device/Ip list match" )
+            main.log.error( "Bad device/Ip list match")
         except TypeError:
             main.log.exception( self.name + ": Object not as expected" )
             return None
@@ -2002,76 +2010,80 @@
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-        ONOSIp = [ 0 ]
-        ONOSIp.extend( ONOSIpList )
 
-        devicesString = "devConfigs = "
-        for node in range( 1, len( ONOSIp ) ):
-            devicesString += ( ONOSIp[ node ] + ":" + str( switchList[ node ] ) )
+        ONOSIp = [0]
+        ONOSIp.extend(ONOSIpList)
+
+        devicesString  = "devConfigs = "
+        for node in range(1, len(ONOSIp)):
+            devicesString += (ONOSIp[node] + ":" + str(switchList[node] ))
             if node < clusterCount:
-                devicesString += ( "," )
+                devicesString += (",")
 
         try:
-            self.handle.sendline( "onos $OC1 cfg set org.onosproject.provider.nil.device.impl.NullDeviceProvider devConfigs " + devicesString )
-            self.handle.expect( ":~" )
-            self.handle.sendline( "onos $OC1 cfg set org.onosproject.provider.nil.device.impl.NullDeviceProvider numPorts " + str( numPorts ) )
-            self.handle.expect( ":~" )
+            self.handle.sendline("onos $OC1 cfg set org.onosproject.provider.nil.device.impl.NullDeviceProvider devConfigs " + devicesString )
+            self.handle.expect(":~")
+            self.handle.sendline("onos $OC1 cfg set org.onosproject.provider.nil.device.impl.NullDeviceProvider numPorts " + str(numPorts) )
+            self.handle.expect(":~")
 
-            for i in range( 10 ):
-                self.handle.sendline( "onos $OC1 cfg get org.onosproject.provider.nil.device.impl.NullDeviceProvider" )
-                self.handle.expect( ":~" )
+            for i in range(10):
+                self.handle.sendline("onos $OC1 cfg get org.onosproject.provider.nil.device.impl.NullDeviceProvider")
+                self.handle.expect(":~")
                 verification = self.handle.before
-                if ( " value=" + str( numPorts ) ) in verification and ( " value=" + devicesString ) in verification:
+                if (" value=" + str(numPorts)) in verification and (" value=" + devicesString) in verification:
                     break
                 else:
-                    time.sleep( 1 )
+                    time.sleep(1)
 
-            assert ( "value=" + str( numPorts ) ) in verification and ( " value=" + devicesString ) in verification
+            assert ("value=" + str(numPorts)) in verification and (" value=" + devicesString) in verification
 
         except AssertionError:
-            main.log.error( "Incorrect Config settings: " + verification )
+            main.log.error("Incorrect Config settings: " + verification)
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
             main.cleanAndExit()
 
-    def configNullLink( self, fileName="/opt/onos/apache-karaf-3.0.3/etc/linkGraph.cfg", eventRate=0 ):
-        """
+    def configNullLink( self,fileName="/opt/onos/apache-karaf-3.0.3/etc/linkGraph.cfg", eventRate=0):
+        '''
                 fileName default is currently the same as the default on ONOS, specify alternate file if
                 you want to use a different topology file than linkGraph.cfg
-        """
-        try:
-            self.handle.sendline( "onos $OC1 cfg set org.onosproject.provider.nil.link.impl.NullLinkProvider eventRate " + str( eventRate ) )
-            self.handle.expect( ":~" )
-            self.handle.sendline( "onos $OC1 cfg set org.onosproject.provider.nil.link.impl.NullLinkProvider cfgFile " + fileName )
-            self.handle.expect( ":~" )
+        '''
 
-            for i in range( 10 ):
-                self.handle.sendline( "onos $OC1 cfg get org.onosproject.provider.nil.link.impl.NullLinkProvider" )
-                self.handle.expect( ":~" )
+
+        try:
+            self.handle.sendline("onos $OC1 cfg set org.onosproject.provider.nil.link.impl.NullLinkProvider eventRate " + str(eventRate))
+            self.handle.expect(":~")
+            self.handle.sendline("onos $OC1 cfg set org.onosproject.provider.nil.link.impl.NullLinkProvider cfgFile " + fileName )
+            self.handle.expect(":~")
+
+            for i in range(10):
+                self.handle.sendline("onos $OC1 cfg get org.onosproject.provider.nil.link.impl.NullLinkProvider")
+                self.handle.expect(":~")
                 verification = self.handle.before
-                if ( " value=" + str( eventRate ) ) in verification and ( " value=" + fileName ) in verification:
+                if (" value=" + str(eventRate)) in verification and (" value=" + fileName) in verification:
                     break
                 else:
-                    time.sleep( 1 )
+                    time.sleep(1)
 
-            assert ( "value=" + str( eventRate ) ) in verification and ( " value=" + fileName ) in verification
+            assert ("value=" + str(eventRate)) in verification and (" value=" + fileName) in verification
 
         except pexpect.EOF:
             main.log.error( self.name + ": EOF exception found" )
             main.log.error( self.name + ":    " + self.handle.before )
             main.cleanAndExit()
         except AssertionError:
-            main.log.info( "Settings did not post to ONOS" )
-            main.log.error( varification )
+            main.log.info("Settings did not post to ONOS")
+            main.log.error(varification)
         except Exception:
             main.log.exception( self.name + ": Uncaught exception!" )
-            main.log.error( varification )
+            main.log.error(varification)
             main.cleanAndExit()
 
     def getOnosIps( self ):
         """
             Get all onos IPs stored in
         """
+
         return sorted( self.onosIps.values() )
 
     def listLog( self, nodeIp ):
@@ -2124,16 +2136,16 @@
         """
         try:
             main.log.info( " Log Report for {} ".format( nodeIp ).center( 70, '=' ) )
-            if isinstance( searchTerms, str ):
-                searchTerms = [ searchTerms ]
+            if type( searchTerms ) is str:
+                searchTerms = [searchTerms]
             numTerms = len( searchTerms )
             outputMode = outputMode.lower()
 
             totalHits = 0
             logLines = []
             for termIndex in range( numTerms ):
-                term = searchTerms[ termIndex ]
-                logLines.append( [ term ] )
+                term = searchTerms[termIndex]
+                logLines.append( [term] )
                 if startStr and endStr:
                     cmd = "onos-ssh {} \"sed -n '/{}/,/{}/p' /opt/onos/log/karaf.log | grep {}\"".format( nodeIp,
                                                                                                           startStr,
@@ -2150,7 +2162,7 @@
                     if term in line and "grep" not in line:
                         count += 1
                         if before.index( line ) > ( len( before ) - 7 ):
-                            logLines[ termIndex ].append( line )
+                            logLines[termIndex].append( line )
                 main.log.info( "{}: {}".format( term, count ) )
                 totalHits += count
                 if termIndex == numTerms - 1:
@@ -2158,10 +2170,10 @@
             if outputMode != "s":
                 outputString = ""
                 for term in logLines:
-                    outputString = term[ 0 ] + ": \n"
+                    outputString = term[0] + ": \n"
                     for line in range( 1, len( term ) ):
-                        outputString += ( "\t" + term[ line ] + "\n" )
-                    if outputString != ( term[ 0 ] + ": \n" ):
+                        outputString += ( "\t" + term[line] + "\n" )
+                    if outputString != ( term[0] + ": \n" ):
                         main.log.info( outputString )
             main.log.info( "=" * 70 )
             return totalHits
@@ -2178,7 +2190,7 @@
             main.cleanAndExit()
 
     def copyMininetFile( self, fileName, localPath, userName, ip,
-                         mnPath='~/mininet/custom/', timeout=60 ):
+                         mnPath='~/mininet/custom/', timeout = 60 ):
         """
         Description:
             Copy mininet topology file from dependency folder in the test folder
@@ -2194,6 +2206,7 @@
             Return main.TRUE if successfully copied the file otherwise
             return main.FALSE
         """
+
         try:
             cmd = "scp " + localPath + fileName + " " + userName + "@" + \
                   str( ip ) + ":" + mnPath + fileName
@@ -2230,22 +2243,22 @@
             main.log.error( self.name + ":     " + self.handle.before )
             main.cleanAndExit()
 
-    def jvmSet( self, memory=8 ):
+    def jvmSet(self, memory=8):
 
         import os
 
-        homeDir = os.path.expanduser( '~' )
+        homeDir = os.path.expanduser('~')
         filename = "/onos/tools/package/bin/onos-service"
 
-        serviceConfig = open( homeDir + filename, 'w+' )
-        serviceConfig.write( "#!/bin/bash\n " )
-        serviceConfig.write( "#------------------------------------- \n " )
-        serviceConfig.write( "# Starts ONOS Apache Karaf container\n " )
-        serviceConfig.write( "#------------------------------------- \n " )
-        serviceConfig.write( "#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n " )
-        serviceConfig.write( """export JAVA_OPTS="${ JAVA_OPTS:--Xms""" + str(memory) + "G -Xmx" + str(memory) + """G }" \n """ )
-        serviceConfig.write( "[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n" )
-        serviceConfig.write( """${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """ )
+        serviceConfig = open(homeDir + filename, 'w+')
+        serviceConfig.write("#!/bin/bash\n ")
+        serviceConfig.write("#------------------------------------- \n ")
+        serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
+        serviceConfig.write("#------------------------------------- \n ")
+        serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
+        serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms""" + str(memory) + "G -Xmx" + str(memory) + """G}" \n """)
+        serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
+        serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
         serviceConfig.close()
 
     def createDBFile( self, testData ):
@@ -2254,7 +2267,7 @@
         DBString = ""
 
         for item in testData:
-            if isinstance( item, string ):
+            if type( item ) is string:
                 item = "'" + item + "'"
             if testData.index( item ) < len( testData - 1 ):
                 item += ","
@@ -2266,15 +2279,15 @@
 
     def verifySummary( self, ONOSIp, *deviceCount ):
 
-        self.handle.sendline( "onos " + ONOSIp + " summary" )
+        self.handle.sendline( "onos " + ONOSIp  + " summary" )
         self.handle.expect( ":~" )
 
         summaryStr = self.handle.before
         print "\nSummary\n==============\n" + summaryStr + "\n\n"
 
-        # passed = "SCC(s)=1" in summaryStr
-        # if deviceCount:
-        #    passed = "devices=" + str( deviceCount ) + "," not in summaryStr
+        #passed = "SCC(s)=1" in summaryStr
+        #if deviceCount:
+        #    passed = "devices=" + str(deviceCount) + "," not in summaryStr
 
         passed = False
         if "SCC(s)=1," in summaryStr:
@@ -2285,7 +2298,7 @@
 
         if deviceCount:
             print" ============================="
-            checkStr = "devices=" + str( deviceCount[ 0 ] ) + ","
+            checkStr = "devices=" + str( deviceCount[0] ) + ","
             print "Checkstr: " + checkStr
             if checkStr not in summaryStr:
                 passed = False
@@ -2317,7 +2330,7 @@
             # IF self.ip_address is an ip address and matches
             #    self.nicAddr: return self.ip_address
             if match:
-                curIp = match.group( 0 )
+                curIp = match.group(0)
                 if nicPat:
                     nicMatch = re.search( nicPat, curIp )
                     if nicMatch:
@@ -2332,7 +2345,7 @@
             ips = re.findall( ifPat, raw )
             if iface:
                 if ips:
-                    ip = ips[ 0 ]
+                    ip = ips[0]
                     self.ip_address = ip
                     return ip
                 else:
@@ -2346,8 +2359,8 @@
                         return ip
             else:  # If only one non-localhost ip, return that
                 tmpList = [ ip for ip in ips if ip is not LOCALHOST ]
-                if len( tmpList ) == 1:
-                    curIp = tmpList[ 0 ]
+                if len(tmpList) == 1:
+                    curIp = tmpList[0]
                     self.ip_address = curIp
                     return curIp
             # Either no non-localhost IPs, or more than 1
@@ -2361,9 +2374,9 @@
             main.log.exception( "Uncaught exception" )
 
     def startBasicONOS( self, nodeList, opSleep=60, onosStartupSleep=30, onosUser="sdn" ):
-        """
+        '''
         Start onos cluster with defined nodes, but only with drivers app
-        """
+        '''
         import time
 
         self.createCellFile( self.ip_address,
@@ -2396,8 +2409,8 @@
 
         onosStatus = True
         for nd in nodeList:
-            onosStatus = onosStatus & self.isup( node=nd )
-            # print "onosStatus is: " + str( onosStatus )
+            onosStatus = onosStatus & self.isup( node = nd )
+            #print "onosStatus is: " + str( onosStatus )
 
         return main.TRUE if onosStatus else main.FALSE