From 6d7231ff4108a6094cf8be2b6832732951bc2ee9 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 20 Sep 2019 15:59:54 -0400 Subject: [PATCH] Add OEM firmware retrieval to SR635/SR655 This provides more detail on core firmware on the TSM servers. Change-Id: If9fad33d1d512ac7f9b70cc971e84eae1c3ad74e --- pyghmi/ipmi/oem/lenovo/handler.py | 2 ++ pyghmi/redfish/oem/lenovo/tsma.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 0c308787..56392b99 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -632,6 +632,8 @@ class OEMHandler(generic.OEMHandler): elif self.is_fpc: return nextscale.get_fpc_firmware(bmcver, self.ipmicmd, self._fpc_variant) + elif self.has_tsma: + return self.tsmahandler.get_firmware_inventory(components, raisebypass=False) return super(OEMHandler, self).get_oem_firmware(bmcver, components) def get_diagnostic_data(self, savefile, progress): diff --git a/pyghmi/redfish/oem/lenovo/tsma.py b/pyghmi/redfish/oem/lenovo/tsma.py index dfc92b44..dd98aefc 100644 --- a/pyghmi/redfish/oem/lenovo/tsma.py +++ b/pyghmi/redfish/oem/lenovo/tsma.py @@ -15,6 +15,7 @@ # limitations under the License. import pyghmi.redfish.oem.generic as generic +import pyghmi.exceptions as exc import pyghmi.util.webclient as webclient import struct import time @@ -78,6 +79,33 @@ class TsmHandler(generic.OEMHandler): self.tsm = webclient.thehost self._certverify = webclient._certverify + def get_firmware_inventory(self, components, raisebypass=True): + wc = self.wc + fwinf = wc.grab_json_response('/api/DeviceVersion') + for biosinf in fwinf: + if biosinf['device'] != 1: + continue + biosinf = fwinf[1] + biosres = { + 'version': '{0}.{1}'.format( + biosinf['main'][0], biosinf['main'][1:]), + 'build': biosinf['buildname'] + } + yield ('UEFI', biosres) + break + name = 'TSM' + fwinf = wc.grab_json_response('/api/get-sysfwinfo') + for cinf in fwinf: + bmcinf = { + 'version': cinf['fw_ver'], + 'build': cinf['buildname'], + 'date': cinf['builddate'], + } + yield (name, bmcinf) + name += ' Backup' + if raisebypass: + raise exc.BypassGenericBehavior() + @property def wc(self): self.fwid = None