Run codecheck script on CHOTestMonkey

Change-Id: I11047f1b4c6ecd8273695c230d3a4a99475a6db6
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
index 4283ff6..2661a07 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/AppEvent.py
@@ -5,7 +5,9 @@
 from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
 from tests.CHOTestMonkey.dependencies.elements.ONOSElement import HostIntent, PointIntent
 
+
 class IntentEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
         # The index of the ONOS CLI that is going to run the command
@@ -19,7 +21,7 @@
             candidates = [ host for host in main.hosts if host not in hostA.correspondents and host != hostA ]
         if len( candidates ) == 0:
             return None
-        hostB = random.sample( candidates, 1 )[0]
+        hostB = random.sample( candidates, 1 )[ 0 ]
         return hostB
 
     def getRandomHostPair( self, connected=True ):
@@ -28,11 +30,11 @@
         with main.variableLock:
             for host in main.hosts:
                 correspondent = self.getRandomCorrespondent( host, connected=connected )
-                if correspondent != None:
+                if correspondent is not None:
                     candidateDict[ host ] = correspondent
             if candidateDict == {}:
                 return None
-            hostA = random.sample( candidateDict.keys(), 1 )[0]
+            hostA = random.sample( candidateDict.keys(), 1 )[ 0 ]
             hostB = candidateDict[ hostA ]
             return [ hostA, hostB ]
 
@@ -52,7 +54,9 @@
         intent = random.sample( intents, 1 )[ 0 ]
         return intent
 
+
 class HostIntentEvent( IntentEvent ):
+
     def __init__( self ):
         IntentEvent.__init__( self )
         self.hostA = None
@@ -75,14 +79,14 @@
                     if args[ 0 ] == 'random' or args[ 1 ] == 'random':
                         if self.typeIndex == EventType().APP_INTENT_HOST_ADD:
                             hostPairRandom = self.getRandomHostPair( connected=False )
-                            if hostPairRandom == None:
+                            if hostPairRandom is None:
                                 main.log.warn( "All host pairs are connected, aborting event" )
                                 return EventStates().ABORT
                             self.hostA = hostPairRandom[ 0 ]
                             self.hostB = hostPairRandom[ 1 ]
                         elif self.typeIndex == EventType().APP_INTENT_HOST_DEL:
                             intent = self.getRandomIntentByType( 'INTENT_HOST' )
-                            if intent == None:
+                            if intent is None:
                                 main.log.warn( "No host intent for deletion, aborting event" )
                                 return EventStates().ABORT
                             self.hostA = intent.hostA
@@ -96,12 +100,12 @@
                                 self.hostA = host
                             elif host.name == args[ 1 ]:
                                 self.hostB = host
-                            if self.hostA != None and self.hostB != None:
+                            if self.hostA is not None and self.hostB is not None:
                                 break
-                        if self.hostA == None:
+                        if self.hostA is None:
                             main.log.warn( "Host %s does not exist: " % ( args[ 0 ] ) )
                             return EventStates().ABORT
-                        if self.hostB == None:
+                        if self.hostB is None:
                             main.log.warn( "Host %s does not exist: " % ( args[ 1 ] ) )
                             return EventStates().ABORT
                     index = int( args[ 2 ] )
@@ -117,32 +121,34 @@
                     main.log.warn( "Caught exception, aborting event" )
                     return EventStates().ABORT
 
+
 class AddHostIntent( HostIntentEvent ):
+
     """
-    Add a host-to-host intent (bidirectional)
+    Add a host-to-host intent ( bidirectional )
     """
     def __init__( self ):
         HostIntentEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startHostIntentEvent( self ):
         try:
-            assert self.hostA != None and self.hostB != None
+            assert self.hostA is not None and self.hostB is not None
             # Check whether there already exists some intent for the host pair
             # For now we should avoid installing overlapping intents
             for intent in main.intents:
                 if not intent.type == 'INTENT_HOST':
                     continue
                 if intent.hostA == self.hostA and intent.hostB == self.hostB or\
