Skip to content

Commit

Permalink
device/interface: split DeviceQueryor into interfaces for inband and …
Browse files Browse the repository at this point in the history
…oob queries
  • Loading branch information
joelrebel committed Aug 22, 2024
1 parent 207d95a commit d4e045b
Show file tree
Hide file tree
Showing 14 changed files with 924 additions and 701 deletions.
3 changes: 2 additions & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ packages:
fileName: "mock_{{.InterfaceName | firstLower}}.go"
inpackage: true
interfaces:
Queryor:
OutofbandQueryor:
InbandQueryor:
12 changes: 10 additions & 2 deletions internal/device/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"github.com/bmc-toolbox/common"

bconsts "github.com/bmc-toolbox/bmclib/v2/constants"
ironlibm "github.com/metal-toolbox/ironlib/model"
)

//go:generate mockgen -source model.go -destination=../fixtures/mock.go -package=fixtures

// Queryor interface defines methods to query a device.
// QueryorOutofband interface defines the out-of-band methods to query a device.
//
// This is common interface to the ironlib and bmclib libraries.
type Queryor interface {
type OutofbandQueryor interface {
// Open opens the connection to the device.
Open(ctx context.Context) error

Expand Down Expand Up @@ -43,3 +44,10 @@ type Queryor interface {

FirmwareInstallUploadAndInitiate(ctx context.Context, component string, file *os.File) (taskID string, err error)
}

type InbandQueryor interface {
// Inventory returns the device inventory
Inventory(ctx context.Context) (*common.Device, error)
FirmwareInstall(ctx context.Context, component, vendor string, model, version, updateFile string, force bool) error
FirmwareInstallRequirements(ctx context.Context, component, vendor, model string) (*ironlibm.UpdateRequirements, error)
}
211 changes: 211 additions & 0 deletions internal/device/mock_inbandQueryor.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d4e045b

Please sign in to comment.