From 9474b3788017bddd70e493e2b9b7674be30abc87 Mon Sep 17 00:00:00 2001 From: Ratan Gupta Date: Fri, 1 Mar 2019 15:13:37 +0530 Subject: Redfish(Network): Allow empty list item for ipv4 address. Tested by: Assuming there are two IP addresses in the IPv4Addresses for the following PATCH request. 1) PATCH {"IPv4Addresses": [{},{}]} =>No change in the existing list. 2) PATCH {"IPv4Addresses": [{},{},{}]} Following error for the third list item. "IPv4Addresses/0/Address@Message.ExtendedInfo": [ { "@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message", "Message": "The property IPv4Addresses/2/Address is a required property and must be included in the request.", "MessageArgs": [ "IPv4Addresses/2/Address" ], "MessageId": "Base.1.4.0.PropertyMissing", "Resolution": "Ensure that the property is in the request body and has a valid value and resubmit the request if the operation failed.", "Severity": "Warning" } Change-Id: I24d11ca82cf6843611f72912499878bcbe1aecac Signed-off-by: Ratan Gupta --- redfish-core/lib/ethernet.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 8d7eddc9e8..71cde151fe 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -923,6 +923,27 @@ class EthernetInterface : public Node std::string pathString = "IPv4Addresses/" + std::to_string(entryIdx); + if (thisJson.empty()) + { + if (thisData != ipv4Data.end()) + { + thisData++; + } + else + { + messages::propertyMissing(asyncResp->res, + pathString + "/Address"); + return; + // TODO Not sure about the property where value is + // list and if unable to update one of the + // list value then should we proceed further or + // break there, would ask in the redfish forum + // till then we stop processing the next list item. + } + entryIdx++; + continue; // not an error as per the redfish spec. + } + std::optional address; std::optional addressOrigin; std::optional subnetMask; -- cgit v1.2.3