sushy.resources 包

子包

子模块

sushy.resources.base 模块

class sushy.resources.base.AbstractDataReader

基类: object

abstract get_data()

Based on data source get data and parse to JSON

set_connection(connector, path)

Sets mandatory connection parameters

参数:
  • connector – A Connector instance

  • path – path of the resource

class sushy.resources.base.CompositeField(*args, **kwargs)

Bases: Mapping, Field

Base class for fields consisting of several sub-fields.

class sushy.resources.base.DictionaryField(*args, **kwargs)

Bases: Field

Base class for fields consisting of dictionary of several sub-fields.

class sushy.resources.base.Field(path, required=False, default=None, adapter=<function Field.<lambda>>)

基类: object

Definition for fields fetched from JSON.

class sushy.resources.base.FieldData(status_code, headers, json_doc)

基类: object

Contains data to be used when constructing Fields

property headers

The headers

property json_doc

The parsed JSON body

property status_code

The status code

class sushy.resources.base.JsonArchiveReader(archive_file)

Bases: AbstractDataReader

Gets the data from JSON file in archive

get_data()

Gets JSON file from archive. Currently supporting ZIP only

class sushy.resources.base.JsonDataReader

Bases: AbstractDataReader

Gets the data from HTTP response given by path

get_data()

Gets JSON file from URI directly

class sushy.resources.base.JsonPackagedFileReader(resource_package_name)

Bases: AbstractDataReader

Gets the data from packaged file given by path

get_data()

Gets JSON file from packaged file denoted by path

class sushy.resources.base.JsonPublicFileReader

Bases: AbstractDataReader

Loads the data from the Internet

get_data()

Get JSON file from full URI

class sushy.resources.base.LinksField(*args, **kwargs)

Bases: CompositeField

Reference to linked resources.

oem_vendors = <sushy.resources.base.Field object>
class sushy.resources.base.ListField(*args, **kwargs)

Bases: Field

Base class for fields consisting of a list of several sub-fields.

class sushy.resources.base.MappedField(field, mapping, required=False, default=None)

Bases: Field

Field taking real value from a mapping.

class sushy.resources.base.MappedListField(field, mapping, required=False, default=None)

Bases: Field

Field taking a list of values with a mapping for the values

Given JSON {‘field’:[‘xxx’, ‘yyy’]}, a sushy resource definition and mapping {‘xxx’:’a’, ‘yyy’:’b’}, the sushy object to come out will be like resource.field = [‘a’, ‘b’]

class sushy.resources.base.MessageListField(*args, **kwargs)

Bases: ListField

List of messages with details of settings update status

message = <sushy.resources.base.Field object>

Human readable message, if provided

message_args = <sushy.resources.base.Field object>

List of message substitution arguments for the message referenced by message_id from the message registry

message_id = <sushy.resources.base.Field object>

The key for this message which can be used to look up the message in a message registry

resolution = <sushy.resources.base.Field object>

Used to provide suggestions on how to resolve the situation that caused the error

severity = <sushy.resources.base.MappedField object>

Severity of the error

class sushy.resources.base.MutableResourceCollectionBase(connector, path, redfish_version=None, registries=None, root=None)

Bases: ResourceCollectionBase

delete_member(identity)

Delete the given member of the collection.

class sushy.resources.base.ResourceBase(connector, path='', redfish_version=None, registries=None, reader=None, json_doc=None, root=None)

基类: object

clone_resource(new_resource, path='')

Instantiate given resource using existing BMC connection context

get_oem_extension(vendor)

Get the OEM extension instance for this resource by OEM vendor

参数:

vendor – the OEM vendor string which is the vendor-specific extensibility identifier. Examples are ‘Contoso’, ‘Hpe’. Possible value can be got from oem_vendors attribute.

返回值:

the Redfish resource OEM extension instance.

引发:

OEMExtensionNotFoundError

invalidate(force_refresh=False)

