How BMC drivers and connections work
mainbmclib uses multiple drivers to interact with BMCs. Drivers represent different services exposed by a BMC, such as redfish, IPMI, SSH, or a vendor API.
The bmclib.Client automatically determines which driver to use for an action (e.g., Power cycle or Create user) based on driver availability or through a compatibility test. You can manually control driver selection by modifying the client.Registry.Drivers list.
// Query just using the redfish endpoint
cl := bmclib.NewClient("192.168.1.1", "admin", "hunter2")
cl.Registry.Drivers = cl.Registry.Using("redfish")
// Query using redfish and fall back to IPMI
client := bmclib.NewClient("192.168.1.1", "admin", "hunter2")
drivers := append(registrar.Drivers{}, bmcClient.Registry.Using("redfish")...)
drivers = append(drivers, bmcClient.Registry.Using("ipmi")...)
client.Registry.Drivers = drivers
// Filter drivers based on compatibility
client.Registry.Drivers = cl.Registry.FilterForCompatible(ctx)