Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
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
3 changes: 3 additions & 0 deletions device/dell/x86_64-dell_s6100_c2538-r0/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
},
{
"name": "SSD"
},
{
"name": "ONIE"
}
],
"fans": [
Expand Down
3 changes: 3 additions & 0 deletions device/dell/x86_64-dellemc_z9332f_d1508-r0/platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
},
{
"name": "PCIe"
},
{
"name": "ONIE"
}
],
"fans": [
Expand Down
Original file line number Diff line number Diff line change
@@ -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}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
MAX_S6100_FANTRAY = 4
MAX_S6100_PSU = 2
MAX_S6100_THERMAL = 10
MAX_S6100_COMPONENT = 4
MAX_S6100_COMPONENT = 5


class Chassis(ChassisBase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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):
Expand All @@ -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",
Expand Down Expand Up @@ -261,6 +263,11 @@ def get_firmware_version(self):
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):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -134,6 +140,11 @@ class Component(ComponentBase):
['PCIe',
'ASIC PCIe firmware',
get_pciephy_version
],

['ONIE',
'Open Network Install Environment',
get_onie_version
]
]

Expand Down