diff --git a/tests/atests/common/discovery.py b/tests/atests/common/discovery.py
index a0f3ef5..e125dcf 100755
--- a/tests/atests/common/discovery.py
+++ b/tests/atests/common/discovery.py
@@ -18,12 +18,10 @@
 vOLT-HA Discovery Test Case module
 """
 
-import time
-import os
-import commands
 import testCaseUtils
 import logging
 
+
 class Discovery(object):
 
     """
@@ -31,10 +29,10 @@
     """
     
     def __init__(self):
-        self.dirs = {}
-        self.dirs ['log'] = None
-        self.dirs ['root'] = None
-        self.dirs ['voltha'] = None
+        self.dirs = dict()
+        self.dirs['log'] = None
+        self.dirs['root'] = None
+        self.dirs['voltha'] = None
 
         self.__logicalDeviceType = None
         self.__oltType = None
@@ -45,98 +43,100 @@
         self.__onuDeviceIds = []
         self.__peers = None
         
-    def dSetLogDirs(self, logDir):
-        testCaseUtils.configDirs(self, logDir)
+    def d_set_log_dirs(self, log_dir):
+        testCaseUtils.config_dirs(self, log_dir)
 
-    def dConfigure(self, logicalDeviceType, oltType, onuType):
-        self.__logicalDeviceType = logicalDeviceType
-        self.__oltType = oltType
-        self.__onuType = onuType
+    def d_configure(self, logical_device_type, olt_type, onu_type):
+        self.__logicalDeviceType = logical_device_type
+        self.__oltType = olt_type
+        self.__onuType = onu_type
 
-    def logicalDevice(self):
+    def logical_device(self):
         logging.info('Logical Device Info')
         statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__logicalDeviceType, 'voltha_devices_after_enable.log')
         assert statusLines, 'No Logical Devices listed under devices'
-        self.__fields = testCaseUtils.parseFields(statusLines)
+        self.__fields = testCaseUtils.parse_fields(statusLines)
         self.__logicalDeviceId = self.__fields[4].strip()
-        testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'),
-            'voltha_logical_device.log', 'logical_device ' + self.__logicalDeviceId, 'voltha_logical_device_ports.log', 'ports', 'voltha_logical_device_flows.log', 'flows')
-        testCaseUtils.printLogFile (self, 'voltha_logical_device_ports.log')
-        testCaseUtils.printLogFile (self, 'voltha_logical_device_flows.log')
+        testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'),
+                                                 'voltha_logical_device.log', 'logical_device ' + self.__logicalDeviceId,
+                                                 'voltha_logical_device_ports.log', 'ports', 'voltha_logical_device_flows.log', 'flows')
+        testCaseUtils.print_log_file(self, 'voltha_logical_device_ports.log')
+        testCaseUtils.print_log_file(self, 'voltha_logical_device_flows.log')
 
-    def oltDiscovery(self):
+    def olt_discovery(self):
         logging.info('Olt Discovery')
         statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__oltType, 'voltha_devices_after_enable.log')
         assert statusLines, 'No Olt listed under devices'
-        self.__fields = testCaseUtils.parseFields(statusLines)
+        self.__fields = testCaseUtils.parse_fields(statusLines)
         self.__oltDeviceId = self.__fields[1].strip()
-        testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'),
-            'voltha_olt_device.log', 'device ' + self.__oltDeviceId, 'voltha_olt_ports.log', 'ports', 'voltha_olt_flows.log', 'flows')
-        testCaseUtils.printLogFile (self, 'voltha_olt_ports.log')
-        testCaseUtils.printLogFile (self, 'voltha_olt_flows.log')
+        testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'),
+                                                 'voltha_olt_device.log', 'device ' + self.__oltDeviceId, 'voltha_olt_ports.log',
+                                                 'ports', 'voltha_olt_flows.log', 'flows')
+        testCaseUtils.print_log_file(self, 'voltha_olt_ports.log')
+        testCaseUtils.print_log_file(self, 'voltha_olt_flows.log')
             
-    def onuDiscovery(self):
+    def onu_discovery(self):
         logging.info('Onu Discovery')
         statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__onuType, 'voltha_devices_after_enable.log')
         assert statusLines, 'No Onu listed under devices'
         lines = statusLines.splitlines()
         for line in lines:
-            self.__fields = testCaseUtils.parseFields(line)
+            self.__fields = testCaseUtils.parse_fields(line)
             onuDeviceId = self.__fields[1].strip()
             self.__onuDeviceIds.append(onuDeviceId)
-            testCaseUtils.send_command_to_voltha_cli(testCaseUtils.getDir(self, 'log'),
-            'voltha_onu_device_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'device ' + onuDeviceId, 
-            'voltha_onu_ports_' +  str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'ports', 
-            'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'flows')
-            testCaseUtils.printLogFile (self, 'voltha_onu_ports_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
-            testCaseUtils.printLogFile (self, 'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
+            testCaseUtils.send_command_to_voltha_cli(testCaseUtils.get_dir(self, 'log'),
+                                                     'voltha_onu_device_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log',
+                                                     'device ' + onuDeviceId, 'voltha_onu_ports_' +
+                                                     str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'ports', 'voltha_onu_flows_' +
+                                                     str(self.__onuDeviceIds.index(onuDeviceId)) + '.log', 'flows')
+            testCaseUtils.print_log_file(self, 'voltha_onu_ports_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
+            testCaseUtils.print_log_file(self, 'voltha_onu_flows_' + str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
                 
     def olt_ports_should_be_enabled_and_active(self):
         statusLines = testCaseUtils.get_fields_from_grep_command(self, self.__oltDeviceId, 'voltha_olt_ports.log')
         assert statusLines, 'No Olt device listed under ports'
         lines = statusLines.splitlines()
         for line in lines:
-            self.__fields = testCaseUtils.parseFields(line)
-            assert self.check_states(self.__oltDeviceId) == True, 'States of %s does match expected ' % self.__oltDeviceId
+            self.__fields = testCaseUtils.parse_fields(line)
+            assert (self.check_states(self.__oltDeviceId) is True), 'States of %s does match expected ' % self.__oltDeviceId
             portType = self.__fields[3].strip()
             assert (portType == 'ETHERNET_NNI' or portType == 'PON_OLT'),\
-            'Port type for %s does not match expected ETHERNET_NNI or PON_OLT' % self.__oltDeviceId
+                'Port type for %s does not match expected ETHERNET_NNI or PON_OLT' % self.__oltDeviceId
             if portType == 'PON_OLT':
                 self.__peers = self.__fields[7].strip()
                 peerFields = self.__peers.split(',')
                 peerDevices = peerFields[1::2]
                 for peerDevice in peerDevices:
                     deviceFields = peerDevice.split(':')
-                    deviceId = deviceFields[1].replace("'","").replace('u','').rstrip("}]").strip()
+                    deviceId = deviceFields[1].replace("'", "").replace('u', '').rstrip("}]").strip()
                     assert deviceId in self.__onuDeviceIds, 'ONU Device %s not found as Peer' % deviceId
                     
     def onu_ports_should_be_enabled_and_active(self):
         for onuDeviceId in self.__onuDeviceIds:
-            statusLines = testCaseUtils.get_fields_from_grep_command(self, onuDeviceId, 'voltha_onu_ports_' + \
-            str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
+            statusLines = testCaseUtils.get_fields_from_grep_command(self, onuDeviceId, 'voltha_onu_ports_' +
+                                                                     str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
             assert statusLines, 'No Onu device listed under ports'
             lines = statusLines.splitlines()
             for line in lines:
-                self.__fields = testCaseUtils.parseFields(line)
-                assert self.check_states(onuDeviceId) == True, 'States of %s does match expected ' % onuDeviceId
+                self.__fields = testCaseUtils.parse_fields(line)
+                assert (self.check_states(onuDeviceId) is True), 'States of %s does match expected ' % onuDeviceId
                 portType = self.__fields[3].strip()
                 assert (portType == 'ETHERNET_UNI' or portType == 'PON_ONU'),\
-                'Port type for %s does not match expected ETHERNET_UNI or PON_ONU' % onuDeviceId
+                    'Port type for %s does not match expected ETHERNET_UNI or PON_ONU' % onuDeviceId
                 if portType == 'PON_ONU':
                     self.__peers = self.__fields[7].strip()
                     peerFields = self.__peers.split(',')
                     peerDevice = peerFields[1]
                     deviceFields = peerDevice.split(':')
-                    deviceId = deviceFields[1].replace("'","").replace('u','').rstrip("}]").strip()
+                    deviceId = deviceFields[1].replace("'", "").replace('u', '').rstrip("}]").strip()
                     assert deviceId == self.__oltDeviceId, 'OLT Device %s not found as Peer' % deviceId
                     
-                           
-    def check_states(self, deviceId):
+    def check_states(self, device_id):
         result = True
         adminState = self.__fields[4].strip()
-        assert adminState == 'ENABLED', 'Admin State of %s not ENABLED' % deviceId
-        operStatus = self.__fields[5].strip()
-        assert operStatus == 'ACTIVE', 'Oper Status of %s not ACTIVE' % deviceId
+        assert adminState == 'ENABLED', 'Admin State of %s not ENABLED' % device_id
+        operatorStatus = self.__fields[5].strip()
+        assert operatorStatus == 'ACTIVE', 'Operator Status of %s not ACTIVE' % device_id
         return result
 
     def olt_should_have_at_least_one_flow(self):
@@ -149,8 +149,8 @@
             
     def onu_should_have_at_least_one_flow(self):
         for onuDeviceId in self.__onuDeviceIds:
-            statusLines = testCaseUtils.get_fields_from_grep_command(self, 'Flows', 'voltha_onu_flows_' + \
-            str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
+            statusLines = testCaseUtils.get_fields_from_grep_command(self, 'Flows', 'voltha_onu_flows_' +
+                                                                     str(self.__onuDeviceIds.index(onuDeviceId)) + '.log')
             assert statusLines, 'No Onu flows under device %s' % onuDeviceId
             before, flows, numFlows = statusLines.partition('Flows')
             plainNumber = numFlows.strip().strip('():')
@@ -158,14 +158,14 @@
                 assert int(plainNumber) > 0, 'Zero number of flows for Onu %s' % onuDeviceId
                       
 
-def runTest(logicalDeviceType, oltType, onuType, logDir):
+def run_test(logical_device_type, olt_type, onu_type, log_dir):
     discovery = Discovery()
-    discovery.dSetLogDirs(logDir)
-    discovery.dConfigure(logicalDeviceType, oltType, onuType)
-    discovery.oltDiscovery()
-    discovery.onuDiscovery()
-    discovery.logicalDevice()
-    discovery.olt_ports_should_be_enabled_and_active()                                      
+    discovery.d_set_log_dirs(log_dir)
+    discovery.d_configure(logical_device_type, olt_type, onu_type)
+    discovery.olt_discovery()
+    discovery.onu_discovery()
+    discovery.logical_device()
+    discovery.olt_ports_should_be_enabled_and_active()
     discovery.onu_ports_should_be_enabled_and_active()
     discovery.olt_should_have_at_least_one_flow()
     discovery.onu_should_have_at_least_one_flow()
