Skip to content

Redfish OEM Extension for SONiC BMC with Schema Mapping to Redis & D-Bus#3

Open
chinmoy-nexthop wants to merge 3 commits into
sonic-net:masterfrom
nexthop-ai:oem/bmcweb-with-dbus-bridge
Open

Redfish OEM Extension for SONiC BMC with Schema Mapping to Redis & D-Bus#3
chinmoy-nexthop wants to merge 3 commits into
sonic-net:masterfrom
nexthop-ai:oem/bmcweb-with-dbus-bridge

Conversation

@chinmoy-nexthop
Copy link
Copy Markdown
Contributor

@chinmoy-nexthop chinmoy-nexthop commented Mar 31, 2026

Map OEM rack manager alerts/telemetry to Redis via sonic-dbus-bridge

What:

- Extend the OEM Sonic Manager schema so SONiC.SubmitAlert and SONiC.SubmitTelemetry carry structured, extensible payloads:
  - SubmitAlert now accepts a redfish_alert_data object keyed by alert type (FlowRateDeviation, LeakDetected, etc.), each with its own fields plus Severity and RscmPosition.
  - SubmitTelemetry now accepts an Alarms object containing sensor status flags, deviation sub-objects, leak detection, and general parameters.
- Update OEM bmcweb actions (SONiC.SubmitAlert / SONiC.SubmitTelemetry) to validate the new JSON shapes and forward the raw JSON to sonic-dbus-bridge over D-Bus instead of parsing individual fields.
- Add a RackManagerReceiver component and declarative field-mapping tables in sonic-dbus-bridge to map OEM JSON into Redis STATE_DB keys/fields.
- Refine Makefile clean/reset targets and Docker build flow for the OEM branch to ensure a fully reproducible workspace.

Why:

- Provide a flexible OEM schema for rack manager alerts and telemetry that can evolve without changing core bmcweb or bridge logic.
- Centralize the JSON→Redis mapping in sonic-dbus-bridge so bmcweb remains a thin HTTP/D-Bus adapter and internal field names are defined in one place.
- Persist rack manager data in STATE_DB in a structured way (RSCM_TELEMETRY|alarms, RSCM_ALERT|<AlertType> hashes) for later consumption by monitoring, analytics, or policy components.
- Make OEM builds more reliable by cleaning all Docker images, build artifacts, and cloned bmcweb state between runs.

How:

- oem-extension schema:
  - Change `SonicManager.v1_0_0.json`:
    - SubmitAlert:
      - Replace flat `AlertType` / `Severity` / `Message` body with `redfish_alert_data` (object, additionalProperties = AlertEntry).
      - Introduce `AlertEntry` definition with required `Severity` and `RscmPosition`, allowing additional per-alert-type fields.
    - SubmitTelemetry:
      - Replace individual scalar fields (InletLiquidTemperatureCelsius, FlowRate, Pressure, LeakDetected) with an `Alarms` object.
      - Add nested structures for InletTempDeviation, FlowRateDeviation, LiquidPressureDeviation, LeakDetected, plus status flags and general parameters.
- bmcweb OEM actions:
  - `sonic_submit_alert.hpp`:
    - Drop json_utils-based field extraction.
    - Parse the request body as JSON, require `redfish_alert_data`, and log payload size.
    - Forward the raw JSON string via D-Bus to `xyz.openbmc_project.Inventory.Manager` at `/xyz/openbmc_project/sonic/rack_manager`, interface `com.sonic.RackManager`, method `SubmitAlert`.
  - `sonic_submit_telemetry.hpp`:
    - Similarly replace per-field parsing with JSON validation, require `Alarms`, and forward the full JSON to `SubmitTelemetry` on the same D-Bus interface.
- sonic-dbus-bridge:
  - Introduce `FieldType` and `FieldMapping` plus mapping tables in `field_mapping.hpp`:
    - `getTelemetryMappings()` maps JSON paths under `Alarms.*` to fields in `RSCM_TELEMETRY|alarms`.
    - `getAlertMappings()` maps JSON paths under `redfish_alert_data.*` to fields in `RSCM_ALERT|<AlertType>` hashes.
  - Add `RackManagerReceiver` (`rack_manager_receiver.hpp/.cpp`):
    - Register D-Bus interface `com.sonic.RackManager` at `/xyz/openbmc_project/sonic/rack_manager`.
    - Implement `SubmitAlert(s json) -> b` and `SubmitTelemetry(s json) -> b` methods.
    - Parse JSON using jsoncpp, resolve dot-separated JSON paths, serialise values by type, and issue HSET calls into Redis STATE_DB (DB index 6).
  - Wire receiver into the bridge:
    - Include `rack_manager_receiver.hpp` in `bridge_app.hpp` and create `rackManagerReceiver_` member.
    - In `BridgeApp::initialize()`, construct and initialize the receiver, and register the rack manager object with the ObjectMapper when successful.
    - Add `src/rack_manager_receiver.cpp` to `meson.build` sources.

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

Signed-off-by: Chinmoy Dey <chinmoy@nexthop.ai>
Signed-off-by: Chinmoy Dey <chinmoy@nexthop.ai>
@chinmoy-nexthop chinmoy-nexthop force-pushed the oem/bmcweb-with-dbus-bridge branch from ba7f04b to efd6cc8 Compare April 11, 2026 17:01
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@chinmoy-nexthop chinmoy-nexthop marked this pull request as ready for review April 11, 2026 17:02
Comment thread oem-extension/schema/json-schema/SonicManager.json Outdated
"additionalProperties": false,
"description": "Request body for SONiC.SubmitTelemetry action.",
"properties": {
"Alarms": {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be good to generalize this name so that it is clear that both alarm and telemetry data are contained

Comment thread sonic-dbus-bridge/include/rack_manager_receiver.hpp Outdated
Comment thread sonic-dbus-bridge/src/rack_manager_receiver.cpp Outdated
@chinmoy-nexthop chinmoy-nexthop force-pushed the oem/bmcweb-with-dbus-bridge branch from efd6cc8 to ce080d2 Compare April 16, 2026 10:00
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

Map OEM rack manager alerts/telemetry to Redis via sonic-dbus-bridge

What:
- Extend the OEM Sonic Manager schema so SONiC.SubmitAlert and SONiC.SubmitTelemetry carry structured, extensible payloads:
  - SubmitAlert now accepts a redfish_alert_data object keyed by alert type (FlowRateDeviation, LeakDetected, etc.), each with its own fields plus Severity and RscmPosition.
  - SubmitTelemetry now accepts an Alarms object containing sensor status flags, deviation sub-objects, leak detection, and general parameters.
- Update OEM bmcweb actions (SONiC.SubmitAlert / SONiC.SubmitTelemetry) to validate the new JSON shapes and forward the raw JSON to sonic-dbus-bridge over D-Bus instead of parsing individual fields.
- Add a RackManagerReceiver component and declarative field-mapping tables in sonic-dbus-bridge to map OEM JSON into Redis STATE_DB keys/fields.
- Refine Makefile clean/reset targets and Docker build flow for the OEM branch to ensure a fully reproducible workspace.

Why:
- Provide a flexible OEM schema for rack manager alerts and telemetry that can evolve without changing core bmcweb or bridge logic.
- Centralize the JSON→Redis mapping in sonic-dbus-bridge so bmcweb remains a thin HTTP/D-Bus adapter and internal field names are defined in one place.
- Persist rack manager data in STATE_DB in a structured way (RSCM_TELEMETRY|alarms, RSCM_ALERT|<AlertType> hashes) for later consumption by monitoring, analytics, or policy components.
- Make OEM builds more reliable by cleaning all Docker images, build artifacts, and cloned bmcweb state between runs.

How:
- oem-extension schema:
  - Change `SonicManager.v1_0_0.json`:
    - SubmitAlert:
      - Replace flat `AlertType` / `Severity` / `Message` body with `redfish_alert_data` (object, additionalProperties = AlertEntry).
      - Introduce `AlertEntry` definition with required `Severity` and `RscmPosition`, allowing additional per-alert-type fields.
    - SubmitTelemetry:
      - Replace individual scalar fields (InletLiquidTemperatureCelsius, FlowRate, Pressure, LeakDetected) with an `Alarms` object.
      - Add nested structures for InletTempDeviation, FlowRateDeviation, LiquidPressureDeviation, LeakDetected, plus status flags and general parameters.
- bmcweb OEM actions:
  - `sonic_submit_alert.hpp`:
    - Drop json_utils-based field extraction.
    - Parse the request body as JSON, require `redfish_alert_data`, and log payload size.
    - Forward the raw JSON string via D-Bus to `xyz.openbmc_project.Inventory.Manager` at `/xyz/openbmc_project/sonic/rack_manager`, interface `com.sonic.RackManager`, method `SubmitAlert`.
  - `sonic_submit_telemetry.hpp`:
    - Similarly replace per-field parsing with JSON validation, require `Alarms`, and forward the full JSON to `SubmitTelemetry` on the same D-Bus interface.
- sonic-dbus-bridge:
  - Introduce `FieldType` and `FieldMapping` plus mapping tables in `field_mapping.hpp`:
    - `getTelemetryMappings()` maps JSON paths under `Alarms.*` to fields in `RSCM_TELEMETRY|alarms`.
    - `getAlertMappings()` maps JSON paths under `redfish_alert_data.*` to fields in `RSCM_ALERT|<AlertType>` hashes.
  - Add `RackManagerReceiver` (`rack_manager_receiver.hpp/.cpp`):
    - Register D-Bus interface `com.sonic.RackManager` at `/xyz/openbmc_project/sonic/rack_manager`.
    - Implement `SubmitAlert(s json) -> b` and `SubmitTelemetry(s json) -> b` methods.
    - Parse JSON using jsoncpp, resolve dot-separated JSON paths, serialise values by type, and issue HSET calls into Redis STATE_DB (DB index 6).
  - Wire receiver into the bridge:
    - Include `rack_manager_receiver.hpp` in `bridge_app.hpp` and create `rackManagerReceiver_` member.
    - In `BridgeApp::initialize()`, construct and initialize the receiver, and register the rack manager object with the ObjectMapper when successful.
    - Add `src/rack_manager_receiver.cpp` to `meson.build` sources.

Signed-off-by: Chinmoy Dey <chinmoy@nexthop.ai>
@chinmoy-nexthop chinmoy-nexthop force-pushed the oem/bmcweb-with-dbus-bridge branch from ce080d2 to 0fd6089 Compare April 16, 2026 10:17
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

{"redfish_alert_data.LiquidPressureDeviation.Severity", "RSCM_ALERT|LiquidPressureDeviation", "severity", FieldType::String},
{"redfish_alert_data.LiquidPressureDeviation.RscmPosition", "RSCM_ALERT|LiquidPressureDeviation", "rscm_position", FieldType::Integer},

// --- InletTemperatureDeviation ---
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InletTempDeviation would match JSON


LOG_INFO("RackManagerReceiver: Stored %d fields (%d skipped / %zu total)",
stored, skipped, mappings.size());
return stored > 0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we reject an empty JSON?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants