bmclib

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: Apache-2.0 Imports: 6 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 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.

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

Documentation

Overview

Package bmclib client.go is intended to be the main the 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
}

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) GetPowerState

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

GetPowerState pass through to library function

func (*Client) Open added in v0.4.8

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

Open pass through to library function

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 WithLogger

func WithLogger(logger logr.Logger) Option

WithLogger sets the logger

func WithRegistry

func WithRegistry(registry *registrar.Registry) Option

WithRegistry sets the Registry

Jump to

Keyboard shortcuts

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