Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oem: Check presence of the fru for topology information #658

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions oem/ibm/libpldmresponder/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ std::string getObjectPathByLocationCode(const std::string& locationCode,
{
std::string locationIface(
"xyz.openbmc_project.Inventory.Decorator.LocationCode");
std::string inventoryIface("xyz.openbmc_project.Inventory.Item");

std::string path;
ObjectValueTree objects;
Expand All @@ -563,13 +564,25 @@ std::string getObjectPathByLocationCode(const std::string& locationCode,
interfaces.contains(locationIface))
{
PropertyMap properties = interfaces[locationIface];
PropertyMap presentInfo = interfaces[inventoryIface];
if (properties.contains("LocationCode"))
{
if (get<std::string>(properties["LocationCode"]) ==
locationCode)
{
path = objPath.first.str;
return path;
// Return the object path only if either
// The "xyz.openbmc_project.Inventory.Item" interface is not
// present or
// The "Present" property is not populated or it is present
// and its value is true
if (!interfaces.contains(
"xyz.openbmc_project.Inventory.Item") ||
!presentInfo.contains("Present") ||
get<bool>(presentInfo["Present"]))
{
path = objPath.first.str;
return path;
}
}
}
}
Expand Down