phosphor-rsyslog-conf: implement restore

Upon startup, if a remote logging config exists, relay that information
into appropriate D-Bus properties.

Change-Id: Ib873667a50f0c8a6af6a3b571f68d6075808ed10
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/phosphor-rsyslog-config/server-conf.hpp b/phosphor-rsyslog-config/server-conf.hpp
index 795cfb6..0f67f30 100644
--- a/phosphor-rsyslog-config/server-conf.hpp
+++ b/phosphor-rsyslog-config/server-conf.hpp
@@ -3,6 +3,7 @@
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
 #include <string>
+#include <phosphor-logging/log.hpp>
 #include "xyz/openbmc_project/Network/Client/server.hpp"
 
 namespace phosphor
@@ -10,6 +11,7 @@
 namespace rsyslog_config
 {
 
+using namespace phosphor::logging;
 using NetworkClient = sdbusplus::xyz::openbmc_project::Network::server::Client;
 using Iface = sdbusplus::server::object::object<NetworkClient>;
 
@@ -37,9 +39,19 @@
         Server(sdbusplus::bus::bus& bus,
                const std::string& path,
                const char* filePath) :
-            Iface(bus, path.c_str()),
+            Iface(bus, path.c_str(), true),
             configFilePath(filePath)
         {
+            try
+            {
+                restore(configFilePath.c_str());
+            }
+            catch(const std::exception& e)
+            {
+                log<level::ERR>(e.what());
+            }
+
+            emit_object_added();
         }
 
         using NetworkClient::address;
@@ -75,6 +87,11 @@
          */
         bool addressValid(const std::string& address);
 
+        /** @brief Populate existing config into D-Bus properties
+         *  @param[in] filePath - rsyslog config file path
+         */
+        void restore(const char* filePath);
+
         std::string configFilePath{};
 };