Redfish is an experimental, dependency-free Go library for serving a DMTF Redfish API, generated directly from the normative CSDL schema and aimed at bare-metal BMC firmware.
Part of the Kyanite stack.
Status: experimental — expect breaking changes.
- Parses the DMTF DSP8010 CSDL (OData EDMX) schema bundle and resolves versioned entity, complex, enum, and type-definition references.
- Generates Go source for an explicit list of resources only, plus the complex and enum types they transitively need.
- Emits reflection-free models with explicit marshalers; no
reflector reflection-basedencoding/jsonin the serving path. - Emits one opt-in
Register*function per resource, so anything a binary does not register is removed by the linker. - Uses
net/http.ServeMuxmethod+pattern routing; no third-party router. - Covers the OData surface a Redfish service needs:
- trimmed
$metadata(EDMX) for the generated types and the OData service document @odata.id,@odata.type,@odata.context, and@odata.etaginjection- collections (
Members,Members@odata.count), including AutoExpand collections - standard Redfish error bodies
- trimmed
- Supports sparse
PATCHon writable properties withETag/If-Matchchecks, and bound actions such asComputerSystem.Reset. - Ships an in-memory example BMC that passes the DMTF Redfish Service Validator and the Interop Validator against the OCP Baseline Hardware Management profile v1.1.1.
- No authentication or session handling;
SessionServiceis modelled but sessions are not enforced. $expand,$select, and other query parameters are not implemented.- No
Allowresponse header yet, so validators cannot test writable properties. - Only the resources listed in
gen/doc.goare generated; other resources need to be added there and regenerated. - Backend errors are not yet mapped to the DSP8011 base message registry.
- No hardware-backed provider implementations; the example uses static fixtures.
internal/csdl: CSDL/EDMX model, parser, and schema bundle resolution.internal/gen: resource resolution,$metadataconstruction, and Go source rendering.cmd/redfishgen: generator command.odata: hand-written JSON builder and OData payload helpers used by generated code.server: response, ETag, and error helpers used by generated handlers.gen: generated models, marshalers, andRegister*functions for the baseline BMC resource set.examples/bmc: minimal in-memory Redfish service built ongen.schema/csdl: vendored CSDL from DMTF DSP8010 (version inschema/VERSION).
PATCH and action bodies are parsed with encoding/json/jsontext, which currently needs the JSON v2 experiment:
export GOEXPERIMENT=jsonv2
go build ./...
go test ./...Regenerate the resource package after changing the target list in gen/doc.go:
go generate ./genRun the example service on :8080:
go run ./examples/bmcscripts/validate.sh boots the example and runs the DMTF
Redfish-Service-Validator and
Redfish-Interop-Validator. It expects both validators cloned under
third_party/ with a Python venv at third_party/.venv, the extracted DSP8010 schema files in SchemaFiles/, and the
OCP profile at profiles/OCPBaselineHardwareManagement.v1_1_1.json.
Design notes are in docs/design.html.
See the org-wide CONTRIBUTING guide. Contributions are dual-licensed.
See the org-wide SECURITY policy.
Dual-licensed under either of Apache-2.0 (LICENSE-APACHE) or MIT (LICENSE-MIT) at your option.
The CSDL schema files under schema/csdl are copyright DMTF and distributed under the
DMTF copyright policy.