ipmigo

package module
v0.0.0-...-e2202f1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: MIT Imports: 15 Imported by: 0

README

ipmigo

Work In Progress

ipmigo is a golang implementation for IPMI client.

Supported Version

  • IPMI v2.0(lanplus)

Examples

package main

import (
    "fmt"

    "github.com/k-sone/ipmigo"
)

func main() {
    c, err := ipmigo.NewClient(ipmigo.Arguments{
        Version:       ipmigo.V2_0,
        Address:       "192.168.1.1:623",
        Username:      "myuser",
        Password:      "mypass",
        CipherSuiteID: 3,
    })
    if err != nil {
        fmt.Println(err)
        return
    }

    if err := c.Open(); err != nil {
        fmt.Println(err)
        return
    }
    defer c.Close()

    cmd := &ipmigo.GetPOHCounterCommand{}
    if err := c.Execute(cmd); err != nil {
        fmt.Println(err)
        return
    }
    fmt.Println("Power On Hours", cmd.PowerOnHours())
}

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotSupportedIPMI error = &MessageError{Message: "Not Supported IPMI"}

Functions

This section is empty.

Types

type ArgumentError

type ArgumentError struct {
	Value   interface{} // Argument that has a problem
	Message string      // Error message
}

An ArgumentError suggests that the arguments are wrong

func (*ArgumentError) Error

func (e *ArgumentError) Error() string

type Arguments

type Arguments struct {
	Version        Version        // IPMI version to use
	Network        string         // See net.Dial parameter (The default is `udp`)
	Address        string         // See net.Dial parameter
	Timeout        time.Duration  // Each connect/read-write timeout (The default is 5sec)
	Retries        uint           // Number of retries (The default is `0`)
	Username       string         // Remote server username
	Password       string         // Remote server password
	PrivilegeLevel PrivilegeLevel // Session privilege level (The default is `Administrator`)
	CipherSuiteID  uint           // ID of cipher suite, See Table 22-20 (The default is `0` which no auth and no encrypt)

	// Will allow to get analog sensor readings of a discrete sensor
	// (For details, see to freeipmi's same name option)
	Discretereading bool
}

An argument for creating an IPMI Client

type Client

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

IPMI Client

func NewClient

func NewClient(args Arguments) (*Client, error)

Create an IPMI Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Execute

func (c *Client) Execute(cmd Command) error

func (*Client) Open

func (c *Client) Open() error

func (*Client) Ping

func (c *Client) Ping() error

type Command

type Command interface {
	Name() string
	Code() uint8
	NetFnRsLUN() NetFnRsLUN
	Marshal() (buf []byte, err error)
	Unmarshal(buf []byte) (rest []byte, err error)
	String() string
}

type CommandError

type CommandError struct {
	CompletionCode CompletionCode
	Command        Command
}

A CommandError suggests that command execution has failed

func (*CommandError) Error

func (e *CommandError) Error() string

type CompletionCode

type CompletionCode uint8

Completion Code (Section 5.2)

const (
	CompletionOK               CompletionCode = 0x00
	CompletionUnspecifiedError CompletionCode = 0xff

	CompletionNodeBusy                 CompletionCode = 0xc0
	CompletionInvalidCommand           CompletionCode = 0xc1
	CompletionInvalidCommandForLUN     CompletionCode = 0xc2
	CompletionTimeout                  CompletionCode = 0xc3
	CompletionOutOfSpace               CompletionCode = 0xc4
	CompletionReservationCancelled     CompletionCode = 0xc5
	CompletionRequestDataTruncated     CompletionCode = 0xc6
	CompletionRequestDataInvalidLength CompletionCode = 0xc7
	CompletionRequestDataFieldExceedEd CompletionCode = 0xc8
	CompletionParameterOutOfRange      CompletionCode = 0xc9
	CompletionCantReturnDataBytes      CompletionCode = 0xca
	CompletionRequestDataNotPresent    CompletionCode = 0xcb
	CompletionInvalidDataField         CompletionCode = 0xcc
	CompletionIllegalSendorOrRecord    CompletionCode = 0xcd
	CompletionCantBeProvided           CompletionCode = 0xce
	CompletionDuplicatedRequest        CompletionCode = 0xcf
	CompletionSDRInUpdateMode          CompletionCode = 0xd0
	CompletionFirmwareUpdateMode       CompletionCode = 0xd1
	CompletionBMCInitialization        CompletionCode = 0xd2
	CompletionDestinationUnavailable   CompletionCode = 0xd3
	CompletionInsufficientPrivilege    CompletionCode = 0xd4
	CompletionNotSupportedPresentState CompletionCode = 0xd5
	CompletionIllegalCommandDisabled   CompletionCode = 0xd6
)

func (CompletionCode) String

func (c CompletionCode) String() string

type EventType

type EventType uint8

Event/Reading Type (Table 42-2)

func (EventType) IsGeneric

func (e EventType) IsGeneric() bool

func (EventType) IsOEM

func (e EventType) IsOEM() bool

func (EventType) IsSensorSpecific

func (e EventType) IsSensorSpecific() bool

func (EventType) IsThreshold

