From 74b154bc0e835302a4fc5c10d3af0397a75ab4a3 Mon Sep 17 00:00:00 2001 From: y7zhou Date: Thu, 15 May 2025 15:30:06 -0400 Subject: [PATCH] [x3b] Update Fan, thermal, LED -- Add additional thermal sensors -- Add suport for mgmt port LED --- .../Nokia-IXR7250-X3B/profile.ini | 1 - .../x86_64-nokia_ixr7250_x3b-r0/platform.json | 126 +++++++- .../platform.json.bak | 285 ------------------ .../platform_components.json | 11 - .../plugins/led_control.py | 83 ++++- .../pmon_daemon_control.json | 3 - .../thermal_policy.json | 6 +- 7 files changed, 199 insertions(+), 316 deletions(-) delete mode 100644 device/nokia/x86_64-nokia_ixr7250_x3b-r0/Nokia-IXR7250-X3B/profile.ini delete mode 100644 device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json.bak delete mode 100755 device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform_components.json delete mode 100644 device/nokia/x86_64-nokia_ixr7250_x3b-r0/pmon_daemon_control.json diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/Nokia-IXR7250-X3B/profile.ini b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/Nokia-IXR7250-X3B/profile.ini deleted file mode 100644 index 4eda67c91a6..00000000000 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/Nokia-IXR7250-X3B/profile.ini +++ /dev/null @@ -1 +0,0 @@ -switchMacAddress=XX:XX:XX:XX:XX:XX diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json index 7d0353ed32a..4bf62632f72 100644 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json +++ b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json @@ -15,72 +15,120 @@ "fans": [ { "name": "Fan1", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan2", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan3", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan4", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan5", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan6", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan7", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan8", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan9", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan10", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan11", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } }, { "name": "Fan12", + "speed": { + "controllable": true, + "minimum": 38 + }, "status_led": { "controllable": false } @@ -220,7 +268,7 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false }, { "name": "MB Left", @@ -228,7 +276,7 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false }, { "name": "MB Right", @@ -236,7 +284,7 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false }, { "name": "MB Center", @@ -244,7 +292,71 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false + }, + { + "name": "MB CPU", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "DDR1", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "DDR2", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "Max Port Temp.", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "ASIC0_DRAM0", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "ASIC0_DRAM1", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "ASIC1_DRAM0", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false + }, + { + "name": "ASIC1_DRAM1", + "controllable": false, + "low-threshold": false, + "high-threshold": true, + "low-crit-threshold": false, + "high-crit-threshold": false }, { "name": "ASIC0", @@ -252,7 +364,7 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false }, { "name": "ASIC1", @@ -260,7 +372,7 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false }, { "name": "CPU", @@ -268,7 +380,7 @@ "low-threshold": false, "high-threshold": true, "low-crit-threshold": false, - "high-crit-threshold": true + "high-crit-threshold": false } ], "sfps": [ diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json.bak b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json.bak deleted file mode 100644 index d4622faa188..00000000000 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform.json.bak +++ /dev/null @@ -1,285 +0,0 @@ -{ - "chassis": { - "name": "7250 IXR-X3B", - "components": [ - { - "name": "BIOS" - }, - { - "name": "CPUCTL" - }, - { - "name": "IOCTL" - } - ], - "watchdog": { - "disarm": false - }, - "get_module_attributes": { - "model": false, - "serial": false, - "base_mac": false, - "system_eeprom_info": false, - "reboot_other_modules": false - }, - "thermal_temperature": { - "minimum": 0, - "maximum": 110 - }, - "fans": [], - "fan_drawers": [], - "master_psu_led_color": [], - "psus": [], - "thermals": [ - { - "name": "ASIC0_0--FAB0", - "controllable": false - }, - { - "name": "ASIC0_1--FAB1", - "controllable": false - }, - { - "name": "ASIC0_2--FAB2", - "controllable": false - }, - { - "name": "ASIC0_3--FAB3", - "controllable": false - }, - { - "name": "ASIC0_4--NIF0", - "controllable": false - }, - { - "name": "ASIC0_5--NIF1", - "controllable": false - }, - { - "name": "ASIC0_6--PRM", - "controllable": false - }, - { - "name": "ASIC0_7--EMI0", - "controllable": false - }, - { - "name": "ASIC0_8--EMI1", - "controllable": false - }, - { - "name": "ASIC0_9--DRAM0", - "controllable": false - }, - { - "name": "ASIC0_10--DRAM1", - "controllable": false - }, - { - "name": "ASIC1_0--FAB0", - "controllable": false - }, - { - "name": "ASIC1_1--FAB1", - "controllable": false - }, - { - "name": "ASIC1_2--FAB2", - "controllable": false - }, - { - "name": "ASIC1_3--FAB3", - "controllable": false - }, - { - "name": "ASIC1_4--NIF0", - "controllable": false - }, - { - "name": "ASIC1_5--NIF1", - "controllable": false - }, - { - "name": "ASIC1_6--PRM", - "controllable": false - }, - { - "name": "ASIC1_7--EMI0", - "controllable": false - }, - { - "name": "ASIC1_8--EMI1", - "controllable": false - }, - { - "name": "ASIC1_9--DRAM0", - "controllable": false - }, - { - "name": "ASIC1_10--DRAM1", - "controllable": false - }, - { - "name": "temp_1(fan)", - "controllable": false - }, - { - "name": "temp_2(fan)", - "controllable": false - }, - { - "name": "temp_3(fan)", - "controllable": false - }, - { - "name": "temp_4(fan)", - "controllable": false - }, - { - "name": "temp_5", - "controllable": false - }, - { - "name": "temp_6", - "controllable": false - }, - { - "name": "temp_7(fan)", - "controllable": false - }, - { - "name": "temp_8(fan)", - "controllable": false - }, - { - "name": "temp_9(fan)", - "controllable": false - }, - { - "name": "temp_10(fan)", - "controllable": false - }, - { - "name": "temp_11(fan)", - "controllable": false - } - ], - "sfps": [ - { - "name": "QSFPDD_1" - }, - { - "name": "QSFPDD_2" - }, - { - "name": "QSFPDD_3" - }, - { - "name": "QSFPDD_4" - }, - { - "name": "QSFPDD_5" - }, - { - "name": "QSFPDD_6" - }, - { - "name": "QSFPDD_7" - }, - { - "name": "QSFPDD_8" - }, - { - "name": "QSFPDD_9" - }, - { - "name": "QSFPDD_10" - }, - { - "name": "QSFPDD_11" - }, - { - "name": "QSFPDD_12" - }, - { - "name": "QSFPDD_13" - }, - { - "name": "QSFPDD_14" - }, - { - "name": "QSFPDD_15" - }, - { - "name": "QSFPDD_16" - }, - { - "name": "QSFPDD_17" - }, - { - "name": "QSFPDD_18" - }, - { - "name": "QSFPDD_19" - }, - { - "name": "QSFPDD_20" - }, - { - "name": "QSFPDD_21" - }, - { - "name": "QSFPDD_22" - }, - { - "name": "QSFPDD_23" - }, - { - "name": "QSFPDD_24" - }, - { - "name": "QSFPDD_25" - }, - { - "name": "QSFPDD_26" - }, - { - "name": "QSFPDD_27" - }, - { - "name": "QSFPDD_28" - }, - { - "name": "QSFPDD_29" - }, - { - "name": "QSFPDD_30" - }, - { - "name": "QSFPDD_31" - }, - { - "name": "QSFPDD_32" - }, - { - "name": "QSFPDD_33" - }, - { - "name": "QSFPDD_34" - }, - { - "name": "QSFPDD_35" - }, - { - "name": "QSFPDD_36" - } - ] - }, - "interfaces": { - - }, - "asic_sensors": { - "poll_interval": "10", - "poll_admin_status": "enable" - } -} diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform_components.json b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform_components.json deleted file mode 100755 index 727475691f9..00000000000 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/platform_components.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "chassis": { - "Nokia-IXR7250-X3B": { - "component": { - "FPGA2": {}, - "FPGA1": {}, - "BIOS": {} - } - } - } -} diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/plugins/led_control.py b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/plugins/led_control.py index 9c790f85091..1fe8ab98f52 100644 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/plugins/led_control.py +++ b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/plugins/led_control.py @@ -23,6 +23,12 @@ QSFP_NUMS = 36 REG_DIR = "/sys/bus/pci/devices/0000:01:00.0/" PORT_DIR = "/sys/bus/pci/devices/0000:05:00.0/" +FILE_OPERSTATE = "/sys/class/net/eth0/operstate" +FILE_DUPLEX = "/sys/class/net/eth0/duplex" +FILE_RX_PACKETS = "/sys/class/net/eth0/statistics/rx_packets" +FILE_TX_PACKETS = "/sys/class/net/eth0/statistics/tx_packets" +FILE_RX_ERRORS = "/sys/class/net/eth0/statistics/rx_errors" +FILE_TX_ERRORS = "/sys/class/net/eth0/statistics/tx_errors" SYSLOG_IDENTIFIER = "nokia-ledd" sonic_logger = logger.Logger(SYSLOG_IDENTIFIER) @@ -34,7 +40,7 @@ class LedControl(LedControlBase): # Constructor def __init__(self): self.chassis = sonic_platform.platform.Platform().get_chassis() - self._initDefaultConfig() + self._initDefaultConfig() def _initDefaultConfig(self): # The fan tray leds and system led managed by new chassis class API @@ -43,7 +49,8 @@ def _initDefaultConfig(self): if multi_asic.is_multi_asic(): # Load the namespace details first from the database_global.json file. - swsscommon.SonicDBConfig.initializeGlobalConfig() + if not swsscommon.SonicDBConfig.isGlobalInit(): + swsscommon.SonicDBConfig.initializeGlobalConfig() # Get the namespaces in the platform. For multi-asic devices we get the namespaces # of front-end ascis which have front-panel interfaces. @@ -64,6 +71,24 @@ def _initDefaultConfig(self): self._initSystemLed() + def _read_sysfs_file(self, sysfs_file): + # On successful read, returns the value read from given + # reg_name and on failure returns 'ERR' + rv = 'ERR' + + if (not os.path.isfile(sysfs_file)): + return rv + try: + with open(sysfs_file, 'r') as fd: + rv = fd.read() + fd.close() + except Exception as e: + rv = 'ERR' + + rv = rv.rstrip('\r\n') + rv = rv.lstrip(" ") + return rv + def _write_sysfs_file(self, sysfs_file, value): # On successful write, the value read will be written on # reg_name and on failure returns 'ERR' @@ -84,15 +109,18 @@ def _initSystemLed(self): self.oldfan = 'off' self.oldpsu = 'off' count = 0 + self.mgmt_link = 'off' + self.mgmt_actv = 'off' + self.mgmt_rx_packets = int(self._read_sysfs_file(FILE_RX_PACKETS)) + self.mgmt_tx_packets = int(self._read_sysfs_file(FILE_TX_PACKETS)) # Timer loop to monitor and set Port Leds and # front panel Status, Fan, and PSU LEDs while True: self.port_state_check() - - time.sleep(0.1) + self.mgmt_check() count = count + 1 - if count == 60: + if count == 30: self.fp_check() count = 0 @@ -186,3 +214,48 @@ def fp_check(self): if self.oldpsu != 'amber': self._write_sysfs_file(REG_DIR + 'led_psu', '0xa4c700') self.oldpsu = 'amber' + + def mgmt_check(self): + link_stat = self._read_sysfs_file(FILE_OPERSTATE) + if link_stat == 'up': + duplex = self._read_sysfs_file(FILE_DUPLEX) + if duplex == 'full': + if self.mgmt_link != 'green': + self._write_sysfs_file(REG_DIR + 'led_mgmt_link', '0x1') + self.mgmt_link = 'green' + elif duplex == 'half': + if self.mgmt_link != 'blink_green': + self._write_sysfs_file(REG_DIR + 'led_mgmt_link', '0x0') + self._write_sysfs_file(REG_DIR + 'led_mgmt_link', '0xf5') + self.mgmt_link = 'blink_green' + else: + if self.mgmt_link != 'off': + self._write_sysfs_file(REG_DIR + 'led_mgmt_link', '0x0') + self.mgmt_link = 'off' + + mgmt_rx_packets = int(self._read_sysfs_file(FILE_RX_PACKETS)) + mgmt_tx_packets = int(self._read_sysfs_file(FILE_TX_PACKETS)) + mgmt_rx_errors = int(self._read_sysfs_file(FILE_RX_ERRORS)) + mgmt_tx_errors = int(self._read_sysfs_file(FILE_TX_ERRORS)) + if mgmt_rx_errors > 0 or mgmt_tx_errors > 0: + if self.mgmt_actv != 'amber': + self._write_sysfs_file(REG_DIR + 'led_mgmt_actv', '0x2') + self.mgmt_actv = 'amber' + elif mgmt_rx_packets > self.mgmt_rx_packets or mgmt_tx_packets > self.mgmt_tx_packets: + self.mgmt_rx_packets = mgmt_rx_packets + self.mgmt_tx_packets = mgmt_tx_packets + if self.mgmt_actv != 'fast_blink_green': + self._write_sysfs_file(REG_DIR + 'led_mgmt_actv', '0x0') + self._write_sysfs_file(REG_DIR + 'led_mgmt_actv', '0x75') + self.mgmt_actv = 'fast_blink_green' + else: + if self.mgmt_actv != 'off': + self._write_sysfs_file(REG_DIR + 'led_mgmt_actv', '0x0') + self.mgmt_actv = 'off' + else: + if self.mgmt_link != 'off': + self._write_sysfs_file(REG_DIR + 'led_mgmt_link', '0x0') + self.mgmt_link = 'off' + if self.mgmt_actv != 'off': + self._write_sysfs_file(REG_DIR + 'led_mgmt_actv', '0x0') + self.mgmt_actv = 'off' diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/pmon_daemon_control.json b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/pmon_daemon_control.json deleted file mode 100644 index 94592fa8ceb..00000000000 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/pmon_daemon_control.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "skip_ledd": true -} diff --git a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/thermal_policy.json b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/thermal_policy.json index 5427406e643..0800ff75f70 100644 --- a/device/nokia/x86_64-nokia_ixr7250_x3b-r0/thermal_policy.json +++ b/device/nokia/x86_64-nokia_ixr7250_x3b-r0/thermal_policy.json @@ -43,10 +43,8 @@ "actions": [ { "type": "thermal.temp_check_and_set_all_fan_speed", - "default_speed": "45", - "threshold1_speed": "60", - "threshold2_speed": "70", - "hightemp_speed": "90" + "default_speed": "60", + "hightemp_speed": "100" } ] },