ipmi

package module
v0.0.0-...-91d61c8 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

README

goipmi

Native IPMI implementation and ipmitool wrapper in Go.

Package goipmi provides utilities to access to i and pass around stack traces.

对使用从ipmi协议进行通信的服务器采集数据提供了底层的接口, 主要是dsn.go对外提供链接服务器接口,client_sdr.go 对外提供采集数据接口,

Usage

type SdrSensorInfo
type SdrSensorInfo struct {
	SensorType  string
	BaseUnit    string
	Value       float64
	DeviceId    string
	StatusDesc  string
	SensorEvent []string
	Avail       bool
}

SdrSensorInfo定义用户所关心采集数据的结构:

  • SensorType所采集类型,如"Temperature", "Voltage", "Current", "Fan"
  • BaseUnit数据的单位,如"degrees C", "Volts", "Amps", "Watts","Joules"
  • Value所采集数据类型的值(float64)
  • DeviceId描述所采集Sensor,如“PSU FAULT”,“BIOS”,“Watchdog”等
  • StatusDesc当sensor类型是Threshold时,该字段表示sensor的状态描述信息
  • SensorEvent当sensor类型是Sensor-specific或generic时, 该字段表示envent的列表
  • Avail描述所采集的数据值是否可用,false为unavailable,true为available
GetSensorList
func GetSensorList(reservationID uint16) ([]SdrSensorInfo, error) 
  • reservationID是采集前获取的初始值,用来迭代RecordId直到RecordId等于Oxffff,将获取的信息保存到数组SdrSensorInfo中
GetSDR
func GetSDR(reservationID uint16, recordID uint16) (sdr *sDRRecordAndValue, next uint16, err error)

执行ipmi命令   ‘Get SDR’commands,reservationID针对一次查询需求生成的ID标识,recordID是查询某一个recordID值, 三次‘get SDR’ Request请求,返回获取到的sensor信息

返回下次迭代查询的recordID值

getSensorReading
func getSensorReading(sensorNum uint8) (*GetSensorReadingResponse, error) 

执行 ipmi ‘Get Sensor Reading’ Command,根据sensorNum请求获取相应,response返回sensorReading值,可用不可用及状体或Event列表

GetSensorStatDesc
func GetSensorStatDesc(readingType SDRSensorReadingType, sensorType SDRSensorType, state2 uint8, state3 uint8) (string, []string) 

根据‘get SDR’ command获取到的 readingType、sensorType值,‘get Sensor Reading’ command 获取的state2(既data1)和state3(既data2),返回 当前sensor的状态string和Event列表[]string,

License

This project is available under the Apache 2.0 license.

Documentation

Index

Constants

View Source
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

	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
)
View Source
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)
)

Command Number Assignments (table G-1)

View Source
const (
	AuthTypeNone = iota
	AuthTypeMD2
	AuthTypeMD5

	AuthTypePassword
	AuthTypeOEM
)

AuthType

View Source
const (
	PrivLevelNone = iota
	PrivLevelCallback
	PrivLevelUser
	PrivLevelOperator
	PrivLevelAdmin
	PrivLevelOEM
)

PrivLevel

View Source
const (
	CommandGetSDRRepositoryInfo = Command(0x20)
	CommandGetReserveSDRRepo    = Command(0x22)
	CommandGetSDR               = Command(0x23)
	CommandGetSensorReading     = Command(0x2d)
)
View Source
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)
	ErrDestUnavail       = CompletionCode(0xd3)
	ErrPrivLevel         = CompletionCode(0xd4)
	ErrInvalidState      = CompletionCode(0xd5)
	ErrUnspecified       = CompletionCode(0xff)
)

Completion Codes per section 5.2

View Source
const (
	SDR_OP_SUP_ALLOC_INFO   = (1 << 0)
	SDR_OP_SUP_RESERVE_REPO = (1 << 1)
	SDR_OP_SUP_PARTIAL_ADD  = (1 << 2)
	SDR_OP_SUP_DELETE       = (1 << 3)
	SDR_OP_SUP_NON_MODAL_UP = (1 << 5)
	SDR_OP_SUP_MODAL_UP     = (1 << 6)
	SDR_OP_SUP_OVERFLOW     = (1 << 7)
)

section 33.9

