labgrid.util package

Subpackages

Submodules

labgrid.util.agent module

labgrid.util.agent.b2s(b)[source]
labgrid.util.agent.s2b(s)[source]
class labgrid.util.agent.Agent[source]

Bases: object

__init__()[source]
send(data)[source]
register(name, func)[source]
load(name, source)[source]
list()[source]
run()[source]
__dict__ = mappingproxy({'__module__': 'labgrid.util.agent', '__init__': <function Agent.__init__>, 'send': <function Agent.send>, 'register': <function Agent.register>, 'load': <function Agent.load>, 'list': <function Agent.list>, 'run': <function Agent.run>, '__dict__': <attribute '__dict__' of 'Agent' objects>, '__weakref__': <attribute '__weakref__' of 'Agent' objects>, '__doc__': None, '__annotations__': {}})
__module__ = 'labgrid.util.agent'
__weakref__

list of weak references to the object (if defined)

labgrid.util.agent.handle_test(*args, **kwargs)[source]
labgrid.util.agent.handle_error(message)[source]
labgrid.util.agent.handle_usbtmc(index, cmd, read=False)[source]
labgrid.util.agent.main()[source]

labgrid.util.agentwrapper module

labgrid.util.agentwrapper.b2s(b)[source]
labgrid.util.agentwrapper.s2b(s)[source]
exception labgrid.util.agentwrapper.AgentError[source]

Bases: Exception

__module__ = 'labgrid.util.agentwrapper'
__weakref__

list of weak references to the object (if defined)

exception labgrid.util.agentwrapper.AgentException[source]

Bases: Exception

__module__ = 'labgrid.util.agentwrapper'
__weakref__

list of weak references to the object (if defined)

class labgrid.util.agentwrapper.MethodProxy(wrapper, name)[source]

Bases: object

__init__(wrapper, name)[source]
__call__(*args, **kwargs)[source]

Call self as a function.

__dict__ = mappingproxy({'__module__': 'labgrid.util.agentwrapper', '__init__': <function MethodProxy.__init__>, '__call__': <function MethodProxy.__call__>, '__dict__': <attribute '__dict__' of 'MethodProxy' objects>, '__weakref__': <attribute '__weakref__' of 'MethodProxy' objects>, '__doc__': None, '__annotations__': {}})
__module__ = 'labgrid.util.agentwrapper'
__weakref__

list of weak references to the object (if defined)

class labgrid.util.agentwrapper.ModuleProxy(wrapper, name)[source]

Bases: object

__init__(wrapper, name)[source]
__getattr__(name)[source]
__dict__ = mappingproxy({'__module__': 'labgrid.util.agentwrapper', '__init__': <function ModuleProxy.__init__>, '__getattr__': <function ModuleProxy.__getattr__>, '__dict__': <attribute '__dict__' of 'ModuleProxy' objects>, '__weakref__': <attribute '__weakref__' of 'ModuleProxy' objects>, '__doc__': None, '__annotations__': {}})
__module__ = 'labgrid.util.agentwrapper'
__weakref__

list of weak references to the object (if defined)

class labgrid.util.agentwrapper.AgentWrapper(host=None)[source]

Bases: object

__init__(host=None)[source]
__del__()[source]
__getattr__(name)[source]
call(method, *args, **kwargs)[source]
__dict__ = mappingproxy({'__module__': 'labgrid.util.agentwrapper', '__init__': <function AgentWrapper.__init__>, '__del__': <function AgentWrapper.__del__>, '__getattr__': <function AgentWrapper.__getattr__>, 'call': <function AgentWrapper.call>, 'load': <function AgentWrapper.load>, 'close': <function AgentWrapper.close>, '__dict__': <attribute '__dict__' of 'AgentWrapper' objects>, '__weakref__': <attribute '__weakref__' of 'AgentWrapper' objects>, '__doc__': None, '__annotations__': {}})
__module__ = 'labgrid.util.agentwrapper'
__weakref__

