How openbmc/entity-manager works
Main components
a. Configuration Store
• Directory: configurations/*.json
• Schemas: schemas/*.json
b. Detection Daemons (Publishers)
• fru-device (src/fru_device)
• devicetree_vpd_parser (src/devicetree_vpd_parser)
• Other custom daemons (e.g., peci-pcie, smbios-mdr)
c. Entity Manager Core
• Modules under src/entity_manager:
• configuration (loads JSON)
• perform_scan & perform_probe (runs detection rules)
• overlay & expression (overrides & conditional logic)
• topology (builds entity graph)
• dbus_interface (publishes Exposes records)
d. D-Bus Message Bus
• sdbusplus interface, service files under service_files/dbus
e. Reactors / Consumers
• dbus-sensors (scans & creates sensor objects)
• CPU managers, hot-swap backplane daemons, drive daemons
f. Build & Test Infrastructure
• Meson build files (meson.build, subprojects/)
• Unit tests (test/*.cpp)
Relationships & data flow
• Config Loader reads JSON configs & validates against schemas
• Detection Daemons scan hardware → publish “Detected Entity” signals on D-Bus
• Entity Manager Core listens on D-Bus → triggers perform_scan() & perform_probe() → applies overlays/expressions → builds in‐memory topology
• Core publishes “Exposes” records on D-Bus for each detected entity feature
• Reactors subscribe to “Exposes” signals → instantiate runtime objects (sensors, controllers)
• This loop repeats on re-detection events (device plug/unplug, host power on)
Architectural patterns & principles
– Event‐driven pipeline: Detection → Core Processing → Publication → Consumption
– Plugin-style modules: separate .cpp/.hpp under src/entity_manager, fru_device, devicetree_vpd_parser
– Clear separation of concerns: config parsing, detection logic, topology construction, D-Bus interface, reactor actions
– Schema‐driven configuration: JSON+Valijson ensures consistency
Technologies & libraries
– C++17, Meson build system
– nlohmann_json for JSON parsing
– Valijson for schema validation
– sdbusplus & phosphor-dbus-interfaces for D-Bus integration
– phosphor-logging for log messages
– GoogleTest for unit tests