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 models with explicit marshalers and body parsers that use neither
reflectnorencoding/json. (net/httpitself linksreflect, and theupdate/raucbackend decodes the output ofrauc statuswithencoding/json.) - 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.typeand@odata.context, andETagheaders- 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.Resetthat complete synchronously or asynchronously as tasks. - Lets providers return a
server.Errorto choose the HTTP status and base message of an error response. - Authenticates requests with sessions (
X-Auth-Token), HTTP Basic, or verified TLS client certificates, checks the privileges of the Administrator, Operator and ReadOnly roles, and serves theAccountServicewith accounts and roles and theSessionServicewith sessions. Passwords are stored as PBKDF2-HMAC-SHA256 hashes; failed logins lock the user name for a while, and at most two passwords, for logins or password changes, are hashed at a time. Changes sent by a browser from another origin are refused. - Serves the
UpdateServicewith firmware and software inventory,SimpleUpdate, multipart HTTP push updates, andActivateon top of a pluggable, OS-independent update backend. - Ships an in-memory example BMC, which requires a login (admin/admin, over plain HTTP: for local use only), that passes the DMTF Redfish Service Validator, with Basic and with session authentication, and the Interop Validator against the OCP Baseline Hardware Management profile v1.1.1.
$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/targets.txtare generated; other resources need to be added there and regenerated. - Only a subset of the DSP8011 base messages is used, and message registries are not served.
- The example uses static fixtures. The RAUC and Intel RSU update backends drive the
raucandrsu_clientcommand line tools and have been tested on one board only (an Agilex 7 SoM).
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, andBodyIdleTimeout, an inactivity limit for request bodies such as update uploads.gen: generated models, marshalers, andRegister*functions for the baseline BMC resource set.auth: accounts, sessions, authentication and authorization middleware, and the account and session services. TLS is left to thehttp.Server.task: runs long-running operations as Redfish tasks and serves the TaskService and task monitors.update: serves the UpdateService and firmware/software inventory on top of an update backend, or of several joined withupdate.Join.update/rauc: update backend for Linux systems updated with RAUC, using therauccommand line tool.update/rsu: update backend for Intel (Altera) RSU, usingrsu_clientfrom LIBRSU and an installer command that reports likerauc install.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/targets.txt:
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. Implementation status is tracked in ROADMAP.md.
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.