list of weak references to the object (if defined)

load(name, path=None)[source]
close()[source]

labgrid.util.atomic module

labgrid.util.atomic.atomic_replace(filename, data)[source]

labgrid.util.dict module

This module contains helper functions for working with dictionaries.

labgrid.util.dict.diff_dict(old, new)[source]

Compares old and new dictionaries, yielding for each difference (key, old_value, new_value). None is used for missing values.

labgrid.util.dict.flat_dict(d)[source]
labgrid.util.dict.filter_dict(d, cls, warn=False)[source]

Returns a copy a dictionary which only contains the attributes defined on an attrs class.

labgrid.util.dict.find_dict(d, key)[source]

Recursively search for a key in a dictionary

Parameters:
  • d (dict) – The dictionary to recursively search through

  • key (str) – The key to search for

labgrid.util.exceptions module

exception labgrid.util.exceptions.NoValidDriverError(msg)[source]

Bases: Exception

__annotations__ = {}
__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='msg'),)
__init__(msg) None

Method generated by attrs for class NoValidDriverError.

__match_args__ = ('msg',)
__module__ = 'labgrid.util.exceptions'
__repr__()

Method generated by attrs for class NoValidDriverError.

__weakref__

list of weak references to the object (if defined)

labgrid.util.expect module

class labgrid.util.expect.PtxExpect(driver)[source]

Bases: spawn

labgrid Wrapper of the pexpect module.

This class provides pexpect functionality for the ConsoleProtocol classes. driver: ConsoleProtocol object to be passed in

__init__(driver)[source]

Initializes a pexpect spawn instance with the required configuration

send(s)[source]

Write to underlying transport, return number of bytes written

sendcontrol(char)[source]

Send control character to underlying transport, e.g. Ctrl-C or Ctrl-Z.

read_nonblocking(size=1, timeout=-1)[source]

Pexpects needs a nonblocking read function, simply use pyserial with a timeout of 0.

__module__ = 'labgrid.util.expect'

labgrid.util.helper module

labgrid.util.helper.get_free_port()[source]

Helper function to always return an unused port.

labgrid.util.helper.get_user()[source]

Get the username of the current user.

labgrid.util.helper.set_nonblocking(fd)[source]
class labgrid.util.helper.ProcessWrapper(callbacks=_Nothing.NOTHING)[source]

Bases: object

loglevel = 20
check_output(command, *, print_on_silent_log=False, input=None, stdin=None)[source]

Run a command and supply the output to callback functions

register(callback)[source]

Register a callback with the ProcessWrapper

unregister(callback)[source]

Unregister a callback with the ProcessWrapper

static log_callback(message, process)[source]

Logs process output message along with its pid.

static print_callback(message, _)[source]

Prints process output message.

enable_logging()[source]

Enables process output to the logging interface.

disable_logging()[source]

Disables process output logging.

enable_print()[source]

Enables process output to print.

disable_print()[source]

Disables process output printing.

__annotations__ = {}
__attrs_attrs__ = (Attribute(name='callbacks', default=Factory(factory=<class 'list'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='callbacks'),)
__dict__ = mappingproxy({'__module__': 'labgrid.util.helper', 'loglevel': 20, 'check_output': <function ProcessWrapper.check_output>, 'register': <function ProcessWrapper.register>, 'unregister': <function ProcessWrapper.unregister>, 'log_callback': <staticmethod(<function ProcessWrapper.log_callback>)>, 'print_callback': <staticmethod(<function ProcessWrapper.print_callback>)>, 'enable_logging': <function ProcessWrapper.enable_logging>, 'disable_logging': <function ProcessWrapper.disable_logging>, 'enable_print': <function ProcessWrapper.enable_print>, 'disable_print': <function ProcessWrapper.disable_print>, '__dict__': <attribute '__dict__' of 'ProcessWrapper' objects>, '__weakref__': <attribute '__weakref__' of 'ProcessWrapper' objects>, '__doc__': None, '__annotations__': {}, '__attrs_attrs__': (Attribute(name='callbacks', default=Factory(factory=<class 'list'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='callbacks'),), '__repr__': <function ProcessWrapper.__repr__>, '__eq__': <function ProcessWrapper.__eq__>, '__ne__': <function ProcessWrapper.__ne__>, '__lt__': <function ProcessWrapper.__lt__>, '__le__': <function ProcessWrapper.__le__>, '__gt__': <function ProcessWrapper.__gt__>, '__ge__': <function ProcessWrapper.__ge__>, '__hash__': None, '__init__': <function ProcessWrapper.__init__>, '__match_args__': ('callbacks',)})
__eq__(other)

Method generated by attrs for class ProcessWrapper.

__ge__(other)

Method generated by attrs for class ProcessWrapper.

__gt__(other)

Method generated by attrs for class ProcessWrapper.

__hash__ = None
__init__(callbacks=_Nothing.NOTHING) None

Method generated by attrs for class ProcessWrapper.

__le__(other)

Method generated by attrs for class ProcessWrapper.

__lt__(other)

Method generated by attrs for class ProcessWrapper.

__match_args__ = ('callbacks',)
__module__ = 'labgrid.util.helper'
__ne__(other)

Method generated by attrs for class ProcessWrapper.

__repr__()

Method generated by attrs for class ProcessWrapper.

__weakref__

list of weak references to the object (if defined)

labgrid.util.managedfile module

exception labgrid.util.managedfile.ManagedFileError[source]

Bases: Exception

__module__ = 'labgrid.util.managedfile'
__weakref__

list of weak references to the object (if defined)

class labgrid.util.managedfile.ManagedFile(local_path, resource, detect_nfs=True)[source]

Bases: object

The ManagedFile allows the synchronisation of a file to a remote host. It has to be created with the to be synced file and the target resource as argument:

::

from labgrid.util.managedfile import ManagedFile

ManagedFile(“/tmp/examplefile”, <your-resource>)

Synchronisation is done with the sync_to_resource method.

__attrs_post_init__()[source]
sync_to_resource(symlink=None)[source]

sync the file to the host specified in a resource

Raises:

ExecutionError – if the SSH connection/copy fails

get_remote_path()[source]

Retrieve the remote file path

Returns:

path to the file on the remote host

Return type:

str

get_hash()[source]

Retrieve the hash of the file

Returns:

SHA256 hexdigest of the file

Return type:

str

get_user_cache_path()[source]
__annotations__ = {}
__attrs_attrs__ = (Attribute(name='local_path', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<function ManagedFile.<lambda>>, kw_only=False, inherited=False, on_setattr=None, alias='local_path'), Attribute(name='resource', default=NOTHING, validator=<instance_of validator for type <class 'labgrid.resource.common.Resource'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='resource'), Attribute(name='detect_nfs', default=True, validator=<instance_of validator for type <class 'bool'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='detect_nfs'))
__dict__ = mappingproxy({'__module__': 'labgrid.util.managedfile', '__doc__': ' The ManagedFile allows the synchronisation of a file to a remote host.\n    It has to be created with the to be synced file and the target resource as\n    argument:\n\n    ::\n        from labgrid.util.managedfile import ManagedFile\n\n        ManagedFile("/tmp/examplefile", <your-resource>)\n\n    Synchronisation is done with the sync_to_resource method.\n    ', '__attrs_post_init__': <function ManagedFile.__attrs_post_init__>, 'sync_to_resource': <function ManagedFile.sync_to_resource>, '_on_nfs': <function ManagedFile._on_nfs>, 'get_remote_path': <function ManagedFile.get_remote_path>, 'get_hash': <function ManagedFile.get_hash>, 'get_user_cache_path': <function ManagedFile.get_user_cache_path>, '__dict__': <attribute '__dict__' of 'ManagedFile' objects>, '__weakref__': <attribute '__weakref__' of 'ManagedFile' objects>, '__annotations__': {}, '__attrs_attrs__': (Attribute(name='local_path', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=<function ManagedFile.<lambda>>, kw_only=False, inherited=False, on_setattr=None, alias='local_path'), Attribute(name='resource', default=NOTHING, validator=<instance_of validator for type <class 'labgrid.resource.common.Resource'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='resource'), Attribute(name='detect_nfs', default=True, validator=<instance_of validator for type <class 'bool'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='detect_nfs')), '__repr__': <function ManagedFile.__repr__>, '__eq__': <function ManagedFile.__eq__>, '__ne__': <function ManagedFile.__ne__>, '__lt__': <function ManagedFile.__lt__>, '__le__': <function ManagedFile.__le__>, '__gt__': <function ManagedFile.__gt__>, '__ge__': <function ManagedFile.__ge__>, '__hash__': None, '__init__': <function ManagedFile.__init__>, '__match_args__': ('local_path', 'resource', 'detect_nfs')})
__eq__(other)

Method generated by attrs for class ManagedFile.

__ge__(other)

Method generated by attrs for class ManagedFile.

__gt__(other)

Method generated by attrs for class ManagedFile.

__hash__ = None
__init__(local_path, resource, detect_nfs=True) None

Method generated by attrs for class ManagedFile.

__le__(other)

Method generated by attrs for class ManagedFile.

__lt__(other)

Method generated by attrs for class ManagedFile.

__match_args__ = ('local_path', 'resource', 'detect_nfs')
__module__ = 'labgrid.util.managedfile'
__ne__(other)

Method generated by attrs for class ManagedFile.

__repr__()

Method generated by attrs for class ManagedFile.

__weakref__

list of weak references to the object (if defined)

labgrid.util.marker module

labgrid.util.marker.gen_marker()[source]

labgrid.util.proxy module

labgrid.util.qmp module

class labgrid.util.qmp.QMPMonitor(monitor_out, monitor_in)[source]

Bases: object

__attrs_post_init__()[source]
execute(command, arguments={})[source]
__annotations__ = {}
__attrs_attrs__ = (Attribute(name='monitor_out', default=NOTHING, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='monitor_out'), Attribute(name='monitor_in', default=NOTHING, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='monitor_in'))
__dict__ = mappingproxy({'__module__': 'labgrid.util.qmp', '__attrs_post_init__': <function QMPMonitor.__attrs_post_init__>, '_negotiate_capabilities': <function QMPMonitor._negotiate_capabilities>, '_read_parse_json': <function QMPMonitor._read_parse_json>, 'execute': <function QMPMonitor.execute>, '__dict__': <attribute '__dict__' of 'QMPMonitor' objects>, '__weakref__': <attribute '__weakref__' of 'QMPMonitor' objects>, '__doc__': None, '__annotations__': {}, '__attrs_attrs__': (Attribute(name='monitor_out', default=NOTHING, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='monitor_out'), Attribute(name='monitor_in', default=NOTHING, validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='monitor_in')), '__repr__': <function QMPMonitor.__repr__>, '__init__': <function QMPMonitor.__init__>, '__match_args__': ('monitor_out', 'monitor_in')})
__init__(monitor_out, monitor_in) None

Method generated by attrs for class QMPMonitor.

__match_args__ = ('monitor_out', 'monitor_in')
__module__ = 'labgrid.util.qmp'
__repr__()

Method generated by attrs for class QMPMonitor.

__weakref__

list of weak references to the object (if defined)

exception labgrid.util.qmp.QMPError(msg)[source]

Bases: Exception

__annotations__ = {}
__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='msg'),)
__init__(msg) None

