[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
This commit is contained in:
tomer-israel 2021-07-20 11:56:04 +03:00 committed by GitHub
parent 3a96eb933e
commit 950c24c5ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 8 deletions

View File

@ -7,9 +7,10 @@
############################################################################# #############################################################################
import os import os
import time import time
import subprocess
from sonic_py_common.logger import Logger from sonic_py_common.logger import Logger
from sonic_py_common.device_info import get_platform, get_path_to_platform_dir
try: try:
from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo
except ImportError as e: except ImportError as e:
@ -25,6 +26,16 @@ logger = Logger()
# #
EEPROM_SYMLINK = "/var/run/hw-management/eeprom/vpd_info" 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): class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
RETRIES = 3 RETRIES = 3

View File

@ -7,6 +7,7 @@
try: try:
from sonic_platform_base.platform_base import PlatformBase from sonic_platform_base.platform_base import PlatformBase
from sonic_platform.chassis import Chassis from sonic_platform.chassis import Chassis
from sonic_py_common.device_info import get_platform
from . import utils from . import utils
except ImportError as e: except ImportError as e:
raise ImportError(str(e) + "- required module not found") raise ImportError(str(e) + "- required module not found")
@ -15,11 +16,13 @@ class Platform(PlatformBase):
def __init__(self): def __init__(self):
PlatformBase.__init__(self) PlatformBase.__init__(self)
self._chassis = Chassis() self._chassis = Chassis()
self._chassis.initialize_psu()
self._chassis.initialize_eeprom() self._chassis.initialize_eeprom()
if utils.is_host(): platform_name = get_platform()
self._chassis.initialize_components() if "simx" not in platform_name:
self._chassis.initizalize_system_led() self._chassis.initialize_psu()
else: if utils.is_host():
self._chassis.initialize_fan() self._chassis.initialize_components()
self._chassis.initialize_thermals() self._chassis.initizalize_system_led()
else:
self._chassis.initialize_fan()
self._chassis.initialize_thermals()