Add an asynchronous aiohttp Redfish client - #190
Draft
jyundt wants to merge 1 commit into
Draft
Conversation
Add a caller-owned aiohttp transport with Basic authentication, timeout handling, same-origin target validation, and cached responses. Include standard ComputerSystem discovery and advertised reset support for asynchronous consumers. Signed-off-by: Jacob Yundt <me@jyundt.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a separate asynchronous Redfish client implemented with
aiohttpwhile leaving the existing synchronous API unchanged.The new
redfish.aiopackage supports caller-owned sessions, HTTP Basic authentication, cached responses, configurable timeouts, same-origin URL validation, and standardComputerSystemdiscovery and reset operations.Closes #189.
Motivation
Asyncio applications need nonblocking Redfish communication without maintaining a separate protocol implementation. In particular, Home Assistant requires integrations to use its shared
aiohttp.ClientSessionso connection pooling, TLS configuration, proxy behavior, and session lifecycle remain under application control.This work supports the generic Redfish integration proposed in home-assistant/core#177991.
Implementation
The asynchronous API:
aiohttp.ClientSession.get,head,post,put,patch, anddeletemethods.redfish[aiohttp]dependency.The standard
ComputerSystemsupport:/redfish/v1/.Systemscollection link.Members@odata.nextLinklinks while rejecting pagination cycles.ComputerSystemresources.PowerStatevalues.{"ResetType": "<advertised type>"}without constructing vendor-specific action paths.Documentation and an asynchronous discovery example are included.
Backward compatibility
The existing synchronous client and public API are unchanged.
aiohttpis optional and is not installed unless theaiohttpextra is selected.A base-wheel installation was verified to import successfully without
aiohttpinstalled.Validation
aiohttp==3.9.0: 29 async tests passed on Python 3.8.twine check.redfish[aiohttp]exposes the complete async API.Live validation
The built wheel was validated against a physical Redfish BMC using a caller-owned
ClientSessionwith certificate fingerprint verification.The validation successfully retrieved the service root, discovered a
ComputerSystem, read its metadata and reportedPowerState, followed its standard ActionInfo resource, and parsed its advertised reset types and reset target.The network trace contained exactly five requests, all of which were
GET. No reset or power-control action was issued.