Method generated by attrs for class QMPError.

__match_args__ = ('msg',)
__module__ = 'labgrid.util.qmp'
__repr__()

Method generated by attrs for class QMPError.

__weakref__

list of weak references to the object (if defined)

labgrid.util.snmp module

labgrid.util.ssh module

class labgrid.util.ssh.SSHConnection(host)[source]

Bases: object

SSHConnections are individual connections to hosts managed by a control socket. In addition to command execution this class also provides an interface to manage port forwardings. These are used in the remote infrastructure to tunnel multiple connections over one SSH link.

A public identity infrastructure is assumed, no extra username or passwords are supported.

__attrs_post_init__()[source]
get_prefix()[source]
run(command, *, codec='utf-8', decodeerrors='strict', force_tty=False, stderr_merge=False, stderr_loglevel=None, stdout_loglevel=None)[source]

Run a command over the SSHConnection

Parameters:
  • command (string) – The command to run

  • codec (string, optional) – output encoding. Defaults to “utf-8”.

  • decodeerrors (string, optional) – behavior on decode errors. Defaults to “strict”. Refer to stdtypes’ bytes.decode for details.

  • force_tty (bool, optional) – force allocate a tty (ssh -tt). Defaults to False

  • stderr_merge (bool, optional) – merge ssh subprocess stderr into stdout. Defaults to False.

  • stdout_loglevel (int, optional) – log stdout with specific log level as well. Defaults to None, i.e. don’t log.

  • stderr_loglevel (int, optional) – log stderr with specific log level as well. Defaults to None, i.e. don’t log.