Mark the resource as stale, prompting refresh() before getting used.

If force_refresh is set to True, then it invokes refresh() on the resource.

参数:

force_refresh – will invoke refresh on the resource, if set to True.

引发:

ResourceNotFoundError

引发:

ConnectionError

引发:

HTTPError

property json
property oem_vendors
property path
redfish_version = None

The Redfish version

refresh(force=True, json_doc=None)

Refresh the resource

Freshly retrieves/fetches the resource attributes and invokes _parse_attributes() method on successful retrieval. It is recommended not to override this method in concrete ResourceBase classes. Resource classes can place their refresh specific operations in _do_refresh() method, if needed. This method represents the template method in the paradigm of Template design pattern.

参数:
  • force – if set to False, will only refresh if the resource is marked as stale, otherwise neither it nor its subresources will be refreshed.

  • json_doc – parsed JSON document in form of Python types.

引发:

ResourceNotFoundError

引发:

ConnectionError

引发:

HTTPError

property registries
property resource_name
property root
class sushy.resources.base.ResourceCollectionBase(connector, path, redfish_version=None, registries=None, root=None)

Bases: ResourceLinksBase

members_identities = <sushy.resources.base.Field object>

A tuple with the members identities

name = <sushy.resources.base.Field object>

The name of the collection

class sushy.resources.base.ResourceLinksBase(connector, path, redfish_version=None, registries=None, root=None)

Bases: ResourceBase

get_member(identity)

Given the identity return a _resource_type object

参数:

identity – The identity of the _resource_type

返回值:

The _resource_type object

引发:

ResourceNotFoundError

get_members()

Return a list of _resource_type objects present in collection

返回值:

A list of _resource_type objects

abstract property members_identities

A sequence with members identities

sushy.resources.base.get_reader(connector, path, reader=None)

Create and configure the reader.

参数:
  • connector – A Connector instance

  • path – sub-URI path to the resource.

  • reader – Reader to use to fetch JSON data.

返回值:

the reader

sushy.resources.common 模块

class sushy.resources.common.ActionField(*args, **kwargs)

Bases: CompositeField

operation_apply_time_support = <sushy.resources.common.OperationApplyTimeSupportField object>
target_uri = <sushy.resources.base.Field object>
class sushy.resources.common.IdRefField(*args, **kwargs)

Bases: CompositeField

Reference to the resource odata identity field.

resource_uri = <sushy.resources.base.Field object>

The unique identifier for a resource

class sushy.resources.common.IdentifiersListField(*args, **kwargs)

Bases: ListField

This type describes any additional identifiers for a resource.

durable_name = <sushy.resources.base.Field object>

This indicates the world wide, persistent name of the resource.

durable_name_format = <sushy.resources.base.MappedField object>

This represents the format of the DurableName property.

class sushy.resources.common.InitializeActionField(*args, **kwargs)

Bases: ActionField

allowed_values = <sushy.resources.base.Field object>
class sushy.resources.common.OperationApplyTimeSupportField

Bases: CompositeField

maintenance_window_duration_in_seconds = <sushy.resources.base.Field object>

The expiry time of maintenance window in seconds

maintenance_window_start_time = <sushy.resources.base.Field object>

The start time of a maintenance window

mapped_supported_values = <sushy.resources.base.MappedListField object>

The types of apply times that the client is allowed request when performing a create, delete, or action operation returned as a mapped list

supported_values = <sushy.resources.base.Field object>

The types of apply times that the client is allowed request when performing a create, delete, or action operation returned as an unmapped list

Deprecated: Use mapped_supported_values.

class sushy.resources.common.ResetActionField(*args, **kwargs)

Bases: ActionField

allowed_values = <sushy.resources.base.Field object>
class sushy.resources.common.StatusField(*args, **kwargs)

Bases: CompositeField

This Field describes the status of a resource and its children.

