Adding Platform specific PDR support

- Adding platform check to generate pdr based on platform type.

- Currently PDR generation is happening based on default
  configuration, so this commit adds support to generate PDR's based
  in the platform type.

Testing:
- Added traces and check from which path the files has been taken for
  pdr generation.
- Removed power supply from default path and oem layer and identified
  that power supply pdr is not generating.

Change-Id: I6bedf06be7392e02c1ad32af7a552a5a4d6d42c0
Signed-off-by: Kamalkumar Patel <kamalkumar.patel@ibm.com>
diff --git a/libpldmresponder/bios.cpp b/libpldmresponder/bios.cpp
index 32d68af..637b213 100644
--- a/libpldmresponder/bios.cpp
+++ b/libpldmresponder/bios.cpp
@@ -69,11 +69,12 @@
 
 DBusHandler dbusHandler;
 
-Handler::Handler(int fd, uint8_t eid, pldm::InstanceIdDb* instanceIdDb,
-                 pldm::requester::Handler<pldm::requester::Request>* handler,
-                 pldm::responder::oem_bios::Handler* oemBiosHandler) :
+Handler::Handler(
+    int fd, uint8_t eid, pldm::InstanceIdDb* instanceIdDb,
+    pldm::requester::Handler<pldm::requester::Request>* handler,
+    pldm::responder::platform_config::Handler* platformConfigHandler) :
     biosConfig(BIOS_JSONS_DIR, BIOS_TABLES_DIR, &dbusHandler, fd, eid,
-               instanceIdDb, handler, oemBiosHandler)
+               instanceIdDb, handler, platformConfigHandler)
 {
     biosConfig.removeTables();
     biosConfig.buildTables();
diff --git a/libpldmresponder/bios.hpp b/libpldmresponder/bios.hpp
index 23f1318..6923063 100644
--- a/libpldmresponder/bios.hpp
+++ b/libpldmresponder/bios.hpp
@@ -3,6 +3,7 @@
 #include "bios_config.hpp"
 #include "bios_table.hpp"
 #include "common/instance_id.hpp"
+#include "platform_config.hpp"
 #include "pldmd/handler.hpp"
 #include "requester/handler.hpp"
 
@@ -33,11 +34,11 @@
      *  @param[in] eid - MCTP EID of host firmware
      *  @param[in] instanceIdDb - pointer to an InstanceIdDb object
      *  @param[in] handler - PLDM request handler
-     *  @param[in] systemConfig - pointer to SystemConfig object
+     *  @param[in] platformConfigHandler - pointer to platform config object
      */
     Handler(int fd, uint8_t eid, pldm::InstanceIdDb* instanceIdDb,
             pldm::requester::Handler<pldm::requester::Request>* handler,
-            pldm::responder::oem_bios::Handler* oemBiosHandler);
+            pldm::responder::platform_config::Handler* platformConfigHandler);
 
     /** @brief Handler for GetDateTime
      *
diff --git a/libpldmresponder/bios_config.cpp b/libpldmresponder/bios_config.cpp
index abc7b2a..8b52a8c 100644
--- a/libpldmresponder/bios_config.cpp
+++ b/libpldmresponder/bios_config.cpp
@@ -45,15 +45,16 @@
     const char* jsonDir, const char* tableDir, DBusHandler* const dbusHandler,
     int fd, uint8_t eid, pldm::InstanceIdDb* instanceIdDb,
     pldm::requester::Handler<pldm::requester::Request>* handler,
-    pldm::responder::oem_bios::Handler* oemBiosHandler) :
+    pldm::responder::platform_config::Handler* platformConfigHandler) :
     jsonDir(jsonDir),
     tableDir(tableDir), dbusHandler(dbusHandler), fd(fd), eid(eid),
-    instanceIdDb(instanceIdDb), handler(handler), oemBiosHandler(oemBiosHandler)
+    instanceIdDb(instanceIdDb), handler(handler),
+    platformConfigHandler(platformConfigHandler)
 
 {
-    if (oemBiosHandler)
+    if (platformConfigHandler)
     {
-        auto systemType = oemBiosHandler->getPlatformName();
+        auto systemType = platformConfigHandler->getPlatformName();
         if (systemType.has_value())
         {
             sysType = systemType.value();
diff --git a/libpldmresponder/bios_config.hpp b/libpldmresponder/bios_config.hpp
index 10cc013..36a7739 100644
--- a/libpldmresponder/bios_config.hpp
+++ b/libpldmresponder/bios_config.hpp
@@ -4,6 +4,7 @@
 #include "bios_table.hpp"
 #include "common/instance_id.hpp"
 #include "oem_handler.hpp"
+#include "platform_config.hpp"
 #include "requester/handler.hpp"
 
 #include <libpldm/bios_table.h>
@@ -79,14 +80,14 @@
      *  @param[in] eid - MCTP EID of host firmware
      *  @param[in] instanceIdDb - pointer to an InstanceIdDb object
      *  @param[in] handler - PLDM request handler
-     *  @param[in] oemBiosHandler - pointer to oem Bios Handler
+     *  @param[in] platformConfigHandler - pointer to platform config Handler
      */
     explicit BIOSConfig(
         const char* jsonDir, const char* tableDir,
         pldm::utils::DBusHandler* const dbusHandler, int fd, uint8_t eid,
         pldm::InstanceIdDb* instanceIdDb,
         pldm::requester::Handler<pldm::requester::Request>* handler,
-        pldm::responder::oem_bios::Handler* oemBiosHandler);
+        pldm::responder::platform_config::Handler* platformConfigHandler);
 
     /** @brief Set attribute value on dbus and attribute value table
      *  @param[in] entry - attribute value entry
@@ -159,8 +160,8 @@
     /** @brief PLDM request handler */
     pldm::requester::Handler<pldm::requester::Request>* handler;
 
-    /** @brief oem Bios Handler*/
-    pldm::responder::oem_bios::Handler* oemBiosHandler;
+    /** @brief platform config Handler*/
+    pldm::responder::platform_config::Handler* platformConfigHandler;
 
     // vector persists all attributes
     using BIOSAttributes = std::vector<std::unique_ptr<BIOSAttribute>>;
diff --git a/libpldmresponder/meson.build b/libpldmresponder/meson.build
index 687fa82..156e3d1 100644
--- a/libpldmresponder/meson.build
+++ b/libpldmresponder/meson.build
@@ -20,6 +20,7 @@
   'pdr_utils.cpp',
   'pdr.cpp',
   'platform.cpp',
+  'platform_config.cpp',
   'fru_parser.cpp',
   'fru.cpp',
   '../host-bmc/host_pdr_handler.cpp',
@@ -50,7 +51,6 @@
     '../oem/ibm/requester/dbus_to_file_handler.cpp',
     '../oem/ibm/libpldmresponder/file_io_type_progress_src.cpp',
     '../oem/ibm/libpldmresponder/file_io_type_vpd.cpp',
-    '../oem/ibm/libpldmresponder/bios_oem_ibm.cpp',
   ]
 endif
 
diff --git a/libpldmresponder/oem_handler.hpp b/libpldmresponder/oem_handler.hpp
index 8bdb6fc..3fcfeb0 100644
--- a/libpldmresponder/oem_handler.hpp
+++ b/libpldmresponder/oem_handler.hpp
@@ -118,28 +118,6 @@
 
 } // namespace oem_platform
 
-namespace oem_bios
-{
-/** Interface to the oem bios Handler class*/
-class Handler : public CmdHandler
-{
-  public:
-    Handler(const pldm::utils::DBusHandler* dBusIntf) : dBusIntf(dBusIntf) {}
-
-    /** @brief Interface to get the system type information
-     *
-     *  @return - the system type information
-     */
-    virtual std::optional<std::string> getPlatformName() = 0;
-
-    virtual ~Handler() = default;
-
-  protected:
-    const pldm::utils::DBusHandler* dBusIntf;
-};
-
-} // namespace oem_bios
-
 } // namespace responder
 
 } // namespace pldm
diff --git a/libpldmresponder/pdr_numeric_effecter.hpp b/libpldmresponder/pdr_numeric_effecter.hpp
index 87e4162..ffcc41a 100644
--- a/libpldmresponder/pdr_numeric_effecter.hpp
+++ b/libpldmresponder/pdr_numeric_effecter.hpp
@@ -78,7 +78,6 @@
                 // present
                 if (!pdr->entity_type)
                 {
-                    error("The entity path for the FRU is not present.");
                     continue;
                 }
             }
diff --git a/libpldmresponder/pdr_state_effecter.hpp b/libpldmresponder/pdr_state_effecter.hpp
index f52739e..78b1632 100644
--- a/libpldmresponder/pdr_state_effecter.hpp
+++ b/libpldmresponder/pdr_state_effecter.hpp
@@ -96,7 +96,6 @@
                 // present
                 if (!pdr->entity_type)
                 {
-                    error("The entity path for the FRU is not present.");
                     continue;
                 }
             }
diff --git a/libpldmresponder/pdr_state_sensor.hpp b/libpldmresponder/pdr_state_sensor.hpp
index 80b829b..f2d89ba 100644
--- a/libpldmresponder/pdr_state_sensor.hpp
+++ b/libpldmresponder/pdr_state_sensor.hpp
@@ -99,7 +99,6 @@
                 // present
                 if (!pdr->entity_type)
                 {
-                    error("The entity path for the FRU is not present.");
                     continue;
                 }
             }
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 7587a16..70ac4bc 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -66,11 +66,15 @@
 }
 
 void Handler::generate(const pldm::utils::DBusHandler& dBusIntf,
-                       const std::string& dir, Repo& repo)
+                       const std::vector<fs::path>& dir, Repo& repo)
 {
-    if (!fs::exists(dir))
+    for (const auto& directory : dir)
     {
-        return;
+        info("checking if : {DIR} exists", "DIR", directory);
+        if (!fs::exists(directory))
+        {
+            return;
+        }
     }
 
     // A map of PDR type to a lambda that handles creation of that PDR type.
@@ -100,50 +104,55 @@
     }}};
 
     Type pdrType{};
