| commit | af5d605812b823fe4a03731dcf6d588bd5f5f181 | [log] [tgz] | 
|---|---|---|
| author | Santosh Puranik <santosh.puranik@in.ibm.com> | Wed Mar 20 18:16:36 2019 +0530 | 
| committer | Ed Tanous <ed.tanous@intel.com> | Wed Apr 10 16:20:13 2019 +0000 | 
| tree | b2ce7352fdd1bd87634565399073f3f2c94d671a | |
| parent | 85d2bb5b16beb18571cac2841437e60bf7522bc1 [diff] | 
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>
This component attempts to be a "do everything" embedded webserver for openbmc.
At this time, the webserver implements a few interfaces:
BMCWeb is configured by setting -D flags that correspond to options in bmcweb/CMakeLists.txt and then compiling.  For example, cmake -DBMCWEB_ENABLE_KVM=NO ... followed by make.  The option names become C++ preprocessor symbols that control which code is compiled into the program.
When BMCWeb starts running, it reads persistent configuration data (such as UUID and session data) from a local file. If this is not usable, it generates a new configuration.
When BMCWeb SSL support is enabled and a usable certificate is not found, it will generate a self-sign a certificate before launching the server.  The keys are generated by the prime256v1 algorithm.  The certificate
C=US, O=OpenBMC, CN=testhost,SHA-256 algorithm.The crow project has had a number of additions to make it more useful for use in the OpenBmc Project. A non-exhaustive list is below. At the time of this writing, the crow project is not accepting patches, so for the time being crow will simply be checked in as is.