diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py index 09d7fe272edb..09ba9f22e51e 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/plugins/sfputil.py @@ -186,7 +186,7 @@ def get_transceiver_change_event(self, timeout=0): phy_port_dict = {} status = True - if self.db_sel == None: + if self.db_sel is None: from swsscommon import swsscommon self.state_db = swsscommon.DBConnector("STATE_DB", REDIS_TIMEOUT_USECS, diff --git a/files/build_scripts/generate_asic_config_checksum.py b/files/build_scripts/generate_asic_config_checksum.py index 41ef6f045e21..2e7aaf0f5842 100755 --- a/files/build_scripts/generate_asic_config_checksum.py +++ b/files/build_scripts/generate_asic_config_checksum.py @@ -57,7 +57,7 @@ def generate_checksum(checksum_files): def main(): config_files = sorted(get_config_files(CONFIG_FILES)) checksum = generate_checksum(config_files) - if checksum == None: + if checksum is None: exit(1) with open(OUTPUT_FILE, 'w') as output: diff --git a/files/image_config/corefile_uploader/core_uploader.py b/files/image_config/corefile_uploader/core_uploader.py index 4807425f4307..ac242006e8c7 100755 --- a/files/image_config/corefile_uploader/core_uploader.py +++ b/files/image_config/corefile_uploader/core_uploader.py @@ -219,7 +219,6 @@ def handle_file(path): def upload_file(fname, fpath, coref): daemonname = fname.split(".")[0] i = 0 - fail_msg = "" while True: try: diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py index 6dbf5c2cc720..8913233366e2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor.py @@ -20,19 +20,13 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time - import traceback import commands - from tabulate import tabulate from as4630_54pe.fanutil import FanUtil from as4630_54pe.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py index 11453818b04c..c775e86874b8 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_fan.py @@ -22,19 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate - except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py index 8ef700f33ca0..02f4541127a7 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_monitor_psu.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py index fbfa46377fa2..ed0df177ee13 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as4630-54pe/utils/accton_as4630_54pe_util.py @@ -29,13 +29,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as4630_54pe' version = '0.0.1' @@ -54,7 +53,6 @@ 'fan3': ['fan'], 'fan4': ['fan'], 'fan5': ['fan'], - 'fan5': ['fan'], } hwmon_nodes = {'led': ['brightness'] , 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py index 09b2b9ea96bd..f032088dc525 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_monitor.py @@ -23,18 +23,11 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as5712_54x.fanutil import FanUtil from as5712_54x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py index 944fb98ada54..71927f933b92 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5712-54x/utils/accton_as5712_util.py @@ -31,11 +31,11 @@ import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as5712_54x' version = '0.2.0' @@ -546,7 +546,7 @@ def cpld_path_of_port(port_index): def get_path_sfp_tx_dis(port_index): cpld_p = cpld_path_of_port(port_index) - if cpld_p == None: + if cpld_p is None: return False, '' else: dev = cpld_p+"module_tx_disable_"+str(port_index) @@ -554,7 +554,7 @@ def get_path_sfp_tx_dis(port_index): def get_path_sfp_presence(port_index): cpld_p = cpld_path_of_port(port_index) - if cpld_p == None: + if cpld_p is None: return False, '' else: dev = cpld_p+"module_present_"+str(port_index) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py index c8574557b3d1..6f55e703d7d1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_monitor.py @@ -23,19 +23,13 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as5812_54t.fanutil import FanUtil from as5812_54t.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py index cad526e17af5..e5ec4fa856d2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54t/utils/accton_as5812_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py index 8c7303efaa78..5e3b368659cc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_monitor.py @@ -23,19 +23,13 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as5812_54x.fanutil import FanUtil from as5812_54x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py index ba526d110a7b..35ae80f5385d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5812-54x/utils/accton_as5812_util.py @@ -31,11 +31,11 @@ import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as5812_54x' version = '0.2.0' @@ -546,7 +546,7 @@ def cpld_path_of_port(port_index): def get_path_sfp_tx_dis(port_index): cpld_p = cpld_path_of_port(port_index) - if cpld_p == None: + if cpld_p is None: return False, '' else: dev = cpld_p+"module_tx_disable_"+str(port_index) @@ -554,7 +554,7 @@ def get_path_sfp_tx_dis(port_index): def get_path_sfp_presence(port_index): cpld_p = cpld_path_of_port(port_index) - if cpld_p == None: + if cpld_p is None: return False, '' else: dev = cpld_p+"module_present_"+str(port_index) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py index ce2e0d18d4ff..ceea8e12f852 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor.py @@ -25,18 +25,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as5835_54t.fanutil import FanUtil from as5835_54t.thermalutil import ThermalUtil except ImportError as e: @@ -203,4 +197,4 @@ def main(argv): time.sleep(10) if __name__ == '__main__': - main(sys.argv[1:]) \ No newline at end of file + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py index d1d93d4f8aea..7978012b0da0 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_fan.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py index 51837c7262ba..9be72fda9993 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_monitor_psu.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py index 88d5bc254628..84625fd6dbf9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54t/utils/accton_as5835_54t_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py index 5789288546b6..9c5e955ce17d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor.py @@ -24,18 +24,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as5835_54x.fanutil import FanUtil from as5835_54x.thermalutil import ThermalUtil except ImportError as e: @@ -202,4 +196,4 @@ def main(argv): time.sleep(10) if __name__ == '__main__': - main(sys.argv[1:]) \ No newline at end of file + main(sys.argv[1:]) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py index 791c80a92b89..dec1e036142d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_fan.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py index d7bd1a1f2515..f994d635239a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_monitor_psu.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py index 615bf6ea208f..ee722ea03040 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as5835-54x/utils/accton_as5835_54x_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py index fbcc74565d62..07e40f6b7fb4 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_monitor.py @@ -24,17 +24,11 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate from as6712_32x.fanutil import FanUtil from as6712_32x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py index 48e957e31257..20968d57a91f 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as6712-32x/utils/accton_as6712_util.py @@ -37,13 +37,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as6712_32x' version = '0.2.0' diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py index 19d7470515f9..8e115c3ad88b 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_monitor.py @@ -24,18 +24,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as7312_54x.fanutil import FanUtil from as7312_54x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py index b8107c47afea..f5438f28f6fc 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54x/utils/accton_as7312_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py index 09bc99c75aba..58ffe1923a85 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_monitor.py @@ -24,18 +24,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as7312_54xs.fanutil import FanUtil from as7312_54xs.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py index 9b5803b07afd..4b2ebbe1cca2 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7312-54xs/utils/accton_as7312_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py index 5d821350ac81..d5b868255f4a 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_monitor.py @@ -24,18 +24,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as7315_27xb.fanutil import FanUtil from as7315_27xb.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py index ea856e4ff56b..869a7784f0d9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7315-27xb/utils/accton_as7315_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py index b775d97edda9..07ec446ab88e 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor.py @@ -24,17 +24,12 @@ try: import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate from as7326_56x.fanutil import FanUtil from as7326_56x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py index 6fa429d01314..b52ada307698 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_fan.py @@ -22,19 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate - except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py index d76c20bd5a9b..cb897b942aeb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_monitor_psu.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py index 0e08f0b62aed..cc04c1de38a9 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7326-56x/utils/accton_as7326_util.py @@ -39,13 +39,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py index c8b755b85b69..9741c506b2d1 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7712-32x/utils/accton_as7712_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py index 63f26d5d2ef6..c423cc441d92 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_monitor.py @@ -23,17 +23,11 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate from as7716_32x.fanutil import FanUtil from as7716_32x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py index b195165337d1..7be4a00b0478 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32x/utils/accton_as7716_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as7716_32x' version = '0.0.1' @@ -55,7 +54,6 @@ 'fan3': ['fan'], 'fan4': ['fan'], 'fan5': ['fan'], - 'fan5': ['fan'], } hwmon_nodes = {'led': ['brightness'] , 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py index c08a82c7dc45..ed5af4818de3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_drv_handler.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import commands - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py index 2568312b0955..86b4f1852066 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_monitor.py @@ -23,17 +23,11 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate from as7716_32x.fanutil import FanUtil from as7716_32x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py index ffddfb338506..0f1f0d66fddb 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7716-32xb/utils/accton_as7716_32xb_util.py @@ -30,13 +30,11 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re -import time -from collections import namedtuple PROJECT_NAME = 'as7716_32xb' version = '0.0.1' @@ -55,7 +53,6 @@ 'fan3': ['fan'], 'fan4': ['fan'], 'fan5': ['fan'], - 'fan5': ['fan'], } hwmon_nodes = {'led': ['brightness'] , 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py index 631a7915383b..aada6ba5c507 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor.py @@ -24,17 +24,12 @@ try: import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate from as7726_32x.fanutil import FanUtil from as7726_32x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py index de737b99f1f3..a2139341150c 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_fan.py @@ -22,19 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate - except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py index 618c58eec872..d139e3f3f1c8 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_monitor_psu.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py index acb0319f5f25..590add7e925f 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7726-32x/utils/accton_as7726_32x_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as7726_32x' version = '0.0.1' @@ -55,7 +54,6 @@ 'fan3': ['fan'], 'fan4': ['fan'], 'fan5': ['fan'], - 'fan5': ['fan'], } hwmon_nodes = {'led': ['brightness'] , 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py index 3d9f6fc3ce5e..a8dcba0f77db 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_monitor.py @@ -24,18 +24,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config - import types import time # this is only being used as part of the example - import traceback import signal - from tabulate import tabulate from as7816_64x.fanutil import FanUtil from as7816_64x.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py index ab5e52cb85bd..0dad870c9718 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as7816-64x/utils/accton_as7816_util.py @@ -30,14 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple - diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py index 3752161d3ebc..49a99aa777a3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor.py @@ -20,19 +20,13 @@ # ------------------------------------------------------------------ try: - import os import commands - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate from as9716_32d.fanutil import FanUtil from as9716_32d.thermalutil import ThermalUtil except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py index 320655361b83..b22dd5d7984d 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_fan.py @@ -22,19 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate - except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py index a8df99430c81..a3c8a0be65b3 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_monitor_psu.py @@ -22,18 +22,12 @@ # ------------------------------------------------------------------ try: - import os - import sys, getopt - import subprocess - import click - import imp + import getopt + import sys import logging import logging.config import logging.handlers - import types import time # this is only being used as part of the example - import traceback - from tabulate import tabulate except ImportError as e: raise ImportError('%s - required module not found' % str(e)) diff --git a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py index 2eac0e5e704d..61d19d0ac7fd 100755 --- a/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/as9716-32d/utils/accton_as9716_32d_util.py @@ -30,13 +30,12 @@ set : change board setting with fan|led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'as9716_32d' version = '0.0.1' @@ -55,7 +54,6 @@ 'fan3': ['fan'], 'fan4': ['fan'], 'fan5': ['fan'], - 'fan5': ['fan'], } hwmon_nodes = {'led': ['brightness'] , 'fan1': ['fan_duty_cycle_percentage', 'fan1_fault', 'fan1_speed_rpm', 'fan1_direction', 'fanr1_fault', 'fanr1_speed_rpm'], diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py index 261074c5d99a..cf8e91faf549 100755 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/accton_minipack_util.py @@ -37,13 +37,12 @@ set : change board setting with led|sfp """ -import os import commands -import sys, getopt +import getopt +import sys import logging import re import time -from collections import namedtuple PROJECT_NAME = 'minipack' version = '0.2.0' diff --git a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py index 84388520b902..257bc1cd90e6 100755 --- a/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py +++ b/platform/broadcom/sonic-platform-modules-accton/minipack/utils/setup_qsfp_eeprom.py @@ -22,8 +22,8 @@ try: import os - import sys, getopt - import subprocess + import getopt + import sys import subprocess import click import imp diff --git a/platform/nephos/sonic-platform-modules-cig/cs5435-54p/utils/cig_cs5435_misc.py b/platform/nephos/sonic-platform-modules-cig/cs5435-54p/utils/cig_cs5435_misc.py index 0a78085fd49b..0a1a887642d6 100755 --- a/platform/nephos/sonic-platform-modules-cig/cs5435-54p/utils/cig_cs5435_misc.py +++ b/platform/nephos/sonic-platform-modules-cig/cs5435-54p/utils/cig_cs5435_misc.py @@ -335,7 +335,7 @@ def system_get_lswtemp(): return 25 # chp = subprocess.Popen("docker ps --filter name=syncd", shell=True, stdout=subprocess.PIPE) -# if chp.poll() == None: +# if chp.poll() is None: # misclogger.info("No subp.") # chp.kill() # diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-54p/utils/cig_cs6436_misc.py b/platform/nephos/sonic-platform-modules-cig/cs6436-54p/utils/cig_cs6436_misc.py index c186676cbf3f..b4627a081d78 100755 --- a/platform/nephos/sonic-platform-modules-cig/cs6436-54p/utils/cig_cs6436_misc.py +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-54p/utils/cig_cs6436_misc.py @@ -335,7 +335,7 @@ def system_get_lswtemp(): return 25 # chp = subprocess.Popen("docker ps --filter name=syncd", shell=True, stdout=subprocess.PIPE) -# if chp.poll() == None: +# if chp.poll() is None: # misclogger.info("No subp.") # chp.kill() # diff --git a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py index 3b685236a075..56add80221bb 100755 --- a/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py +++ b/platform/nephos/sonic-platform-modules-cig/cs6436-56p/utils/cig_cs6436_misc.py @@ -335,7 +335,7 @@ def system_get_lswtemp(): return 25 # chp = subprocess.Popen("docker ps --filter name=syncd", shell=True, stdout=subprocess.PIPE) -# if chp.poll() == None: +# if chp.poll() is None: # misclogger.info("No subp.") # chp.kill() # diff --git a/src/sonic-config-engine/config_samples.py b/src/sonic-config-engine/config_samples.py index 99341642961f..be8ab3e0a955 100644 --- a/src/sonic-config-engine/config_samples.py +++ b/src/sonic-config-engine/config_samples.py @@ -1,5 +1,3 @@ -import os -import sys from natsort import natsorted def generate_t1_sample_config(data): diff --git a/src/sonic-config-engine/minigraph.py b/src/sonic-config-engine/minigraph.py index b18261a8fc9a..7aa51304d2ea 100644 --- a/src/sonic-config-engine/minigraph.py +++ b/src/sonic-config-engine/minigraph.py @@ -1,15 +1,10 @@ from __future__ import print_function -import calendar -from ipaddress import IPv4Address, IPv4Network, ip_address, ip_network +import ipaddress import math import os import sys -import socket -import struct import json -import copy -import ipaddress from collections import defaultdict from lxml import etree as ET @@ -809,7 +804,7 @@ def parse_spine_chassis_fe(results, vni, lo_intfs, phyport_intfs, pc_intfs, pc_m intf_name = pc_member[1] break - if intf_name == None: + if intf_name is None: print('Warning: cannot find any interfaces that belong to %s' % (pc_intf), file=sys.stderr) continue @@ -1314,8 +1309,8 @@ def get_tunnel_entries(tunnel_intfs, lo_intfs, hostname): lo_addr = '' # Use the first IPv4 loopback as the tunnel destination IP for addr in lo_intfs.keys(): - ip_addr = ip_network(UNICODE_TYPE(addr[1])) - if isinstance(ip_addr, IPv4Network): + ip_addr = ipaddress.ip_network(UNICODE_TYPE(addr[1])) + if isinstance(ip_addr, ipaddress.IPv4Network): lo_addr = str(ip_addr.network_address) break diff --git a/src/sonic-config-engine/portconfig.py b/src/sonic-config-engine/portconfig.py index 1a49e4fd1cd4..d20212eb55aa 100644 --- a/src/sonic-config-engine/portconfig.py +++ b/src/sonic-config-engine/portconfig.py @@ -1,10 +1,10 @@ try: - import os - import sys - import json import ast + import json + import os import re - from collections import OrderedDict + import sys + from swsssdk import ConfigDBConnector from sonic_py_common import device_info except ImportError as e: