hostinfo

package
v0.0.0-...-cd06882 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2025 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package hostinfo provides support for Autotest's serialized hostinfo data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(hi *HostInfo) ([]byte, error)

Marshal serializes the HostInfo struct into a slice of bytes.

func MarshalIndent

func MarshalIndent(hi *HostInfo) ([]byte, error)

MarshalIndent serializes the HostInfo struct into a slice of bytes. The prefix and indent options of json.MarshalIndent are not exposed to the user because You Don't Need Them.

func RevertDut

func RevertDut(d *inventory.DeviceUnderTest, hi *HostInfo)

RevertDut reverts the Autotest hostinfo back to an inventory DUT struct.

Types

type AdminClient

type AdminClient interface {
	GetRecoveryVersion(ctx context.Context, in *fleet.GetRecoveryVersionRequest, opts ...grpc.CallOption) (*fleet.GetRecoveryVersionResponse, error)
}

AdminClient is a client that knows how to respond to the GetStableVersion RPC call. Its prototypical implementation is fleet.InventoryClient.

type Getter

type Getter struct {
	// contains filtered or unexported fields
}

Getter is a container for the clients needed to construct the host_info_store contents for a given hostname.

func NewGetter

func NewGetter(
	ic InventoryClient,
	ac AdminClient,
) *Getter

NewGetter constructs a getter in the default configuration.

func (*Getter) GetContentsForHostname

func (g *Getter) GetContentsForHostname(ctx context.Context, hostname string) (string, error)

GetContentsForHostname gets the entire hostinfostore file contents for a given hostname as a string.

func (*Getter) GetStableVersion

func (g *Getter) GetStableVersion(ctx context.Context, deviceType, hostname, board, model string, pools []string) (*lab_platform.StableVersion, error)

GetStableVersion gets the stable version info.

type HostInfo

type HostInfo struct {
	Labels         []string          `json:"labels"`
	Attributes     map[string]string `json:"attributes"`
	StableVersions map[string]string `json:"stable_versions"`
}

HostInfo stores the host information. Hostinfo files are used to pass host information to Autotest and receive host information changes from Autotest.

func ConvertDut

func ConvertDut(d *inventory.DeviceUnderTest) *HostInfo

ConvertDut converts the inventory DUT struct to Autotest hostinfo.

func Unmarshal

func Unmarshal(blob []byte) (*HostInfo, error)

Unmarshal deserializes a HostInfo struct from a slice of bytes. Unmarshal accepts a serialized HostInfo or serialized versionedHostInfo it always ignores all version information

type InventoryClient

type InventoryClient interface {
	GetChromeOSDeviceData(context.Context, *ufsAPI.GetChromeOSDeviceDataRequest, ...grpc.CallOption) (*models.ChromeOSDeviceData, error)
}

InventoryClient is a client that knows how to resolve a ChromeosDeviceDataRequest contains hostname to ChromeOSDeviceData that contains information about the DUT V1.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL