ipmi

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBootOrderQualifiers

func GetBootOrderQualifiers(bootTarget hal.BootTarget, vendor api.Vendor) (uefiQualifier, bootDevQualifier uint8)

GetBootOrderQualifiers returns the qualifiers needed to set the given boot order according to the given vendor

func RawChassisControl

func RawChassisControl(fn ChassisControlFunction) []string

func RawChassisIdentifyOff

func RawChassisIdentifyOff() []string

func RawChassisIdentifyOn

func RawChassisIdentifyOn() []string

func RawDisableUser

func RawDisableUser(uid uint8) []string

func RawEnableUser

func RawEnableUser(uid uint8) []string

func RawEnableUserSOLPayloadAccess

func RawEnableUserSOLPayloadAccess(channelNumber, uid uint8) []string

func RawSetSystemBootOptions

func RawSetSystemBootOptions(target hal.BootTarget, vendor api.Vendor) []string

func RawSetUserName

func RawSetUserName(uid uint8, username string) []string

func RawSetUserPassword

func RawSetUserPassword(uid uint8, password string) []string

func RawUserAccess

func RawUserAccess(channelNumber, uid uint8, privilege api.IpmiPrivilege) []string

Types

type ApiType added in v0.2.0

type ApiType int
const (
	HighLevel ApiType = iota // use ipmitool commands
	LowLevel                 // use raw commands
)

type BMCDeviceAndMessagingCommand

type BMCDeviceAndMessagingCommand = uint8
const (
	SetBMCGlobalEnables BMCDeviceAndMessagingCommand = iota + 46
	GetBMCGlobalEnables
	ClearMessageFlags
	GetMessageFlags
	EnableMessageChannelReceive
	GetMessage
	SendMessage
	ReadEventMessageBuffer
	GetBTInterfaceCapabilities
	GetSystemGUID
	GetChannelAuthenticationCapabilities
	GetSessionChallenge
	ActivateSession
	SetSessionPrivilegeLevel
	CloseSession
	GetSessionInfo

	GetAuthCode
	SetChannelAccess
	GetChannelAccess
	GetChannelInfo
	SetUserAccess
	GetUserAccess
	SetUserName
	GetUserName
	SetUserPassword
	ActivatePayload
	DeactivatePayload
	GetPayloadActivationStatus
	GetPayloadInstanceInfo
	SetUserPayloadAccess
	GetUserPayloadAccess
	GetChannelPayloadSupport
	GetChannelPayloadVersion
	GetChannelOEMPayloadInfo

	MasterReadWrite

	GetChannelCipherSuites
	SuspendResumePayloadEncryption
	SetChannelSecurityKeys
	GetSystemInterfaceCapabilities
	SetSystemInfoParameters
	GetSystemInfoParameters
)

type BMCInfo

type BMCInfo struct {
	FirmwareRevision string `ipmitool:"Firmware Revision"`
}

BMCInfo contains the parsed output of 'ipmitool bmc info'

type BMCWatchdogTimerCommand

type BMCWatchdogTimerCommand = uint8
const (
	ResetWatchdogTimer BMCWatchdogTimerCommand = iota + 34

	SetWatchdogTimer
	GetWatchdogTimer
)

type Bool

type Bool = uint8
const (
	False Bool = iota
	True
)

type BridgeManagementCommand

type BridgeManagementCommand = uint8
const (
	GetBridgeState BridgeManagementCommand = iota
	SetBridgeState
	GetICMBAddress
	SetICMBAddress
	SetBridgeProxyAddress
	GetBridgeStatistics
	GetICMBCapabilities

	ClearBridgeStatistics
	GetBridgeProxyAddress
	GetICMBConnectorInfo
	GetICMBConnectionID
	SendICMBConnectionID
	ErrorReport BridgeManagementCommand = 255
)

type BridgingCommand

type BridgingCommand = uint8
const (
	BridgeRequest BridgingCommand = iota + 32
	BridgeMessage
)

type ChassisControlFunction

type ChassisControlFunction = uint8
const (
	ChassisControlPowerDown ChassisControlFunction = iota
	ChassisControlPowerUp
	ChassisControlPowerCycle
	ChassisControlHardReset
	ChassisControlPulseDiagnosticInterrupt
	ChassisControlInitiateSoftShutdownViaOvertemp
)

type ChassisDeviceCommand