-    for (const auto& dirEntry : fs::directory_iterator(dir))
+    for (const auto& directory : dir)
     {
-        try
+        for (const auto& dirEntry : fs::directory_iterator(directory))
         {
-            auto json = readJson(dirEntry.path().string());
-            if (!json.empty())
+            try
             {
-                auto effecterPDRs = json.value("effecterPDRs", empty);
-                for (const auto& effecter : effecterPDRs)
+                if (fs::is_regular_file(dirEntry.path().string()))
                 {
-                    pdrType = effecter.value("pdrType", 0);
-                    generateHandlers.at(pdrType)(dBusIntf, effecter, repo);
-                }
+                    auto json = readJson(dirEntry.path().string());
+                    if (!json.empty())
+                    {
+                        auto effecterPDRs = json.value("effecterPDRs", empty);
+                        for (const auto& effecter : effecterPDRs)
+                        {
+                            pdrType = effecter.value("pdrType", 0);
+                            generateHandlers.at(pdrType)(dBusIntf, effecter,
+                                                         repo);
+                        }
 
-                auto sensorPDRs = json.value("sensorPDRs", empty);
-                for (const auto& sensor : sensorPDRs)
-                {
-                    pdrType = sensor.value("pdrType", 0);
-                    generateHandlers.at(pdrType)(dBusIntf, sensor, repo);
+                        auto sensorPDRs = json.value("sensorPDRs", empty);
+                        for (const auto& sensor : sensorPDRs)
+                        {
+                            pdrType = sensor.value("pdrType", 0);
+                            generateHandlers.at(pdrType)(dBusIntf, sensor,
+                                                         repo);
+                        }
+                    }
                 }
             }
-        }
-        catch (const InternalFailure& e)
-        {
-            error(
-                "PDR config directory does not exist or empty, TYPE= {PDR_TYPE} PATH={DIR_PATH} ERROR={ERR_EXCEP}",
-                "PDR_TYPE", pdrType, "DIR_PATH", dirEntry.path().string(),
-                "ERR_EXCEP", e.what());
-        }
-        catch (const Json::exception& e)
-        {
-            error(
-                "Failed parsing PDR JSON file, TYPE={PDR_TYPE} ERROR={ERR_EXCEP}",
-                "PDR_TYPE", pdrType, "ERR_EXCEP", e.what());
-            pldm::utils::reportError(
-                "xyz.openbmc_project.bmc.pldm.InternalFailure");
-        }
-        catch (const std::exception& e)
-        {
-            error(
-                "Failed parsing PDR JSON file, TYPE= {PDR_TYPE} ERROR={ERR_EXCEP}",
-                "PDR_TYPE", pdrType, "ERR_EXCEP", e.what());
-            pldm::utils::reportError(
-                "xyz.openbmc_project.bmc.pldm.InternalFailure");
+            catch (const InternalFailure& e)
+            {
+                error(
+                    "PDR config directory '{PATH}' does not exist or empty for '{TYPE}' pdr: {ERROR}",
+                    "TYPE", pdrType, "PATH", dirEntry.path(), "ERROR", e);
+            }
+            catch (const Json::exception& e)
+            {
+                error("Failed parsing PDR JSON file for '{TYPE}' pdr: {ERROR}",
+                      "TYPE", pdrType, "ERROR", e);
+                pldm::utils::reportError(
+                    "xyz.openbmc_project.PLDM.Error.Generate.PDRJsonFileParseFail");
+            }
+            catch (const std::exception& e)
+            {
+                error("Failed parsing PDR JSON file for '{TYPE}' pdr: {ERROR}",
+                      "TYPE", pdrType, "ERROR", e);
+                pldm::utils::reportError(
+                    "xyz.openbmc_project.PLDM.Error.Generate.PDRJsonFileParseFail");
+            }
         }
     }
 }
@@ -172,11 +181,25 @@
     if (!pdrCreated)
     {
         generateTerminusLocatorPDR(pdrRepo);
-        generate(*dBusIntf, pdrJsonsDir, pdrRepo);
+        if (platformConfigHandler)
+        {
+            auto systemType = platformConfigHandler->getPlatformName();
+            if (systemType.has_value())
+            {
+                // In case of normal poweron , the system type would have been
+                // already filled by entity manager when ever BMC reaches Ready
+                // state. If this is not filled by time we get a getpdr request
+                // we can assume that the entity manager service is not present
+                // on this system & continue to build the common PDR's.
+                pdrJsonsDir.push_back(pdrJsonDir / systemType.value());
+            }
+        }
+
         if (oemPlatformHandler != nullptr)
         {
             oemPlatformHandler->buildOEMPDR(pdrRepo);
         }
+        generate(*dBusIntf, pdrJsonsDir, pdrRepo);
 
         pdrCreated = true;
 
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index a5dcc44..605c8ab 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -7,6 +7,7 @@
 #include "host-bmc/host_pdr_handler.hpp"
 #include "libpldmresponder/pdr.hpp"
 #include "libpldmresponder/pdr_utils.hpp"
+#include "libpldmresponder/platform_config.hpp"
 #include "oem_handler.hpp"
 #include "pldmd/handler.hpp"
 
@@ -49,11 +50,12 @@
 {
   public:
     Handler(const pldm::utils::DBusHandler* dBusIntf, uint8_t eid,
-            pldm::InstanceIdDb* instanceIdDb, const std::string& pdrJsonsDir,
+            pldm::InstanceIdDb* instanceIdDb, const fs::path& pdrJsonDir,
             pldm_pdr* repo, HostPDRHandler* hostPDRHandler,
             pldm::state_sensor::DbusToPLDMEvent* dbusToPLDMEventHandler,
             fru::Handler* fruHandler,
             pldm::responder::oem_platform::Handler* oemPlatformHandler,
+            pldm::responder::platform_config::Handler* platformConfigHandler,
             pldm::requester::Handler<pldm::requester::Request>* handler,
             sdeventplus::Event& event, bool buildPDRLazily = false,
             const std::optional<EventMap>& addOnHandlersMap = std::nullopt) :
@@ -62,8 +64,9 @@
         hostPDRHandler(hostPDRHandler),
         dbusToPLDMEventHandler(dbusToPLDMEventHandler), fruHandler(fruHandler),
         dBusIntf(dBusIntf), oemPlatformHandler(oemPlatformHandler),
-        handler(handler), event(event), pdrJsonsDir(pdrJsonsDir),
-        pdrCreated(false)
+        platformConfigHandler(platformConfigHandler), handler(handler),
+        event(event), pdrJsonDir(pdrJsonDir), pdrCreated(false),
+        pdrJsonsDir({pdrJsonDir})
     {
         if (!buildPDRLazily)
         {
@@ -192,7 +195,7 @@
      *  @param[in] repo - instance of concrete implementation of Repo
      */
     void generate(const pldm::utils::DBusHandler& dBusIntf,
-                  const std::string& dir,
+                  const std::vector<fs::path>& dir,
                   pldm::responder::pdr_utils::Repo& repo);
 
     /** @brief Parse PDR JSONs and build state effecter PDR repository
@@ -483,10 +486,12 @@
     fru::Handler* fruHandler;
     const pldm::utils::DBusHandler* dBusIntf;
     pldm::responder::oem_platform::Handler* oemPlatformHandler;
+    pldm::responder::platform_config::Handler* platformConfigHandler;
     pldm::requester::Handler<pldm::requester::Request>* handler;
     sdeventplus::Event& event;
-    std::string pdrJsonsDir;
+    fs::path pdrJsonDir;
     bool pdrCreated;
+    std::vector<fs::path> pdrJsonsDir;
     std::unique_ptr<sdeventplus::source::Defer> deferredGetPDREvent;
 };
 
diff --git a/libpldmresponder/platform_config.cpp b/libpldmresponder/platform_config.cpp
new file mode 100644
index 0000000..be44933
--- /dev/null
+++ b/libpldmresponder/platform_config.cpp
@@ -0,0 +1,108 @@
+#include "platform_config.hpp"
+
+namespace pldm
+{
+namespace responder
+{
+
+namespace platform_config
+{
+/** @brief callback function invoked when interfaces get added from
+ *      Entity manager
+ *
+ *  @param[in] msg - Data associated with subscribed signal
+ */
+void Handler::systemCompatibleCallback(sdbusplus::message_t& msg)
+{
+    sdbusplus::message::object_path path;
+
+    pldm::utils::InterfaceMap interfaceMap;
+
+    msg.read(path, interfaceMap);
+
+    if (!interfaceMap.contains(compatibleInterface))
+    {
+        return;
+    }
+    // Get the "Name" property value of the
+    // "xyz.openbmc_project.Inventory.Decorator.Compatible" interface
+    const auto& properties = interfaceMap.at(compatibleInterface);
+
+    if (!properties.contains(namesProperty))
+    {
+        return;
+    }
+    auto names =
+        std::get<pldm::utils::Interfaces>(properties.at(namesProperty));
+
+    std::string systemType;
+    if (!names.empty())
+    {
+        // get only the first system type
+        systemType = names.front();
+    }
+
+    if (!systemType.empty())
+    {
+        systemCompatibleMatchCallBack.reset();
+    }
+}
+
+/** @brief Method to get the system type information
+ *
+ *  @return - the system type information
+ */
+std::optional<std::filesystem::path> Handler::getPlatformName()
+{
+    if (!systemType.empty())
+    {
+        return fs::path{systemType};
+    }
+
+    namespace fs = std::filesystem;
+    static constexpr auto orgFreeDesktopInterface =
+        "org.freedesktop.DBus.Properties";
+    static constexpr auto getMethod = "Get";
+
+    static constexpr auto searchpath = "/xyz/openbmc_project/";
+    int depth = 0;
+    std::vector<std::string> systemCompatible = {compatibleInterface};
+    pldm::utils::GetSubTreeResponse response =
+        pldm::utils::DBusHandler().getSubtree(searchpath, depth,
+                                              systemCompatible);
+    auto& bus = pldm::utils::DBusHandler::getBus();
+    std::variant<std::vector<std::string>> value;
+
+    for (const auto& [objectPath, serviceMap] : response)
+    {
+        try
+        {
+            auto method = bus.new_method_call(
+                serviceMap[0].first.c_str(), objectPath.c_str(),
+                orgFreeDesktopInterface, getMethod);
+            method.append(systemCompatible[0].c_str(), namesProperty);
+            auto reply = bus.call(method);
+            reply.read(value);
+            auto systemList = std::get<std::vector<std::string>>(value);
+            if (!systemList.empty())
+            {
+                systemType = systemList.at(0);
+                return fs::path{systemType};
+            }
+        }
+        catch (const std::exception& e)
+        {
+            error(
+                "Error getting Names property at '{PATH}' on '{INTERFACE}': {ERROR}",
+                "PATH", objectPath, "INTERFACE", systemCompatible[0], "ERROR",
+                e);
+        }
+    }
+    return std::nullopt;
+}
+
+} // namespace platform_config
+
+} // namespace responder
+
+} // namespace pldm
diff --git a/libpldmresponder/platform_config.hpp b/libpldmresponder/platform_config.hpp
new file mode 100644
index 0000000..5a5b2a7
--- /dev/null
+++ b/libpldmresponder/platform_config.hpp
@@ -0,0 +1,58 @@
+#pragma once
+#include "common/utils.hpp"
+#include "pldmd/handler.hpp"
+
+#include <phosphor-logging/lg2.hpp>
+
+PHOSPHOR_LOG2_USING;
+
+namespace pldm
+{
+namespace responder
+{
+
+namespace platform_config
+{
+using namespace pldm::utils;
+
+static constexpr auto compatibleInterface =
+    "xyz.openbmc_project.Inventory.Decorator.Compatible";
+static constexpr auto namesProperty = "Names";
+
+class Handler : public CmdHandler
+{
+  public:
+    Handler()
+    {
+        systemCompatibleMatchCallBack =
+            std::make_unique<sdbusplus::bus::match::match>(
+                pldm::utils::DBusHandler::getBus(),
+                sdbusplus::bus::match::rules::interfacesAdded() +
+                    sdbusplus::bus::match::rules::sender(
+                        "xyz.openbmc_project.EntityManager"),
+                std::bind(&Handler::systemCompatibleCallback, this,
+                          std::placeholders::_1));
+    }
+
+    /** @brief Interface to get the system type information
+     *
+     *  @return - the system type information
+     */
+    virtual std::optional<std::filesystem::path> getPlatformName();
+
+    /** @brief D-Bus Interface added signal match for Entity Manager */
+    void systemCompatibleCallback(sdbusplus::message_t& msg);
+
+  private:
+    /** @brief system type/model */
+    std::string systemType;
+
+    /** @brief D-Bus Interface added signal match for Entity Manager */
+    std::unique_ptr<sdbusplus::bus::match_t> systemCompatibleMatchCallBack;
+};
+
+} // namespace platform_config
+
+} // namespace responder
+
+} // namespace pldm
diff --git a/libpldmresponder/test/libpldmresponder_bios_config_test.cpp b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
index fcbb09f..d073e85 100644
--- a/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_bios_config_test.cpp
@@ -3,6 +3,7 @@
 #include "libpldmresponder/bios_config.hpp"
 #include "libpldmresponder/bios_string_attribute.hpp"
 #include "libpldmresponder/oem_handler.hpp"
+#include "libpldmresponder/platform_config.hpp"
 #include "mocked_bios.hpp"
 
 #include <nlohmann/json.hpp>
@@ -77,29 +78,26 @@
 fs::path TestBIOSConfig::tableDir;
 std::vector<Json> TestBIOSConfig::jsons;
 
-class MockBiosSystemConfig : public pldm::responder::oem_bios::Handler
+class MockSystemConfig : public pldm::responder::platform_config::Handler
 {
   public:
-    MockBiosSystemConfig(const pldm::utils::DBusHandler* dBusIntf) :
-        pldm::responder::oem_bios::Handler(dBusIntf)
-    {}
+    MockSystemConfig() {}
     MOCK_METHOD(void, ibmCompatibleAddedCallback, (sdbusplus::message_t&), ());
-    MOCK_METHOD(std::optional<std::string>, getPlatformName, ());
+    MOCK_METHOD(std::optional<std::filesystem::path>, getPlatformName, ());
 };
 
 TEST_F(TestBIOSConfig, buildTablesTest)
 {
     MockdBusHandler dbusHandler;
+    MockSystemConfig mockSystemConfig;
 
-    MockBiosSystemConfig mockBiosSystemConfig(&dbusHandler);
-
+    EXPECT_CALL(mockSystemConfig, getPlatformName()).WillOnce(Return(""));
     ON_CALL(dbusHandler, getDbusPropertyVariant(_, _, _))
         .WillByDefault(Throw(std::exception()));
 
     BIOSConfig biosConfig("./bios_jsons", tableDir.c_str(), &dbusHandler, 0, 0,
-                          nullptr, nullptr, &mockBiosSystemConfig);
+                          nullptr, nullptr, &mockSystemConfig);
     biosConfig.buildTables();
-
     auto stringTable = biosConfig.getBIOSTable(PLDM_BIOS_STRING_TABLE);
     auto attrTable = biosConfig.getBIOSTable(PLDM_BIOS_ATTR_TABLE);
     auto attrValueTable = biosConfig.getBIOSTable(PLDM_BIOS_ATTR_VAL_TABLE);
@@ -265,15 +263,15 @@
 TEST_F(TestBIOSConfig, buildTablesSystemSpecificTest)
 {
     MockdBusHandler dbusHandler;
+    MockSystemConfig mockSystemConfig;
 
-    MockBiosSystemConfig mockBiosSystemConfig(&dbusHandler);
-
+    EXPECT_CALL(mockSystemConfig, getPlatformName()).WillOnce(Return(""));
     ON_CALL(dbusHandler, getDbusPropertyVariant(_, _, _))
         .WillByDefault(Throw(std::exception()));
 
     BIOSConfig biosConfig("./system_type1/bios_jsons", tableDir.c_str(),
                           &dbusHandler, 0, 0, nullptr, nullptr,
-                          &mockBiosSystemConfig);
+                          &mockSystemConfig);
 
     biosConfig.buildTables();
 
@@ -338,11 +336,11 @@
 TEST_F(TestBIOSConfig, setAttrValue)
 {
     MockdBusHandler dbusHandler;
+    MockSystemConfig mockSystemConfig;
 
-    MockBiosSystemConfig mockBiosSystemConfig(&dbusHandler);
-
+    EXPECT_CALL(mockSystemConfig, getPlatformName()).WillOnce(Return(""));
     BIOSConfig biosConfig("./bios_jsons", tableDir.c_str(), &dbusHandler, 0, 0,
-                          nullptr, nullptr, &mockBiosSystemConfig);
+                          nullptr, nullptr, &mockSystemConfig);
     biosConfig.removeTables();
     biosConfig.buildTables();
 
diff --git a/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp b/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
index 6ef74b7..ce34434 100644
--- a/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_pdr_effecter_test.cpp
@@ -32,7 +32,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
 
@@ -133,7 +133,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_NUMERIC_EFFECTER_PDR);
 