This field shall contain any state or health properties of a resource.

health = <sushy.resources.base.MappedField object>

Represents health of resource w/o considering its dependent resources

health_rollup = <sushy.resources.base.MappedField object>

Represents health state of resource and its dependent resources

state = <sushy.resources.base.MappedField object>

Indicates the known state of the resource, such as if it is enabled.

sushy.resources.constants 模块

class sushy.resources.constants.ApplyTime(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

Apply time constants

AT_MAINTENANCE_WINDOW_START = 'AtMaintenanceWindowStart'

Apply during a maintenance window as specified by an administrator.

IMMEDIATE = 'Immediate'

Apply immediately.

IN_MAINTENANCE_WINDOW_ON_RESET = 'InMaintenanceWindowOnReset'

Apply after a reset but within maintenance window as specified by an administrator.

ON_RESET = 'OnReset'

Apply on a reset.

class sushy.resources.constants.DurableNameFormat(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

Durable name format constants

EUI = 'EUI'

The IEEE-defined 64-bit Extended Unique Identifier (EUI).

FC_WWN = 'FC_WWN'

The Fibre Channel (FC) World Wide Name (WWN).

NAA = 'NAA'

The Name Address Authority (NAA) format.

NGUID = 'NGUID'

The Namespace Globally Unique Identifier (NGUID).

NQN = 'NQN'

The NVMe Qualified Name (NQN).

NSID = 'NSID'

The NVM Namespace Identifier (NSID).

UUID = 'UUID'

The Universally Unique Identifier (UUID).

iQN = 'iQN'

The iSCSI Qualified Name (iQN).

class sushy.resources.constants.Health(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

Health related constants.

CRITICAL = 'Critical'

A critical condition requires immediate attention.

OK = 'OK'

Normal.

WARNING = 'Warning'

A condition requires attention.

class sushy.resources.constants.IndicatorLED(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

Indicator LED Constants

BLINKING = 'Blinking'

指示灯正在闪烁

LIT = 'Lit'

指示灯已点亮

OFF = 'Off'

指示灯已熄灭

UNKNOWN = 'Unknown'

无法确定指示灯的状态

class sushy.resources.constants.PowerState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

系统电源状态常量

OFF = 'Off'

资源已断电,但某些组件(例如管理控制器)可能仍有辅助电源

ON = 'On'

资源已通电

PAUSED = 'Paused'

资源已暂停。

POWERING_OFF = 'PoweringOff'

开机和关机之间的临时状态。断电操作可能需要时间,因为操作系统正在进行关机过程

POWERING_ON = 'PoweringOn'

关机和开机之间的临时状态。此临时状态可能非常短暂

class sushy.resources.constants.Protocol(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

协议类型常量

AHCI = 'AHCI'

高级主机控制器接口 (AHCI)。

DISPLAY_PORT = 'DisplayPort'

DisplayPort。

DVI = 'DVI'
ETHERNET = 'Ethernet'

以太网。

FC = 'FC'

光纤通道。

FCP = 'FCP'

用于 SCSI 的光纤通道协议。

FCoE = 'FCoE'

以太网上的光纤通道 (FCoE)。

FICON = 'FICON'

光纤连接 (FICON)。

FTP = 'FTP'

文件传输协议 (FTP)。

GEN_Z = 'GenZ'

GenZ。

HDMI = 'HDMI'

HDMI。

HTTP = 'HTTP'

超文本传输协议 (HTTP)。

HTTPS = 'HTTPS'

安全超文本传输协议 (HTTPS)。

I2C = 'I2C'

芯片间通信总线。

INFINI_BAND = 'InfiniBand'

InfiniBand。

MULTI_PROTOCOL = 'MultiProtocol'

多协议。

NFSv3 = 'NFSv3'

网络文件系统 (NFS) 版本 3。

NFSv4 = 'NFSv4'

网络文件系统 (NFS) 版本 4。

NVLink。

NVMe = 'NVMe'

非易失性存储器 Express (NVMe)。

NVMe_OVER_FABRICS = 'NVMeOverFabrics'

Fabric 上的 NVMe。

OEM = 'OEM'

OEM 特有。

PCIe = 'PCIe'

PCI Express。

RoCE = 'RoCE'

在以太网上 RDMA 协议。

RoCEv2 = 'RoCEv2'

在以太网上 RDMA 协议 版本 2。

SAS = 'SAS'

串行连接 SCSI。

SATA = 'SATA'

串行 AT 附件。

SFTP = 'SFTP'

SSH 文件传输协议 (SFTP)。

SMB = 'SMB'

服务器消息块 (SMB)。也称为通用互联网文件系统 (CIFS)。

TCP = 'TCP'

传输控制协议 (TCP)。

TFTP = 'TFTP'

简单文件传输协议 (TFTP)。

UDP = 'UDP'

用户数据报协议 (UDP)。

UHCI = 'UHCI'

通用主机控制器接口 (UHCI)。

USB = 'USB'

通用串行总线 (USB)。

VGA = 'VGA'

VGA。

iSCSI = 'iSCSI'

Internet SCSI。

iWARP = 'iWARP'

Internet 广域 RDMA 协议 (iWARP)。

class sushy.resources.constants.ResetType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

重置操作常量

FORCE_OFF = 'ForceOff'

立即关闭设备(非正常关机)。

FORCE_ON = 'ForceOn'

立即打开设备。

FORCE_RESTART = 'ForceRestart'

立即进行非正常关机并重启系统。

GRACEFUL_RESTART = 'GracefulRestart'

正常关机并重启系统。

GRACEFUL_SHUTDOWN = 'GracefulShutdown'

正常关机并断电。

NMI = 'Nmi'

生成诊断中断,通常是 x86 系统上的 NMI,以停止正常操作,完成诊断操作,并通常使系统停止运行。

ON = 'On'

打开设备。

PAUSE = 'Pause'

暂停设备的执行,但不移除电源。这通常是虚拟机管理程序的特性。

POWER_CYCLE = 'PowerCycle'

循环给设备供电。行为类似于完全移除电源,然后恢复对资源的供电。

PUSH_POWER_BUTTON = 'PushPowerButton'

模拟按下设备上的物理电源按钮。

RESUME = 'Resume'

恢复暂停设备的执行。这通常是虚拟机管理程序的特性。

SUSPEND = 'Suspend'

在断电前将设备状态写入磁盘。这允许在重新通电时恢复状态。

sushy.resources.constants.Severity

Health 的别名

class sushy.resources.constants.State(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

状态相关常量。

ABSENT = 'Absent'

此功能或资源不存在或未检测到。

DEFERRING = 'Deferring'

该元素不处理任何命令,而是排队等待新的请求。

DISABLED = 'Disabled'

此功能或资源已禁用。

ENABLED = 'Enabled'

此功能或资源已启用。

IN_TEST = 'InTest'

此功能或资源正在进行测试,或正在为调试捕获信息。

QUALIFIED = 'Qualified'

该元素的质量在可接受的操作范围内。

QUIESCED = 'Quiesced'

该元素已启用,但仅处理有限的命令集。

STANDBY_OFFLINE = 'StandbyOffline'

此功能或资源已启用,但等待外部操作激活。

STANDBY_SPARE = 'StandbySpare'

此功能或资源是冗余集的一部分,并等待故障转移或其他外部操作激活。

STARTING = 'Starting'

此功能或资源正在启动。

UNAVAILABLE_OFFLINE = 'UnavailableOffline'

此功能或资源存在但无法使用。

UPDATING = 'Updating'

该元素正在更新,可能不可用或性能下降。

sushy.resources.ipaddresses 模块

class sushy.resources.ipaddresses.AddressState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

DEPRECATED = 'Deprecated'

此地址当前在其有效生命周期内,但已超出 RFC4862 定义的首选生命周期。

FAILED = 'Failed'

此地址已通过 RFC4862 第 5.4 节定义的重复地址检测 (DAD) 测试失败,当前未在使用。

PREFERRED = 'Preferred'

此地址当前在其 RFC4862 定义的有效和首选生命周期内。

TENTATIVE = 'Tentative'

此地址当前正在根据 RFC4862 第 5.4 节进行重复地址检测 (DAD) 测试。

class sushy.resources.ipaddresses.IPv4AddressOrigin(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

BOOTP = 'BOOTP'

由 BOOTP 服务提供的地址。

DHCP = 'DHCP'

由 DHCPv4 服务提供的地址。

该地址仅对该网络段或链路有效。

STATIC = 'Static'

用户配置的静态地址。

class sushy.resources.ipaddresses.IPv6AddressOrigin(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

基础: Enum

DHCP = 'DHCPv6'

由 DHCPv6 服务提供的地址。

该地址仅对该网络段或链路有效。

SLAAC = 'SLAAC'

由无状态自动配置 (SLAAC) 服务提供的地址。

STATIC = 'Static'

用户配置的静态地址。

sushy.resources.settings 模块

class sushy.resources.settings.MaintenanceWindowField(*args, **kwargs)

Bases: CompositeField

maintenance_window_duration_in_seconds = <sushy.resources.base.Field object>

The expiry time of maintenance window in seconds

maintenance_window_start_time = <sushy.resources.base.Field object>

The start time of a maintenance window

sushy.resources.settings.NO_UPDATES = 4

未进行更新

class sushy.resources.settings.SettingsApplyTimeField

Bases: CompositeField

apply_time = <sushy.resources.base.Field object>

何时应用未来的配置

apply_time_allowable_values = <sushy.resources.base.Field object>

允许的 ApplyTime 值列表

maintenance_window_duration_in_seconds = <sushy.resources.base.Field object>

The expiry time of maintenance window in seconds

maintenance_window_start_time = <sushy.resources.base.Field object>

The start time of a maintenance window

class sushy.resources.settings.SettingsField

Bases: CompositeField

资源的设置

表示资源的未来状态和配置。该字段添加到支持未来状态和配置的资源中。

该字段包含多个属性,以帮助客户端监视服务如何使用资源,并确定应用值的可能结果(无论是否成功)。

commit(connector, value)

提交新设置值

新值将在系统或服务重启时应用。

参数:
  • connector – A Connector instance

  • value – 表示 JSON 的值,其结构特定于每个资源,调用者必须正确格式化

返回值:

响应对象

get_status(registries)

确定上次更新的状态

使用消息 ID 和严重性来确定状态。

参数:

registries – 用于解析消息的注册表

返回值:

包含状态和任何消息的 SettingsUpdate 对象

property maintenance_window

MaintenanceWindow 字段

指示给定资源是否分配了用于应用设置或操作的维护窗口

messages = <sushy.resources.base.MessageListField object>

表示上次将 Settings 资源的值应用到服务器的结果

property operation_apply_time_support

OperationApplyTimeSupport 字段

指示客户端是否允许请求特定应用时间的创建、删除或操作操作,针对给定资源

property resource_uri
time = <sushy.resources.base.Field object>

指示设置应用到服务器的时间

class sushy.resources.settings.SettingsUpdate(status, messages)

基类: object

包含设置更新状态和更新详情

property messages

来自更新的消息列表(MessageListField

property status

更新的状态

sushy.resources.settings.UPDATE_FAILURE = 2

更新时遇到错误

sushy.resources.settings.UPDATE_PENDING = 3

更新正在等待应用

sushy.resources.settings.UPDATE_SUCCESS = 1

更新成功

sushy.resources.settings.UPDATE_UNKNOWN = 0

更新状态未知

模块内容