Git Product home page Git Product logo

redfish-mockup-server's Introduction

Copyright 2016-2020 DMTF. All rights reserved.

The Redfish mockup server

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.

Contents

Run the Redfish mockup server inside docker

$ docker build -t redfish-mockup-server:latest .
$ docker run --rm -it -v /absolute/path-to-mockup/directory:/mymockup redfish-mockup-server:latest -D /mymockup

Run the Redfish mockup server outside docker: Prerequisite software

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.

Python 3

  1. Verify your Python installation:

    $ python --version
  2. If Python 3.4 or later is not installed, download Python for your operating system and verify the Python installation again:

    $ python --version
  3. Ensure that Python is in your path:

    $ echo $PATH

pip

  1. Verify your pip installation:

    $ pip --version
  2. If pip is not installed, install it:

    $ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    $ python3 get-pip.py
  3. Upgrade pip and verify the installation again:

    $ pip install --upgrade pip
    $ pip --version

Python packages

  1. Install Python packages:

    $ pip install -r requirements.txt

Redfish mockup server

Clone the Redfish mockup server repository:

$ git clone [email protected]:DMTF/Redfish-Mockup-Server.git

Redfish mockup bundle

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.

Start the Redfish mockup server

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.
  1. Get the latest Redfish mockup server usage information:

    $ python3 redfishMockupServer.py --help
  2. 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

redfishMockupServer 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

Example

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

Docker container

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

Release process

To publish a new version, run the release.sh script:

sh release.sh <NewVersion>
  1. Update CHANGELOG.md with the list of changes since the last release.
  2. Update the tool_version variable in redfishMockupServer.py to the new version of the tool.
  3. Push changes to GitHub.
  4. Create a release in GitHub.

redfish-mockup-server's People

Contributors

billdodd avatar drfleming0227 avatar glimchb avatar jautor avatar mrabhiram avatar mraineri avatar nasimh avatar pwvancil avatar rite2hhh avatar robisonjoel avatar tomasg2012 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.