2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 19:57:47 +00:00

Add get_inventory_of_component

redfish did not have a compatible function for the ipmi get_inventory_of_component.
For now, only provide fastpath for system,
other components are difficult to have shortcuts for.

Change-Id: I1998186340b206a997fd0c062bec02fcb0af5ebe
This commit is contained in:
Jarrod Johnson 2019-05-13 15:18:17 -04:00
parent ee63d83dac
commit 61e5a9967b

View File

@ -863,6 +863,22 @@ class Command(object):
for adp in self._get_adp_inventory(True, withids):
yield adp
def get_inventory_of_component(self, component):
if component.lower() == 'system':
sysinfo = {
'UUID': self.sysinfo.get('UUID', ''),
'Serial Number': self.sysinfo.get('SerialNumber', ''),
'Manufacturer': self.sysinfo.get('Manufacturer', ''),
'Product Name': self.sysinfo.get('Model', ''),
'Model': self.sysinfo.get(
'SKU', self.sysinfo.get('PartNumber', '')),
}
return sysinfo
else:
for invpair in self.get_inventory():
if invpair[0].lower() == component.lower():
return invpair[1]
def get_inventory(self, withids=False):
sysinfo = {
'UUID': self.sysinfo.get('UUID', ''),