bmc

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BMCResetter

type BMCResetter interface {
	BmcReset(ctx context.Context, resetType string) (ok bool, err error)
}

BMCResetter for resetting a BMC. resetType: "warm" resets the management console without rebooting the BMC resetType: "cold" reboots the BMC

type BiosConfigurationGetter

type BiosConfigurationGetter interface {
	GetBiosConfiguration(ctx context.Context) (biosConfig map[string]string, err error)
}

type BootDeviceSetter

type BootDeviceSetter interface {
	BootDeviceSet(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)
}

BootDeviceSetter sets the next boot device for a machine

type Closer

type Closer interface {
	Close(ctx context.Context) error
}

Closer interface for closing a connection to a BMC

type FirmwareInstallVerifier

type FirmwareInstallVerifier interface {
	// FirmwareInstallStatus returns the status of the firmware install process.
	//
	// parameters:
	// installVersion (required) - the version this method should check is installed.
	// component (optional) - the component slug for the component update being installed.
	// taskID (optional) - the task identifier.
	//
	// return values:
	// status - returns one of the FirmwareInstall statuses (see devices/constants.go).
	FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error)
}

FirmwareInstallVerifier defines an interface to check firmware install status

type FirmwareInstaller

type FirmwareInstaller interface {
	// FirmwareInstall uploads firmware update payload to the BMC returning the task ID
	//
	// parameters:
	// component - the component slug for the component update being installed.
	// applyAt - one of "Immediate", "OnReset".
	// forceInstall - purge the install task queued/scheduled firmware install BMC task (if any).
	// reader - the io.reader to the firmware update file.
	//
	// return values:
	// taskID - A taskID is returned if the update process on the BMC returns an identifier for the update process.
	FirmwareInstall(ctx context.Context, component, applyAt string, forceInstall bool, reader io.Reader) (taskID string, err error)
}

FirmwareInstaller defines an interface to install firmware updates

type InventoryGetter

type InventoryGetter interface {
	Inventory(ctx context.Context) (device *common.Device, err error)
}

InventoryGetter defines methods to retrieve device hardware and firmware inventory

type Metadata

type Metadata struct {
	// SuccessfulProvider is the name of the provider that successfully executed
	SuccessfulProvider string
	// ProvidersAttempted is a slice of all providers that were attempt to execute
	ProvidersAttempted []string
	// SuccessfulOpenConns is a slice of provider names that were opened successfully
	SuccessfulOpenConns []string
	// SuccessfulCloseConns is a slice of provider names that were closed successfully
	SuccessfulCloseConns []string
	// FailedProviderDetail holds the failed providers error messages for called methods
	FailedProviderDetail map[string]string
}

Metadata represents details about a bmc method

func CloseConnectionFromInterfaces

func CloseConnectionFromInterfaces(ctx context.Context, generic []interface{}) (metadata Metadata, err error)

CloseConnectionFromInterfaces identifies implementations of the Closer() interface and and passes the found implementations to the closeConnection() wrapper

func CreateUserFromInterfaces

func CreateUserFromInterfaces(ctx context.Context, timeout time.Duration, user, pass, role string, generic []interface{}) (ok bool, metadata Metadata, err error)

CreateUsersFromInterfaces identifies implementations of the UserCreator interface and passes them to the createUser() wrapper method.

func DeleteUserFromInterfaces

func DeleteUserFromInterfaces(ctx context.Context, timeout time.Duration, user string, generic []interface{}) (ok bool, metadata Metadata, err error)

DeleteUsersFromInterfaces identifies implementations of the UserDeleter interface and passes them to the deleteUser() wrapper method.

func FirmwareInstallFromInterfaces

func FirmwareInstallFromInterfaces(ctx context.Context, component, applyAt string, forceInstall bool, reader io.Reader, generic []interface{}) (taskID string, metadata Metadata, err error)

FirmwareInstallFromInterfaces identifies implementations of the FirmwareInstaller interface and passes the found implementations to the firmwareInstall() wrapper

func FirmwareInstallStatusFromInterfaces

func FirmwareInstallStatusFromInterfaces(ctx context.Context, installVersion, component, taskID string, generic []interface{}) (status string, metadata Metadata, err error)

FirmwareInstallStatusFromInterfaces identifies implementations of the FirmwareInstallVerifier interface and passes the found implementations to the firmwareInstallStatus() wrapper.

func GetBiosConfigurationInterfaces

func GetBiosConfigurationInterfaces(ctx context.Context, generic []interface{}) (biosConfig map[string]string, metadata Metadata, err error)

func GetInventoryFromInterfaces

func GetInventoryFromInterfaces(ctx context.Context, generic []interface{}) (device *common.Device, metadata Metadata, err error)

GetInventoryFromInterfaces identifies implementations of the InventoryGetter interface and passes the found implementations to the inventory() wrapper method

func GetPostCodeInterfaces

func GetPostCodeInterfaces(ctx context.Context, generic []interface{}) (status string, code int, metadata Metadata, err error)

GetPostCodeFromInterfaces identifies implementations of the PostCodeGetter interface and passes the found implementations to the postCode() wrapper method.

func GetPowerStateFromInterfaces

func GetPowerStateFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (state string, metadata Metadata, err error)

GetPowerStateFromInterfaces identifies implementations of the PostStateGetter interface and passes the found implementations to the getPowerState() wrapper.

func OpenConnectionFromInterfaces

func OpenConnectionFromInterfaces(ctx context.Context, timeout time.Duration, providers []interface{}) (opened []interface{}, metadata Metadata, err error)

OpenConnectionFromInterfaces will try all opener interfaces and remove failed ones. The reason failed ones need to be removed is so that when other methods are called (like powerstate) implementations that have connections wont nil pointer error when their connection fails.

func ReadUsersFromInterfaces

func ReadUsersFromInterfaces(ctx context.Context, timeout time.Duration, generic []interface{}) (users []map[string]string, metadata Metadata, err error)

ReadUsersFromInterfaces identifies implementations of the UserReader interface and passes them to the readUsers() wrapper method.

func ResetBMCFromInterfaces

func ResetBMCFromInterfaces(ctx context.Context, timeout time.Duration, resetType string, generic []interface{}) (ok bool, metadata Metadata, err error)

ResetBMCFromInterfaces identifies implementations of the BMCResetter interface and passes them to the resetBMC() wrapper method.

func ScreenshotFromInterfaces

func ScreenshotFromInterfaces(ctx context.Context, generic []interface{}) (image []byte, fileType string, metadata Metadata, err error)

ScreenshotFromInterfaces identifies implementations of the ScreenshotGetter interface and passes the found implementations to the screenshot() wrapper method.

func SetBootDeviceFromInterfaces

func SetBootDeviceFromInterfaces(ctx context.Context, timeout time.Duration, bootDevice string, setPersistent, efiBoot bool, generic []interface{}) (ok bool, metadata Metadata, err error)

SetBootDeviceFromInterfaces identifies implementations of the BootDeviceSetter interface and passes the found implementations to the setBootDevice() wrapper

func SetPowerStateFromInterfaces

func SetPowerStateFromInterfaces(ctx context.Context, timeout time.Duration, state string, generic []interface{}) (ok bool, metadata Metadata, err error)

SetPowerStateFromInterfaces identifies implementations of the PostStateSetter interface and passes the found implementations to the setPowerState() wrapper.

func SetVirtualMediaFromInterfaces

func SetVirtualMediaFromInterfaces(ctx context.Context, kind string, mediaURL string, generic []interface{}) (ok bool, metadata Metadata, err error)

SetVirtualMediaFromInterfaces identifies implementations of the virtualMediaSetter interface and passes the found implementations to the setVirtualMedia() wrapper

func UpdateUserFromInterfaces

func UpdateUserFromInterfaces(ctx context.Context, timeout time.Duration, user, pass, role string, generic []interface{}) (ok bool, metadata Metadata, err error)

UpdateUsersFromInterfaces identifies implementations of the UserUpdater interface and passes them to the updateUser() wrapper method.

type Opener

type Opener interface {
	Open(ctx context.Context) error
}

Opener interface for opening a connection to a BMC

type PostCodeGetter

type PostCodeGetter interface {
	// PostCode retrieves the BIOS/UEFI POST code from a device
	//
	// returns 'status' which is a (bmclib specific) string identifier for the POST code
	// and 'code' with the actual POST code returned to bmclib by the device
	PostCode(ctx context.Context) (status string, code int, err error)
}

PostCodeGetter defines methods to retrieve device BIOS/UEFI POST code

type PowerSetter

type PowerSetter interface {
	// PowerSet sets the power state of a Machine through a BMC.
	// While the state's accepted are ultimately up to what the implementation
	// expects, implementations should generally try to provide support for the following
	// states, modeled after the functionality available in `ipmitool chassis power`.
	//
	// "on": Power up chassis. should not error if the machine is already on
	// "off": Hard powers down chassis. should not error if the machine is already off
	// "soft": Initiate a soft-shutdown of OS via ACPI.
	// "reset": soft down and then power on. simulates a reboot from the host OS.
	// "cycle": hard power down followed by a power on. simulates pressing a power button
	// to turn the machine off then pressing the button again to turn it on.
	PowerSet(ctx context.Context, state string) (ok bool, err error)
}

PowerSetter sets the power state of a BMC

type PowerStateGetter

type PowerStateGetter interface {
	PowerStateGet(ctx context.Context) (state string, err error)
}

PowerStateGetter gets the power state of a BMC

type Provider

type Provider interface {
	// Name of the provider
	Name() string
}

Provider interface describes details about a provider

type ScreenshotGetter

type ScreenshotGetter interface {
	Screenshot(ctx context.Context) (image []byte, fileType string, err error)
}

ScreenshotGetter interface provides methods to query for a BMC screen capture.

type UserCreator

type UserCreator interface {
	UserCreate(ctx context.Context, user, pass, role string) (ok bool, err error)
}

UserCreator creates a user on a BMC

type UserDeleter

type UserDeleter interface {
	UserDelete(ctx context.Context, user string) (ok bool, err error)
}

UserDeleter deletes a user on a BMC

type UserReader

type UserReader interface {
	UserRead(ctx context.Context) (users []map[string]string, err error)
}

UserReader lists all users on a BMC

type UserUpdater

type UserUpdater interface {
	UserUpdate(ctx context.Context, user, pass, role string) (ok bool, err error)
}

UserUpdater updates a user on a BMC

type VirtualMediaSetter

type VirtualMediaSetter interface {
	SetVirtualMedia(ctx context.Context, kind string, mediaURL string) (ok bool, err error)
}

VirtualMediaSetter controls the virtual media attached to a machine

Jump to

Keyboard shortcuts

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