[DellEMC] S6100 - Adding SSD component and introducing platform_fw_au_handle for auto-update (#9208)
Why I did it Adding SSD as part of platform components list. Introducing platform_fw_au_reboot_handle to use auto-update functionality in fwutil How I did it Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: platform/broadcom/sonic-platform-modules-dell/debian/platform-modules-s6100.install new file: platform/broadcom/sonic-platform-modules-dell/s6100/scripts/platform_fw_au_reboot_handle modified: platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py modified: platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/component.py How to verify it By running fwutil command. Warning: fwupdate_fwimage_dir: /var/platform/fwpackage/. Chassis Module Component Firmware Version (Current/Available) Status --------- -------- ----------- ------------------------------- ----------------------------- ------------------ S6100-ON BIOS S6100-BIOS-3.25.0.2-9-noRP2.bin 3.25.0.2-8 / 3.25.0.2-9 update is required FPGA smf_firmware_upgrade.tar 2.4 / 2.4 up-to-date CPLD cpld_firmware_upgrade.tar 4 / 4 up-to-date SSD ssd_firmware_upgrade.tar S16425cG / S16425cG up-to-date root@sonic:~#
This commit is contained in:
parent
6d8c509817
commit
82085af786
@ -14,6 +14,7 @@ s6100/scripts/soft-reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-
|
||||
s6100/scripts/reboot_plugin usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
||||
s6100/scripts/ssd-fw-upgrade usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
||||
s6100/scripts/override.conf /etc/systemd/system/systemd-reboot.service.d
|
||||
s6100/scripts/platform_fw_au_reboot_handle usr/share/sonic/device/x86_64-dell_s6100_c2538-r0
|
||||
common/dell_lpc_mon.sh usr/local/bin
|
||||
s6100/scripts/s6100_ssd_mon.sh usr/local/bin
|
||||
s6100/scripts/s6100_ssd_upgrade_status.sh usr/local/bin
|
||||
|
@ -0,0 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
DEVPATH="/usr/share/sonic/device/x86_64-dell_s6100_c2538-r0"
|
||||
|
||||
BIOS_FW_UPGRADE="$DEVPATH/bios-fw-upgrade"
|
||||
FPGA_FW_UPGRADE="$DEVPATH/smf-fw-upgrade"
|
||||
CPLD_FW_UPGRADE="$DEVPATH/cpld-fw-upgrade"
|
||||
SSD_FW_UPGRADE="$DEVPATH/ssd-fw-upgrade"
|
||||
|
||||
execute_upgrade() {
|
||||
case $1 in
|
||||
BIOS)
|
||||
if [ -x ${BIOS_FW_UPGRADE} ];then
|
||||
${BIOS_FW_UPGRADE} $BOOT
|
||||
fi
|
||||
;;
|
||||
FPGA)
|
||||
if [ -x ${SMF_FW_UPGRADE} ];then
|
||||
${SMF_FW_UPGRADE} $BOOT
|
||||
fi
|
||||
;;
|
||||
CPLD)
|
||||
if [ -x ${CPLD_FW_UPGRADE} ];then
|
||||
${CPLD_FW_UPGRADE} $BOOT
|
||||
fi
|
||||
;;
|
||||
SSD)
|
||||
if [ -x ${SSD_FW_UPGRADE} ];then
|
||||
${SSD_FW_UPGRADE} $BOOT
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
parse() {
|
||||
if [ -f ${TASK_FILE} ];then
|
||||
while IFS= read -r line; do
|
||||
execute_upgrade $line
|
||||
done < $TASK_FILE
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
fast-reboot)
|
||||
TASK_FILE="/tmp/firmwareupdate/fast_fw_au_task"
|
||||
;;
|
||||
warm-reboot)
|
||||
TASK_FILE="/tmp/firmwareupdate/warm_fw_au_task"
|
||||
;;
|
||||
reboot)
|
||||
TASK_FILE="/tmp/firmwareupdate/cold_fw_au_task"
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {fast-reboot|warm-reboot|reboot}" >&2
|
||||
exit 2
|
||||
esac
|
||||
BOOT=$1
|
||||
parse
|
||||
|
@ -27,7 +27,7 @@ MAX_S6100_MODULE = 4
|
||||
MAX_S6100_FANTRAY = 4
|
||||
MAX_S6100_PSU = 2
|
||||
MAX_S6100_THERMAL = 10
|
||||
MAX_S6100_COMPONENT = 3
|
||||
MAX_S6100_COMPONENT = 4
|
||||
|
||||
|
||||
class Chassis(ChassisBase):
|
||||
|
@ -10,13 +10,19 @@
|
||||
########################################################################
|
||||
|
||||
try:
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import tarfile
|
||||
from sonic_platform_base.component_base import ComponentBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
BIOS_QUERY_VERSION_COMMAND = "dmidecode -s system-version"
|
||||
SSD_VERSION_COMMAND = "ssdutil -v"
|
||||
SSD_UPGRADE_SCHEDULE = "/usr/local/bin/ssd_upgrade_schedule"
|
||||
PCI_VERSION_COMMAND = "lspci -s 0:0.0"
|
||||
|
||||
|
||||
class Component(ComponentBase):
|
||||
@ -29,9 +35,10 @@ class Component(ComponentBase):
|
||||
CHASSIS_COMPONENTS = [
|
||||
["BIOS", ("Performs initialization of hardware components during "
|
||||
"booting")],
|
||||
["CPLD", "Used for managing IO modules, SFP+ modules and system LEDs"],
|
||||
["FPGA", ("Platform management controller for on-board temperature "
|
||||
"monitoring, in-chassis power, Fan and LED control")]
|
||||
"monitoring, in-chassis power, Fan and LED control")],
|
||||
["CPLD", "Used for managing IO modules, SFP+ modules and system LEDs"],
|
||||
["SSD", "Solid State Drive that stores data persistently"]
|
||||
]
|
||||
MODULE_COMPONENT = [
|
||||
"IOM{}-CPLD",
|
||||
@ -125,6 +132,38 @@ class Component(ComponentBase):
|
||||
else:
|
||||
return 'NA'
|
||||
|
||||
def _get_ssd_version(self):
|
||||
rv = 'NA'
|
||||
ssd_ver = self._get_command_result(SSD_VERSION_COMMAND)
|
||||
if not ssd_ver:
|
||||
return rv
|
||||
else:
|
||||
version = re.search(r'Firmware\s*:(.*)',ssd_ver)
|
||||
if version:
|
||||
rv = version.group(1).strip()
|
||||
return rv
|
||||
|
||||
def _get_available_firmware_version(self, image_path):
|
||||
if not os.path.isfile(image_path):
|
||||
return False, "ERROR: File not found"
|
||||
|
||||
try:
|
||||
updater = tarfile.open(image_path, "r")
|
||||
except tarfile.ReadError:
|
||||
return False, "ERROR: Unable to extract firmware updater"
|
||||
|
||||
try:
|
||||
ver_info_fd = updater.extractfile("fw-component-version")
|
||||
except KeyError:
|
||||
updater.close()
|
||||
return False, "ERROR: Version info not available"
|
||||
|
||||
ver_info = json.load(ver_info_fd)
|
||||
ver_info_fd.close()
|
||||
updater.close()
|
||||
|
||||
return True, ver_info
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the component
|
||||
@ -216,10 +255,53 @@ class Component(ComponentBase):
|
||||
else:
|
||||
return bios_ver
|
||||
|
||||
elif self.index == 1: # SwitchCard CPLD
|
||||
return self._get_cpld_version()
|
||||
elif self.index == 2: # FPGA
|
||||
elif self.index == 1: # FPGA
|
||||
return self._get_fpga_version()
|
||||
elif self.index == 2: # SwitchCard CPLD
|
||||
return self._get_cpld_version()
|
||||
elif self.index == 3: #SSD
|
||||
return self._get_ssd_version()
|
||||
|
||||
def get_available_firmware_version(self, image_path):
|
||||
"""
|
||||
Retrieves the available firmware version of the component
|
||||
|
||||
Note: the firmware version will be read from image
|
||||
|
||||
Args:
|
||||
image_path: A string, path to firmware image
|
||||
|
||||
Returns:
|
||||
A string containing the available firmware version of the component
|
||||
"""
|
||||
avail_ver = None
|
||||
if self.index == 2: # SwitchCard CPLD
|
||||
valid, version = self._get_available_firmware_version(image_path)
|
||||
pci_ver = self._get_command_result(PCI_VERSION_COMMAND)
|
||||
if valid:
|
||||
if pci_ver:
|
||||
board_ver = re.search(r"\(rev ([0-9]{2})\)$", pci_ver)
|
||||
if board_ver:
|
||||
board_ver = board_ver.group(1).strip()
|
||||
board_type = 'B0' if board_ver == '02' else 'C0'
|
||||
cpld_ver = self._get_cpld_version()
|
||||
avail_ver = version.get(board_type) if board_type == 'B0' else cpld_ver
|
||||
else:
|
||||
print(version)
|
||||
|
||||
elif self.index == 3: # SSD
|
||||
valid, version = self._get_available_firmware_version(image_path)
|
||||
ssd_ver = self._get_command_result(SSD_VERSION_COMMAND)
|
||||
if valid:
|
||||
if ssd_ver:
|
||||
ssd_model = re.search(r'Device Model\s*:.*(3IE[3]{0,1})', ssd_ver)
|
||||
if ssd_model:
|
||||
ssd_model = ssd_model.group(1).strip()
|
||||
avail_ver = version.get(ssd_model)
|
||||
else:
|
||||
print(version)
|
||||
|
||||
return avail_ver if avail_ver else "NA"
|
||||
|
||||
def install_firmware(self, image_path):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user