ipmi

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Command is the ipmi cli to execute
	Command = command.IPMITool
	// Callback ipmi privilege
	Callback = Privilege(1)
	// User ipmi privilege
	User = Privilege(2)
	// Operator ipmi privilege
	Operator = Privilege(3)
	// Administrator ipmi privilege
	Administrator = Privilege(4)
	// OEM ipmi privilege
	OEM = Privilege(5)
	// NoAccess ipmi privilege
	NoAccess = Privilege(15)
)
View Source
const (
	// PXE boot server via PXE
	PXE = Bootdev("pxe")
	// Disk boot server from hard disk
	Disk = Bootdev("disk")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BMCInfo

type BMCInfo struct {
	// # ipmitool bmc info
	// Device ID                 : 32
	// Device Revision           : 1
	// Firmware Revision         : 1.64
	// IPMI Version              : 2.0
	// Manufacturer ID           : 10876
	// Manufacturer Name         : Supermicro
	// Product ID                : 2402 (0x0962)
	// Product Name              : Unknown (0x962)
	// Device Available          : yes
	// Provides Device SDRs      : no
	// Additional Device Support :
	FirmwareRevision string `ipmitool:"Firmware Revision"`
}

BMCInfo contains the parsed output of ipmitool bmc info

type Bootdev

type Bootdev string

Bootdev specifies from which device to boot

type Fru

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

Fru contains Field Replacable Unit information, retrieved with ipmitool fru

type Ipmi

type Ipmi interface {
	DevicePresent() bool
	Run(arg ...string) (string, error)
	CreateUser(username, uid string, privilege Privilege) (string, error)
	GetLanConfig() (LanConfig, error)
	EnableUEFI(bootdev Bootdev, persistent bool) error
	GetFru() (Fru, error)
	GetSession() (Session, error)
	GetBMCInfo() (BMCInfo, error)
}

Ipmi defines methods to interact with ipmi

func New

func New() Ipmi

New create a new Ipmitool with the default command

type Ipmitool

type Ipmitool struct {
	Command string
}

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

func (*Ipmitool) CreateUser

func (i *Ipmitool) CreateUser(username, uid string, privilege Privilege) (string, error)

CreateUser create a ipmi user with password and privilege level

func (*Ipmitool) DevicePresent

func (i *Ipmitool) DevicePresent() bool

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

func (*Ipmitool) EnableUEFI

func (i *Ipmitool) EnableUEFI(bootdev Bootdev, persistent bool) error

EnableUEFI set the firmware to boot with uefi for given bootdev, bootdev can be one of pxe|disk if persistent is set to true this will last for every subsequent boot, not only the next.

func (*Ipmitool) GetBMCInfo

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

GetBMCInfo returns the bmc info

func (*Ipmitool) GetFru

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

GetFru returns the Field Replacable Unit information

func (*Ipmitool) GetLanConfig

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

GetLanConfig returns the LanConfig

func (*Ipmitool) GetSession

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

GetSession returns the Session info

func (*Ipmitool) Run

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

Run execute ipmitool

type LanConfig

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

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

func (*LanConfig) String

func (l *LanConfig) String() string

type Privilege

type Privilege int

Privilege of a ipmitool user

type Session

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

Session information of the current ipmi session

Jump to

Keyboard shortcuts

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