summaryrefslogtreecommitdiff
path: root/redfish-core/lib/ethernet.hpp
diff options
context:
space:
mode:
authormanojkiran.eda@gmail.com <manojeda@in.ibm.com>2019-10-03 12:53:44 +0300
committerRatan Gupta <ratagupt@linux.vnet.ibm.com>2020-04-09 08:54:15 +0300
commit0f6efdc1a0c919ffdfc00b2ff8af0929652483dc (patch)
treea4abf4c4afcadf2f0b71dfd578c300ea4c6c4dd8 /redfish-core/lib/ethernet.hpp
parent734a1c37e7768176ece2411354c10a52ac8d1c09 (diff)
downloadbmcweb-0f6efdc1a0c919ffdfc00b2ff8af0929652483dc.tar.xz
Support for NameServers & StaticNameServers
- As per the proposal made in the mentioned mailing list thread https://lists.ozlabs.org/pipermail/openbmc/2019-September/018399.html As mentioined in the proposal, it is agreed that configuring the Nameservers by the DHCP server is an optional step, and therefore the Static and Dynamic Configurations can co-exist. The commit supports : 1. NameServers - A readonly property which contains all the nameservers (Static & Dynamic) configured on an interface. 2. StaticNameServers - A writable property which can be used by a redfish client to set a NameServer(Static) on the interface. TestedBy: 1. Redfish Validator - PASS 2. Pass the DNS via DHCP Server and make sure we populate NameServers with the DNS supplied by DHCP. 3. With the DNS supplied via DHCP intact, set another Namserver by PATCH on the StaticNameServers property, and Made sure StaticNameServers and NameServers populates the respective information. 4. PATCH opteration on NameServers should throw an Error Saying it is a Readonly property. Signed-off-by: manojkiran.eda@gmail.com <manojeda@in.ibm.com> Change-Id: I43b75091cce6938ea2fa094692f2c3f434e5a774
Diffstat (limited to 'redfish-core/lib/ethernet.hpp')
-rw-r--r--redfish-core/lib/ethernet.hpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 56e1a1508b..bf5daed7b9 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -107,7 +107,8 @@ struct EthernetInterfaceData
std::string ipv6_default_gateway;
std::string mac_address;
std::vector<std::uint32_t> vlan_id;
- std::vector<std::string> nameservers;
+ std::vector<std::string> nameServers;
+ std::vector<std::string> staticNameServers;
std::vector<std::string> domainnames;
};
@@ -294,7 +295,19 @@ inline bool extractEthernetInterfaceData(const std::string &ethiface_id,
&propertyPair.second);
if (nameservers != nullptr)
{
- ethData.nameservers = std::move(*nameservers);
+ ethData.nameServers = std::move(*nameservers);
+ }
+ }
+ else if (propertyPair.first == "StaticNameServers")
+ {
+ const std::vector<std::string> *staticNameServers =
+ sdbusplus::message::variant_ns::get_if<
+ std::vector<std::string>>(
+ &propertyPair.second);
+ if (staticNameServers != nullptr)
+ {
+ ethData.staticNameServers =
+ std::move(*staticNameServers);
}
}
else if (propertyPair.first == "DHCPEnabled")
@@ -1606,7 +1619,8 @@ class EthernetInterface : public Node
"xyz.openbmc_project.Network",
"/xyz/openbmc_project/network/" + ifaceId,
"org.freedesktop.DBus.Properties", "Set",
- "xyz.openbmc_project.Network.EthernetInterface", "Nameservers",
+ "xyz.openbmc_project.Network.EthernetInterface",
+ "StaticNameServers",
std::variant<std::vector<std::string>>{updatedStaticNameServers});
}
@@ -1806,15 +1820,8 @@ class EthernetInterface : public Node
{"@odata.id", "/redfish/v1/Managers/bmc/EthernetInterfaces/" +
iface_id + "/VLANs"}};
- if (translateDHCPEnabledToBool(ethData.DHCPEnabled, true) &&
- ethData.DNSEnabled)
- {
- json_response["StaticNameServers"] = nlohmann::json::array();
- }
- else
- {
- json_response["StaticNameServers"] = ethData.nameservers;
- }
+ json_response["NameServers"] = ethData.nameServers;
+ json_response["StaticNameServers"] = ethData.staticNameServers;
nlohmann::json &ipv4_array = json_response["IPv4Addresses"];
nlohmann::json &ipv4_static_array =