Commit Graph

13 Commits

Author SHA1 Message Date
Jacob Weinstock
a24f9330ff Merge from master, fix metadata;
metadata was returning duplicates. This commit
fixes that.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-03-25 13:55:11 -06:00
Jacob Weinstock
8adfe3736c Update OpenConnectionFromInterfaces to remove failed opens:
Currently, if an implementation that opens a stateful session
in its Opener implementation fails when open is called and then
has a method called, for example, PowerStateGet, that needs to
use the session info, we will get a panic.

This code updates the OpenConnectionFromInterfaces to remove any
provider implementations that fails to open successfully.
We do this and then return a new registrar.Drivers from the Open
method in client.go.

This changes the existing client.go Open method signature.
Returning the registrar.Drivers instead of updating in place I
think is important. We don't want to hide the "magic" because
this can be confusing about why/which providers are being removed.
It also allows the end-user to have flexibility in deciding
if/when to use this newly updated registrar.Drivers.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-03-25 13:55:11 -06:00
Jacob Weinstock
1623f627ce Add metadata to opener/closer interfaces:
Updates metadata with open/close providers attempted
and successful. Also, cleaned up tests in the bmc package.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-03-24 12:53:53 -06:00
Jacob Weinstock
247171c378 Use metadata struct:
Change the successfulProvider to be the bmc.Metadata
struct. This allows us to grow the metadata we can
provide during a method call.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-03-24 12:53:53 -06:00
Jacob Weinstock
223055a18d Identify the provider that executed successfully:
Without breaking clients, this adds the capability
of relaying to the end-user the name of the provider
that successfully executed. This give info back to
end-users to help if they need to use a certain
provider for certain hardware.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-03-24 12:53:53 -06:00
Jacob Weinstock
062ef08b26 Remove local registry package:
Replace the local registry package with github.com/jacobweinstock/registry
makes the registry much simpler to interact with and
removes the magic of init functions and package-level
variables. Makes registering providers more understandable
through explicit registration.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-01-14 21:05:35 -07:00
Jacob Weinstock
bb372afbe8 Add DiscoverCompatible:
This is the update to ScanAndDiscover for the registry.
It will run an "isCompatible" function for all registered
providers to determine if the BMC is compatible with the
provider and then will update the registry collection
with all compatible providers.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-12-16 11:30:49 -07:00
Jacob Weinstock
bc36e3248d Update client to open/close before all actions:
Stateful implementations need connections opened/closed
before/after performing actions.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-12-16 09:07:26 -07:00
Jacob Weinstock
81fc68d8d3 Add PreferProtocol functionality:
Allows ordering the registries based on a list of
prefered protocol types.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-12-04 21:44:34 -07:00
Jacob Weinstock
ce0aecc6bc Add port to registry/client:
Make port first class var.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-12-02 10:41:45 -07:00
Jacob Weinstock
473803a9a1 remove creds
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-12-01 14:12:30 -07:00
Jacob Weinstock
620e2d881c Add discovery functionality:
This function will integrate the ScanAndConnect functionality
to discover and register any providers that are compatible with
the BMC. discover.ScanAndConnect as is doesn't implement any of
the new design interfaces but is here to show a path forward
for how to use the very valuable discovery functionality with
the registry. We'll need to add functionality that will append
to the registry for all providers that are compatible with
a BMC.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-11-30 16:29:12 -07:00
Jacob Weinstock
ce886f1e25 Add client package:
Client package purpose is to be the primary
interaction that a bmclib user would use. It interacts
with the registry to initialize registered providers
with auth and then has pass through functions to call
the interface executor functions.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2020-11-30 16:05:25 -07:00