Documentation
¶
Index ¶
- Constants
- Variables
- func DefaultVendors() map[Manufacturer]VendorFactory
- func GenerateSecurePassword(manufacturer Manufacturer, length int) (string, error)
- type AccountManager
- type AllowedValues
- type BIOSManager
- type BMC
- type BMCSettingsManager
- type BootController
- type ComponentType
- type DellRedfishBMC
- func (r *DellRedfishBMC) CheckBMCAttributes(ctx context.Context, bmcUUID string, attrs schemas.SettingsAttributes) (bool, error)
- func (r *DellRedfishBMC) CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
- func (r *DellRedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
- func (r *DellRedfishBMC) GetBMCPendingAttributeValues(ctx context.Context, bmcUUID string) (schemas.SettingsAttributes, error)
- func (r *DellRedfishBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *DellRedfishBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *DellRedfishBMC) SetBMCAttributesImmediately(ctx context.Context, bmcUUID string, attributes schemas.SettingsAttributes) error
- func (r *DellRedfishBMC) UpgradeBMCVersion(ctx context.Context, _ string, ...) (string, bool, error)
- func (r *DellRedfishBMC) UpgradeBiosVersion(ctx context.Context, _ string, ...) (string, bool, error)
- type Drive
- type Entity
- type EventSubscriber
- type FirmwareUpdater
- type HPERedfishBMC
- func (r *HPERedfishBMC) CheckBMCAttributes(_ context.Context, _ string, _ schemas.SettingsAttributes) (bool, error)
- func (r *HPERedfishBMC) CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
- func (r *HPERedfishBMC) CreateEventSubscription(ctx context.Context, destination string, ...) (string, error)
- func (r *HPERedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
- func (r *HPERedfishBMC) GetBMCPendingAttributeValues(_ context.Context, _ string) (schemas.SettingsAttributes, error)
- func (r *HPERedfishBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *HPERedfishBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *HPERedfishBMC) SetBMCAttributesImmediately(ctx context.Context, _ string, attributes schemas.SettingsAttributes) error
- func (r *HPERedfishBMC) UpgradeBMCVersion(ctx context.Context, _ string, ...) (string, bool, error)
- func (r *HPERedfishBMC) UpgradeBiosVersion(ctx context.Context, _ string, ...) (string, bool, error)
- type IndicatorController
- type InvalidBIOSSettingsError
- type InvalidBMCSettingsError
- type LenovoRedfishBMC
- func (r *LenovoRedfishBMC) CheckBMCAttributes(_ context.Context, _ string, _ schemas.SettingsAttributes) (bool, error)
- func (r *LenovoRedfishBMC) CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
- func (r *LenovoRedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
- func (r *LenovoRedfishBMC) GetBMCPendingAttributeValues(_ context.Context, _ string) (schemas.SettingsAttributes, error)
- func (r *LenovoRedfishBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *LenovoRedfishBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *LenovoRedfishBMC) SetBMCAttributesImmediately(ctx context.Context, _ string, attributes schemas.SettingsAttributes) error
- func (r *LenovoRedfishBMC) UpgradeBMCVersion(ctx context.Context, _ string, ...) (string, bool, error)
- func (r *LenovoRedfishBMC) UpgradeBiosVersion(ctx context.Context, _ string, ...) (string, bool, error)
- type Manager
- type ManagerController
- type Manufacturer
- type ManufacturerPasswordConfig
- type NetworkInterface
- type Options
- type PowerController
- type Processor
- type RedfishBaseBMC
- func (r *RedfishBaseBMC) CheckBMCAttributes(_ context.Context, _ string, _ schemas.SettingsAttributes) (bool, error)
- func (r *RedfishBaseBMC) CheckBMCPendingComponentUpgrade(_ context.Context, componentType ComponentType) (bool, error)
- func (r *RedfishBaseBMC) CheckBiosAttributes(attrs schemas.SettingsAttributes) (bool, error)
- func (r *RedfishBaseBMC) Client() *gofish.APIClient
- func (r *RedfishBaseBMC) CreateEventSubscription(ctx context.Context, destination string, ...) (string, error)
- func (r *RedfishBaseBMC) CreateOrUpdateAccount(_ context.Context, userName, role, password string, enabled bool) error
- func (r *RedfishBaseBMC) DeleteAccount(ctx context.Context, userName, id string) error
- func (r *RedfishBaseBMC) DeleteEventSubscription(_ context.Context, uri string) error
- func (r *RedfishBaseBMC) DiscoverManager(_ context.Context) (*schemas.Manager, error)
- func (r *RedfishBaseBMC) ForcePowerOff(ctx context.Context, systemURI string) error
- func (r *RedfishBaseBMC) GetAccountService() (*schemas.AccountService, error)
- func (r *RedfishBaseBMC) GetAccounts() ([]*schemas.ManagerAccount, error)
- func (r *RedfishBaseBMC) GetBMCAttributeValues(_ context.Context, _ string, attributes map[string]string) (schemas.SettingsAttributes, error)
- func (r *RedfishBaseBMC) GetBMCPendingAttributeValues(_ context.Context, _ string) (schemas.SettingsAttributes, error)
- func (r *RedfishBaseBMC) GetBMCUpgradeTask(_ context.Context, _ string, _ string) (*schemas.Task, error)
- func (r *RedfishBaseBMC) GetBMCVersion(ctx context.Context, bmcUUID string) (string, error)
- func (r *RedfishBaseBMC) GetBiosAttributeValues(ctx context.Context, systemURI string, attributes []string) (schemas.SettingsAttributes, error)
- func (r *RedfishBaseBMC) GetBiosPendingAttributeValues(ctx context.Context, systemURI string) (schemas.SettingsAttributes, error)
- func (r *RedfishBaseBMC) GetBiosUpgradeTask(_ context.Context, _ string, _ string) (*schemas.Task, error)
- func (r *RedfishBaseBMC) GetBiosVersion(ctx context.Context, systemURI string) (string, error)
- func (r *RedfishBaseBMC) GetBootOrder(ctx context.Context, systemURI string) ([]string, error)
- func (r *RedfishBaseBMC) GetEntityFromUri(ctx context.Context, uri string, client schemas.Client, entity any) error
- func (r *RedfishBaseBMC) GetManager(bmcUUID string) (*schemas.Manager, error)
- func (r *RedfishBaseBMC) GetProcessors(ctx context.Context, systemURI string) ([]Processor, error)
- func (r *RedfishBaseBMC) GetStorages(ctx context.Context, systemURI string) ([]Storage, error)
- func (r *RedfishBaseBMC) GetSystemInfo(ctx context.Context, systemURI string) (SystemInfo, error)
- func (r *RedfishBaseBMC) GetSystems(ctx context.Context) ([]Server, error)
- func (r *RedfishBaseBMC) Logout()
- func (r *RedfishBaseBMC) Manufacturer() Manufacturer
- func (r *RedfishBaseBMC) Options() Options
- func (r *RedfishBaseBMC) PowerOff(ctx context.Context, systemURI string) error
- func (r *RedfishBaseBMC) PowerOn(ctx context.Context, systemURI string) error
- func (r *RedfishBaseBMC) Reset(ctx context.Context, systemURI string, resetType schemas.ResetType) error
- func (r *RedfishBaseBMC) ResetManager(ctx context.Context, bmcUUID string, resetType schemas.ResetType) error
- func (r *RedfishBaseBMC) SetBMCAttributesImmediately(_ context.Context, _ string, attributes schemas.SettingsAttributes) error
- func (r *RedfishBaseBMC) SetBiosAttributesOnReset(ctx context.Context, systemURI string, attributes schemas.SettingsAttributes) error
- func (r *RedfishBaseBMC) SetBootOrder(ctx context.Context, systemURI string, bootOrder []string) error
- func (r *RedfishBaseBMC) SetBootOverride(ctx context.Context, systemURI string) error
- func (r *RedfishBaseBMC) SetIndicatorLED(ctx context.Context, systemURI string, state schemas.IndicatorLED) error
- func (r *RedfishBaseBMC) UpgradeBMCVersion(_ context.Context, _ string, _ *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
- func (r *RedfishBaseBMC) UpgradeBiosVersion(_ context.Context, _ string, _ *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
- func (r *RedfishBaseBMC) WaitForServerPowerState(ctx context.Context, systemURI string, powerState schemas.PowerState) error
- type RedfishLocalBMC
- func (r *RedfishLocalBMC) CheckBMCAttributes(ctx context.Context, UUID string, attrs schemas.SettingsAttributes) (bool, error)
- func (r *RedfishLocalBMC) CheckBMCPendingComponentUpgrade(_ context.Context, _ ComponentType) (bool, error)
- func (r *RedfishLocalBMC) GetBMCAttributeValues(ctx context.Context, UUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
- func (r *RedfishLocalBMC) GetBMCPendingAttributeValues(ctx context.Context, uuid string) (schemas.SettingsAttributes, error)
- func (r *RedfishLocalBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *RedfishLocalBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
- func (r *RedfishLocalBMC) SetBMCAttributesImmediately(ctx context.Context, bmcUUID string, attributes schemas.SettingsAttributes) error
- func (r *RedfishLocalBMC) SetBootOverride(ctx context.Context, systemURI string) error
- func (r *RedfishLocalBMC) UpgradeBMCVersion(ctx context.Context, _ string, ...) (string, bool, error)
- func (r *RedfishLocalBMC) UpgradeBiosVersion(ctx context.Context, _ string, ...) (string, bool, error)
- type Registry
- type RegistryEntry
- type RegistryEntryAttributes
- type Server
- type SimpleUpdateRequestBody
- type Storage
- type SupermicroRedfishBMC
- type SystemInfo
- type SystemInspector
- type VendorFactory
- type Volume
Constants ¶
const ( // DefaultResourcePollingInterval is the default interval for polling resources. DefaultResourcePollingInterval = 30 * time.Second // DefaultResourcePollingTimeout is the default timeout for polling resources. DefaultResourcePollingTimeout = 5 * time.Minute // DefaultPowerPollingInterval is the default interval for polling power state. DefaultPowerPollingInterval = 30 * time.Second // DefaultPowerPollingTimeout is the default timeout for polling power state. DefaultPowerPollingTimeout = 5 * time.Minute )
const (
DummyMockTaskForUpgrade = "/redfish/v1/TaskService/Tasks/upgrade"
)
Variables ¶
var ErrNotSupported = errors.New("operation not supported by this vendor")
ErrNotSupported is returned when a BMC operation is not supported by the vendor.
Functions ¶
func DefaultVendors ¶ added in v0.6.0
func DefaultVendors() map[Manufacturer]VendorFactory
DefaultVendors returns the built-in vendor factories for Dell, HPE, Lenovo and Supermicro. Callers can copy and extend this map, or build their own from scratch, and pass the extras through Options.AdditionalVendors.
func GenerateSecurePassword ¶ added in v0.3.0
func GenerateSecurePassword(manufacturer Manufacturer, length int) (string, error)
GenerateSecurePassword generates a secure password for BMC accounts based on vendor-specific requirements.
Types ¶
type AccountManager ¶ added in v0.6.0
type AccountManager interface {
// CreateOrUpdateAccount creates or updates a BMC user account.
CreateOrUpdateAccount(ctx context.Context, userName, role, password string, enabled bool) error
// DeleteAccount deletes a BMC user account.
DeleteAccount(ctx context.Context, userName, id string) error
// GetAccounts retrieves all BMC user accounts.
GetAccounts() ([]*schemas.ManagerAccount, error)
// GetAccountService retrieves the account service.
GetAccountService() (*schemas.AccountService, error)
}
AccountManager manages BMC user accounts.
type AllowedValues ¶
type BIOSManager ¶ added in v0.6.0
type BIOSManager interface {
// GetBiosVersion retrieves the BIOS version for the system.
GetBiosVersion(ctx context.Context, systemURI string) (string, error)
// GetBiosAttributeValues retrieves BIOS attribute values for the system.
GetBiosAttributeValues(ctx context.Context, systemURI string, attributes []string) (schemas.SettingsAttributes, error)
// GetBiosPendingAttributeValues retrieves pending BIOS attribute values for the system.
GetBiosPendingAttributeValues(ctx context.Context, systemURI string) (schemas.SettingsAttributes, error)
// SetBiosAttributesOnReset sets BIOS attributes on the system and applies them on the next reset.
SetBiosAttributesOnReset(ctx context.Context, systemURI string, attributes schemas.SettingsAttributes) (err error)
// CheckBiosAttributes checks if the BIOS attributes are valid and returns whether a reset is required.
CheckBiosAttributes(attrs schemas.SettingsAttributes) (reset bool, err error)
}
BIOSManager reads and updates BIOS attributes on a system.
type BMC ¶
type BMC interface {
PowerController
BootController
SystemInspector
BIOSManager
BMCSettingsManager
FirmwareUpdater
ManagerController
AccountManager
IndicatorController
EventSubscriber
// Logout closes the BMC client connection by logging out.
Logout()
}
BMC is the union of every capability a Redfish BMC client may offer. It exists so that constructors can return a single fully-featured value; individual consumers should depend on the narrower capability interfaces above whenever possible.
func NewRedfishBMCClient ¶
NewRedfishBMCClient creates a vendor-specific BMC client by connecting to the Redfish endpoint, detecting the manufacturer, and dispatching through the vendor registry. DefaultVendors() is used as the base and merged with any entries in options.AdditionalVendors (which may override built-ins). If no factory matches the detected manufacturer, the base Redfish implementation is returned.
func NewRedfishLocalBMCClient ¶
NewRedfishLocalBMCClient creates a new RedfishLocalBMC with the given connection details. Authentication is validated by the mock HTTP server via the standard Basic Auth header.
func NewRedfishLocalBMCClientWithRegistry ¶ added in v0.5.0
func NewRedfishLocalBMCClientWithRegistry(ctx context.Context, options Options, registryBaseURL string) (BMC, error)
NewRedfishLocalBMCClientWithRegistry creates a RedfishLocalBMC that, after SetBootOverride, simulates probe registration by posting dummy network data to registryBaseURL/register. Use this in place of RedfishWithRegistryPatch for dev/tilt environments where a real probe will not run.
type BMCSettingsManager ¶ added in v0.6.0
type BMCSettingsManager interface {
// GetBMCVersion retrieves the BMC version for the system.
GetBMCVersion(ctx context.Context, UUID string) (string, error)
// GetBMCAttributeValues retrieves BMC attribute values for the system.
GetBMCAttributeValues(ctx context.Context, UUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
// GetBMCPendingAttributeValues retrieves pending BMC attribute values for the system.
GetBMCPendingAttributeValues(ctx context.Context, UUID string) (result schemas.SettingsAttributes, err error)
// SetBMCAttributesImmediately sets BMC attributes on the system and applies them immediately.
SetBMCAttributesImmediately(ctx context.Context, UUID string, attributes schemas.SettingsAttributes) (err error)
// CheckBMCAttributes checks if the BMC attributes are valid and returns whether a reset is required.
CheckBMCAttributes(ctx context.Context, UUID string, attrs schemas.SettingsAttributes) (reset bool, err error)
}
BMCSettingsManager reads and updates BMC attributes (manager settings).
type BootController ¶ added in v0.6.0
type BootController interface {
// SetBootOverride sets the boot device to network boot for the next system
// power-on, bypassing the persistent boot order. The override applies to a
// single boot only.
SetBootOverride(ctx context.Context, systemURI string) error
// GetBootOrder retrieves the boot order for the system.
GetBootOrder(ctx context.Context, systemURI string) ([]string, error)
// SetBootOrder sets the boot order for the system.
SetBootOrder(ctx context.Context, systemURI string, order []string) error
}
BootController manages boot overrides and boot order for a system.
type ComponentType ¶ added in v0.5.0
type ComponentType string
ComponentType represents a firmware component type.
const ( ComponentTypeBMC ComponentType = "BMC" ComponentTypeBIOS ComponentType = "BIOS" )
type DellRedfishBMC ¶ added in v0.5.0
type DellRedfishBMC struct {
*RedfishBaseBMC
}
DellRedfishBMC is the Dell-specific implementation of the BMC interface.
func (*DellRedfishBMC) CheckBMCAttributes ¶ added in v0.5.0
func (r *DellRedfishBMC) CheckBMCAttributes(ctx context.Context, bmcUUID string, attrs schemas.SettingsAttributes) (bool, error)
func (*DellRedfishBMC) CheckBMCPendingComponentUpgrade ¶ added in v0.5.0
func (r *DellRedfishBMC) CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
CheckBMCPendingComponentUpgrade checks for staged component upgrades (Dell: Staged=true).
func (*DellRedfishBMC) GetBMCAttributeValues ¶ added in v0.5.0
func (r *DellRedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
func (*DellRedfishBMC) GetBMCPendingAttributeValues ¶ added in v0.5.0
func (r *DellRedfishBMC) GetBMCPendingAttributeValues(ctx context.Context, bmcUUID string) (schemas.SettingsAttributes, error)
func (*DellRedfishBMC) GetBMCUpgradeTask ¶ added in v0.5.0
func (*DellRedfishBMC) GetBiosUpgradeTask ¶ added in v0.5.0
func (*DellRedfishBMC) SetBMCAttributesImmediately ¶ added in v0.5.0
func (r *DellRedfishBMC) SetBMCAttributesImmediately(ctx context.Context, bmcUUID string, attributes schemas.SettingsAttributes) error
func (*DellRedfishBMC) UpgradeBMCVersion ¶ added in v0.5.0
func (r *DellRedfishBMC) UpgradeBMCVersion(ctx context.Context, _ string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
func (*DellRedfishBMC) UpgradeBiosVersion ¶ added in v0.5.0
func (r *DellRedfishBMC) UpgradeBiosVersion(ctx context.Context, _ string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
type Drive ¶
type Drive struct {
Entity
// MediaType specifies the media type of the storage device.
MediaType string `json:"mediaType,omitempty"`
// Type specifies the type of the storage device.
Type schemas.FormFactor `json:"type,omitempty"`
// SizeBytes specifies the size of the storage device in bytes.
SizeBytes int64 `json:"sizeBytes,omitempty"`
// Vendor specifies the vendor of the storage device.
Vendor string `json:"vendor,omitempty"`
// Model specifies the model of the storage device.
Model string `json:"model,omitempty"`
// State specifies the state of the storage device.
State schemas.State `json:"state,omitempty"`
}
Drive represents a storage drive.
type EventSubscriber ¶ added in v0.6.0
type EventSubscriber interface {
// CreateEventSubscription creates an event subscription for the manager.
CreateEventSubscription(ctx context.Context, destination string, eventType schemas.EventFormatType, protocol schemas.DeliveryRetryPolicy) (string, error)
// DeleteEventSubscription deletes an event subscription for the manager.
DeleteEventSubscription(ctx context.Context, uri string) error
}
EventSubscriber manages Redfish event subscriptions on the BMC.
type FirmwareUpdater ¶ added in v0.6.0
type FirmwareUpdater interface {
// UpgradeBiosVersion upgrades the BIOS version for the system.
UpgradeBiosVersion(ctx context.Context, manufacturer string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
// GetBiosUpgradeTask retrieves the task for the BIOS upgrade.
GetBiosUpgradeTask(ctx context.Context, manufacturer string, taskURI string) (*schemas.Task, error)
// UpgradeBMCVersion upgrades the BMC version for the system.
UpgradeBMCVersion(ctx context.Context, manufacturer string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
// GetBMCUpgradeTask retrieves the task for the BMC upgrade.
GetBMCUpgradeTask(ctx context.Context, manufacturer string, taskURI string) (*schemas.Task, error)
// CheckBMCPendingComponentUpgrade checks if there are pending/staged firmware upgrades
// for the given component type.
CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
}
FirmwareUpdater drives BIOS and BMC firmware upgrades.
type HPERedfishBMC ¶ added in v0.5.0
type HPERedfishBMC struct {
*RedfishBaseBMC
}
HPERedfishBMC is the HPE-specific implementation of the BMC interface.
func (*HPERedfishBMC) CheckBMCAttributes ¶ added in v0.5.0
func (r *HPERedfishBMC) CheckBMCAttributes(_ context.Context, _ string, _ schemas.SettingsAttributes) (bool, error)
func (*HPERedfishBMC) CheckBMCPendingComponentUpgrade ¶ added in v0.5.0
func (r *HPERedfishBMC) CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
CheckBMCPendingComponentUpgrade checks for staged component upgrades (HPE: Staged=true). NOTE: HPE firmware entries use numeric IDs, so matching is done via fw.Name.
func (*HPERedfishBMC) CreateEventSubscription ¶ added in v0.5.0
func (r *HPERedfishBMC) CreateEventSubscription( ctx context.Context, destination string, eventFormatType schemas.EventFormatType, retry schemas.DeliveryRetryPolicy, ) (string, error)
CreateEventSubscription overrides the base implementation to omit DeliveryRetryPolicy. HPE iLO firmware does not support the DeliveryRetryPolicy property in EventDestination POST requests and returns: "PropertyNotWritableOrUnknown: DeliveryRetryPolicy is not writable or unknown" Even when the EventService advertises retry capabilities, iLO rejects this field.
func (*HPERedfishBMC) GetBMCAttributeValues ¶ added in v0.5.0
func (r *HPERedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
func (*HPERedfishBMC) GetBMCPendingAttributeValues ¶ added in v0.5.0
func (r *HPERedfishBMC) GetBMCPendingAttributeValues(_ context.Context, _ string) (schemas.SettingsAttributes, error)
func (*HPERedfishBMC) GetBMCUpgradeTask ¶ added in v0.5.0
func (*HPERedfishBMC) GetBiosUpgradeTask ¶ added in v0.5.0
func (*HPERedfishBMC) SetBMCAttributesImmediately ¶ added in v0.5.0
func (r *HPERedfishBMC) SetBMCAttributesImmediately(ctx context.Context, _ string, attributes schemas.SettingsAttributes) error
func (*HPERedfishBMC) UpgradeBMCVersion ¶ added in v0.5.0
func (r *HPERedfishBMC) UpgradeBMCVersion(ctx context.Context, _ string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
func (*HPERedfishBMC) UpgradeBiosVersion ¶ added in v0.5.0
func (r *HPERedfishBMC) UpgradeBiosVersion(ctx context.Context, _ string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
type IndicatorController ¶ added in v0.6.0
type IndicatorController interface {
// SetIndicatorLED sets the indicator LED state on the system.
SetIndicatorLED(ctx context.Context, systemURI string, state schemas.IndicatorLED) error
}
IndicatorController controls the physical indicator (locator) LED on a system.
type InvalidBIOSSettingsError ¶ added in v0.2.0
func (*InvalidBIOSSettingsError) Error ¶ added in v0.2.0
func (e *InvalidBIOSSettingsError) Error() string
type InvalidBMCSettingsError ¶ added in v0.5.0
func (*InvalidBMCSettingsError) Error ¶ added in v0.5.0
func (e *InvalidBMCSettingsError) Error() string
type LenovoRedfishBMC ¶ added in v0.5.0
type LenovoRedfishBMC struct {
*RedfishBaseBMC
}
LenovoRedfishBMC is the Lenovo-specific implementation of the BMC interface.
func (*LenovoRedfishBMC) CheckBMCAttributes ¶ added in v0.5.0
func (r *LenovoRedfishBMC) CheckBMCAttributes(_ context.Context, _ string, _ schemas.SettingsAttributes) (bool, error)
func (*LenovoRedfishBMC) CheckBMCPendingComponentUpgrade ¶ added in v0.5.0
func (r *LenovoRedfishBMC) CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
CheckBMCPendingComponentUpgrade checks for pending component upgrades (Lenovo: "-Pending" suffix).
func (*LenovoRedfishBMC) GetBMCAttributeValues ¶ added in v0.5.0
func (r *LenovoRedfishBMC) GetBMCAttributeValues(ctx context.Context, bmcUUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
func (*LenovoRedfishBMC) GetBMCPendingAttributeValues ¶ added in v0.5.0
func (r *LenovoRedfishBMC) GetBMCPendingAttributeValues(_ context.Context, _ string) (schemas.SettingsAttributes, error)
func (*LenovoRedfishBMC) GetBMCUpgradeTask ¶ added in v0.5.0
func (*LenovoRedfishBMC) GetBiosUpgradeTask ¶ added in v0.5.0
func (*LenovoRedfishBMC) SetBMCAttributesImmediately ¶ added in v0.5.0
func (r *LenovoRedfishBMC) SetBMCAttributesImmediately(ctx context.Context, _ string, attributes schemas.SettingsAttributes) error
func (*LenovoRedfishBMC) UpgradeBMCVersion ¶ added in v0.5.0
func (r *LenovoRedfishBMC) UpgradeBMCVersion(ctx context.Context, _ string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
func (*LenovoRedfishBMC) UpgradeBiosVersion ¶ added in v0.5.0
func (r *LenovoRedfishBMC) UpgradeBiosVersion(ctx context.Context, _ string, parameters *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
type Manager ¶
type Manager struct {
UUID string
Manufacturer string
FirmwareVersion string
SerialNumber string
SKU string
Model string
PowerState string
State string
MACAddress string
OemLinks json.RawMessage
}
Manager represents the manager information.
type ManagerController ¶ added in v0.6.0
type ManagerController interface {
// GetManager returns the manager.
GetManager(UUID string) (*schemas.Manager, error)
// DiscoverManager returns the first manager that exposes graphical console capabilities.
DiscoverManager(ctx context.Context) (*schemas.Manager, error)
// ResetManager performs a reset on the Manager.
ResetManager(ctx context.Context, UUID string, resetType schemas.ResetType) error
}
ManagerController interacts with the BMC's own Manager resource.
type Manufacturer ¶
type Manufacturer string
const ( ManufacturerDell Manufacturer = "Dell Inc." ManufacturerLenovo Manufacturer = "Lenovo" ManufacturerHPE Manufacturer = "HPE" ManufacturerSupermicro Manufacturer = "Supermicro" )
type ManufacturerPasswordConfig ¶ added in v0.3.0
type ManufacturerPasswordConfig struct {
SpecialChars string
}
ManufacturerPasswordConfig holds vendor-specific constraints, including max length and allowed special characters.
type NetworkInterface ¶
type Options ¶
type Options struct {
Endpoint string
Username string
Password string
BasicAuth bool
// TLS configuration
InsecureTLS bool // Skip TLS certificate verification
ResourcePollingInterval time.Duration
ResourcePollingTimeout time.Duration
PowerPollingInterval time.Duration
PowerPollingTimeout time.Duration
// AdditionalVendors maps a manufacturer string (as reported by Redfish)
// to a factory that wraps the base Redfish client in a vendor-specific
// implementation. Entries are merged on top of DefaultVendors() by
// NewRedfishBMCClient, so callers only need to supply the extra OEMs
// they want to add. Existing built-in manufacturers can be overridden
// by registering the same key.
AdditionalVendors map[Manufacturer]VendorFactory
}
Options contain the options for the BMC redfish client.
type PowerController ¶ added in v0.6.0
type PowerController interface {
// PowerOn powers on the system.
PowerOn(ctx context.Context, systemURI string) error
// PowerOff gracefully shuts down the system.
PowerOff(ctx context.Context, systemURI string) error
// ForcePowerOff powers off the system.
ForcePowerOff(ctx context.Context, systemURI string) error
// Reset performs a reset on the system.
Reset(ctx context.Context, systemURI string, resetType schemas.ResetType) error
// WaitForServerPowerState waits for the server to reach the specified power state.
WaitForServerPowerState(ctx context.Context, systemURI string, powerState schemas.PowerState) error
}
PowerController manages the power state of a system.
type Processor ¶
type Processor struct {
// ID uniquely identifies the resource.
ID string
// Type specifies the type of processor.
Type string
// Architecture specifies the architecture of the processor.
Architecture string
// InstructionSet specifies the instruction set of the processor.
InstructionSet string
// Manufacturer specifies the manufacturer of the processor.
Manufacturer string
// Model specifies the model of the processor.
Model string
// MaxSpeedMHz specifies the maximum speed of the processor in MHz.
MaxSpeedMHz int32
// TotalCores specifies the total number of cores in the processor.
TotalCores int32
// TotalThreads specifies the total number of threads in the processor.
TotalThreads int32
}
Processor represents a processor in the system.
type RedfishBaseBMC ¶ added in v0.5.0
type RedfishBaseBMC struct {
// contains filtered or unexported fields
}
RedfishBaseBMC is the base implementation of the BMC interface for Redfish. Vendor-specific structs embed this and override methods as needed.
func (*RedfishBaseBMC) CheckBMCAttributes ¶ added in v0.5.0
func (r *RedfishBaseBMC) CheckBMCAttributes(_ context.Context, _ string, _ schemas.SettingsAttributes) (bool, error)
func (*RedfishBaseBMC) CheckBMCPendingComponentUpgrade ¶ added in v0.5.0
func (r *RedfishBaseBMC) CheckBMCPendingComponentUpgrade(_ context.Context, componentType ComponentType) (bool, error)
CheckBMCPendingComponentUpgrade is a fallback for unknown vendors. Returns ErrNotSupported indicating the feature is not supported. Vendor-specific implementations (Dell, HPE, Lenovo) override this to check actual firmware inventory and return whether a pending component upgrade exists for the specified component type.
func (*RedfishBaseBMC) CheckBiosAttributes ¶ added in v0.5.0
func (r *RedfishBaseBMC) CheckBiosAttributes(attrs schemas.SettingsAttributes) (bool, error)
CheckBiosAttributes checks if the attributes need to reboot when changed and are the correct type.
func (*RedfishBaseBMC) Client ¶ added in v0.6.0
func (r *RedfishBaseBMC) Client() *gofish.APIClient
Client returns the underlying gofish API client. External vendor implementations that embed *RedfishBaseBMC use this to perform OEM-specific HTTP requests without re-establishing the connection.
func (*RedfishBaseBMC) CreateEventSubscription ¶ added in v0.5.0
func (r *RedfishBaseBMC) CreateEventSubscription( ctx context.Context, destination string, eventFormatType schemas.EventFormatType, retry schemas.DeliveryRetryPolicy, ) (string, error)
func (*RedfishBaseBMC) CreateOrUpdateAccount ¶ added in v0.5.0
func (*RedfishBaseBMC) DeleteAccount ¶ added in v0.5.0
func (r *RedfishBaseBMC) DeleteAccount(ctx context.Context, userName, id string) error
func (*RedfishBaseBMC) DeleteEventSubscription ¶ added in v0.5.0
func (r *RedfishBaseBMC) DeleteEventSubscription(_ context.Context, uri string) error
func (*RedfishBaseBMC) DiscoverManager ¶ added in v0.5.0
DiscoverManager queries the BMC for available managers and returns the one with graphical console capabilities (non-zero MaxConcurrentSessions or non-empty ConnectTypesSupported). When multiple candidates match, the manager with the lexicographically smallest ODataID is returned for determinism.
func (*RedfishBaseBMC) ForcePowerOff ¶ added in v0.5.0
func (r *RedfishBaseBMC) ForcePowerOff(ctx context.Context, systemURI string) error
ForcePowerOff powers off the system using Redfish.
func (*RedfishBaseBMC) GetAccountService ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetAccountService() (*schemas.AccountService, error)
func (*RedfishBaseBMC) GetAccounts ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetAccounts() ([]*schemas.ManagerAccount, error)
func (*RedfishBaseBMC) GetBMCAttributeValues ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetBMCAttributeValues(_ context.Context, _ string, attributes map[string]string) (schemas.SettingsAttributes, error)
func (*RedfishBaseBMC) GetBMCPendingAttributeValues ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetBMCPendingAttributeValues(_ context.Context, _ string) (schemas.SettingsAttributes, error)
func (*RedfishBaseBMC) GetBMCUpgradeTask ¶ added in v0.5.0
func (*RedfishBaseBMC) GetBMCVersion ¶ added in v0.5.0
func (*RedfishBaseBMC) GetBiosAttributeValues ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetBiosAttributeValues(ctx context.Context, systemURI string, attributes []string) (schemas.SettingsAttributes, error)
func (*RedfishBaseBMC) GetBiosPendingAttributeValues ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetBiosPendingAttributeValues(ctx context.Context, systemURI string) (schemas.SettingsAttributes, error)
func (*RedfishBaseBMC) GetBiosUpgradeTask ¶ added in v0.5.0
func (*RedfishBaseBMC) GetBiosVersion ¶ added in v0.5.0
func (*RedfishBaseBMC) GetBootOrder ¶ added in v0.5.0
func (*RedfishBaseBMC) GetEntityFromUri ¶ added in v0.5.0
func (*RedfishBaseBMC) GetManager ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetManager(bmcUUID string) (*schemas.Manager, error)
func (*RedfishBaseBMC) GetProcessors ¶ added in v0.5.0
func (*RedfishBaseBMC) GetStorages ¶ added in v0.5.0
func (*RedfishBaseBMC) GetSystemInfo ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetSystemInfo(ctx context.Context, systemURI string) (SystemInfo, error)
GetSystemInfo retrieves information about the system using Redfish.
func (*RedfishBaseBMC) GetSystems ¶ added in v0.5.0
func (r *RedfishBaseBMC) GetSystems(ctx context.Context) ([]Server, error)
GetSystems get managed systems
func (*RedfishBaseBMC) Logout ¶ added in v0.5.0
func (r *RedfishBaseBMC) Logout()
Logout closes the BMC client connection by logging out
func (*RedfishBaseBMC) Manufacturer ¶ added in v0.6.0
func (r *RedfishBaseBMC) Manufacturer() Manufacturer
Manufacturer returns the manufacturer detected during connect, or the empty string when detection failed (for example because no Systems were exposed during endpoint discovery).
func (*RedfishBaseBMC) Options ¶ added in v0.6.0
func (r *RedfishBaseBMC) Options() Options
Options returns the options the client was constructed with.
func (*RedfishBaseBMC) PowerOff ¶ added in v0.5.0
func (r *RedfishBaseBMC) PowerOff(ctx context.Context, systemURI string) error
PowerOff gracefully shuts down the system using Redfish.
func (*RedfishBaseBMC) PowerOn ¶ added in v0.5.0
func (r *RedfishBaseBMC) PowerOn(ctx context.Context, systemURI string) error
PowerOn powers on the system using Redfish.
func (*RedfishBaseBMC) Reset ¶ added in v0.5.0
func (r *RedfishBaseBMC) Reset(ctx context.Context, systemURI string, resetType schemas.ResetType) error
Reset performs a reset on the system using Redfish.
func (*RedfishBaseBMC) ResetManager ¶ added in v0.5.0
func (*RedfishBaseBMC) SetBMCAttributesImmediately ¶ added in v0.5.0
func (r *RedfishBaseBMC) SetBMCAttributesImmediately(_ context.Context, _ string, attributes schemas.SettingsAttributes) error
func (*RedfishBaseBMC) SetBiosAttributesOnReset ¶ added in v0.5.0
func (r *RedfishBaseBMC) SetBiosAttributesOnReset(ctx context.Context, systemURI string, attributes schemas.SettingsAttributes) error
SetBiosAttributesOnReset sets given bios attributes.
func (*RedfishBaseBMC) SetBootOrder ¶ added in v0.5.0
func (r *RedfishBaseBMC) SetBootOrder(ctx context.Context, systemURI string, bootOrder []string) error
SetBootOrder sets bios boot order
func (*RedfishBaseBMC) SetBootOverride ¶ added in v0.6.0
func (r *RedfishBaseBMC) SetBootOverride(ctx context.Context, systemURI string) error
SetBootOverride sets the boot device to network boot for the next system boot using Redfish. Only set BootSourceOverrideMode when the BMC reports it; older BMCs that don't expose it will reject the field.
func (*RedfishBaseBMC) SetIndicatorLED ¶ added in v0.6.0
func (r *RedfishBaseBMC) SetIndicatorLED(ctx context.Context, systemURI string, state schemas.IndicatorLED) error
SetIndicatorLED sets the indicator LED state on the system using Redfish.
func (*RedfishBaseBMC) UpgradeBMCVersion ¶ added in v0.5.0
func (r *RedfishBaseBMC) UpgradeBMCVersion(_ context.Context, _ string, _ *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
UpgradeBMCVersion is a fallback for unknown vendors. Vendor-specific structs override this.
func (*RedfishBaseBMC) UpgradeBiosVersion ¶ added in v0.5.0
func (r *RedfishBaseBMC) UpgradeBiosVersion(_ context.Context, _ string, _ *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
UpgradeBiosVersion is a fallback for unknown vendors. Vendor-specific structs override this.
func (*RedfishBaseBMC) WaitForServerPowerState ¶ added in v0.5.0
func (r *RedfishBaseBMC) WaitForServerPowerState(ctx context.Context, systemURI string, powerState schemas.PowerState) error
type RedfishLocalBMC ¶
type RedfishLocalBMC struct {
*RedfishBaseBMC
// contains filtered or unexported fields
}
RedfishLocalBMC implements the BMC interface for Redfish.
func (*RedfishLocalBMC) CheckBMCAttributes ¶
func (r *RedfishLocalBMC) CheckBMCAttributes(ctx context.Context, UUID string, attrs schemas.SettingsAttributes) (bool, error)
CheckBMCAttributes validates BMC attributes against the server-side registry.
func (*RedfishLocalBMC) CheckBMCPendingComponentUpgrade ¶ added in v0.5.0
func (r *RedfishLocalBMC) CheckBMCPendingComponentUpgrade(_ context.Context, _ ComponentType) (bool, error)
CheckBMCPendingComponentUpgrade returns false for local provider. This is the expected behavior for non-real hardware environments; vendor implementations (Dell, HPE, Lenovo) override this to check actual firmware inventory.
func (*RedfishLocalBMC) GetBMCAttributeValues ¶
func (r *RedfishLocalBMC) GetBMCAttributeValues(ctx context.Context, UUID string, attributes map[string]string) (schemas.SettingsAttributes, error)
GetBMCAttributeValues retrieves specific BMC attribute values via HTTP from the BMC manager. Integer-typed attributes are converted from float64 (JSON default) to int to match controller expectations.
func (*RedfishLocalBMC) GetBMCPendingAttributeValues ¶
func (r *RedfishLocalBMC) GetBMCPendingAttributeValues(ctx context.Context, uuid string) (schemas.SettingsAttributes, error)
GetBMCPendingAttributeValues returns pending BMC attribute values by navigating the manager's @Redfish.Settings.SettingsObject link, mirroring the Dell pattern.
func (*RedfishLocalBMC) GetBMCUpgradeTask ¶
func (r *RedfishLocalBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
GetBMCUpgradeTask retrieves the status of a BMC upgrade task.
func (*RedfishLocalBMC) GetBiosUpgradeTask ¶
func (r *RedfishLocalBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)
GetBiosUpgradeTask retrieves the status of a BIOS upgrade task.
func (*RedfishLocalBMC) SetBMCAttributesImmediately ¶
func (r *RedfishLocalBMC) SetBMCAttributesImmediately(ctx context.Context, bmcUUID string, attributes schemas.SettingsAttributes) error
SetBMCAttributesImmediately sets BMC attributes via HTTP PATCH to the BMC Settings endpoint. Navigates from the manager's @Redfish.Settings.SettingsObject link, mirroring the Dell pattern.
func (*RedfishLocalBMC) SetBootOverride ¶ added in v0.6.0
func (r *RedfishLocalBMC) SetBootOverride(ctx context.Context, systemURI string) error
SetBootOverride sets the boot device for the next system boot using Redfish. When a registryURL is configured, it additionally simulates probe registration by posting dummy network data to the registry in a background goroutine.
func (*RedfishLocalBMC) UpgradeBMCVersion ¶
func (r *RedfishLocalBMC) UpgradeBMCVersion(ctx context.Context, _ string, params *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
UpgradeBMCVersion initiates a BMC upgrade.
func (*RedfishLocalBMC) UpgradeBiosVersion ¶
func (r *RedfishLocalBMC) UpgradeBiosVersion(ctx context.Context, _ string, params *schemas.UpdateServiceSimpleUpdateParameters) (string, bool, error)
UpgradeBiosVersion initiates a BIOS upgrade.
type Registry ¶
type Registry struct {
schemas.Entity
// ODataContext is the odata context.
ODataContext string `json:"@odata.context"`
// ODataType is the odata type.
ODataType string `json:"@odata.type"`
// Description provides a description of this resource.
Description string
// Languages is the RFC5646-conformant language codes for the
// available Message Registries.
Languages []string
// Registry shall contain the Message Registry name and it major and
// minor versions, as defined by the Redfish Specification.
RegistryEntries RegistryEntry
}
Registry describes the Message Registry file locator Resource.
type RegistryEntry ¶
type RegistryEntry struct {
Attributes []RegistryEntryAttributes
}
type RegistryEntryAttributes ¶
type SimpleUpdateRequestBody ¶ added in v0.5.0
type SimpleUpdateRequestBody struct {
schemas.UpdateServiceSimpleUpdateParameters
RedfishOperationApplyTime schemas.OperationApplyTime `json:"@Redfish.OperationApplyTime,omitempty"`
}
SimpleUpdateRequestBody extends SimpleUpdateParameters with an OEM apply-time field.
type Storage ¶
type Storage struct {
Entity
// State specifies the state of the storage.
State schemas.State `json:"state,omitempty"`
// Drives is a collection of drives associated with this storage.
Drives []Drive `json:"drives,omitempty"`
// Volumes is a collection of volumes associated with this storage.
Volumes []Volume `json:"volumes,omitempty"`
}
Storage represents a storage resource.
type SupermicroRedfishBMC ¶ added in v0.5.0
type SupermicroRedfishBMC struct {
*RedfishBaseBMC
}
SupermicroRedfishBMC is the Supermicro-specific implementation of the BMC interface.
func (*SupermicroRedfishBMC) SetBootOverride ¶ added in v0.6.0
func (r *SupermicroRedfishBMC) SetBootOverride(ctx context.Context, systemURI string) error
SetBootOverride sets the boot device to network boot for the next system boot on Supermicro hardware. Newer Supermicro BMCs require BootSourceOverrideMode=UEFI to be sent explicitly for the override to take effect; older boards (e.g. X10-series with Redfish ComputerSystem v1_3_0) don't expose the property at all and reject the whole PATCH when it's included.
type SystemInfo ¶
type SystemInfo struct {
Manufacturer string
Model string
Status schemas.Status
PowerState schemas.PowerState
TotalSystemMemory resource.Quantity
SystemURI string
SystemUUID string
SystemInfo string
SerialNumber string
SKU string
IndicatorLED string
}
SystemInfo represents basic information about the system.
type SystemInspector ¶ added in v0.6.0
type SystemInspector interface {
// GetSystems returns the managed systems.
GetSystems(ctx context.Context) ([]Server, error)
// GetSystemInfo retrieves information about the system.
GetSystemInfo(ctx context.Context, systemURI string) (SystemInfo, error)
// GetProcessors retrieves processor information for the system.
GetProcessors(ctx context.Context, systemURI string) ([]Processor, error)
// GetStorages retrieves storage information for the system.
GetStorages(ctx context.Context, systemURI string) ([]Storage, error)
}
SystemInspector reads inventory information from the managed systems.
type VendorFactory ¶ added in v0.6.0
type VendorFactory func(base *RedfishBaseBMC) BMC
VendorFactory wraps a *RedfishBaseBMC in a vendor-specific implementation. External packages can supply their own factories via Options.AdditionalVendors to extend the BMC client with new manufacturers, or to override a built-in, without modifying this package.
type Volume ¶
type Volume struct {
Entity
// CapacityBytes specifies the capacity of the volume in bytes.
SizeBytes int64 `json:"sizeBytes,omitempty"`
// Status specifies the status of the volume.
State schemas.State `json:"state,omitempty"`
// RAIDType specifies the RAID type of the associated Volume.
RAIDType schemas.RAIDType `json:"raidType,omitempty"`
// VolumeUsage specifies the volume usage type for the Volume.
VolumeUsage string `json:"volumeUsage,omitempty"`
}
Volume represents a storage volume.