Documentation ¶
Index ¶
- Constants
- Variables
- type ActivateSessionRequest
- type ActivateSessionResponse
- type AuthCapabilitiesRequest
- type AuthCapabilitiesResponse
- type BootDevice
- type ChassisControl
- type ChassisControlRequest
- type ChassisControlResponse
- type ChassisIdentifyRequest
- type ChassisIdentifyResponse
- type ChassisStatusRequest
- type ChassisStatusResponse
- type Client
- func (c *Client) Close() error
- func (c *Client) Control(ctl ChassisControl) error
- func (c *Client) DeviceID() (*DeviceIDResponse, error)
- func (c *Client) Identify(time int, indefinitely bool) error
- func (c *Client) Open() error
- func (c *Client) Send(req *Request, res Response) error
- func (c *Client) SetBootDevice(dev BootDevice) error
- type CloseSessionRequest
- type CloseSessionResponse
- type Command
- type CompletionCode
- type Connection
- type DeviceIDRequest
- type DeviceIDResponse
- type Handler
- type IdentifyState
- type Message
- type NetworkFunction
- type OemID
- type Request
- type Response
- type SessionChallengeRequest
- type SessionChallengeResponse
- type SessionPrivilegeLevelRequest
- type SessionPrivilegeLevelResponse
- type SetSystemBootOptionsRequest
- type SetSystemBootOptionsResponse
- type Simulator
- type SystemBootOptionsRequest
- type SystemBootOptionsResponse
Constants ¶
const ( ControlPowerDown = ChassisControl(0x0) ControlPowerUp = ChassisControl(0x1) ControlPowerCycle = ChassisControl(0x2) ControlPowerHardReset = ChassisControl(0x3) ControlPowerPulseDiag = ChassisControl(0x4) ControlPowerAcpiSoft = ChassisControl(0x5) BootDeviceNone = BootDevice(0x00) BootDevicePxe = BootDevice(0x04) BootDeviceDisk = BootDevice(0x08) BootDeviceSafe = BootDevice(0x0c) BootDeviceDiag = BootDevice(0x10) BootDeviceCdrom = BootDevice(0x14) BootDeviceBios = BootDevice(0x18) BootDeviceRemoteFloppy = BootDevice(0x1c) BootDeviceRemotePrimary = BootDevice(0x24) BootDeviceRemoteCdrom = BootDevice(0x20) BootDeviceRemoteDisk = BootDevice(0x2c) BootDeviceFloppy = BootDevice(0x3c) SystemPower = 0x1 PowerOverload = 0x2 PowerInterlock = 0x4 MainPowerFault = 0x8 PowerControlFault = 0x10 PowerRestorePolicyAlwaysOff = 0x0 PowerRestorePolicyPrevious = 0x1 PowerRestorePolicyAlwaysOn = 0x2 PowerRestorePolicyUnknown = 0x3 PowerEventUnknown = 0x0 PowerEventAcFailed = 0x1 PowerEventOverload = 0x2 PowerEventInterlock = 0x4 PowerEventFault = 0x8 PowerEventCommand = 0x10 ChassisIntrusion = 0x1 FrontPanelLockout = 0x2 DriveFault = 0x4 CoolingFanFault = 0x8 ChassisIdentifySupported = 0x40 ChassisIdentifyMask = 0x30 ChassisIdentifyOff = 0x00 ChassisIdentifyOn = 0x10 ChassisIdentifyOnIndefinite = 0x20 ChassisIdentifyReserved = 0x30 SleepButtonDisable = 0x80 DiagButtonDisable = 0x40 ResetButtonDisable = 0x20 PowerButtonDisable = 0x10 SleepButtonDisabled = 0x08 DiagButtonDisabled = 0x04 ResetButtonDisabled = 0x02 PowerButtonDisabled = 0x01 BootParamSetInProgress = 0x0 BootParamSvcPartSelect = 0x1 BootParamSvcPartScan = 0x2 BootParamFlagValid = 0x3 BootParamInfoAck = 0x4 BootParamBootFlags = 0x5 BootParamInitInfo = 0x6 BootParamInitMbox = 0x7 IdentifyOff = IdentifyState(0x0) IdentifyOn = IdentifyState(0x1) IdentifyOnIndefinite = IdentifyState(0x2) IdentifyReserved = IdentifyState(0x3) IdentifyUnsupported = IdentifyState(0x4) )
const ( CommandGetDeviceID = Command(0x01) CommandGetAuthCapabilities = Command(0x38) CommandGetSessionChallenge = Command(0x39) CommandActivateSession = Command(0x3a) CommandSetSessionPrivilegeLevel = Command(0x3b) CommandCloseSession = Command(0x3c) CommandChassisControl = Command(0x02) CommandChassisStatus = Command(0x01) CommandSetSystemBootOptions = Command(0x08) CommandGetSystemBootOptions = Command(0x09) CommandChassisIdentify = Command(0x04) )
Command Number Assignments (table G-1)
const ( AuthTypeNone = iota AuthTypeMD2 AuthTypeMD5 AuthTypePassword AuthTypeOEM )
AuthType
const ( PrivLevelNone = iota PrivLevelCallback PrivLevelUser PrivLevelOperator PrivLevelAdmin PrivLevelOEM )
PrivLevel
const ( CommandCompleted = CompletionCode(0x00) ErrNodeBusy = CompletionCode(0xc0) ErrInvalidCommand = CompletionCode(0xc1) ErrInvalidLunCommand = CompletionCode(0xc2) ErrCommandTimeout = CompletionCode(0xc3) ErrOutOfSpace = CompletionCode(0xc4) ErrInvalidResv = CompletionCode(0xc5) ErrDataTruncated = CompletionCode(0xc6) ErrShortPacket = CompletionCode(0xc7) ErrLongPacket = CompletionCode(0xc8) ErrParamRange = CompletionCode(0xc9) ErrRequestData = CompletionCode(0xca) ErrNoObj = CompletionCode(0xcb) ErrInvalidPacket = CompletionCode(0xcc) ErrInvalidObjCommand = CompletionCode(0xcd) ErrNoResponse = CompletionCode(0xce) ErrDuplicateRequest = CompletionCode(0xcf) ErrRepoUpMode = CompletionCode(0xd0) ErrFirmwareUpMode = CompletionCode(0xd1) ErrInitMode = CompletionCode(0xd2) ErrPrivLevel = CompletionCode(0xd4) ErrInvalidState = CompletionCode(0xd5) ErrUnspecified = CompletionCode(0xff) )
Completion Codes per section 5.2
const ( OemUnknown = OemID(0) OemHP = OemID(11) OemSun = OemID(42) OemNokia = OemID(94) OemBull = OemID(107) OemHitachi116 = OemID(116) OemNEC = OemID(119) OemToshiba = OemID(186) OemIntel = OemID(343) OemTatung = OemID(373) OemHitachi399 = OemID(399) OemDell = OemID(674) OemLMC = OemID(2168) OemRadiSys = OemID(4337) OemBroadcom = OemID(4413) OemMagnum = OemID(5593) OemTyan = OemID(6653) OemNewisys = OemID(9237) OemFujitsuSiemens = OemID(10368) OemAvocent = OemID(10418) OemPeppercon = OemID(10437) OemSupermicro = OemID(10876) OemOSA = OemID(11102) OemGoogle = OemID(11129) OemPICMG = OemID(12634) OemRaritan = OemID(13742) OemKontron = OemID(15000) OemPPS = OemID(16394) OemAMI = OemID(20974) OemNokiaSiemensNetworks = OemID(28458) OemSupermicro47488 = OemID(47488) )
IANA assigned manufacturer IDs
Variables ¶
var ( NetworkFunctionChassis = NetworkFunction(0x00) NetworkFunctionApp = NetworkFunction(0x06) )
Network Function Codes per section 5.1
Functions ¶
This section is empty.
Types ¶
type ActivateSessionRequest ¶
type ActivateSessionRequest struct { AuthType uint8 PrivLevel uint8 AuthCode [16]uint8 InSeq [4]uint8 }
ActivateSessionRequest per section 22.17
type ActivateSessionResponse ¶
type ActivateSessionResponse struct { CompletionCode AuthType uint8 SessionID uint32 InboundSeq uint32 MaxPriv uint8 }
ActivateSessionResponse per section 22.17
type AuthCapabilitiesRequest ¶
AuthCapabilitiesRequest per section 22.13
type AuthCapabilitiesResponse ¶
type AuthCapabilitiesResponse struct { CompletionCode ChannelNumber uint8 AuthTypeSupport uint8 Status uint8 Reserved uint8 OEMID uint16 OEMAux uint8 }
AuthCapabilitiesResponse per section 22.13
type BootDevice ¶
type BootDevice uint8
func (BootDevice) String ¶
func (d BootDevice) String() string
type ChassisControl ¶
type ChassisControl uint8
func (ChassisControl) String ¶
func (c ChassisControl) String() string
type ChassisControlRequest ¶
type ChassisControlRequest struct {
ChassisControl
}
ChassisControlRequest per section 28.3
type ChassisControlResponse ¶
type ChassisControlResponse struct {
CompletionCode
}
ChassisControlResponse per section 28.3
type ChassisIdentifyRequest ¶
ChassisIdentifyRequest per Secion 28.5
type ChassisIdentifyResponse ¶
type ChassisIdentifyResponse struct {
CompletionCode
}
ChassisIdentifyResponse per section 28.5
type ChassisStatusRequest ¶
type ChassisStatusRequest struct{}
ChassisStatusRequest per section 28.2
type ChassisStatusResponse ¶
type ChassisStatusResponse struct { CompletionCode PowerState uint8 LastPowerEvent uint8 State uint8 FrontControlPanel uint8 }
ChassisStatusResponse per section 28.2
func (*ChassisStatusResponse) IsIdentifyOn ¶
func (s *ChassisStatusResponse) IsIdentifyOn() IdentifyState
func (*ChassisStatusResponse) IsSystemPowerOn ¶
func (s *ChassisStatusResponse) IsSystemPowerOn() bool
func (*ChassisStatusResponse) PowerRestorePolicy ¶
func (s *ChassisStatusResponse) PowerRestorePolicy() uint8
func (*ChassisStatusResponse) String ¶
func (s *ChassisStatusResponse) String() string
func (*ChassisStatusResponse) UnmarshalBinary ¶
func (r *ChassisStatusResponse) UnmarshalBinary(buf []byte) error
UnmarshalBinary implementation to handle variable length Data
type Client ¶
type Client struct { *Connection // contains filtered or unexported fields }
Client provides common high level functionality around the underlying transport
func NewClient ¶
func NewClient(c *Connection) (*Client, error)
NewClient creates a new Client with the given Connection properties
func (*Client) Control ¶
func (c *Client) Control(ctl ChassisControl) error
Control sends a chassis power control command
func (*Client) DeviceID ¶
func (c *Client) DeviceID() (*DeviceIDResponse, error)
DeviceID get the Device ID of the BMC
func (*Client) SetBootDevice ¶
func (c *Client) SetBootDevice(dev BootDevice) error
SetBootDevice is a wrapper around SetSystemBootOptionsRequest to configure the BootDevice per section 28.12 - table 28
type CloseSessionRequest ¶
type CloseSessionRequest struct {
SessionID uint32
}
CloseSessionRequest per section 22.19
type CloseSessionResponse ¶
type CloseSessionResponse struct {
CompletionCode
}
CloseSessionResponse per section 22.19
type CompletionCode ¶
type CompletionCode uint8
CompletionCode is the first byte in the data field of all IPMI responses
func (CompletionCode) Code ¶
func (c CompletionCode) Code() uint8
Code returns the CompletionCode as uint8
type Connection ¶
type Connection struct { Path string Hostname string Port int Username string Password string Interface string }
Connection properties for a Client
func (*Connection) LocalIP ¶
func (c *Connection) LocalIP() string
LocalIP returns the local (client) IP address of the Connection
func (*Connection) RemoteIP ¶
func (c *Connection) RemoteIP() string
RemoteIP returns the remote (bmc) IP address of the Connection
type DeviceIDResponse ¶
type DeviceIDResponse struct { CompletionCode DeviceID uint8 DeviceRevision uint8 FirmwareRevision1 uint8 FirmwareRevision2 uint8 IPMIVersion uint8 AdditionalDeviceSupport uint8 ManufacturerID OemID ProductID uint16 }
DeviceIDResponse per section 20.1
type IdentifyState ¶
type IdentifyState uint8
type Message ¶
type Message struct { AuthCode [16]byte Data []byte RequestID string // contains filtered or unexported fields }
Message encapsulates an IPMI message
func (*Message) CompletionCode ¶
func (m *Message) CompletionCode() CompletionCode
CompletionCode of an IPMI command response
func (*Message) NetFn ¶
func (m *Message) NetFn() NetworkFunction
NetFn returns the NetworkFunction portion of the NetFn/RsLUN field
type NetworkFunction ¶
type NetworkFunction uint8
NetworkFunction identifies the functional class of an IPMI message
type OemID ¶
type OemID uint16
OemID aka IANA assigned Enterprise Number per: http://www.iana.org/assignments/enterprise-numbers/enterprise-numbers Note that constants defined here are the same subset that ipmitool recognizes.
type Response ¶
type Response interface {
Code() uint8
}
Response to an IPMI request must include at least a CompletionCode
type SessionChallengeRequest ¶
SessionChallengeRequest per section 22.16
type SessionChallengeResponse ¶
type SessionChallengeResponse struct { CompletionCode TemporarySessionID uint32 Challenge [16]byte }
SessionChallengeResponse per section 22.16
type SessionPrivilegeLevelRequest ¶
type SessionPrivilegeLevelRequest struct {
PrivLevel uint8
}
SessionPrivilegeLevelRequest per section 22.18
type SessionPrivilegeLevelResponse ¶
type SessionPrivilegeLevelResponse struct { CompletionCode NewPrivilegeLevel uint8 }
SessionPrivilegeLevelResponse per section 22.18
type SetSystemBootOptionsRequest ¶
SetSystemBootOptionsRequest per section 28.12
func (*SetSystemBootOptionsRequest) MarshalBinary ¶
func (r *SetSystemBootOptionsRequest) MarshalBinary() ([]byte, error)
MarshalBinary implementation to handle variable length Data
func (*SetSystemBootOptionsRequest) UnmarshalBinary ¶
func (r *SetSystemBootOptionsRequest) UnmarshalBinary(buf []byte) error
UnmarshalBinary implementation to handle variable length Data
type SetSystemBootOptionsResponse ¶
type SetSystemBootOptionsResponse struct {
CompletionCode
}
SetSystemBootOptionsResponse per section 28.12
type Simulator ¶
type Simulator struct {
// contains filtered or unexported fields
}
Simulator for IPMI
func NewSimulator ¶
NewSimulator constructs a Simulator with the given addr
func (*Simulator) NewConnection ¶
func (s *Simulator) NewConnection() *Connection
NewConnection to this Simulator instance
func (*Simulator) SetHandler ¶
func (s *Simulator) SetHandler(netfn NetworkFunction, command Command, handler Handler)
SetHandler sets the command handler for the given netfn and command
type SystemBootOptionsRequest ¶
SystemBootOptionsRequest per section 28.13
type SystemBootOptionsResponse ¶
type SystemBootOptionsResponse struct { CompletionCode Version uint8 Param uint8 Data []uint8 }
SystemBootOptionsResponse per section 28.13
func (*SystemBootOptionsResponse) BootDeviceSelector ¶
func (r *SystemBootOptionsResponse) BootDeviceSelector() BootDevice
func (*SystemBootOptionsResponse) MarshalBinary ¶
func (r *SystemBootOptionsResponse) MarshalBinary() ([]byte, error)
MarshalBinary implementation to handle variable length Data
func (*SystemBootOptionsResponse) UnmarshalBinary ¶
func (r *SystemBootOptionsResponse) UnmarshalBinary(buf []byte) error
UnmarshalBinary implementation to handle variable length Data