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
tree: c3fafe0c6df4a68b330cef4b3fc028e70d1f1a59
  1. conf/
  2. dynamic-layers/
  3. meta-nuvoton-npcm8xx/
  4. recipes-connectivity/
  5. recipes-core/
  6. recipes-devtools/
  7. recipes-extended/
  8. recipes-google/
  9. recipes-kernel/
  10. recipes-phosphor/
  11. LICENSE
  12. README.md
README.md

meta-gbmc-staging

This repository contains additions to the openbmc/meta-google layer that are not yet ready for OpenBMC inclusion.

How to use this layer

  1. Clone openbmc/openbmc from GitHub.
  2. Clone this layer from GitHub into a subdirectory of openbmc.