Mechanism to associate sensor/effecter to FRU entity
The "entity_path" key is defined in PDR JSONs and will have an FRU D-Bus object
path as the value, if this is present, the entity type, instance, and container
id should be associate with the FRU entity.
Tested: test JSON with https://gist.github.com/lxwinspur/7225a9301ccfcbff1f6549203405b4fa
after executing the following command, get the entity information from FruHandler
entity_type = 120
entity_instance_num = 1
entity_container_id = 0
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I019f9a0b9d4dbec20a71dfd797f30ac8f57f67b8
diff --git a/libpldmresponder/fru.hpp b/libpldmresponder/fru.hpp
index b19519c..c890a87 100644
--- a/libpldmresponder/fru.hpp
+++ b/libpldmresponder/fru.hpp
@@ -31,6 +31,7 @@
using InterfaceMap = std::map<Interface, PropertyMap>;
using ObjectValueTree = std::map<sdbusplus::message::object_path, InterfaceMap>;
using ObjectPath = std::string;
+using AssociatedEntityMap = std::map<ObjectPath, pldm_entity>;
} // namespace dbus
@@ -124,6 +125,18 @@
*/
void buildFRUTable();
+ /** @brief Get std::map associated with the entity
+ * key: object path
+ * value: pldm_entity
+ *
+ * @return std::map<ObjectPath, pldm_entity>
+ */
+ inline const pldm::responder::dbus::AssociatedEntityMap&
+ getAssociateEntityMap() const
+ {
+ return associatedEntityMap;
+ }
+
private:
uint16_t nextRSI()
{
@@ -151,9 +164,13 @@
* @param[in] recordInfos - FRU record info to build the FRU records
* @param[in/out] entity - PLDM entity corresponding to FRU instance
*/
- void populateRecords(const pldm::responder::dbus::InterfaceMap& interfaces,
+ void populateRecords(const dbus::InterfaceMap& interfaces,
const fru_parser::FruRecordInfos& recordInfos,
const pldm_entity& entity);
+
+ /** @brief Associate sensor/effecter to FRU entity
+ */
+ dbus::AssociatedEntityMap associatedEntityMap;
};
namespace fru
@@ -212,6 +229,18 @@
impl.buildFRUTable();
}
+ /** @brief Get std::map associated with the entity
+ * key: object path
+ * value: pldm_entity
+ *
+ * @return std::map<ObjectPath, pldm_entity>
+ */
+ const pldm::responder::dbus::AssociatedEntityMap&
+ getAssociateEntityMap() const
+ {
+ return impl.getAssociateEntityMap();
+ }
+
/** @brief Handler for GetFRURecordByOption
*
* @param[in] request - Request message payload