Commit Graph

22 Commits

Author SHA1 Message Date
Jacob Weinstock
d034c23f1b Add defaultTimeout test and FilterForCompatible func comment.
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2023-03-09 08:00:19 -07:00
Jacob Weinstock
8d86381ad7 Add test back
Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2023-03-09 07:36:30 -07:00
Jacob Weinstock
b7858cd07f Add per provider timeouts for all methods:
This expands the timeout for opening connections
to all method/BMC interactions.

If a context with a timeout IS provided to a method call
but no per provider timeout is defined, then we default to a
timeout of the provided timeout duration divided by the
number of providers/drivers in the Client.Registry.Drivers
slice.

If a context with a timeout IS NOT provided to a method call
and no per provider timeout is defined, then we use the
defaultConnectTimeout of 30 seconds.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2023-03-09 07:32:08 -07:00
Joel Rebello
cb259307ad
client: additional parameter for connection timeouts
The context deadline timeout value is shared between all the bmclib providers
that is - when creating an a new connection/session on a BMC. The shared timeout value
entails that a single provider can consume the whole timeout value depending on how long
it takes to respond, thus leaving the other providers with no chance to connect.

 WithConnectTimeout sets the timeout when connecting to a BMC to create a new session.
When not defined the deadline value passed in through the context applies.

This timeout value will best work when its lesser than the passed in context deadline value.
2023-03-08 21:42:59 +01:00
Joel Rebello
ebd47f334c
redfish: adds an optional client parameter to specify incompatible Redfish versions
This enables the client to optionally define Redfish versions its not compatible
with, giving the user the option to ignore the Redfish endpoint on BMCs
for cases where the Redfish version is too old or is known to not have
an expected functionality.
2023-01-30 14:11:58 +01:00
Joel Rebello
518a2b0193
client: update imports for v2 2022-07-26 10:56:20 +02:00
Jacob Weinstock
2b17ba7063 Add dell idrac9 implementation for new interfaces:
Adds user crud operations for dell idrac9 to the new
interfaces.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-04-28 14:39:25 -06:00
Jacob Weinstock
11e1044828 Update Client.Open method:
The UX feels unnecessarily verbose/explicit. Most other
libraries that have open/close methods just return an error.
These libraries dont return multiple implementation but with
the ability to get metadata for each Client.X call I dont
think we need to worry about making it that explicit that
we've modified the providers. Open for discussion here, but
putting this in as a PR regardless.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-04-27 16:47:02 -06:00
Jacob Weinstock
d1237f9b73 Update metadata user experience:
After using the metadata for a little, i dont like the
experience. Having to pass in metadata was not easily
understood and was trying to be too clever. This update
will make metadata available for all methods. user just
has to call GetMetadata().

Public API is affected as client will no longer be able
to pass in the &metadata var. Seeing as we are not v1,
i feel comfortable with the change.

Signed-off-by: Jacob Weinstock <jakobweinstock@gmail.com>
2021-04-24 14:02:01 -06:00
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