DellEMC: S6100, Z9332f - Include ONIE version in 'show platform firmware status' (#10493)

Why I did it
To include ONIE version in show platform firmware status command output in DellEMC S6100 and Z9332f platforms.

How I did it
Include ‘ONIE’ in the list of components provided by platform APIs in DellEMC S6100 and Z9332f.
Unmount ONIE-BOOT if mounted using fast/soft/warm-reboot plugins in DellEMC S6100.
This commit is contained in:
Arun Saravanan Balachandran 2022-05-12 21:54:06 +05:30 committed by GitHub
parent f4b22f67a4
commit 942bef4475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 64 additions and 3 deletions

View File

@ -18,6 +18,9 @@
},
{
"name": "SSD"
},
{
"name": "ONIE"
}
],
"fans": [

View File

@ -30,6 +30,9 @@
},
{
"name": "PCIe"
},
{
"name": "ONIE"
}
],
"fans": [

View File

@ -0,0 +1,28 @@
#!/bin/bash
# script to get the ONIE version from NOS
ONIEPATH="/mnt/onie-boot"
# Exit if not superuser
if [[ "$EUID" -ne 0 ]]; then
echo "This command must be run as root" >&2
exit 1
fi
# Mount ONIE partition if not already mounted
if ! grep -qs ${ONIEPATH} /proc/mounts; then
mkdir -p ${ONIEPATH}
mount LABEL=ONIE-BOOT ${ONIEPATH} || ERR=$?
if [[ ${ERR} -ne 0 ]]; then
exit 1
fi
fi
# Get ONIE version
onie_version=$(${ONIEPATH}/onie/tools/bin/onie-version | grep "ONIE version") || ERR=$?
if [[ ${ERR} -ne 0 ]]; then
exit 1
fi
onie_version=$(echo ${onie_version} | awk '{print $NF}')
echo ${onie_version}

View File

@ -37,3 +37,4 @@ s6100/systemd/s6100-platform-startup.service etc/systemd/system
s6100/scripts/s6100_serial_getty_monitor etc/monit/conf.d
common/fw-updater usr/local/bin
common/onie_mode_set usr/local/bin
common/onie_version usr/local/bin

View File

@ -10,3 +10,4 @@ common/io_rd_wr.py usr/local/bin
common/fw-updater usr/local/bin
common/onie_mode_set usr/local/bin
common/onie_stage_fwpkg usr/local/bin
common/onie_version usr/local/bin

View File

@ -1,5 +1,12 @@
#!/bin/bash
ONIE_PATH="/mnt/onie-boot"
# Unmount ONIE partition if mounted
if grep -qs ${ONIE_PATH} /proc/mounts; then
umount ${ONIE_PATH}
fi
if [[ -d /sys/devices/platform/SMF.512/hwmon/ ]]; then
cd /sys/devices/platform/SMF.512/hwmon/*
echo 0xcc > mb_poweron_reason

View File

@ -28,7 +28,7 @@ MAX_S6100_MODULE = 4
MAX_S6100_FANTRAY = 4
MAX_S6100_PSU = 2
MAX_S6100_THERMAL = 10
MAX_S6100_COMPONENT = 4
MAX_S6100_COMPONENT = 5
class Chassis(ChassisBase):

View File

@ -23,6 +23,7 @@ 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"
ONIE_VERSION_COMMAND = "/usr/local/bin/onie_version"
class Component(ComponentBase):
@ -38,7 +39,8 @@ class Component(ComponentBase):
["FPGA", ("Platform management controller for on-board temperature "
"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"]
["SSD", "Solid State Drive that stores data persistently"],
["ONIE", "Open Network Install Environment"]
]
MODULE_COMPONENT = [
"IOM{}-CPLD",
@ -261,6 +263,11 @@ class Component(ComponentBase):
return self._get_cpld_version()
elif self.index == 3: #SSD
return self._get_ssd_version()
elif self.index == 4: # ONIE
try:
return subprocess.check_output(ONIE_VERSION_COMMAND, text=True).strip()
except (FileNotFoundError, subprocess.CalledProcessError):
return 'NA'
def get_available_firmware_version(self, image_path):
"""

View File

@ -28,7 +28,7 @@ MAX_Z9332F_FANTRAY = 7
MAX_Z9332F_FAN = 2
MAX_Z9332F_PSU = 2
MAX_Z9332F_THERMAL = 14
MAX_Z9332F_COMPONENT = 8 # BIOS,FPGA,BMC,BB CPLD,2 Switch CPLDs,SSD and PCIe
MAX_Z9332F_COMPONENT = 9 # BIOS,FPGA,BMC,BB CPLD,2 Switch CPLDs,SSD,PCIe and ONIE
media_part_num_list = set([ \
"8T47V","XTY28","MHVPK","GF76J","J6FGD","F1KMV","9DN5J","H4DHD","6MCNV","0WRX0","X7F70","5R2PT","WTRD1","WTRD1","WTRD1","WTRD1","5250G","WTRD1","C5RNH","C5RNH","FTLX8571D3BCL-FC",

View File

@ -91,6 +91,12 @@ def get_pciephy_version():
return val
def get_onie_version():
try:
return subprocess.check_output('/usr/local/bin/onie_version', text=True).strip()
except (FileNotFoundError, subprocess.CalledProcessError):
return 'NA'
class Component(ComponentBase):
"""DellEMC Platform-specific Component class"""
@ -134,6 +140,11 @@ class Component(ComponentBase):
['PCIe',
'ASIC PCIe firmware',
get_pciephy_version
],
['ONIE',
'Open Network Install Environment',
get_onie_version
]
]