AbstractDataReader
CompositeField
DictionaryField
Field
FieldData
JsonArchiveReader
JsonDataReader
JsonPackagedFileReader
JsonPublicFileReader
LinksField
ListField
MappedField
MappedListField
MessageListField
MutableResourceCollectionBase
ResourceBase
ResourceCollectionBase
ResourceLinksBase
get_reader()
ApplyTime
DurableNameFormat
Health
IndicatorLED
PowerState
Protocol
Protocol.AHCI
Protocol.DISPLAY_PORT
Protocol.DVI
Protocol.ETHERNET
Protocol.FC
Protocol.FCP
Protocol.FCoE
Protocol.FICON
Protocol.FTP
Protocol.GEN_Z
Protocol.HDMI
Protocol.HTTP
Protocol.HTTPS
Protocol.I2C
Protocol.INFINI_BAND
Protocol.MULTI_PROTOCOL
Protocol.NFSv3
Protocol.NFSv4
Protocol.NVLINK
Protocol.NVMe
Protocol.NVMe_OVER_FABRICS
Protocol.OEM
Protocol.PCIe
Protocol.RoCE
Protocol.RoCEv2
Protocol.SAS
Protocol.SATA
Protocol.SFTP
Protocol.SMB
Protocol.TCP
Protocol.TFTP
Protocol.UDP
Protocol.UHCI
Protocol.USB
Protocol.VGA
Protocol.iSCSI
Protocol.iWARP
ResetType
Severity
State
Bases: object
Perform authentication.
RuntimeError
Method to assert if session based refresh can be done.
Shutdown Redfish authentication object
Undoes whatever should be undone to cancel authenticated session.
Set the context of the authentication object.
root_resource – Root sushy object
connector – Connector for http connections
Bases: AuthBase
Basic Authentication class.
This is a class used to encapsulate a basic authentication session.
username – User account with admin/server-profile access privilege.
password – User account password.
Method to assert if session based refresh can be done.
Bases: AuthBase
Session Authentication class.
This is a class used to encapsulate a redfish session.
Method to assert if session based refresh can be done.
Close the Redfish Session.
Attempts to close an established RedfishSession by deleting it from the remote Redfish controller.
Returns the session key.
The session key.
Returns the session resource id.
The session resource id.
Method to refresh a session to a Redfish controller.
This method is called to create a new session after a session that has already been established has timed-out or expired.
MissingXAuthToken
ConnectionError
AccessError
HTTPError
Reset active session related attributes.
Bases: SessionAuth
Method to refresh a session to a Redfish controller.
This method is called to create a new RedfishSession if we have previously established a RedfishSession and the previous session has timed-out or expired. If we did not previously have an established session, we simply return our BasicAuthentication requests.Session.
Bases: object
Close this connector and the associated HTTP session.
HTTP DELETE method.
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
The response object from the requests library.
ConnectionError
HTTPError
HTTP GET method.
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
The response object from the requests library.
ConnectionError
HTTPError
HTTP PATCH method.
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
The response object from the requests library.
ConnectionError
HTTPError
HTTP POST method.
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
The response object from the requests library.
ConnectionError
HTTPError
HTTP PUT method.
path – Optional sub-URI path to the resource.
data – Optional JSON data.
headers – Optional dictionary of headers.
blocking – Whether to block for asynchronous operations.
timeout – Max time in seconds to wait for blocking async call.
extra_session_req_kwargs – Optional keyword argument to pass requests library arguments which would pass on to requests session object.
The response object from the requests library.
ConnectionError
HTTPError
Sets the authentication mechanism for our connector.
Sets the http basic authentication information.
Sets the session authentication information.
Bases: SushyError
Bases: SushyError
Bases: SushyError
Bases: SushyError
Basic exception for HTTP errors
Error JSON body, if present.
Error code defined in the Redfish specification, if present.
Error message defined in the Redfish specification, if present.
HTTP status code.
Bases: SushyError
Bases: SushyError
Bases: SushyError
Bases: SushyError
Bases: SushyError
Bases: HTTPError
Bases: SushyError
Bases: HTTPError
Bases: Exception
Basic exception for errors raised by Sushy
Bases: SushyError
Raise a correct error class, if needed.
Bases: MutableMapping
Download registries on demand.
Redfish message registries can be very large. On top of that, they are not used frequently. Thus, let’s not pull them off the BMC unless the consumer is actually trying to use them.
service_root (sushy.main.Sushy) – Redfish service root object
Bases: CompositeField
The excerpt query parameter is supported
The expand query parameter is supported
The filter query parameter is supported
The only query parameter is supported
The select query parameter is supported
Bases: ResourceBase
Creates a session without invoking SessionService.
For use when a new connection is to be established. Removes prior Session and authentication data before making the request.
username – The username to utilize to create a session with the remote endpoint.
password – The password to utilize to create a session with the remote endpoint.
A session key and uri in the form of a tuple
MissingXAuthToken
ConnectionError
AccessError
HTTPError
MissingAttributeError
Get the CertificateService object
The CertificateService object
Given the identity return a Chassis object
identity – The identity of the Chassis resource. If not given, sushy will default to the single available chassis or fail if there appear to be more or less then one Chassis listed.
UnknownDefaultError if default system can’t be determined.
The Chassis object
Get the ChassisCollection object
MissingAttributeError, if the collection attribute is not found
a ChassisCollection object
Get the CompositionService object
MissingAttributeError, if the composition service attribute is not found
The CompositionService object
Get the EventService object
MissingAttributeError, if the EventService is not found
The EventService object
Given the identity return a Fabric object
identity – The identity of the Fabric resource
The Fabric object
Get the FabricCollection object
MissingAttributeError, if the collection attribute is not found
a FabricCollection object
Given the identity return a Manager object
identity – The identity of the Manager resource. If not given, sushy will default to the single available Manager or fail if there appear to be more or less then one Manager listed.
The Manager object
Get the ManagerCollection object
MissingAttributeError, if the collection attribute is not found
a ManagerCollection object
Given the identity return a Session object
identity – The identity of the session resource
The Session object
Get the SessionService object
MissingAttributeError, if the collection attribute is not found
as SessionCollection object
Returns the Sessions url
Given the identity return a System object
identity – The identity of the System resource. If not given, sushy will default to the single available System or fail if there appear to be more or less then one System listed.
UnknownDefaultError if default system can’t be determined.
The System object
Get the SystemCollection object
MissingAttributeError, if the collection attribute is not found
a SystemCollection object
Used to retrieve a TaskMonitor by task monitor URI.
task_monitor_uri – Task monitor URI
A task monitor.
Get the TaskService object
The TaskService object
Get the UpdateService object
The UpdateService object
The Redfish root service identity
Gets and combines all message registries together
Fetches all registries if any provided by Redfish service and combines together with packaged standard registries.
dict of combined message registries where key is Registry_name.Major_version.Minor_version and value is registry itself.
The Redfish root service name
The product associated with this Redfish service
The information about protocol features supported by the service
Gets and combines all registries together
Fetches all registries if any provided by Redfish service and combines together with packaged standard registries. Both message and attribute registries are supported from the Redfish service.
dict of combined registries keyed by both the registry name (Registry_name.Major_version.Minor_version) and the registry file identity, with the value being the actual registry itself.
The Redfish root service UUID
Bases: object
The amount of time to sleep before retrying
A Boolean indicating if the Task is cancellable.
Refreshes task and check if it is still processing
A boolean indicating if the task is still processing.
Construct TaskMonitor instance from received response.
Unprocessed response
URI used to initiate async operation
Redfish version. Optional when used internally.
Redfish registries. Optional when used internally.
TaskMonitor instance
MissingHeaderError if Location is missing in response
Construct Task instance from task monitor URI.
Task instance.
Indicates if the task is still processing
A boolean indicating if the task is still processing.
Refresh the Task
Freshly retrieves/fetches the Task. :raises: ResourceNotFoundError :raises: ConnectionError :raises: HTTPError
Unprocessed response.
Intended to be used internally. :returns: Unprocessed response.
Seconds the client should wait before querying the operation status
Defaults to 1 second if Retry-After not specified in response.
The number of seconds to wait
The executing task
The Task being executed.
The TaskMonitor URI
The TaskMonitor URI.
Waits until task is completed or it times out.
timeout_sec – Timeout to wait
ConnectionError when times out
Given a value x this method returns either a bool or None
x – The value to transform and return
Either None or x cast to a bool
Clear some or all cached values of the resource.
If the cache variable refers to a resource instance then the
invalidate()
method is called on that. Otherwise it is set to None.
Should there be a need to force refresh the resource and its sub-resources,
“cascading refresh”, force_refresh
is to be set to True.
This is the complimentary method of cache_it
decorator.
res_selfie – the resource instance.
force_refresh – force_refresh argument of invalidate()
method.
only_these – expects a sequence of specific method names for which the cached value/s need to be cleared only. When None, all the cached values are cleared.
Utility decorator to cache the return value of the decorated method.
This decorator is to be used with any Sushy resource class method.
This will internally create an attribute on the resource namely
_cache_<decorated_method_name>
. This is referred to as the “caching
attribute”. This attribute will eventually hold the resultant value from
the method invocation (when method gets first time called) and for every
subsequent calls to that method this cached value will get returned. It
expects the decorated method to contain its own logic of evaluation.
This also assigns a variable named _cache_attr_names
on the resource.
This variable maintains a collection of all the existing
“caching attribute” names.
To invalidate or clear the cache use cache_clear()
.
Usage:
class SomeResource(base.ResourceBase):
...
@cache_it
def get_summary(self):
# do some calculation and return the result
# and this result will be cached.
return result
...
def _do_refresh(self, force):
cache_clear(self, force)
If the returned value is a Sushy resource instance or a sequence whose
element is of type Sushy resource it handles the case of calling the
refresh()
method of that resource. This is done to avoid unnecessary
recreation of a new resource instance which got already created at the
first place in contrast to fresh retrieval of the resource json data.
Again, the force
argument is deliberately set to False to do only the
“light refresh” of the resource (only the fresh retrieval of resource)
instead of doing the complete exhaustive “cascading refresh” (resource
with all its nested subresources recursively).
class SomeResource(base.ResourceBase):
...
@property
@cache_it
def nested_resource(self):
return NestedResource(
self._conn, "Path/to/NestedResource",
redfish_version=self.redfish_version)
...
def _do_refresh(self, force):
# selective attribute clearing
cache_clear(self, force, only_these=['nested_resource'])
Do note that this is not thread safe. So guard your code to protect it from any kind of concurrency issues while using this decorator.
res_accessor_method – the resource accessor decorated method.
Convert camelCase string to underscore_joined string
camelcase_str – The camelCase string
the equivalent underscore_joined string
Extract and return a tuple of members identities
members – A list of members in JSON format
A tuple containing the members paths
Helper function to find the subresource path
resource – ResourceBase instance on which the name gets queried upon.
subresource_name – name of the resource field to fetch the ‘@odata.id’ from.
is_collection – if True, expect a list of resources to fetch the ‘@odata.id’ from.
Resource path (if is_collection is False) or a list of resource paths (if is_collection is True).
Given a value x it cast as int or None
x – The value to transform and return
Either None or x cast to an int
Helper wrapper over builtin max() function.
This function is just a wrapper over builtin max() w/o key
argument.
The default
argument specifies an object to return if the provided
iterable
is empty. Also it filters out the None type values.
iterable – an iterable
default – 0 by default
Validates apply time input for asynchronous operations
payload – Payload for which to process apply time settings
apply_time – When to update the attribute. Optional.
An sushy.ApplyTime
value.
maint_window_start_time – The start time of a maintenance window, datetime. Required when updating during maintenance window and default maintenance window not set by the system.
maint_window_duration – Duration of maintenance time since maintenance window start time in seconds. Required when updating during maintenance window and default maintenance window not set by the system.
ValueError – When input apply time settings incorrect
Payload with adjusted apply time settings if valid
Given a dictionary revert it’s mapping
dictionary – A dictionary to be reverted
A dictionary with the keys and values reverted
Remove passwords from the item.
Python’s dict.setdefault
applied on Python objects.
If name is an attribute with obj, return its value. If not, set name attribute with a value of default and return default.
obj – a python object
name – name of attribute
default – default value to be set
Simple synchronization decorator.
Decorating a method like so:
@synchronized
def foo(self, *args):
...
ensures that only one thread will execute the foo method at a time.
Bases: ResourceBase
Creates a session without invoking SessionService.
For use when a new connection is to be established. Removes prior Session and authentication data before making the request.
username – The username to utilize to create a session with the remote endpoint.
password – The password to utilize to create a session with the remote endpoint.
A session key and uri in the form of a tuple
MissingXAuthToken
ConnectionError
AccessError
HTTPError
MissingAttributeError
Get the CertificateService object
The CertificateService object
Given the identity return a Chassis object
identity – The identity of the Chassis resource. If not given, sushy will default to the single available chassis or fail if there appear to be more or less then one Chassis listed.
UnknownDefaultError if default system can’t be determined.
The Chassis object
Get the ChassisCollection object
MissingAttributeError, if the collection attribute is not found
a ChassisCollection object
Get the CompositionService object
MissingAttributeError, if the composition service attribute is not found
The CompositionService object
Get the EventService object
MissingAttributeError, if the EventService is not found
The EventService object
Given the identity return a Fabric object
identity – The identity of the Fabric resource
The Fabric object
Get the FabricCollection object
MissingAttributeError, if the collection attribute is not found
a FabricCollection object
Given the identity return a Manager object
identity – The identity of the Manager resource. If not given, sushy will default to the single available Manager or fail if there appear to be more or less then one Manager listed.
The Manager object
Get the ManagerCollection object
MissingAttributeError, if the collection attribute is not found
a ManagerCollection object
Given the identity return a Session object
identity – The identity of the session resource
The Session object
Get the SessionService object
MissingAttributeError, if the collection attribute is not found
as SessionCollection object
Returns the Sessions url
Given the identity return a System object
identity – The identity of the System resource. If not given, sushy will default to the single available System or fail if there appear to be more or less then one System listed.
UnknownDefaultError if default system can’t be determined.
The System object
Get the SystemCollection object
MissingAttributeError, if the collection attribute is not found
a SystemCollection object
Used to retrieve a TaskMonitor by task monitor URI.
task_monitor_uri – Task monitor URI
A task monitor.
Get the TaskService object
The TaskService object
Get the UpdateService object
The UpdateService object
The Redfish root service identity
Gets and combines all message registries together
Fetches all registries if any provided by Redfish service and combines together with packaged standard registries.
dict of combined message registries where key is Registry_name.Major_version.Minor_version and value is registry itself.
The Redfish root service name
The product associated with this Redfish service
The information about protocol features supported by the service
Gets and combines all registries together
Fetches all registries if any provided by Redfish service and combines together with packaged standard registries. Both message and attribute registries are supported from the Redfish service.
dict of combined registries keyed by both the registry name (Registry_name.Major_version.Minor_version) and the registry file identity, with the value being the actual registry itself.
The Redfish root service UUID
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.