From 1a60269df784f336e4847a043180d44d50a2b843 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 9 Aug 2017 09:09:35 -0400 Subject: [PATCH] Implement SMM data extension Do the SMM specific commands to get the serial number and model number. Change-Id: Iddc84c386996a2f93974e65980ed6f928105d87f --- pyghmi/ipmi/oem/lenovo/handler.py | 3 +++ pyghmi/ipmi/oem/lenovo/nextscale.py | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 8f0e3ddf..c809dff8 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -496,6 +496,9 @@ class OEMHandler(generic.OEMHandler): except (AttributeError, KeyError, IndexError): pass return fru + elif self.is_fpc == 2: # SMM variant + fru['oem_parser'] = 'lenovo' + return self.smmhandler.process_fru(fru) else: fru['oem_parser'] = None return fru diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index f20ed8bc..bdfeabb3 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -240,6 +240,16 @@ class SMMClient(object): self.password = ipmicmd.ipmi_session.password self._wc = None + def process_fru(self, fru): + # TODO(jjohnson2): can also get EIOM, SMM, and riser data if warranted + fru['Serial Number'] = self.ipmicmd.xraw_command( + netfn=0x32, command=0xb0, data=(5, 1))['data'][:].strip().replace( + '\xff', '') + fru['Model'] = self.ipmicmd.xraw_command( + netfn=0x32, command=0xb0, data=(5, 0))['data'][:].strip().replace( + '\xff', '') + return fru + def get_webclient(self): cv = self.ipmicmd.certverify wc = webclient.SecureHTTPConnection(self.smm, 443, verifycallback=cv)