bmclib

package module
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 14 Imported by: 2

README

bmclib - board management controller library

Status Go Report Card GoDoc Development/Support

A library to interact with BMCs of different vendors

Data collection support

Hardware Supported Partially Supported
Dell M1000e
Dell iDRAC8
Dell iDRAC9
HP c7000
HP iLO3
HP iLO4
HP iLO5
Supermicro X10
Supermicro X11

Firmware update support

Hardware Supported
Dell M1000e
Dell iDRAC8
Dell iDRAC9
HP c7000
HP iLO2
HP iLO3
HP iLO4
HP iLO5
Supermicro X9
Supermicro X10
Supermicro X11

Configuration support

Hardware User accounts Syslog NTP SNMP Ldap Ldap groups BIOS HTTPS Cert
Dell M1000e -
Dell iDRAC8
Dell iDRAC9
HP c7000 -
HP iLO4
HP iLO5
Supermicro X10
Supermicro X11

Debugging

export BMCLIB_LOG_LEVEL=debug for bmclib to debug log

export BMCLIB_LOG_LEVEL=trace for bmclib to trace log

export BMCLIB_TEST=1 to run on a dummy bmc (dry run).

bmc-toolbox

All of the tooling that uses bmclib is part of the bmc-toolbox

Inventory collection

dora uses bmclib to identify and inventorize assets.

Configuration

bmcbutler uses bmclib to manage configuration on BMCs.

Web API

actor uses bmclib to abstract away various BMCs and expose a consistent web API to interact with them.

Acknowledgment

bmclib was originally developed for Booking.com. With approval from Booking.com, the code and specification were generalized and published as Open Source on github, for which the authors would like to express their gratitude.

bmclib interfaces with Redfish with https://github.com/stmcginnis/gofish

Authors
  • Juliano Martinez
  • Joel Rebello
  • Guilherme M. Schroeder
  • Mariano Guezuraga

Documentation

Overview

Package bmclib client.go is intended to be the main public API. Its purpose is to make interacting with bmclib as friendly as possible.

Package bmclib abstracts various vendor/models of Baseboard Management controllers.

ENV vars ======== export DEBUG_BMCLIB=1 for bmclib to verbose log export BMCLIB_TEST=1 to run on a dummy bmc (dry run).

Scan and connect ----------------

Connect to a BMC - "discover" its model, vendor, for list of supported BMCs see README.md.

connection, err = discover.ScanAndConnect(ip, user, pass)
if err != nil {
	return connection, errors.New("ScanAndConnect attempt unsuccessful.")
}

Once a connection is setup, the connection needs to be type asserted, to either a 'Bmc' or 'BmcChassis'.

switch connection.(type) {
case devices.Bmc:
	bmc := connection.(devices.Bmc)

	// invoke Bmc interface methods here
	...

	bmc.Close()
case devices.BmcChassis:
	chassis := connection.(devices.BmcChassis)

	// invoke BmcChassis interface methods here
	...

	chassis.Close()
default:
	log.Error("Unknown device")
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Host string
	Port string
	User string
	Pass string
}

Auth details for connecting to a BMC

type Client

type Client struct {
	Auth     Auth
	Logger   logr.Logger
	Registry *registrar.Registry
	// contains filtered or unexported fields
}

Client for BMC interactions

func NewClient

func NewClient(host, port, user, pass string, opts ...Option) *Client

NewClient returns a new Client struct

func (*Client) Close added in v0.4.8

func (c *Client) Close(ctx context.Context) (err error)

Close pass through to library function

func (*Client) CreateUser

func (c *Client) CreateUser(ctx context.Context, user, pass, role string) (ok bool, err error)

CreateUser pass through to library function

func (*Client) DeleteUser

func (c *Client) DeleteUser(ctx context.Context, user string) (ok bool, err error)

DeleteUser pass through to library function

func (*Client) FirmwareInstall added in v0.5.3

func (c *Client) FirmwareInstall(ctx context.Context, component, applyAt string, forceInstall bool, reader io.Reader) (taskID string, err error)

FirmwareInstall pass through library function to upload firmware and install firmware

func (*Client) FirmwareInstallStatus added in v0.5.3

func (c *Client) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error)

FirmwareInstallStatus pass through library function to check firmware install status

func (*Client) GetMetadata added in v0.4.12

func (c *Client) GetMetadata() bmc.Metadata

GetMetadata returns the metadata that is populated after each BMC function/method call

func (*Client) GetPowerState

func (c *Client) GetPowerState(ctx context.Context) (state string, err error)

GetPowerState pass through to library function

func (*Client) Inventory added in v0.5.3

func (c *Client) Inventory(ctx context.Context) (device *devices.Device, err error)

Inventory pass through library function to collect hardware and firmware inventory

func (*Client) Open added in v0.4.8

func (c *Client) Open(ctx context.Context) error

Open calls the OpenConnectionFromInterfaces library function Any providers/drivers that do not successfully connect are removed from the client.Registry.Drivers. If client.Registry.Drivers ends up being empty then we error.

func (*Client) PostCode added in v0.5.3

func (c *Client) PostCode(ctx context.Context) (status string, code int, err error)

PostCodeGetter pass through library function to return the BIOS/UEFI POST code

func (*Client) ReadUsers

func (c *Client) ReadUsers(ctx context.Context) (users []map[string]string, err error)

ReadUsers pass through to library function

func (*Client) ResetBMC

func (c *Client) ResetBMC(ctx context.Context, resetType string) (ok bool, err error)

ResetBMC pass through to library function

func (*Client) SetBootDevice

func (c *Client) SetBootDevice(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)

SetBootDevice pass through to library function

func (*Client) SetPowerState

func (c *Client) SetPowerState(ctx context.Context, state string) (ok bool, err error)

SetPowerState pass through to library function

func (*Client) UpdateUser

func (c *Client) UpdateUser(ctx context.Context, user, pass, role string) (ok bool, err error)

UpdateUser pass through to library function

type Option

type Option func(*Client)

Option for setting optional Client values

func WithHTTPClient added in v0.5.3

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets an http client

func WithLogger

func WithLogger(logger logr.Logger) Option

WithLogger sets the logger

func WithRegistry

func WithRegistry(registry *registrar.Registry) Option

WithRegistry sets the Registry

func WithSecureTLS added in v0.5.3

func WithSecureTLS(rootCAs *x509.CertPool) Option

WithSecureTLS enforces trusted TLS connections, with an optional CA certificate pool. Using this option with an nil pool uses the system CAs.

Directories

Path Synopsis
examples
v1/create-users
create-users is an example commmand that utilizes the 'v1' bmclib interface methods to create user entries in a BMC using the redfish driver.
create-users is an example commmand that utilizes the 'v1' bmclib interface methods to create user entries in a BMC using the redfish driver.
v1/install-firmware
install-firmware is an example commmand that utilizes the 'v1' bmclib interface methods to flash a firmware image to a BMC.
install-firmware is an example commmand that utilizes the 'v1' bmclib interface methods to flash a firmware image to a BMC.
v1/inventory
inventory is an example commmand that utilizes the 'v1' bmclib interface methods to gather inventory from a BMC using the redfish driver.
inventory is an example commmand that utilizes the 'v1' bmclib interface methods to gather inventory from a BMC using the redfish driver.
v1/status
status is an example commmand that utilizes the 'v1' bmclib interface methods to gather the BMC version, power state, and bios version from a BMC using the redfish driver.
status is an example commmand that utilizes the 'v1' bmclib interface methods to gather the BMC version, power state, and bios version from a BMC using the redfish driver.
hp

Jump to

Keyboard shortcuts

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