diff options
author | Tim Lee <timlee660101@gmail.com> | 2020-11-19 09:14:27 +0300 |
---|---|---|
committer | Tim Lee <timlee660101@gmail.com> | 2020-11-20 05:51:26 +0300 |
commit | 94bda602f00b181befa20a08550439b3c1d3b256 (patch) | |
tree | b4c1ce8549ed3cee080ac8f13f07c6ebb842976d /redfish-core/lib/systems.hpp | |
parent | 83deb7d8bd399469f8167f768cd6bb641584529d (diff) | |
download | bmcweb-94bda602f00b181befa20a08550439b3c1d3b256.tar.xz |
systems: fix Members@odata.count is incorrect even Members have contents
Issue symptom:
Run automation test "Verify_Systems_Defaults" then we got ERROR as below.
Verify Systems Defaults :: Verify systems defaults. | FAIL |
**ERROR** Invalid variable value: systems['Members@odata.count']: 0 <int>
Root cause:
In Systems, doGet() didn't calculate count after ifaceArray.push_back({{"@odata.id", "/redfish/v1/Systems/system"}})
Solution:
Increase count by ifaceArray.size() after ifaceArray.push_back() in Systems
Tested:
1. Verified
robot -t Verify_Systems_Defaults redfish/service_root/test_sessions_management.robot
Verify Systems Defaults :: Verify systems defaults. | PASS |
2. Verified system detail from Redfish.
Get https://<BMC-IP>/redfish/v1/Systems
Response:
{
"@odata.id": "/redfish/v1/Systems",
"@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
"Members": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"Members@odata.count": 1,
"Name": "Computer System Collection"
}
Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: I9cdb5dac9e16851112085048bc674808511a4845
Diffstat (limited to 'redfish-core/lib/systems.hpp')
-rw-r--r-- | redfish-core/lib/systems.hpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index ef178ed203..89a8ad5b1d 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -1769,9 +1769,9 @@ class SystemsCollection : public Node asyncResp->res.jsonValue["Members"]; ifaceArray = nlohmann::json::array(); auto& count = asyncResp->res.jsonValue["Members@odata.count"]; - count = 0; ifaceArray.push_back( {{"@odata.id", "/redfish/v1/Systems/system"}}); + count = ifaceArray.size(); if (!ec) { BMCWEB_LOG_DEBUG << "Hypervisor is available"; |