dcmi

package
v0.0.0-...-be2ac48 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package dcmi implements the Data Center Manageability Interface specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CapabilitiesParameter

type CapabilitiesParameter uint8

CapabilitiesParameter is a kind of sub-command number within the Get DCMI Capabilities request. This seems to be an effort by the spec to keep packets as small as possible, but is a pain as we effectively have to send up to 5 packets to discover all capabilities. To address this madness, this library does something equally mad and implements each parameter as its own command, as there is no way to know from a response packet alone which parameter was requested.

func (CapabilitiesParameter) Description

func (s CapabilitiesParameter) Description() string

Description returns the human-readable name of each parameter.

func (CapabilitiesParameter) String

func (s CapabilitiesParameter) String() string

type GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd

type GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd struct {
	Rsp GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp
	// contains filtered or unexported fields
}

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd) Name

Name returns "Get DCMI Capabilities Info (Enhanced System Power Statistics Attributes)".

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd) Operation

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd) Operation() *ipmi.Operation

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd) Request

func (c *GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd) Request() gopacket.SerializableLayer

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsCmd) Response

type GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp

type GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp struct {
	layers.BaseLayer

	// PowerRollingAvgTimePeriods returns the supported rolling average time
	// periods that can be requested with the Get Power Reading command. This
	// will be a whole number of seconds, minutes, hours or days, from 0 seconds
	// to 63 days. A value of 0 means the system supports obtaining the current
	// reading. This slice contains time periods in the order provided by the
	// BMC.
	PowerRollingAvgTimePeriods []time.Duration
	// contains filtered or unexported fields
}

GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp is returned when a Get DCMI Capabilities Info request is sent with parameter 5. This is not supported by v1.0.

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp) CanDecode

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp) Decode

func (g *GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp) Decode(data []byte, df gopacket.DecodeFeedback) ([]byte, error)

Decode decodes the header and returns the remaining bytes (which could be empty), or nil if an error occurs.

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp) DecodeFromBytes

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp) LayerType

func (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp) NextLayerType

type GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd

type GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd struct {
	Rsp GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp
	// contains filtered or unexported fields
}

func NewGetDCMICapabilitiesInfoManageabilityAccessAttrsCmd

func NewGetDCMICapabilitiesInfoManageabilityAccessAttrsCmd() *GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd) Name

Name returns "Get DCMI Capabilities Info (Manageability Access Attributes)".

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd) Operation

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd) Operation() *ipmi.Operation

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd) Request

func (c *GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd) Request() gopacket.SerializableLayer

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsCmd) Response

type GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp

type GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp struct {
	layers.BaseLayer

	// PrimaryLANOOBChannel is the primary LAN OOB channel number. This will
	// only be a valid channel number for systems supporting RMCP+. 0xff
	// indicates not supported; the Valid() method can be used to test for this.
	PrimaryLANOOBChannel ipmi.Channel

	// SecondaryLANOOBChannel is the secondary LAN OOB channel number. This may
	// be invalid on all systems, as a secondary channel is optional. 0xff
	// indicates not supported; the Valid() method can be used to test for this.
	SecondaryLANOOBChannel ipmi.Channel

	// SerialOOBChannel is the serial OOB TMODE channel number. This is
	// optional, and so may give an invalid channel number on all systems. 0xff
	// indicates not supported; use Valid() to test.
	SerialOOBChannel ipmi.Channel
	// contains filtered or unexported fields
}

GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp is returned when a Get DCMI Capabilities Info request is sent with parameter 4.

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp) CanDecode

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp) Decode

func (g *GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp) Decode(data []byte, df gopacket.DecodeFeedback) ([]byte, error)

Decode decodes the header and returns the remaining bytes (which could be empty), or nil if an error occurs.

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp) DecodeFromBytes

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp) LayerType

func (*GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp) NextLayerType

type GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd

type GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd struct {
	Rsp GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp
	// contains filtered or unexported fields
}

func NewGetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd

func NewGetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd() *GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd) Name

Name returns "Get DCMI Capabilities Info (Mandatory Platform Attributes)".

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd) Operation

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd) Operation() *ipmi.Operation

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd) Request

func (c *GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd) Request() gopacket.SerializableLayer

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsCmd) Response

type GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp

type GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp struct {
	layers.BaseLayer

	// SELAutoRollover indicates whether SEL automatic rollover is enabled, also
	// known as SEL overwrite.
	SELAutoRollover bool

	// SELFlushOnRollover indicates whether, on rollover, the entire SEL is
	// flushed. This should be ignored if SELAutoRollover is false, or if the
	// response is v1.0, where this is unspecified.
	SELFlushOnRollover bool

	// SELRecordLevelFlushOnRollover indicates whether individual SEL records
	// are flished upon rollover, as opposed to the entire SEL. This should be
	// ignored in SELAutoRollover is false, or if the response is v1.0, where
	// this is unspecified.
	SELRecordLevelFlushOnRollover bool

	// SELMaxEntries contains the maximum number of SEL entries supported by the
	// system. v1.0 gives no lower bound, v1.1 and v1.5 say 64. The max is 4096
	// for all implementations. It is a 12-bit uint on the wire, however as DCMI
	// (like IPMI) uses little-endian, the max representable value is 0xff0f, or
	// 65295, rather than 0x0fff, which would be 4095.
	SELMaxEntries uint16

	// AssetTagSupport indicates whether the system supports the asset tag
	// functions for a v1.0 system. This is mandatory in one place, recommended
	// in another, and removed from v1.1. It is set to true from v1.1 for
	// backwards compatibility.
	AssetTagSupport bool

	// DHCPHostNameSupport indicates whether the system publishes itself as a
	// DCMI controller when using DISCOVER mechanisms by setting option 12 (Host
	// Name) to equal "DCMI". This is recommended in v1.0, and mandatory from
	// v1.1, where it is forced to true.
	DHCPHostNameSupport bool

	// GUIDSupport indicates whether the system supports the system GUID
	// identification function. This is mandatory in the v1.0 spec, and the
	// field is removed from v1.1, where it is forced to true.
	GUIDSupport bool

	// BaseboardTemperature indicates whether at least one baseboard temperature
	// sensor is present. This is mandatory in v1.0, and the field is removed
	// from v1.1, where it is forced to true.
	BaseboardTemperature bool

	// ProcessorsTemperature indicates whether at least one processor
	// temperature sensor is present. This is mandatory in v1.0, and the field
	// is removed from v1.1, where it is forced to true.
	ProcessorsTemperature bool

	// InletTemperature indicates whether at least one baseboard temperature
	// sensor is present. This is mandatory in v1.0, and the field is removed
	// from v1.1, where it is forced to true.
	InletTemperature bool

	// TemperatureSamplingFrequency is the interval between successive
	// temperature samples. This will be a whole number of seconds between 0 and
	// 255. It will always be 0 for v1.0, where the field is not present.
	TemperatureSamplingFrequency time.Duration
	// contains filtered or unexported fields
}

GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp is returned when a Get DCMI Capabilities Info request is sent with parameter 2.

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp) CanDecode

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp) Decode

func (g *GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp) Decode(data []byte, df gopacket.DecodeFeedback) ([]byte, error)

Decode decodes the header and returns the remaining bytes (which could be empty), or nil if an error occurs.

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp) DecodeFromBytes

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp) LayerType

func (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp) NextLayerType

type GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd

type GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd struct {
	Rsp GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp
	// contains filtered or unexported fields
}

func NewGetDCMICapabilitiesInfoOptionalPlatformAttrsCmd

func NewGetDCMICapabilitiesInfoOptionalPlatformAttrsCmd() *GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd) Name

Name returns "Get DCMI Capabilities Info (Optional Platform Attributes)".

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd) Operation

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd) Operation() *ipmi.Operation

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd) Request

func (c *GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd) Request() gopacket.SerializableLayer

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsCmd) Response

type GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp

type GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp struct {
	layers.BaseLayer

	// PowerManagementSlaveAddress gives the 7-bit I2C slave address of the
	// power management device on the IPMB.
	PowerManagementSlaveAddress ipmi.SlaveAddress

	// PowerManagementChannel is the channel number of the power management
	// controller.
	PowerManagementChannel ipmi.Channel

	// PowerManagementRevision is the power management controller device
	// revision.
	PowerManagementRevision uint8
	// contains filtered or unexported fields
}

GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp is returned when a Get DCMI Capabilities Info request is sent with parameter 3.

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp) CanDecode

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp) Decode

