Avoid populating StaticNameServers property
Redfish ethernet schema has two properties for nameservers
1.NameServers - Represents nameservers currently in use on Interface
2.StaticNameServers -Represents only statically defined set of DNS
As we have only one DBUS property `Nameservers` which is used for both
the static and dynamic nameservers, So the idea behind this commit is
to not populate the StaticnameServers property when DHCP mode is
enabled.
Tested By:
GET https://${BMC_IP}/redfish/v1/Managers/bmc/EthernetInterfaces/eth0
Signed-off-by: Manojkiran Eda <manojkiran.eda@gmail.com>
Change-Id: I64f66bde55ec41dc78befbb659a0cbc425bbc24b
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 7932210..17b953b 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1539,7 +1539,15 @@
iface_id + "/VLANs"}};
json_response["NameServers"] = ethData.nameservers;
- json_response["StaticNameServers"] = ethData.nameservers;
+
+ if (!ethData.DHCPEnabled)
+ {
+ json_response["StaticNameServers"] = ethData.nameservers;
+ }
+ else
+ {
+ json_response["StaticNameServers"] = {};
+ }
nlohmann::json &ipv4_array = json_response["IPv4Addresses"];
ipv4_array = nlohmann::json::array();