func (e EventType) IsThreshold() bool

func (EventType) IsUnspecified

func (e EventType) IsUnspecified() bool

type GetChassisStatusCommand

type GetChassisStatusCommand struct {
	// Response Data
	PowerIsOn               bool
	PowerOverload           bool
	PowerInterlock          bool
	PowerFault              bool
	PowerControlFault       bool
	PowerRestorePolicy      uint8 // (See Table 28-3)
	LastPowerEventACFailed  bool
	LastPowerEventOverload  bool
	LastPowerEventInterlock bool
	LastPowerEventFault     bool
	LastPowerEventCommand   bool
	ChassisIntrusionActive  bool
	FrontPanelLockoutActive bool
	DriveFault              bool
	CoolingFanFault         bool
}

Get Chassis Status Command (Section 28.2)

func (*GetChassisStatusCommand) Code

func (c *GetChassisStatusCommand) Code() uint8

func (*GetChassisStatusCommand) Marshal

func (c *GetChassisStatusCommand) Marshal() ([]byte, error)

func (*GetChassisStatusCommand) Name

func (c *GetChassisStatusCommand) Name() string

func (*GetChassisStatusCommand) NetFnRsLUN

func (c *GetChassisStatusCommand) NetFnRsLUN() NetFnRsLUN

func (*GetChassisStatusCommand) String

func (c *GetChassisStatusCommand) String() string

func (*GetChassisStatusCommand) Unmarshal

func (c *GetChassisStatusCommand) Unmarshal(buf []byte) ([]byte, error)

type GetDeviceIDCommand

type GetDeviceIDCommand struct {
	// Response Data
	DeviceID              uint8
	DeviceRevision        uint8
	DeviceProvidesSDRs    bool
	DeviceAvailable       bool
	FirmwareMajorRevision uint8
	FirmwareMinorRevision uint8
	IPMIVersion           uint8
	SupportDeviceSensor   bool
	SupportDeviceSDRRepo  bool
	SupportDeviceSEL      bool
	SupportDeviceFRU      bool
	SupportDeviceChassis  bool
}

Get Device ID Command (Section 20.1)

func (*GetDeviceIDCommand) Code

func (c *GetDeviceIDCommand) Code() uint8

func (*GetDeviceIDCommand) Marshal

func (c *GetDeviceIDCommand) Marshal() ([]byte, error)

func (*GetDeviceIDCommand) Name

func (c *GetDeviceIDCommand) Name() string

func (*GetDeviceIDCommand) NetFnRsLUN

func (c *GetDeviceIDCommand) NetFnRsLUN() NetFnRsLUN

func (*GetDeviceIDCommand) String

func (c *GetDeviceIDCommand) String() string

func (*GetDeviceIDCommand) Unmarshal

func (c *GetDeviceIDCommand) Unmarshal(buf []byte) ([]byte, error)

type GetPOHCounterCommand

type GetPOHCounterCommand struct {
	// Response Data
	MinutesPerCount uint8
	Counter         uint32
}

Get POH Counter Command (Section 28.14)

func (*GetPOHCounterCommand) Code

func (c *GetPOHCounterCommand) Code() uint8

func (*GetPOHCounterCommand) Marshal

func (c *GetPOHCounterCommand) Marshal() ([]byte, error)

func (*GetPOHCounterCommand) Name

func (c *GetPOHCounterCommand) Name() string

func (*GetPOHCounterCommand) NetFnRsLUN

func (c *GetPOHCounterCommand) NetFnRsLUN() NetFnRsLUN

func (*GetPOHCounterCommand) PowerOnHours

func (c *GetPOHCounterCommand) PowerOnHours() time.Duration

func (*GetPOHCounterCommand) String

func (c *GetPOHCounterCommand) String() string

func (*GetPOHCounterCommand) Unmarshal

