Skip to content

Commit

Permalink
internal/model: Add Action, Step types and related methods
Browse files Browse the repository at this point in the history
This change adds the Steps object to replace the stateswitch.Transition*
types. It also adds struct tags for all the fields so they can be
serialized to be stored in the KV.

Moves DeviceQueryor interface into its own package for easier import
without conflicts.
  • Loading branch information
joelrebel committed Apr 26, 2024
1 parent 69e5c5d commit acec76c
Show file tree
Hide file tree
Showing 10 changed files with 1,147 additions and 200 deletions.
45 changes: 45 additions & 0 deletions internal/device/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package device

import (
"context"
"os"

"github.com/bmc-toolbox/common"

bconsts "github.com/bmc-toolbox/bmclib/v2/constants"
)

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

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

// Close closes the connection to the device.
Close(ctx context.Context) error

PowerStatus(ctx context.Context) (status string, err error)

SetPowerState(ctx context.Context, state string) error

ResetBMC(ctx context.Context) error

// Reinitializes the underlying device queryor client to purge old session information.
ReinitializeClient(ctx context.Context)

// Inventory returns the device inventory
Inventory(ctx context.Context) (*common.Device, error)

FirmwareInstallSteps(ctx context.Context, component string) ([]bconsts.FirmwareInstallStep, error)

FirmwareUpload(ctx context.Context, component string, reader *os.File) (uploadVerifyTaskID string, err error)

FirmwareTaskStatus(ctx context.Context, kind bconsts.FirmwareInstallStep, component, taskID, installVersion string) (state bconsts.TaskState, status string, err error)

FirmwareInstallUploaded(ctx context.Context, component, uploadVerifyTaskID string) (installTaskID string, err error)

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

0 comments on commit acec76c

Please sign in to comment.