labgrid.external package

Submodules

labgrid.external.hawkbit module

class labgrid.external.hawkbit.HawkbitTestClient(host, port, username, password, version=1.0)[source]

Bases: object

__attrs_post_init__()[source]
add_target(target_id: str, token: str)[source]

Add a target to the HawkBit Installation

Parameters
  • target_id (-) – the (unique) device name of the target to add

  • token (-) – pre-shared key to authenticate the target

delete_target(target_id: str)[source]

Delete a target from the HawkBit Installation

Parameters

target_id (-) – the (unique) device name of the target to delete

add_swmodule(modulename: str)[source]
delete_swmodule(module_id: str)[source]

Delete a softwaremodule from the HawkBit Installation

Parameters

module_id (-) – the ID given by hawkBit for the module

add_distributionset(module_id, name=None)[source]
delete_distributionset(distset_id: str)[source]

Delete a distrubitionset from the HawkBit Installation

Parameters

distset_id (-) – the ID of the distribution set to delete

add_artifact(module_id: str, filename: str)[source]
delete_artifact(module_id: str, artifact_id: str)[source]

Delete an artifact from the HawkBit Installation

Parameters

artifact_id (-) – the ID of the artifact to delete

assign_target(distribution_id, target_id)[source]
add_rollout(name, distribution_id, groups)[source]
start_rollout(rollout_id)[source]
post(endpoint: str)[source]
post_json(endpoint: str, data: dict)[source]
post_binary(endpoint: str, filename: str)[source]
delete(endpoint: str)[source]
get_endpoint(endpoint: str)[source]
__attrs_attrs__ = (Attribute(name='host', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='port', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='username', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='password', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='version', default=1.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__dict__ = mappingproxy({'__module__': 'labgrid.external.hawkbit', '__attrs_post_init__': <function HawkbitTestClient.__attrs_post_init__>, 'add_target': <function HawkbitTestClient.add_target>, 'delete_target': <function HawkbitTestClient.delete_target>, 'add_swmodule': <function HawkbitTestClient.add_swmodule>, 'delete_swmodule': <function HawkbitTestClient.delete_swmodule>, 'add_distributionset': <function HawkbitTestClient.add_distributionset>, 'delete_distributionset': <function HawkbitTestClient.delete_distributionset>, 'add_artifact': <function HawkbitTestClient.add_artifact>, 'delete_artifact': <function HawkbitTestClient.delete_artifact>, 'assign_target': <function HawkbitTestClient.assign_target>, 'add_rollout': <function HawkbitTestClient.add_rollout>, 'start_rollout': <function HawkbitTestClient.start_rollout>, 'post': <function HawkbitTestClient.post>, 'post_json': <function HawkbitTestClient.post_json>, 'post_binary': <function HawkbitTestClient.post_binary>, 'delete': <function HawkbitTestClient.delete>, 'get_endpoint': <function HawkbitTestClient.get_endpoint>, '__dict__': <attribute '__dict__' of 'HawkbitTestClient' objects>, '__weakref__': <attribute '__weakref__' of 'HawkbitTestClient' objects>, '__doc__': None, '__attrs_attrs__': (Attribute(name='host', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='port', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='username', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='password', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='version', default=1.0, validator=<instance_of validator for type <class 'float'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False)), '__repr__': <function HawkbitTestClient.__repr__>, '__init__': <function HawkbitTestClient.__init__>})
__init__(host, port, username, password, version=1.0) → None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'labgrid.external.hawkbit'
__repr__()

Automatically created by attrs.

__weakref__

list of weak references to the object (if defined)

exception labgrid.external.hawkbit.HawkbitError(msg)[source]

Bases: Exception

__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False),)
__init__(msg) → None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'labgrid.external.hawkbit'
__repr__()

Automatically created by attrs.

__weakref__

list of weak references to the object (if defined)

labgrid.external.usbstick module

The USBStick module provides support to interactively use a simulated USB device in a test.

class labgrid.external.usbstick.USBStatus[source]

Bases: enum.Enum

This class describes the USBStick Status

unplugged = 0
plugged = 1
mounted = 2
__module__ = 'labgrid.external.usbstick'
class labgrid.external.usbstick.USBStick(target, image_dir, image_name='')[source]

Bases: object

The USBStick class provides an easy to use interface to describe a target as an USB Stick.

__attrs_post_init__()[source]
plug_in()[source]

Insert the USBStick

This function plugs the virtual USB Stick in, making it available to the connected computer.

plug_out()[source]

Plugs out the USBStick

Plugs out the USBStick from the connected computer, does nothing if it is already unplugged

put_file(filename, destination='')[source]

Put a file onto the USBStick Image

Puts a file onto the USB Stick, raises a StateError if it is not mounted on the host computer.

get_file(filename)[source]

Gets a file from the USBStick Image

Gets a file from the USB Stick, raises a StateError if it is not mounted on the host computer.

upload_image(image)[source]

Upload a complete image as a new USB Stick

This replaces the current USB Stick image, storing it permanently on the RiotBoard.

switch_image(image_name)[source]

Switch between already uploaded images on the target.

__attrs_attrs__ = (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image_dir', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image_name', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False))
__dict__ = mappingproxy({'__module__': 'labgrid.external.usbstick', '__doc__': 'The USBStick class provides an easy to use interface to describe a\n target as an USB Stick.', '__attrs_post_init__': <function USBStick.__attrs_post_init__>, 'plug_in': <function USBStick.plug_in>, 'plug_out': <function USBStick.plug_out>, 'put_file': <function USBStick.put_file>, 'get_file': <function USBStick.get_file>, 'upload_image': <function USBStick.upload_image>, 'switch_image': <function USBStick.switch_image>, '__dict__': <attribute '__dict__' of 'USBStick' objects>, '__weakref__': <attribute '__weakref__' of 'USBStick' objects>, '__attrs_attrs__': (Attribute(name='target', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image_dir', default=NOTHING, validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False), Attribute(name='image_name', default='', validator=<instance_of validator for type <class 'str'>>, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False)), '__repr__': <function USBStick.__repr__>, '__init__': <function USBStick.__init__>})
__init__(target, image_dir, image_name='') → None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'labgrid.external.usbstick'
__repr__()

Automatically created by attrs.

__weakref__

list of weak references to the object (if defined)

exception labgrid.external.usbstick.StateError(msg)[source]

Bases: Exception

Exception which indicates a error in the state handling of the test

__attrs_attrs__ = (Attribute(name='msg', default=NOTHING, validator=None, repr=True, cmp=True, hash=None, init=True, metadata=mappingproxy({}), type=None, converter=None, kw_only=False),)
__init__(msg) → None

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'labgrid.external.usbstick'
__repr__()

Automatically created by attrs.

__weakref__

list of weak references to the object (if defined)