@@ -207,7 +207,8 @@ def catalog_resource( context, resource, inventory, chassis_id ):
207
207
"AssetTag" : resource .get ( "AssetTag" , None ),
208
208
"Label" : resource .get ( location_prop , {} ).get ( "PartLocation" , {} ).get ( "ServiceLabel" , None ),
209
209
"State" : resource .get ( "Status" , {} ).get ( "State" , None ),
210
- "Description" : None
210
+ "Description" : None ,
211
+ "RelativeRepairableUnitUri" : None
211
212
}
212
213
213
214
# If no label was found, build a default name
@@ -284,6 +285,42 @@ def catalog_resource( context, resource, inventory, chassis_id ):
284
285
description_str = description_str + " Storage Controller"
285
286
catalog ["Description" ] = description_str .strip ()
286
287
288
+ # Determine the relative repairable unit
289
+ relative_repairable_unit = None
290
+ prop_list = []
291
+ if resource_type == "Chassis" :
292
+ if "Links" in resource :
293
+ if "ContainedBy" in resource ["Links" ]:
294
+ if "@odata.id" in resource ["Links" ]["ContainedBy" ]:
295
+ relative_repairable_unit = resource ["Links" ]["ContainedBy" ]["@odata.id" ]
296
+ elif resource_type == "Processor" :
297
+ if "Links" in resource :
298
+ if "Chassis" in resource ["Links" ]:
299
+ if "@odata.id" in resource ["Links" ]["Chassis" ]:
300
+ relative_repairable_unit = resource ["Links" ]["Chassis" ]["@odata.id" ]
301
+ elif resource_type == "Memory" :
302
+ if "Links" in resource :
303
+ if "Chassis" in resource ["Links" ]:
304
+ if "@odata.id" in resource ["Links" ]["Chassis" ]:
305
+ relative_repairable_unit = resource ["Links" ]["Chassis" ]["@odata.id" ]
306
+ elif resource_type == "Drive" :
307
+ if "Links" in resource :
308
+ if "Chassis" in resource ["Links" ]:
309
+ if "@odata.id" in resource ["Links" ]["Chassis" ]:
310
+ relative_repairable_unit = resource ["Links" ]["Chassis" ]["@odata.id" ]
311
+ elif resource_type == "PCIeDevice" :
312
+ pass
313
+ elif resource_type == "StorageController" :
314
+ pass
315
+ elif resource_type == "NetworkAdapter" :
316
+ pass
317
+ elif resource_type == "Switch" :
318
+ pass
319
+ if relative_repairable_unit is None :
320
+ # No handling set up for this resource type
321
+ pass
322
+ catalog ["RelativeRepairableUnitUri" ] = relative_repairable_unit
323
+
287
324
# Find the inventory instance to update based on the chassis identifier
288
325
inventory_instance = None
289
326
for chassis_inventory in inventory :
0 commit comments