Add ServiceIdentification
Implements GET and PATCH support for ServiceIdentification in
Managers/bmc and service root.
Tested:
- Refish Service Validator passes
- Tested on romulus:
1. GET initial value
```
curl -k "https://$BMC/redfish/v1"
{
...
}
```
ServiceIdentification is not yet present in service root,
as expected
```
curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/Managers/bmc"
{
...
"ServiceIdentification": "",
...
}
```
2. PATCH and GET with valid value
```
curl -k -X PATCH "https://$BMC/redfish/v1/Managers/bmc" -H "X-Auth-Token: $XAUTH_TOKEN" \
-H 'Content-Type: application/json' --data-raw '{"ServiceIdentification": "foo"}'
{
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The request completed successfully.",
"MessageArgs": [],
"MessageId": "Base.1.19.Success",
"MessageSeverity": "OK",
"Resolution": "None."
}
]
}
curl -k "https://$BMC/redfish/v1"
{
...
"ServiceIdentification": "foo",
...
}
curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/Managers/bmc"
{
...
"ServiceIdentification": "foo",
...
}
```
3. PATCH and GET with invalid value
```
curl -k -X PATCH "https://$BMC/redfish/v1/Managers/bmc" -H "X-Auth-Token: $XAUTH_TOKEN" \
-H 'Content-Type: application/json' --data-raw '{"ServiceIdentification": "$$$"}'
{
"ServiceIdentification@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The value provided for the property ServiceIdentification is not valid.",
"MessageArgs": [
"ServiceIdentification"
],
"MessageId": "Base.1.19.PropertyValueError",
"MessageSeverity": "Warning",
"Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed."
}
]
}
curl -k -X PATCH "https://$BMC/redfish/v1/Managers/bmc" -H "X-Auth-Token: $XAUTH_TOKEN" \
-H 'Content-Type: application/json' --data-raw '{"ServiceIdentification": "2222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222"}'
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "#Message.v1_1_1.Message",
"Message": "The string 'ServiceIdentification' exceeds the length limit 99.",
"MessageArgs": [
"ServiceIdentification",
"99"
],
"MessageId": "Base.1.19.StringValueTooLong",
"MessageSeverity": "Warning",
"Resolution": "Resubmit the request with an appropriate string length."
}
],
"code": "Base.1.19.StringValueTooLong",
"message": "The string 'ServiceIdentification' exceeds the length limit 99."
}
}
curl -k "https://$BMC/redfish/v1"
{
...
"ServiceIdentification": "foo",
...
}
curl -k -H "X-Auth-Token: $XAUTH_TOKEN" "https://$BMC/redfish/v1/Managers/bmc"
{
...
"ServiceIdentification": "foo",
...
}
```
Change-Id: I5b71a73e947ec64cabb8d93c8503a18fb43b8937
Signed-off-by: Corey Ethington <cethington@coreweave.com>
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index 34f0e31..a67a75d 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -11,6 +11,7 @@
#include "persistent_data.hpp"
#include "query.hpp"
#include "registries/privilege_registry.hpp"
+#include "utils/manager_utils.hpp"
#include <boost/beast/http/field.hpp>
#include <boost/beast/http/verb.hpp>
@@ -80,6 +81,7 @@
"/redfish/v1/EventService";
asyncResp->res.jsonValue["TelemetryService"]["@odata.id"] =
"/redfish/v1/TelemetryService";
+ manager_utils::getServiceIdentification(asyncResp, true);
asyncResp->res.jsonValue["Cables"]["@odata.id"] = "/redfish/v1/Cables";
asyncResp->res.jsonValue["Links"]["ManagerProvidingService"]["@odata.id"] =