Documentation ¶
Index ¶
- type Client
- func (c *Client) Close()
- func (c *Client) DeleteRemotePath(ctx context.Context, path string) error
- func (c *Client) DisconnectionListener() <-chan struct{}
- func (c *Client) ExpectDisconnect(ctx context.Context, f func() error) error
- func (c *Client) ExpectReboot(ctx context.Context, f func() error) error
- func (c *Client) GetSSHConnection(ctx context.Context) (string, error)
- func (c *Client) GetSystemImageMerkle(ctx context.Context) (string, error)
- func (c *Client) Name() string
- func (c *Client) Pave(ctx context.Context, build artifacts.Build) error
- func (c *Client) ReadRemotePath(ctx context.Context, path string) ([]byte, error)
- func (c *Client) Reboot(ctx context.Context) error
- func (c *Client) RebootToRecovery(ctx context.Context) error
- func (c *Client) Reconnect(ctx context.Context) error
- func (c *Client) RegisterPackageRepository(ctx context.Context, repo *packages.Server, createRewriteRule bool) error
- func (c *Client) RemoteFileExists(ctx context.Context, path string) (bool, error)
- func (c *Client) Run(ctx context.Context, command []string, stdout io.Writer, stderr io.Writer) error
- func (c *Client) ServePackageRepository(ctx context.Context, repo *packages.Repository, name string, ...) (*packages.Server, error)
- func (c *Client) StartRpcSession(ctx context.Context, repo *packages.Repository) (*sl4f.Client, error)
- func (c *Client) ValidateStaticPackages(ctx context.Context) error
- type ConstantHostResolver
- type DeviceEntry
- type DeviceFinder
- type DeviceFinderMode
- type DeviceFinderResolver
- type DeviceResolver
- type EstimatedMonotonicTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client manages the connection to the device.
func NewClient ¶
func NewClient( ctx context.Context, deviceFinder *DeviceFinder, deviceResolver DeviceResolver, privateKey ssh.Signer, sshConnectBackoff retry.Backoff, workaroundBrokenTimeSkip bool, ) (*Client, error)
NewClient creates a new Client.
func (*Client) DeleteRemotePath ¶
DeleteRemotePath deletes a file off the remote device.
func (*Client) DisconnectionListener ¶
func (c *Client) DisconnectionListener() <-chan struct{}
DisconnectionListener returns a channel that is closed when the client is disconnected.
func (*Client) ExpectDisconnect ¶
func (*Client) ExpectReboot ¶
ExpectReboot prepares a device for a reboot, runs a closure `f` that should reboot the device, then finally verifies whether a reboot actually took place. It does this by writing a unique value to `/tmp/ota_test_should_reboot`, then executing the closure. After we reconnect, we check if `/tmp/ota_test_should_reboot` exists. If not, exit with `nil`. Otherwise, we failed to reboot, or some competing test is also trying to reboot the device. Either way, err out.
func (*Client) GetSSHConnection ¶
func (*Client) GetSystemImageMerkle ¶
func (*Client) Pave ¶
Pave paves the device to the specified build. It assumes the device is already in recovery, since there are multiple ways to get a device into recovery.
func (*Client) ReadRemotePath ¶
ReadRemotePath read a file off the remote device.
func (*Client) Reboot ¶
Reboot asks the device to reboot. It waits until the device reconnects before returning.
func (*Client) RebootToRecovery ¶
RebootToRecovery asks the device to reboot into the recovery partition. It waits until the device disconnects before returning.
func (*Client) RegisterPackageRepository ¶
func (c *Client) RegisterPackageRepository(ctx context.Context, repo *packages.Server, createRewriteRule bool) error
RegisterPackageRepository adds the repository as a repository inside the device.
func (*Client) RemoteFileExists ¶
RemoteFileExists checks if a file exists on the remote device.
func (*Client) Run ¶
func (c *Client) Run(ctx context.Context, command []string, stdout io.Writer, stderr io.Writer) error
Run a command to completion on the remote device and write STDOUT and STDERR to the passed in io.Writers.
func (*Client) ServePackageRepository ¶
func (*Client) StartRpcSession ¶
type ConstantHostResolver ¶
type ConstantHostResolver struct {
// contains filtered or unexported fields
}
ConstnatAddressResolver returns a fixed hostname for the specified nodename.
func NewConstantHostResolver ¶
func NewConstantHostResolver(ctx context.Context, nodeName string, host string) ConstantHostResolver
NewConstantAddressResolver constructs a fixed host.
func (ConstantHostResolver) NodeNames ¶
func (r ConstantHostResolver) NodeNames() []string
func (ConstantHostResolver) ResolveName ¶
func (r ConstantHostResolver) ResolveName(ctx context.Context) (string, error)
type DeviceEntry ¶
DeviceEntry describes the result from `List` and `ListNetboot`.
type DeviceFinder ¶
type DeviceFinder struct {
// contains filtered or unexported fields
}
DeviceFinder wraps the logic around the `device-finder` tool. This tools allows the discovery and resolution of device node names to their IP addresses.
func NewDeviceFinder ¶
func NewDeviceFinder(deviceFinderPath string) *DeviceFinder
NewDeviceFinder constructs a `DeviceFinder` type wrapping the `device-finder` path pointed to by the `deviceFinderPath`.
func (*DeviceFinder) List ¶
func (d *DeviceFinder) List(ctx context.Context, mode DeviceFinderMode, nodeNames ...string) ([]DeviceEntry, error)
List wraps running `device-finder list ...`. This can be filtered down for specific nodenames.
func (*DeviceFinder) Resolve ¶
func (d *DeviceFinder) Resolve(ctx context.Context, mode DeviceFinderMode, nodeNames []string) (DeviceEntry, error)
Resolves nodenames to an IP address.
type DeviceFinderMode ¶
type DeviceFinderMode int
DeviceFinderMode selects the protocol to use to resolve a nodename to an IP Address.
const ( // Mdns uses the mDNS protocol to resolve a nodename to an IP address. Mdns DeviceFinderMode = iota // Netboot uses the netboot protocol to resolve a nodename to an IP address. Netboot )
func (DeviceFinderMode) String ¶
func (m DeviceFinderMode) String() string
type DeviceFinderResolver ¶
type DeviceFinderResolver struct {
// contains filtered or unexported fields
}
DeviceFinderResolver uses `device-finder` to resolve a nodename into a hostname. The logic here should match get-fuchsia-device-addr (//tools/devshell/lib/vars.sh).
func NewDeviceFinderResolver ¶
func NewDeviceFinderResolver(ctx context.Context, deviceFinder *DeviceFinder, nodeName string) (*DeviceFinderResolver, error)
NewDeviceFinderResolver constructs a new `DeviceFinderResolver` for the specific
func (*DeviceFinderResolver) NodeNames ¶
func (r *DeviceFinderResolver) NodeNames() []string
func (*DeviceFinderResolver) ResolveName ¶
func (r *DeviceFinderResolver) ResolveName(ctx context.Context) (string, error)
type DeviceResolver ¶
type EstimatedMonotonicTime ¶
type EstimatedMonotonicTime struct {
// contains filtered or unexported fields
}
EstimatedMonotonicTime is a structure that will return a string estimate of a device's current monotonic time.
func NewEstimatedMonotonicTime ¶
func NewEstimatedMonotonicTime(client *Client, suffix string) *EstimatedMonotonicTime
NewEstimatedMonotonicTime constructs a new EstimatedMonotonicTime.
func (*EstimatedMonotonicTime) String ¶
func (p *EstimatedMonotonicTime) String() string
String() will return a string prefixed by the device's monotonic time.