Returns:

(stdout, stderr, returncode)

run_check(command, *, codec='utf-8', decodeerrors='strict', force_tty=False, stderr_merge=False, stderr_loglevel=None, stdout_loglevel=None)[source]

Runs a command over the SSHConnection returns the output if successful, raises ExecutionError otherwise.

Except for the means of returning the value, this is equivalent to run.

Parameters:
  • command (string) – The command to run

  • codec (string, optional) – output encoding. Defaults to “utf-8”.

  • decodeerrors (string, optional) – behavior on decode errors. Defaults to “strict”. Refer to stdtypes’ bytes.decode for details.

  • force_tty (bool, optional) – force allocate a tty (ssh -tt). Defaults to False

  • stderr_merge (bool, optional) – merge ssh subprocess stderr into stdout. Defaults to False.

  • stdout_loglevel (int, optional) – log stdout with specific log level as well. Defaults to None, i.e. don’t log.

  • stderr_loglevel (int, optional) – log stderr with specific log level as well. Defaults to None, i.e. don’t log.

Returns:

stdout of the executed command if successful and

otherwise an ExecutionError Exception

Return type:

List[str]

get_file(remote_file, local_file)[source]

Get a file from the remote host

put_file(local_file, remote_path)[source]

Put a file onto the remote host

add_port_forward(remote_host, remote_port, local_port=None)[source]

forward command

remove_port_forward(remote_host, remote_port)[source]

cancel command

add_remote_port_forward(remote_port, local_port, remote_bind=None)[source]

remote forward command

Note that the remote socket is not bound to any specific IP by default, making it reachable by the target. Also, ‘GatewayPorts clientspecified’ needs to be configured in the remote host’s sshd_config.

remove_remote_port_forward(remote_port, local_port, remote_bind=None)[source]

remote cancel command

