Redfish(Ethernet): Fix to not convert the json index into string
During Property Update for the Ipv4address, Index was getting
converted into string which was causing the bmcweb to crash.
This commit fixes this problem.
TestedBy:
Assumption: There is already three IP address and updating the
third one.
PATCH -D patch.txt -d '{"IPv4Addresses":
[{},{},{"Address": "x.x.x.x","AddressOrigin": "Static","SubnetMask": "255.255.0.0","Gateway":"x.x.x.x"}]}
Change-Id: Ic055649b75aaa36e16bda5d8dc4e4e9c87dcb315
Signed-off-by: Ratan Gupta <ratagupt@linux.vnet.ibm.com>
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 0bfe9db..8d7eddc 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1019,9 +1019,9 @@
messages::internalError(asyncResp->res);
return;
}
- asyncResp->res
- .jsonValue["IPv4Addresses"][std::to_string(
- entryIdx)]["Address"] = address;
+ asyncResp->res.jsonValue["IPv4Addresses"]
+ [entryIdx]["Address"] =
+ address;
};
crow::connections::systemBus->async_method_call(
@@ -1058,9 +1058,8 @@
messages::internalError(asyncResp->res);
return;
}
- asyncResp->res
- .jsonValue["IPv4Addresses"][std::to_string(
- entryIdx)]["Gateway"] =
+ asyncResp->res.jsonValue["IPv4Addresses"]
+ [entryIdx]["Gateway"] =
std::move(gateway);
};