Skip to main content

Programming- and CLI-Interface for the h5-dataformat of the Shepherd-Testbed

Project description

Core Library

PyPiVersion image Pytest CodeStyle

Main Documentation: https://orgua.github.io/shepherd

Source Code: https://github.com/orgua/shepherd-datalib

Main Project: https://github.com/orgua/shepherd


shepherd-core is designed as a library and bundles data-models and file-access-routines for the shepherd-testbed, that are used by several codebases.

For postprocessing shepherds .h5-files usage of shepherd_data is recommended.

Features

  • read and write shepherds hdf5-files
  • create, read, write and convert experiments for the testbed
    • all required data-models are included
  • simulate the virtual source, including virtual harvesters (and virtual converter as a whole)
  • connect and query the testbed via a webclient (TestbedClient in alpha-stage)
    • offline usage defaults to static demo-fixtures loaded from yaml-files in the model-directories
  • work with target-firmwares
    • embed, modify, verify, convert
    • Note: working with ELF-files requires external dependencies, see Installation-Chapter
  • decode waveforms (gpio-state & timestamp) to UART
  • create an inventory (for deployed versions of software, hardware)

See official documentation or example scripts for more details and usage. Most functionality is showcased in both. The extra-directory holds data-generators relevant for the testbed. Notably is a trafficbench-experiment that's used to derive the link-matrix of the testbed-nodes.

Config-Models in Detail

These pydantic data-models are used throughout all shepherd interfaces. Users can create an experiment, include their own content and feed it to the testbed.

  • orchestration /data-models with focus on remote shepherd-testbed
  • classes of sub-models
    • /base: base-classes, configuration and -functionality for all models
    • /testbed: meta-data representation of all testbed-components
    • /content: reusable user-defined meta-data for fw, h5 and vsrc-definitions
    • /experiment: configuration-models including sub-systems
    • /task: digestible configs for shepherd-herd or -sheep
    • behavior controlled by ShpModel and content-model
  • a basic database is available as fixtures through a tb_client
    • fixtures selectable by name & ID
    • fixtures support inheritance
  • the models support
    • auto-completion with neutral / sensible values
    • complex and custom datatypes (i.e. PositiveInt, lists-checks on length)
    • checking of inputs and type-casting
    • generate their own schema (for web-forms)
    • pre-validation
    • store to & load from yaml with typecheck through wrapper
    • documentation
  • experiment-definition is designed securely
    • types are limited in size (str)
    • exposes no internal paths
  • experiments can be transformed to task-sets (TestbedTasks.from_xp())

Compatibility

OS PyVersion Comment
Ubuntu 3.8 - 3.13
Windows 3.8 - 3.13 no support for elf and hex-conversions yet
MacOS 3.8 - 3.13 hex-conversion missing

Notes:

  • hex-conversion needs a working and accessible objcopy
  • elf-supports needs
    • shepherd-core[elf] installs pwntools-elf-only
    • most elf-features also still utilize hex-conversion

Installation

The Library is available via PyPI and can be installed with

pip install shepherd-core -U

# or for the full experience (includes core)
pip install shepherd-data -U

For bleeding-edge-features or dev-work it is possible to install directly from GitHub-Sources (here dev-branch):

pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U
# and on sheep with newer debian
sudo pip install git+https://github.com/orgua/shepherd-datalib.git@dev#subdirectory=shepherd_core -U --break-system-packages

If you are working with .elf-files (embedding into experiments) you make "objcopy" accessible to python. In Ubuntu, you can either install build-essential or binutils-$ARCH with arch being msp430 or arm-none-eabi for the nRF52.

sudo apt install build-essential

For more advanced work with .elf-files (modify value of symbols / target-ID) you should install

pip install shepherd-core[elf]

and also make sure the prereqs for the pwntools are met.

For creating an inventory of the host-system you should install

pip install shepherd-core[inventory]

Unittests

To run the testbench, follow these steps:

  1. Navigate your host-shell into the package-folder and
  2. install dependencies
  3. run the testbench (~ 320 tests):
cd shepherd-datalib/shepherd_core
pip3 install ./[tests]
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shepherd_core-2025.5.2.tar.gz (542.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shepherd_core-2025.5.2-py3-none-any.whl (117.3 kB view details)

Uploaded Python 3

File details

Details for the file shepherd_core-2025.5.2.tar.gz.

File metadata

  • Download URL: shepherd_core-2025.5.2.tar.gz
  • Upload date:
  • Size: 542.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for shepherd_core-2025.5.2.tar.gz
Algorithm Hash digest
SHA256 aaac57e412d59c4efe59af9a8c5a1d536d510b0bf81acede0600d0b88c95bab4
MD5 80a0fba1fdeab614466fda8abfb8b952
BLAKE2b-256 66da9d6d523f7b9015eccc756563e40a145b9ef9f94e267cd69c6a3330eff1ed

See more details on using hashes here.

Provenance

The following attestation bundles were made for shepherd_core-2025.5.2.tar.gz:

Publisher: publish_core.yaml on orgua/shepherd-datalib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file shepherd_core-2025.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for shepherd_core-2025.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c3e510dfe90b7ab510dda7c1b72f050b848d54ef86aefef5cd6e426902ce4580
MD5 188979c7f4f62463271a9e6e75fa05d9
BLAKE2b-256 8c712c663ab3d299c86dc2581d7f82c04b4a695d3f60e953cb7193d832a0ca76

See more details on using hashes here.

Provenance

The following attestation bundles were made for shepherd_core-2025.5.2-py3-none-any.whl:

Publisher: publish_core.yaml on orgua/shepherd-datalib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page