mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Add fallbacks for more redfish implementations
Redfish implementations can get dodgy about some things and use different names for the same thing and different mappings depending on vendor opinion... Change-Id: I7ec5f1754fcfeca3933dd22a91d1a2daa037e501
This commit is contained in:
parent
61e5a9967b
commit
904a2428c7
@ -590,7 +590,8 @@ class Command(object):
|
||||
return {'identifystate': self._idstatemap[ledstate]}
|
||||
|
||||
def get_health(self, verbose=True):
|
||||
health = self.sysinfo.get('Status', {}).get('HealthRollup', None)
|
||||
health = self.sysinfo.get('Status', {})
|
||||
health = health.get('HealthRollup', health.get('Health', 'Unknown'))
|
||||
health = _healthmap[health]
|
||||
summary = {'badreadings': [], 'health': health}
|
||||
if health > 0 and verbose:
|
||||
@ -909,6 +910,17 @@ class Command(object):
|
||||
if not urls:
|
||||
urls = self._get_adp_urls()
|
||||
if not urls:
|
||||
# No PCIe device inventory, but *maybe* ethernet inventory...
|
||||
aidx = 1
|
||||
for nicinfo in self._get_eth_urls():
|
||||
nicinfo = self._do_web_request(nicinfo)
|
||||
nicname = nicinfo.get('Name', None)
|
||||
nicinfo = nicinfo.get('MACAddress', None)
|
||||
if not nicname:
|
||||
nicname = 'NIC'
|
||||
if nicinfo:
|
||||
yield (nicname, {'MAC Address {0}'.format(aidx): nicinfo})
|
||||
aidx += 1
|
||||
return
|
||||
for inf in self._do_bulk_requests(urls):
|
||||
adpinfo, url = inf
|
||||
@ -952,6 +964,17 @@ class Command(object):
|
||||
nicidx += 1
|
||||
yield aname, yieldinf
|
||||
|
||||
def _get_eth_urls(self):
|
||||
ethurls = self.sysinfo.get('EthernetInterfaces', {})
|
||||
ethurls = ethurls.get('@odata.id', None)
|
||||
if ethurls:
|
||||
ethurls = self._do_web_request(ethurls)
|
||||
ethurls = ethurls.get('Members', [])
|
||||
urls = [x['@odata.id'] for x in ethurls]
|
||||
else:
|
||||
urls = []
|
||||
return urls
|
||||
|
||||
def _get_adp_urls(self):
|
||||
adpurls = self.sysinfo.get('PCIeDevices', [])
|
||||
if adpurls:
|
||||
|
Loading…
x
Reference in New Issue
Block a user