From 950c24c5ae8cb5ef538a650fd976d9bebcea2ddc Mon Sep 17 00:00:00 2001 From: tomer-israel <76040066+tomer-israel@users.noreply.github.com> Date: Tue, 20 Jul 2021 11:56:04 +0300 Subject: [PATCH] [PMON] [Mellanox] fix syseepromd issue on simx (#8131) Avoid initializing sfp/thermal/components/fan/psu/leds on simx and create vpd_info file on hw_management when we use mellanox simulator platform - Why I did it this is a fix for issue in mellanox simulator platforms. the syseepromd failed on the pmon docker. also "decode-syseeprom" failed also - How I did it before initializing thermal/components/fan/psu/leds --> check if we are running on simx creating the vpd_info on the hw_management folder. - How to verify it check if syseepromd process was loaded properly on the pmon docker. decode-syseeprom is working well without errors/warnings --- .../mlnx-platform-api/sonic_platform/eeprom.py | 13 ++++++++++++- .../sonic_platform/platform.py | 17 ++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py b/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py index da6b70f7890e..3bc169843a39 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py @@ -7,9 +7,10 @@ ############################################################################# import os import time +import subprocess from sonic_py_common.logger import Logger - +from sonic_py_common.device_info import get_platform, get_path_to_platform_dir try: from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo except ImportError as e: @@ -25,6 +26,16 @@ # EEPROM_SYMLINK = "/var/run/hw-management/eeprom/vpd_info" +platform_name = get_platform() +if 'simx' in platform_name: + platform_path = get_path_to_platform_dir() + + if not os.path.exists(EEPROM_SYMLINK): + if not os.path.exists(os.path.dirname(EEPROM_SYMLINK)): + os.makedirs(os.path.dirname(EEPROM_SYMLINK)) + + subprocess.check_call(['/usr/bin/xxd', '-r', '-p', 'syseeprom.hex', EEPROM_SYMLINK], cwd=platform_path) + class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): RETRIES = 3 diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py b/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py index 60e4dcbc99e2..6e18d1fbd854 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/platform.py @@ -7,6 +7,7 @@ try: from sonic_platform_base.platform_base import PlatformBase from sonic_platform.chassis import Chassis + from sonic_py_common.device_info import get_platform from . import utils except ImportError as e: raise ImportError(str(e) + "- required module not found") @@ -15,11 +16,13 @@ class Platform(PlatformBase): def __init__(self): PlatformBase.__init__(self) self._chassis = Chassis() - self._chassis.initialize_psu() self._chassis.initialize_eeprom() - if utils.is_host(): - self._chassis.initialize_components() - self._chassis.initizalize_system_led() - else: - self._chassis.initialize_fan() - self._chassis.initialize_thermals() + platform_name = get_platform() + if "simx" not in platform_name: + self._chassis.initialize_psu() + if utils.is_host(): + self._chassis.initialize_components() + self._chassis.initizalize_system_led() + else: + self._chassis.initialize_fan() + self._chassis.initialize_thermals()