Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"component": {
"ONIE": { },
"SSD": { },
"BIOS": { },
"CPLD1": { },
"CPLD2": { }
}
Expand Down
4 changes: 2 additions & 2 deletions platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,14 @@ def initialize_components(self):
return
if not self._component_list:
# Initialize component list
from .component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD
from .component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD, ComponentBIOSSN2201
self._component_list.append(ComponentONIE())
self._component_list.append(ComponentSSD())
# Upgrading BIOS is not supported on SN2201
if DeviceDataManager.get_platform_name() not in ['x86_64-nvidia_sn2201-r0']:
self._component_list.append(ComponentBIOS())
else:
logger.log_notice("Updating BIOS is not supported on SN2201")
self._component_list.append(ComponentBIOSSN2201())
self._component_list.extend(ComponentCPLD.get_component_list())

def get_num_components(self):
Expand Down
31 changes: 31 additions & 0 deletions platform/mellanox/mlnx-platform-api/sonic_platform/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,37 @@ def update_firmware(self, image_path):
self.__install_firmware(image_path)


class ComponentBIOSSN2201(Component):
COMPONENT_NAME = 'BIOS'
COMPONENT_DESCRIPTION = 'BIOS - Basic Input/Output System'

BIOS_VERSION_COMMAND = 'dmidecode -t0'

def __init__(self):
super(ComponentBIOSSN2201, self).__init__()

self.name = self.COMPONENT_NAME
self.description = self.COMPONENT_DESCRIPTION

def get_firmware_version(self):
cmd = self.BIOS_VERSION_COMMAND

try:
output = subprocess.check_output(cmd.split(),
stderr=subprocess.STDOUT,
universal_newlines=True).rstrip('\n')
except subprocess.CalledProcessError as e:
raise RuntimeError("Failed to get {} version: {}".format(self.name, str(e)))

match = re.search('Version: (.*)', output)
if match:
version = match.group(1)
else:
version = 'Unknown version'

return version


class ComponentCPLD(Component):
COMPONENT_NAME = 'CPLD{}'
COMPONENT_DESCRIPTION = 'CPLD - Complex Programmable Logic Device'
Expand Down