diff options
author | Santosh Puranik <santosh.puranik@in.ibm.com> | 2019-03-20 18:16:36 +0530 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-04-10 16:20:13 +0000 |
commit | af5d605812b823fe4a03731dcf6d588bd5f5f181 (patch) | |
tree | b2ce7352fdd1bd87634565399073f3f2c94d671a /include | |
parent | 85d2bb5b16beb18571cac2841437e60bf7522bc1 (diff) | |
download | bmcweb-af5d605812b823fe4a03731dcf6d588bd5f5f181.tar.gz bmcweb-af5d605812b823fe4a03731dcf6d588bd5f5f181.zip |
PATCH support for DateTime
This commit adds PATCH support for the DateTime property.
To set the BMC time, it uses the
xyz.openbmc_project.Time.EpochTime.Elapsed property.
The BMC time can only be set if the BMC owns it's own time *and*
the time is not automatically synced with NTP server(s).
The input JSON for the PATCH request must speicfy datetime in
extended ISO 8601 format.
Tested:
=======
Precondition: Time owner should be BMC and sync method should be
Manual.
busctl get-property xyz.openbmc_project.Settings
/xyz/openbmc_project/time/owner
xyz.openbmc_project.Time.Owner TimeOwner
s "xyz.openbmc_project.Time.Owner.Owners.BMC"
busctl get-property xyz.openbmc_project.Settings
/xyz/openbmc_project/time/sync_method
xyz.openbmc_project.Time.Synchronization TimeSyncMethod
s "xyz.openbmc_project.Time.Synchronization.Method.Manual"
-- Setting date time:
curl -k -H "X-Auth-Token: $bmc_token" -X PATCH
https://${bmc}:${port}/redfish/v1/Managers/bmc -d
'{"DateTime": "2019-03-20T08:47:30.345+00:00"}'
{
"DateTime": "2019-03-20T08:47:30.345+00:00"
}
Invalid date time string:
curl -k -H "X-Auth-Token: $bmc_token" -X PATCH
https://${bmc}:${port}/redfish/v1/Managers/bmc -d
'{"DateTime": "2019-03-20T08:47:30.345+ds:00"}'
{
"DateTime@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The value 2019-03-20T08:47:30.345+ds:00 for the property
DateTime is of a different format than the property can accept.",
"MessageArgs": [
"2019-03-20T08:47:30.345+ds:00",
"DateTime"
],
"MessageId": "Base.1.4.0.PropertyValueFormatError",
"Resolution": "Correct the value for the property in the request body and
resubmit the request if the operation failed.",
"Severity": "Warning"
}
]
}
When the time sync method is NTP, the PATCH request fails as expected:
busctl get-property xyz.openbmc_project.Settings
/xyz/openbmc_project/time/sync_method
xyz.openbmc_project.Time.Synchronization TimeSyncMethod
s "xyz.openbmc_project.Time.Synchronization.Method.NTP"
curl -k -H "X-Auth-Token: $bmc_token" -X PATCH
https://${bmc}:${port}/redfish/v1/Managers/bmc -d '{"DateTime":
"2019-03-20T08:47:30+00:00"}'
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The request failed due to an internal service error. The
service is still operational.",
"MessageArgs": [],
"MessageId": "Base.1.4.0.InternalError",
"Resolution": "Resubmit the request. If the problem persists, consider
resetting the service.",
"Severity": "Critical"
}
],
"code": "Base.1.4.0.InternalError",
"message": "The request failed due to an internal service error. The
service is still operational."
}
}
When the time sync method is Manual, but the time owner is Host,
PATCH fails as expected again:
busctl get-property xyz.openbmc_project.Settings
/xyz/openbmc_project/time/owner
xyz.openbmc_project.Time.Owner TimeOwner
s "xyz.openbmc_project.Time.Owner.Owners.Host"
busctl get-property xyz.openbmc_project.Settings
/xyz/openbmc_project/time/sync_method
xyz.openbmc_project.Time.Synchronization TimeSyncMethod
s "xyz.openbmc_project.Time.Synchronization.Method.Manual"
curl -k -H "X-Auth-Token: $bmc_token" -X PATCH
https://${bmc}:${port}/redfish/v1/Managers/bmc -d '{"DateTime":
"2019-03-20T08:47:30+00:00"}'
{
"error": {
"@Message.ExtendedInfo": [
{
"@odata.type": "/redfish/v1/$metadata#Message.v1_0_0.Message",
"Message": "The request failed due to an internal service error. The
service is still operational.",
"MessageArgs": [],
"MessageId": "Base.1.4.0.InternalError",
"Resolution": "Resubmit the request. If the problem persists, consider
resetting the service.",
"Severity": "Critical"
}
],
"code": "Base.1.4.0.InternalError",
"message": "The request failed due to an internal service error. The
service is still operational."
}
}
Change-Id: Ie4a71e639b9a6577fae8627f0f69b6179506eb58
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions