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 ¶
- type Auth
- type Client
- func (c *Client) Close(ctx context.Context) (err error)
- func (c *Client) CreateUser(ctx context.Context, user, pass, role string) (ok bool, err error)
- func (c *Client) DeleteUser(ctx context.Context, user string) (ok bool, err error)
- func (c *Client) FirmwareInstall(ctx context.Context, component, applyAt string, forceInstall bool, ...) (taskID string, err error)
- func (c *Client) FirmwareInstallStatus(ctx context.Context, installVersion, component, taskID string) (status string, err error)
- func (c *Client) GetMetadata() bmc.Metadata
- func (c *Client) GetPowerState(ctx context.Context) (state string, err error)
- func (c *Client) Inventory(ctx context.Context) (device *devices.Device, err error)
- func (c *Client) Open(ctx context.Context) error
- func (c *Client) PostCode(ctx context.Context) (status string, code int, err error)
- func (c *Client) ReadUsers(ctx context.Context) (users []map[string]string, err error)
- func (c *Client) ResetBMC(ctx context.Context, resetType string) (ok bool, err error)
- func (c *Client) SetBootDevice(ctx context.Context, bootDevice string, setPersistent, efiBoot bool) (ok bool, err error)
- func (c *Client) SetPowerState(ctx context.Context, state string) (ok bool, err error)
- func (c *Client) UpdateUser(ctx context.Context, user, pass, role string) (ok bool, err error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Auth Auth Logger logr.Logger Registry *registrar.Registry // contains filtered or unexported fields }
Client for BMC interactions
func (*Client) CreateUser ¶
CreateUser pass through to library function
func (*Client) DeleteUser ¶
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
GetMetadata returns the metadata that is populated after each BMC function/method call
func (*Client) GetPowerState ¶
GetPowerState pass through to library function
func (*Client) Inventory ¶ added in v0.5.3
Inventory pass through library function to collect hardware and firmware inventory
func (*Client) Open ¶ added in v0.4.8
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
PostCodeGetter pass through library function to return the BIOS/UEFI POST code
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 ¶
SetPowerState pass through to library function
type Option ¶
type Option func(*Client)
Option for setting optional Client values
func WithHTTPClient ¶ added in v0.5.3
WithHTTPClient sets an http client
func WithRegistry ¶
WithRegistry sets the Registry
func WithSecureTLS ¶ added in v0.5.3
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. |