diff options
author | Ed Tanous <edtanous@google.com> | 2023-01-27 21:42:32 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2023-03-02 02:15:54 +0300 |
commit | e68d1be018a203970377d652005bafa14c4bf2f0 (patch) | |
tree | eff3417b5f05910643b3799a81ed03be27523585 | |
parent | a88562de3928f88e71505e629b640adfc00c2b62 (diff) | |
download | bmcweb-e68d1be018a203970377d652005bafa14c4bf2f0.tar.xz |
Add ManagerProvidingService implementation
This property was added in Redfish 2022.3 to allow clients to determine
which manager is hosting the ServiceRoot, such that they can find uptime
statistics, and other metrics from that resource, without needing to
attach them directly to serviceroot.
Tested:
Redfish service validator passes.
GET /redfish/v1/Managers/bmc returns the expected response.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: If2b78528d1499fbdae46120e1a1792ecf7ceb1d3
-rw-r--r-- | Redfish.md | 1 | ||||
-rw-r--r-- | redfish-core/lib/service_root.hpp | 5 | ||||
-rw-r--r-- | test/redfish-core/lib/service_root_test.cpp | 7 |
3 files changed, 10 insertions, 3 deletions
diff --git a/Redfish.md b/Redfish.md index dd82a06134..3bb95ca26e 100644 --- a/Redfish.md +++ b/Redfish.md @@ -37,6 +37,7 @@ Fields common to all schemas - Chassis - EventService - JsonSchemas +- Links/ManagerProvidingService - Links/Sessions - Managers - RedfishVersion diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp index 7d586cbd2e..a72a03e5b7 100644 --- a/redfish-core/lib/service_root.hpp +++ b/redfish-core/lib/service_root.hpp @@ -49,7 +49,7 @@ inline void handleServiceRootGetImpl( { std::string uuid = persistent_data::getConfig().systemUuid; asyncResp->res.jsonValue["@odata.type"] = - "#ServiceRoot.v1_11_0.ServiceRoot"; + "#ServiceRoot.v1_15_0.ServiceRoot"; asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1"; asyncResp->res.jsonValue["Id"] = "RootService"; asyncResp->res.jsonValue["Name"] = "Root Service"; @@ -83,6 +83,9 @@ inline void handleServiceRootGetImpl( "/redfish/v1/TelemetryService"; asyncResp->res.jsonValue["Cables"]["@odata.id"] = "/redfish/v1/Cables"; + asyncResp->res.jsonValue["Links"]["ManagerProvidingService"]["@odata.id"] = + "/redfish/v1/Managers/bmc"; + nlohmann::json& protocolFeatures = asyncResp->res.jsonValue["ProtocolFeaturesSupported"]; protocolFeatures["ExcerptQuery"] = false; diff --git a/test/redfish-core/lib/service_root_test.cpp b/test/redfish-core/lib/service_root_test.cpp index 1f50100057..7ebf8d86ac 100644 --- a/test/redfish-core/lib/service_root_test.cpp +++ b/test/redfish-core/lib/service_root_test.cpp @@ -26,7 +26,7 @@ void assertServiceRootGet(crow::Response& res) { nlohmann::json& json = res.jsonValue; EXPECT_EQ(json["@odata.id"], "/redfish/v1"); - EXPECT_EQ(json["@odata.type"], "#ServiceRoot.v1_11_0.ServiceRoot"); + EXPECT_EQ(json["@odata.type"], "#ServiceRoot.v1_15_0.ServiceRoot"); EXPECT_EQ(json["AccountService"]["@odata.id"], "/redfish/v1/AccountService"); @@ -45,8 +45,11 @@ void assertServiceRootGet(crow::Response& res) EXPECT_EQ(json["Id"], "RootService"); EXPECT_EQ(json["Links"]["Sessions"]["@odata.id"], "/redfish/v1/SessionService/Sessions"); - EXPECT_EQ(json["Links"].size(), 1); + EXPECT_EQ(json["Links"].size(), 2); EXPECT_EQ(json["Links"]["Sessions"].size(), 1); + EXPECT_EQ(json["Links"]["ManagerProvidingService"].size(), 1); + EXPECT_EQ(json["Links"]["ManagerProvidingService"]["@odata.id"], + "/redfish/v1/Managers/bmc"); EXPECT_EQ(json["Managers"]["@odata.id"], "/redfish/v1/Managers"); EXPECT_EQ(json["Managers"].size(), 1); |