bmcweb: Implement PartLocationContext for devpath3
Implements https://github.com/DMTF/Redfish/pull/5481
PartLocationContext along with ServiceLabel uniquely identifies part
in an enclosure where just the ServiceLabel cannot.
PartLocationContext is derived from LocationCode following Chassis
associations - Chassis to Chassis using '/contained_by' association and
Chassis to other objects using '/chassis'.
Example:
Upstream chassis assocations for a Processor resource:
cpu0
<-{/chassis} ChassisC
<-{/contained_by} ChassisB
<-{/contained_by} ChassisA
Location object based on the associations above:
"Location": {
"PartLocationContext": <ChassisB LocationCode> / <ChassisC LocationCode>
"PartLocation": {
"LocationType": "Slot"
"ServiceLabel": "<cpu0 LocationCode>"
},
Tested:
wget -qO- localhost/redfish/v1/Chassis/AgoraV2/Assembly
{
"@odata.id": "/redfish/v1/Chassis/AgoraV2/Assembly",
"@odata.type": "#Assembly.v1_3_0.Assembly",
"Assemblies": [
{
"@odata.id": "/redfish/v1/Chassis/AgoraV2/Assembly#/Assemblies/0",
"@odata.type": "#Assembly.v1_3_0.AssemblyData",
"Location": {
"PartLocation": {
"LocationType": "Slot",
"ServiceLabel": "BIOS"
},
"PartLocationContext": "DC_SCM"
},
"MemberId": "0",
"Name": "BIOS_flash"
},
{
"@odata.id": "/redfish/v1/Chassis/AgoraV2/Assembly#/Assemblies/1",
"@odata.type": "#Assembly.v1_3_0.AssemblyData",
"Location": {
"PartLocation": {
"LocationType": "Slot",
"ServiceLabel": "BMC"
},
"PartLocationContext": "DC_SCM"
},
"MemberId": "1",
"Name": "BMC_flash"
}
],
"Assemblies@odata.count": 2,
"Id": "Assembly",
"Name": "Assembly Collection"
}
Google-Bug-Id: 276470977
Change-Id: I9c4aae49e13c4803435de1bf13683269f8db1192
Signed-off-by: Rahul Kapoor <rahulkpr@google.com>
(cherry picked from commit beef8d560173d9af16abfdc769546ee2007b4587)
15 files changed