dryad

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: Apache-2.0, Apache-2.0 Imports: 11 Imported by: 2

Documentation

Overview

Package dryad provides Dryad Manager.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnectionClosed is returned when caller tries to close already closed connection
	// to Dryad.
	ErrConnectionClosed = errors.New("attempt to close already closed connection")
	// ErrNotMounted is returned when the check for sshfs mount fails.
	ErrNotMounted = errors.New("filesystem not mounted")
)

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Username string
	Password string
}

Credentials are used to login to device.

type DeviceCommunicationProvider

type DeviceCommunicationProvider interface {
	// Boot starts DUT and prepares communication so that Login could work.
	//
	// It can be called more than once to reset DUT's state.
	Boot() error

	// Login changes user which is used by remaining methods of this interface.
	//
	// In case of serial it is simple login to terminal.
	//
	// In case of SSH it is used to initialize the connection.
	//
	// In case of SDB it corresponds to `sdb root on` if username is "root"
	// or `sdb root off` otherwise.
	//
	// If shell has appropriate permissions, `su - username` may be used.
	Login(Credentials) error

	// CopyFilesTo transfers data from src to dest present on device.
	// All non-existing directories in dest will be created.
	//
	// It corresponds to command `sdb push src dest`.
	CopyFilesTo(src []string, dest string) error

	// CopyFilesFrom transfers data from src present on device to dest.
	// All non-existing directories in dest will be created.
	//
	// It corresponds to command `sdb pull src dest`.
	CopyFilesFrom(src []string, dest string) error

	// Exec runs a command on device until it exits or timeout occurs.
	// error occurs also when a cmd has non-zero return value.
	// command may be terminated if the stdout and stderr is too large, err will be set.
	//
	// Large outputs should be redirected to files.
	Exec(cmd ...string) (stdout, stderr []byte, err error)

	// Close terminates session to Device.
	Close() error
}

DeviceCommunicationProvider is used to execute steps from job definition that require communication with DUT.

func NewDeviceCommunicationProvider

func NewDeviceCommunicationProvider(session SessionProvider) DeviceCommunicationProvider

NewDeviceCommunicationProvider returns new instance of DeviceCommunicationProvider.

type SessionProvider

type SessionProvider interface {
	// Exec runs a cmd on Dryad.
	// Execution time is limited by default timeout of the session.
	Exec(cmd ...string) (stdout, stderr []byte, err error)

	// DUT switches connections of SDcard and power supply to Device Under Test (DUT).
	//
	// Additional actions, notable PowerTick, may be required for successful device boot.
	DUT() error

	// TS switches connections of SDcard to Test Server (TS).
	// Power is cut from the device and it has no longer access to SDcard.
	TS() error

	// PowerTick switches voltage input on and off in order to cause a device reboot.
	// Moreover it may temporarily change state of dypers.
	//
	// Tick length and dyper actions are defined in device configuration.
	PowerTick() error

	// Close terminates session to Dryad.
	Close() error
}

SessionProvider is used to execute steps from job definition that require communication with Dryad.

It should automatically reconnect if connection has been lost unless Close is called.

func NewSessionProvider

func NewSessionProvider(dryad weles.Dryad, workdir string) SessionProvider

NewSessionProvider returns new instance of SessionProvider.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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