@@ -56,17 +56,12 @@ def get_bmc_info_generic(redfish_url):
5656 manager_response = view_response
5757
5858 # get model
59- bmc_model = manager_response .get ("Model" )
60- bmc_fw_version = manager_response .get ("FirmwareVersion" )
61-
62- if plugin_object .rf .vendor == "HPE" :
63- bmc_model = " " .join (bmc_fw_version .split (" " )[0 :2 ])
64-
65- if plugin_object .rf .vendor == "Dell" :
66- if bmc_model == "13G Monolithic" :
67- bmc_model = "iDRAC 8"
68- if bmc_model in ["14G Monolithic" , "15G Monolithic" ]:
69- bmc_model = "iDRAC 9"
59+ if len (plugin_object .rf .get_system_properties ("managers" )) == 1 :
60+ bmc_model = plugin_object .rf .vendor_data .get_bmc_model ()
61+ bmc_fw_version = plugin_object .rf .vendor_data .get_bmc_firmware_version ()
62+ else :
63+ bmc_model = manager_response .get ("Model" )
64+ bmc_fw_version = manager_response .get ("FirmwareVersion" )
7065
7166 # some Cisco Systems have a second manager with no attributes which needs to be skipped
7267 if plugin_object .rf .vendor == "Cisco" :
@@ -172,7 +167,7 @@ def get_bmc_info_generic(redfish_url):
172167 addresses = format_interface_addresses (mac_address ),
173168 manager_ids = manager_inventory .id ,
174169 system_ids = manager_inventory .system_ids ,
175- chassi_ids = manager_inventory .chassi_ids ,
170+ chassis_ids = manager_inventory .chassis_ids ,
176171 ipv4_addresses = get_interface_ip_addresses (manager_nic , "IPv4Addresses" ),
177172 ipv6_addresses = get_interface_ip_addresses (manager_nic , "IPv6Addresses" ),
178173 link_type = "Ethernet" ,
@@ -251,7 +246,8 @@ def get_bmc_info_generic(redfish_url):
251246 ilo_license_string = grab (vendor_data , "License.LicenseString" )
252247 ilo_license_key = grab (vendor_data , "License.LicenseKey" )
253248
254- bmc_licenses .append (f"{ ilo_license_string } ({ ilo_license_key } )" )
249+ if ilo_license_string and ilo_license_key :
250+ bmc_licenses .append (f"{ ilo_license_string } ({ ilo_license_key } )" )
255251
256252 elif plugin_object .rf .vendor == "Lenovo" :
257253
@@ -307,15 +303,15 @@ def get_bmc_info_generic(redfish_url):
307303
308304 elif plugin_object .rf .vendor == "Huawei" :
309305
310- ibmc_license_link = vendor_data .get ("LicenseService" )
306+ bmc_license_link = vendor_data .get ("LicenseService" )
311307
312- if ibmc_license_link is not None and len (ibmc_license_link ) > 0 :
313- ibmc_lic = plugin_object .rf .get (ibmc_license_link .get ("@odata.id" ))
308+ if bmc_license_link is not None and len (bmc_license_link ) > 0 :
309+ bmc_lic = plugin_object .rf .get (bmc_license_link .get ("@odata.id" ))
314310
315- if ibmc_lic .get ("error" ):
316- plugin_object .add_data_retrieval_error (Manager , ibmc_lic , ibmc_license_link .get ("@odata.id" ))
311+ if bmc_lic .get ("error" ):
312+ plugin_object .add_data_retrieval_error (Manager , bmc_lic , bmc_license_link .get ("@odata.id" ))
317313
318- bmc_licenses .append ("%s (%s)" % (ibmc_lic .get ("InstalledStatus" ), ibmc_lic .get ("LicenseClass" )))
314+ bmc_licenses .append ("%s (%s)" % (bmc_lic .get ("InstalledStatus" ), bmc_lic .get ("LicenseClass" )))
319315
320316 manager_inventory .licenses = bmc_licenses
321317
@@ -326,7 +322,7 @@ def get_bmc_info_generic(redfish_url):
326322 if plugin_object .rf .vendor == "HPE" :
327323
328324 # iLO Self Test
329- for self_test in vendor_data .get ("iLOSelfTestResults" ):
325+ for self_test in vendor_data .get ("iLOSelfTestResults" , [] ):
330326
331327 self_test_status = self_test .get ("Status" )
332328
@@ -403,16 +399,16 @@ def get_bmc_info_generic(redfish_url):
403399
404400 # Lenovo specific stuff
405401 if plugin_object .rf .vendor == "Lenovo" :
406- redfish_chassi_url = grab (manager_response , "Links/ManagerForChassis/0/@odata.id" , separator = "/" )
402+ redfish_chassis_url = grab (manager_response , "Links/ManagerForChassis/0/@odata.id" , separator = "/" )
407403
408- chassi_response = None
409- if redfish_chassi_url is not None :
410- chassi_response = plugin_object .rf .get (redfish_chassi_url )
404+ chassis_response = None
405+ if redfish_chassis_url is not None :
406+ chassis_response = plugin_object .rf .get (redfish_chassis_url )
411407
412- if chassi_response .get ("error" ):
413- plugin_object .add_data_retrieval_error (Manager , chassi_response , redfish_chassi_url )
408+ if chassis_response .get ("error" ):
409+ plugin_object .add_data_retrieval_error (Manager , chassis_response , redfish_chassis_url )
414410
415- located_data = grab (chassi_response , f"Oem.{ plugin_object .rf .vendor_dict_key } .LocatedIn" )
411+ located_data = grab (chassis_response , f"Oem.{ plugin_object .rf .vendor_dict_key } .LocatedIn" )
416412
417413 if located_data is not None :
418414 descriptive_name = located_data .get ("DescriptiveName" )
@@ -436,10 +432,10 @@ def get_bmc_info_generic(redfish_url):
436432 # get Huawei Server location data
437433 if plugin_object .rf .vendor == "Huawei" :
438434
439- ibmc_location = vendor_data .get ("DeviceLocation" )
440- if ibmc_location is not None and len (ibmc_location ) > 0 :
435+ bmc_location = vendor_data .get ("DeviceLocation" )
436+ if bmc_location is not None and len (bmc_location ) > 0 :
441437
442- location_string = f"Location: { ibmc_location } "
438+ location_string = f"Location: { bmc_location } "
443439 if plugin_object .cli_args .detailed :
444440 plugin_object .add_output_data ("OK" , f"BMC { location_string } " ,
445441 location = f"Manager { manager_inventory .id } " )
0 commit comments