func (g *GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp) Decode(data []byte, df gopacket.DecodeFeedback) ([]byte, error)

Decode decodes the header and returns the remaining bytes (which could be empty), or nil if an error occurs.

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp) DecodeFromBytes

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp) LayerType

func (*GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp) NextLayerType

type GetDCMICapabilitiesInfoReq

type GetDCMICapabilitiesInfoReq struct {
	layers.BaseLayer

	// Parameter specifies the type of attributes or capabilities desired. This
	// command returns one of several different possible pieces of information
	// depending on this value, e.g. supported DCMI capabilities, platform
	// attributes and access attributes. The response layer formats for the
	// different selector values are specified in Table 6-3.
	Parameter CapabilitiesParameter
}

GetDCMICapabilitiesInfoReq represents the Get DCMI Capabilities Info request, specified in 6.1. This is a session-less command, but the spec explicitly says it can be executed inside a session at any privilege level.

This command is also recommended (not by the spec) for DCMI discovery. Although a DCMI flag is present in the RMCP Presence Pong message since DCMI 1.5 (2011), in practice, this alone is useless as large parts of DCMI (e.g. power management) are optional. Given sending this command to discover what is actually supported would be necessary anyway in most cases, it is advised to forget RMCP Presence Ping and just send this.

func (*GetDCMICapabilitiesInfoReq) LayerType

func (*GetDCMICapabilitiesInfoReq) SerializeTo

type GetDCMICapabilitiesInfoSupportedCapabilitiesCmd

type GetDCMICapabilitiesInfoSupportedCapabilitiesCmd struct {
	Rsp GetDCMICapabilitiesInfoSupportedCapabilitiesRsp
	// contains filtered or unexported fields
}

func NewGetDCMICapabilitiesInfoSupportedCapabilitiesCmd

func NewGetDCMICapabilitiesInfoSupportedCapabilitiesCmd() *GetDCMICapabilitiesInfoSupportedCapabilitiesCmd

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesCmd) Name

Name returns "Get DCMI Capabilities Info (Supported Capabilities)".

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesCmd) Operation

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesCmd) Operation() *ipmi.Operation

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesCmd) Request

func (c *GetDCMICapabilitiesInfoSupportedCapabilitiesCmd) Request() gopacket.SerializableLayer

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesCmd) Response

type GetDCMICapabilitiesInfoSupportedCapabilitiesRsp

type GetDCMICapabilitiesInfoSupportedCapabilitiesRsp struct {
	layers.BaseLayer

	// TemperatureMonitor indicates whether the system supports the temperature
	// monitoring commands in Table 3-1 of v1.0. This is a v1.0-only field, but
	// will be forced to true for v1.1 and v1.5 systems for backwards
	// compatibility.
	TemperatureMonitor bool

	// ChassisPower indicates whether the system supports the chassis power
	// commands in Table 3-1 of v1.0. This is a v1.0-only field, but will be
	// forced to true for v1.1 and v1.5 systems for backwards compatibility.
	ChassisPower bool

	// SELLogging indicates whether the system supports the event logging
	// commands in Table 3-1 of v1.0. This is a v1.0-only field, but will be
	// forced to true for v1.1 and v1.5 systems for backwards compatibility.
	SELLogging bool

	// Identification indicates whether the system supports the identification
	// commands in Table 3-1 of v1.0. This is a v1.0-only field, but will be
	// forced to true for v1.1 and v1.5 systems for backwards compatibility.
	Identification bool

	// PowerManagement indicates whether the server supports the power
	// management platform functions, e.g. Get Power Reading. Note, at least
	// SuperMicro BMCs are known to report true here but give a 0-byte response
	// (with normal completion code) to the Get Power Reading command.
	PowerManagement bool

	// VLANCapable indicates whether the system supports VLANs. This is a
	// v1.0-only field, and will be forced to true for v1.1 and v1.5 systems for
	// backwards compatibility.
	VLANCapable bool

	// SOLSupportes indicates whether the system supports serial-over-LAN. This
	// is a v1.0-only field, and will be forced to true for v1.1 and v1.5
	// systems for backwards compatibility.
	SOLSupported bool

	// OOBPrimaryLANChannelAvailable indicates whether an Out-of-Band Primary
	// LAN Channel is available. This is a v1.0-only field, and will be forced
	// to true for v1.1 and v1.5 systems for backwards compatibility.
	OOBPrimaryLANChannelAvailable bool

	// OOBSecondaryLANChannelAvailable indicates whether an Out-of-Band
	// Secondary (second) LAN Channel is available.
	OOBSecondaryLANChannelAvailable bool

	// SerialTMODEAvailable indicates whether TMODE is available on the serial
	// port to the management controller.
	SerialTMODEAvailable bool

	// IBKCSChannelAvailable indicates whether an in-band KCS channel is
	// available. This is a v1.0 field, forced to true for v1.1 and v1.5 for
	// backwards compatibility.
	IBKCSChannelAvailable bool

	// IBSystemInterfaceChannelAvailable indicates whether an in-band system
	// interface channel is available. This will always be false for v1.0, which
	// uses this bit for the KCS channel instead.
	IBSystemInterfaceChannelAvailable bool
	// contains filtered or unexported fields
}

GetDCMICapabilitiesInfoSupportedCapabilitiesRsp is returned when a Get DCMI Capabilities Info request is sent with parameter 1. The returned capabilities detail conformance to the spec for platform and manageability access.

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesRsp) CanDecode

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesRsp) Decode

func (g *GetDCMICapabilitiesInfoSupportedCapabilitiesRsp) Decode(data []byte, df gopacket.DecodeFeedback) ([]byte, error)

Decode decodes the header and returns the remaining bytes (which could be empty), or nil if an error occurs.

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesRsp) DecodeFromBytes

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesRsp) LayerType

func (*GetDCMICapabilitiesInfoSupportedCapabilitiesRsp) NextLayerType

type GetDCMISensorInfoCmd

type GetDCMISensorInfoCmd struct {
	Req GetDCMISensorInfoReq
	Rsp GetDCMISensorInfoRsp
}

func (*GetDCMISensorInfoCmd) Name

func (*GetDCMISensorInfoCmd) Name() string

Name returns "Get DCMI Sensor Info".

func (*GetDCMISensorInfoCmd) Operation

func (*GetDCMISensorInfoCmd) Operation() *ipmi.Operation

func (*GetDCMISensorInfoCmd) Request

func (*GetDCMISensorInfoCmd) Response

type GetDCMISensorInfoReq

type GetDCMISensorInfoReq struct {
	layers.BaseLayer

	// Type is the kind of thing we are interested in finding sensors for. As of
	// DCMI v1.5, the only valid value here is temperature (0x01).
	Type ipmi.SensorType

	// Entity is the type of component we are interested in. As of DCMI v1.5,
	// this is inlet, CPU or baseboard temperature. In v1.0 and v1.1, 0x40, 0x41
	// and 0x42 respectively were used to refer to these, however v1.5
	// recommends using the IPMI entity IDs: 0x37, 0x03 and 0x07 respectively.
	// DCMI v1.5 promises to map the DCMI values to their IPMI equivalents,
	// encouraging use of the latter. In practice, try the IPMI entities first,
	// falling back on the DCMI ones if there is an empty response.
	Entity ipmi.EntityID

	// Instance specifies the instance of the SDR to retrieve. 0x00 indicates to
	// retrieve all instance associated with the entity.
	Instance ipmi.EntityInstance

	// InstanceStart is for use when Instance is 0x00. It is intended for when
	// there are >8 instances of a particular sensor, so they cannot all be
	// returned in a single response. This can be used to offset the start
	// record ID. It looks like the idea is to set this to the highest instance
	// received + 1. Note IPMI makes no guarantees about the instance space,
	// however it seems DCMI instances must be sequential and incrementing.
	InstanceStart uint8
}

GetDCMISensorInfoReq represents the Get DCMI Sensor Info command, specified in 6.5.2 of DCMI v1.0, v1.1 and v1.5. This command is used to help system management software find sensors monitoring specific things the DCMI authors believe are particularly pertinent, that are difficult to identify using IPMI alone. Note, even though read-only, this has a minimum privilege level of Operator.

func (*GetDCMISensorInfoReq) LayerType

func (*GetDCMISensorInfoReq) SerializeTo

type GetDCMISensorInfoRsp

type GetDCMISensorInfoRsp struct {
	layers.BaseLayer

	// Instances gives the total number of instances of the requested entity. If
	// this is greater than the number of record IDs returned (and Instance was
	// not specified in the request), it is an invitation to issue a new request
	// with InstanceStart set.
	Instances uint8

	// RecordIDs contains the record IDs returned by the BMC. In DCMI v1.1 and
	// v1.5, these may include SDRs for both the DCMI and IPMI entities.
	RecordIDs []ipmi.RecordID
}

GetDCMISensorInfoRsp represents the BMC's response to a Get DCMI Sensor Info request. It is specified in 6.5.2 of DCMI v1.0, v1.1 and v1.5.

func (*GetDCMISensorInfoRsp) CanDecode

func (g *GetDCMISensorInfoRsp) CanDecode() gopacket.LayerClass

func (*GetDCMISensorInfoRsp) DecodeFromBytes

func (g *GetDCMISensorInfoRsp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*GetDCMISensorInfoRsp) LayerType

func (*GetDCMISensorInfoRsp) NextLayerType

func (*GetDCMISensorInfoRsp) NextLayerType() gopacket.LayerType

type GetPowerReadingCmd

type GetPowerReadingCmd struct {
	Req GetPowerReadingReq
	Rsp GetPowerReadingRsp
}

func (*GetPowerReadingCmd) Name

func (*GetPowerReadingCmd) Name() string

Name returns "Get Power Reading".

func (*GetPowerReadingCmd) Operation

func (*GetPowerReadingCmd) Operation() *ipmi.Operation

func (*GetPowerReadingCmd) Request

func (*GetPowerReadingCmd) Response

type GetPowerReadingReq

type GetPowerReadingReq struct {
	layers.BaseLayer

	// Mode indicates whether enhanced system power statistics are desired. Must
	// be SystemPowerStatisticsModeNormal for v1.0, in which case the BMC is in
	// control over the statistics reporting time period.
	Mode SystemPowerStatisticsMode

	// If Mode is SystemPowerStatisticsModeEnhanced, the rolling average time
	// period over which to retrieve statistics. Note that this cannot be
	// arbitrary - only a period returned in the PowerRollingAvgTimePeriods
	// field of Get DCMI Capabilities Info response can be used. If scraping the
	// power reading, this should be equal to the scrape interval.
	Period time.Duration
}

GetPowerReadingReq implements the Get Power Reading command, specified in 6.6.1.

func (*GetPowerReadingReq) LayerType

func (*GetPowerReadingReq) LayerType() gopacket.LayerType

func (*GetPowerReadingReq) SerializeTo

type GetPowerReadingRsp

type GetPowerReadingRsp struct {
	layers.BaseLayer

	// Instantaneous gives the current power consumption in watts.
	Instantaneous uint16

	// Min gives the minimum power over the period in watts.
	Min uint16

	// Max gives the maximum power over the period in watts.
	Max uint16

	// Avg gives the average power over the period in watts.
	Avg uint16

	// Timestamp indicates when the power readings are for. If using enhanced
	// power statistics, this is the end of the averaging window.
	Timestamp time.Time

	// Period is the sampling period over which the controller is reporting
	// statistics. If SystemPowerStatisticsModeEnhanced was used, this will
	// equal the duration requested, otherwise it is up the the BMC.
	Period time.Duration

	// Active indicates whether power measurement is currently active.
	Active bool
}

GetPowerReadingRsp represents the response to a Get Power Reading command, specified in 6.6.1. Be wary of interpreting this response without checking the timestamp and period (especially the latter if not using enhanced mode, where the remote console is in control of the period).

func (*GetPowerReadingRsp) CanDecode

func (g *GetPowerReadingRsp) CanDecode() gopacket.LayerClass

func (*GetPowerReadingRsp) DecodeFromBytes

func (g *GetPowerReadingRsp) DecodeFromBytes(data []byte, df gopacket.DecodeFeedback) error

func (*GetPowerReadingRsp) LayerType

func (*GetPowerReadingRsp) LayerType() gopacket.LayerType

func (*GetPowerReadingRsp) NextLayerType

func (*GetPowerReadingRsp) NextLayerType() gopacket.LayerType

type SensorInfo

