Copyright 2016-2020 DMTF. All rights reserved.
The Redfish Mockup Server serves Redfish requests against a Redfish mockup. The server runs at either a specified IP address and port or the default IP address and port, 127.0.0.1:8000
.
You can find DMTF-published sample mockups at All Published Versions of DSP2043.
To create a mockup from a service, use the Redfish-Mockup-Creator.
The scope of this tool is to serve a static mockup for development purposes. It does support modification requests, such as PATCH
and POST
, and actions to a limited extent. For a more feature-rich Redfish experience, one of the following tools can be used instead of the Redfish Mockup Server:
- Redfish-Interface-Emulator: A more functional service that implements modification requests and actions.
- Swordfish-API-Emulator: A SNIA extension to the previous tool with more built-in functionality supported.
To run the mockup server natively on your system:
To run the mockup server as a Docker container:
- Install Docker.
Redfish Mockup Server, version 1.1.4
usage: redfishMockupServer.py [-h] [-H HOST] [-p PORT] [-D DIR] [-E] [-X]
[-t TIME] [-T] [-s] [--cert CERT] [--key KEY]
[-S] [-P]
Serve a static Redfish mockup.
optional arguments:
-h, --help show this help message and exit
-H HOST, --host HOST, --Host HOST
hostname or IP address (default 127.0.0.1)
-p PORT, --port PORT, --Port PORT
host port (default 8000)
-D DIR, --dir DIR, --Dir DIR
path to mockup dir (may be relative to CWD)
-E, --test-etag, --TestEtag
(unimplemented) etag testing
-X, --headers load headers from headers.json files in mockup
-t TIME, --time TIME delay in seconds added to responses (float or int)
-T delay response based on times in time.json files in
mockup
-s, --ssl place server in SSL (HTTPS) mode; requires a cert and
key
--cert CERT the certificate for SSL
--key KEY the key for SSL
-S, --short-form, --shortForm
apply short form to mockup (omit filepath /redfish/v1)
-P, --ssdp make mockup SSDP discoverable
The mockup server starts an HTTP server at the -H HOST
host and -p PORT
port. The mockup server provides Redfish resources in the -D DIR
mockup directory.
If the mockup does not contain the representation of the /redfish
resource, you must provide the --short-form
argument. If you omit the mockup, the mockup server serves DMTF's public-rackmount1
mockup.
python redfishMockupServer.py -D /home/user/redfish-mockup
To run as a Docker container, use one of these actions to pull or build the container:
-
Pull the container from Docker Hub:
docker pull dmtf/redfish-mockup-server:latest
-
Build a container from local source:
docker build -t dmtf/redfish-mockup-server:latest .
-
Build a container from GitHub:
docker build -t dmtf/redfish-mockup-server:latest https://github.com/DMTF/Redfish-Mockup-Server.git#main
This command runs the container with the built-in public-rackmount1
mockup:
docker run --rm dmtf/redfish-mockup-server:latest
This command runs the container with a specified mockup, where <path-to-mockup>
is the path to the mockup directory:
docker run --rm -v <path-to-mockup>:/mockup dmtf/redfish-mockup-server:latest -D /mockup
Or using compose:
docker compose up
- Go to the "Actions" page
- Select the "Release and Publish" workflow
- Click "Run workflow"
- Fill out the form
- Click "Run workflow"