NetworkProtocol: Support NetworkSuppliedServers property

There was no way to differentiate between the static and DHCP assigned
NTP servers. Networkd and Dbus has added support for StaticNTPServers to
save the static configuration.

PATCH command will now set the StaticNTPServers property at the backend.
NTPServers property will contain network supplied dynamic NTP Servers at
the system.

Tested by:
 1. PATCH /redfish/v1/Managers/bmc/NetworkProtocol -d
    '{"NTP":{"NTPServers": [<ip>]}}'
    Verify that this adds the NTPs server to the NetworkProtocol
 2. Enable DHCP to fetch NTP servers list from the DHCP server. Verify
    that they are listed when GET on NetworkProtocol as below
    "NTP": {
        "NTPServers": [
        <static ntp server ip>
      ],
      "NetworkSuppliedServers": [
        <dynamic ntp server ip>
      ],
      "ProtocolEnabled": true
    },
 3. Redfish validator run

Signed-off-by: sunharis <sunithaharish04@gmail.com>
Change-Id: Ifac77485485839292b770d36def35da17d723c4e
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index f99cfd3..de81e5c 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -46,7 +46,8 @@
 
 inline void extractNTPServersAndDomainNamesData(
     const dbus::utility::ManagedObjectType& dbusData,
-    std::vector<std::string>& ntpData, std::vector<std::string>& dnData)
+    std::vector<std::string>& ntpData, std::vector<std::string>& dynamicNtpData,
+    std::vector<std::string>& dnData)
 {
     for (const auto& obj : dbusData)
     {
@@ -60,7 +61,7 @@
 
             for (const auto& propertyPair : ifacePair.second)
             {
-                if (propertyPair.first == "NTPServers")
+                if (propertyPair.first == "StaticNTPServers")
                 {
                     const std::vector<std::string>* ntpServers =
                         std::get_if<std::vector<std::string>>(
@@ -70,6 +71,17 @@
                         ntpData = *ntpServers;
                     }
                 }
+                else if (propertyPair.first == "NTPServers")
+                {
+                    const std::vector<std::string>* dynamicNtpServers =
+                        std::get_if<std::vector<std::string>>(
+                            &propertyPair.second);
+                    if (dynamicNtpServers != nullptr)
+                    {
+                        dynamicNtpData = *dynamicNtpServers;
+                    }
+                }
+
                 else if (propertyPair.first == "DomainName")
                 {
                     const std::vector<std::string>* domainNames =
@@ -94,17 +106,19 @@
             const boost::system::error_code errorCode,
             const dbus::utility::ManagedObjectType& dbusData) {
         std::vector<std::string> ntpServers;
+        std::vector<std::string> dynamicNtpServers;
         std::vector<std::string> domainNames;
 
         if (errorCode)
         {
-            callback(false, ntpServers, domainNames);
+            callback(false, ntpServers, dynamicNtpServers, domainNames);
             return;
         }
 
-        extractNTPServersAndDomainNamesData(dbusData, ntpServers, domainNames);
+        extractNTPServersAndDomainNamesData(dbusData, ntpServers,
+                                            dynamicNtpServers, domainNames);
 
-        callback(true, ntpServers, domainNames);
+        callback(true, ntpServers, dynamicNtpServers, domainNames);
         },
         "xyz.openbmc_project.Network", "/xyz/openbmc_project/network",
         "org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
@@ -114,7 +128,7 @@
                            const crow::Request& req)
 {
     asyncResp->res.jsonValue["@odata.type"] =
-        "#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol";
+        "#ManagerNetworkProtocol.v1_9_0.ManagerNetworkProtocol";
     asyncResp->res.jsonValue["@odata.id"] =
         "/redfish/v1/Managers/bmc/NetworkProtocol";
     asyncResp->res.jsonValue["Id"] = "NetworkProtocol";
@@ -140,6 +154,7 @@
     getEthernetIfaceData(
         [hostName, asyncResp](const bool& success,
                               const std::vector<std::string>& ntpServers,
+                              const std::vector<std::string>& dynamicNtpServers,
                               const std::vector<std::string>& domainNames) {
         if (!success)
         {
@@ -148,6 +163,8 @@
             return;
         }
         asyncResp->res.jsonValue["NTP"]["NTPServers"] = ntpServers;
+        asyncResp->res.jsonValue["NTP"]["NetworkSuppliedServers"] =
+            dynamicNtpServers;
         if (!hostName.empty())
         {
             std::string fqdn = hostName;
@@ -349,7 +366,7 @@
                         }
                         },
                         service, objectPath, "org.freedesktop.DBus.Properties",
-                        "Set", interface, "NTPServers",
+                        "Set", interface, "StaticNTPServers",
                         dbus::utility::DbusVariantType{currentNtpServers});
                 }
             }
@@ -512,6 +529,7 @@
                 [asyncResp, ntpServerObjects](
                     const bool success,
                     std::vector<std::string>& currentNtpServers,
+                    std::vector<std::string>& /*dynamicNtpServers*/,
                     const std::vector<std::string>& /*domainNames*/) {
                 if (!success)
                 {