From 345fd8b44ec066c7161fffee91d00e7e5a01057b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Fri, 7 Feb 2025 15:15:48 -0500 Subject: [PATCH] Handle redfish modeling of some IB adapters IB adapters may be modeled with 'None' Ethernet elements. Handle this and also check for InfiniBand instead. Change-Id: I80b6769b3bb4c5f478cb48b261f5666dfd6a97e0 --- pyghmi/redfish/oem/generic.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pyghmi/redfish/oem/generic.py b/pyghmi/redfish/oem/generic.py index 1a639666..a77212f1 100644 --- a/pyghmi/redfish/oem/generic.py +++ b/pyghmi/redfish/oem/generic.py @@ -788,17 +788,29 @@ class OEMHandler(object): if 'Name' not in nadinfo: continue nicname = nadinfo['Name'] + if nicname == 'NetworkAdapter': + nicname = nadinfo.get('Model', nicname) yieldinf = {} macidx = 1 if 'Ports' in nadinfo: for portinfo in self._get_expanded_data( nadinfo['Ports']['@odata.id']).get('Members', []): - macs = [x for x in portinfo.get('Ethernet', {}).get('AssociatedMACAddresses', [])] - for mac in macs: - label = 'MAC Address {}'.format(macidx) - yieldinf[label] = _normalize_mac(mac) - macidx += 1 - foundmacs = True + ethinfo = portinfo.get('Ethernet', {}) + if ethinfo: + macs = [x for x in ethinfo.get('AssociatedMACAddresses', [])] + for mac in macs: + label = 'MAC Address {}'.format(macidx) + yieldinf[label] = _normalize_mac(mac) + macidx += 1 + foundmacs = True + ibinfo = portinfo.get('InfiniBand', {}) + if ibinfo: + macs = [x for x in ibinfo.get('AssociatedPortGUIDs', [])] + for mac in macs: + label = 'Port GUID {}'.format(macidx) + yieldinf[label] = mac + macidx += 1 + foundmacs = True macinfobyadpname[nicname] = yieldinf else: for ctrlr in nadinfo.get('Controllers', []):