Skip to main content

A collection of tools for interacting with Baseboard Management Controllers (BMCs)

Project description

BMCTools

A Python library for interacting with Baseboard Management Controllers (BMCs) using various protocols and vendor-specific implementations.

Features

  • Redfish API Support: Unified interface for managing servers via Redfish
  • Vendor-Agnostic Implementations:
    • ASUS
    • Supermicro
    • Dell iDRAC
  • Boot Management: Get/set boot order, query boot options, search by MAC address
  • IPMI Tools: Interface for ipmitool operations
  • Session Management: Automatic Redfish session handling with token-based authentication

Supported Modules

  • redfish: Redfish API client with manufacturer-specific implementations
  • racadm: Tools for Dell iDRAC using RACADM
  • ipmi: IPMI tool wrappers
  • sum: Supermicro Update Manager (SUM) tools
  • misc: Miscellaneous utilities

Installation

From Source

git clone https://github.com/jessebutryn/bmctools.git
cd bmctools
pip install -e .

Requirements

  • Python 3.9+
  • requests

Usage

Basic Redfish Example

from bmctools.redfish.redfish import Redfish

# Initialize connection
redfish = Redfish(
    ip='192.168.1.100',
    username='admin',
    password='password',
    verify_ssl=False
)

# Auto-detects manufacturer and loads appropriate implementation
print(f"Manufacturer: {redfish.manufacturer}")
print(f"System ID: {redfish.system_id}")

Boot Management

from bmctools.redfish.redfish import Redfish

redfish = Redfish('192.168.1.100', 'admin', 'password')

# Get current boot order
boot_order = redfish.get_boot_order()
print(f"Current boot order: {boot_order}")

# Get all boot options with details
boot_options = redfish.get_boot_options()
for option in boot_options:
    print(f"{option['Name']}: {option['DisplayName']}")

# Get boot option by MAC address
option = redfish.get_boot_option_by_mac('10:70:FD:29:E5:22')
print(f"Found: {option['BootOptionReference']}")

# Set new boot order (must include ALL boot options)
new_order = [
    "Boot0003",
    "Boot0004", 
    "Boot0000",
    "Boot0001",
    "Boot0002",
    "Boot0005"
]
redfish.set_boot_order(new_order)

# Get pending boot order (from FutureState/SD endpoint)
pending = redfish.get_pending_boot_order()

# Reboot to apply changes
redfish.reset_system()  # Auto-detects supported reset type
# Or specify reset type explicitly:
# redfish.manufacturer_class.reset_system('ForceRestart')

Direct Redfish API Access

from bmctools.redfish.redfish import Redfish

redfish = Redfish('192.168.1.100', 'admin', 'password')

# GET request
response = redfish.api.get('/redfish/v1/Systems')
print(response.json())

# POST request with data
payload = {'ResetType': 'ForceRestart'}
response = redfish.api.post(
    '/redfish/v1/Systems/Self/Actions/ComputerSystem.Reset',
    data=payload
)

# PATCH request with custom headers
headers = {'If-Match': 'W/"12345"'}
response = redfish.api.patch(
    '/redfish/v1/Systems/Self/SD',
    data={'Boot': {'BootOrder': ['Boot0000']}},
    headers=headers
)

Architecture

Redfish Module Structure

  • fishapi.py: Low-level Redfish HTTP client with session management
  • redfish.py: High-level interface with manufacturer detection
  • asusfish.py: ASUS-specific implementation
  • smcfish.py: Supermicro-specific implementation

Manufacturer Detection

The library automatically detects the manufacturer from the Redfish API and loads the appropriate vendor-specific implementation. All methods can be executed from the redfish.py class regardless of manufacturer.

Caching

Where possible options and methods are cached after the first retrieval to avoid redundant API calls:

# Uses cache if available
options = redfish.get_boot_options()

# Force fresh API call
options = redfish.get_boot_options(nocache=True)

Development

Docker Build

Build the Docker image with all dependencies:

make build

Launch a shell in the container:

make shell

Note: The Docker build uses --platform linux/amd64 for compatibility with vendor tools.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Author

Jesse Butryn

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bmctools-0.1.0.tar.gz (46.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bmctools-0.1.0-py3-none-any.whl (53.0 kB view details)

Uploaded Python 3

File details

Details for the file bmctools-0.1.0.tar.gz.

File metadata

  • Download URL: bmctools-0.1.0.tar.gz
  • Upload date:
  • Size: 46.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bmctools-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6eea312bf5de78071f1071e0c07656d0878987c3c996164252f45e81021d7977
MD5 ffa5e1f495682e0031cf6c1cb7765ab2
BLAKE2b-256 85426e99743b72bceefc5c6b853f1f9c806abb65516300dcb52c067ca5539643

See more details on using hashes here.

File details

Details for the file bmctools-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bmctools-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 53.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bmctools-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 451c95bb0bf49b11ab461733bc759b99ce73401fcf050a904752dae762778168
MD5 b4f8faa2bcbfc19a34f9a561dbccb105
BLAKE2b-256 18b7bcb7712e72681c0a3be872eb9aec9648cea0114f9b4f4938dabfe792ed39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page