@@ -181,7 +181,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
 
@@ -204,7 +204,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     uint16_t entityType = 33;
     uint16_t entityInstance = 0;
     uint16_t containerId = 0;
diff --git a/libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp b/libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp
index ae1ed3a..92da066 100644
--- a/libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_pdr_sensor_test.cpp
@@ -36,7 +36,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_sensor/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     handler.getPDR(req, requestPayloadLength);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_SENSOR_PDR);
@@ -88,7 +88,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_sensor/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     handler.getPDR(req, requestPayloadLength);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_SENSOR_PDR);
diff --git a/libpldmresponder/test/libpldmresponder_platform_test.cpp b/libpldmresponder/test/libpldmresponder_platform_test.cpp
index 1bc92d5..c56cf06 100644
--- a/libpldmresponder/test/libpldmresponder_platform_test.cpp
+++ b/libpldmresponder/test/libpldmresponder_platform_test.cpp
@@ -44,7 +44,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     pdrRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo repo(pdrRepo);
     ASSERT_EQ(repo.empty(), false);
     auto response = handler.getPDR(req, requestPayloadLength);
@@ -83,7 +83,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     pdrRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo repo(pdrRepo);
     ASSERT_EQ(repo.empty(), false);
     auto response = handler.getPDR(req, requestPayloadLength);