type ChassisDeviceCommand = uint8
const (
	GetChassisCapabilities ChassisDeviceCommand = iota
	GetChassisStatus
	ChassisControl
	ChassisReset
	ChassisIdentify
	SetChassisCapabilities
	SetPowerRestorePolicy
	GetSystemRestartCause
	SetSystemBootOptions
	GetSystemBootOptions
	SetFrontPanelButtonEnables
	SetPowerCycleInterval

	GetPOHCounter
)

type ChassisIdentifyFunction

type ChassisIdentifyFunction = uint8
const (
	ChassisIdentifyForceOnIndefinitely ChassisIdentifyFunction = iota
)

type ChassisIdentifyRequest

type ChassisIdentifyRequest struct {
	IntervalSeconds uint8
	ForceOn         uint8
}

ChassisIdentifyRequest per section 28.5

type ChassisIdentifyResponse

type ChassisIdentifyResponse struct {
	goipmi.CompletionCode
}

ChassisIdentifyResponse per section 28.5

type Client

type Client struct {
	*goipmi.Client
	api.Vendor
}

func OpenClientConnection

func OpenClientConnection(ip string, port int, user, password string) (*Client, error)

func (*Client) SetBootOrder

func (c *Client) SetBootOrder(bootTarget hal.BootTarget, vendor api.Vendor) error

func (*Client) SetChassisIdentifyLEDOff

func (c *Client) SetChassisIdentifyLEDOff() error

func (*Client) SetChassisIdentifyLEDOn

func (c *Client) SetChassisIdentifyLEDOn() error

func (*Client) SetChassisIdentifyLEDState

func (c *Client) SetChassisIdentifyLEDState(state hal.IdentifyLEDState) error

func (*Client) SetSystemBoot

func (c *Client) SetSystemBoot(param uint8, data ...uint8) error

type CommandForwardingCommand

type CommandForwardingCommand = uint8
const (
	ForwardedCommand CommandForwardingCommand = iota + 48
	SetForwardedCommands
	GetForwardedCommands
	EnableForwardedCommands
)

type DiscoveryCommand

type DiscoveryCommand = uint8
const (
	PrepareForDiscovery DiscoveryCommand = iota + 16
	GetAddresses
	SetDiscovered
	GetChassisDeviceID
	SetChassisDeviceID
)

type EventCommand

type EventCommand = uint8
const (
	SetEventReceiver EventCommand = iota
	GetEventReceiver
	PlatformEvent
)
const (
	GetEventCount EventCommand = iota + 48
	SetEventDestination
	SetEventReceptionState
	SendICMBEventMessage
	GetEventDestination
	GetEventReceptionState
)

type FRUDeviceCommand

type FRUDeviceCommand = uint8
const (
	GetFRUInventoryAreaInfo FRUDeviceCommand = iota + 16
	ReadFRUData
	WriteFRUData
)

type FirmwareFirewallConfigurationCommand

type FirmwareFirewallConfigurationCommand = uint8
const (
	SetCommandEnables FirmwareFirewallConfigurationCommand = iota + 96
	GetCommandEnables
	SetCommandSubFunctionEnables
	GetCommandSubFunctionEnables
	GetOEMNetNnIANASupport
)

type Fru

type Fru struct {
	ChassisPartNumber   string `ipmitool:"Chassis Part Number"`
	ChassisPartSerial   string `ipmitool:"Chassis Serial"`
	BoardMfg            string `ipmitool:"Board Mfg"`
	BoardMfgSerial      string `ipmitool:"Board Mfg Serial"`
	BoardPartNumber     string `ipmitool:"Board Part Number"`
	ProductManufacturer string `ipmitool:"Product Manufacturer"`
	ProductPartNumber   string `ipmitool:"Product Part Number"`
	ProductSerial       string `ipmitool:"Product Serial"`
}

Fru contains Field Replaceable Unit information, retrieved with 'ipmitool fru'

type GlobalDeviceCommand

type GlobalDeviceCommand = uint8
const (
	GetDeviceID GlobalDeviceCommand = iota + 1
	ColdReset
	WarmReset
	GetSelfTestResults
	ManufacturingTestOn
	SetACPIPowerState
	GetACPIPowerState
	GetDeviceGUID
	GetNetFnSupport
	GetCommandSupport
	GetCommandSubFunctionSupport
	GetConfigurableCommands
	GetConfigurableCommandSubFunctions
)

type IpmiTool

