Implement BootTime LogService for system and bmc

Under BootTimeMonitor service we are storing boot time log entries-
* Checkpoints: at which time, machine at a specific stage
* Durations: how long does it take for a certain stage?
* Statistics: Whether the component is rebooting or not.

Since all of the data are like log or event, we are exporting all these
information as part of a logservice "BootTime".
* OEMDiagnosticDataType contains the type of the log
* DiagnosticData contains the base64 encoded json of the data

The feature is only for single host right now since the service captures only one host.

Design Doc: go/deoxys-redfish-schema

Tested:
```
root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices",
  "@odata.type": "#LogServiceCollection.LogServiceCollection",
  "Description": "Collection of LogServices for this Computer System",
  "Members": [
    ...
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime"
    },
    ...
  ],
  "Members@odata.count": 6,
  "Name": "System Log Services Collection"
}
root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime",
  "@odata.type": "#LogService.v1_1_0.LogService",
  "DateTime": "2024-09-08T16:40:34+00:00",
  "DateTimeLocalOffset": "+00:00",
  "Description": "Boot Time Log Service",
  "Entries": {
    "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries"
  },
  "Id": "BootTime",
  "LogEntryType": "Multiple",
  "Name": "Boot Time Log Service",
  "OverWritePolicy": "WrapsWhenFull"
}
root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries",
  "@odata.type": "#LogEntryCollection.LogEntryCollection",
  "Description": "Collection of Boot time Log Entries with checkpoints and duration",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries/Checkpoint-0",
      "@odata.type": "#LogEntry.v1_15_0.LogEntry",
      "DiagnosticData": "eyJNb25vVGltZU1zIjo4MTA3MCwiTmFtZSI6Ikhvc3RTdGF0ZTpPZmYiLCJXYWxsVGltZU1zIjoxNzAyNjU0NjQ2Nzk5fQ==",
      "EntryType": "Oem",
      "Id": "Checkpoint-0",
      "Message": "{\"MonoTimeMs\":81070,\"Name\":\"HostState:Off\",\"WallTimeMs\":1702654646799}",
      "Name": "Boot Time Log Entry",
      "OEMDiagnosticDataType": "Checkpoint"
    },
    ...
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries/Duration-2",
      "@odata.type": "#LogEntry.v1_15_0.LogEntry",
      "DiagnosticData": "eyJEdXJhdGlvbk1zIjozNjAwMCwiTmFtZSI6Ik5lcmZESENQIn0=",
      "EntryType": "Oem",
      "Id": "Duration-2",
      "Message": "{\"DurationMs\":36000,\"Name\":\"NerfDHCP\"}",
      "Name": "Boot Time Log Entry",
      "OEMDiagnosticDataType": "Duration"
    },
    {
      "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statistic-0",
      "@odata.type": "#LogEntry.v1_15_0.LogEntry",
      "DiagnosticData": "eyJJc1JlYm9vdGluZyI6dHJ1ZX0=",
      "EntryType": "Oem",
      "Id": "Statistic-0",
      "Message": "{\"IsRebooting\":true}",
      "Name": "Boot Time Log Entry",
      "OEMDiagnosticDataType": "Statistic"
    }
  ],
  "Members@odata.count": 9,
  "Name": "Boot Time Log Entries"
}root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statistic-0
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statistic-0",
  "@odata.type": "#LogEntry.v1_15_0.LogEntry",
  "DiagnosticData": "eyJJc1JlYm9vdGluZyI6dHJ1ZX0=",
  "EntryType": "Oem",
  "Id": "Statistic-0",
  "Message": "{\"IsRebooting\":true}",
  "Name": "Boot Time Log Entry",
  "OEMDiagnosticDataType": "Statistic"
}root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statistic-2
{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type LogEntry named 'Statistic-2' was not found.",
        "MessageArgs": [
          "LogEntry",
          "Statistic-2"
        ],
        "MessageId": "Base.1.13.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.13.0.ResourceNotFound",
    "message": "The requested resource of type LogEntry named 'Statistic-2' was not found."
  }
}root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statistic--1
{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type LogEntry named 'Statistic--1' was not found.",
        "MessageArgs": [
          "LogEntry",
          "Statistic--1"
        ],
        "MessageId": "Base.1.13.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.13.0.ResourceNotFound",
    "message": "The requested resource of type LogEntry named 'Statistic--1' was not found."
  }
}root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statistic-
{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type LogEntry named 'Statistic-' was not found.",
        "MessageArgs": [
          "LogEntry",
          "Statistic-"
        ],
        "MessageId": "Base.1.13.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.13.0.ResourceNotFound",
    "message": "The requested resource of type LogEntry named 'Statistic-' was not found."
  }
}root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Statisti
{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type LogEntry named 'Statisti' was not found.",
        "MessageArgs": [
          "LogEntry",
          "Statisti"
        ],
        "MessageId": "Base.1.13.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.13.0.ResourceNotFound",
    "message": "The requested resource of type LogEntry named 'Statisti' was not found."
  }
}root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Checkpoint-0
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries/Checkpoint-0",
  "@odata.type": "#LogEntry.v1_15_0.LogEntry",
  "DiagnosticData": "eyJNb25vVGltZU1zIjo4MTA3MCwiTmFtZSI6Ikhvc3RTdGF0ZTpPZmYiLCJXYWxsVGltZU1zIjoxNzAyNjU0NjQ2Nzk5fQ==",
  "EntryType": "Oem",
  "Id": "Checkpoint-0",
  "Message": "{\"MonoTimeMs\":81070,\"Name\":\"HostState:Off\",\"WallTimeMs\":1702654646799}",
  "Name": "Boot Time Log Entry",
  "OEMDiagnosticDataType": "Checkpoint"
}
root@bmc:~# curl localhost/redfish/v1/Systems/system/LogServices/BootTime/Entries/Duration-1
{
  "@odata.id": "/redfish/v1/Systems/system/LogServices/BootTime/Entries/Duration-1",
  "@odata.type": "#LogEntry.v1_15_0.LogEntry",
  "DiagnosticData": "eyJEdXJhdGlvbk1zIjozNjAwMCwiTmFtZSI6Ik5lcmZVc2VyIn0=",
  "EntryType": "Oem",
  "Id": "Duration-1",
  "Message": "{\"DurationMs\":36000,\"Name\":\"NerfUser\"}",
  "Name": "Boot Time Log Entry",
  "OEMDiagnosticDataType": "Duration"
}
root@bmc:~# curl localhost/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/
{
  "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries",
  "@odata.type": "#LogEntryCollection.LogEntryCollection",
  "Description": "Collection of Boot time Log Entries with checkpoints and duration",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Checkpoint-0",
      "@odata.type": "#LogEntry.v1_15_0.LogEntry",
      "DiagnosticData": "eyJNb25vVGltZU1zIjoxODczNDAsIk5hbWUiOiJIb3N0UmVsZWFzZWQiLCJXYWxsVGltZU1zIjoxNzAyNjU0NzUzMDY3fQ==",
      "EntryType": "Oem",
      "Id": "Checkpoint-0",
      "Message": "{\"MonoTimeMs\":187340,\"Name\":\"HostReleased\",\"WallTimeMs\":1702654753067}",
      "Name": "Boot Time Log Entry",
      "OEMDiagnosticDataType": "Checkpoint"
    },
    ...
    {
      "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Duration-5",
      "@odata.type": "#LogEntry.v1_15_0.LogEntry",
      "DiagnosticData": "eyJEdXJhdGlvbk1zIjozMjExOTYsIk5hbWUiOiJVc2Vyc3BhY2UifQ==",
      "EntryType": "Oem",
      "Id": "Duration-5",
      "Message": "{\"DurationMs\":321196,\"Name\":\"Userspace\"}",
      "Name": "Boot Time Log Entry",
      "OEMDiagnosticDataType": "Duration"
    },
    {
      "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Statistic-0",
      "@odata.type": "#LogEntry.v1_15_0.LogEntry",
      "DiagnosticData": "eyJJc1JlYm9vdGluZyI6ZmFsc2V9",
      "EntryType": "Oem",
      "Id": "Statistic-0",
      "Message": "{\"IsRebooting\":false}",
      "Name": "Boot Time Log Entry",
      "OEMDiagnosticDataType": "Statistic"
    }
  ],
  "Members@odata.count": 9,
  "Name": "Boot Time Log Entries"
}root@bmc:~# curl localhost/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Duration-5
{
  "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Duration-5",
  "@odata.type": "#LogEntry.v1_15_0.LogEntry",
  "DiagnosticData": "eyJEdXJhdGlvbk1zIjozMjExOTYsIk5hbWUiOiJVc2Vyc3BhY2UifQ==",
  "EntryType": "Oem",
  "Id": "Duration-5",
  "Message": "{\"DurationMs\":321196,\"Name\":\"Userspace\"}",
  "Name": "Boot Time Log Entry",
  "OEMDiagnosticDataType": "Duration"
}
root@bmc:~# curl localhost/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Checkpoint-1
{
  "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Checkpoint-1",
  "@odata.type": "#LogEntry.v1_15_0.LogEntry",
  "DiagnosticData": "eyJNb25vVGltZU1zIjozNTg0MTAsIk5hbWUiOiJVc2Vyc3BhY2VFbmQiLCJXYWxsVGltZU1zIjoxNzI1Nzk1NDE2NDEyfQ==",
  "EntryType": "Oem",
  "Id": "Checkpoint-1",
  "Message": "{\"MonoTimeMs\":358410,\"Name\":\"UserspaceEnd\",\"WallTimeMs\":1725795416412}",
  "Name": "Boot Time Log Entry",
  "OEMDiagnosticDataType": "Checkpoint"
}
root@bmc:~# curl localhost/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Statistic-0
{
  "@odata.id": "/redfish/v1/Managers/bmc/LogServices/BootTime/Entries/Statistic-0",
  "@odata.type": "#LogEntry.v1_15_0.LogEntry",
  "DiagnosticData": "eyJJc1JlYm9vdGluZyI6ZmFsc2V9",
  "EntryType": "Oem",
  "Id": "Statistic-0",
  "Message": "{\"IsRebooting\":false}",
  "Name": "Boot Time Log Entry",
  "OEMDiagnosticDataType": "Statistic"
}
```