@@ -116,7 +116,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     pdrRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo repo(pdrRepo);
     ASSERT_EQ(repo.empty(), false);
     auto response = handler.getPDR(req, requestPayloadLength);
@@ -147,7 +147,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     pdrRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo repo(pdrRepo);
     ASSERT_EQ(repo.empty(), false);
     auto response = handler.getPDR(req, requestPayloadLength);
@@ -180,7 +180,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     pdrRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo repo(pdrRepo);
     ASSERT_EQ(repo.empty(), false);
     auto response = handler.getPDR(req, requestPayloadLength);
@@ -241,7 +241,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     handler.getPDR(req, requestPayloadLength);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
@@ -289,7 +289,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     handler.getPDR(req, requestPayloadLength);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_EFFECTER_PDR);
@@ -336,7 +336,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, numericEffecterPDRs, PLDM_NUMERIC_EFFECTER_PDR);
 
@@ -380,7 +380,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, numericEffecterPDRs, PLDM_NUMERIC_EFFECTER_PDR);
 
@@ -417,7 +417,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, numericEffecterPDRs, PLDM_NUMERIC_EFFECTER_PDR);
 
@@ -494,7 +494,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_effecter/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, numericEffecterPDRs, PLDM_NUMERIC_EFFECTER_PDR);
 
@@ -673,7 +673,7 @@
     MockdBusHandler mockedUtils;
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "", inPDRRepo, nullptr, nullptr,
-                    nullptr, nullptr, nullptr, event);
+                    nullptr, nullptr, nullptr, nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_TERMINUS_LOCATOR_PDR);
 
@@ -719,7 +719,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_sensor/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_SENSOR_PDR);
     pdr_utils::PdrEntry e;
@@ -767,7 +767,7 @@
     auto event = sdeventplus::Event::get_default();
     Handler handler(&mockedUtils, 0, nullptr, "./pdr_jsons/state_sensor/good",
                     inPDRRepo, nullptr, nullptr, nullptr, nullptr, nullptr,
-                    event);
+                    nullptr, event);
     Repo inRepo(inPDRRepo);
     getRepoByType(inRepo, outRepo, PLDM_STATE_SENSOR_PDR);
     pdr_utils::PdrEntry e;