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()