From 34493c9e22d34c0bd89e4504e575827daa75d721 Mon Sep 17 00:00:00 2001 From: Pavan Prakash <120486223+Pavan-Nokia@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:57:48 -0500 Subject: [PATCH] [Nokia-7215-A1] Update platform to add DC support (#20592) 1) Add support for DC PSU 2) Enhance watchdog service --- .../7215-a1/service/cpu_wdt.service | 1 + .../7215-a1/sonic_platform/chassis.py | 2 +- .../7215-a1/sonic_platform/eeprom.py | 4 ++-- .../7215-a1/sonic_platform/fan.py | 2 +- .../7215-a1/sonic_platform/psu.py | 22 ++++++++++++++++--- .../sonic-platform-nokia-7215-a1.postinst | 1 + 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/platform/marvell/sonic-platform-nokia/7215-a1/service/cpu_wdt.service b/platform/marvell/sonic-platform-nokia/7215-a1/service/cpu_wdt.service index 761deec569cc..993070a14a2a 100644 --- a/platform/marvell/sonic-platform-nokia/7215-a1/service/cpu_wdt.service +++ b/platform/marvell/sonic-platform-nokia/7215-a1/service/cpu_wdt.service @@ -1,5 +1,6 @@ [Unit] Description=CPU WDT +Conflicts=watchdog-control.service After=nokia-7215init.service [Service] ExecStart=/usr/local/bin/cpu_wdt.py diff --git a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/chassis.py b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/chassis.py index 41d600147bd9..6fdec26ec5bc 100644 --- a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/chassis.py +++ b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/chassis.py @@ -98,7 +98,7 @@ def __init__(self): self._fan_list.append(fan) for i in range(MAX_7215_PSU): - psu = Psu(i) + psu = Psu(i, self.get_model()) self._psu_list.append(psu) for i in range(MAX_7215_THERMAL): diff --git a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/eeprom.py b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/eeprom.py index b9f770abf906..914c08cfc0cd 100644 --- a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/eeprom.py +++ b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/eeprom.py @@ -40,13 +40,13 @@ def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0): if self.is_psu_eeprom: self.index = psu_index self.part_number = '1' - self.model_str = 'PJT-12V100WBBA' + self.model_str = 'NA' self.serial_number = 'NA' if self.is_fan_eeprom: self.index = fan_index self.part_number = '1' - self.model_str = 'FFB0412UHN-BC2EA12' + self.model_str = 'NA' self.serial_number = 'NA' diff --git a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/fan.py b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/fan.py index a8891a51f0f0..32a9bb21d9aa 100644 --- a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/fan.py +++ b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/fan.py @@ -181,7 +181,7 @@ def get_direction(self): """ ch_model=self.get_chassis_model() #compare first 8 characters of chassis molel string - if(ch_model[:8]=='3HE18723'): + if(ch_model[:8]=='3HE18723' or ch_model[:8]=='3HE20994' ): direction = 'intake' else: direction = 'exhaust' diff --git a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/psu.py b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/psu.py index 8249954932ff..356e01500f69 100644 --- a/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/psu.py +++ b/platform/marvell/sonic-platform-nokia/7215-a1/sonic_platform/psu.py @@ -25,12 +25,12 @@ class Psu(PsuBase): """Nokia platform-specific PSU class for 7215 """ - def __init__(self, psu_index): + def __init__(self, psu_index, chassis_model): PsuBase.__init__(self) # PSU is 1-based in Nokia platforms self.index = psu_index + 1 self._fan_list = [] - + self.chassis_model = chassis_model # PSU eeprom self.eeprom = Eeprom(is_psu=True, psu_index=self.index) @@ -90,7 +90,16 @@ def _get_active_psus(self): active_psus = int(psu1_good) + int(psu2_good) return active_psus + + def get_chassis_model(self): + """ + Retrieves the model number of the Fan + Returns: + string: Model number of Fan. Use part number for this. + """ + return self.chassis_model + def get_name(self): """ Retrieves the name of the device @@ -118,7 +127,14 @@ def get_model(self): Returns: string: Part number of PSU """ - return self.eeprom.modelstr() + ch_model=self.get_chassis_model() + #compare first 8 characters of chassis molel string + if(ch_model[:8]=='3HE18723' or ch_model[:8]=='3HE18724' ): + model = 'AC-PSU' + else: + model = 'DC-PSU' + + return model def get_serial(self): """ diff --git a/platform/marvell/sonic-platform-nokia/debian/sonic-platform-nokia-7215-a1.postinst b/platform/marvell/sonic-platform-nokia/debian/sonic-platform-nokia-7215-a1.postinst index 949cd1a289ef..e5a3c2e1697c 100644 --- a/platform/marvell/sonic-platform-nokia/debian/sonic-platform-nokia-7215-a1.postinst +++ b/platform/marvell/sonic-platform-nokia/debian/sonic-platform-nokia-7215-a1.postinst @@ -26,6 +26,7 @@ case "$1" in systemctl enable nokia-7215init.service systemctl start nokia-7215init.service + systemctl mask --now watchdog-control.service systemctl enable cpu_wdt.service systemctl start cpu_wdt.service