Components

Resources

class labgrid.resource.RawSerialPort(target, port=None, speed=115200)[source]

Bases: labgrid.resource.base.SerialPort, labgrid.resource.common.Resource

class labgrid.resource.NetworkSerialPort(target, host, port, speed=115200)[source]

Bases: labgrid.resource.common.NetworkResource

class labgrid.resource.NetworkService(target, address, username)[source]

Bases: labgrid.resource.common.Resource

class labgrid.resource.OneWirePIO(target, host, path)[source]

Bases: labgrid.resource.common.Resource

This resource describes a Onewire PIO Port.

Arguments: host - The hostname of the owserver e.g. localhost:4304 path - Path to the port on the owserver e.g. 29.7D6913000000/PIO.0

class labgrid.resource.NetworkPowerPort(target, model, host, index)[source]

Bases: labgrid.resource.common.Resource

class labgrid.resource.RemotePlace(target, name)[source]

Bases: labgrid.resource.common.ManagedResource

class labgrid.resource.USBSerialPort(target, match, device=None, port=None, speed=115200)[source]

Bases: labgrid.resource.base.SerialPort, labgrid.resource.udev.USBResource

Drivers

class labgrid.driver.BareboxDriver(target, prompt='')[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.linuxbootprotocol.LinuxBootProtocol

BareboxDriver - Driver to control barebox via the console

run(cmd, *, step)[source]

Runs the specified cmd on the shell and returns the output.

Arguments: cmd - cmd to run on the shell

run_check(cmd)[source]

Runs the specified cmd on the shell and returns the output if successful, raises ExecutionError otherwise.

Arguments: cmd - cmd to run on the shell

get_status()[source]

Returns the status of the barebox driver. 0 means not connected/found, 1 means shell

await_prompt()[source]

Await autoboot line and stop it to get to the prompt

class labgrid.driver.UBootDriver(target, prompt='', password='', init_commands=NOTHING)[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.linuxbootprotocol.LinuxBootProtocol

UBootDriver - Driver to control uboot via the console

run(cmd)[source]

Runs the specified cmd on the shell and returns the output.

Arguments: cmd - cmd to run on the shell

run_check(cmd)[source]

Runs the specified cmd on the shell and returns the output if successful, raises ExecutionError otherwise.

Arguments: cmd - cmd to run on the shell

get_status()[source]

Returns the status of the uboot driver. 0 means not connected/found, 1 means shell

await_prompt()[source]

Await autoboot line and stop it to get to the prompt

await_boot()[source]

Wait for boot line of the linux kernel

class labgrid.driver.ShellDriver(target, prompt, login_prompt, username, password='', keyfile='')[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol

ShellDriver - Driver to execute commands on the shell

run(cmd, *, step)[source]

Runs the specified cmd on the shell and returns the output.

Arguments: cmd - cmd to run on the shell

await_login()[source]

Awaits the login prompt and logs the user in

run_check(cmd)[source]

Runs the specified cmd on the shell and returns the output if successful, raises ExecutionError otherwise.

Arguments: cmd - cmd to run on the shell

get_status()[source]

Returns the status of the shell-driver. 0 means not connected/found, 1 means shell

put_ssh_key(key)[source]

Upload an SSH Key to a target

class labgrid.driver.SSHDriver(target, keyfile='')[source]

Bases: labgrid.driver.commandmixin.CommandMixin, labgrid.driver.common.Driver, labgrid.protocol.commandprotocol.CommandProtocol, labgrid.protocol.filetransferprotocol.FileTransferProtocol

SSHDriver - Driver to execute commands via SSH

run(cmd)[source]

Execute cmd on the target.

This method runs the specified cmd as a command on its target. It uses the ssh shell command to run the command and parses the exitcode. cmd - command to be run on the target

returns: (stdout, stderr, returncode)

run_check(cmd)[source]

Runs the specified cmd on the shell and returns the output if successful, raises ExecutionError otherwise.

Arguments: cmd - cmd to run on the shell

get_status()[source]

The SSHDriver is always connected, return 1

class labgrid.driver.SerialDriver(target)[source]

Bases: labgrid.driver.consoleexpectmixin.ConsoleExpectMixin, labgrid.driver.common.Driver, labgrid.protocol.consoleprotocol.ConsoleProtocol

Driver implementing the ConsoleProtocol interface over a SerialPort connection

open()[source]

Opens the serialport, does nothing if it is already closed

close()[source]

Closes the serialport, does nothing if it is already closed

class labgrid.driver.InfoDriver(target)[source]

Bases: labgrid.driver.common.Driver, labgrid.protocol.infoprotocol.InfoProtocol

InfoDriver implementing the InfoProtocol on top of CommandProtocol drivers

get_ip(interface='eth0')[source]

Returns the IP of the supplied interface

get_service_status(service)[source]

Returns True if service is active, False in all other cases

Strategies

class labgrid.strategy.UBootStrategy(target, status=<Status.unknown: 0>)[source]

Bases: labgrid.strategy.common.Strategy

UbootStrategy - Strategy to switch to uboot or shell

class labgrid.strategy.BareboxStrategy(target, status=<Status.unknown: 0>)[source]

Bases: labgrid.strategy.common.Strategy

BareboxStrategy - Strategy to switch to barebox or shell