type IpmiTool interface {
	DevicePresent() bool
	NewCommand(arg ...string) (*exec.Cmd, error)
	Run(arg ...string) (string, error)
	CreateUser(user api.BMCUser, privilege api.IpmiPrivilege, password string, constraints *api.PasswordConstraints, apiType ApiType) (pwd string, err error)
	ChangePassword(user api.BMCUser, newPassword string, apiType ApiType) error
	SetUserEnabled(user api.BMCUser, enabled bool, apiType ApiType) error
	GetLanConfig() (LanConfig, error)
	SetBootOrder(target hal.BootTarget, vendor api.Vendor) error
	SetChassisControl(ChassisControlFunction) error
	SetChassisIdentifyLEDState(hal.IdentifyLEDState) error
	SetChassisIdentifyLEDOn() error
	SetChassisIdentifyLEDOff() error
	GetFru() (Fru, error)
	GetSession() (Session, error)
	BMC() (*api.BMC, error)
	OpenConsole(s ssh.Session) error
}

IpmiTool defines methods to interact with IPMI

func New

func New(log logger.Logger) (IpmiTool, error)

New creates a new IpmiTool with the default command

func NewOutBand added in v0.2.3

func NewOutBand(ip string, port int, user, password string, log logger.Logger) (IpmiTool, error)

NewOutBand creates a new IpmiTool with the default command

type Ipmitool

type Ipmitool struct {
	// contains filtered or unexported fields
}

Ipmitool is used to query and modify the IPMI based BMC from the host os

func (*Ipmitool) BMC

func (i *Ipmitool) BMC() (*api.BMC, error)

BMC returns the BMC struct

func (*Ipmitool) ChangePassword added in v0.2.0

func (i *Ipmitool) ChangePassword(user api.BMCUser, newPassword string, apiType ApiType) error

ChangePassword of the given user

func (*Ipmitool) CreateUser

func (i *Ipmitool) CreateUser(user api.BMCUser, privilege api.IpmiPrivilege, password string, pc *api.PasswordConstraints, apiType ApiType) (string, error)

CreateUser creates an IPMI user with given privilege level and either the given password or - if empty - a generated one with respect to the given password constraints

func (*Ipmitool) DevicePresent

func (i *Ipmitool) DevicePresent() bool

DevicePresent returns true if the IPMI device is present, which is required to talk to the BMC

func (*Ipmitool) GetBMCInfo

func (i *Ipmitool) GetBMCInfo() (BMCInfo, error)

GetBMCInfo returns the BMC info

func (*Ipmitool) GetFru

func (i *Ipmitool) GetFru() (Fru, error)

GetFru returns the Field Replaceable Unit information

func (*Ipmitool) GetLanConfig

func (i *Ipmitool) GetLanConfig() (LanConfig, error)

GetLanConfig returns the LAN config

func (*Ipmitool) GetSession

func (i *Ipmitool) GetSession() (Session, error)

GetSession returns the session

func (*Ipmitool) NewCommand added in v0.1.11

func (i *Ipmitool) NewCommand(args ...string) (*exec.Cmd, error)

NewCommand returns a new ipmitool command with the given arguments

func (*Ipmitool) OpenConsole added in v0.1.11

func (i *Ipmitool) OpenConsole(s ssh.Session) error

OpenConsole connect to the serian console and put the in/out into a ssh stream

func (*Ipmitool) Run

func (i *Ipmitool) Run(args ...string) (string, error)

Run executes ipmitool with given arguments and returns the outcome

func (*Ipmitool) SetBootOrder

func (i *Ipmitool) SetBootOrder(target hal.BootTarget, vendor api.Vendor) error

SetBootOrder persistently sets the boot order to given target

func (*Ipmitool) SetChassisControl

func (i *Ipmitool) SetChassisControl(fn ChassisControlFunction) error

SetChassisControl executes the given chassis control function

func (*Ipmitool) SetChassisIdentifyLEDOff

func (i *Ipmitool) SetChassisIdentifyLEDOff() error

SetChassisIdentifyLEDOff turns off the chassis identify LED

func (*Ipmitool) SetChassisIdentifyLEDOn

func (i *Ipmitool) SetChassisIdentifyLEDOn() error

SetChassisIdentifyLEDOn turns on the chassis identify LED

func (*Ipmitool) SetChassisIdentifyLEDState

func (i *Ipmitool) SetChassisIdentifyLEDState(state hal.IdentifyLEDState) error

SetChassisIdentifyLEDState sets the chassis identify LED to given state

func (*Ipmitool) SetUserEnabled added in v0.2.0

func (i *Ipmitool) SetUserEnabled(user api.BMCUser, enabled bool, apiType ApiType) error

SetUserEnabled enable the given user

type LANDeviceCommand

