Redfish API Presentation Module

The Redfish API Presentation Module in tlBMC is responsible for exposing tlBMC-owned resources (Chassis, Sensors, Cables, UpdateService, TaskService) via a standard Redfish REST API. It receives HTTP requests, routes them to correct handlers, handles query parsing (like $expand), and enforces authentication/authorization and rate limiting.

The core implementation resides in the third_party/milotic/external/cc/tlbmc/redfish/ directory.


Overview and Integration (gBMCWeb Proxying)

tlBMC does not run as a standalone, public-facing web server for the entire Redfish tree. Instead, it co-exists with a primary web daemon (like gbmcweb).

  • Path Ownership: During startup, RedfishApp calculates the list of routes it manages by calling GetOwnedUrls() and GetOwnedSubtrees().
  • Dynamic Proxying: gbmcweb queries these functions to dynamically determine which HTTP request paths to proxy directly to tlBMC over a local IPC or socket connection.
  • Asynchronous Execution: Incoming proxied requests are adapted from crow::Request into internal RedfishRequest formats and processed asynchronously on a dedicated thread pool.

Central Configuration

The Redfish presentation layer is configured via TlbmcConfig inside tlbmc_config_bundle.textproto (defined in central_config.proto).

1. Redfish Rate Limiter Module (RedfishRateLimiterModule)

Exposes request rate limiting on Redfish paths using a token bucket algorithm.

FieldTypeDefaultDescription
enabledboolfalseRegisters the rate
: : : : limiter service :
: : : : routes. :
activeboolfalseActively drops
: : : : requests when :
: : : : limits are :
: : : : crossed. :
leak_rate_per_secdouble100.0Sustained requests
: : : : processed per :
: : : : second. :
bucket_capacitydouble200.0Maximum burst of
: : : : requests allowed. :
bypass_urirepeated string-Routes exempt from
: : : : rate limiting. :
redRedfishRateLimiterRed-Random Early
: : : : Detection (RED) :
: : : : drop rules. :

RedfishRateLimiterRed (Random Early Discard) Options

  • enabled (bool, default: false): Enables random dropping.
  • min_threshold (double, default: 50.0): Bucket level fullness (in %) where RED starts randomly dropping requests.
  • max_threshold (double, default: 150.0): Bucket level where all requests are dropped with max_drop_prob.
  • max_drop_prob (double, default: 0.1): Max drop probability.

2. Trust Bundle Installation Module (TrustBundleInstallModule)

FieldTypeDefaultDescription
enabledboolfalseIf true, tlBMC claims ownership of /redfish/v1/CertificateService and /redfish/v1/CertificateService/CertificateLocations to manage client certificates and trust bundles. It also restricts the recovery authorization policy to only allow certificate actions.

Core Routing and Trie Matching

  • RedfishApp (redfish/app.cc): The main entry point that wraps the request worker pool, adapters, and configuration hooks.
  • Router (redfish/routing.cc): Uses a Trie data structure to map incoming request URIs and HTTP methods to their handlers. Custom routing rules are registered using the ECRXX_ROUTE macros.
  • Preprocess & Postprocess:
    • RedfishPreprocess: Enforces authorization and maps peer client certificates (mTLS) to specific roles and privileges.
    • RedfishPostprocess: Implements standard query parameters, such as resolving $expand queries.

Protobuf Configuration Schemas

The Redfish presentation layer reads from the tlBMC Store. The tlBMC store holds a representation of all resources parsed and managed by tlBMC and the presentation layer maps this to standard redfish output consistent with DMTF schemas. The following are proto definitions that tlBMC uses to internally model resources:

  • StableId (defined in stable_id.proto): Defines structures to map hardware physical paths (like I2C/PCIe paths) to stable Redfish IDs.
  • Resource (defined in resource.proto): Defines types representing physical and logical components (Chassis, Fan, PowerSupply, etc.).
  • Sensor (defined in sensor.proto): Schema representing sensor telemetry properties, readings, and states exposed in Redfish Sensor collections.
  • SoftwareMetrics (defined in software_metrics.proto): Schema defining software metrics (network ports, stall info).
  • PowerFaultLogEntry (defined in power_fault_log_entry.proto): Defines the log entries exposed by the power fault log service.
  • FruTable (defined in fru.proto): Inventory data parsed to populate Redfish chassis properties.
  • TopologyConfig (defined in topology_config.proto): Defines chassis and cable relationships mapped to Redfish URLs.

Examples

Rate Limiter and Trust Bundle Activation (tlbmc_config_bundle.textproto)

Shows how to configure rate limiting with Random Early Detection, set up a bypass URI, and activate the CertificateService.

general_config {
  redfish_rate_limiter_module {
    enabled: true
    active: true
    leak_rate_per_sec: 50.0
    bucket_capacity: 100.0
    bypass_uri: "/redfish/v1/SessionService/Sessions"
    bypass_uri: "/redfish/v1/CertificateService"
    red {
      enabled: true
      min_threshold: 40.0
      max_threshold: 120.0
      max_drop_prob: 0.15
    }
  }
  trust_bundle_install_module {
    enabled: true
  }
}

Code References

Config & Presentation Protos

Core Code