Skip to content

Commit cdd6cc4

Browse files
PriyangaRamasamySunnySrivastava1984
authored andcommitted
Publish Location under PCIeDevice schema (#1083)
The commit publishes Location code under PCIeDevice schema. Validator was executed and no new error was found. Test: curl -k -H "X-Auth-Token: $bmc_token" -X GET "https://${BMC_IP}/redfish/ v1/Systems/system/PCIeDevices/chassis_motherboard_pcieslot0_pcie_card0" { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/ chassis_motherboard_pcieslot0_pcie_card0", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "chassis_motherboard_pcieslot0_pcie_card0", "Oem": { "IBM": { "@odata.type": "#IBMPCIeDevice.v1_0_0.IBM", "LinkReset": false } }, "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/ chassis_motherboard_pcieslot0_pcie_card0/PCIeFunctions" }, "PCIeInterface": { "LanesInUse": null }, "Slot": { "Location": { "PartLocation": { "ServiceLabel": "U78DA.ND0.WZS003T-P0-C0" } }, "SlotType": "FullLength" }, "Status": { "Health": "OK", "State": "Enabled" } } Change-Id: Iba1b98734fdfee43c2995f6c9f1f2660e196814a Signed-off-by: Sunny Srivastava <[email protected]> Co-authored-by: Sunny Srivastava <[email protected]> Signed-off-by: Souvik Roy <[email protected]>
1 parent 9bfb291 commit cdd6cc4

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

redfish-core/lib/pcie.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,31 @@ inline void getPCIeDeviceAsset(
523523
});
524524
}
525525

526+
inline void getPCIeDeviceLocation(
527+
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
528+
const std::string& pcieDevicePath, const std::string& service)
529+
{
530+
dbus::utility::getProperty<std::string>(
531+
service, pcieDevicePath,
532+
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
533+
[asyncResp](const boost::system::error_code& ec,
534+
const std::string& property) {
535+
if (ec)
536+
{
537+
if (ec.value() != EBADR)
538+
{
539+
BMCWEB_LOG_ERROR("DBUS response error for Location");
540+
messages::internalError(asyncResp->res);
541+
}
542+
return;
543+
}
544+
545+
asyncResp->res
546+
.jsonValue["Slot"]["Location"]["PartLocation"]["ServiceLabel"] =
547+
property;
548+
});
549+
}
550+
526551
inline void addPCIeDeviceProperties(
527552
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
528553
const std::string& pcieDeviceId,
@@ -676,6 +701,7 @@ inline void afterGetValidPcieDevicePath(
676701
getPCIeDeviceSlotPath(
677702
pcieDevicePath, asyncResp,
678703
std::bind_front(afterGetPCIeDeviceSlotPath, asyncResp));
704+
getPCIeDeviceLocation(asyncResp, pcieDevicePath, service);
679705
}
680706

681707
inline void handlePCIeDeviceGet(

0 commit comments

Comments
 (0)