type LANDeviceCommand = uint8
const (
	SetLANConfigurationParameters LANDeviceCommand = iota + 1
	GetLANConfigurationParameters
	SuspendBMCARPs
	GetIPUDPRMCPStatistics
)

type LanConfig

type LanConfig struct {
	IP  string `ipmitool:"IP Address"`
	Mac string `ipmitool:"MAC Address"`
}

LanConfig contains the config of IPMI. Tag must contain first column name of ipmitool lan print command output to get the second column value be parsed into the field

func (*LanConfig) String

func (l *LanConfig) String() string

type NetworkFunction

type NetworkFunction = uint8
const (
	ChassisNetworkFunction NetworkFunction = iota
	ChassisResponse
	BridgeNetworkFunction
	BridgeResponse
	SensorEventNetworkFunction
	SensorEventResponse
	AppNetworkFunction
	AppResponse
	FirmwareNetworkFunction
	FirmwareResponse
	StorageNetworkFunction
	StorageResponse
	TransportNetworkFunction
	TransportResponse
)

type PEFAndAlertingCommand

type PEFAndAlertingCommand = uint8
const (
	GetPEFCapabilities PEFAndAlertingCommand = iota + 16
	ArmPEFPostponeTimer
	SetPEFConfigurationParameters
	GetPEFConfigurationParameters
	SetLastProcessingEventID
	GetLastProcessingEventID
	AlertImmediate
	PETAcknowledge
)

type SDRDeviceCommand

type SDRDeviceCommand = uint8
const (
	GetSDRRepositoryInfo SDRDeviceCommand = iota + 32
	GetSDRRepositoryAllocationInfo
	ReserveSDRRepository
	GetSDR
	AddSDR
	PartialAddSDR
	DeleteSDR
	ClearSDRRepository
	GetSDRRepositoryTime
	SetSDRRepositoryTime
	EnterSDRRepositoryUpdateMode
	ExitSDRRepositoryUpdateMode
	RunInitializationAgent
)

type SELDeviceCommand

type SELDeviceCommand = uint8
const (
	GetSELInfo SELDeviceCommand = iota + 64
	GetSELAllocationInfo
	ReserveSEL
	GetSELEntry
	AddSELEntry
	PartialAddSELEntry
	DeleteSELEntry
	ClearSEL
	GetSELTime
	SetSELTime
)
const (
	GetAuxiliaryLogStatus SELDeviceCommand = iota + 90
	SetAuxiliaryLogStatus
	GetSELTimeUTCOffset
	SetSELTimeUTCOffset
)

type SensorDeviceCommand

type SensorDeviceCommand = uint8
const (
	GetDeviceSDRInfo SensorDeviceCommand = iota + 32
	GetDeviceSDR
	ReserveDeviceSDRRepository
	GetSensorReadingFactors
	SetSensorHysteresis
	GetSensorHysteresis
	SetSensorThreshold
	GetSensorThreshold
	SetSensorEventEnable
	GetSensorEventEnable
	ReArmSensorEvents
	GetSensorEventStatus

	GetSensorReading
	SetSensorType
	GetSensorType
	SetSensorReadingAndEventStatus
)

type SerialModemDeviceCommand

type SerialModemDeviceCommand = uint8
const (
	SetSerialModemConfiguration SerialModemDeviceCommand = iota + 16
	GetSerialModemConfiguration
	SetSerialModemMux
	GetTAPResponseCodes
	SetPPPUDPProxyTransmitData
	GetPPPUDPProxyTransmitData
	SetPPPUDPProxyPacket
	GetPPPUDPProxyReceiveData
	SerialModemConnectionActive
	Callback
	SetUserCallbackOptions
	GetUserCallbackOptions
	SetSerialRoutingMux

	SOLActivating
	SetSOLConfigurationParameters
	GetSOLConfigurationParameters
)

type Session

type Session struct {
	UserID    string `ipmitool:"user id"`
	Privilege string `ipmitool:"privilege level"`
}

Session holds information about the current IPMI session

type SetSystemBootOptionsFunction

type SetSystemBootOptionsFunction = uint8
const (
	ServicePartitionSelector SetSystemBootOptionsFunction = iota + 1
	ServicePartitionScan
	ValidBitClearing
	BootInfoAcknowledge
	BootFlags
	InitiatorInfo
	InitiatorMailbox
	OEMHasHandledBootInfo
	SMSHasHandledBootInfo
	OSServicePartitionHasHandledBootInfo
	OSLoaderHasHandledBootInfo
	BIOSPOSTHasHandledBootInfo
)

Jump to

Keyboard shortcuts

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