Redfish(Network): Implemented PATCH of Nameservers array
Testing:
"NameServers": [],
"NameServers@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The property NameServers is a read only property and cannot be assigned a value.",
"MessageArgs": [
"NameServers"
],
"MessageId": "Base.1.4.0.PropertyNotWritable",
"Resolution": "Remove the property from the request body and resubmit the request if the operation failed.",
"Severity": "Warning"
}
]
Change-Id: I12b8cb0ad9b8ad83371ee1d834f38e7537cc7b61
Signed-off-by: RAJESWARAN THILLAIGOVINDAN <rajeswgo@in.ibm.com>
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 0356b0c..f1ef23f 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1317,12 +1317,13 @@
std::optional<nlohmann::json> ipv4Addresses;
std::optional<nlohmann::json> ipv6Addresses;
std::optional<std::vector<std::string>> staticNameServers;
+ std::optional<std::vector<std::string>> nameServers;
if (!json_util::readJson(
req, res, "HostName", hostname, "IPv4Addresses", ipv4Addresses,
"IPv6Addresses", ipv6Addresses, "MACAddress", macAddress,
"StaticNameServers", staticNameServers, "IPv6DefaultGateway",
- ipv6DefaultGateway))
+ ipv6DefaultGateway, "NameServers", nameServers))
{
return;
}
@@ -1336,7 +1337,8 @@
ipv4Addresses = std::move(ipv4Addresses),
ipv6Addresses = std::move(ipv6Addresses),
ipv6DefaultGateway = std::move(ipv6DefaultGateway),
- staticNameServers = std::move(staticNameServers)](
+ staticNameServers = std::move(staticNameServers),
+ nameServers = std::move(nameServers)](
const bool &success, const EthernetInterfaceData ðData,
const boost::container::flat_set<IPv4AddressData> &ipv4Data) {
if (!success)
@@ -1374,6 +1376,13 @@
handleIPv4Patch(iface_id, ipv4, ipv4Data, asyncResp);
}
+ if (nameServers)
+ {
+ // Data.Permissions is read-only
+ messages::propertyNotWritable(asyncResp->res,
+ "NameServers");
+ }
+
if (ipv6Addresses)
{
// TODO(kkowalsk) IPv6 Not supported on D-Bus yet