Documentation
¶
Index ¶
- type AvailableFirmware
- type Chassis
- type Client
- type ComponentFirmwareUpgrades
- type Credentials
- type FirmwareUpdateQuery
- type FirmwareUpdateState
- type FirmwareUpdateStatus
- type FirmwareVersion
- type PMCVendor
- type PowerControlResult
- type PowerManagementController
- type PowerShelf
- type PowerSupplyUnit
- type PowershelfComponent
- type RegisterPowershelfRequest
- type RegisterPowershelfResponse
- type Sensor
- type SensorThresholds
- type StatusCode
- type UpdateComponentFirmwareRequest
- type UpdateComponentFirmwareResponse
- type UpdatePowershelfFirmwareRequest
- type UpdatePowershelfFirmwareResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvailableFirmware ¶
type AvailableFirmware struct {
PMCMACAddress string
Upgrades []ComponentFirmwareUpgrades
}
AvailableFirmware contains available firmware upgrades for a powershelf.
type Client ¶
type Client interface {
// GetPowershelves returns powershelf information for the specified PMC MAC addresses.
// If pmcMacs is empty, returns all powershelves.
GetPowershelves(ctx context.Context, pmcMacs []string) ([]PowerShelf, error)
// RegisterPowershelves registers new powershelves with their PMC credentials.
RegisterPowershelves(ctx context.Context, requests []RegisterPowershelfRequest) ([]RegisterPowershelfResponse, error)
// PowerOn powers on the specified powershelves.
PowerOn(ctx context.Context, pmcMacs []string) ([]PowerControlResult, error)
// PowerOff powers off the specified powershelves.
PowerOff(ctx context.Context, pmcMacs []string) ([]PowerControlResult, error)
// UpdateFirmware performs firmware upgrades on the specified powershelves.
UpdateFirmware(ctx context.Context, requests []UpdatePowershelfFirmwareRequest) ([]UpdatePowershelfFirmwareResponse, error)
// GetFirmwareUpdateStatus returns the status of firmware updates for the specified PMC(s) and component(s).
GetFirmwareUpdateStatus(ctx context.Context, queries []FirmwareUpdateQuery) ([]FirmwareUpdateStatus, error)
// ListAvailableFirmware lists the firmware versions available for the specified powershelves.
ListAvailableFirmware(ctx context.Context, pmcMacs []string) ([]AvailableFirmware, error)
// SetDryRun configures whether the firmware manager is in Dry Run mode.
SetDryRun(ctx context.Context, dryRun bool) error
// Close closes the underlying gRPC connection.
Close() error
// The following are only valid in the mock environment and should only be called by unit tests.
AddPowershelf(PowerShelf)
}
Client allows us to have both a real implementation and a mock implementation for unit tests which can be switched transparently.
func NewClient ¶
NewClient creates a GRPC connection pool to PSM. Returning success does not mean that we have yet made an actual connection; that happens when making an actual request.
func NewMockClient ¶
func NewMockClient() Client
NewMockClient returns a "GRPC" client that returns mock values so it can be used in unit tests.
type ComponentFirmwareUpgrades ¶
type ComponentFirmwareUpgrades struct {
Component PowershelfComponent
Upgrades []FirmwareVersion
}
ComponentFirmwareUpgrades contains available firmware upgrades for a component.
type Credentials ¶
Credentials wraps around a username and password.
type FirmwareUpdateQuery ¶
type FirmwareUpdateQuery struct {
PMCMACAddress string
Component PowershelfComponent
}
FirmwareUpdateQuery specifies a single PMC MAC and component to query for firmware update status.
type FirmwareUpdateState ¶
type FirmwareUpdateState int
FirmwareUpdateState represents the state of a firmware update operation.
const ( FirmwareUpdateStateUnknown FirmwareUpdateState = 0 FirmwareUpdateStateQueued FirmwareUpdateState = 1 FirmwareUpdateStateVerifying FirmwareUpdateState = 2 FirmwareUpdateStateCompleted FirmwareUpdateState = 3 FirmwareUpdateStateFailed FirmwareUpdateState = 4 )
type FirmwareUpdateStatus ¶
type FirmwareUpdateStatus struct {
PMCMACAddress string
Component PowershelfComponent
State FirmwareUpdateState
Status StatusCode
Error string
}
FirmwareUpdateStatus contains the status of a firmware update operation.
type FirmwareVersion ¶
type FirmwareVersion struct {
Version string
}
FirmwareVersion represents a firmware version.
type PowerControlResult ¶
type PowerControlResult struct {
PMCMACAddress string
Status StatusCode
Error string
}
PowerControlResult contains the result of a power control operation.
type PowerManagementController ¶
type PowerManagementController struct {
MACAddress string
IPAddress string
Vendor PMCVendor
SerialNumber string
Model string
Manufacturer string
PartNumber string
FirmwareVersion string
HardwareVersion string
}
PowerManagementController contains PMC identity and metadata.
type PowerShelf ¶
type PowerShelf struct {
PMC PowerManagementController
Chassis Chassis
PSUs []PowerSupplyUnit
}
PowerShelf represents a complete powershelf with its PMC, chassis, and PSUs.
type PowerSupplyUnit ¶
type PowerSupplyUnit struct {
ID string
Name string
Manufacturer string
Model string
SerialNumber string
CapacityWatts string
FirmwareVersion string
HardwareVersion string
PowerState bool
Sensors []Sensor
}
PowerSupplyUnit contains power supply hardware/firmware and sensor data.
type PowershelfComponent ¶
type PowershelfComponent int
PowershelfComponent represents a component type for firmware updates.
const ( PowershelfComponentPMC PowershelfComponent = 0 PowershelfComponentPSU PowershelfComponent = 1 )
func (PowershelfComponent) String ¶
func (c PowershelfComponent) String() string
type RegisterPowershelfRequest ¶
type RegisterPowershelfRequest struct {
PMCMACAddress string
PMCIPAddress string
PMCVendor PMCVendor
PMCCredentials Credentials
}
RegisterPowershelfRequest contains the information needed to register a powershelf.
type RegisterPowershelfResponse ¶
type RegisterPowershelfResponse struct {
PMCMACAddress string
IsNew bool
Created time.Time
Status StatusCode
Error string
}
RegisterPowershelfResponse contains the result of registering a powershelf.
type Sensor ¶
type Sensor struct {
ID string
Name string
Reading float32
ReadingRangeMax float64
ReadingRangeMin float32
ReadingType string
ReadingUnits string
Thresholds SensorThresholds
}
Sensor captures a single sensor reading, thresholds, and units.
type SensorThresholds ¶
type SensorThresholds struct {
LowerCaution float32
LowerCritical float32
UpperCaution float32
UpperCritical float32
}
SensorThresholds contains threshold values for a sensor.
type StatusCode ¶
type StatusCode int
StatusCode represents the result of an operation.
const ( StatusSuccess StatusCode = 0 StatusInvalidArgument StatusCode = 1 StatusInternalError StatusCode = 2 )
type UpdateComponentFirmwareRequest ¶
type UpdateComponentFirmwareRequest struct {
Component PowershelfComponent
UpgradeTo FirmwareVersion
}
UpdateComponentFirmwareRequest specifies a firmware update for a single component.
type UpdateComponentFirmwareResponse ¶
type UpdateComponentFirmwareResponse struct {
Component PowershelfComponent
Status StatusCode
Error string
}
UpdateComponentFirmwareResponse contains the result of updating firmware for a component.
type UpdatePowershelfFirmwareRequest ¶
type UpdatePowershelfFirmwareRequest struct {
PMCMACAddress string
Components []UpdateComponentFirmwareRequest
}
UpdatePowershelfFirmwareRequest specifies firmware updates for a powershelf.
type UpdatePowershelfFirmwareResponse ¶
type UpdatePowershelfFirmwareResponse struct {
PMCMACAddress string
Components []UpdateComponentFirmwareResponse
}
UpdatePowershelfFirmwareResponse contains the result of updating firmware for a powershelf.