bmc

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const (
	DummyMockTaskForUpgrade = "/redfish/v1/TaskService/Tasks/upgrade"
)

Variables

This section is empty.

Functions

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 AllowedValues

type AllowedValues struct {
	ValueDisplayName string
	ValueName        string
}

type BMC

type BMC 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

	// SetPXEBootOnce sets the boot device for the next system boot.
	SetPXEBootOnce(ctx context.Context, systemURI string) error

	// GetSystemInfo retrieves information about the system.
	GetSystemInfo(ctx context.Context, systemURI string) (SystemInfo, error)

	// Logout closes the BMC client connection by logging out
	Logout()

	// GetSystems returns the managed systems
	GetSystems(ctx context.Context) ([]Server, error)

	// 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

	// GetBootOrder retrieves the boot order for the system.
	GetBootOrder(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)

	// 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)

	// CheckBiosAttributes checks if the BIOS attributes are valid and returns whether a reset is required.
	CheckBiosAttributes(attrs schemas.SettingsAttributes) (reset bool, 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)

	// 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)

	// SetBMCAttributesImmediately sets BMC attributes on the system and applies them immediately.
	SetBMCAttributesImmediately(ctx context.Context, UUID string, attributes schemas.SettingsAttributes) (err error)

	// GetBiosVersion retrieves the BIOS version for the system.
	GetBiosVersion(ctx context.Context, systemURI string) (string, error)

	// GetBMCVersion retrieves the BMC version for the system.
	GetBMCVersion(ctx context.Context, UUID string) (string, error)

	// SetBootOrder sets the boot order for the system.
	SetBootOrder(ctx context.Context, systemURI string, order []string) error

	// GetStorages retrieves storage information for the system.
	GetStorages(ctx context.Context, systemURI string) ([]Storage, error)

	// GetProcessors retrieves processor information for the system.
	GetProcessors(ctx context.Context, systemURI string) ([]Processor, error)

	// 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)

	// WaitForServerPowerState waits for the server to reach the specified power state.
	WaitForServerPowerState(ctx context.Context, systemURI string, powerState schemas.PowerState) 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)

	// 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

	// 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)

	// CheckBMCPendingComponentUpgrade checks if there are pending/staged firmware upgrades
	// for the given component type.
	CheckBMCPendingComponentUpgrade(ctx context.Context, componentType ComponentType) (bool, error)
}

BMC defines an interface for interacting with a Baseboard Management Controller.

func NewRedfishBMCClient

func NewRedfishBMCClient(ctx context.Context, options Options) (BMC, error)

NewRedfishBMCClient creates a vendor-specific BMC client by connecting to the Redfish endpoint, detecting the manufacturer, and returning the appropriate vendor-specific struct. The returned BMC interface implementation will have vendor-specific method overrides where needed.

func NewRedfishLocalBMCClient

func NewRedfishLocalBMCClient(ctx context.Context, options Options) (BMC, error)

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 SetPXEBootOnce, 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 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 (r *DellRedfishBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)

func (*DellRedfishBMC) GetBiosUpgradeTask added in v0.5.0

func (r *DellRedfishBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)

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 Entity

type Entity struct {
	// ID uniquely identifies the resource.
	ID string `json:"Id"`
	// Name is the name of the resource or array element.
	Name string `json:"name"`
}

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 (r *HPERedfishBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)

func (*HPERedfishBMC) GetBiosUpgradeTask added in v0.5.0

func (r *HPERedfishBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)

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 InvalidBIOSSettingsError added in v0.2.0

type InvalidBIOSSettingsError struct {
	SettingName  string
	SettingValue any
	Message      string
}

func (*InvalidBIOSSettingsError) Error added in v0.2.0

func (e *InvalidBIOSSettingsError) Error() string

type InvalidBMCSettingsError added in v0.5.0

type InvalidBMCSettingsError struct {
	SettingName  string
	SettingValue any
	Message      string
}

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 (r *LenovoRedfishBMC) GetBMCUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)

func (*LenovoRedfishBMC) GetBiosUpgradeTask added in v0.5.0

func (r *LenovoRedfishBMC) GetBiosUpgradeTask(ctx context.Context, _ string, taskURI string) (*schemas.Task, error)

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 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 NetworkInterface struct {
	ID                  string
	MACAddress          string
	PermanentMACAddress string
}

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
}

Options contain the options for the BMC redfish client.

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 an error 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) 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 (r *RedfishBaseBMC) CreateOrUpdateAccount(
	ctx context.Context, userName,
	role, password string, enabled bool,
) error

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(ctx context.Context, uri string) error

func (*RedfishBaseBMC) DiscoverManager added in v0.5.0

func (r *RedfishBaseBMC) DiscoverManager(_ context.Context) (*schemas.Manager, error)

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 (r *RedfishBaseBMC) GetBMCUpgradeTask(_ context.Context, _ string, _ string) (*schemas.Task, error)

func (*RedfishBaseBMC) GetBMCVersion added in v0.5.0

func (r *RedfishBaseBMC) GetBMCVersion(ctx context.Context, bmcUUID string) (string, error)

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 (r *RedfishBaseBMC) GetBiosUpgradeTask(_ context.Context, _ string, _ string) (*schemas.Task, error)

func (*RedfishBaseBMC) GetBiosVersion added in v0.5.0

func (r *RedfishBaseBMC) GetBiosVersion(ctx context.Context, systemURI string) (string, error)

func (*RedfishBaseBMC) GetBootOrder added in v0.5.0

func (r *RedfishBaseBMC) GetBootOrder(ctx context.Context, systemURI string) ([]string, error)

func (*RedfishBaseBMC) GetEntityFromUri added in v0.5.0

func (r *RedfishBaseBMC) GetEntityFromUri(ctx context.Context, uri string, client schemas.Client, entity any) error

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 (r *RedfishBaseBMC) GetProcessors(ctx context.Context, systemURI string) ([]Processor, error)

func (*RedfishBaseBMC) GetStorages added in v0.5.0

func (r *RedfishBaseBMC) GetStorages(ctx context.Context, systemURI string) ([]Storage, error)

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) 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 (r *RedfishBaseBMC) ResetManager(ctx context.Context, bmcUUID string, resetType schemas.ResetType) error

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) SetPXEBootOnce added in v0.5.0

func (r *RedfishBaseBMC) SetPXEBootOnce(ctx context.Context, systemURI string) error

SetPXEBootOnce sets the boot device for the next system boot using Redfish.

func (*RedfishBaseBMC) UpgradeBMCVersion added in v0.5.0

UpgradeBMCVersion is a fallback for unknown vendors. Vendor-specific structs override this.

func (*RedfishBaseBMC) UpgradeBiosVersion added in v0.5.0

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) SetPXEBootOnce added in v0.5.0

func (r *RedfishLocalBMC) SetPXEBootOnce(ctx context.Context, systemURI string) error

SetPXEBootOnce 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

UpgradeBMCVersion initiates a BMC upgrade.

func (*RedfishLocalBMC) UpgradeBiosVersion

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 RegistryEntryAttributes struct {
	AttributeName string
	CurrentValue  any
	DisplayName   string
	DisplayOrder  int
	HelpText      string
	Hidden        bool
	Immutable     bool
	MaxLength     int
	MenuPath      string
	MinLength     int
	ReadOnly      bool
	ResetRequired *bool
	Type          string
	WriteOnly     bool
	Value         []AllowedValues
}

type Server

type Server struct {
	UUID         string
	URI          string
	Model        string
	Manufacturer string
	PowerState   schemas.PowerState
	SerialNumber string
}

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) SetPXEBootOnce added in v0.5.0

func (r *SupermicroRedfishBMC) SetPXEBootOnce(ctx context.Context, systemURI string) error

SetPXEBootOnce sets the boot device for the next system boot. Supermicro requires explicitly setting BootSourceOverrideMode to UEFI.

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 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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL