summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRatan Gupta <ratagupt@linux.vnet.ibm.com>2019-03-07 15:55:57 +0300
committerRatan Gupta <ratagupt@linux.vnet.ibm.com>2019-03-19 06:38:21 +0300
commit95897b20269638316c0f3262b8ea17a3e5329dd5 (patch)
tree35b50fd95028df59895a2020386f7c27d055baef
parentd577665b5dddb29d2bf2ecffb43063c36a4a954f (diff)
downloadbmcweb-95897b20269638316c0f3262b8ea17a3e5329dd5.tar.xz
Redfish(Ethernet): Send the correct JSON response after creating the IPV4 object.
Before this commit after creating the IPv4 address object,JSON response was having empty string for the newly added object. This commit fixes the problem. Tested By: Assuming there are already two IP addresses configured then the following PATCH request would throw the following output PATCH -D patch.txt -d '{"IPv4Addresses": [{},{},{"Address": "a.a.a.a","Address Origin": "Static","SubnetMask": "255.255.0.0","Gateway":"g.g.g.g"}]} { "@odata.id": "/redfish/v1/Managers/bmc/EthernetInterfaces/eth0", "HostName": "witherspoon", "IPv4Addresses": [ { "Address": "169.254.201.17", "AddressOrigin": "IPv4LinkLocal", "Gateway": "9.3.185.1", "SubnetMask": "255.255.0.0" }, { "Address": "9.3.185.83", "AddressOrigin": "Static", "Gateway": "9.3.185.1", "SubnetMask": "255.255.255.0" }, { "Address": "a.a.a.a", "Gateway": "g.g.g.g", "SubnetMask": "255.255.0.0" } ], Change-Id: I6be340051020839ff7f669296c2077ecfdce78ff Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
-rw-r--r--redfish-core/lib/ethernet.hpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 1d3cb85d5a..476e03aff2 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1200,7 +1200,12 @@ class EthernetInterface : public Node
createIPv4(ifaceId, entryIdx, prefixLength, *gateway, *address,
asyncResp);
- asyncResp->res.jsonValue["IPv4Addresses"][entryIdx] = thisJson;
+
+ nlohmann::json &ipv4AddressJson =
+ asyncResp->res.jsonValue["IPv4Addresses"][entryIdx];
+ ipv4AddressJson["Address"] = *address;
+ ipv4AddressJson["SubnetMask"] = *subnetMask;
+ ipv4AddressJson["Gateway"] = *gateway;
}
entryIdx++;
}