redfish-python-sdk 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- redfish_python_sdk-1.0.0.dist-info/METADATA +164 -0
- redfish_python_sdk-1.0.0.dist-info/RECORD +56 -0
- redfish_python_sdk-1.0.0.dist-info/WHEEL +5 -0
- redfish_python_sdk-1.0.0.dist-info/licenses/LICENSE +29 -0
- redfish_python_sdk-1.0.0.dist-info/top_level.txt +1 -0
- redfish_sdk/__init__.py +63 -0
- redfish_sdk/client.py +1894 -0
- redfish_sdk/exceptions.py +56 -0
- redfish_sdk/http_client.py +452 -0
- redfish_sdk/managers/__init__.py +21 -0
- redfish_sdk/managers/_log_helpers.py +144 -0
- redfish_sdk/managers/account.py +96 -0
- redfish_sdk/managers/chassis.py +327 -0
- redfish_sdk/managers/event.py +264 -0
- redfish_sdk/managers/managers.py +120 -0
- redfish_sdk/managers/registries.py +48 -0
- redfish_sdk/managers/session.py +130 -0
- redfish_sdk/managers/systems.py +630 -0
- redfish_sdk/managers/task.py +89 -0
- redfish_sdk/managers/update.py +99 -0
- redfish_sdk/managers/update_strategies/__init__.py +51 -0
- redfish_sdk/managers/update_strategies/base.py +101 -0
- redfish_sdk/managers/update_strategies/h3c.py +140 -0
- redfish_sdk/managers/update_strategies/inspur.py +89 -0
- redfish_sdk/managers/update_strategies/lenovo.py +59 -0
- redfish_sdk/managers/update_strategies/nettrix.py +56 -0
- redfish_sdk/managers/update_strategies/registry.py +72 -0
- redfish_sdk/managers/update_strategies/vendor_detect.py +111 -0
- redfish_sdk/managers/update_strategies/xfusion.py +60 -0
- redfish_sdk/managers/update_strategies/zte.py +68 -0
- redfish_sdk/models/__init__.py +55 -0
- redfish_sdk/models/account.py +60 -0
- redfish_sdk/models/chassis.py +86 -0
- redfish_sdk/models/check.py +231 -0
- redfish_sdk/models/common.py +102 -0
- redfish_sdk/models/drive.py +53 -0
- redfish_sdk/models/event.py +64 -0
- redfish_sdk/models/fru.py +59 -0
- redfish_sdk/models/gpu.py +33 -0
- redfish_sdk/models/logs.py +56 -0
- redfish_sdk/models/managers.py +153 -0
- redfish_sdk/models/memory.py +50 -0
- redfish_sdk/models/network_adapter.py +76 -0
- redfish_sdk/models/oem.py +173 -0
- redfish_sdk/models/pcie_device.py +89 -0
- redfish_sdk/models/power.py +92 -0
- redfish_sdk/models/processor.py +50 -0
- redfish_sdk/models/registry.py +34 -0
- redfish_sdk/models/resource_key.py +70 -0
- redfish_sdk/models/root.py +50 -0
- redfish_sdk/models/session.py +42 -0
- redfish_sdk/models/storage.py +77 -0
- redfish_sdk/models/systems.py +194 -0
- redfish_sdk/models/task.py +54 -0
- redfish_sdk/models/thermal.py +111 -0
- redfish_sdk/models/update.py +55 -0
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Manager (BMC) resource models.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
10
|
+
|
|
11
|
+
from .common import Entity, Link, Status
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class CommandShell(BaseModel):
|
|
15
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
16
|
+
connect_types_supported: Optional[List[str]] = Field(None, alias="ConnectTypesSupported")
|
|
17
|
+
max_concurrent_sessions: Optional[int] = Field(None, alias="MaxConcurrentSessions")
|
|
18
|
+
service_enabled: Optional[bool] = Field(None, alias="ServiceEnabled")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class GraphicalConsole(BaseModel):
|
|
22
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
23
|
+
connect_types_supported: Optional[List[str]] = Field(None, alias="ConnectTypesSupported")
|
|
24
|
+
max_concurrent_sessions: Optional[int] = Field(None, alias="MaxConcurrentSessions")
|
|
25
|
+
service_enabled: Optional[bool] = Field(None, alias="ServiceEnabled")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class SerialConsole(BaseModel):
|
|
29
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
30
|
+
connect_types_supported: Optional[List[str]] = Field(None, alias="ConnectTypesSupported")
|
|
31
|
+
max_concurrent_sessions: Optional[int] = Field(None, alias="MaxConcurrentSessions")
|
|
32
|
+
service_enabled: Optional[bool] = Field(None, alias="ServiceEnabled")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Manager(Entity):
|
|
36
|
+
"""
|
|
37
|
+
Represents a BMC (Baseboard Management Controller) manager.
|
|
38
|
+
Endpoint: /redfish/v1/Managers/{managerId}
|
|
39
|
+
|
|
40
|
+
"""
|
|
41
|
+
date_time: Optional[str] = Field(None, alias="DateTime")
|
|
42
|
+
date_time_local_offset: Optional[str] = Field(None, alias="DateTimeLocalOffset")
|
|
43
|
+
command_shell: Optional[CommandShell] = Field(None, alias="CommandShell")
|
|
44
|
+
graphical_console: Optional[GraphicalConsole] = Field(None, alias="GraphicalConsole")
|
|
45
|
+
serial_console: Optional[SerialConsole] = Field(None, alias="SerialConsole")
|
|
46
|
+
dedicated_network_ports: Optional[Link] = Field(None, alias="DedicatedNetworkPorts")
|
|
47
|
+
ethernet_interfaces: Optional[Link] = Field(None, alias="EthernetInterfaces")
|
|
48
|
+
firmware_version: Optional[str] = Field(None, alias="FirmwareVersion")
|
|
49
|
+
host_interfaces: Optional[Link] = Field(None, alias="HostInterfaces")
|
|
50
|
+
log_services: Optional[Link] = Field(None, alias="LogServices")
|
|
51
|
+
manager_type: Optional[str] = Field(None, alias="ManagerType")
|
|
52
|
+
model: Optional[str] = Field(None, alias="Model")
|
|
53
|
+
network_protocol: Optional[Link] = Field(None, alias="NetworkProtocol")
|
|
54
|
+
power_state: Optional[str] = Field(None, alias="PowerState")
|
|
55
|
+
security_policy: Optional[Link] = Field(None, alias="SecurityPolicy")
|
|
56
|
+
serial_interfaces: Optional[Link] = Field(None, alias="SerialInterfaces")
|
|
57
|
+
service_entry_point_uuid: Optional[str] = Field(None, alias="ServiceEntryPointUUID")
|
|
58
|
+
status: Optional[Status] = Field(None, alias="Status")
|
|
59
|
+
uuid: Optional[str] = Field(None, alias="UUID")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# ---------------------------------------------------------------------------
|
|
63
|
+
# NetworkProtocol
|
|
64
|
+
# ---------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
class ProtocolConfig(BaseModel):
|
|
67
|
+
"""Generic protocol configuration (SSH, HTTPS, IPMI, etc.)."""
|
|
68
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
69
|
+
port: Optional[int] = Field(None, alias="Port")
|
|
70
|
+
protocol_enabled: Optional[bool] = Field(None, alias="ProtocolEnabled")
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class NetworkProtocol(Entity):
|
|
74
|
+
"""
|
|
75
|
+
Network protocol configuration for a manager (BMC).
|
|
76
|
+
Endpoint: /redfish/v1/Managers/{managerId}/NetworkProtocol
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
fqdn: Optional[str] = Field(None, alias="FQDN")
|
|
80
|
+
host_name: Optional[str] = Field(None, alias="HostName")
|
|
81
|
+
http: Optional[ProtocolConfig] = Field(None, alias="HTTP")
|
|
82
|
+
https: Optional[ProtocolConfig] = Field(None, alias="HTTPS")
|
|
83
|
+
ipmi: Optional[ProtocolConfig] = Field(None, alias="IPMI")
|
|
84
|
+
ssh: Optional[ProtocolConfig] = Field(None, alias="SSH")
|
|
85
|
+
snmp: Optional[ProtocolConfig] = Field(None, alias="SNMP")
|
|
86
|
+
virtual_media: Optional[ProtocolConfig] = Field(None, alias="VirtualMedia")
|
|
87
|
+
kvmip: Optional[ProtocolConfig] = Field(None, alias="KVMIP")
|
|
88
|
+
status: Optional[Status] = Field(None, alias="Status")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# ---------------------------------------------------------------------------
|
|
92
|
+
# EthernetInterface
|
|
93
|
+
# ---------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
class IPv4Address(BaseModel):
|
|
96
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
97
|
+
address: Optional[str] = Field(None, alias="Address")
|
|
98
|
+
address_origin: Optional[str] = Field(None, alias="AddressOrigin")
|
|
99
|
+
gateway: Optional[str] = Field(None, alias="Gateway")
|
|
100
|
+
subnet_mask: Optional[str] = Field(None, alias="SubnetMask")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class IPv6Address(BaseModel):
|
|
104
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
105
|
+
address: Optional[str] = Field(None, alias="Address")
|
|
106
|
+
address_origin: Optional[str] = Field(None, alias="AddressOrigin")
|
|
107
|
+
address_state: Optional[str] = Field(None, alias="AddressState")
|
|
108
|
+
prefix_length: Optional[int] = Field(None, alias="PrefixLength")
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class Vlan(BaseModel):
|
|
112
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
113
|
+
vlan_id: Optional[int] = Field(None, alias="VLANId")
|
|
114
|
+
vlan_enable: Optional[bool] = Field(None, alias="VLANEnable")
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
class EthernetInterface(Entity):
|
|
118
|
+
"""
|
|
119
|
+
Represents a BMC Ethernet interface.
|
|
120
|
+
Endpoint: /redfish/v1/Managers/{managerId}/EthernetInterfaces/{id}
|
|
121
|
+
|
|
122
|
+
"""
|
|
123
|
+
auto_neg: Optional[bool] = Field(None, alias="AutoNeg")
|
|
124
|
+
fqdn: Optional[str] = Field(None, alias="FQDN")
|
|
125
|
+
full_duplex: Optional[bool] = Field(None, alias="FullDuplex")
|
|
126
|
+
host_name: Optional[str] = Field(None, alias="HostName")
|
|
127
|
+
ipv4_addresses: Optional[List[IPv4Address]] = Field(None, alias="IPv4Addresses")
|
|
128
|
+
ipv6_addresses: Optional[List[IPv6Address]] = Field(None, alias="IPv6Addresses")
|
|
129
|
+
ipv6_default_gateway: Optional[str] = Field(None, alias="IPv6DefaultGateway")
|
|
130
|
+
interface_enabled: Optional[bool] = Field(None, alias="InterfaceEnabled")
|
|
131
|
+
link_status: Optional[str] = Field(None, alias="LinkStatus")
|
|
132
|
+
mac_address: Optional[str] = Field(None, alias="MACAddress")
|
|
133
|
+
mtu_size: Optional[int] = Field(None, alias="MTUSize")
|
|
134
|
+
name_servers: Optional[List[str]] = Field(None, alias="NameServers")
|
|
135
|
+
permanent_mac_address: Optional[str] = Field(None, alias="PermanentMACAddress")
|
|
136
|
+
speed_mbps: Optional[int] = Field(None, alias="SpeedMbps")
|
|
137
|
+
vlan: Optional[Vlan] = Field(None, alias="VLAN")
|
|
138
|
+
status: Optional[Status] = Field(None, alias="Status")
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
# ---------------------------------------------------------------------------
|
|
142
|
+
# HostInterface
|
|
143
|
+
# ---------------------------------------------------------------------------
|
|
144
|
+
|
|
145
|
+
class HostInterface(Entity):
|
|
146
|
+
"""
|
|
147
|
+
Represents a host interface for BMC-to-host communication.
|
|
148
|
+
Endpoint: /redfish/v1/Managers/{managerId}/HostInterfaces/{id}
|
|
149
|
+
"""
|
|
150
|
+
host_interface_type: Optional[str] = Field(None, alias="HostInterfaceType")
|
|
151
|
+
interface_enabled: Optional[bool] = Field(None, alias="InterfaceEnabled")
|
|
152
|
+
network_protocol: Optional[Link] = Field(None, alias="NetworkProtocol")
|
|
153
|
+
status: Optional[Status] = Field(None, alias="Status")
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Memory (DIMM) component models.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Any, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict
|
|
10
|
+
|
|
11
|
+
from .check import Field
|
|
12
|
+
from .common import Entity, Link, Status
|
|
13
|
+
from .oem import Oem
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MemoryLocation(BaseModel):
|
|
17
|
+
"""Physical location info for a memory module."""
|
|
18
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
19
|
+
|
|
20
|
+
channel: Optional[Any] = Field(None, alias="Channel")
|
|
21
|
+
memory_controller: Optional[int] = Field(None, alias="MemoryController")
|
|
22
|
+
slot: Optional[int] = Field(None, alias="Slot")
|
|
23
|
+
socket: Optional[int] = Field(None, alias="Socket")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Memory(Entity):
|
|
27
|
+
"""
|
|
28
|
+
Represents a memory module (DIMM).
|
|
29
|
+
Endpoint: /redfish/v1/Systems/{systemId}/Memory/{memoryId}
|
|
30
|
+
|
|
31
|
+
"""
|
|
32
|
+
base_module_type: Optional[str] = Field(None, alias="BaseModuleType")
|
|
33
|
+
bus_width_bits: Optional[int] = Field(None, alias="BusWidthBits")
|
|
34
|
+
capacity_mib: Optional[int] = Field(None, alias="CapacityMiB", validate="required,type=int,gt=0")
|
|
35
|
+
data_width_bits: Optional[int] = Field(None, alias="DataWidthBits")
|
|
36
|
+
operating_speed_mhz: Optional[int] = Field(None, alias="OperatingSpeedMhz", validate="type=int,gt=0")
|
|
37
|
+
manufacturer: Optional[str] = Field(None, alias="Manufacturer", validate="type=str")
|
|
38
|
+
vendor_id: Optional[str] = Field(None, alias="VendorID")
|
|
39
|
+
part_number: Optional[str] = Field(None, alias="PartNumber", validate="type=str")
|
|
40
|
+
serial_number: Optional[str] = Field(None, alias="SerialNumber", validate="type=str")
|
|
41
|
+
device_locator: Optional[str] = Field(None, alias="DeviceLocator")
|
|
42
|
+
device_id: Optional[str] = Field(None, alias="DeviceID")
|
|
43
|
+
error_correction: Optional[str] = Field(None, alias="ErrorCorrection")
|
|
44
|
+
memory_device_type: Optional[str] = Field(None, alias="MemoryDeviceType", validate="type=str")
|
|
45
|
+
memory_type: Optional[str] = Field(None, alias="MemoryType")
|
|
46
|
+
rank_count: Optional[int] = Field(None, alias="RankCount")
|
|
47
|
+
memory_location: Optional[MemoryLocation] = Field(None, alias="MemoryLocation")
|
|
48
|
+
status: Optional[Status] = Field(None, alias="Status", validate="status")
|
|
49
|
+
oem: Optional[Oem] = Field(None, alias="Oem")
|
|
50
|
+
environment_metrics: Optional[Link] = Field(None, alias="EnvironmentMetrics")
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Network Adapter (NIC) component models.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict
|
|
10
|
+
|
|
11
|
+
from .check import Field
|
|
12
|
+
from .common import Entity, Link, Status
|
|
13
|
+
from .oem import Oem
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DataCenterBridging(BaseModel):
|
|
17
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
18
|
+
capable: Optional[bool] = Field(None, alias="Capable")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class NPAR(BaseModel):
|
|
22
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
23
|
+
npar_capable: Optional[bool] = Field(None, alias="NparCapable")
|
|
24
|
+
npar_enabled: Optional[bool] = Field(None, alias="NparEnabled")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VirtualFunction(BaseModel):
|
|
28
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
29
|
+
device_max_count: Optional[int] = Field(None, alias="DeviceMaxCount")
|
|
30
|
+
min_assignment_group_size: Optional[int] = Field(None, alias="MinAssignmentGroupSize")
|
|
31
|
+
network_port_max_count: Optional[int] = Field(None, alias="NetworkPortMaxCount")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class VirtualizationOffload(BaseModel):
|
|
35
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
36
|
+
virtual_function: Optional[VirtualFunction] = Field(None, alias="VirtualFunction")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ControllerCapabilities(BaseModel):
|
|
40
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
41
|
+
data_center_bridging: Optional[DataCenterBridging] = Field(None, alias="DataCenterBridging")
|
|
42
|
+
npar: Optional[NPAR] = Field(None, alias="NPAR")
|
|
43
|
+
network_device_function_count: Optional[int] = Field(
|
|
44
|
+
None, alias="NetworkDeviceFunctionCount"
|
|
45
|
+
)
|
|
46
|
+
network_port_count: Optional[int] = Field(None, alias="NetworkPortCount")
|
|
47
|
+
virtualization_offload: Optional[VirtualizationOffload] = Field(
|
|
48
|
+
None, alias="VirtualizationOffload"
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Controller(BaseModel):
|
|
53
|
+
"""Embedded NIC controller within a NetworkAdapter."""
|
|
54
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
55
|
+
controller_capabilities: Optional[ControllerCapabilities] = Field(
|
|
56
|
+
None, alias="ControllerCapabilities"
|
|
57
|
+
)
|
|
58
|
+
firmware_package_version: Optional[str] = Field(None, alias="FirmwarePackageVersion")
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class NetworkAdapter(Entity):
|
|
62
|
+
"""
|
|
63
|
+
Represents a network adapter (NIC).
|
|
64
|
+
Endpoint: /redfish/v1/Chassis/{chassisId}/NetworkAdapters/{networkAdapterId}
|
|
65
|
+
|
|
66
|
+
"""
|
|
67
|
+
controllers: Optional[List[Controller]] = Field(None, alias="Controllers", validate="list")
|
|
68
|
+
manufacturer: Optional[str] = Field(None, alias="Manufacturer", validate="type=str")
|
|
69
|
+
model: Optional[str] = Field(None, alias="Model", validate="type=str")
|
|
70
|
+
network_device_functions: Optional[Link] = Field(None, alias="NetworkDeviceFunctions")
|
|
71
|
+
part_number: Optional[str] = Field(None, alias="PartNumber")
|
|
72
|
+
ports: Optional[Link] = Field(None, alias="Ports")
|
|
73
|
+
sku: Optional[str] = Field(None, alias="SKU")
|
|
74
|
+
serial_number: Optional[str] = Field(None, alias="SerialNumber", validate="type=str")
|
|
75
|
+
status: Optional[Status] = Field(None, alias="Status", validate="status")
|
|
76
|
+
oem: Optional[Oem] = Field(None, alias="Oem")
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""
|
|
2
|
+
OEM (vendor-specific) data models.
|
|
3
|
+
|
|
4
|
+
Redfish allows vendors to extend standard resources with OEM fields.
|
|
5
|
+
This module models the common OEM fields used across Dell, HPE, xFusion,
|
|
6
|
+
Lenovo, Inspur (浪潮), Ningchang (宁畅), etc.
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from typing import Any, List, Optional
|
|
12
|
+
|
|
13
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
14
|
+
|
|
15
|
+
from .common import Entity, Link
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class MainBoard(Entity):
|
|
19
|
+
"""
|
|
20
|
+
Mainboard (motherboard) FRU information.
|
|
21
|
+
Field aliases support multiple vendor naming conventions.
|
|
22
|
+
|
|
23
|
+
Inherits from Entity so that when parsed from a standalone FRU
|
|
24
|
+
resource endpoint (e.g. ``/redfish/v1/Chassis/1/FruService/0``),
|
|
25
|
+
standard fields like ``@odata.id``, ``Id``, ``Name`` are preserved.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
chassis_part_number: Optional[str] = Field(None, alias="ChassisPartNumber")
|
|
29
|
+
part_number: Optional[str] = Field(None, alias="PartNumber")
|
|
30
|
+
product_name: Optional[str] = Field(None, alias="ProductName")
|
|
31
|
+
serial_number: Optional[str] = Field(None, alias="SerialNumber")
|
|
32
|
+
manufacturer: Optional[str] = Field(None, alias="Manufacturer")
|
|
33
|
+
build_date: Optional[str] = Field(None, alias="BuildDate,ManufactureDate")
|
|
34
|
+
pretty_name: Optional[str] = Field(None, alias="PrettyName")
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class DeviceMaxNum(BaseModel):
|
|
38
|
+
"""Maximum number of each hardware component type."""
|
|
39
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
40
|
+
|
|
41
|
+
memory_num: Optional[int] = Field(None, alias="MemoryNum")
|
|
42
|
+
pcie_num: Optional[int] = Field(None, alias="PCIeNum")
|
|
43
|
+
cpu_num: Optional[int] = Field(None, alias="CPUNum")
|
|
44
|
+
disk_num: Optional[int] = Field(None, alias="DiskNum")
|
|
45
|
+
power_supply_num: Optional[int] = Field(None, alias="PowerSupplyNum")
|
|
46
|
+
fan_num: Optional[int] = Field(None, alias="FanNum")
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class Bmc(BaseModel):
|
|
50
|
+
"""
|
|
51
|
+
BMC (Baseboard Management Controller) OEM extension fields.
|
|
52
|
+
|
|
53
|
+
This is a catch-all model for OEM-specific fields from various vendors.
|
|
54
|
+
Due to the wide variety of vendor implementations, most fields are optional.
|
|
55
|
+
|
|
56
|
+
Key fields:
|
|
57
|
+
- fru: Link to FRU data (华为 xFusion, 联想 etc.)
|
|
58
|
+
- mainboard: Mainboard info (华为 iBMC)
|
|
59
|
+
- bmc_version, cpld_version: Firmware version info
|
|
60
|
+
"""
|
|
61
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
62
|
+
|
|
63
|
+
# Product info
|
|
64
|
+
product_name: Optional[str] = Field(None, alias="ProductName")
|
|
65
|
+
bios_vendor: Optional[str] = Field(None, alias="BiosVendor")
|
|
66
|
+
|
|
67
|
+
# Memory OEM (H3C)
|
|
68
|
+
technology: Optional[str] = Field(None, alias="Technology")
|
|
69
|
+
|
|
70
|
+
# Memory OEM (Ningchang 宁畅)
|
|
71
|
+
mem_type: Optional[str] = Field(None, alias="Type")
|
|
72
|
+
rank: Optional[str] = Field(None, alias="Rank")
|
|
73
|
+
|
|
74
|
+
# NetworkAdapter OEM (Ningchang)
|
|
75
|
+
name: Optional[str] = Field(None, alias="Name")
|
|
76
|
+
driver_name: Optional[str] = Field(None, alias="DriverName")
|
|
77
|
+
driver_version: Optional[str] = Field(None, alias="DriverVersion")
|
|
78
|
+
card_manufacturer: Optional[str] = Field(None, alias="CardManufacturer")
|
|
79
|
+
board_manufacturer: Optional[str] = Field(None, alias="BoardManufacturer")
|
|
80
|
+
card_model: Optional[str] = Field(None, alias="CardModel")
|
|
81
|
+
device_locator: Optional[str] = Field(None, alias="DeviceLocator")
|
|
82
|
+
position: Optional[str] = Field(None, alias="Position")
|
|
83
|
+
root_bdf: Optional[str] = Field(None, alias="RootBDF")
|
|
84
|
+
|
|
85
|
+
# Chassis OEM
|
|
86
|
+
mainboard: Optional[MainBoard] = Field(None, alias="Mainboard")
|
|
87
|
+
device_max_num: Optional[DeviceMaxNum] = Field(None, alias="DeviceMaxNum")
|
|
88
|
+
power_button_enabled: Optional[bool] = Field(None, alias="PowerButtonEnabled")
|
|
89
|
+
|
|
90
|
+
# 浪潮 (Inspur) specific
|
|
91
|
+
threshold_sensors: Optional[Link] = Field(None, alias="ThresholdSensors")
|
|
92
|
+
discrete_sensors: Optional[Link] = Field(None, alias="DiscreteSensors")
|
|
93
|
+
boards: Optional[Link] = Field(None, alias="Boards")
|
|
94
|
+
backplanes: Optional[Link] = Field(None, alias="Backplanes")
|
|
95
|
+
health_summary: Optional[Link] = Field(None, alias="HealthSummary")
|
|
96
|
+
|
|
97
|
+
# Drive OEM (Inspur)
|
|
98
|
+
rebuild_led: Optional[str] = Field(None, alias="RebuildLED")
|
|
99
|
+
interface_type: Optional[str] = Field(None, alias="Interface")
|
|
100
|
+
|
|
101
|
+
# Thermal OEM
|
|
102
|
+
fan_speed_adjustment_mode: Optional[str] = Field(None, alias="FanSpeedAdjustmentMode")
|
|
103
|
+
fan_speed_level_percents: Optional[int] = Field(None, alias="FanSpeedLevelPercents")
|
|
104
|
+
|
|
105
|
+
# Power OEM
|
|
106
|
+
line_output_voltage: Optional[float] = Field(None, alias="LineOutputVoltage")
|
|
107
|
+
fan_speed: Optional[int] = Field(None, alias="FANSpeed")
|
|
108
|
+
heatsink_temperature_celsius: Optional[float] = Field(None, alias="HeatsinkTemperatureCelsius")
|
|
109
|
+
ambient_temperature_celsius: Optional[float] = Field(None, alias="AmbientTemperatureCelsius")
|
|
110
|
+
total_power: Optional[int] = Field(None, alias="TotalPower")
|
|
111
|
+
|
|
112
|
+
# System OEM
|
|
113
|
+
configuration_model: Optional[str] = Field(None, alias="ConfigurationModel")
|
|
114
|
+
bmc_version: Optional[str] = Field(None, alias="BMCVersion")
|
|
115
|
+
cpld_version: Optional[str] = Field(None, alias="CPLDVersion")
|
|
116
|
+
me_version: Optional[str] = Field(None, alias="MEVersion")
|
|
117
|
+
psu_version: Optional[str] = Field(None, alias="PSUVersion")
|
|
118
|
+
cpu_usage_percent: Optional[int] = Field(None, alias="CPUUsagePercent")
|
|
119
|
+
memory_usage_percent: Optional[int] = Field(None, alias="MemoryUsagePercent")
|
|
120
|
+
|
|
121
|
+
# FRU link (xFusion, Lenovo 等)
|
|
122
|
+
fru: Optional[Link] = Field(None, alias="Fru")
|
|
123
|
+
kvm: Optional[Link] = Field(None, alias="KVM")
|
|
124
|
+
|
|
125
|
+
# Processor OEM
|
|
126
|
+
current_speed_mhz: Optional[int] = Field(None, alias="CurrentSpeedMHz")
|
|
127
|
+
l1_cache_kib: Optional[int] = Field(None, alias="L1CacheKiB")
|
|
128
|
+
l2_cache_kib: Optional[int] = Field(None, alias="L2CacheKiB")
|
|
129
|
+
l3_cache_kib: Optional[int] = Field(None, alias="L3CacheKiB")
|
|
130
|
+
|
|
131
|
+
# Auth
|
|
132
|
+
x_auth_token: Optional[str] = Field(None, alias="X-Auth-Token")
|
|
133
|
+
serial_number: Optional[str] = Field(None, alias="SerialNumber")
|
|
134
|
+
part_number: Optional[str] = Field(None, alias="PartNumber")
|
|
135
|
+
|
|
136
|
+
# Lenovo
|
|
137
|
+
system_board_serial_number: Optional[str] = Field(None, alias="SystemBoardSerialNumber")
|
|
138
|
+
fru_part_number: Optional[str] = Field(None, alias="FruPartNumber")
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
class Oem(BaseModel):
|
|
142
|
+
"""
|
|
143
|
+
Top-level OEM wrapper used in most Redfish resources.
|
|
144
|
+
|
|
145
|
+
The 'bmc' field accepts multiple vendor-specific keys:
|
|
146
|
+
- Public (华为 iBMC / xFusion)
|
|
147
|
+
- BMC
|
|
148
|
+
- xFusion
|
|
149
|
+
- Lenovo
|
|
150
|
+
|
|
151
|
+
"""
|
|
152
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
153
|
+
|
|
154
|
+
# The SDK resolves vendor-specific OEM keys at parse time
|
|
155
|
+
bmc: Optional[Bmc] = Field(None, alias="Public")
|
|
156
|
+
host_post_code: Optional[List[Link]] = Field(None, alias="HostPostCode")
|
|
157
|
+
fru_service: Optional[str] = Field(None, alias="FruService")
|
|
158
|
+
|
|
159
|
+
def model_post_init(self, __context: Any) -> None:
|
|
160
|
+
"""
|
|
161
|
+
After initialization, resolve vendor-specific OEM keys into the 'bmc' field.
|
|
162
|
+
This replicates Java's @JsonAlias behavior for multi-vendor support.
|
|
163
|
+
"""
|
|
164
|
+
if self.bmc is None:
|
|
165
|
+
extra = self.model_extra or {}
|
|
166
|
+
for key in ("BMC", "xFusion", "Lenovo", "Hpe", "Dell"):
|
|
167
|
+
if key in extra and extra[key] is not None:
|
|
168
|
+
val = extra[key]
|
|
169
|
+
if isinstance(val, dict):
|
|
170
|
+
self.bmc = Bmc.model_validate(val)
|
|
171
|
+
elif isinstance(val, Bmc):
|
|
172
|
+
self.bmc = val
|
|
173
|
+
break
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""
|
|
2
|
+
PCIe Device component models.
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict
|
|
10
|
+
|
|
11
|
+
from .check import Field
|
|
12
|
+
from .common import Entity, Link, Status
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class PCIeInterface(BaseModel):
|
|
16
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
17
|
+
lanes_in_use: Optional[int] = Field(None, alias="LanesInUse")
|
|
18
|
+
max_lanes: Optional[int] = Field(None, alias="MaxLanes")
|
|
19
|
+
max_pcie_type: Optional[str] = Field(None, alias="MaxPCIeType")
|
|
20
|
+
pcie_type: Optional[str] = Field(None, alias="PCIeType")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class GpuCore(BaseModel):
|
|
24
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
25
|
+
build_time: Optional[str] = Field(None, alias="BuildTime")
|
|
26
|
+
capacity_gb: Optional[int] = Field(None, alias="CapacityGB")
|
|
27
|
+
member_id: Optional[int] = Field(None, alias="MemberId")
|
|
28
|
+
power: Optional[float] = Field(None, alias="Power")
|
|
29
|
+
temperature: Optional[int] = Field(None, alias="Temperature")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class GpuPerformanceParameters(BaseModel):
|
|
33
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
34
|
+
encoder_usage_percent: Optional[str] = Field(None, alias="EncoderUsagePercent")
|
|
35
|
+
decoder_usage_percent: Optional[str] = Field(None, alias="DecoderUsagePercent")
|
|
36
|
+
gpu_usage_percent: Optional[str] = Field(None, alias="GPUUsagePercent")
|
|
37
|
+
temperature_celsius: Optional[str] = Field(None, alias="TemperatureCelsius")
|
|
38
|
+
power_watts: Optional[str] = Field(None, alias="PowerWatts")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class PCIeDeviceOEMPublic(BaseModel):
|
|
42
|
+
"""OEM public extension for PCIe GPU devices (华为 xFusion specific)."""
|
|
43
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
44
|
+
device_bdf: Optional[str] = Field(None, alias="DeviceBDF")
|
|
45
|
+
device_locator: Optional[str] = Field(None, alias="DeviceLocator")
|
|
46
|
+
memory_size_mib: Optional[int] = Field(None, alias="MemorySizeMiB")
|
|
47
|
+
gpu_core: Optional[List[GpuCore]] = Field(None, alias="GpuCore")
|
|
48
|
+
gpu_performance_parameters: Optional[GpuPerformanceParameters] = Field(
|
|
49
|
+
None, alias="GpuPerformanceParameters"
|
|
50
|
+
)
|
|
51
|
+
memory_band_width: Optional[str] = Field(None, alias="MemoryBandWidth")
|
|
52
|
+
reading_celsius: Optional[int] = Field(None, alias="ReadingCelsius")
|
|
53
|
+
link_speed: Optional[str] = Field(None, alias="LinkSpeed")
|
|
54
|
+
max_link_speed: Optional[str] = Field(None, alias="MaxLinkSpeed")
|
|
55
|
+
link_width: Optional[int] = Field(None, alias="LinkWidth")
|
|
56
|
+
max_link_width: Optional[int] = Field(None, alias="MaxLinkWidth")
|
|
57
|
+
pcie_card_type: Optional[str] = Field(None, alias="PCIeCardType")
|
|
58
|
+
power_capacity_watts: Optional[int] = Field(None, alias="PowerCapacityWatts")
|
|
59
|
+
power_watts: Optional[float] = Field(None, alias="PowerWatts")
|
|
60
|
+
power_consumed_watts: Optional[float] = Field(None, alias="PowerConsumedWatts")
|
|
61
|
+
slot_number: Optional[int] = Field(None, alias="SlotNumber")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class PCIeDeviceOEM(BaseModel):
|
|
65
|
+
"""OEM wrapper for PCIe device."""
|
|
66
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
67
|
+
gpu_oem_public: Optional[PCIeDeviceOEMPublic] = Field(None, alias="Public")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class PCIeDevice(Entity):
|
|
71
|
+
"""
|
|
72
|
+
Represents a PCIe device (GPU, NIC, etc.).
|
|
73
|
+
Endpoint: /redfish/v1/Chassis/{chassisId}/PCIeDevices/{pcieDeviceId}
|
|
74
|
+
|
|
75
|
+
The 'name' field is used to identify GPU devices (contains "GPU" substring).
|
|
76
|
+
OEM field contains extended GPU metrics for 华为 xFusion servers.
|
|
77
|
+
|
|
78
|
+
"""
|
|
79
|
+
card_model: Optional[str] = Field(None, alias="CardModel")
|
|
80
|
+
pcie_functions: Optional[Link] = Field(None, alias="PCIeFunctions")
|
|
81
|
+
pcie_interface: Optional[PCIeInterface] = Field(None, alias="PCIeInterface")
|
|
82
|
+
oem: Optional[PCIeDeviceOEM] = Field(None, alias="Oem")
|
|
83
|
+
staged_version: Optional[str] = Field(None, alias="StagedVersion")
|
|
84
|
+
status: Optional[Status] = Field(None, alias="Status", validate="status")
|
|
85
|
+
model: Optional[str] = Field(None, alias="Model", validate="type=str")
|
|
86
|
+
manufacturer: Optional[str] = Field(None, alias="Manufacturer", validate="type=str")
|
|
87
|
+
serial_number: Optional[str] = Field(None, alias="SerialNumber")
|
|
88
|
+
part_number: Optional[str] = Field(None, alias="PartNumber")
|
|
89
|
+
firmware_version: Optional[str] = Field(None, alias="FirmwareVersion", validate="type=str")
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Power component models (PSU, voltage, power control).
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import List, Optional
|
|
8
|
+
|
|
9
|
+
from pydantic import BaseModel, ConfigDict
|
|
10
|
+
|
|
11
|
+
from .check import Field
|
|
12
|
+
from .common import Entity, Link, Status
|
|
13
|
+
from .oem import Oem
|
|
14
|
+
from .thermal import Redundancy
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class InputRange(BaseModel):
|
|
18
|
+
"""Input voltage range for a power supply."""
|
|
19
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
20
|
+
|
|
21
|
+
input_type: Optional[str] = Field(None, alias="InputType")
|
|
22
|
+
maximum_voltage: Optional[int] = Field(None, alias="MaximumVoltage")
|
|
23
|
+
minimum_voltage: Optional[int] = Field(None, alias="MinimumVoltage")
|
|
24
|
+
output_wattage: Optional[int] = Field(None, alias="OutputWattage")
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class PowerSupply(Entity):
|
|
28
|
+
"""
|
|
29
|
+
Represents a power supply unit (PSU).
|
|
30
|
+
Embedded in Power resource.
|
|
31
|
+
|
|
32
|
+
"""
|
|
33
|
+
firmware_version: Optional[str] = Field(None, alias="FirmwareVersion")
|
|
34
|
+
input_ranges: Optional[List[InputRange]] = Field(None, alias="InputRanges")
|
|
35
|
+
power_output_watts: Optional[int] = Field(None, alias="PowerOutputWatts", validate="type=int")
|
|
36
|
+
# LineInputVoltage is defined as Number in DMTF Redfish PowerSupply schema,
|
|
37
|
+
# which allows fractional values (e.g. 220.5). Use float to match the spec.
|
|
38
|
+
line_input_voltage: Optional[float] = Field(None, alias="LineInputVoltage")
|
|
39
|
+
line_input_voltage_type: Optional[str] = Field(None, alias="LineInputVoltageType")
|
|
40
|
+
manufacturer: Optional[str] = Field(None, alias="Manufacturer", validate="type=str")
|
|
41
|
+
member_id: Optional[str] = Field(None, alias="MemberId")
|
|
42
|
+
model: Optional[str] = Field(None, alias="Model", validate="type=str")
|
|
43
|
+
part_number: Optional[str] = Field(None, alias="PartNumber")
|
|
44
|
+
power_capacity_watts: Optional[int] = Field(None, alias="PowerCapacityWatts", validate="type=int,gt=0")
|
|
45
|
+
last_power_output_watts: Optional[int] = Field(None, alias="LastPowerOutputWatts")
|
|
46
|
+
power_supply_type: Optional[str] = Field(None, alias="PowerSupplyType")
|
|
47
|
+
related_item: Optional[List[Link]] = Field(None, alias="RelatedItem")
|
|
48
|
+
serial_number: Optional[str] = Field(None, alias="SerialNumber", validate="type=str")
|
|
49
|
+
spare_part_number: Optional[str] = Field(None, alias="SparePartNumber")
|
|
50
|
+
power_input_watts: Optional[int] = Field(None, alias="PowerInputWatts", validate="type=int")
|
|
51
|
+
redundancy: Optional[List[Redundancy]] = Field(None, alias="Redundancy")
|
|
52
|
+
status: Optional[Status] = Field(None, alias="Status", validate="status")
|
|
53
|
+
oem: Optional[Oem] = Field(None, alias="Oem")
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Voltage(BaseModel):
|
|
57
|
+
"""Voltage sensor reading."""
|
|
58
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
59
|
+
|
|
60
|
+
member_id: Optional[str] = Field(None, alias="MemberId")
|
|
61
|
+
name: Optional[str] = Field(None, alias="Name")
|
|
62
|
+
physical_context: Optional[str] = Field(None, alias="PhysicalContext")
|
|
63
|
+
reading_volts: Optional[float] = Field(None, alias="ReadingVolts")
|
|
64
|
+
status: Optional[Status] = Field(None, alias="Status")
|
|
65
|
+
upper_threshold_critical: Optional[float] = Field(None, alias="UpperThresholdCritical")
|
|
66
|
+
lower_threshold_critical: Optional[float] = Field(None, alias="LowerThresholdCritical")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class PowerControl(BaseModel):
|
|
70
|
+
"""Represents overall power consumption metrics."""
|
|
71
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
72
|
+
|
|
73
|
+
member_id: Optional[str] = Field(None, alias="MemberId")
|
|
74
|
+
name: Optional[str] = Field(None, alias="Name")
|
|
75
|
+
power_capacity_watts: Optional[int] = Field(None, alias="PowerCapacityWatts")
|
|
76
|
+
power_consumed_watts: Optional[float] = Field(None, alias="PowerConsumedWatts")
|
|
77
|
+
power_requested_watts: Optional[float] = Field(None, alias="PowerRequestedWatts")
|
|
78
|
+
power_available_watts: Optional[float] = Field(None, alias="PowerAvailableWatts")
|
|
79
|
+
power_allocated_watts: Optional[float] = Field(None, alias="PowerAllocatedWatts")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class Power(Entity):
|
|
83
|
+
"""
|
|
84
|
+
Power data (PSUs, voltages, power controls) for a chassis.
|
|
85
|
+
Endpoint: /redfish/v1/Chassis/{chassisId}/Power
|
|
86
|
+
|
|
87
|
+
"""
|
|
88
|
+
power_control: Optional[List[PowerControl]] = Field(None, alias="PowerControl")
|
|
89
|
+
power_supplies: Optional[List[PowerSupply]] = Field(None, alias="PowerSupplies")
|
|
90
|
+
redundancy: Optional[List[Redundancy]] = Field(None, alias="Redundancy")
|
|
91
|
+
voltages: Optional[List[Voltage]] = Field(None, alias="Voltages")
|
|
92
|
+
oem: Optional[Oem] = Field(None, alias="Oem")
|