Handle FRU records from host
- Get FRU record table from host and traverse the entity structure
from the FRU record set PDR, and create D-Bus object.
- When the FRU field type is a PLDM_OEM_FRU_FIELD_TYPE_LOCATION_CODE
, the location code is used to populate the
xyz.openbmc_project.Inventory.Decorator.LocationCode D-Bus
interface for the corresponding FRU.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I482c4d371f76b4881109ef420dfd9543e1aa810b
diff --git a/host-bmc/test/custom_dbus_test.cpp b/host-bmc/test/custom_dbus_test.cpp
new file mode 100644
index 0000000..4549c0d
--- /dev/null
+++ b/host-bmc/test/custom_dbus_test.cpp
@@ -0,0 +1,16 @@
+#include "../custom_dbus.hpp"
+
+#include <gtest/gtest.h>
+
+using namespace pldm::dbus;
+TEST(CustomDBus, LocationCode)
+{
+ std::string tmpPath = "/abc/def";
+ std::string locationCode = "testLocationCode";
+
+ CustomDBus::getCustomDBus().setLocationCode(tmpPath, locationCode);
+ auto retLocationCode = CustomDBus::getCustomDBus().getLocationCode(tmpPath);
+
+ EXPECT_NE(retLocationCode, std::nullopt);
+ EXPECT_EQ(locationCode, retLocationCode);
+}