Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting tool to be a single script that builds an HTML report #67

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 128 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,129 @@
# Byte-compiled / optimized / DLL files
__pycache__/
results.json
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cover
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Use case checkers reports
reports/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2017-2024, Contributing Member(s) of Distributed Management Task
Copyright (c) 2017-2025, Contributing Member(s) of Distributed Management Task
Force, Inc.. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
135 changes: 48 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,113 +1,74 @@
# Redfish Usecase Checkers
# Redfish Use Case Checkers

Copyright 2017-2021 DMTF. All rights reserved.
Copyright 2017-2025 DMTF. All rights reserved.

## About

Language: Python 3.x

This is a collection of tools to exercise and validate common use cases for DMTF Redfish.
For example:
* Issue system reset commands (`On`, `GracefulShutdown`, `GracefulRestart`, etc.)
* Issue PATCH requests for boot override modes, modifying BIOS/UEFI boot sequence
* Add/modify/delete user accounts
The Redfish Use Case Checkers performs common management use cases to ensure a Redfish service meets functional expectations.

## Installation

## Prerequisites
From PyPI:

Install `jsonschema`, `redfish`, and `redfish_utilities`:
pip install redfish_use_case_checkers

```
pip install jsonschema
pip install redfish
pip install redfish_utilities
```


## Test Details and Examples

Each tool may be execuated with the `-h` option to get verbose help on parameters.


### One Time Boot Checker

This checker logs into a specified service and traverses the systems collection.
It will perform the following operations on all systems:
* Reads the `Boot` object
* Sets the `BootSourceOverrideTarget` property to either `Pxe` or `Usb`, depending on what's allowed
* Performs a reset of the system
* Monitors the `BootSourceOverrideTarget` property after the reset to ensure it changes back to `None`

Example:
```
$ python3 one_time_boot_check.py -r 127.0.0.1:8000 -u <user> -p <pass> -S Always
```


### Power/Thermal Info Checker
From GitHub:

This checker logs into a specified service and traverses the chassis collection.
For each chassis found, it will ensure that it can collect at least one sensor reading from the `Power` and `Thermal` resources.
For each sensor reading found, it will ensure that the readings are consistent with the state of the sensor, as in there are no bogus readings for a device that isn't present.

Example:
```
$ python3 power_thermal_test.py -r 127.0.0.1:8000 -u <user> -p <pass> -S Always
```
git clone https://github.com/DMTF/Redfish-Use-Case-Checkers.git
cd Redfish-Use-Case-Checkers
python setup.py sdist
pip install dist/redfish_use_case_checkers-x.x.x.tar.gz

## Requirements

### Power Control Checker
The Redfish Use Case Checkers requires Python3.

This checker logs into a specified service and traverses the system collection.
It will perform the following operations on all systems:
* Reads the allowable `ResetType` parameter values
* Performs a reset using each of the allowable `ResetType` values
Required external packages:

Example:
```
$ python3 power_control.py -r 127.0.0.1:8000 -u <user> -p <pass> -S Always
colorama
redfish
redfish_utilities
```

If installing from GitHub, you may install the external packages by running:

### Account Management Checker
pip install -r requirements.txt

This checker logs into a specified service and performs the following operations:
* Creates a new user
* Logs into the service with the new user
* Modifies the new user with different roles
* Deletes the new user
## Usage

Example:
```
$ python3 account_management.py --r 127.0.0.1:8000 -u <user> -p <pass> -S Always
usage: rf_use_case_checkers [-h] --user USER --password PASSWORD --rhost RHOST
[--report-dir REPORT_DIR] [--relaxed]
[--debugging]

Validate Redfish services against use cases

options:
-h, --help show this help message and exit
--user USER, -u USER The username for authentication
--password PASSWORD, -p PASSWORD
The password for authentication
--rhost RHOST, -r RHOST
The address of the Redfish service (with scheme)
--report-dir REPORT_DIR
the directory for generated report files (default:
'reports')
--relaxed Allows for some failures to be logged as warnings;
useful if the criteria is to meet the literal 'shall'
statements in the specification.
--debugging Controls the verbosity of the debugging output; if not
specified only INFO and higher are logged.
```


### Query Parameter Checker

This checker logs into a specified service and performs the following operations:
* Inspects the `ProtocolFeatures` property to see what query parameters are supported
* Tests `$filter` on the role collection within the account service
* Tests `$select` on a role within the role collection within the account service
* Tests `$expand` on service root
* Tests `only` on various resources found on service root

Example:
```
$ python3 query_parameters_check.py --r 127.0.0.1:8000 -u <user> -p <pass> -S Always
```

rf_use_case_checkers -r https://192.168.1.100 -u USERNAME -p PASSWORD

### Manager Ethernet Interface Checker
## Release Process

This checker logs into a specified service and traverses the Ethernet interface collection in each manager found in the manager collection.
It will perform the following operations on all Ethernet interfaces:
* Inspects array properties to ensure `null` is used to show empty slots that a client is allowed to configure
* Inspects string properties containing IP addresses to ensure invalid addresses, such as `0.0.0.0`, are not used
* Inspects IPv4 address properties to ensure `Gateway` is only present in the first array index
* Ensures the minimum number of expected properties for configuring VLANs and IP addresses are present

Example:
```
$ python3 manager_ethernet_interface_check.py --r 127.0.0.1:8000 -u <user> -p <pass> -S Always
```
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"
Loading