api

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: AGPL-3.0 Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	VagrantBoard = &Board{
		VM:           true,
		VendorString: "vagrant",
		Vendor:       VendorVagrant,
		Model:        "vagrant",
		PartNumber:   "vagrant",
		SerialNumber: "vagrant",
		BiosVersion:  "0",
		BMC: &BMC{
			IP:                  "1.1.1.1",
			MAC:                 "aa:bb:cc:dd:ee:ff",
			ChassisPartNumber:   "vagrant",
			ChassisPartSerial:   "vagrant",
			BoardMfg:            "vagrant",
			BoardMfgSerial:      "vagrant",
			BoardPartNumber:     "vagrant",
			ProductManufacturer: "vagrant",
			ProductPartNumber:   "vagrant",
			ProductSerial:       "vagrant",
			FirmwareRevision:    "vagrant",
		},
		BIOS: &BIOS{
			Version: "0",
			Vendor:  "vagrant",
			Date:    "01/01/2020",
		},
		Firmware: 0,
	}
)

Functions

This section is empty.

Types

type BIOS

type BIOS struct {
	Version string
	Vendor  string
	Date    string
}

BIOS information of this machine

func (*BIOS) String

func (b *BIOS) String() string

type BMC

type BMC struct {
	IP                  string
	MAC                 string
	ChassisPartNumber   string
	ChassisPartSerial   string
	BoardMfg            string
	BoardMfgSerial      string
	BoardPartNumber     string
	ProductManufacturer string
	ProductPartNumber   string
	ProductSerial       string
	FirmwareRevision    string `ipmitool:"Firmware Revision"`
}

BMC Base Management Controller details

type BMCConnection added in v0.2.0

type BMCConnection interface {
	// BMC returns the actual BMC details
	BMC() (*BMC, error)
	// PresentSuperUser returns the details of the already present bmc superuser
	PresentSuperUser() BMCUser
	// SuperUser returns the details of the preset metal bmc superuser
	SuperUser() BMCUser
	// User returns the details of the preset metal bmc user
	User() BMCUser
	// Present returns true if the InBand Connection found a usable BMC device
	Present() bool
	// Creates the given BMC user and returns generated password
	CreateUserAndPassword(user BMCUser, privilege IpmiPrivilege) (string, error)
	// Creates the given BMC user with the given password
	CreateUser(user BMCUser, privilege IpmiPrivilege, password string) error
	// Changes the password of the given BMC user
	ChangePassword(user BMCUser, newPassword string) error
	// Enables/Disables the given BMC user
	SetUserEnabled(user BMCUser, enabled bool) error
}

BMCConnection offers methods to add/update BMC users and retrieve BMC details

type BMCUser added in v0.2.0

type BMCUser struct {
	Name          string
	Id            string
	ChannelNumber int
}

BMCUser holds BMC user details

type Board

type Board struct {
	VM            bool
	VendorString  string
	Vendor        Vendor
	Model         string
	PartNumber    string
	SerialNumber  string
	BiosVersion   string
	BMC           *BMC
	BIOS          *BIOS
	Firmware      kernel.FirmwareMode
	IndicatorLED  string
	PowerMetric   *PowerMetric
	PowerSupplies []PowerSupply
}

Board raw dmi board information

func (*Board) String

func (b *Board) String() string

type IpmiPrivilege added in v0.1.2

type IpmiPrivilege = uint8

Privilege of an IPMI user

const (
	// Callback IPMI privilege
	CallbackPrivilege IpmiPrivilege = iota + 1
	// User IPMI privilege
	UserPrivilege
	// Operator IPMI privilege
	OperatorPrivilege
	// Administrator IPMI privilege
	AdministratorPrivilege
	// OEM IPMI privilege
	OEMPrivilege
	// NoAccess IPMI privilege
	NoAccessPrivilege
)

type OutBandBMCConnection added in v0.2.0

type OutBandBMCConnection interface {
	// BMC returns the actual BMC details
	BMC() (*BMC, error)
}

OutBandBMCConnection offers a method to retrieve BMC details

type PasswordConstraints added in v0.1.8

type PasswordConstraints struct {
	Length      int
	NumDigits   int
	NumSymbols  int
	NoUpper     bool
	AllowRepeat bool
}

PasswordConstraints holds the constraints that are ensured for generated passwords

type PowerMetric added in v0.4.3

type PowerMetric struct {
	// AverageConsumedWatts shall represent the
	// average power level that occurred averaged over the last IntervalInMin
	// minutes.
	AverageConsumedWatts float32
	// IntervalInMin shall represent the time
	// interval (or window), in minutes, in which the PowerMetrics properties
	// are measured over.
	// Should be an integer, but some Dell implementations return as a float.
	IntervalInMin float32
	// MaxConsumedWatts shall represent the
	// maximum power level in watts that occurred within the last
	// IntervalInMin minutes.
	MaxConsumedWatts float32
	// MinConsumedWatts shall represent the
	// minimum power level in watts that occurred within the last
	// IntervalInMin minutes.
	MinConsumedWatts float32
}

type PowerSupply added in v0.5.5

type PowerSupply struct {
	// Status shall contain any status or health properties
	// of the resource.
	Status Status
}

type Status added in v0.5.5

type Status struct {
	Health string
	State  string
}

type Vendor

type Vendor int

Vendor identifies different server vendors

const (
	// VendorUnknown is a unknown Vendor
	VendorUnknown Vendor = iota
	// VendorSupermicro identifies all Supermicro servers
	VendorSupermicro
	// VendorNovarion identifies all Novarion servers
	VendorNovarion
	// VendorLenovo identifies all Lenovo servers
	VendorLenovo
	// VendorDell identifies all Dell servers
	VendorDell
	// VendorVagrant is a virtual machine.
	VendorVagrant
)

func GuessVendor

func GuessVendor(vendor string) Vendor

GuessVendor will try to guess from vendor string

func (Vendor) PasswordConstraints added in v0.2.0

func (v Vendor) PasswordConstraints() *PasswordConstraints

func (Vendor) String

func (v Vendor) String() string

Jump to

Keyboard shortcuts

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