oem-ibm: Adding entity path correction function

This commit introduces enhancements to rectify entity paths over DBus.
Formerly, the conventional DBus path involved appending an instance
number, such as 'system' becoming 'system1', 'motherboard' becoming
'motherboard1', and 'chassis' becoming 'chassis1'. This function is
designed to align with IBM's specific use case, ensuring the numbering
system adheres appropriately.

Testing:
Unit tests passed

Change-Id: I671f8486078054b44110ffa2cbf169c63d164cf1
Signed-off-by: Kamalkumar Patel <kamalkumar.patel@ibm.com>
diff --git a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
index a6ac666..4f3969c 100644
--- a/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
+++ b/oem/ibm/libpldmresponder/oem_ibm_handler.cpp
@@ -419,6 +419,36 @@
                          uint8_t(CodeUpdateState::END));
 }
 
+void pldm::responder::oem_ibm_platform::Handler::updateOemDbusPaths(
+    std::string& dbusPath)
+{
+    std::string toFind("system1/chassis1/motherboard1");
+    if (dbusPath.find(toFind) != std::string::npos)
+    {
+        size_t pos = dbusPath.find(toFind);
+        dbusPath.replace(pos, toFind.length(), "system/chassis/motherboard");
+    }
+    toFind = "system1";
+    if (dbusPath.find(toFind) != std::string::npos)
+    {
+        size_t pos = dbusPath.find(toFind);
+        dbusPath.replace(pos, toFind.length(), "system");
+    }
+    /* below logic to replace path 'motherboard/socket/chassis' to
+       'motherboard/chassis' or 'motherboard/socket123/chassis' to
+       'motherboard/chassis' */
+    toFind = "socket";
+    size_t pos1 = dbusPath.find(toFind);
+    // while loop to detect multiple substring 'socket' in the path
+    while (pos1 != std::string::npos)
+    {
+        size_t pos2 = dbusPath.substr(pos1 + 1).find('/') + 1;
+        // Replacing starting from substring to next occurence of char '/'
+        dbusPath.replace(pos1, pos2 + 1, "");
+        pos1 = dbusPath.find(toFind);
+    }
+}
+
 void pldm::responder::oem_ibm_platform::Handler::_processSystemReboot(
     sdeventplus::source::EventBase& /*source */)
 {