type SensorInfo struct {
	Inlet     []ipmi.RecordID
	CPU       []ipmi.RecordID
	Baseboard []ipmi.RecordID
}

SensorInfo models the exhaustive result of the Get DCMI Sensor Info command, obtained through calling it possibly multiple times to enumerate all instances. Fields correspond to entity IDs defined in Table 6-6, 6-8 and 6-14 of DCMI v1.0, v1.1 and v1.5 respectively.

func GetSensorInfo

func GetSensorInfo(ctx context.Context, s bmc.Session) (*SensorInfo, error)

GetSensorInfo retrieves the RecordIDs of all inlet, CPU and baseboard temperatures for a system. It is an abstraction over Get DCMI Sensor Info, handling the case where the BMC cares about IPMI vs. DCMI entity IDs, and the case where there are >8 sensors, so the command has to be invoked many times. For practical use, this should always be preferred to calling Get DCMI Sensor Info manually. To avoid duplicate sensors, this method will only return either sensors obtained by passing IPMI EntityIDs, or those obtained by passing DCMI EntityIDs - never an intersection of the two.

type SessionCommands

type SessionCommands interface {
	SessionlessCommands

	GetPowerReading(context.Context, *GetPowerReadingReq) (*GetPowerReadingRsp, error)

	GetDCMISensorInfo(context.Context, *GetDCMISensorInfoReq) (*GetDCMISensorInfoRsp, error)
}

SessionCommands represents the high-level API for commands that can be executed within a session.

func NewSessionCommander

func NewSessionCommander(s bmc.Session) SessionCommands

NewSessionCommander wraps a session-based connection in a context that provides high-level access to DCMI commands. For convenience, this function accepts the Session interface, however DCMI is unlikely to work over IPMI v1.5. When sending repeated commands, it is recommended to use the SendCommand() method on the connection directly to reduce the number of allocations.

type SessionlessCommands

type SessionlessCommands interface {
	GetDCMICapabilitiesInfoSupportedCapabilities(context.Context) (*GetDCMICapabilitiesInfoSupportedCapabilitiesRsp, error)
	GetDCMICapabilitiesInfoMandatoryPlatformAttrs(context.Context) (*GetDCMICapabilitiesInfoMandatoryPlatformAttrsRsp, error)
	GetDCMICapabilitiesInfoOptionalPlatformAttrs(context.Context) (*GetDCMICapabilitiesInfoOptionalPlatformAttrsRsp, error)
	GetDCMICapabilitiesInfoManageabilityAccessAttrs(context.Context) (*GetDCMICapabilitiesInfoManageabilityAccessAttrsRsp, error)
	GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrs(context.Context) (*GetDCMICapabilitiesInfoEnhancedSystemPowerStatisticsAttrsRsp, error)
}

SessionlessCommands contains the high-level API for commands that can be executed outside the context of a session.

func NewSessionlessCommander

func NewSessionlessCommander(s bmc.Sessionless) SessionlessCommands

NewSessionlessCommander wraps a session-less connection in a context that provides high-level access to DCMI commands. For convenience, this function accepts the Sessionless interface, however DCMI is unlikely to work over IPMI v1.5. When sending repeated commands, it is recommended to use the SendCommand() method on the connection directly to reduce the number of allocations.

type SystemPowerStatisticsMode

type SystemPowerStatisticsMode uint8

SystemPowerStatisticsMode represents whether enhanced system power statistics are in use.

const (
	// SystemPowerStatisticsModeNormal means no rolling average time period can
	// be specified in the Get Power Reading command. This is the only option
	// supported by v1.0.
	SystemPowerStatisticsModeNormal SystemPowerStatisticsMode = 0x01

	// SystemPowerStatisticsModeEnhanced means one of the rolling average time
	// periods returned in the Get DCMI Capabilities Info response can be sent
	// to the BMC, and the corresponding readings will be returned. This is less
	// useful when constantly polling BMCs for the current reading.
	SystemPowerStatisticsModeEnhanced SystemPowerStatisticsMode = 0x02
)

func (SystemPowerStatisticsMode) Description

func (s SystemPowerStatisticsMode) Description() string

Description returns a human-friendly name for the mode.

func (SystemPowerStatisticsMode) String

func (s SystemPowerStatisticsMode) String() string

Jump to

Keyboard shortcuts

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