View Source
const (
	SDR_RECORD_TYPE_FULL_SENSOR            = 0x01
	SDR_RECORD_TYPE_COMPACT_SENSOR         = 0x02
	SDR_RECORD_TYPE_EVENTONLY_SENSOR       = 0x03
	SDR_RECORD_TYPE_ENTITY_ASSOC           = 0x08
	SDR_RECORD_TYPE_DEVICE_ENTITY_ASSOC    = 0x09
	SDR_RECORD_TYPE_GENERIC_DEVICE_LOCATOR = 0x10
	SDR_RECORD_TYPE_FRU_DEVICE_LOCATOR     = 0x11
	SDR_RECORD_TYPE_MC_DEVICE_LOCATOR      = 0x12
	SDR_RECORD_TYPE_MC_CONFIRMATION        = 0x13
	SDR_RECORD_TYPE_BMC_MSG_CHANNEL_INFO   = 0x14
	SDR_RECORD_TYPE_OEM                    = 0xc0
)
View Source
const (
	RESERVED                                  = 0x00
	SDR_SENSOR_TYPECODES_TEMPERATURE          = 0x01
	SDR_SENSOR_TYPECODES_VOLTAGE              = 0x02
	SDR_SENSOR_TYPECODES_CURRENT              = 0x03
	SDR_SENSOR_TYPECODES_FAN                  = 0x04
	SDR_SENSOR_TYPECODES_PHYSICALSECURITY     = 0x05
	SDR_SENSOR_TYPECODES_PALTFORMSECURITY     = 0x06
	SDR_SENSOR_TYPECODES_PROCESSOR            = 0x07
	SDR_SENSOR_TYPECODES_POWSERSUPPLY         = 0x08
	SDR_SENSOR_TYPECODES_POWERUNIT            = 0x09
	SDR_SENSOR_TYPECODES_COLLINGDEVICE        = 0x0a
	SDR_SENSOR_TYPECODES_OTHERUNITSBASED      = 0x0b
	SDR_SENSOR_TYPECODES_MEMORY               = 0x0c
	SDR_SENSOR_TYPECODES_DRIVESLOT            = 0x0d
	SDR_SENSOR_TYPECODES_POSTMEMORYRESIZE     = 0x0e
	SDR_SENSOR_TYPECODES_SYSTEMFIRMWARE       = 0x0f
	SDR_SENSOR_TYPECODES_EVENTLOGGINGDISABLED = 0x10
	SDR_SENSOR_TYPECODES_WATCHDOG1            = 0x11
	SDR_SENSOR_TYPECODES_SYSTEMEVENT          = 0x12
	SDR_SENSOR_TYPECODES_CRITICALINTERRUPT    = 0x13
	SDR_SENSOR_TYPECODES_BUTTONSWITCH         = 0x14
	SDR_SENSOR_TYPECODES_MODULEBOARD          = 0x15
	SDR_SENSOR_TYPECODES_MICROCTRLCOPROCESS   = 0x16
	SDR_SENSOR_TYPECODES_ADDINCARD            = 0x17
	SDR_SENSOR_TYPECODES_CHASSIS              = 0x18
	SDR_SENSOR_TYPECODES_CHIPSET              = 0x19
	SDR_SENSOR_TYPECODES_OTHER_FRU            = 0x1a
	SDR_SENSOR_TYPECODES_CABLEINTERCONN       = 0x1b
	SDR_SENSOR_TYPECODES_TERMINATOR           = 0x1c
	SDR_SENSOR_TYPECODES_SYSBOOT_RESTAINITI   = 0x1d
	SDR_SENSOR_TYPECODES_BOOTERROR            = 0x1e
	SDR_SENSOR_TYPECODES_BASEOSBOOT_INITISTAT = 0x1f
	SDR_SENSOR_TYPECODES_OSSTOP_SHUTDOWN      = 0x20
	SDR_SENSOR_TYPECODES_STOPCONNECTOR        = 0x21
	SDR_SENSOR_TYPECODES_SYSTEMACPIPOWERSTAT  = 0x22
	SDR_SENSOR_TYPECODES_WATCHDOG2            = 0x23
	SDR_SENSOR_TYPECODES_PLATORMALERT         = 0x24
	SDR_SENSOR_TYPECODES_ENTITYPRESENCE       = 0x25
	SDR_SENSOR_TYPECODES_MONITORASIC_IC       = 0x26
	SDR_SENSOR_TYPECODES_LAN                  = 0x27
	SDR_SENSOR_TYPECODES_MANAGSUBSYSHEALTH    = 0x28
	SDR_SENSOR_TYPECODES_BATTERY              = 0x29
	SDR_SENSOR_TYPECODES_SESSIONAUDIT         = 0x2a
	SDR_SENSOR_TYPECODES_VERSIONCHANGE        = 0x2b
	SDR_SENSOR_TYPECODES_FRUSTATE             = 0x2c
)
View Source
const (
	SENSOR_READTYPE_UNSPECIFIED  = 0x00
	SENSOR_READTYPE_THREADHOLD   = 0x01
	SENSOR_READTYPE_GENERIC_L    = 0x02
	SENSOR_READTYPE_GENERIC_H    = 0x0C
	SENSOR_READTYPE_SENSORSPECIF = 0x6F
	SENSOR_READTYPE_OEM_L        = 0x70
	SENSOR_READTYPE_OEM_H        = 0x7F
)
View Source
const (
	SDR_SENSOR_STAT_LO_NC = 1 << 0
	SDR_SENSOR_STAT_LO_CR = 1 << 1
	SDR_SENSOR_STAT_LO_NR = 1 << 2
	SDR_SENSOR_STAT_HI_NC = 1 << 3
	SDR_SENSOR_STAT_HI_CR = 1 << 4
	SDR_SENSOR_STAT_HI_NR = 1 << 5
)
View Source
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

