A lightweight Go HTTP server that implements a mock RedFish API, providing endpoints for testing and development of RedFish-compatible applications.
- RedFish 1.18.0 Specification Compliance - Compatible with RedFish 5.0
- Basic Authentication - Default credentials:
admin/password - Core Resource Collections - Systems, Chassis, Managers, and UpdateService endpoints
- Firmware Management - Mock firmware inventory and update operations
- OData Annotations - Proper JSON responses with RedFish OData context
- Go 1.23.6 or later
-
Clone or download the project
git clone https://github.com/Metify-io/redfish_api_mock.git cd redfish_api_mock -
Install dependencies
go mod tidy
-
Build and run
go run main.go
Or build a binary:
go build ./redfish_api_mock -host localhost -port 8080
-
Server starts on port 8080
Starting RedFish Mock Server on :8080 Default credentials: admin / password
Test the service root endpoint:
curl -u admin:password http://localhost:8080/redfish/v1/ | jqGET /redfish/v1/- RedFish service root with links to resource collections
GET /redfish/v1/Systems- Collection of computer systemsGET /redfish/v1/Systems/{id}- Individual computer system details
GET /redfish/v1/Chassis- Collection of chassisGET /redfish/v1/Chassis/{id}- Individual chassis details
GET /redfish/v1/Managers- Collection of managersGET /redfish/v1/Managers/{id}- Individual manager details
GET /redfish/v1/UpdateService- Update service informationGET /redfish/v1/UpdateService/FirmwareInventory- Firmware inventory collectionGET /redfish/v1/UpdateService/FirmwareInventory/{id}- Individual firmware componentPOST /redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate- Mock firmware update
All endpoints require HTTP Basic Authentication:
- Username:
admin - Password:
password
The server returns realistic mock data including:
- Systems: Mock Server X1000 with 2 CPUs, 64GB RAM
- Chassis: 1U RackMount chassis
- Managers: BMC with firmware version 1.0.0
- Firmware Inventory: BIOS, BMC, and NIC components with version information
curl http://localhost:8080/redfish/v1/ | jqcurl -u admin:password http://localhost:8080/redfish/v1/Systems | jqcurl -u admin:password http://localhost:8080/redfish/v1/Systems/1 | jqcurl -u admin:password -X POST \
-H "Content-Type: application/json" \
-d '{"ImageURI": "https://example.com/firmware.bin"}' \
http://localhost:8080/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdatemain.go- Single file containing all server logic and data structuresgo.mod- Go module definition with gorilla/mux dependency
go buildThis mock server implements key RedFish concepts:
- OData Context - JSON-LD metadata for schema information
- Resource Collections - RESTful collections with member references
- Proper HTTP Status Codes - 200 OK, 202 Accepted, 401 Unauthorized, etc.
- RedFish Headers - OData-Version 4.0 header on all responses
- Development Testing - Test RedFish client applications without hardware
- CI/CD Integration - Mock RedFish endpoints for automated testing
- API Learning - Explore RedFish API structure and responses
- Prototyping - Build RedFish-compatible tools before hardware deployment
This project is available as open source under the terms specified by the repository license.