Skip to content

Event subscription mechanism for sonic-redfish#4

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

Event subscription mechanism for sonic-redfish#4
chinmoy-nexthop wants to merge 2 commits into
sonic-net:masterfrom
nexthop-ai:event/bmcweb-with-dbus-bridge

Conversation

@chinmoy-nexthop
Copy link
Copy Markdown
Contributor

@chinmoy-nexthop chinmoy-nexthop commented Apr 13, 2026

Add leak detection Redfish events for SONiC BMC

What:

- Integrate rmc-events-based leak detection into bmcweb via a new integration patch.
- Add LeakDetection and LeakDetectors Redfish endpoints and wire them into the existing ThermalSubsystem and Redfish router.
- Extend sonic-dbus-bridge so leak sensors in STATE_DB are surfaced on D-Bus and drive Redfish events.
- Update the build system to copy rmc-events sources into bmcweb and fix Meson wraps for stdexec and sdbusplus.

Why:

- Expose SONiC BMC leak sensors via standard Redfish resources so clients can monitor chassis leak status.
- Emit Environmental.* Redfish events when leak detector states change (Critical/Warning/Normal) for better observability and alerting.
- Ensure the leak detection path (STATE_DB -> D-Bus -> Redfish) is robust and buildable in the SONiC/sonic-redfish pipeline.

How:

- sonic-dbus-bridge:
  - Add LeakSensorInfo and a leakSensors vector to InventoryModel.
  - Extend RedisAdapter to read LEAK_SENSOR|* keys from STATE_DB and provide getLeakSensors/getLeakSensor helpers.
  - Create leak sensor D-Bus objects under /xyz/openbmc_project/sensors/leak with:
    - xyz.openbmc_project.Inventory.Item.LeakDetector (DetectorState, Type),
    - xyz.openbmc_project.State.Decorator.OperationalStatus (Functional),
    - xyz.openbmc_project.Inventory.Item (Present, PrettyName).
  - Track leak sensor state changes in UpdateEngine and call DBusExporter::updateLeakSensorState, which updates DetectorState and Functional and emits PropertiesChanged signals.
- rmc-events:
  - Add leak_detection.hpp implementing:
    - /redfish/v1/Chassis/{id}/ThermalSubsystem/LeakDetection,
    - /LeakDetectors (collection),
    - /LeakDetectors/{detectorId} (per-sensor).
  - Add leak_detector_monitor.{hpp,cpp} to watch D-Bus leak detector PropertiesChanged signals and map DetectorState into Environmental.* MessageIds, then call EventServiceManager::sendEvent.
- bmcweb integration:
  - Update meson.build to include redfish-core/src/leak_detector_monitor.cpp in srcfiles_bmcweb.
  - Include leak_detection.hpp, set up LeakDetection navigation links from ThermalSubsystem, and register LeakDetection/LeakDetector routes in redfish.cpp.
  - Fix Meson wrap configuration for stdexec/sdbusplus
- Build system:
  - Extend the top-level Makefile to:
    - Copy rmc-events/lib, include, and src files into the bmcweb tree before applying patches.
    - Ensure stdexec.wrap is copied into sdbusplus/subprojects (fix-sdbusplus-stdexec) before native bmcweb builds.

@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 changed the title Event subscription mechanish for sonic-redfish Event subscription mechanism for sonic-redfish Apr 13, 2026
@chinmoy-nexthop chinmoy-nexthop force-pushed the event/bmcweb-with-dbus-bridge branch from 2175198 to a0d69a6 Compare April 13, 2026 15:34
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

What:
- Integrate rmc-events-based leak detection into bmcweb via a new integration patch.
- Add LeakDetection and LeakDetectors Redfish endpoints and wire them into the existing ThermalSubsystem and Redfish router.
- Extend sonic-dbus-bridge so leak sensors in STATE_DB are surfaced on D-Bus and drive Redfish events.
- Update the build system to copy rmc-events sources into bmcweb and fix Meson wraps for stdexec and sdbusplus.

Why:
- Expose SONiC BMC leak sensors via standard Redfish resources so clients can monitor chassis leak status.
- Emit Environmental.* Redfish events when leak detector states change (Critical/Warning/Normal) for better observability and alerting.
- Ensure the leak detection path (STATE_DB -> D-Bus -> Redfish) is robust and buildable in the SONiC/sonic-redfish pipeline.