View Source
var (
	NetworkFunctionChassis     = NetworkFunction(0x00)
	NetworkFunctionSensorEvent = NetworkFunction(0x04)
	NetworkFunctionApp         = NetworkFunction(0x06)
	NetworkFunctionStorge      = NetworkFunction(0x0A)
	NetworkFunctionTransport   = NetworkFunction(0x0C)
)

Network Function Codes per section 5.1

View Source
var (
	ErrDeviceIdMustLess16   = errors.New("Device Id must be less or equal to 16 bytes length")
	ErrUnitNotSupport       = errors.New("Unit not support, only support unsigned and 2's complement signed")
	ErrMZero                = errors.New("M mustn't be 0")
	ErrIdStringLenNotMatch  = errors.New("Length of the Id string is mismatch")
	ErrSensorReadUnavail    = errors.New("Sensor Reading Unavailable")
	ErrNotFoundTheSensorNum = errors.New("failed to found the SensorNumber")
)

Functions

func GetSensorStatDesc

func GetSensorStatDesc(readingType SDRSensorReadingType, sensorType SDRSensorType, state2 uint8, state3 uint8) (string, []string)

must pass reading with read_valid is true

func NewRepo

func NewRepo() *repo

func ParseDSN

func ParseDSN(dsn string) (user, password, host string, port uint16, _err error)

parse dsn which is used to describe a connection to an ipmi server format:

user:password@ip:port
use `\` to escape : @  \

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

type AuthCapabilitiesRequest struct {
	ChannelNumber uint8
	PrivLevel     uint8
}

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

func (c *Client) CalSdrRecordValue(recordType uint8, recordKeyBody_Data *bytes.Buffer) (*sDRRecordAndValue, error)

func (*Client) Close

func (c *Client) Close() error

Close the IPMI session

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

func (c *Client) GetReserveSDRRepoForReserveId() (*ReserveRepositoryResponse, error)

func (*Client) GetSDR

func (c *Client) GetSDR(reservationID uint16, recordID uint16) (sdr *sDRRecordAndValue, next uint16, err error)

Get SDR Command 33.12

func (*Client) GetSensorList

func (c *Client) GetSensorList(reservationID uint16) ([]SdrSensorInfo, error)

func (*Client) Open

func (c *Client) Open() error

Open a new IPMI session

func (*Client) RepositoryInfo

func (c *Client) RepositoryInfo() (*SDRRepositoryInfoResponse, error)

RepositoryInfo get the Repository Info of the SDR

func (*Client) Send

func (c *Client) Send(req *Request, res Response) error

Send a Request and unmarshal to given Response type

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 Command

type Command uint8

Command fields on an IPMI message

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

func (CompletionCode) Error

func (c CompletionCode) Error() string

Error for CompletionCode

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 DeviceIDRequest

type DeviceIDRequest struct{}

DeviceIDRequest per section 20.1

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 GetSDRCommandRequest

type GetSDRCommandRequest struct {
	ReservationID    uint16
	RecordID         uint16
	OffsetIntoRecord uint8
	ByteToRead       uint8 //FFH means read entire record
}

type GetSDRCommandResponse

type GetSDRCommandResponse struct {
	CompletionCode
	NextRecordID uint16
	ReadData     []byte
}

func (*GetSDRCommandResponse) MarshalBinary

func (r *GetSDRCommandResponse) MarshalBinary() (data []byte, err error)

func (*GetSDRCommandResponse) UnmarshalBinary

func (r *GetSDRCommandResponse) UnmarshalBinary(data []byte) error

type GetSensorReadingRequest

type GetSensorReadingRequest struct {
	SensorNumber uint8
}

type GetSensorReadingResponse

type GetSensorReadingResponse struct {
	CompletionCode
	SensorReading uint8
	ReadingAvail  uint8
	Data1         uint8
	Data2         uint8
}

section 35.14

func (*GetSensorReadingResponse) UnmarshalBinary

func (r *GetSensorReadingResponse) UnmarshalBinary(data []byte) error

35.14 Data2 is Optional, so we have to implement UnmarshalBinary manually

type Handler

type Handler func(*Message) Response

Handler function

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

func (*Message) Request

func (m *Message) Request(data interface{}) Response

Request specific to the request IPMI command Unmarshal errors are returned as a Response such that they can be propagated to the client.

func (*Message) Response

func (m *Message) Response(data Response) error

Response specific to the request IPMI command

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.

func (OemID) String

func (id OemID) String() string

type Request

type Request struct {
	NetworkFunction
	Command
	Data interface{}
}

Request structure

type ReserveRepositoryResponse

type ReserveRepositoryResponse struct {
	CompletionCode
	ReservationId uint16
}

section 33.11

type ReserveSDRRepositoryRequest

type ReserveSDRRepositoryRequest struct{}

type Response

type Response interface {
	Code() uint8
}

Response to an IPMI request must include at least a CompletionCode

type SDRCompactSensor

type SDRCompactSensor struct {
	SDRRecordHeader

	Deviceid string
	// contains filtered or unexported fields
}

func NewSDRCompactSensor

func NewSDRCompactSensor(id uint16, name string) (*SDRCompactSensor, error)

func (*SDRCompactSensor) DeviceId

func (r *SDRCompactSensor) DeviceId() string

func (*SDRCompactSensor) MarshalBinary

func (r *SDRCompactSensor) MarshalBinary() (data []byte, err error)

func (*SDRCompactSensor) RecordId

func (r *SDRCompactSensor) RecordId() uint16

func (*SDRCompactSensor) RecordType

func (r *SDRCompactSensor) RecordType() SDRRecordType

func (*SDRCompactSensor) UnmarshalBinary

func (r *SDRCompactSensor) UnmarshalBinary(data []byte) error

type SDRFruDeviceLocator

type SDRFruDeviceLocator struct {
	SDRRecordHeader

	Deviceid string
	// contains filtered or unexported fields
}

func NewSDRFruDeviceLocator

func NewSDRFruDeviceLocator(id uint16, name string) (*SDRFruDeviceLocator, error)

func (*SDRFruDeviceLocator) DeviceId

func (r *SDRFruDeviceLocator) DeviceId() string

func (*SDRFruDeviceLocator) MarshalBinary

func (r *SDRFruDeviceLocator) MarshalBinary() (data []byte, err error)

func (*SDRFruDeviceLocator) RecordId

func (r *SDRFruDeviceLocator) RecordId() uint16

func (*SDRFruDeviceLocator) RecordType

func (r *SDRFruDeviceLocator) RecordType() SDRRecordType

type SDRFullSensor

type SDRFullSensor struct {
	SDRRecordHeader

	Deviceid string
	// contains filtered or unexported fields
}

func NewSDRFullSensor

func NewSDRFullSensor(id uint16, name string) (*SDRFullSensor, error)

func (*SDRFullSensor) CalValue

func (r *SDRFullSensor) CalValue(value float64) uint8

calculate the given value into the SDR reading value, using current M,B,Bexp,Rexp setting 36.3

func (*SDRFullSensor) DeviceId

func (r *SDRFullSensor) DeviceId() string

func (*SDRFullSensor) GetMBExp

func (r *SDRFullSensor) GetMBExp() (M int16, B int16, Bexp int8, Rexp int8)

func (*SDRFullSensor) MarshalBinary

func (r *SDRFullSensor) MarshalBinary() (data []byte, err error)

func (*SDRFullSensor) RecordId

func (r *SDRFullSensor) RecordId() uint16

func (*SDRFullSensor) RecordType

func (r *SDRFullSensor) RecordType() SDRRecordType

func (*SDRFullSensor) SetMBExp

func (r *SDRFullSensor) SetMBExp(M int16, B int16, Bexp int8, Rexp int8)

M: 10bit signed 2's complement B: 10bit signed 2's complement Bexp: 4bit signed 2's complement Rexp: 4bit signed 2's complement

func (*SDRFullSensor) UnmarshalBinary

func (r *SDRFullSensor) UnmarshalBinary(data []byte) error

type SDRMCDeviceLoc

type SDRMCDeviceLoc struct {
	SDRRecordHeader

	Deviceid string
	// contains filtered or unexported fields
}

type SDRMcDeviceLocator

type SDRMcDeviceLocator struct {
	SDRRecordHeader

	Deviceid string
	// contains filtered or unexported fields
}

func NewSDRMcDeviceLocator

func NewSDRMcDeviceLocator(id uint16, name string) (*SDRMcDeviceLocator, error)

func (*SDRMcDeviceLocator) DeviceId

func (r *SDRMcDeviceLocator) DeviceId() string

func (*SDRMcDeviceLocator) MarshalBinary

func (r *SDRMcDeviceLocator) MarshalBinary() (data []byte, err error)

func (*SDRMcDeviceLocator) RecordId

func (r *SDRMcDeviceLocator) RecordId() uint16

func (*SDRMcDeviceLocator) RecordType

func (r *SDRMcDeviceLocator) RecordType() SDRRecordType

type SDRRecord

type SDRRecord interface {
	DeviceId() string
	RecordId() uint16
	RecordType() SDRRecordType
}

type SDRRecordHeader

type SDRRecordHeader struct {
	Recordid   uint16
	SDRVersion uint8
	Rtype      SDRRecordType
}

type SDRRecordType

type SDRRecordType uint8

type SDRRepositoryInfoRequest

type SDRRepositoryInfoRequest struct{}

DeviceIDRequest per section 33.9

type SDRRepositoryInfoResponse

type SDRRepositoryInfoResponse struct {
	CompletionCode
	SDRVersion                  uint8
	RecordCount                 uint16
	FreeSpaceInBytes            uint16
	TimestampMostRecentAddition uint32
	TimestampMostRecentErase    uint32
	OperationSupprot            uint8
}

DeviceIDResponse per section 33.9

type SDRSensorReadingData2

type SDRSensorReadingData2 uint8

type SDRSensorReadingType

type SDRSensorReadingType uint8

type SDRSensorType

type SDRSensorType uint8

type SdrSensorInfo

type SdrSensorInfo struct {
	SensorType  string
	ReadingType SDRSensorReadingType
	BaseUnit    string
	Value       float64
	DeviceId    string
	StatusDesc  string
	SensorEvent []string
	Avail       bool
	Data1       uint8
	Data2       uint8
}

type SessionChallengeRequest

type SessionChallengeRequest struct {
	AuthType uint8
	Username [16]uint8
}

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

type SetSystemBootOptionsRequest struct {
	Param uint8
	Data  []uint8
}

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

func NewSimulator(addr net.UDPAddr) *Simulator

NewSimulator constructs a Simulator with the given addr

func (*Simulator) LocalAddr

func (s *Simulator) LocalAddr() *net.UDPAddr

LocalAddr returns the address the server is bound to.

func (*Simulator) NewConnection

func (s *Simulator) NewConnection() *Connection

NewConnection to this Simulator instance

func (*Simulator) Run

func (s *Simulator) Run() error

Run the Simulator.

func (*Simulator) SetHandler

func (s *Simulator) SetHandler(netfn NetworkFunction, command Command, handler Handler)

SetHandler sets the command handler for the given netfn and command

func (*Simulator) Stop

func (s *Simulator) Stop()

Stop the Simulator.

type SystemBootOptionsRequest

type SystemBootOptionsRequest struct {
	Param uint8
	Set   uint8
	Block uint8
}

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

Jump to

Keyboard shortcuts

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