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/host-bmc/utils.cpp b/host-bmc/utils.cpp
index a178d48..6c1b818 100644
--- a/host-bmc/utils.cpp
+++ b/host-bmc/utils.cpp
@@ -56,11 +56,10 @@
     return parents;
 }
 
-void addObjectPathEntityAssociations(const EntityAssociations& entityAssoc,
-                                     pldm_entity_node* entity,
-                                     const fs::path& path,
-                                     ObjectPathMaps& objPathMap,
-                                     EntityMaps entityMaps)
+void addObjectPathEntityAssociations(
+    const EntityAssociations& entityAssoc, pldm_entity_node* entity,
+    const fs::path& path, ObjectPathMaps& objPathMap, EntityMaps entityMaps,
+    pldm::responder::oem_platform::Handler* oemPlatformHandler)
 {
     if (entity == nullptr)
     {
@@ -98,6 +97,10 @@
                                          std::to_string(
                                              node_entity.entity_instance_num)};
             std::string entity_path = p.string();
+            if (oemPlatformHandler)
+            {
+                oemPlatformHandler->updateOemDbusPaths(entity_path);
+            }
             // If the entity obtained from the remote PLDM terminal is not in
             // the MAP, or there is no auxiliary name PDR, add it directly.
             // Otherwise, check whether the DBus service of entity_path exists,
@@ -122,7 +125,8 @@
             for (size_t i = 1; i < ev.size(); i++)
             {
                 addObjectPathEntityAssociations(entityAssoc, ev[i], p,
-                                                objPathMap, entityMaps);
+                                                objPathMap, entityMaps,
+                                                oemPlatformHandler);
             }
             found = true;
         }
@@ -133,6 +137,10 @@
         std::string dbusPath =
             path / fs::path{entityName +
                             std::to_string(node_entity.entity_instance_num)};
+        if (oemPlatformHandler)
+        {
+            oemPlatformHandler->updateOemDbusPaths(dbusPath);
+        }
         try
         {
             pldm::utils::DBusHandler().getService(dbusPath.c_str(), nullptr);
@@ -144,9 +152,11 @@
     }
 }
 
-void updateEntityAssociation(const EntityAssociations& entityAssoc,
-                             pldm_entity_association_tree* entityTree,
-                             ObjectPathMaps& objPathMap, EntityMaps entityMaps)
+void updateEntityAssociation(
+    const EntityAssociations& entityAssoc,
+    pldm_entity_association_tree* entityTree, ObjectPathMaps& objPathMap,
+    EntityMaps entityMaps,
+    pldm::responder::oem_platform::Handler* oemPlatformHandler)
 {
     std::vector<pldm_entity_node*> parentsEntity =
         getParentEntites(entityAssoc);
@@ -202,7 +212,7 @@
         }
 
         addObjectPathEntityAssociations(entityAssoc, entity, path, objPathMap,
-                                        entityMaps);
+                                        entityMaps, oemPlatformHandler);
     }
 }