diff options
author | Ratan Gupta <ratagupt@linux.vnet.ibm.com> | 2019-03-01 12:43:37 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-03-13 02:30:08 +0300 |
commit | 9474b3788017bddd70e493e2b9b7674be30abc87 (patch) | |
tree | 1d91bc6f8bbe75d01f9aa8cedcf053b1cbdad54a | |
parent | 82fd90f0550794f8f93877dfc7cfdb0aa3124ece (diff) | |
download | bmcweb-9474b3788017bddd70e493e2b9b7674be30abc87.tar.xz |
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 <ratagupt@linux.vnet.ibm.com>
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
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<std::string> address; std::optional<std::string> addressOrigin; std::optional<std::string> subnetMask; |