diff --git a/chassishandler.cpp b/chassishandler.cpp
index d4ce0e4..4b42b3c 100644
--- a/chassishandler.cpp
+++ b/chassishandler.cpp
@@ -88,7 +88,6 @@
 // Service name should be referenced by connection name got via object mapper
 const char* settings_object_name = "/org/openbmc/settings/host0";
 const char* settings_intf_name = "org.freedesktop.DBus.Properties";
-const char* host_intf_name = "org.openbmc.settings.Host";
 const char* identify_led_object_name =
     "/xyz/openbmc_project/led/groups/enclosure_identify";
 
@@ -179,139 +178,6 @@
 
 } // namespace poh
 
-// TODO : Can remove the below function as we have
-//       new functions which uses sdbusplus.
-//
-//       openbmc/openbmc#1489
-int dbus_get_property(const char* name, char** buf)
-{
-    sd_bus_error error = SD_BUS_ERROR_NULL;
-    sd_bus_message* m = NULL;
-    sd_bus* bus = NULL;
-    char* temp_buf = NULL;
-    char* connection = NULL;
-    int r;
-
-    // Get the system bus where most system services are provided.
-    bus = ipmid_get_sd_bus_connection();
-
-    r = mapper_get_service(bus, settings_object_name, &connection);
-    if (r < 0)
-    {
-        log<level::ERR>("Failed to get connection",
-                        entry("OBJ_NAME=%s", settings_object_name),
-                        entry("ERRNO=0x%X", -r));
-        goto finish;
-    }
-
-    /*
-     * Bus, service, object path, interface and method are provided to call
-     * the method.
-     * Signatures and input arguments are provided by the arguments at the
-     * end.
-     */
-    r = sd_bus_call_method(bus, connection,      /* service to contact */
-                           settings_object_name, /* object path */
-                           settings_intf_name,   /* interface name */
-                           "Get",                /* method name */
-                           &error,               /* object to return error in */
-                           &m,                   /* return message on success */
-                           "ss",                 /* input signature */
-                           host_intf_name,       /* first argument */
-                           name);                /* second argument */
-
-    if (r < 0)
-    {
-        log<level::ERR>("Failed to issue Get method call",
-                        entry("ERRNO=0x%X", r));
-        goto finish;
-    }
-
-    /*
-     * The output should be parsed exactly the same as the output formatting
-     * specified.
-     */
-    r = sd_bus_message_read(m, "v", "s", &temp_buf);
-    if (r < 0)
-    {
-        log<level::ERR>("Failed to parse response message",
-                        entry("ERRNO=0x%X", -r));
-        goto finish;
-    }
-
-    *buf = strdup(temp_buf);
-    /*    *buf = (char*) malloc(strlen(temp_buf));
-    if (*buf) {
-        strcpy(*buf, temp_buf);
-    }
-     */
-
-finish:
-    sd_bus_error_free(&error);
-    sd_bus_message_unref(m);
-    free(connection);
-
-    return r;
-}
-
-// TODO : Can remove the below function as we have
-//       new functions which uses sdbusplus.
-//
-//       openbmc/openbmc#1489
-
-int dbus_set_property(const char* name, const char* value)
-{
-    sd_bus_error error = SD_BUS_ERROR_NULL;
-    sd_bus_message* m = NULL;
-    sd_bus* bus = NULL;
-    char* connection = NULL;
-    int r;
-
-    // Get the system bus where most system services are provided.
-    bus = ipmid_get_sd_bus_connection();
-
-    r = mapper_get_service(bus, settings_object_name, &connection);
-    if (r < 0)
-    {
-        log<level::ERR>("Failed to get connection",
-                        entry("OBJ_NAME=%s", settings_object_name),
-                        entry("ERRNO=0x%X", -r));
-        goto finish;
-    }
-
-    /*
-     * Bus, service, object path, interface and method are provided to call
-     * the method.
-     * Signatures and input arguments are provided by the arguments at the
-     * end.
-     */
-    r = sd_bus_call_method(bus, connection,      /* service to contact */
-                           settings_object_name, /* object path */
-                           settings_intf_name,   /* interface name */
-                           "Set",                /* method name */
-                           &error,               /* object to return error in */
-                           &m,                   /* return message on success */
-                           "ssv",                /* input signature */
-                           host_intf_name,       /* first argument */
-                           name,                 /* second argument */
-                           "s",                  /* third argument */
-                           value);               /* fourth argument */
-
-    if (r < 0)
-    {
-        log<level::ERR>("Failed to issue Set method call",
-                        entry("ERRNO=0x%X", r));
-        goto finish;
-    }
-
-finish:
-    sd_bus_error_free(&error);
-    sd_bus_message_unref(m);
-    free(connection);
-
-    return r;
-}
-
 struct get_sys_boot_options_t
 {
     uint8_t parameter;
