Skip to main content

IoT Testbed Experiment Automation CLI for MergeTB / Sphere Testbed

Project description

mrg-iot

A Python CLI for automating IoT testbed experiments on the Sphere / Merge Testbed platform.

mrg-iot drives the full experiment lifecycle so you don't have to:

  • Create an experiment and its network model for the selected devices.
  • Realize and materialize the model.
  • Create an XDC (eXperimental Data Center) and attach it to the materialization.
  • Set up SSH port forwarding for RTSP streams and file downloads.
  • (Optional) De-materialize and clean up resources when you're done.

Installation

pipx install mrg-iot

(Or pip install mrg-iot inside a virtualenv.)

mrg-iot requires Python 3.9+ and a working VLC install on the host for RTSP playback — pip can't install VLC for you.

Usage

Interactive mode

mrg-iot login        # save credentials to ~/.mrg-iot/session.json
mrg-iot              # walk through the experiment flow

Non-interactive mode

mrg-iot --non-interactive \
    --project neuiot \
    --devices s-echodot-1 \
    --exp-name myexp \
    --exp-desc "my experiment" \
    --realization realiot \
    --duration 1w \
    --xdc myxdc

Cleanup subcommands

mrg-iot exp delete         --project neuiot --name myexp
mrg-iot exp dematerialize  --project neuiot --name myexp --realization realiot
mrg-iot xdc detach         --project neuiot --name myxdc --experiment myexp --realization realiot
mrg-iot xdc delete         --project neuiot --name myxdc

Run mrg-iot --help for the full flag list.

Debug logging

mrg-iot --debug      # verbose logs to stderr + debug.log

Input validation

The CLI validates inputs upfront so bad args fail fast rather than deep inside a portal call:

  • Names (exp-name, realization, xdc, network): start with a letter, lowercase letters and digits only, max 32 chars.
  • Description: letters, digits, spaces, commas, periods, hyphens; max 256 chars.
  • Duration: minimum 4 days. Accepts 1w, 4d, 1w2d, 1 week, etc.

macOS SSL note

If portal calls fail with an SSL error on macOS:

export SSL_CERT_FILE="$(python -m certifi)"
export REQUESTS_CA_BUNDLE="$SSL_CERT_FILE"

Development

git clone https://gitlab.com/sphere-neu/mrg-iot.git
cd mrg-iot
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

mypy .
pylint *.py
black *.py
isort *.py

License

MIT — see LICENSE.

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

mrg_iot-1.3.0.tar.gz (72.0 kB view details)

Uploaded Source

Built Distribution

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

mrg_iot-1.3.0-py3-none-any.whl (61.9 kB view details)

Uploaded Python 3

File details

Details for the file mrg_iot-1.3.0.tar.gz.

File metadata

  • Download URL: mrg_iot-1.3.0.tar.gz
  • Upload date:
  • Size: 72.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for mrg_iot-1.3.0.tar.gz
Algorithm Hash digest
SHA256 abd7b3e9872cc2e7c6eea3e3adeff013a690c9e355c22d1987d12f6e367a5ab0
MD5 5fc85c4d8fa8eb81f0fb67c12387fa1d
BLAKE2b-256 3b3bcdbf17ebdd3eeada43531c67fc34999602b182e09f93dc123c373526a0a5

See more details on using hashes here.

File details

Details for the file mrg_iot-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: mrg_iot-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 61.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for mrg_iot-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ab898793fc5dd7cef25d9a65b8f08f0a549a68d0d37635976f74d803cea13f10
MD5 51fdaf10f6950c431b65f5f4615b218b
BLAKE2b-256 4fd501c3b365da74024624b6cfed3a1288017b36d0c2a41f59c196d9c1a17330

See more details on using hashes here.

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