Implement TemperatureReadingsCelsius property for ThermalMetrics

The ThermalMetrics schema[1] provides for efficient thermal metric
gathering for thermal sensors. The schema allows retrieving just the
thermal metrics with one Redfish URI. This prevents the additional work
required when returning all the sensor data, or multiple Redfish URI
calls to retrieve the properties for all of the thermal sensors.

This commit implements the TemperatureReadingsCelsius property of
ThermalMetrics[1]. ThermalMetrics is a property of ThermalSubsystem[2].
TemperatureReadingsCelsius is a SensorArrayExcerpt[3].

[1] https://redfish.dmtf.org/schemas/v1/ThermalMetrics.v1_0_1.json
[2] https://redfish.dmtf.org/schemas/v1/ThermalSubsystem.v1_3_2.json
[3] http://redfish.dmtf.org/schemas/v1/Sensor.v1_9_0.json#/definitions/SensorArrayExcerpt

The temperature sensors are found by finding 'all_sensors' endpoints for
specific chassis of D-Bus service
/xyz/openbmc_project/sensors/temperature. An entry of SensorArrayExcerpt
is built for each temperature sensor retrieved.

Implementation Notes:
 - Common function sensor_utils::objectPropertiesToJson() is used to
   fill in sensor excerpt properties. Currently the only excerpt
   ChassisSubNode is ThermalMetrics. However there are others excerpts
   defined by Redfish. Right now mostly this is just skipping things,
   but I'm expecting when other sensor excerpts are implemented that
   some of the other properties may be added for excerpts as well. I'm
   expecting the combination of the chassisSubNode and the sensorType
   will be used to determine which properties are included for a
   particular call to build a sensor Json representation.
 - New sensor_utils::objectExcerptToJson() function created. This wraps
   sensor_utils::objectPropertiesToJson() and builds DataSourceUri for a
   sensor excerpt.
 - New sensor_utils::getAllSensorObjects() function created. This builds
   list of 'all_sensors' association endpoints for specified D-Bus path
   with specified D-Bus interfaces. Callback function is called with
   list for handling sensors.

Tested:
1. Redfish Service Validator passed.
2. doGet method:
```
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics
{
  "@odata.id": "/redfish/v1/Chassis/chassis/ThermalSubsystem/ThermalMetrics",
  "@odata.type": "#ThermalMetrics.v1_0_1.ThermalMetrics",
  "Id": "ThermalMetrics",
  "Name": "Thermal Metrics",
  "TemperatureReadingsCelsius": [
    {
      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp0",
      "Reading": -131072000.0
    },
    {
      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp1",
      "Reading": -131072000.0
    },
    {
      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps0_temp2",
      "Reading": -131072000.0
    },
    {
      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0",
      "Reading": -131072000.0
    },
    {
      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp1",
      "Reading": -131072000.0
    },
    {
      "DataSourceUri": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp2",
      "Reading": -131072000.0
    }
  ],
  "TemperatureReadingsCelsius@odata.count": 6
}
```

3. Verification of DataSourceUri:
```
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0
{
  "@odata.id": "/redfish/v1/Chassis/chassis/Sensors/temperature_ps1_temp0",
  "@odata.type": "#Sensor.v1_2_0.Sensor",
  "Id": "temperature_ps1_temp0",
  "Name": "ps1 temp0",
  "Reading": -131072000.0,
  "ReadingType": "Temperature",
  "ReadingUnits": "Cel",
  "Status": {
    "Health": "OK",
    "State": "Enabled"
  }
}
```

4. A bad chassis ID:
```
curl -k -H "X-Auth-Token: ${token}" -X GET https://${bmc}/redfish/v1/Chassis/chassisBAD/ThermalSubsystem/ThermalMetrics
{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type Chassis named 'chassisBAD' was not found.",
        "MessageArgs": [
          "Chassis",
          "chassisBAD"
        ],
        "MessageId": "Base.1.18.1.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.18.1.ResourceNotFound",
    "message": "The requested resource of type Chassis named 'chassisBAD' was not found."
  }
}
```

Signed-off-by: George Liu <liuxiwei@ieisystem.com>
Change-Id: I6e4ed1f281fd5371c978983b6cc5666badd3752c
Signed-off-by: Janet Adkins <janeta@us.ibm.com>
4 files changed
tree: 538bf953d4bf5e9fe8747ab517cb3f27c8f4a079
  1. .github/
  2. config/
  3. http/
  4. include/
  5. redfish-core/
  6. scripts/
  7. src/
  8. static/
  9. subprojects/
  10. test/
  11. .clang-format
  12. .clang-tidy
  13. .codespell-ignore
  14. .dockerignore
  15. .eslintignore
  16. .gitignore
  17. .markdownlint.yaml
  18. .openbmc-enforce-gitlint
  19. .prettierignore
  20. .shellcheck
  21. AGGREGATION.md
  22. CLIENTS.md
  23. COMMON_ERRORS.md
  24. DBUS_USAGE.md
  25. DEVELOPING.md
  26. HEADERS.md
  27. LICENSE
  28. meson.build
  29. meson.options
  30. OEM_SCHEMAS.md
  31. OWNERS
  32. README.md
  33. Redfish.md
  34. REDFISH_CHECKLIST.md
  35. run-ci
  36. TESTING.md
README.md

OpenBMC webserver

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 setup 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.