Google-Bug-Id: 296791271
Change-Id: Ib225f251c3f6c406c6998ae1eb815ddb7135987e
Signed-off-by: Munawar Hussain <munawarhussain@google.com>
5 files changed
tree: 9e9bb2692e898aa1120d3439ecd8bd1a61294f98
  1. .github/
  2. config/
  3. grpc-redfish/
  4. http/
  5. include/
  6. mapper/
  7. plugins/
  8. redfish-core/
  9. scripts/
  10. src/
  11. static/
  12. subprojects/
  13. test/
  14. .clang-format
  15. .clang-tidy
  16. .dockerignore
  17. .gitignore
  18. .markdownlint.yaml
  19. .openbmc-enforce-gitlint
  20. .prettierignore
  21. .shellcheck
  22. AGGREGATION.md
  23. CLIENTS.md
  24. COMMON_ERRORS.md
  25. DBUS_USAGE.md
  26. DEVELOPING.md
  27. HEADERS.md
  28. LICENSE
  29. meson.build
  30. meson_options.txt
  31. OEM_SCHEMAS.md
  32. OWNERS
  33. PLUGINS.md
  34. README.md
  35. README_GOOGLE.md
  36. Redfish.md
  37. run-ci
  38. setup.cfg
  39. TESTING.md
README.md

OpenBMC webserver

This project is Google's version of BMCWeb.

See Readme Google for Google added features. The following is the original README of OpenBMC/BMCWeb.

==============================================================================

This component attempts to be a “do everything” embedded webserver for OpenBMC.

Features

The webserver implements a few distinct interfaces:

  • DBus event websocket. Allows registering on changes to specific dbus paths, properties, and will send an event from the websocket if those filters match.
  • OpenBMC DBus REST api. Allows direct, low interference, high fidelity access to dbus and the objects it represents.
  • Serial: A serial websocket for interacting with the host serial console through websockets.
  • Redfish: A protocol compliant, DBus to Redfish translator.
  • KVM: A websocket based implementation of the RFB (VNC) frame buffer protocol intended to mate to webui-vue to provide a complete KVM implementation.

Protocols

bmcweb at a protocol level supports http and https. TLS is supported through OpenSSL.

AuthX

Authentication

Bmcweb supports multiple authentication protocols:

  • Basic authentication per RFC7617
  • Cookie based authentication for authenticating against webui-vue
  • Mutual TLS authentication based on OpenSSL
  • Session authentication through webui-vue
  • XToken based authentication conformant to Redfish DSP0266

Each of these types of authentication is able to be enabled or disabled both via runtime policy changes (through the relevant Redfish APIs) or via configure time options. All authentication mechanisms supporting username/password are routed to libpam, to allow for customization in authentication implementations.

Authorization

All authorization in bmcweb is determined at routing time, and per route, and conform to the Redfish PrivilegeRegistry.

*Note: Non-Redfish functions are mapped to the closest equivalent Redfish privilege level.

Configuration

bmcweb is configured per the meson build files. Available options are documented in meson_options.txt

Compile bmcweb with default options

meson builddir
ninja -C builddir

If any of the dependencies are not found on the host system during configuration, meson will automatically download them via its wrap dependencies mentioned in bmcweb/subprojects.

Use of persistent data

bmcweb relies on some on-system data for storage of persistent data that is internal to the process. Details on the exact data stored and when it is read/written can seen from the persistent_data namespace.

TLS certificate generation

When SSL support is enabled and a usable certificate is not found, bmcweb will generate a self-signed a certificate before launching the server. Please see the bmcweb source code for details on the parameters this certificate is built with.

Redfish Aggregation

bmcweb is capable of aggregating resources from satellite BMCs. Refer to AGGREGATION.md for more information on how to enable and use this feature.