PEL: Manager: Implemented the GetPELIdFromBMCLogId dbus method
In OpenPOWER based system, the application may need to get
the PEL id (aka Entry ID (EID) which is a unique id in the PEL) by using
OpenBMC event log id so added the interface for the same.
Tested:
- Tested by below unit test cases.
- With valid OpenBMC Event Log ID
- With invalid OpenBMC Event Log ID
- Tested by using busctl command
- With valid OpenBMC Event Log ID
```
busctl call xyz.openbmc_project.Logging \
/xyz/openbmc_project/logging org.open_power.Logging.PEL \
GetPELIdFromBMCLogId u 4534
>>> u 1342211909
```
- With invalid OpenBMC Event Log ID
```
busctl call xyz.openbmc_project.Logging \
/xyz/openbmc_project/logging org.open_power.Logging.PEL \
GetPELIdFromBMCLogId u 0xFFFFFFFF
>>> Call failed: Invalid argument was given.
```
DBus interface:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-dbus-interfaces/+/44420
Signed-off-by: Ramesh Iyyar <rameshi1@in.ibm.com>
Change-Id: I60ff5b86bb82cef2c2d3ceab74c49de5b6f6f99d
diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp
index b2224cf..42aae88 100644
--- a/extensions/openpower-pels/manager.hpp
+++ b/extensions/openpower-pels/manager.hpp
@@ -218,6 +218,19 @@
*/
std::string getEventId(const openpower::pels::PEL& pel) const;
+ /** @brief Implementation for GetPELIdFromBMCLogId
+ *
+ * Returns the PEL Id (aka Entry ID (EID)) based on the given
+ * BMC event log id.
+ *
+ * @param[in] bmcLogId - The BMC event log id of the PEL to retrieve
+ * the PEL id.
+ *
+ * @return uint32_t - The Id of the PEL.
+ * Throw "InvalidArgument" if not found.
+ */
+ uint32_t getPELIdFromBMCLogId(uint32_t bmcLogId) override;
+
private:
/**
* @brief Adds a received raw PEL to the PEL repository