Skip to content

Commit

Permalink
[PMON] [Mellanox] fix syseepromd issue on simx (sonic-net#8131)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tomer-israel authored and Carl Keene committed Aug 7, 2021
1 parent c2fea5a commit 90d7821
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
13 changes: 12 additions & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/eeprom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down
17 changes: 10 additions & 7 deletions platform/mellanox/mlnx-platform-api/sonic_platform/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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()

0 comments on commit 90d7821

Please sign in to comment.