Skip to content

A simple Python 3.4 program that can be copied into a folder at the top of any Redfish mockup and can serve Redfish requests on the specified IP/port.

License

Notifications You must be signed in to change notification settings

DMTF/Redfish-Mockup-Server

Repository files navigation

Redfish Mockup Server

Copyright 2016-2020 DMTF. All rights reserved.

License Pulls Code style: black Linters Docker GitHub stars GitHub Contributors

About

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:

Requirements

To run the mockup server natively on your system:

  • Install Python 3 and pip.
  • Install required Python packages: pip install -r requirements.txt

To run the mockup server as a Docker container:

Usage

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

Description

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.

Native system example

python redfishMockupServer.py -D /home/user/redfish-mockup

Docker container example

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

Release process

  1. Go to the "Actions" page
  2. Select the "Release and Publish" workflow
  3. Click "Run workflow"
  4. Fill out the form
  5. Click "Run workflow"

About

A simple Python 3.4 program that can be copied into a folder at the top of any Redfish mockup and can serve Redfish requests on the specified IP/port.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published