Move dbus_to_terminus_effecter code to platform-mc

In the current state , pldm build breaks when attempting to perform
a debug-optimized build (`-O2` optimization), leading to the following
linker error:

```
undefined reference to `pldm::platform_mc::TerminusManager::getActiveEidByName
(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
```

This issue is not encountered in the CI environment, as CI uses the
`-Og` optimization flag, which does not aggressively inline functions.
Consequently, the reference to `getActiveEidByName()` is resolved
without issue. However, when building the project with default
optimizations (debugoptimized [-O2]), the build fails because the
linker cannot resolve the reference to `getActiveEidByName()`, which is
inlined by the compiler.

To address this problem, there are three potential solutions:

1. Prevent Inlining of the Function:
   We could use `__attribute__((noinline))` to prevent the compiler
   from inlining `getActiveEidByName()`.

2. Move Source Files into `libpldmresponder`:
   We could move the `platform-mc/manager.cpp` and
   `platform-mc/terminus_manager.cpp` files into the `libpldmresponder`
   so the compiler can resolve the reference directly within the
   library.

3. Migrate `dbus_to_terminus_effecter.cpp` to the `platform-mc` folder:

The most appropriate solution appears to be migrating the
`dbus_to_terminus_effecter.cpp` file into the `platform-mc` directory.
This file is not inherently tied to `libpldmresponder` but functions as
a requester. Additionally, there are existing community patches that
allow the system to scale from a single host terminus to multiple
terminii, further justifying this move. So, solution #3 is the most
fitting at this stage. By relocating the `dbus_to_terminus_effecter`
code to the `platform-mc` folder, we can ensure proper modularity,
while also resolving the build issue in a clean and scalable manner.

Tested By:
1. meson build -Doptimization=2 works fine with the patchset.

Change-Id: I0ac8be58253bfb0394500f1d34e8431c6103c924
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
diff --git a/platform-mc/dbus_to_terminus_effecters.cpp b/platform-mc/dbus_to_terminus_effecters.cpp
new file mode 100644
index 0000000..0c27f95
--- /dev/null
+++ b/platform-mc/dbus_to_terminus_effecters.cpp
@@ -0,0 +1,704 @@
+#include "dbus_to_terminus_effecters.hpp"
+
+#include <libpldm/pdr.h>
+#include <libpldm/platform.h>
+
+#include <phosphor-logging/lg2.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+#include <xyz/openbmc_project/State/Boot/Progress/client.hpp>
+#include <xyz/openbmc_project/State/OperatingSystem/Status/server.hpp>
+
+#include <fstream>
+
+PHOSPHOR_LOG2_USING;
+
+using namespace pldm::utils;
+
+namespace pldm
+{
+namespace host_effecters
+{
+using InternalFailure =
+    sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure;
+
+constexpr auto hostEffecterJson = "dbus_to_terminus_effecter.json";
+
+void HostEffecterParser::populatePropVals(
+    const Json& dBusValues, std::vector<PropertyValue>& propertyValues,
+    const std::string& propertyType)
+
+{
+    for (const auto& elem : dBusValues)
+    {
+        auto value = jsonEntryToDbusVal(propertyType, elem);
+        propertyValues.emplace_back(value);
+    }
+}
+
+void HostEffecterParser::parseEffecterJson(const std::string& jsonPath)
+{
+    fs::path jsonDir(jsonPath);
+    if (!fs::exists(jsonDir) || fs::is_empty(jsonDir))
+    {
+        error("Effecter json file for remote terminus '{PATH}' does not exist.",
+              "PATH", jsonPath);
+        return;
+    }
+
+    fs::path jsonFilePath = jsonDir / hostEffecterJson;
+    if (!fs::exists(jsonFilePath))
+    {
+        error("Json at path '{PATH}' does not exist.", "PATH", jsonFilePath);
+        throw InternalFailure();
+    }
+
+    std::ifstream jsonFile(jsonFilePath);
+    auto data = Json::parse(jsonFile, nullptr, false);
+    if (data.is_discarded())
+    {
+        error("Failed to parse json file {PATH}", "PATH", jsonFilePath);
+        throw InternalFailure();
+    }
+    const Json empty{};
+    const std::vector<Json> emptyList{};
+
+    auto entries = data.value("entries", emptyList);
+    for (const auto& entry : entries)
+    {
+        EffecterInfo effecterInfo;
+        effecterInfo.mctpEid = entry.value("mctp_eid", 0xFF);
+        effecterInfo.terminusName = entry.value("terminus_name", "");
+        auto jsonEffecterInfo = entry.value("effecter_info", empty);
+        auto effecterId =
+            jsonEffecterInfo.value("effecterID", PLDM_INVALID_EFFECTER_ID);
+        /* default as PLDM_STATE_EFFECTER_PDR */
+        auto effecterPdrType =
+            jsonEffecterInfo.value("effecterPdrType", PLDM_STATE_EFFECTER_PDR);
+        if (effecterPdrType != PLDM_STATE_EFFECTER_PDR &&
+            effecterPdrType != PLDM_NUMERIC_EFFECTER_PDR)
+        {
+            error(
+                "Effecter PDRType not supported {TYPE} of effecterID '{EFFECTERID}'",
+                "TYPE", effecterPdrType, "EFFECTERID", effecterId);
+            continue;
+        }
+        effecterInfo.effecterPdrType = effecterPdrType;
+        effecterInfo.containerId = jsonEffecterInfo.value("containerID", 0);
+        effecterInfo.entityType = jsonEffecterInfo.value("entityType", 0);
+        effecterInfo.entityInstance =
+            jsonEffecterInfo.value("entityInstance", 0);
+        effecterInfo.compEffecterCnt =
+            jsonEffecterInfo.value("compositeEffecterCount", 0);
+        effecterInfo.checkHostState =
+            jsonEffecterInfo.value("checkHostState", true);
+        auto effecters = entry.value("effecters", emptyList);
+
+        if (effecterPdrType == PLDM_NUMERIC_EFFECTER_PDR)
+        {
+            for (const auto& effecter : effecters)
+            {
+                DBusNumericEffecterMapping dbusInfo{};
+                auto jsonDbusInfo = effecter.value("dbus_info", empty);
+                dbusInfo.dataSize = effecter.value("effecterDataSize", 0);
+                dbusInfo.unitModifier = effecter.value("unitModifier", 0);
+                dbusInfo.resolution = effecter.value("resolution", 1);
+                dbusInfo.offset = effecter.value("offset", 0);
+                dbusInfo.dbusMap.objectPath =
+                    jsonDbusInfo.value("object_path", "");
+                dbusInfo.dbusMap.interface =
+                    jsonDbusInfo.value("interface", "");
+                dbusInfo.dbusMap.propertyName =
+                    jsonDbusInfo.value("property_name", "");
+                dbusInfo.dbusMap.propertyType =
+                    jsonDbusInfo.value("property_type", "");
+                /**
+                 * Only support these property type for Numeric Effecter D-Bus
+                 * property:
+                 * "uint8_t", "int16_t",  "uint16_t", "int32_t", "uint32_t",
+                 * "int64_t", "uint64_t", "double"
+                 */
+                if (!dbusValueNumericTypeNames.contains(
+                        dbusInfo.dbusMap.propertyType))
+                {
+                    lg2::error(
+                        "Invalid PropertyType {TYPE} of object path {PATH} property name {NAME}",
+                        "TYPE", dbusInfo.dbusMap.propertyType, "PATH",
+                        dbusInfo.dbusMap.objectPath, "NAME",
+                        dbusInfo.dbusMap.propertyName);
+                    continue;
+                }
+
+                dbusInfo.propertyValue =
+                    std::numeric_limits<double>::quiet_NaN();
+                auto effecterInfoIndex = hostEffecterInfo.size();
+                auto dbusInfoIndex = effecterInfo.dbusInfo.size();
+                createHostEffecterMatch(
+                    dbusInfo.dbusMap.objectPath, dbusInfo.dbusMap.interface,
+                    effecterInfoIndex, dbusInfoIndex, effecterId);
+                effecterInfo.dbusNumericEffecterInfo.emplace_back(
+                    std::move(dbusInfo));
+            }
+            hostEffecterInfo.emplace_back(std::move(effecterInfo));
+            continue;
+        }
+
+        for (const auto& effecter : effecters)
+        {
+            DBusEffecterMapping dbusInfo{};
+            auto jsonDbusInfo = effecter.value("dbus_info", empty);
+            dbusInfo.dbusMap.objectPath = jsonDbusInfo.value("object_path", "");
+            dbusInfo.dbusMap.interface = jsonDbusInfo.value("interface", "");
+            dbusInfo.dbusMap.propertyName =
+                jsonDbusInfo.value("property_name", "");
+            dbusInfo.dbusMap.propertyType =
+                jsonDbusInfo.value("property_type", "");
+            Json propertyValues = jsonDbusInfo["property_values"];
+
+            populatePropVals(propertyValues, dbusInfo.propertyValues,
+                             dbusInfo.dbusMap.propertyType);
+
+            const std::vector<uint8_t> emptyStates{};
+            auto state = effecter.value("state", empty);
+            dbusInfo.state.stateSetId = state.value("id", 0);
+            auto states = state.value("state_values", emptyStates);
+            if (dbusInfo.propertyValues.size() != states.size())
+            {
+                error(
+                    "Number of states do not match with number of D-Bus property values in the json. Object path at '{PATH}' and property '{PROPERTY}' will not be monitored",
+                    "PATH", dbusInfo.dbusMap.objectPath, "PROPERTY",
+                    dbusInfo.dbusMap.propertyName);
+                continue;
+            }
+            for (const auto& s : states)
+            {
+                dbusInfo.state.states.emplace_back(s);
+            }
+
+            auto effecterInfoIndex = hostEffecterInfo.size();
+            auto dbusInfoIndex = effecterInfo.dbusInfo.size();
+            createHostEffecterMatch(
+                dbusInfo.dbusMap.objectPath, dbusInfo.dbusMap.interface,
+                effecterInfoIndex, dbusInfoIndex, effecterId);
+            effecterInfo.dbusInfo.emplace_back(std::move(dbusInfo));
+        }
+        hostEffecterInfo.emplace_back(std::move(effecterInfo));
+    }
+}
+
+bool HostEffecterParser::isHostOn(void)
+{
+    using BootProgress =
+        sdbusplus::client::xyz::openbmc_project::state::boot::Progress<>;
+    constexpr auto hostStatePath = "/xyz/openbmc_project/state/host0";
+    try
+    {
+        auto propVal = dbusHandler->getDbusPropertyVariant(
+            hostStatePath, "BootProgress", BootProgress::interface);
+
+        using Stages = BootProgress::ProgressStages;
+        auto currHostState = sdbusplus::message::convert_from_string<Stages>(
+                                 std::get<std::string>(propVal))
+                                 .value();
+
+        if (currHostState != Stages::SystemInitComplete &&
+            currHostState != Stages::OSRunning &&
+            currHostState != Stages::SystemSetup &&
+            currHostState != Stages::OEM)
+        {
+            info(
+                "Remote terminus is not up/active, current remote terminus state is: '{CURRENT_HOST_STATE}'",
+                "CURRENT_HOST_STATE", currHostState);
+            return false;
+        }
+    }
+    catch (const sdbusplus::exception_t& e)
+    {
+        error(
+            "Error in getting current remote terminus state. Will still continue to set the remote terminus effecter, error - {ERROR}",
+            "ERROR", e);
+        return false;
+    }
+
+    return true;
+}
+
+void HostEffecterParser::processHostEffecterChangeNotification(
+    const DbusChgHostEffecterProps& chProperties, size_t effecterInfoIndex,
+    size_t dbusInfoIndex, uint16_t effecterId)
+{
+    const auto& pdrType = hostEffecterInfo[effecterInfoIndex].effecterPdrType;
+    if (pdrType == PLDM_NUMERIC_EFFECTER_PDR)
+    {
+        processTerminusNumericEffecterChangeNotification(
+            chProperties, effecterInfoIndex, dbusInfoIndex, effecterId);
+        return;
+    }
+    const auto& propertyName = hostEffecterInfo[effecterInfoIndex]
+                                   .dbusInfo[dbusInfoIndex]
+                                   .dbusMap.propertyName;
+
+    const auto& it = chProperties.find(propertyName);
+
+    if (it == chProperties.end())
+    {
+        return;
+    }
+
+    if (effecterId == PLDM_INVALID_EFFECTER_ID)
+    {
+        constexpr auto localOrRemote = false;
+        effecterId = findStateEffecterId(
+            pdrRepo, hostEffecterInfo[effecterInfoIndex].entityType,
+            hostEffecterInfo[effecterInfoIndex].entityInstance,
+            hostEffecterInfo[effecterInfoIndex].containerId,
+            hostEffecterInfo[effecterInfoIndex]
+                .dbusInfo[dbusInfoIndex]
+                .state.stateSetId,
+            localOrRemote);
+        if (effecterId == PLDM_INVALID_EFFECTER_ID)
+        {
+            error(
+                "Effecter ID '{EFFECTERID}' of entity type '{TYPE}', entityInstance '{INSTANCE}' and containerID '{CONTAINER_ID}' not found in pdr repo",
+                "EFFECTERID", effecterId, "TYPE",
+                hostEffecterInfo[effecterInfoIndex].entityType, "INSTANCE",
+                hostEffecterInfo[effecterInfoIndex].entityInstance,
+                "CONTAINER_ID",
+                hostEffecterInfo[effecterInfoIndex].containerId);
+            return;
+        }
+    }
+
+    if (!isHostOn())
+    {
+        return;
+    }
+
+    uint8_t newState{};
+    try
+    {
+        newState =
+            findNewStateValue(effecterInfoIndex, dbusInfoIndex, it->second);
+    }
+    catch (const std::out_of_range& e)
+    {
+        error("Failed to find new state '{NEW_STATE}' in json, error - {ERROR}",
+              "ERROR", e, "NEW_STATE", newState);
+        return;
+    }
+
+    std::vector<set_effecter_state_field> stateField;
+    for (uint8_t i = 0; i < hostEffecterInfo[effecterInfoIndex].compEffecterCnt;
+         i++)
+    {
+        if (i == dbusInfoIndex)
+        {
+            stateField.push_back({PLDM_REQUEST_SET, newState});
+        }
+        else
+        {
+            stateField.push_back({PLDM_NO_CHANGE, 0});
+        }
+    }
+    int rc{};
+    try
+    {
+        rc = setHostStateEffecter(effecterInfoIndex, stateField, effecterId);
+    }
+    catch (const std::runtime_error& e)
+    {
+        error(
+            "Failed to set remote terminus state effecter for effecter ID '{EFFECTERID}', error - {ERROR}",
+            "ERROR", e, "EFFECTERID", effecterId);
+        return;
+    }
+    if (rc != PLDM_SUCCESS)
+    {
+        error(
+            "Failed to set the remote terminus state effecter for effecter ID '{EFFECTERID}', response code '{RC}'",
+            "EFFECTERID", effecterId, "RC", rc);
+    }
+}
+
+double HostEffecterParser::adjustValue(double value, double offset,
+                                       double resolution, int8_t modify)
+{
+    double unitModifier = std::pow(10, signed(modify));
+    return std::round((value - offset) * resolution / unitModifier);
+}
+
+void HostEffecterParser::processTerminusNumericEffecterChangeNotification(
+    const DbusChgHostEffecterProps& chProperties, size_t effecterInfoIndex,
+    size_t dbusInfoIndex, uint16_t effecterId)
+{
+    const auto& checkHost = hostEffecterInfo[effecterInfoIndex].checkHostState;
+    const auto& propValues = hostEffecterInfo[effecterInfoIndex]
+                                 .dbusNumericEffecterInfo[dbusInfoIndex];
+    const auto& propertyName = propValues.dbusMap.propertyName;
+    const auto& propertyType = propValues.dbusMap.propertyType;
+
+    if (effecterId == PLDM_INVALID_EFFECTER_ID)
+    {
+        lg2::error(
+            "Dbus to PLDM Numeric Effecter setting requires valid effecter ID. Invalid effecter ID {EFFECTER_ID}",
+            "EFFECTER_ID", effecterId);
+    }
+
+    if (!dbusValueNumericTypeNames.contains(propertyType))
+    {
+        lg2::error(
+            "DBus Value to PLDM Numeric Effecter setting only supports D-Bus Numeric data type. Invalid type {TYPE}",
+            "TYPE", propertyType);
+        return;
+    }
+
+    const auto& it = chProperties.find(propertyName);
+
+    if (it == chProperties.end())
+    {
+        return;
+    }
+
+    double val = std::numeric_limits<double>::quiet_NaN();
+    if (!pldm::utils::dbusPropValuesToDouble(propertyType, it->second, &val))
+    {
+        lg2::error(
+            "DBus Value to PLDM Numeric Effecter setting only supports Numeric D-Bus data type. Invalid type {TYPE}",
+            "TYPE", propertyType);
+        return;
+    }
+
+    /* Update the current value of D-Bus interface*/
+    if (std::isfinite(val) && !std::isfinite(propValues.propertyValue))
+    {
+        hostEffecterInfo[effecterInfoIndex]
+            .dbusNumericEffecterInfo[dbusInfoIndex]
+            .propertyValue = val;
+        return;
+    }
+
+    /* Bypass the setting when the current value is NA or setting value is NA */
+    if (!std::isfinite(propValues.propertyValue) || !std::isfinite(val))
+    {
+        return;
+    }
+
+    /* Setting value equals the D-Bus value which is real value of effecter */
+    if (val == propValues.propertyValue)
+    {
+        return;
+    }
+
+    double rawValue = adjustValue(val, propValues.offset, propValues.resolution,
+                                  propValues.unitModifier);
+
+    if (checkHost && !isHostOn())
+    {
+        return;
+    }
+
+    try
+    {
+        auto rc = setTerminusNumericEffecter(effecterInfoIndex, effecterId,
+                                             propValues.dataSize, rawValue);
+        if (rc)
+        {
+            error(
+                "Could not set the numeric effecter ID '{EFFECTERID}' return code '{RC}'",
+                "EFFECTERID", effecterId, "RC", rc);
+            return;
+        }
+    }
+    catch (const std::runtime_error& e)
+    {
+        error("Could not set numeric effecter ID= '{EFFECTERID}'", "EFFECTERID",
+              effecterId);
+        return;
+    }
+
+    hostEffecterInfo[effecterInfoIndex]
+        .dbusNumericEffecterInfo[dbusInfoIndex]
+        .propertyValue = val;
+
+    return;
+}
+
+uint8_t HostEffecterParser::findNewStateValue(
+    size_t effecterInfoIndex, size_t dbusInfoIndex,
+    const PropertyValue& propertyValue)
+{
+    const auto& propValues = hostEffecterInfo[effecterInfoIndex]
+                                 .dbusInfo[dbusInfoIndex]
+                                 .propertyValues;
+    auto it = std::find(propValues.begin(), propValues.end(), propertyValue);
+    uint8_t newState{};
+    if (it != propValues.end())
+    {
+        auto index = std::distance(propValues.begin(), it);
+        newState = hostEffecterInfo[effecterInfoIndex]
+                       .dbusInfo[dbusInfoIndex]
+                       .state.states[index];
+    }
+    else
+    {
+        throw std::out_of_range("new state not found in json");
+    }
+    return newState;
+}
+
+size_t getEffecterDataSize(uint8_t effecterDataSize)
+{
+    switch (effecterDataSize)
+    {
+        case PLDM_EFFECTER_DATA_SIZE_UINT8:
+            return sizeof(uint8_t);
+        case PLDM_EFFECTER_DATA_SIZE_SINT8:
+            return sizeof(int8_t);
+        case PLDM_EFFECTER_DATA_SIZE_UINT16:
+            return sizeof(uint16_t);
+        case PLDM_EFFECTER_DATA_SIZE_SINT16:
+            return sizeof(int16_t);
+        case PLDM_EFFECTER_DATA_SIZE_UINT32:
+            return sizeof(uint32_t);
+        case PLDM_EFFECTER_DATA_SIZE_SINT32:
+            return sizeof(int32_t);
+        default:
+            return 0;
+    }
+}
+
+int HostEffecterParser::setTerminusNumericEffecter(
+    size_t effecterInfoIndex, uint16_t effecterId, uint8_t dataSize,
+    double rawValue)
+{
+    std::string terminusName = hostEffecterInfo[effecterInfoIndex].terminusName;
+    uint8_t& mctpEid = hostEffecterInfo[effecterInfoIndex].mctpEid;
+    if (!terminusName.empty())
+    {
+        auto tmpEid = platformManager->getActiveEidByName(terminusName);
+        if (tmpEid)
+        {
+            mctpEid = tmpEid.value();
+        }
+    }
+
+    auto instanceId = instanceIdDb->next(mctpEid);
+    int rc = PLDM_ERROR;
+    std::vector<uint8_t> requestMsg;
+
+    /**
+     * PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES = 4. It includes the 1 byte
+     * value for effecterValue as `Table 48 - SetNumericEffecterValue command
+     * format` DSP0248 V1.3.0 So the payload_length of `SetNumericEffecterValue`
+     * request message will be payload_length =
+     * PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES - 1 + sizeof(dataType)
+     */
+    size_t payload_length = PLDM_SET_NUMERIC_EFFECTER_VALUE_MIN_REQ_BYTES - 1 +
+                            getEffecterDataSize(dataSize);
+    requestMsg.resize(sizeof(pldm_msg_hdr) + payload_length);
+    auto request = new (requestMsg.data()) pldm_msg;
+    switch (dataSize)
+    {
+        case PLDM_EFFECTER_DATA_SIZE_UINT8:
+        {
+            auto value_uint8 = (uint8_t)rawValue;
+            rc = encode_set_numeric_effecter_value_req(
+                instanceId, effecterId, dataSize,
+                reinterpret_cast<uint8_t*>(&value_uint8), request,
+                payload_length);
+            break;
+        }
+        case PLDM_EFFECTER_DATA_SIZE_SINT8:
+        {
+            auto value_int8 = (int8_t)rawValue;
+            rc = encode_set_numeric_effecter_value_req(
+                instanceId, effecterId, dataSize,
+                reinterpret_cast<uint8_t*>(&value_int8), request,
+                payload_length);
+            break;
+        }
+        case PLDM_EFFECTER_DATA_SIZE_UINT16:
+        {
+            auto value_uint16 = (uint16_t)rawValue;
+            rc = encode_set_numeric_effecter_value_req(
+                instanceId, effecterId, dataSize,
+                reinterpret_cast<uint8_t*>(&value_uint16), request,
+                payload_length);
+            break;
+        }
+        case PLDM_EFFECTER_DATA_SIZE_SINT16:
+        {
+            auto value_int16 = (int16_t)rawValue;
+            rc = encode_set_numeric_effecter_value_req(
+                instanceId, effecterId, dataSize,
+                reinterpret_cast<uint8_t*>(&value_int16), request,
+                payload_length);
+            break;
+        }
+        case PLDM_EFFECTER_DATA_SIZE_UINT32:
+        {
+            auto value_uint32 = (uint32_t)rawValue;
+            rc = encode_set_numeric_effecter_value_req(
+                instanceId, effecterId, dataSize,
+                reinterpret_cast<uint8_t*>(&value_uint32), request,
+                payload_length);
+            break;
+        }
+        case PLDM_EFFECTER_DATA_SIZE_SINT32:
+        {
+            auto value_int32 = (int32_t)rawValue;
+            rc = encode_set_numeric_effecter_value_req(
+                instanceId, effecterId, dataSize,
+                reinterpret_cast<uint8_t*>(&value_int32), request,
+                payload_length);
+            break;
+        }
+        default:
+            break;
+    }
+
+    if (rc)
+    {
+        error(
+            "Failed to encode set numeric effecter request message for effecter ID '{EFFECTERID}' and instanceID '{INSTANCE}' with error code '{RC}'",
+            "EFFECTERID", effecterId, "INSTANCE", instanceId, "RC", lg2::hex,
+            rc);
+
+        instanceIdDb->free(mctpEid, instanceId);
+        return rc;
+    }
+
+    auto setNumericEffecterRespHandler = [effecterId](mctp_eid_t /*eid*/,
+                                                      const pldm_msg* response,
+                                                      size_t respMsgLen) {
+        if (response == nullptr || !respMsgLen)
+        {
+            error(
+                "Failed to receive response for setNumericEffecterValue command");
+            return;
+        }
+        uint8_t completionCode{};
+        auto rc = decode_set_numeric_effecter_value_resp(response, respMsgLen,
+                                                         &completionCode);
+
+        if (rc)
+        {
+            error(
+                "Failed to decode set numeric effecter response message for effecter ID '{EFFECTERID}' with error code '{RC}'",
+                "EFFECTERID", effecterId, "RC", lg2::hex, rc);
+        }
+        if (completionCode)
+        {
+            error(
+                "Failed to set numeric effecter for effecter ID '{EFFECTERID}' with complete code '{CC}'",
+                "EFFECTERID", effecterId, "CC", lg2::hex, completionCode);
+        }
+    };
+
+    rc = handler->registerRequest(
+        mctpEid, instanceId, PLDM_PLATFORM, PLDM_SET_NUMERIC_EFFECTER_VALUE,
+        std::move(requestMsg), std::move(setNumericEffecterRespHandler));
+    if (rc)
+    {
+        error("Failed to send request to set an effecter on Host");
+    }
+    return rc;
+}
+
+int HostEffecterParser::setHostStateEffecter(
+    size_t effecterInfoIndex, std::vector<set_effecter_state_field>& stateField,
+    uint16_t effecterId)
+{
+    std::string terminusName = hostEffecterInfo[effecterInfoIndex].terminusName;
+    uint8_t& mctpEid = hostEffecterInfo[effecterInfoIndex].mctpEid;
+    if (!terminusName.empty())
+    {
+        auto tmpEid = platformManager->getActiveEidByName(terminusName);
+        if (tmpEid)
+        {
+            mctpEid = tmpEid.value();
+        }
+    }
+
+    uint8_t& compEffCnt = hostEffecterInfo[effecterInfoIndex].compEffecterCnt;
+    auto instanceId = instanceIdDb->next(mctpEid);
+
+    std::vector<uint8_t> requestMsg(
+        sizeof(pldm_msg_hdr) + sizeof(effecterId) + sizeof(compEffCnt) +
+            sizeof(set_effecter_state_field) * compEffCnt,
+        0);
+    auto request = new (requestMsg.data()) pldm_msg;
+    auto rc = encode_set_state_effecter_states_req(
+        instanceId, effecterId, compEffCnt, stateField.data(), request);
+
+    if (rc != PLDM_SUCCESS)
+    {
+        error(
+            "Failed to encode set state effecter states message for effecter ID '{EFFECTERID}' and instanceID '{INSTANCE}' with response code '{RC}'",
+            "EFFECTERID", effecterId, "INSTANCE", instanceId, "RC", lg2::hex,
+            rc);
+        instanceIdDb->free(mctpEid, instanceId);
+        return rc;
+    }
+
+    auto setStateEffecterStatesRespHandler = [](mctp_eid_t /*eid*/,
+                                                const pldm_msg* response,
+                                                size_t respMsgLen) {
+        if (response == nullptr || !respMsgLen)
+        {
+            error(
+                "Failed to receive response for setting state effecter states.");
+            return;
+        }
+        uint8_t completionCode{};
+        auto rc = decode_set_state_effecter_states_resp(response, respMsgLen,
+                                                        &completionCode);
+        if (rc)
+        {
+            error(
+                "Failed to decode response of set state effecter states, response code '{RC}'",
+                "RC", rc);
+            pldm::utils::reportError(
+                "xyz.openbmc_project.bmc.pldm.SetHostEffecterFailed");
+        }
+        if (completionCode)
+        {
+            error(
+                "Failed to set a remote terminus effecter, completion code '{CC}'",
+                "CC", completionCode);
+            pldm::utils::reportError(
+                "xyz.openbmc_project.bmc.pldm.SetHostEffecterFailed");
+        }
+    };
+
+    rc = handler->registerRequest(
+        mctpEid, instanceId, PLDM_PLATFORM, PLDM_SET_STATE_EFFECTER_STATES,
+        std::move(requestMsg), std::move(setStateEffecterStatesRespHandler));
+    if (rc)
+    {
+        error(
+            "Failed to send request to set an effecter on remote terminus for effecter ID '{EFFECTERID}', response code '{RC}'",
+            "EFFECTERID", effecterId, "RC", rc);
+    }
+    return rc;
+}
+
+void HostEffecterParser::createHostEffecterMatch(
+    const std::string& objectPath, const std::string& interface,
+    size_t effecterInfoIndex, size_t dbusInfoIndex, uint16_t effecterId)
+{
+    using namespace sdbusplus::bus::match::rules;
+    effecterInfoMatch.emplace_back(std::make_unique<sdbusplus::bus::match_t>(
+        pldm::utils::DBusHandler::getBus(),
+        propertiesChanged(objectPath, interface),
+        [this, effecterInfoIndex, dbusInfoIndex,
+         effecterId](sdbusplus::message_t& msg) {
+            DbusChgHostEffecterProps props;
+            std::string iface;
+            msg.read(iface, props);
+            processHostEffecterChangeNotification(props, effecterInfoIndex,
+                                                  dbusInfoIndex, effecterId);
+        }));
+}
+
+} // namespace host_effecters
+} // namespace pldm
diff --git a/platform-mc/dbus_to_terminus_effecters.hpp b/platform-mc/dbus_to_terminus_effecters.hpp
new file mode 100644
index 0000000..962865c
--- /dev/null
+++ b/platform-mc/dbus_to_terminus_effecters.hpp
@@ -0,0 +1,258 @@
+#pragma once
+
+#include "common/instance_id.hpp"
+#include "common/types.hpp"
+#include "common/utils.hpp"
+#include "platform-mc/manager.hpp"
+#include "requester/handler.hpp"
+
+#include <phosphor-logging/lg2.hpp>
+
+#include <string>
+#include <utility>
+#include <vector>
+
+PHOSPHOR_LOG2_USING;
+
+namespace pldm
+{
+
+namespace host_effecters
+{
+
+using DbusChgHostEffecterProps =
+    std::map<dbus::Property, pldm::utils::PropertyValue>;
+
+/** @struct State
+ *  Contains the state set id and the possible states for
+ *  an effecter
+ */
+struct PossibleState
+{
+    uint16_t stateSetId;         //!< State set id
+    std::vector<uint8_t> states; //!< Possible states
+};
+
+/** @struct DBusEffecterMapping
+ *  Contains the D-Bus information for an effecter
+ */
+struct DBusEffecterMapping
+{
+    pldm::utils::DBusMapping dbusMap;
+    std::vector<pldm::utils::PropertyValue>
+        propertyValues;  //!< D-Bus property values
+    PossibleState state; //!< Corresponding effecter states
+};
+
+/** @struct DBusEffecterMapping
+ *  Contains the D-Bus information for an effecter
+ */
+struct DBusNumericEffecterMapping
+{
+    pldm::utils::DBusMapping dbusMap;
+    uint8_t dataSize;     //!< Numeric effecter PDR data size
+    double resolution;    //!< Numeric effecter PDR resolution
+    double offset;        //!< Numeric effecter PDR offset
+    int8_t unitModifier;  //!< Numeric effecter PDR unitModifier
+    double propertyValue; //!< D-Bus property values
+};
+
+/** @struct EffecterInfo
+ *  Contains the effecter information as a whole
+ */
+struct EffecterInfo
+{
+    uint8_t mctpEid;             //!< Host mctp eid
+    std::string terminusName;    //!< Terminus name
+    uint8_t effecterPdrType;     //!< Effecter PDR type state/numeric
+    uint16_t containerId;        //!< Container Id for host effecter
+    uint16_t entityType;         //!< Entity type for the host effecter
+    uint16_t entityInstance;     //!< Entity instance for the host effecter
+    uint8_t compEffecterCnt;     //!< Composite effecter count
+    bool checkHostState;         //!< Check host state before setting effecter
+    std::vector<DBusEffecterMapping>
+        dbusInfo;                //!< D-Bus information for the effecter id
+    std::vector<DBusNumericEffecterMapping>
+        dbusNumericEffecterInfo; //!< D-Bus information for the effecter id
+};
+
+/** @class HostEffecterParser
+ *
+ *  @brief This class parses the Host Effecter json file and monitors for the
+ *         D-Bus changes for the effecters. Upon change, calls the corresponding
+ *         setStateEffecterStates on the host
+ */
+class HostEffecterParser
+{
+  public:
+    HostEffecterParser() = delete;
+    HostEffecterParser(const HostEffecterParser&) = delete;
+    HostEffecterParser& operator=(const HostEffecterParser&) = delete;
+    HostEffecterParser(HostEffecterParser&&) = delete;
+    HostEffecterParser& operator=(HostEffecterParser&&) = delete;
+    virtual ~HostEffecterParser() = default;
+
+    /** @brief Constructor to create a HostEffecterParser object.
+     *  @param[in] instanceIdDb - PLDM InstanceIdDb object pointer
+     *  @param[in] fd - socket fd to communicate to host
+     *  @param[in] repo -  PLDM PDR repository
+     *  @param[in] dbusHandler - D-bus Handler
+     *  @param[in] jsonPath - path for the json file
+     *  @param[in] handler - PLDM request handler
+     */
+    explicit HostEffecterParser(
+        pldm::InstanceIdDb* instanceIdDb, int fd, const pldm_pdr* repo,
+        pldm::utils::DBusHandler* const dbusHandler,
+        const std::string& jsonPath,
+        pldm::requester::Handler<pldm::requester::Request>* handler,
+        platform_mc::Manager* platformManager) :
+        instanceIdDb(instanceIdDb), sockFd(fd), pdrRepo(repo),
+        dbusHandler(dbusHandler), handler(handler),
+        platformManager(platformManager)
+    {
+        try
+        {
+            parseEffecterJson(jsonPath);
+        }
+        catch (const std::exception& e)
+        {
+            error(
+                "The json file '{PATH}' does not exist or malformed, error - '{ERROR}'",
+                "PATH", jsonPath, "ERROR", e);
+        }
+    }
+
+    /* @brief Parses the host effecter json
+     *
+     * @param[in] jsonPath - path for the json file
+     */
+    void parseEffecterJson(const std::string& jsonPath);
+
+    /* @brief Method to take action when the subscribed D-Bus property is
+     *        changed
+     * @param[in] chProperties - list of properties which have changed
+     * @param[in] effecterInfoIndex - index of effecterInfo pointer in
+     *                                hostEffecterInfo
+     * @param[in] dbusInfoIndex - index on dbusInfo pointer in each effecterInfo
+     * @param[in] effecterId - host effecter id
+     * @return - none
+     */
+    void processHostEffecterChangeNotification(
+        const DbusChgHostEffecterProps& chProperties, size_t effecterInfoIndex,
+        size_t dbusInfoIndex, uint16_t effecterId);
+
+    /* @brief Method to take action when the subscribed D-Bus property is
+     *        changed
+     * @param[in] chProperties - list of properties which have changed
+     * @param[in] effecterInfoIndex - index of effecterInfo pointer in
+     *                                hostEffecterInfo
+     * @param[in] dbusInfoIndex - index on dbusInfo pointer in each effecterInfo
+
+     * @param[in] effecterId - terminus numeric effecter id
+     * @return - none
+     */
+    void processTerminusNumericEffecterChangeNotification(
+        const DbusChgHostEffecterProps& chProperties, size_t effecterInfoIndex,
+        size_t dbusInfoIndex, uint16_t effecterId);
+
+    /* @brief Populate the property values in each dbusInfo from the json
+     *
+     * @param[in] dBusValues - json values
+     * @param[out] propertyValues - dbusInfo property values
+     * @param[in] propertyType - type of the D-Bus property
+     * @return - none
+     */
+    void populatePropVals(
+        const pldm::utils::Json& dBusValues,
+        std::vector<pldm::utils::PropertyValue>& propertyValues,
+        const std::string& propertyType);
+
+    /* @brief Set a host state effecter
+     *
+     * @param[in] effecterInfoIndex - index of effecterInfo pointer in
+     *                                hostEffecterInfo
+     * @param[in] stateField - vector of state fields equal to composite
+     *                         effecter count in number
+     * @param[in] effecterId - host effecter id
+     * @return - PLDM status code
+     */
+    virtual int setHostStateEffecter(
+        size_t effecterInfoIndex,
+        std::vector<set_effecter_state_field>& stateField, uint16_t effecterId);
+
+    /* @brief Set a terminus numeric effecter
+     *
+     * @param[in] effecterInfoIndex - index of effecterInfo pointer in
+     *                                hostEffecterInfo
+     * @param[in] effecterId - host effecter id
+     * @param[in] dataSize - data size
+     * @param[in] rawValue - raw value
+     * @return - PLDM status code
+     */
+    virtual int setTerminusNumericEffecter(size_t effecterInfoIndex,
+                                           uint16_t effecterId,
+                                           uint8_t dataSize, double rawValue);
+
+    /* @brief Fetches the new state value and the index in stateField set which
+     *        needs to be set with the new value in the setStateEffecter call
+     * @param[in] effecterInfoIndex - index of effecterInfo in hostEffecterInfo
+     * @param[in] dbusInfoIndex - index of dbusInfo within effecterInfo
+     * @param[in] propertyValue - the changed D-Bus property value
+     * @return - the new state value
+     */
+    uint8_t findNewStateValue(size_t effecterInfoIndex, size_t dbusInfoIndex,
+                              const pldm::utils::PropertyValue& propertyValue);
+
+    /* @brief Subscribes for D-Bus property change signal on the specified
+     *        object
+     *
+     * @param[in] objectPath - D-Bus object path to look for
+     * @param[in] interface - D-Bus interface
+     * @param[in] effecterInfoIndex - index of effecterInfo pointer in
+     *                                hostEffecterInfo
+     * @param[in] dbusInfoIndex - index of dbusInfo within effecterInfo
+     * @param[in] effecterId - host effecter id
+     */
+    virtual void createHostEffecterMatch(
+        const std::string& objectPath, const std::string& interface,
+        size_t effecterInfoIndex, size_t dbusInfoIndex, uint16_t effecterId);
+
+    /* @brief Adjust the numeric effecter value base on the effecter
+     *        configurations
+     *
+     * @param[in] value - Raw value
+     * @param[in] offset - offset config
+     * @param[in] resolution - resolution config
+     * @param[in] modify - modify config
+     *
+     * @return - Value of effecter
+     */
+    double adjustValue(double value, double offset, double resolution,
+                       int8_t modify);
+
+  private:
+    /* @brief Verify host On state before configure the host effecters
+     *
+     * @return - true if host is on and false for others cases
+     */
+    bool isHostOn(void);
+
+  protected:
+    pldm::InstanceIdDb* instanceIdDb; //!< Reference to the InstanceIdDb object
+                                      //!< to obtain instance id
+    int sockFd;                       //!< Socket fd to send message to host
+    const pldm_pdr* pdrRepo;          //!< Reference to PDR repo
+    std::vector<EffecterInfo> hostEffecterInfo; //!< Parsed effecter information
+    std::vector<std::unique_ptr<sdbusplus::bus::match_t>>
+        effecterInfoMatch; //!< vector to catch the D-Bus property change
+                           //!< signals for the effecters
+    const pldm::utils::DBusHandler* dbusHandler; //!< D-bus Handler
+    /** @brief PLDM request handler */
+    pldm::requester::Handler<pldm::requester::Request>* handler;
+
+    /** @brief MC Platform manager*/
+    platform_mc::Manager* platformManager = nullptr;
+};
+
+} // namespace host_effecters
+} // namespace pldm
diff --git a/platform-mc/test/dbus_to_terminus_effecter_test.cpp b/platform-mc/test/dbus_to_terminus_effecter_test.cpp
new file mode 100644
index 0000000..e6fcd43
--- /dev/null
+++ b/platform-mc/test/dbus_to_terminus_effecter_test.cpp
@@ -0,0 +1,144 @@
+#include "common/test/mocked_utils.hpp"
+#include "common/utils.hpp"
+#include "platform-mc/dbus_to_terminus_effecters.hpp"
+
+#include <nlohmann/json.hpp>
+
+#include <gtest/gtest.h>
+
+using namespace pldm::host_effecters;
+using namespace pldm::utils;
+
+class MockHostEffecterParser : public HostEffecterParser
+{
+  public:
+    MockHostEffecterParser(int fd, const pldm_pdr* repo,
+                           DBusHandler* const dbusHandler,
+                           const std::string& jsonPath) :
+        HostEffecterParser(nullptr, fd, repo, dbusHandler, jsonPath, nullptr,
+                           nullptr)
+    {}
+
+    MOCK_METHOD(int, setHostStateEffecter,
+                (size_t, std::vector<set_effecter_state_field>&, uint16_t),
+                (override));
+
+    MOCK_METHOD(void, createHostEffecterMatch,
+                (const std::string&, const std::string&, size_t, size_t,
+                 uint16_t),
+                (override));
+
+    const std::vector<EffecterInfo>& gethostEffecterInfo()
+    {
+        return hostEffecterInfo;
+    }
+};
+
+TEST(HostEffecterParser, parseEffecterJsonGoodPath)
+{
+    MockdBusHandler dbusHandler;
+    int sockfd{};
+    MockHostEffecterParser hostEffecterParserGood(sockfd, nullptr, &dbusHandler,
+                                                  "./host_effecter_jsons/good");
+    auto hostEffecterInfo = hostEffecterParserGood.gethostEffecterInfo();
+    ASSERT_EQ(hostEffecterInfo.size(), 2);
+    ASSERT_EQ(hostEffecterInfo[0].effecterPdrType, PLDM_STATE_EFFECTER_PDR);
+    ASSERT_EQ(hostEffecterInfo[0].entityInstance, 0);
+    ASSERT_EQ(hostEffecterInfo[0].entityType, 33);
+    ASSERT_EQ(hostEffecterInfo[0].dbusInfo.size(), 1);
+    ASSERT_EQ(hostEffecterInfo[0].checkHostState, true);
+    DBusEffecterMapping dbusInfo{
+        {"/xyz/openbmc_project/control/host0/boot",
+         "xyz.openbmc_project.Control.Boot.Mode", "BootMode", "string"},
+        {"xyz.openbmc_project.Control.Boot.Mode.Modes.Regular"},
+        {196, {2}}};
+    auto& temp = hostEffecterInfo[0].dbusInfo[0];
+    ASSERT_EQ(temp.dbusMap.objectPath == dbusInfo.dbusMap.objectPath, true);
+    ASSERT_EQ(temp.dbusMap.interface == dbusInfo.dbusMap.interface, true);
+    ASSERT_EQ(temp.dbusMap.propertyName == dbusInfo.dbusMap.propertyName, true);
+    ASSERT_EQ(temp.dbusMap.propertyType == dbusInfo.dbusMap.propertyType, true);
+
+    /* Check Numeric Effecter in Good Json file */
+    ASSERT_EQ(hostEffecterInfo[1].effecterPdrType, PLDM_NUMERIC_EFFECTER_PDR);
+    ASSERT_EQ(hostEffecterInfo[1].entityType, 32903);
+    ASSERT_EQ(hostEffecterInfo[1].entityInstance, 6);
+    ASSERT_EQ(hostEffecterInfo[1].containerId, 4);
+    ASSERT_EQ(hostEffecterInfo[1].dbusNumericEffecterInfo.size(), 1);
+    ASSERT_EQ(hostEffecterInfo[1].checkHostState, false);
+    DBusNumericEffecterMapping dbusInfoNumeric{
+        {"/xyz/openbmc_project/effecters/power/PLimit",
+         "xyz.openbmc_project.Effecter.Value", "Value", "double"},
+        5,
+        1,
+        0,
+        -3,
+        100};
+    auto& tempNumeric = hostEffecterInfo[1].dbusNumericEffecterInfo[0];
+    ASSERT_EQ(tempNumeric.dbusMap.objectPath ==
+                  dbusInfoNumeric.dbusMap.objectPath,
+              true);
+    ASSERT_EQ(tempNumeric.dbusMap.interface ==
+                  dbusInfoNumeric.dbusMap.interface,
+              true);
+    ASSERT_EQ(tempNumeric.dbusMap.propertyName ==
+                  dbusInfoNumeric.dbusMap.propertyName,
+              true);
+    ASSERT_EQ(tempNumeric.dbusMap.propertyType ==
+                  dbusInfoNumeric.dbusMap.propertyType,
+              true);
+    ASSERT_EQ(tempNumeric.dataSize == dbusInfoNumeric.dataSize, true);
+    ASSERT_EQ(tempNumeric.resolution == dbusInfoNumeric.resolution, true);
+    ASSERT_EQ(tempNumeric.offset == dbusInfoNumeric.offset, true);
+    ASSERT_EQ(tempNumeric.unitModifier == dbusInfoNumeric.unitModifier, true);
+}
+
+TEST(HostEffecterParser, parseEffecterJsonBadPath)
+{
+    MockdBusHandler dbusHandler;
+    int sockfd{};
+    MockHostEffecterParser hostEffecterParser(sockfd, nullptr, &dbusHandler,
+                                              "./host_effecter_jsons/no_json");
+    ASSERT_THROW(
+        hostEffecterParser.parseEffecterJson("./host_effecter_jsons/no_json"),
+        std::exception);
+    ASSERT_THROW(
+        hostEffecterParser.parseEffecterJson("./host_effecter_jsons/malformed"),
+        std::exception);
+}
+
+TEST(HostEffecterParser, findNewStateValue)
+{
+    MockdBusHandler dbusHandler;
+    int sockfd{};
+    MockHostEffecterParser hostEffecterParser(sockfd, nullptr, &dbusHandler,
+                                              "./host_effecter_jsons/good");
+
+    PropertyValue val1{std::in_place_type<std::string>,
+                       "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular"};
+    PropertyValue val2{std::in_place_type<std::string>,
+                       "xyz.openbmc_project.Control.Boot.Mode.Modes.Setup"};
+    auto newState = hostEffecterParser.findNewStateValue(0, 0, val1);
+    ASSERT_EQ(newState, 2);
+
+    ASSERT_THROW(hostEffecterParser.findNewStateValue(0, 0, val2),
+                 std::exception);
+}
+
+TEST(HostEffecterParser, adjustValue)
+{
+    MockdBusHandler dbusHandler;
+    int sockfd{};
+    MockHostEffecterParser hostEffecterParser(sockfd, nullptr, &dbusHandler,
+                                              "./host_effecter_jsons/good");
+
+    auto realVal = hostEffecterParser.adjustValue(200, -50, 0.5, -2);
+    ASSERT_EQ(realVal, 12500);
+    realVal = hostEffecterParser.adjustValue(0, -50, 1, 0);
+    ASSERT_EQ(realVal, 50);
+    realVal = hostEffecterParser.adjustValue(0, 100, 1, -1);
+    ASSERT_EQ(realVal, -1000);
+    realVal = hostEffecterParser.adjustValue(2.34, 0, 1, -1);
+    ASSERT_EQ(realVal, 23);
+    realVal = hostEffecterParser.adjustValue(2.35, 0, 1, -1);
+    ASSERT_EQ(realVal, 24);
+}
diff --git a/platform-mc/test/host_effecter_jsons/good/dbus_to_terminus_effecter.json b/platform-mc/test/host_effecter_jsons/good/dbus_to_terminus_effecter.json
new file mode 100644
index 0000000..2bc789a
--- /dev/null
+++ b/platform-mc/test/host_effecter_jsons/good/dbus_to_terminus_effecter.json
@@ -0,0 +1,57 @@
+{
+    "entries": [
+        {
+            "mctp_eid": 9,
+            "effecter_info": {
+                "effecterID": 4,
+                "containerID": 0,
+                "entityType": 33,
+                "entityInstance": 0,
+                "compositeEffecterCount": 1
+            },
+            "effecters": [
+                {
+                    "dbus_info": {
+                        "object_path": "/xyz/openbmc_project/control/host0/boot",
+                        "interface": "xyz.openbmc_project.Control.Boot.Mode",
+                        "property_name": "BootMode",
+                        "property_type": "string",
+                        "property_values": [
+                            "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular"
+                        ]
+                    },
+                    "state": {
+                        "id": 196,
+                        "state_values": [2]
+                    }
+                }
+            ]
+        },
+        {
+            "mctp_eid": 20,
+            "effecter_info": {
+                "effecterPdrType": 9,
+                "effecterID": 155,
+                "entityType": 32903,
+                "entityInstance": 6,
+                "containerID": 4,
+                "compositeEffecterCount": 1,
+                "checkHostState": false
+            },
+            "effecters": [
+                {
+                    "dbus_info": {
+                        "object_path": "/xyz/openbmc_project/effecters/power/PLimit",
+                        "interface": "xyz.openbmc_project.Effecter.Value",
+                        "property_name": "Value",
+                        "property_type": "double"
+                    },
+                    "effecterDataSize": 5,
+                    "resolution": 1,
+                    "offset": 0,
+                    "unitModifier": -3
+                }
+            ]
+        }
+    ]
+}
diff --git a/platform-mc/test/host_effecter_jsons/malformed/dbus_to_terminus_effecter.json b/platform-mc/test/host_effecter_jsons/malformed/dbus_to_terminus_effecter.json
new file mode 100644
index 0000000..9db2505
--- /dev/null
+++ b/platform-mc/test/host_effecter_jsons/malformed/dbus_to_terminus_effecter.json
@@ -0,0 +1,10 @@
+"effecters": [
+    {
+        "dbus_info": {
+            "object_path": "/xyz/openbmc_project/control/host0/boot",
+            "interface": "xyz.openbmc_project.Control.Boot.Mode",
+            "property_values": [
+                "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular"
+                ]
+        }
+        ]
diff --git a/platform-mc/test/host_effecter_jsons/no_json/dummy.json b/platform-mc/test/host_effecter_jsons/no_json/dummy.json
new file mode 100644
index 0000000..401832d
--- /dev/null
+++ b/platform-mc/test/host_effecter_jsons/no_json/dummy.json
@@ -0,0 +1,5 @@
+"record_details":
+   {
+       "fru_record_type" : 1,
+       "encoding_type": 1
+    }
diff --git a/platform-mc/test/meson.build b/platform-mc/test/meson.build
index e8ea6b7..2d722e9 100644
--- a/platform-mc/test/meson.build
+++ b/platform-mc/test/meson.build
@@ -8,6 +8,7 @@
         '../sensor_manager.cpp',
         '../numeric_sensor.cpp',
         '../event_manager.cpp',
+        '../dbus_to_terminus_effecters.cpp',
         '../../requester/mctp_endpoint_discovery.cpp',
     ],
     include_directories: ['../../requester', '../../pldmd'],
@@ -20,6 +21,7 @@
     'sensor_manager_test',
     'numeric_sensor_test',
     'event_manager_test',
+    'dbus_to_terminus_effecter_test',
 ]
 
 foreach t : tests