A lightweight, dynamic Python client for Redfish BMC APIs
Project description
rackfish - Dynamic Redfish Client
A lightweight, dynamic Python client for interacting with Redfish BMC (Baseboard Management Controller) APIs. Provides intuitive access to server hardware management through lazy-loaded object graphs, automatic OEM property surfacing, and validated action invocation.
๐ฏ Why rackfish?
- ๐ Zero Dependencies (except
requests) - Minimal footprint - โก Lazy Loading - Resources fetched on-demand for performance
- ๐จ Pythonic Interface - JSON properties become Python attributes
- ๐ง OEM Support - Vendor extensions (Huawei, Dell, HPE) automatically accessible
- ๐ Smart Navigation - Related resources directly navigable via Links
- โ Action Validation - Parameter validation using ActionInfo schemas
- ๐ Collection Support - Iterate Redfish collections naturally
- ๐ Flexible Auth - Session tokens or Basic authentication
Installation
From PyPI (recommended)
pip install rackfish
From source
git clone https://github.com/thefrolov/rackfish.git
cd rackfish
pip install -e .
Development installation
pip install -e ".[dev]"
Quick Start
from rackfish import RedfishClient
# Connect to BMC
client = RedfishClient("https://bmc.example.com", "admin", "password",
use_session=True, verify_ssl=False)
root = client.connect()
# Power control - multiple ways to access systems
system = next(iter(client.Systems)) # Traditional iteration
system = client.Systems.Members[0] # Direct member access
system = client.System # Singular form (if only one member!)
system.Reset(ResetType="GracefulRestart")
# Access OEM properties (auto-surfaced)
if hasattr(system, "BootMode"):
print(f"Boot Mode: {system.BootMode}")
# Navigate linked resources
for chassis in system.Chassis:
print(f"Chassis: {chassis.Name}")
# Logout
client.logout()
Documentation
- docs/EXAMPLES.md - Comprehensive usage examples for all common Redfish operations
- docs/USE_CASES.md - Complete index of 150+ supported use cases
- docs/OEM_LINKS_SURFACING.md - Details on automatic OEM and Links surfacing
- docs/TESTS.md - Test suite documentation
- docs/INDEX.md - Master navigation document
- CHANGELOG.md - Version history and changes
- CONTRIBUTING.md - How to contribute
Common Use Cases
User Management
accounts = client.AccountService.Accounts
new_user = accounts.create({"UserName": "operator", "Password": "pass", "RoleId": "Operator"})
new_user.RoleId = "Administrator"
new_user.delete()
Storage Management
storage = next(iter(client.Systems)).Storage[0]
volume = storage.Volumes.create({"Name": "DataVol", "CapacityBytes": 500*1024**3})
Network Configuration
port = client.Managers[0].EthernetInterfaces[0]
port.patch({"IPv4Addresses": [{"Address": "192.168.1.100", "SubnetMask": "255.255.255.0"}]})
Event Subscriptions
subs = client.EventService.Subscriptions
sub = subs.create({"Destination": "https://listener/events", "EventTypes": ["Alert"]})
Firmware Updates
client.UpdateService.SimpleUpdate(ImageURI="http://server/fw.bin", TransferProtocol="HTTP")
System Health Monitoring
for temp in chassis.Thermal.Temperatures:
print(f"{temp.Name}: {temp.ReadingCelsius}ยฐC")
See docs/EXAMPLES.md for 100+ more examples covering:
- BIOS configuration
- Certificate management
- Virtual media (KVM)
- LDAP authentication
- Boot order configuration
- SEL/log collection
- And much more...
Project Structure
rackfish/
โโโ rackfish/ # Main package
โ โโโ __init__.py # Package initialization
โ โโโ client.py # Core library implementation
โโโ tests/ # Test suite
โ โโโ __init__.py
โ โโโ test_common_usage.py
โ โโโ test_oem_links_surfacing.py
โ โโโ test_recursion_fix.py
โโโ examples/ # Usage examples
โ โโโ examples_comprehensive.py
โ โโโ demo_surfacing_comprehensive.py
โ โโโ example_oem_links.py
โโโ docs/ # Documentation
โ โโโ INDEX.md
โ โโโ EXAMPLES.md
โ โโโ USE_CASES.md
โ โโโ TESTS.md
โ โโโ OEM_LINKS_SURFACING.md
โ โโโ COMPLETION_SUMMARY.md
โโโ .github/
โ โโโ copilot-instructions.md
โโโ README.md
โโโ CHANGELOG.md
โโโ CONTRIBUTING.md
โโโ LICENSE
โโโ pyproject.toml
โโโ requirements.txt
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Architecture
Core Components
RedfishClient- HTTP session management, authentication, base URL handlingRedfishResource- Dynamic resource representation with lazy loading_convert- Recursive JSON-to-object mapping with link stub creation_hydrate- Property mapping, OEM/Links surfacing, action binding
Key Design Patterns
- Lazy Loading - Link stubs defer fetching until attribute access
- OEM Surfacing - Vendor properties promoted to main object (collision-safe)
- Links Surfacing - Related resources directly accessible (collision-safe)
- Action Methods - Redfish Actions bound as callable instance methods
- ActionInfo Validation - Parameter schemas fetched and enforced
Recursion Guard
Deeply nested JSON structures are handled safely by deferring hydration (fetched=False) for all embedded resources, preventing stack overflow.
Supported Use Cases
The library supports 150+ common Redfish operations including:
System Management
- Power control (Reset, ForceOff, GracefulRestart)
- Boot order configuration
- System health monitoring
Storage
- Logical drive creation/deletion
- Storage controller management
- Drive inventory and status
Network
- IP configuration (IPv4/IPv6)
- VLAN management
- DNS/NTP configuration
- SNMP trap configuration
User & Security
- User account CRUD
- Role assignment
- Password policies
- LDAP integration
Certificates
- CSR generation
- SSL/TLS certificate import
- SSH public key management
- Two-factor authentication certs
Firmware & BIOS
- Firmware updates
- BIOS configuration
- BMC reset/rollback
Monitoring & Logs
- Temperature sensors
- Fan speeds
- Voltage readings
- System event logs (SEL)
Virtual Media
- ISO mounting (KVM)
- VNC/KVM configuration
- Virtual media operations
See EXAMPLES.md for complete list and code samples.
OEM Vendor Support
Works with any Redfish-compliant BMC including:
- Huawei - TaiShan servers, FruControl, custom boot modes
- Dell - iDRAC, DellAttributes
- HPE - iLO, HPE-specific extensions
- Lenovo - XClarity
- Supermicro - IPMI/Redfish hybrid
- And any other vendor implementing Redfish standard
OEM extensions are automatically surfaced to the main object for easy access.
Advanced Features
Generic Request Helpers
For operations not exposed as methods:
response = client.get("/redfish/v1/custom/path")
client.post("/redfish/v1/Actions/Custom", data={"param": "value"})
client.patch("/redfish/v1/Systems/1", data={"AssetTag": "NEW"})
client.delete("/redfish/v1/Collection/Item")
Allowable Values
Get valid parameter values:
reset_types = system.get_allowable_values("ResetType")
print(f"Valid reset types: {reset_types}")
Raw JSON Access
raw_data = resource.to_dict()
Contributing
See .github/copilot-instructions.md for development guidelines and architecture details.
License
See LICENSE file.
Version
Current version: 1.0.3
Requirements
- Python 3.8+
- requests library
Support
For issues, questions, or contributions, please refer to the project repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rackfish-1.0.3.tar.gz.
File metadata
- Download URL: rackfish-1.0.3.tar.gz
- Upload date:
- Size: 55.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e27f9fe0705a83d0da2e2bf0170924576f1c62f03368cfbe8ccea716aa1c1c6c
|
|
| MD5 |
92b2b97db6626bdf1dcc02c86f55cb57
|
|
| BLAKE2b-256 |
4a590360e22a3aac6757ec2ec364701a20e2c0397decdfdfea488c10b12ffb11
|
Provenance
The following attestation bundles were made for rackfish-1.0.3.tar.gz:
Publisher:
publish.yml on thefrolov/rackfish
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rackfish-1.0.3.tar.gz -
Subject digest:
e27f9fe0705a83d0da2e2bf0170924576f1c62f03368cfbe8ccea716aa1c1c6c - Sigstore transparency entry: 607802518
- Sigstore integration time:
-
Permalink:
thefrolov/rackfish@57764893d06f6c04bfabfce01c07e3e161443f53 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/thefrolov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@57764893d06f6c04bfabfce01c07e3e161443f53 -
Trigger Event:
release
-
Statement type:
File details
Details for the file rackfish-1.0.3-py3-none-any.whl.
File metadata
- Download URL: rackfish-1.0.3-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e7608ab21cc55673ae24a04eb2b58eb51bc0f7f3a4e355f1dffb63bfdf7e038
|
|
| MD5 |
8e0acbc01ee856279fddf2247e6dae95
|
|
| BLAKE2b-256 |
317faeba4593b8ddc9f40c966c95dd6c79023d4d45a98b71c448527591289186
|
Provenance
The following attestation bundles were made for rackfish-1.0.3-py3-none-any.whl:
Publisher:
publish.yml on thefrolov/rackfish
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rackfish-1.0.3-py3-none-any.whl -
Subject digest:
9e7608ab21cc55673ae24a04eb2b58eb51bc0f7f3a4e355f1dffb63bfdf7e038 - Sigstore transparency entry: 607802525
- Sigstore integration time:
-
Permalink:
thefrolov/rackfish@57764893d06f6c04bfabfce01c07e3e161443f53 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/thefrolov
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@57764893d06f6c04bfabfce01c07e3e161443f53 -
Trigger Event:
release
-
Statement type: