Copyright 2016-2020 DMTF. All rights reserved.
The Redfish mockup server, redfishMockupServer.py
, serves Redfish GET
, PATCH
, POST
, and DELETE
requests against a Redfish mockup bundle, and implements the SubmitTestEvent
action.
The server runs at either:
- An IP address and port that you specify when you start the server.
- The default IP address and port,
127.0.0.1:8000
.
The server runs in tall or short form, which indicates what the server expects at the top of the mockup directory structure:
-
Tall. (Default.) The mockup directory structure, the version resource,
/redfish
. -
Short. The mockup directory structure, the service root resource,
/redfish/v1/
.Note: To run in short form, specify the
-S
option when you start the server.
- Run the Redfish mockup server inside docker
- Run the Redfish mockup server outside docker: Prerequisite software
- Start the Redfish mockup server
- redfishMockupServer usage
- Release process
$ docker build -t redfish-mockup-server:latest .
$ docker run --rm -it -v /absolute/path-to-mockup/directory:/mymockup redfish-mockup-server:latest -D /mymockup
You must install Python 3, pip, and Python packages.
Then, you must clone the Redfish mockup server and save the Redfish Mockup Bundle to your local machine.
-
Verify your Python installation:
$ python --version
-
If Python 3.4 or later is not installed, download Python for your operating system and verify the Python installation again:
$ python --version
-
Ensure that Python is in your path:
$ echo $PATH
-
Verify your pip installation:
$ pip --version
-
If pip is not installed, install it:
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py $ python3 get-pip.py
-
Upgrade pip and verify the installation again:
$ pip install --upgrade pip $ pip --version
-
Install Python packages:
$ pip install -r requirements.txt
Clone the Redfish mockup server repository:
$ git clone [email protected]:DMTF/Redfish-Mockup-Server.git
DSP2043 Redfish Mockup Bundle provides mockups of various Redfish service implementations that show typical Redfish examples.
Go to the All Published Versions of DSP2043 page and in the Title column, click the Redfish Mockup Bundle link and save the ZIP file to your preferred location.
The server runs at either:
- An IP address and port that you specify when you start the server.
- The default IP address and port,
127.0.0.1:8000
.
-
Get the latest Redfish mockup server usage information:
$ python3 redfishMockupServer.py --help
-
Start the server in short form against the mockup in
-D <DIR>
:$ python3 redfishMockupServer.py -S -D <DIR>
Note: If you omit the
-S
option, the server runs in tall form by default.
For example, if you copy the DSP2043_2019.1
bundle to a DSP2043_2019.1
directory that is parallel with the Redfish-Mockup-Server
directory, you can start the server in short form on port 8000, as follows:
$ cd Redfish-Mockup-Server
$ python3 redfishMockupServer.py -S -D ../DSP2043_2019.1/public-localstorage
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 HOST name or IP address and PORT port. The mockup server provides Redfish resources in the 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
If running as a Docker container, use one of these actions to pull or build the container:
Action | Command |
---|---|
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 |
The following command runs the container with the built-in public-rackmount1
mockup:
docker run --rm dmtf/redfish-mockup-server:latest
The following command runs the container with a specified mockup, where <PathToMockup>
is the path to the mockup directory:
docker run --rm -v <PathToMockup>:/mockup dmtf/redfish-mockup-server:latest -D /mockup
To publish a new version, run the release.sh
script:
sh release.sh <NewVersion>
- Update
CHANGELOG.md
with the list of changes since the last release. - Update the
tool_version
variable inredfishMockupServer.py
to the new version of the tool. - Push changes to GitHub.
- Create a release in GitHub.