-                intent.hostB == self.hostA and intent.hostA == self.hostB:
+                        intent.hostB == self.hostA and intent.hostA == self.hostB:
                     main.log.warn( self.typeString + " - find an exiting intent for the host pair, abort installation" )
                     return EventStates().ABORT
             main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.hostA.name, self.hostB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 id = controller.CLI.addHostIntent( self.hostA.id, self.hostB.id )
-            if id == None:
+            if id is None:
                 main.log.warn( self.typeString + " - add host intent failed" )
                 return EventStates().FAIL
             with main.variableLock:
@@ -157,34 +163,36 @@
             main.log.warn( "Caught exception, aborting event" )
             return EventStates().ABORT
 
+
 class DelHostIntent( HostIntentEvent ):
+
     """
-    Delete a host-to-host intent (bidirectional)
+    Delete a host-to-host intent ( bidirectional )
     """
     def __init__( self ):
         HostIntentEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startHostIntentEvent( self ):
         try:
-            assert self.hostA != None and self.hostB != None
+            assert self.hostA is not None and self.hostB is not None
             targetIntent = None
             for intent in main.intents:
                 if not intent.type == 'INTENT_HOST':
                     continue
                 if intent.hostA == self.hostA and intent.hostB == self.hostB or\
-                intent.hostB == self.hostA and intent.hostA == self.hostB:
+                        intent.hostB == self.hostA and intent.hostA == self.hostB:
                     targetIntent = intent
                     break
-            if targetIntent == None:
+            if targetIntent is None:
                 main.log.warn( self.typeString + " - intent does not exist" )
                 return EventStates().FAIL
             main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.hostA.name, self.hostB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 result = controller.CLI.removeIntent( targetIntent.id, purge=True )
-            if result == None or result == main.FALSE:
+            if result is None or result == main.FALSE:
                 main.log.warn( self.typeString + " - delete host intent failed" )
                 return EventStates().FAIL
             with main.variableLock:
@@ -195,7 +203,9 @@
             main.log.warn( "Caught exception, aborting event" )
             return EventStates().ABORT
 
+
 class PointIntentEvent( IntentEvent ):
+
     def __init__( self ):
         IntentEvent.__init__( self )
         self.deviceA = None
@@ -218,14 +228,14 @@
                     if args[ 0 ] == 'random' or args[ 1 ] == 'random':
                         if self.typeIndex == EventType().APP_INTENT_POINT_ADD:
                             hostPairRandom = self.getRandomHostPair( connected=False )
-                            if hostPairRandom == None:
+                            if hostPairRandom is None:
                                 main.log.warn( "All host pairs are connected, aborting event" )
                                 return EventStates().ABORT
                             self.deviceA = hostPairRandom[ 0 ].device
                             self.deviceB = hostPairRandom[ 1 ].device
                         elif self.typeIndex == EventType().APP_INTENT_POINT_DEL:
                             intent = self.getRandomIntentByType( 'INTENT_POINT' )
-                            if intent == None:
+                            if intent is None:
                                 main.log.warn( "No point intent for deletion, aborting event" )
                                 return EventStates().ABORT
                             self.deviceA = intent.deviceA
@@ -239,12 +249,12 @@
                                 self.deviceA = device
                             elif device.name == args[ 1 ]:
                                 self.deviceB = device
-                            if self.deviceA != None and self.deviceB != None:
+                            if self.deviceA is not None and self.deviceB is not None:
                                 break
-                        if self.deviceA == None:
+                        if self.deviceA is None:
                             main.log.warn( "Device %s does not exist: " % ( args[ 0 ] ) )
                             return EventStates().ABORT
-                        if self.deviceB == None:
+                        if self.deviceB is None:
                             main.log.warn( "Device %s does not exist: " % ( args[ 1 ] ) )
                             return EventStates().ABORT
                     index = int( args[ 2 ] )
@@ -270,18 +280,20 @@
                     main.log.warn( "Caught exception, aborting event" )
                     return EventStates().ABORT
 
+
 class AddPointIntent( PointIntentEvent ):
+
     """
     Add a point-to-point intent
     """
     def __init__( self ):
         PointIntentEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startPointIntentEvent( self ):
         try:
-            assert self.deviceA != None and self.deviceB != None
+            assert self.deviceA is not None and self.deviceB is not None
             controller = main.controllers[ self.CLIIndex - 1 ]
             # TODO: support multiple hosts under one device
             # Check whether there already exists some intent for the device pair
@@ -302,7 +314,7 @@
                 if len( self.deviceB.hosts ) > 0:
                     dstMAC = self.deviceB.hosts[ 0 ].mac
                 id = controller.CLI.addPointIntent( self.deviceA.dpid, self.deviceB.dpid, 1, 1, '', srcMAC, dstMAC )
-            if id == None:
+            if id is None:
                 main.log.warn( self.typeString + " - add point intent failed" )
                 return EventStates().FAIL
             with main.variableLock:
@@ -317,18 +329,20 @@
             main.log.warn( "Caught exception, aborting event" )
             return EventStates().ABORT
 
+
 class DelPointIntent( PointIntentEvent ):
+
     """
     Delete a point-to-point intent
     """
     def __init__( self ):
         PointIntentEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startPointIntentEvent( self ):
         try:
-            assert self.deviceA != None and self.deviceB != None
+            assert self.deviceA is not None and self.deviceB is not None
             targetIntent = None
             for intent in main.intents:
                 if not intent.type == 'INTENT_POINT':
@@ -336,14 +350,14 @@
                 if intent.deviceA == self.deviceA and intent.deviceB == self.deviceB:
                     targetIntent = intent
                     break
-            if targetIntent == None:
+            if targetIntent is None:
                 main.log.warn( self.typeString + " - intent does not exist" )
                 return EventStates().FAIL
             main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.deviceA.name, self.deviceB.name, self.CLIIndex ) )
             controller = main.controllers[ self.CLIIndex - 1 ]
             with controller.CLILock:
                 result = controller.CLI.removeIntent( targetIntent.id, purge=True )
-            if result == None or result == main.FALSE:
+            if result is None or result == main.FALSE:
                 main.log.warn( self.typeString + " - delete point intent failed" )
                 return EventStates().FAIL
             with main.variableLock:
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
old mode 100755
new mode 100644
index 8c85ff8..2c0cfc3
--- a/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/CheckEvent.py
@@ -4,7 +4,9 @@
 """
 from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
 
+
 class CheckEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
 
@@ -17,7 +19,9 @@
             result = self.startCheckEvent()
             return result
 
+
 class IntentCheck( CheckEvent ):
+
     def __init__( self ):
         CheckEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
@@ -37,7 +41,9 @@
                     checkResult = EventStates().FAIL
         return checkResult
 
+
 class FlowCheck( CheckEvent ):
+
     def __init__( self ):
         CheckEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
@@ -58,7 +64,7 @@
                         if device.isRemoved():
                             continue
                         coreFlowNumOnos = controller.CLI.flowAddedCount( device.dpid, core=True )
-                        if coreFlowNumOnos == None:
+                        if coreFlowNumOnos is None:
                             main.log.warn( "Flow Check - error when trying to get flow number of %s on ONOS%s" % ( device.dpid, controller.index ) )
                             checkResult = EventStates().FAIL
                         else:
@@ -94,7 +100,9 @@
                         checkResult = EventStates().FAIL
         return checkResult
 
+
 class TopoCheck( CheckEvent ):
+
     def __init__( self ):
         CheckEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
@@ -144,7 +152,7 @@
                         devices = json.loads( devices )
                         availableDeviceNum = 0
                         for device in devices:
-                            if device[ 'available' ] == True:
+                            if device[ 'available' ]:
                                 availableDeviceNum += 1
                         if not availableDeviceNum == upDeviceNum:
                             checkResult = EventStates().FAIL
@@ -166,11 +174,13 @@
                         return EventStates().FAIL
         return checkResult
 
+
 class ONOSCheck( CheckEvent ):
+
     def __init__( self ):
         CheckEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startCheckEvent( self, args=None ):
         import json
@@ -209,7 +219,7 @@
                     with controller.CLILock:
                         leaders = controller.CLI.leaders()
                     leaders = json.loads( leaders )
-                    ONOSTopics = [ j['topic'] for j in leaders ]
+                    ONOSTopics = [ j[ 'topic' ] for j in leaders ]
                     for topic in topics:
                         if topic not in ONOSTopics:
                             checkResult = EventStates().FAIL
@@ -235,11 +245,13 @@
                     return EventStates().FAIL
         return checkResult
 
+
 class TrafficCheck( CheckEvent ):
+
     def __init__( self ):
         CheckEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startCheckEvent( self, args=None ):
         checkResult = EventStates().PASS
@@ -256,7 +268,7 @@
             dstIPv4List[ host.index ] = []
             dstIPv6List[ host.index ] = []
             for correspondent in host.correspondents:
-                if not correspondent in upHosts:
+                if correspondent not in upHosts:
                     continue
                 for ipAddress in correspondent.ipAddresses:
                     if ipAddress.startswith( str( main.params[ 'TEST' ][ 'ipv6Prefix' ] ) ):
@@ -295,4 +307,3 @@
                 checkResult = EventStates().FAIL
                 main.log.warn( "Traffic Check - ping6 failed" )
         return checkResult
-
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/Event.py b/TestON/tests/CHOTestMonkey/dependencies/events/Event.py
index 2abd77f..9aa4ae6 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/Event.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/Event.py
@@ -4,10 +4,12 @@
 """
 from threading import Lock
 