connect()[source]
isconnected()[source]
disconnect()[source]
cleanup()[source]
__annotations__ = {}
__attrs_attrs__ = (Attribute(name='host', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='host'), Attribute(name='_connected', default=False, validator=<instance_of validator for type <class 'bool'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='connected'), Attribute(name='_tmpdir', default=Factory(factory=<function SSHConnection.<lambda>>, takes_self=False), validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='tmpdir'), Attribute(name='_l_forwards', default=Factory(factory=<class 'dict'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='l_forwards'), Attribute(name='_r_forwards', default=Factory(factory=<class 'set'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='r_forwards'))
__dict__ = mappingproxy({'__module__': 'labgrid.util.ssh', '__doc__': 'SSHConnections are individual connections to hosts managed by a control\n    socket. In addition to command execution this class also provides an\n    interface to manage port forwardings. These are used in the remote\n    infrastructure to tunnel multiple connections over one SSH link.\n\n    A public identity infrastructure is assumed, no extra username or passwords\n    are supported.', '__attrs_post_init__': <function SSHConnection.__attrs_post_init__>, '_get_ssh_base_args': <staticmethod(<function SSHConnection._get_ssh_base_args>)>, '_get_ssh_control_args': <function SSHConnection._get_ssh_control_args>, '_get_ssh_args': <function SSHConnection._get_ssh_args>, '_open_connection': <function SSHConnection._open_connection>, '_run_socket_command': <function SSHConnection._run_socket_command>, 'get_prefix': <function SSHConnection.get_prefix>, 'run': <function SSHConnection.run>, 'run_check': <function SSHConnection.run_check>, 'get_file': <function SSHConnection.get_file>, 'put_file': <function SSHConnection.put_file>, 'add_port_forward': <function SSHConnection.add_port_forward>, 'remove_port_forward': <function SSHConnection.remove_port_forward>, 'add_remote_port_forward': <function SSHConnection.add_remote_port_forward>, 'remove_remote_port_forward': <function SSHConnection.remove_remote_port_forward>, 'connect': <function SSHConnection.connect>, 'isconnected': <function SSHConnection.isconnected>, '_check_external_master': <function SSHConnection._check_external_master>, '_start_own_master': <function SSHConnection._start_own_master>, '_stop_own_master': <function SSHConnection._stop_own_master>, '_start_keepalive': <function SSHConnection._start_keepalive>, '_check_keepalive': <function SSHConnection._check_keepalive>, '_stop_keepalive': <function SSHConnection._stop_keepalive>, 'disconnect': <function SSHConnection.disconnect>, 'cleanup': <function SSHConnection.cleanup>, '__dict__': <attribute '__dict__' of 'SSHConnection' objects>, '__weakref__': <attribute '__weakref__' of 'SSHConnection' objects>, '__annotations__': {}, '__attrs_attrs__': (Attribute(name='host', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='host'), Attribute(name='_connected', default=False, validator=<instance_of validator for type <class 'bool'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='connected'), Attribute(name='_tmpdir', default=Factory(factory=<function SSHConnection.<lambda>>, takes_self=False), validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='tmpdir'), Attribute(name='_l_forwards', default=Factory(factory=<class 'dict'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='l_forwards'), Attribute(name='_r_forwards', default=Factory(factory=<class 'set'>, takes_self=False), validator=None, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=False, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='r_forwards')), '__repr__': <function SSHConnection.__repr__>, '__eq__': <function SSHConnection.__eq__>, '__ne__': <function SSHConnection.__ne__>, '__lt__': <function SSHConnection.__lt__>, '__le__': <function SSHConnection.__le__>, '__gt__': <function SSHConnection.__gt__>, '__ge__': <function SSHConnection.__ge__>, '__hash__': None, '__init__': <function SSHConnection.__init__>, '__match_args__': ('host',)})
__eq__(other)

Method generated by attrs for class SSHConnection.

__ge__(other)

Method generated by attrs for class SSHConnection.

__gt__(other)

Method generated by attrs for class SSHConnection.

__hash__ = None
__init__(host) None

Method generated by attrs for class SSHConnection.

__le__(other)

Method generated by attrs for class SSHConnection.

__lt__(other)

Method generated by attrs for class SSHConnection.

__match_args__ = ('host',)
__module__ = 'labgrid.util.ssh'
__ne__(other)

Method generated by attrs for class SSHConnection.

__repr__()

Method generated by attrs for class SSHConnection.

__weakref__

list of weak references to the object (if defined)

exception labgrid.util.ssh.ForwardError(msg)[source]

Bases: Exception

__annotations__ = {}
__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='msg'),)
__eq__(other)

Method generated by attrs for class ForwardError.

__ge__(other)

Method generated by attrs for class ForwardError.

__gt__(other)

Method generated by attrs for class ForwardError.

__hash__ = None
__init__(msg) None

Method generated by attrs for class ForwardError.

__le__(other)

Method generated by attrs for class ForwardError.

__lt__(other)

Method generated by attrs for class ForwardError.

__match_args__ = ('msg',)
__module__ = 'labgrid.util.ssh'
__ne__(other)

Method generated by attrs for class ForwardError.

__repr__()

Method generated by attrs for class ForwardError.

__weakref__

list of weak references to the object (if defined)

labgrid.util.timeout module

class labgrid.util.timeout.Timeout(timeout=120.0)[source]

Bases: object

Reperents a timeout (as a deadline)

__attrs_post_init__()[source]
property remaining
property expired
__annotations__ = {}
__attrs_attrs__ = (Attribute(name='timeout', default=120.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='timeout'),)
__dict__ = mappingproxy({'__module__': 'labgrid.util.timeout', '__doc__': 'Reperents a timeout (as a deadline)', '__attrs_post_init__': <function Timeout.__attrs_post_init__>, 'remaining': <property object>, 'expired': <property object>, '__dict__': <attribute '__dict__' of 'Timeout' objects>, '__weakref__': <attribute '__weakref__' of 'Timeout' objects>, '__annotations__': {}, '__attrs_attrs__': (Attribute(name='timeout', default=120.0, validator=<instance_of validator for type <class 'float'>>, repr=True, eq=True, eq_key=None, order=True, order_key=None, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False, inherited=False, on_setattr=None, alias='timeout'),), '__repr__': <function Timeout.__repr__>, '__init__': <function Timeout.__init__>, '__match_args__': ('timeout',)})
__init__(timeout=120.0) None

Method generated by attrs for class Timeout.

__match_args__ = ('timeout',)
__module__ = 'labgrid.util.timeout'
__repr__()

Method generated by attrs for class Timeout.

__weakref__

list of weak references to the object (if defined)

labgrid.util.version module

This module contains helper functions for working with version.

labgrid.util.version.labgrid_version()[source]

labgrid.util.yaml module

This module contains the custom YAML load and dump functions and associated loader and dumper

class labgrid.util.yaml.Loader(stream)[source]

Bases: SafeLoader

__module__ = 'labgrid.util.yaml'
yaml_constructors = {'!template': <function _template_constructor>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function _dict_constructor>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:python/tuple': <function FullConstructor.construct_python_tuple>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function _str_constructor>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, None: <function SafeConstructor.construct_undefined>}
class labgrid.util.yaml.Dumper(stream, default_style=None, default_flow_style=False, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None, sort_keys=True)[source]

Bases: SafeDumper

__annotations__ = {}
__module__ = 'labgrid.util.yaml'
yaml_representers = {<class 'NoneType'>: <function SafeRepresenter.represent_none>, <class 'bool'>: <function SafeRepresenter.represent_bool>, <class 'bytes'>: <function SafeRepresenter.represent_binary>, <class 'collections.OrderedDict'>: <function _dict_representer>, <class 'datetime.date'>: <function SafeRepresenter.represent_date>, <class 'datetime.datetime'>: <function SafeRepresenter.represent_datetime>, <class 'dict'>: <function SafeRepresenter.represent_dict>, <class 'float'>: <function SafeRepresenter.represent_float>, <class 'int'>: <function SafeRepresenter.represent_int>, <class 'list'>: <function SafeRepresenter.represent_list>, <class 'set'>: <function SafeRepresenter.represent_set>, <class 'str'>: <function SafeRepresenter.represent_str>, <class 'tuple'>: <function SafeRepresenter.represent_list>, None: <function SafeRepresenter.represent_undefined>}
labgrid.util.yaml.load(stream)[source]

Wrapper for yaml load function with custom loader.

labgrid.util.yaml.dump(data, stream=None, **kwargs)[source]

Wrapper for yaml dump function with custom dumper.

labgrid.util.yaml.resolve_templates(data, mapping)[source]

Iterate recursively over data and call substitute(mapping) on all Templates.