How:
- sonic-dbus-bridge:
  - Add LeakSensorInfo and a leakSensors vector to InventoryModel.
  - Extend RedisAdapter to read LEAK_SENSOR|* keys from STATE_DB and provide getLeakSensors/getLeakSensor helpers.
  - Create leak sensor D-Bus objects under /xyz/openbmc_project/sensors/leak with:
    - xyz.openbmc_project.Inventory.Item.LeakDetector (DetectorState, Type),
    - xyz.openbmc_project.State.Decorator.OperationalStatus (Functional),
    - xyz.openbmc_project.Inventory.Item (Present, PrettyName).
  - Track leak sensor state changes in UpdateEngine and call DBusExporter::updateLeakSensorState, which updates DetectorState and Functional and emits PropertiesChanged signals.
- rmc-events:
  - Add leak_detection.hpp implementing:
    - /redfish/v1/Chassis/{id}/ThermalSubsystem/LeakDetection,
    - /LeakDetectors (collection),
    - /LeakDetectors/{detectorId} (per-sensor).
  - Add leak_detector_monitor.{hpp,cpp} to watch D-Bus leak detector PropertiesChanged signals and map DetectorState into Environmental.* MessageIds, then call EventServiceManager::sendEvent.
- bmcweb integration:
  - Update meson.build to include redfish-core/src/leak_detector_monitor.cpp in srcfiles_bmcweb.
  - Include leak_detection.hpp, set up LeakDetection navigation links from ThermalSubsystem, and register LeakDetection/LeakDetector routes in redfish.cpp.
  - Fix Meson wrap configuration for stdexec/sdbusplus
- Build system:
  - Extend the top-level Makefile to:
    - Copy rmc-events/lib, include, and src files into the bmcweb tree before applying patches.
    - Ensure stdexec.wrap is copied into sdbusplus/subprojects (fix-sdbusplus-stdexec) before native bmcweb builds.

Signed-off-by: Chinmoy Dey <chinmoy@nexthop.ai>
@chinmoy-nexthop chinmoy-nexthop force-pushed the event/bmcweb-with-dbus-bridge branch from a2d0023 to fe3b12e Compare May 11, 2026 09:37
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

What:
- Fix bmcweb Debian packaging so dpkg-buildpackage can find debian/changelog and complete successfully.
- Move bmcweb source tarball (.tar.gz) to target/ directory alongside other build artifacts.
- Remove redundant stdexec.wrap from sonic-dbus-bridge subprojects.
- Update build instructions and patch format for bmcweb integration.

Why:
- The bmcweb build was failing because debian/ directory and its required files (changelog, control, rules, etc.) were missing from the bmcweb tree.
- The .tar.gz source tarball was being left in the repo root, cluttering the workspace instead of being organized with other build outputs.
- sonic-dbus-bridge doesn't need its own stdexec.wrap since the dependency is handled via sdbusplus.
- Ensure the build is reproducible and all artifacts are properly collected.

How:
- bmcweb/debian/:
  - Add debian/changelog with version 1.0.0 for SONiC integration.
  - Add debian/control defining bmcweb and bmcweb-dbg packages with proper dependencies.
  - Add debian/install listing files to package (bmcweb binary, systemd units, www content).
  - Add debian/not-installed excluding unwanted artifacts (boost static libs, zstd tools, etc.).
  - Add debian/rules with proper Makefile syntax (tab-indented recipes) and wrap-mode=default.
- Makefile:
  - Add @mv $(REPO_ROOT)/bmcweb_*.tar.gz $(TARGET_DIR)/ to build-bmcweb-native target so source tarballs are collected alongside .deb files.
- patches/0004-Integrate-rmc-events-leak-detection-into-bmcweb.patch:
  - Fix corrupt patch format (line count mismatches in unified diff headers).
- sonic-dbus-bridge/subprojects/stdexec.wrap:
  - Remove this file; stdexec dependency is managed via sdbusplus, not as a standalone subproject.
- build/Dockerfile.build and README.md:
  - Update documentation and build environment setup to reflect current build process.

Signed-off-by: Chinmoy Dey <chinmoy@nexthop.ai>
@chinmoy-nexthop chinmoy-nexthop force-pushed the event/bmcweb-with-dbus-bridge branch from fe3b12e to 6f892ac Compare May 11, 2026 17:03
@mssonicbld
Copy link
Copy Markdown

/azp run

@azure-pipelines
Copy link
Copy Markdown

No pipelines are associated with this pull request.

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.

2 participants