nv-redfish
A modular Redfish client stack for Rust.
Repository structure
-
core: Semantic-unaware foundation used by code generated from CSDL
- Primitives and traits:
Bmc,EntityTypeRef,Expandable,NavProperty<T>,Action<T,R>,ODataId,ODataETag,EdmDateTimeOffset,EdmDuration,Empty - Optional HTTP client behind the
reqwestfeature (enabled by default) incore::http(ReqwestClient,HttpBmc) - Goal: provide the minimum building blocks for generated code; no service-specific logic
- Primitives and traits:
-
redfish: High-level ergonomic wrappers over generated Redfish schema types
- Feature-gated services (enable only what you need)
- OEM extensions are feature-gated by vendor/product
- Patch support (
redfish::patch_support) to handle vendor quirks while maintaining compatibility - Uses generated types included via
redfish::schema(autogenerated by the CSDL compiler)
-
csdl-compiler: CSDL (OData) schema compiler and Rust code generator
- Reads Redfish (and OEM) CSDL XML, compiles a subset, and generates Rust code
- Two primary compilation modes:
- Compile: compile a subset rooted at specific singletons (e.g.,
Service) - CompileOem: compile OEM schemas and include them in the root set
- Compile: compile a subset rooted at specific singletons (e.g.,
- Entity type inclusion can be controlled with wildcard patterns; only needed types are compiled
- The generator produces Rust modules and types consumed by the
redfishcrate - CLI:
csdl-compilerwith subcommands incsdl-compiler/src/commands.rs
How the pieces fit together
- Choose features in
nv-redfish(services, OEM flags). The selected features determine which schemas to include (seefeatures.toml) and which high-level wrappers are built. - The build uses
csdl-compilerto generate only the required schema types into theredfishcrate (viabuild.rs), keeping the binary lightweight. - The high-level
nv-redfishAPIs (e.g.,ServiceRoot,accounts) operate over the generated types and thecoreprimitives. - Provide a
Bmcimplementation. Withcore’sreqwestfeature, useHttpBmc<ReqwestClient>; otherwise, plug in your own transport.
Feature flags
- core:
reqwest(default) enables the HTTP client implementation. - redfish:
std-redfish: convenience bundle of common service features.- Service features:
accounts,assembly,bios,boot-options,chassis,computer-systems,ethernet-interfaces,log-services,managers,memory,network-adapters,pcie-devices,power,power-supplies,processors,secure-boot,sensors,storages,thermal,update-service(plus helperresource-status). - OEM vendor features:
oem,oem-ami,oem-dell,oem-hpe,oem-lenovo,oem-supermicro,oem-nvidia. - OEM product features:
oem-nvidia-bluefield,oem-nvidia-baseboard.
Use std-redfish for broad support and fast onboarding.
For smaller binaries and faster compilation, enable only the specific service/OEM features your client needs.
Example
Minimal shape:
// Recursion limit is need to be increased because Redfish has deep
// tree of types reference to each other.
use ServiceRoot;
use Client;
use ;
use Arc;
use Url;
async
Goals
- Be as lightweight as possible:
- Compile only schemas referenced by enabled features (
features.tomldriven). - Keep the core minimal and transport-agnostic.
- Compile only schemas referenced by enabled features (
- Support a variety of vendors compatibly:
- Feature-gated OEM extensions.
- Patch support for schema deviations in real-world BMCs.
License
See workspace Cargo.toml.
This project includes Redfish schema files as submodule from DMTF’s Redfish-Publications repository, licensed under the BSD-3-Clause license.
This project includes Swordfish schema files as submodule from SNIA’s Swordfish-Publications repository, licensed under the BSD-3-Clause license.
Contributing
Please see CONTRIBUTING.md for details.