+
 class EventType:
+
     def __init__( self ):
         self.map = {}
-        # Group events (>100) should be divided into individual events by the generator before going to the scheduler
+        # Group events ( >100 ) should be divided into individual events by the generator before going to the scheduler
         self.NULL = 0
         for eventName in main.params[ 'EVENT' ].keys():
             typeString = main.params[ 'EVENT' ][ eventName ][ 'typeString' ]
@@ -15,7 +17,9 @@
             setattr( self, typeString, typeIndex )
             self.map[ typeIndex ] = typeString
 
+
 class EventStates:
+
     def __init__( self ):
         self.map = {}
         self.FAIL = 0
@@ -25,7 +29,9 @@
         self.ABORT = -1
         self.map[ -1 ] = 'ABORT'
 
+
 class Event:
+
     """
     Event class for CHOTestMonkey
     It is the super class for CheckEvent and NetworkEvent
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
index f6e13cc..a601c42 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/NetworkEvent.py
@@ -5,7 +5,9 @@
 from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
 from tests.CHOTestMonkey.dependencies.elements.NetworkElement import NetworkElement, Device, Host, Link
 
+
 class LinkEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
         self.linkA = None
@@ -16,7 +18,7 @@
 
     def startEvent( self, args ):
         """
-        args are the names of the two link ends, e.g. ['s1', 's2']
+        args are the names of the two link ends, e.g. [ 's1', 's2' ]
         """
         with self.eventLock:
             #main.log.info( "%s - starting event" % ( self.typeString ) )
@@ -30,7 +32,7 @@
                 if self.typeIndex == EventType().NETWORK_LINK_DOWN:
                     with main.mininetLock:
                         linkRandom = main.Mininet1.getLinkRandom()
-                    if linkRandom == None:
+                    if linkRandom is None:
                         main.log.warn( "No link available, aborting event" )
                         return EventStates().ABORT
                     args[ 0 ] = linkRandom[ 0 ]
@@ -51,21 +53,23 @@
             elif args[ 0 ] == args[ 1 ]:
                 main.log.warn( "%s - invalid arguments: %s" % ( self.typeString, args ) )
                 return EventStates().ABORT
-            if self.linkA == None or self.linkB == None:
+            if self.linkA is None or self.linkB is None:
                 for link in main.links:
                     if link.deviceA.name == args[ 0 ] and link.deviceB.name == args[ 1 ]:
                         self.linkA = link
                     elif link.deviceA.name == args[ 1 ] and link.deviceB.name == args[ 0 ]:
                         self.linkB = link
-                    if self.linkA != None and self.linkB != None:
+                    if self.linkA is not None and self.linkB is not None:
                         break
-                if self.linkA == None or self.linkB == None:
+                if self.linkA is None or self.linkB is None:
                     main.log.warn( "Bidirectional link %s - %s does not exist: " % ( args[ 0 ], args[ 1 ] ) )
                     return EventStates().ABORT
             main.log.debug( "%s - %s" % ( self.typeString, self.linkA ) )
             return self.startLinkEvent()
 
+
 class LinkDown( LinkEvent ):
+
     """
     Generate a link down event giving the two ends of the link
     """
@@ -76,7 +80,7 @@
 
     def startLinkEvent( self ):
         # TODO: do we need to handle a unidirectional link?
-        assert self.linkA != None and self.linkB != None
+        assert self.linkA is not None and self.linkB is not None
         with main.variableLock:
             if self.linkA.isDown() or self.linkB.isDown():
                 main.log.warn( "Link Down - link already down" )
@@ -86,11 +90,11 @@
                 return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.linkA.deviceA.name, self.linkA.deviceB.name ) )
         with main.mininetLock:
-            '''
+            """
             result = main.Mininet1.link( END1=self.linkA.deviceA.name,
                                          END2=self.linkA.deviceB.name,
-                                         OPTION="down")
-            '''
+                                         OPTION="down" )
+            """
             result = main.Mininet1.delLink( self.linkA.deviceA.name,
                                             self.linkA.deviceB.name )
         if not result:
@@ -101,7 +105,9 @@
             self.linkB.bringDown()
         return EventStates().PASS
 
+
 class LinkUp( LinkEvent ):
+
     """
     Generate a link up event giving the two ends of the link
     """
@@ -111,7 +117,7 @@
         self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startLinkEvent( self ):
-        assert self.linkA != None and self.linkB != None
+        assert self.linkA is not None and self.linkB is not None
         with main.variableLock:
             if self.linkA.isUp() or self.linkB.isUp():
                 main.log.warn( "Link Up - link already up" )
@@ -121,11 +127,11 @@
                 return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {}".format( self.typeIndex, self.typeString, self.linkA.deviceA.name, self.linkA.deviceB.name ) )
         with main.mininetLock:
-            '''
+            """
             result = main.Mininet1.link( END1=self.linkA.deviceA.name,
                                          END2=self.linkA.deviceB.name,
-                                         OPTION="up")
-            '''
+                                         OPTION="up" )
+            """
             result = main.Mininet1.addLink( self.linkA.deviceA.name,
                                             self.linkA.deviceB.name )
         if not result:
@@ -136,7 +142,9 @@
             self.linkB.bringUp()
         return EventStates().PASS
 
+
 class DeviceEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
         self.device = None
@@ -161,7 +169,7 @@
                 if self.typeIndex == EventType().NETWORK_DEVICE_DOWN:
                     with main.mininetLock:
                         switchRandom = main.Mininet1.getSwitchRandom()
-                    if switchRandom == None:
+                    if switchRandom is None:
                         main.log.warn( "No switch available, aborting event" )
                         return EventStates().ABORT
                     args[ 0 ] = switchRandom
@@ -176,19 +184,21 @@
                             return EventStates().ABORT
                         deviceList = random.sample( removedDevices, 1 )
                         self.device = deviceList[ 0 ]
-            if self.device == None:
+            if self.device is None:
                 for device in main.devices:
                     if device.name == args[ 0 ]:
                         self.device = device
-                if self.device == None:
+                if self.device is None:
                     main.log.warn( "Device %s does not exist: " % ( args[ 0 ] ) )
                     return EventStates().ABORT
             main.log.debug( "%s - %s" % ( self.typeString, self.device ) )
             return self.startDeviceEvent()
 
+
 class DeviceDown( DeviceEvent ):
+
     """
-    Generate a device down event (which actually removes this device for now) giving its name
+    Generate a device down event ( which actually removes this device for now ) giving its name
     """
     def __init__( self ):
         DeviceEvent.__init__( self )
@@ -196,7 +206,7 @@
         self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startDeviceEvent( self ):
-        assert self.device != None
+        assert self.device is not None
         with main.variableLock:
             if self.device.isRemoved():
                 main.log.warn( "Device Down - device has been removed" )
@@ -219,9 +229,11 @@
                     intent.setFailed()
         return EventStates().PASS
 
+
 class DeviceUp( DeviceEvent ):
+
     """
-    Generate a device up event (which re-adds this device in case the device is removed) giving its name
+    Generate a device up event ( which re-adds this device in case the device is removed ) giving its name
     """
     def __init__( self ):
         DeviceEvent.__init__( self )
@@ -229,7 +241,7 @@
         self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startDeviceEvent( self ):
-        assert self.device != None
+        assert self.device is not None
         with main.variableLock:
             if self.device.isUp():
                 main.log.warn( "Device Up - device already up" )
@@ -237,7 +249,7 @@
         # Re-add the device
         main.log.info( "Event recorded: {} {} {}".format( self.typeIndex, self.typeString, self.device.name ) )
         with main.mininetLock:
-            result = main.Mininet1.addSwitch( self.device.name, dpid=self.device.dpid[3:] )
+            result = main.Mininet1.addSwitch( self.device.name, dpid=self.device.dpid[ 3: ] )
         if not result:
             main.log.warn( "%s - failed to re-add device" % ( self.typeString ) )
             return EventStates().FAIL
@@ -269,7 +281,7 @@
                 for intent in main.intents:
                     if intent.isFailed():
                         if intent.deviceA == self.device and intent.deviceB.isUp() or\
-                        intent.deviceB == self.device and intent.deviceA.isUp():
+                                intent.deviceB == self.device and intent.deviceA.isUp():
                             intent.setInstalled()
         # Re-assign mastership for the device
         with main.mininetLock:
@@ -281,7 +293,7 @@
                 if h.isUp() and h != host:
                     correspondent = h
                     break
-            if correspondent == None:
+            if correspondent is None:
                 with main.mininetLock:
                     main.Mininet1.pingall()
                     if main.enableIPv6:
@@ -290,14 +302,14 @@
                 ipv4Addr = None
                 ipv6Addr = None
                 for ipAddress in correspondent.ipAddresses:
-                    if ipAddress.startswith( str( main.params[ 'TEST' ][ 'ipv6Prefix' ] ) ) and ipv6Addr == None:
+                    if ipAddress.startswith( str( main.params[ 'TEST' ][ 'ipv6Prefix' ] ) ) and ipv6Addr is None:
                         ipv6Addr = ipAddress
-                    elif ipAddress.startswith( str( main.params[ 'TEST' ][ 'ipv4Prefix' ] ) ) and ipv4Addr == None:
+                    elif ipAddress.startswith( str( main.params[ 'TEST' ][ 'ipv4Prefix' ] ) ) and ipv4Addr is None:
                         ipv4Addr = ipAddress
-                assert ipv4Addr != None
+                assert ipv4Addr is not None
                 host.handle.pingHostSetAlternative( [ ipv4Addr ], 1 )
                 if main.enableIPv6:
-                    assert ipv6Addr != None
+                    assert ipv6Addr is not None
                     host.handle.pingHostSetAlternative( [ ipv6Addr ], 1, True )
             with main.variableLock:
                 host.bringUp()
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
index cafe800..d386c1b 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/ONOSEvent.py
@@ -4,7 +4,9 @@
 """
 from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
 
+
 class ONOSEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
         self.ONOSIndex = -1
@@ -30,11 +32,13 @@
                         result = self.startONOSEvent()
             return result
 
+
 class ONOSDown( ONOSEvent ):
+
     def __init__( self ):
         ONOSEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startONOSEvent( self ):
         assert self.ONOSIndex != -1
@@ -52,11 +56,13 @@
             main.controllers[ self.ONOSIndex - 1 ].bringDown()
         return EventStates().PASS
 
+
 class ONOSUp( ONOSEvent ):
+
     def __init__( self ):
         ONOSEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startONOSEvent( self ):
         assert self.ONOSIndex != -1
@@ -85,7 +91,9 @@
                         main.controllers[ self.ONOSIndex - 1 ].bringUp()
         return EventStates().PASS
 
+
 class CfgEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
         self.component = ''
@@ -98,11 +106,13 @@
             result = self.startCfgEvent( args )
             return result
 
+
 class SetCfg( CfgEvent ):
+
     def __init__( self ):
         CfgEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startCfgEvent( self, args ):
         if len( args ) < 3:
@@ -121,7 +131,7 @@
             if controller.isUp():
                 index = controller.index
         if index == -1:
-            main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
+            main.log.warn( "%s - No available controllers" % s( self.typeString ) )
             return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.component, self.propName, self.value ) )
         controller = main.controllers[ index - 1 ]
@@ -134,11 +144,13 @@
             return EventStates().FAIL
         return EventStates().PASS
 
+
 class SetFlowObj( CfgEvent ):
+
     def __init__( self ):
         CfgEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startCfgEvent( self, args ):
         if len( args ) < 1:
@@ -159,7 +171,7 @@
             if controller.isUp():
                 index = controller.index
         if index == -1:
-            main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
+            main.log.warn( "%s - No available controllers" % s( self.typeString ) )
             return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.component, self.propName, self.value ) )
         controller = main.controllers[ index - 1 ]
@@ -172,11 +184,13 @@
             return EventStates().FAIL
         return EventStates().PASS
 
+
 class BalanceMasters( Event ):
+
     def __init__( self ):
         Event.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startEvent( self, args=None ):
         with self.eventLock:
@@ -186,7 +200,7 @@
                 if controller.isUp():
                     index = controller.index
             if index == -1:
-                main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
+                main.log.warn( "%s - No available controllers" % s( self.typeString ) )
                 return EventStates().ABORT
             main.log.info( "Event recorded: {} {}".format( self.typeIndex, self.typeString ) )
             controller = main.controllers[ index - 1 ]
@@ -197,11 +211,13 @@
                 return EventStates().FAIL
             return EventStates().PASS
 
+
 class SetFlowObjCompiler( CfgEvent ):
+
     def __init__( self ):
         CfgEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
-        self.typeIndex= int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
+        self.typeIndex = int( main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeIndex' ] )
 
     def startCfgEvent( self, args ):
         if len( args ) < 1:
@@ -219,7 +235,7 @@
             if controller.isUp():
                 index = controller.index
         if index == -1:
-            main.log.warn( "%s - No available controllers" %s ( self.typeString ) )
+            main.log.warn( "%s - No available controllers" % s( self.typeString ) )
             return EventStates().ABORT
         main.log.info( "Event recorded: {} {} {} {} {}".format( self.typeIndex, self.typeString, self.component, self.propName, self.value ) )
         controller = main.controllers[ index - 1 ]
@@ -231,4 +247,3 @@
             main.log.warn( "%s - failed to set configuration" % ( self.typeString ) )
             return EventStates().FAIL
         return EventStates().PASS
-
diff --git a/TestON/tests/CHOTestMonkey/dependencies/events/TestEvent.py b/TestON/tests/CHOTestMonkey/dependencies/events/TestEvent.py
index 605e43f..07a8cf3 100644
--- a/TestON/tests/CHOTestMonkey/dependencies/events/TestEvent.py
+++ b/TestON/tests/CHOTestMonkey/dependencies/events/TestEvent.py
@@ -4,7 +4,9 @@
 """
 from tests.CHOTestMonkey.dependencies.events.Event import EventType, EventStates, Event
 
+
 class TestEvent( Event ):
+
     def __init__( self ):
         Event.__init__( self )
 
@@ -17,7 +19,9 @@
             result = self.startTestEvent( args )
             return result
 
+
 class TestPause( TestEvent ):
+
     def __init__( self ):
         TestEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
@@ -28,7 +32,9 @@
         main.eventScheduler.setRunningState( False )
         return result
 
+
 class TestResume( TestEvent ):
+
     def __init__( self ):
         TestEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]
@@ -39,7 +45,9 @@
         main.eventScheduler.setRunningState( True )
         return result
 
+
 class TestSleep( TestEvent ):
+
     def __init__( self ):
         TestEvent.__init__( self )
         self.typeString = main.params[ 'EVENT' ][ self.__class__.__name__ ][ 'typeString' ]