func (c *GetPOHCounterCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSDRCommand

type GetSDRCommand struct {
	// Request Data
	ReservationID uint16
	RecordID      uint16
	RecordOffset  uint8
	ReadBytes     uint8

	// Response Data
	NextRecordID uint16
	RecordData   []byte
}

Get SDR Command (Section 33.12)

func (*GetSDRCommand) Code

func (c *GetSDRCommand) Code() uint8

func (*GetSDRCommand) Marshal

func (c *GetSDRCommand) Marshal() ([]byte, error)

func (*GetSDRCommand) Name

func (c *GetSDRCommand) Name() string

func (*GetSDRCommand) NetFnRsLUN

func (c *GetSDRCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSDRCommand) String

func (c *GetSDRCommand) String() string

func (*GetSDRCommand) Unmarshal

func (c *GetSDRCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSDRRepositoryInfoCommand

type GetSDRRepositoryInfoCommand struct {
	// Response Data
	SDRVersion  uint8 // (0x01: IPMIv1.0, 0x51: IPMIv1.5, 0x02: IPMIv2.0)
	RecordCount uint16
}

Get SDR Repository Info Command (Section 33.9)

func (*GetSDRRepositoryInfoCommand) Code

func (*GetSDRRepositoryInfoCommand) Marshal

func (c *GetSDRRepositoryInfoCommand) Marshal() ([]byte, error)

func (*GetSDRRepositoryInfoCommand) Name

func (*GetSDRRepositoryInfoCommand) NetFnRsLUN

func (c *GetSDRRepositoryInfoCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSDRRepositoryInfoCommand) String

func (c *GetSDRRepositoryInfoCommand) String() string

func (*GetSDRRepositoryInfoCommand) Unmarshal

func (c *GetSDRRepositoryInfoCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSELEntryCommand

type GetSELEntryCommand struct {
	// Request Data
	ReservationID uint16
	RecordID      uint16
	RecordOffset  uint8
	ReadBytes     uint8

	// Response Data
	NextRecordID uint16
	RecordData   []byte
}

Get SEL Entry Command (Section 31.5)

func (*GetSELEntryCommand) Code

func (c *GetSELEntryCommand) Code() uint8

func (*GetSELEntryCommand) Marshal

func (c *GetSELEntryCommand) Marshal() ([]byte, error)

func (*GetSELEntryCommand) Name

func (c *GetSELEntryCommand) Name() string

func (*GetSELEntryCommand) NetFnRsLUN

func (c *GetSELEntryCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSELEntryCommand) String

func (c *GetSELEntryCommand) String() string

func (*GetSELEntryCommand) Unmarshal

func (c *GetSELEntryCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSELInfoCommand

type GetSELInfoCommand struct {
	// Response Data
	SELVersion        uint8
	Entries           uint16
	FreeSpace         uint16
	LastAddTime       uint32
	LastDelTime       uint32
	SupportAllocInfo  bool
	SupportReserve    bool
	SupportPartialAdd bool
	SupportDelete     bool
	Overflow          bool
}

Get SEL Info (Section 31.2)

func (*GetSELInfoCommand) Code

func (c *GetSELInfoCommand) Code() uint8

func (*GetSELInfoCommand) Marshal

func (c *GetSELInfoCommand) Marshal() ([]byte, error)

func (*GetSELInfoCommand) Name

func (c *GetSELInfoCommand) Name() string

func (*GetSELInfoCommand) NetFnRsLUN

func (c *GetSELInfoCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSELInfoCommand) String

func (c *GetSELInfoCommand) String() string

func (*GetSELInfoCommand) Unmarshal

func (c *GetSELInfoCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSensorReadingCommand

type GetSensorReadingCommand struct {
	// Request Data
	RsLUN        uint8
	SensorNumber uint8

	// Response Data
	SensorReading      uint8
	ReadingUnavailable bool
	ScanningDisabled   bool
	EventDisabled      bool
	SensorData2        uint8
	SensorData3        uint8
}

Get Sensor Reading Command (Section 35.14)

func (*GetSensorReadingCommand) Code

func (c *GetSensorReadingCommand) Code() uint8

func (*GetSensorReadingCommand) IsValid

func (c *GetSensorReadingCommand) IsValid() bool

Returns `true` if `SensorReading` is valid.

func (*GetSensorReadingCommand) Marshal

func (c *GetSensorReadingCommand) Marshal() ([]byte, error)

func (*GetSensorReadingCommand) Name

func (c *GetSensorReadingCommand) Name() string

func (*GetSensorReadingCommand) NetFnRsLUN

func (c *GetSensorReadingCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSensorReadingCommand) String

func (c *GetSensorReadingCommand) String() string

func (*GetSensorReadingCommand) ThresholdStatus

func (c *GetSensorReadingCommand) ThresholdStatus() ThresholdStatus

Returns the threshold status if sensor is threshold-base.

func (*GetSensorReadingCommand) Unmarshal

func (c *GetSensorReadingCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSessionInfoCommand

type GetSessionInfoCommand struct {
	// Request Data
	SessionIndex uint8  // Request Type (0x00: Current , 0xN: Nth active, 0xfe: By handle , 0xff: By ID)
	SessionID    uint32 // Session ID or Handle

	// Response Data
	SessionHandle      uint8
	SessionSlotCount   uint8
	ActiveSessionCount uint8
	UserID             uint8
	PrivilegeLevel     PrivilegeLevel
	ChannelType        uint8 // (0x00: IPMI v1.5, 0x01: IPMI v2.0)
	ChannelNumber      uint8
	ConsoleIP          net.IP
	ConsoleMAC         net.HardwareAddr
	ConsolePort        uint16
}

Get Session Info Command (Section 22.20)

func (*GetSessionInfoCommand) Code

func (c *GetSessionInfoCommand) Code() uint8

func (*GetSessionInfoCommand) Marshal

func (c *GetSessionInfoCommand) Marshal() ([]byte, error)

func (*GetSessionInfoCommand) Name

func (c *GetSessionInfoCommand) Name() string

func (*GetSessionInfoCommand) NetFnRsLUN

func (c *GetSessionInfoCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSessionInfoCommand) String

func (c *GetSessionInfoCommand) String() string

func (*GetSessionInfoCommand) Unmarshal

func (c *GetSessionInfoCommand) Unmarshal(buf []byte) ([]byte, error)

type GetSystemRestartCauseCommand

type GetSystemRestartCauseCommand struct {
	// Response Data
	RestartCause uint8 // (See Table 28-11)
}

Get System Restart Cause Command (Section 28.11)

func (*GetSystemRestartCauseCommand) Code

func (*GetSystemRestartCauseCommand) Marshal

func (c *GetSystemRestartCauseCommand) Marshal() ([]byte, error)

func (*GetSystemRestartCauseCommand) Name

func (*GetSystemRestartCauseCommand) NetFnRsLUN

func (c *GetSystemRestartCauseCommand) NetFnRsLUN() NetFnRsLUN

func (*GetSystemRestartCauseCommand) String

func (*GetSystemRestartCauseCommand) Unmarshal

func (c *GetSystemRestartCauseCommand) Unmarshal(buf []byte) ([]byte, error)

type MessageError

type MessageError struct {
	Cause   error  // Cause of the error
	Message string // Error message
	Detail  string // Detail of the error for debugging
}

A MessageError suggests that the received message is wrong or is not obtained

func (*MessageError) Error

func (e *MessageError) Error() string

type NetFn

type NetFn uint8

Network Function Codes (Section 5.1)

const (
	NetFnChassisReq NetFn = iota
	NetFnChassisRes
	NetFnBridgeReq
	NetFnBridgeRes
	NetFnSensorReq
	NetFnSensorRes
	NetFnAppReq
	NetFnAppRes
	NetFnFirmwareReq
	NetFnFirmwareRes
	NetFnStorageReq
	NetFnStorageRes
	NetFnTransportReq
	NetFnTransportRes
	NetFnOEM = 0x30
)

type NetFnRsLUN

type NetFnRsLUN uint8

Network Function and Logical Unit Number

func NewNetFnRsLUN

func NewNetFnRsLUN(netFn NetFn, rsLUN uint8) NetFnRsLUN

func (NetFnRsLUN) NetFn

func (n NetFnRsLUN) NetFn() NetFn

func (NetFnRsLUN) RsLUN

func (n NetFnRsLUN) RsLUN() uint8

type PrivilegeLevel

type PrivilegeLevel uint8

Channel Privilege Levels. (Section 6.8)

const (
	PrivilegeCallback PrivilegeLevel = iota + 1
	PrivilegeUser
	PrivilegeOperator
	PrivilegeAdministrator
)

func (PrivilegeLevel) String

func (p PrivilegeLevel) String() string

type RawCommand

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

func NewRawCommand

func NewRawCommand(name string, code uint8, fn NetFnRsLUN, input []byte) *RawCommand

func (*RawCommand) Code

func (c *RawCommand) Code() uint8

func (*RawCommand) Input

func (c *RawCommand) Input() []byte

func (*RawCommand) Marshal

func (c *RawCommand) Marshal() ([]byte, error)

func (*RawCommand) Name

func (c *RawCommand) Name() string

func (*RawCommand) NetFnRsLUN

func (c *RawCommand) NetFnRsLUN() NetFnRsLUN

func (*RawCommand) Output

func (c *RawCommand) Output() []byte

func (*RawCommand) String

func (c *RawCommand) String() string

func (*RawCommand) Unmarshal

func (c *RawCommand) Unmarshal(buf []byte) ([]byte, error)

type ReserveSDRRepositoryCommand

type ReserveSDRRepositoryCommand struct {
	// Response Data
	ReservationID uint16
}

Reserve SDR Repository Command (Section 33.11)

func (*ReserveSDRRepositoryCommand) Code

func (*ReserveSDRRepositoryCommand) Marshal

func (c *ReserveSDRRepositoryCommand) Marshal() ([]byte, error)

func (*ReserveSDRRepositoryCommand) Name

func (*ReserveSDRRepositoryCommand) NetFnRsLUN

func (c *ReserveSDRRepositoryCommand) NetFnRsLUN() NetFnRsLUN

func (*ReserveSDRRepositoryCommand) String

func (c *ReserveSDRRepositoryCommand) String() string

func (*ReserveSDRRepositoryCommand) Unmarshal

func (c *ReserveSDRRepositoryCommand) Unmarshal(buf []byte) ([]byte, error)

type ReserveSELCommand

type ReserveSELCommand struct {
	// Response Data
	ReservationID uint16
}

Reserve SEL Command (Section 31.4)

func (*ReserveSELCommand) Code

func (c *ReserveSELCommand) Code() uint8

func (*ReserveSELCommand) Marshal

func (c *ReserveSELCommand) Marshal() ([]byte, error)

func (*ReserveSELCommand) Name

func (c *ReserveSELCommand) Name() string

func (*ReserveSELCommand) NetFnRsLUN

func (c *ReserveSELCommand) NetFnRsLUN() NetFnRsLUN

func (*ReserveSELCommand) String

func (c *ReserveSELCommand) String() string

func (*ReserveSELCommand) Unmarshal

func (c *ReserveSELCommand) Unmarshal(buf []byte) ([]byte, error)

type SDR

type SDR interface {
	// Returns record type
	Type() SDRType
	// Returns record id
	ID() uint16
	// Returns bytes of the record key and body
	Data() []byte
}

Sensor Data Record

func SDRGetAllRecordsRepo

func SDRGetAllRecordsRepo(c *Client) ([]SDR, error)

Returns all sensor records from SDR repository.

func SDRGetRecordsRepo

func SDRGetRecordsRepo(c *Client, filter func(id uint16, t SDRType) bool) ([]SDR, error)

Returns sensor records from SDR repository.

type SDRCommonSensor

type SDRCommonSensor struct {
	OwnerID       uint8
	OwnerLUN      uint8
	ChannelNumber uint8
	SensorNumber  uint8

	Entity struct {
		ID       uint8 // (See Table 43-13)
		Instance uint8
		Logical  bool
	}

	SensorInitialization struct {
		Scanning       bool
		EventGen       bool
		InitSensorType bool
		InitHysteresis bool
		InitThresholds bool
		InitEvents     bool
		InitScanning   bool
	}

	SensorCapabilities struct {
		EventMessage uint8
		Threshold    uint8
		Hysteresis   uint8
		AutoRearm    bool
		Ignore       bool
	}

	SensorType       SensorType
	EventReadingType uint8 // (See Table 42-1)

	Mask struct {
		AssertionOrLowerThreshold   uint16 // (See 15-16 byte in Table 43-1)
		DeassertionOrUpperThreshold uint16 // (See 17-18 byte in Table 43-1)
		DiscreteOrReadableThreshold uint16 // (See 19-20 byte in Table 43-1)
	}

	SensorUnits struct {
		Percentage   bool
		Modifier     uint8
		RateUnit     uint8
		Analog       uint8
		BaseType     UnitType
		ModifierType UnitType
	}
	// contains filtered or unexported fields
}

Intersection of FullSensor and CompactSensor

func (*SDRCommonSensor) Data

func (r *SDRCommonSensor) Data() []byte

func (*SDRCommonSensor) ID

func (r *SDRCommonSensor) ID() uint16

func (*SDRCommonSensor) Type

func (r *SDRCommonSensor) Type() SDRType

func (*SDRCommonSensor) UnitString

func (r *SDRCommonSensor) UnitString() string

func (*SDRCommonSensor) Unmarshal

func (r *SDRCommonSensor) Unmarshal(buf []byte) ([]byte, error)

type SDRCompactSensor

type SDRCompactSensor struct {
	SDRCommonSensor

	Share struct {
		Count          uint8
		ModifierType   uint8 // (0: numeric, 1: alpha)
		ModifierOffset uint8
		EntityInstance uint8 // (0: same, 1: increments)
	}

	Threshold struct {
		PositiveHysteresis uint8
		NegativeHysteresis uint8
	}

	OEM      uint8
	IDType   uint8
	IDLength uint8
	IDString []byte
}

Compact Sensor Record (Section 43.2)

func (*SDRCompactSensor) SensorID

func (r *SDRCompactSensor) SensorID() string

func (*SDRCompactSensor) Unmarshal

func (r *SDRCompactSensor) Unmarshal(buf []byte) ([]byte, error)

type SDRFRUDeviceLocator

type SDRFRUDeviceLocator struct {
	SlaveAddress       uint8
	DeviceID           uint8
	BusID              uint8
	AccessLUN          uint8
	Logical            bool
	ChannelNumber      uint8
	DeviceType         uint8
	DeviceTypeModifier uint8

	Entity struct {
		ID       uint8
		Instance uint8
	}

	OEM      uint8
	IDType   uint8
	IDLength uint8
	IDString []byte
	// contains filtered or unexported fields
}

FRU Device Locator Record (Section 43.8)

func (*SDRFRUDeviceLocator) Data

func (r *SDRFRUDeviceLocator) Data() []byte

func (*SDRFRUDeviceLocator) ID

func (r *SDRFRUDeviceLocator) ID() uint16

func (*SDRFRUDeviceLocator) SensorID

func (r *SDRFRUDeviceLocator) SensorID() string

func (*SDRFRUDeviceLocator) Type

func (r *SDRFRUDeviceLocator) Type() SDRType

func (*SDRFRUDeviceLocator) Unmarshal

func (r *SDRFRUDeviceLocator) Unmarshal(buf []byte) ([]byte, error)

type SDRFullSensor

type SDRFullSensor struct {
	SDRCommonSensor

	Linearization uint8
	M             int16
	Tolerance     uint8
	B             int16
	Accuracy      uint16
	AccuracyExp   uint8
	RExp          int8
	BExp          int8

	AnalogFlags struct {
		NominalRead bool
		NormalMax   bool
		NormalMin   bool
	}

	NominalRead uint8
	NormalMax   uint8
	NormalMin   uint8
	SensorMax   uint8
	SensorMin   uint8

	Threshold struct {
		UpperNonRecover    uint8
		UpperCrit          uint8
		UpperNonCrit       uint8
		LowerNonRecover    uint8
		LowerCrit          uint8
		LowerNonCrit       uint8
		PositiveHysteresis uint8
		NegativeHysteresis uint8
	}

	OEM      uint8
	IDType   uint8
	IDLength uint8
	IDString []byte
}

Full Sensor Record (Section 43.1)

func (*SDRFullSensor) ConvertSensorReading

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

Returns converted sensor reading.

func (*SDRFullSensor) IsAnalogReading

func (r *SDRFullSensor) IsAnalogReading() bool

Returns `true` if sensor has an analog reading.

func (*SDRFullSensor) IsThresholdBaseSensor

func (r *SDRFullSensor) IsThresholdBaseSensor() bool

Returns `true` if sensor is threshold-base.

func (*SDRFullSensor) SensorID

func (r *SDRFullSensor) SensorID() string

func (*SDRFullSensor) Unmarshal

func (r *SDRFullSensor) Unmarshal(buf []byte) ([]byte, error)

type SDRType

type SDRType uint8

Sensor Data Record Type

const (
	SDRTypeFullSensor              SDRType = 0x01
	SDRTypeCompactSensor           SDRType = 0x02
	SDRTypeEventOnlySensor         SDRType = 0x03
	SDRTypeEntityAssociation       SDRType = 0x08
	SDRTypeDeviceEntityAssociation SDRType = 0x09
	SDRTypeGenericDeviceLocator    SDRType = 0x10
	SDRTypeFRUDeviceLocator        SDRType = 0x11
	SDRTypeMCDeviceLocator         SDRType = 0x12
	SDRTypeMCConfirmation          SDRType = 0x13
	SDRTypeBMCMessageChannelInfo   SDRType = 0x14
	SDRTypeOEM                     SDRType = 0xc0
)

type SELEventRecord

type SELEventRecord struct {
	RecordID     uint16
	RecordType   SELType
	Timestamp    Timestamp
	GeneratorID  uint16
	EvMRev       uint8
	SensorType   SensorType
	SensorNumber uint8
	EventType    EventType
	EventDir     uint8
	EventData1   uint8 // (Table 29-6)
	EventData2   uint8 // (Table 29-6)
	EventData3   uint8 // (Table 29-6)
	// contains filtered or unexported fields
}

SEL Event Record (Section 32.1)

func (*SELEventRecord) Data

func (r *SELEventRecord) Data() []byte

func (*SELEventRecord) Description

func (r *SELEventRecord) Description() string

Returns event description.

func (*SELEventRecord) GetEventTriggerReading

func (r *SELEventRecord) GetEventTriggerReading() (uint8, bool)

Returns trigger reading of threshold-base sensor.

func (*SELEventRecord) GetEventTriggerThreshold

func (r *SELEventRecord) GetEventTriggerThreshold() (uint8, bool)

Returns trigger threshold value of threshold-base sensor.

func (*SELEventRecord) ID

func (r *SELEventRecord) ID() uint16

func (*SELEventRecord) IsAssertionEvent

func (r *SELEventRecord) IsAssertionEvent() bool

Returns `true'` if it is assertion event.

func (*SELEventRecord) Type

func (r *SELEventRecord) Type() SELType

func (*SELEventRecord) Unmarshal

func (r *SELEventRecord) Unmarshal(buf []byte) ([]byte, error)

type SELNonTimestampedOEMRecord

type SELNonTimestampedOEMRecord struct {
	RecordID   uint16
	RecordType SELType
	OEM        []byte
	// contains filtered or unexported fields
}

Non-Timestamped OEM SEL record (Section 32.3)

func (*SELNonTimestampedOEMRecord) Data

func (r *SELNonTimestampedOEMRecord) Data() []byte

func (*SELNonTimestampedOEMRecord) ID

func (*SELNonTimestampedOEMRecord) Type

func (*SELNonTimestampedOEMRecord) Unmarshal

func (r *SELNonTimestampedOEMRecord) Unmarshal(buf []byte) ([]byte, error)

type SELRecord

type SELRecord interface {
	// Returns record type
	Type() SELType
	// Returns record id
	ID() uint16
	// Returns bytes of the record key and body
	Data() []byte
}

Sensor Event Log Record

func SELGetEntries

func SELGetEntries(c *Client, offset, num int) (records []SELRecord, total int, err error)

type SELTimestampedOEMRecord

type SELTimestampedOEMRecord struct {
	RecordID       uint16
	RecordType     SELType
	Timestamp      Timestamp
	ManufacturerID uint32
	OEMDefined     []byte
	// contains filtered or unexported fields
}

Timestamped OEM SEL record (Section 32.2)

func (*SELTimestampedOEMRecord) Data

func (r *SELTimestampedOEMRecord) Data() []byte

func (*SELTimestampedOEMRecord) ID

func (*SELTimestampedOEMRecord) Type

func (r *SELTimestampedOEMRecord) Type() SELType

func (*SELTimestampedOEMRecord) Unmarshal

func (r *SELTimestampedOEMRecord) Unmarshal(buf []byte) ([]byte, error)

type SELType

type SELType uint8

Sensor Event Log Record Type

func (SELType) IsNonTimestampedOEM

func (t SELType) IsNonTimestampedOEM() bool

func (SELType) IsTimestampedOEM

func (t SELType) IsTimestampedOEM() bool

type SensorType

type SensorType uint8

Sensor Type (Table 42-3)

func (SensorType) String

func (t SensorType) String() string

type SetChassisControlCommand

type SetChassisControlCommand struct {
	// Request Data
	PowerState uint8
}

Set Chassis Power Command (Section 28.3)

func (*SetChassisControlCommand) Code

func (c *SetChassisControlCommand) Code() uint8

func (*SetChassisControlCommand) Marshal

func (c *SetChassisControlCommand) Marshal() ([]byte, error)

func (*SetChassisControlCommand) Name

func (c *SetChassisControlCommand) Name() string

func (*SetChassisControlCommand) NetFnRsLUN

func (c *SetChassisControlCommand) NetFnRsLUN() NetFnRsLUN

func (*SetChassisControlCommand) String

func (c *SetChassisControlCommand) String() string

func (*SetChassisControlCommand) Unmarshal

func (c *SetChassisControlCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMBIOSDate2Command

type SupermicroOEMBIOSDate2Command struct {
	// Response Data
	BIOSDate string
}

SupermicroOEMBIOSDate2Command is the Supermicro OEM command to get the board's BIOS date

func (*SupermicroOEMBIOSDate2Command) Code

func (*SupermicroOEMBIOSDate2Command) Marshal

func (c *SupermicroOEMBIOSDate2Command) Marshal() ([]byte, error)

func (*SupermicroOEMBIOSDate2Command) Name

func (*SupermicroOEMBIOSDate2Command) NetFnRsLUN

func (c *SupermicroOEMBIOSDate2Command) NetFnRsLUN() NetFnRsLUN

func (*SupermicroOEMBIOSDate2Command) String

func (*SupermicroOEMBIOSDate2Command) Unmarshal

func (c *SupermicroOEMBIOSDate2Command) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMBIOSUpdateProgressCommand

type SupermicroOEMBIOSUpdateProgressCommand struct {
	// Request Data
	ID uint16
	// Response Data
	CompletionCode uint8
}

SupermicroOEMBIOSUpdateProgressCommand is the Supermicro OEM command to get the current BIOS flash state over IPMI

func (*SupermicroOEMBIOSUpdateProgressCommand) Code

func (*SupermicroOEMBIOSUpdateProgressCommand) Marshal

func (*SupermicroOEMBIOSUpdateProgressCommand) Name

func (*SupermicroOEMBIOSUpdateProgressCommand) NetFnRsLUN

func (*SupermicroOEMBIOSUpdateProgressCommand) String

func (*SupermicroOEMBIOSUpdateProgressCommand) Unmarshal

func (c *SupermicroOEMBIOSUpdateProgressCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMBIOSVersionCommand

type SupermicroOEMBIOSVersionCommand struct {
	// Response Data
	BIOSVersion string
}

SupermicroOEMBIOSVersionCommand is the Supermicro OEM command to get the board's BIOS version

func (*SupermicroOEMBIOSVersionCommand) Code

func (*SupermicroOEMBIOSVersionCommand) Marshal

func (c *SupermicroOEMBIOSVersionCommand) Marshal() ([]byte, error)

func (*SupermicroOEMBIOSVersionCommand) Name

func (*SupermicroOEMBIOSVersionCommand) NetFnRsLUN

func (*SupermicroOEMBIOSVersionCommand) String

func (*SupermicroOEMBIOSVersionCommand) Unmarshal

func (c *SupermicroOEMBIOSVersionCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMCancelBIOSCommand

type SupermicroOEMCancelBIOSCommand struct {
	// Request Data
	ID uint16
}

SupermicroOEMCancelBIOSCommand is the Supermicro OEM command to cancel a BIOS flash over IPMI

func (*SupermicroOEMCancelBIOSCommand) Code

func (*SupermicroOEMCancelBIOSCommand) Marshal

func (c *SupermicroOEMCancelBIOSCommand) Marshal() ([]byte, error)

func (*SupermicroOEMCancelBIOSCommand) Name

func (*SupermicroOEMCancelBIOSCommand) NetFnRsLUN

func (*SupermicroOEMCancelBIOSCommand) String

func (*SupermicroOEMCancelBIOSCommand) Unmarshal

func (c *SupermicroOEMCancelBIOSCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMFinalizeBIOSCommand

type SupermicroOEMFinalizeBIOSCommand struct {
	// Request Data
	ID uint16
}

SupermicroOEMFinalizeBIOSCommand is the Supermicro OEM command to finalize a BIOS flash over IPMI

func (*SupermicroOEMFinalizeBIOSCommand) Code

func (*SupermicroOEMFinalizeBIOSCommand) Marshal

func (c *SupermicroOEMFinalizeBIOSCommand) Marshal() ([]byte, error)

func (*SupermicroOEMFinalizeBIOSCommand) Name

func (*SupermicroOEMFinalizeBIOSCommand) NetFnRsLUN

func (*SupermicroOEMFinalizeBIOSCommand) String

func (*SupermicroOEMFinalizeBIOSCommand) Unmarshal

func (c *SupermicroOEMFinalizeBIOSCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMFlashBIOSCommand

type SupermicroOEMFlashBIOSCommand struct {
	// Request Data
	ID   uint16
	Flag uint32
}

SupermicroOEMFlashBIOSCommand is the Supermicro OEM command to flash all uploaded BIOS chunk over IPMI

func (*SupermicroOEMFlashBIOSCommand) Code

func (*SupermicroOEMFlashBIOSCommand) Marshal

func (c *SupermicroOEMFlashBIOSCommand) Marshal() ([]byte, error)

func (*SupermicroOEMFlashBIOSCommand) Name

func (*SupermicroOEMFlashBIOSCommand) NetFnRsLUN

func (c *SupermicroOEMFlashBIOSCommand) NetFnRsLUN() NetFnRsLUN

func (*SupermicroOEMFlashBIOSCommand) String

func (*SupermicroOEMFlashBIOSCommand) Unmarshal

func (c *SupermicroOEMFlashBIOSCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMProductIDCommand

type SupermicroOEMProductIDCommand struct {
	// Response Data
	BoardModelID uint16
}

SupermicroOEMProductIDCommand is the Supermicro OEM command to get the board's product ID

func (*SupermicroOEMProductIDCommand) Code

func (*SupermicroOEMProductIDCommand) Marshal

func (c *SupermicroOEMProductIDCommand) Marshal() ([]byte, error)

func (*SupermicroOEMProductIDCommand) Name

func (*SupermicroOEMProductIDCommand) NetFnRsLUN

func (c *SupermicroOEMProductIDCommand) NetFnRsLUN() NetFnRsLUN

func (*SupermicroOEMProductIDCommand) String

func (*SupermicroOEMProductIDCommand) Unmarshal

func (c *SupermicroOEMProductIDCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMStartBIOSUpgradeCommand

type SupermicroOEMStartBIOSUpgradeCommand struct {
	// Request Data
	ImageSize uint32

	// Response Data
	ID           uint16
	MaxChunkSize uint32
}

SupermicroOEMStartBIOSUpgradeCommand is the Supermicro OEM command to start BIOS upgrade over IPMI

func (*SupermicroOEMStartBIOSUpgradeCommand) Code

func (*SupermicroOEMStartBIOSUpgradeCommand) Marshal

func (*SupermicroOEMStartBIOSUpgradeCommand) Name

func (*SupermicroOEMStartBIOSUpgradeCommand) NetFnRsLUN

func (*SupermicroOEMStartBIOSUpgradeCommand) String

func (*SupermicroOEMStartBIOSUpgradeCommand) Unmarshal

func (c *SupermicroOEMStartBIOSUpgradeCommand) Unmarshal(buf []byte) ([]byte, error)

type SupermicroOEMUploadBIOSCommand

type SupermicroOEMUploadBIOSCommand struct {
	// Request Data
	ID     uint16
	Offset uint32
	Data   []byte
}

SupermicroOEMUploadBIOSCommand is the Supermicro OEM command to upload a BIOS chunk over IPMI

func (*SupermicroOEMUploadBIOSCommand) Code

func (*SupermicroOEMUploadBIOSCommand) Marshal

func (c *SupermicroOEMUploadBIOSCommand) Marshal() ([]byte, error)

func (*SupermicroOEMUploadBIOSCommand) Name

func (*SupermicroOEMUploadBIOSCommand) NetFnRsLUN

func (*SupermicroOEMUploadBIOSCommand) String

func (*SupermicroOEMUploadBIOSCommand) Unmarshal

func (c *SupermicroOEMUploadBIOSCommand) Unmarshal(buf []byte) ([]byte, error)

type ThresholdStatus

type ThresholdStatus string
const (
	// Normal operating ranges
	ThresholdStatusOK ThresholdStatus = "ok"
	// Lower Non-Recoverable
	ThresholdStatusLNR ThresholdStatus = "lnr"
	// Lower Critical
	ThresholdStatusLCR ThresholdStatus = "lcr"
	// Lower Non-Critical
	ThresholdStatusLNC ThresholdStatus = "lnc"
	// Upper Non-Recoverable
	ThresholdStatusUNR ThresholdStatus = "unr"
	// Upper Critical
	ThresholdStatusUCR ThresholdStatus = "ucr"
	// Upper Non-Critical
	ThresholdStatusUNC ThresholdStatus = "unc"
)

func NewThresholdStatus

func NewThresholdStatus(status uint8) ThresholdStatus

Returns threshold status of threshold-base sensor.

type Timestamp

type Timestamp struct {
	Value uint32
}

Timestamp (Section 37)

func (*Timestamp) Format

func (t *Timestamp) Format(format string) string

func (*Timestamp) IsPostInit

func (t *Timestamp) IsPostInit() bool

func (*Timestamp) IsUnspecified

func (t *Timestamp) IsUnspecified() bool

func (*Timestamp) String

func (t *Timestamp) String() string

type UnitType

type UnitType uint8

Sensor Unit Type (Section 43.17)

func (UnitType) String

func (u UnitType) String() string

type Version

type Version int
const (
	V1_5 Version = iota + 1
	V2_0
)

Directories

Path Synopsis
examples
sdr
sel

Jump to

Keyboard shortcuts

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