Skip to content

Commit fb3e088

Browse files
souvik1914581PriyangaRamasamySunnySrivastava1984
authored
Publish Location under PCIeDevice schema (#1083) (#1239)
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]> Signed-off-by: Souvik Roy <[email protected]> Co-authored-by: priyaram <[email protected]> Co-authored-by: Sunny Srivastava <[email protected]>
1 parent 58d3589 commit fb3e088

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

redfish-core/lib/pcie.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,33 @@ inline void getPCIeDeviceAsset(
524524
});
525525
}
526526

527+
inline void getPCIeDeviceLocation(
528+
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
529+
const std::string& pcieDevicePath, const std::string& service)
530+
{
531+
dbus::utility::getProperty<std::string>(
532+
service, pcieDevicePath,
533+
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
534+
[asyncResp](const boost::system::error_code& ec,
535+
const std::string& property) {
536+
if (ec)
537+
{
538+
if (ec.value() != EBADR)
539+
{
540+
BMCWEB_LOG_ERROR(
541+
"DBUS response error for Location. Error code: {}",
542+
ec.value());
543+
messages::internalError(asyncResp->res);
544+
}
545+
return;
546+
}
547+
548+
asyncResp->res
549+
.jsonValue["Slot"]["Location"]["PartLocation"]["ServiceLabel"] =
550+
property;
551+
});
552+
}
553+
527554
inline void addPCIeDeviceProperties(
528555
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
529556
const std::string& pcieDeviceId,
@@ -679,6 +706,7 @@ inline void afterGetValidPcieDevicePath(
679706
std::bind_front(afterGetPCIeDeviceSlotPath, asyncResp));
680707
name_util::getPrettyName(asyncResp, pcieDevicePath, service,
681708
nlohmann::json::json_pointer{"/Name"});
709+
getPCIeDeviceLocation(asyncResp, pcieDevicePath, service);
682710
}
683711

684712
inline void handlePCIeDeviceGet(

0 commit comments

Comments
 (0)