Get DHCP configuration values form n/w config file while creating
DHCP config object.

Each time when we update config file we recreate DHCP config object,
with existing code DHCP configuration values are getting initialized
to default values.
With these changes we get DHCP configuration values from n/w config.

Resolves openbmc/openbmc#2891

Change-Id: I95d50d52a8aa569493739a46b88e4a378e399698
Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
diff --git a/dhcp_configuration.hpp b/dhcp_configuration.hpp
index a550077..5db88e9 100644
--- a/dhcp_configuration.hpp
+++ b/dhcp_configuration.hpp
@@ -3,6 +3,7 @@
 #include "xyz/openbmc_project/Network/DHCPConfiguration/server.hpp"
 #include <sdbusplus/bus.hpp>
 #include <sdbusplus/server/object.hpp>
+#include "config_parser.hpp"
 
 #include <string>
 
@@ -50,13 +51,10 @@
             bus(bus),
             manager(parent)
         {
-            // systemd default behaviour is following fields should be
-            // enabled by default.
-
-            ConfigIntf::dNSEnabled(true);
-            ConfigIntf::nTPEnabled(true);
-            ConfigIntf::hostNameEnabled(true);
-            ConfigIntf::sendHostNameEnabled(true);
+            ConfigIntf::dNSEnabled(getDHCPPropFromConf("UseDNS"));
+            ConfigIntf::nTPEnabled(getDHCPPropFromConf("UseNTP"));
+            ConfigIntf::hostNameEnabled(getDHCPPropFromConf("UseHostname"));
+            ConfigIntf::sendHostNameEnabled(getDHCPPropFromConf("SendHostname"));
             emit_object_added();
         }
 
@@ -90,6 +88,11 @@
          */
         bool sendHostNameEnabled(bool value) override;
 
+        /** @brief read the DHCP Prop value from the configuration file
+         *  @param[in] prop - DHCP Prop name.
+         */
+        bool getDHCPPropFromConf(const std::string& prop);
+
         /* @brief Network Manager needed the below function to know the
          *        value of the properties (ntpEnabled,dnsEnabled,hostnameEnabled
                   sendHostNameEnabled).