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
diff --git a/Redfish.md b/Redfish.md
index dd82a06..3bb95ca 100644
--- a/Redfish.md
+++ b/Redfish.md
@@ -37,6 +37,7 @@
- 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 7d586cb..a72a03e 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -49,7 +49,7 @@
{
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 @@
"/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 1f50100..7ebf8d8 100644
--- a/test/redfish-core/lib/service_root_test.cpp
+++ b/test/redfish-core/lib/service_root_test.cpp
@@ -26,7 +26,7 @@
{
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 @@
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);