From a20602a489c4ede9d317f942bc137cf6fc39c163 Mon Sep 17 00:00:00 2001 From: nicwu Date: Fri, 18 Feb 2022 05:37:17 +0000 Subject: [PATCH] [Author]:jersyang@celestica.com [JIRA ID]:NA [Description]:1. change the baud rate to 9600 2. optimize the alert in Azure community --- device/celestica/x86_64-cel_belgite-r0/installer.conf | 2 +- .../belgite/modules/pddf_custom_wdt.c | 2 +- .../belgite/pddf/sonic_platform/__init__.py | 3 ++- .../belgite/pddf/sonic_platform/chassis.py | 2 +- .../belgite/pddf/sonic_platform/eeprom.py | 5 +++-- .../belgite/pddf/sonic_platform/fan_drawer.py | 2 +- .../belgite/pddf/sonic_platform/watchdog.py | 4 ---- .../belgite/pddf/sonic_platform_setup.py | 1 - .../belgite/utils/belgite_pddf_monitor.py | 9 +++++---- 9 files changed, 14 insertions(+), 16 deletions(-) diff --git a/device/celestica/x86_64-cel_belgite-r0/installer.conf b/device/celestica/x86_64-cel_belgite-r0/installer.conf index 9ec2292df5ef..332ea6217a1e 100644 --- a/device/celestica/x86_64-cel_belgite-r0/installer.conf +++ b/device/celestica/x86_64-cel_belgite-r0/installer.conf @@ -1,4 +1,4 @@ CONSOLE_PORT=0x3f8 CONSOLE_DEV=0 -CONSOLE_SPEED=115200 +CONSOLE_SPEED=9600 ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="module_blacklist=gpio_ich crashkernel=0M-2G:256M,2G-4G:320M,4G-8G:384M,8G-:448M acpi_no_watchdog" diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c b/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c index a60f92031a0c..93998b718539 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/modules/pddf_custom_wdt.c @@ -308,7 +308,7 @@ static ssize_t reason_show(struct device *dev, bootstatus = watchdog_get_reason(wdt); - return sprintf(buf, "0x%02\n", bootstatus); + return sprintf(buf, "0x%02x\n", bootstatus); } static DEVICE_ATTR_RO(reason); diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/__init__.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/__init__.py index 2dc71f83c00d..0533d11584e1 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/__init__.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/__init__.py @@ -1,3 +1,4 @@ # All the derived classes for PDDF __all__ = ["platform", "chassis", "sfp", "psu", "thermal"] -from sonic_platform import * +from sonic_platform import * #[py/polluting-import] + diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py index d8a7fb91f517..6d36345fbe8b 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/chassis.py @@ -25,7 +25,7 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): with open(FAN_DIRECTION_FILE_PATH, "w+") as f: f.write(vendor_ext) for i in range(self.platform_inventory['num_fantrays']): - fandrawer = FanDrawer(i, self.pddf_obj, self.plugin_data) + fandrawer = FanDrawer(i, self.pddf_obj, self.plugin_data) #lgtm [py/call/wrong-number-class-arguments] self._fan_drawer_list.append(fandrawer) self._fan_list.extend(fandrawer._fan_list) diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/eeprom.py index 8309e759fca6..b79af685ff22 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/eeprom.py @@ -23,7 +23,8 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): if self.eeprom_path is None: return - super(PddfEeprom, self).__init__(self.eeprom_path, 0, '', True) + #super(PddfEeprom, self).__init__(self.eeprom_path, 0, '', True) + super().__init__(self.eeprom_path, 0, '', True) self.eeprom_tlv_dict = dict() try: self.eeprom_data = self.read_eeprom() @@ -49,7 +50,7 @@ def __init__(self, pddf_data=None, pddf_plugin_data=None): code = "0x%02X" % ((tlv[0])) if (tlv[0]) == self._TLV_CODE_VENDOR_EXT: - name = "Vendor Extension" + name = "Vendor Extension" #lgtm [py/multiple-definition] value = "" if self._TLV_DISPLAY_VENDOR_EXT: for c in tlv[2:2 + tlv[1]]: diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan_drawer.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan_drawer.py index de08675c067f..7e3fd75bbe19 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan_drawer.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/fan_drawer.py @@ -34,7 +34,7 @@ def __init__(self, tray_idx, pddf_data=None, pddf_plugin_data=None): self.fantray_index = tray_idx+1 for j in range(self.platform['num_fans_pertray']): # Fan index is 0-based for the init call - self._fan_list.append(Fan(tray_idx, j, self.pddf_obj, self.plugin_data)) + self._fan_list.append(Fan(tray_idx, j, self.pddf_obj, self.plugin_data)) #lgtm [py/call/wrong-number-class-arguments] def get_name(self): """ diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/watchdog.py index 7aa635cbe790..789c04addf1e 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform/watchdog.py @@ -5,13 +5,9 @@ # Watchdog contains an implementation of SONiC Platform Base Watchdog API # ############################################################################# -import ctypes import fcntl import os -import subprocess -import time import array -import syslog try: from sonic_platform_base.watchdog_base import WatchdogBase diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform_setup.py b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform_setup.py index a1535165bb66..159e26656138 100644 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform_setup.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/pddf/sonic_platform_setup.py @@ -1,5 +1,4 @@ import os -import sys from setuptools import setup os.listdir diff --git a/platform/broadcom/sonic-platform-modules-cel/belgite/utils/belgite_pddf_monitor.py b/platform/broadcom/sonic-platform-modules-cel/belgite/utils/belgite_pddf_monitor.py index b676c856592b..017a04709f3c 100755 --- a/platform/broadcom/sonic-platform-modules-cel/belgite/utils/belgite_pddf_monitor.py +++ b/platform/broadcom/sonic-platform-modules-cel/belgite/utils/belgite_pddf_monitor.py @@ -28,6 +28,7 @@ import logging.config import time # this is only being used as part of the example import signal + import math from sonic_platform import platform except ImportError as e: raise ImportError('%s - required module not found' % str(e)) @@ -121,21 +122,21 @@ def get_fan_speed_by_temperature(self, temp_list): # U4 U7 if not update_temp_sensor: # temperature down - b = 1400/13 + b = math.trunc(1400/13) if sensor_temp <= 32000: sensor_temp_speed = 40 elif sensor_temp >= 45000: sensor_temp_speed = 100 else: - sensor_temp_speed = int((60 / 13) * int(sensor_temp / 1000) - b) + sensor_temp_speed = int(math.trunc(60 / 13) * math.trunc(sensor_temp / 1000) - b) else: # temperature up - b = 1580 / 13 + b = math.trunc(1580 / 13) if sensor_temp <= 35000: sensor_temp_speed = 40 elif sensor_temp >= 48000: sensor_temp_speed = 100 else: - sensor_temp_speed = int((60/13) * int(sensor_temp/1000) - b) + sensor_temp_speed = int(math.trunc(60/13) * math.trunc(sensor_temp/1000) - b) # CPU if not update_temp_cpu: # temperature down