Skip to main content

Router Test Kit

CI PyPI version Python License Documentation

A Python framework for automated testing of network devices — OneOS6 routers, Cisco-compatible devices, Linux hosts, and RADIUS servers — over SSH and Telnet. Device types are registered via Python entry points, so external packages can contribute new device types without modifying the core library.

Installation

pip install router-test-kit

Testing

Three-tier test strategy: unit (mocks, no Docker) → integration (real SSH via Docker) → hardware (real OneOS6 devices, opt-in). See docs/testing.md for setup and usage.

Quick start

from router_test_kit.device import LinuxDevice
from router_test_kit.connection import SSHConnection

device = LinuxDevice(username="admin", password="secret")
conn = SSHConnection(timeout=10).connect(device, "192.168.1.100")
try:
    output = conn.write_command("ip route show")
    print(output)
finally:
    conn.disconnect()

SSHConnection.connect accepts an optional port (default 22), so non-standard SSH ports work without any subclassing:

conn = SSHConnection().connect(device, "192.168.1.100", port=2222)

Supported devices

Device type Class Transport
Linux / Unix host LinuxDevice SSH, Telnet
OneOS6 router OneOS6Device SSH, Telnet
RADIUS server RADIUSServer SSH
Local host HostDevice subprocess

Note: Telnet support uses the standard-library telnetlib module, which was removed in Python 3.13. This package requires Python >=3.9,<3.13 until a replacement lands. TelnetConnection emits a DeprecationWarning on instantiation — prefer SSHConnection where possible.

Plugin system

New device types are registered via Python entry points. To add a device type from an external package, declare it in the package's pyproject.toml:

[project.entry-points."router_test_kit.devices"]
juniper = "rtk_plugin_juniper:JuniperDevice"

The class must inherit from router_test_kit.device.Device. At import time, router_test_kit auto-discovers and loads all registered plugins.

from router_test_kit import get_plugin_manager

manager = get_plugin_manager()
devices = manager.get_available_devices()  # includes built-ins + plugins

juniper = manager.create_device("juniper", username="admin", password="secret")

Examples

Documentation

Full API reference and usage guide: alex-anast.github.io/router-test-kit

Design overview (device hierarchy, connection abstraction, plugin discovery): docs/architecture.md

Contributing

See CONTRIBUTING.md for development setup, coding conventions, and the release process.

git clone https://github.com/alex-anast/router-test-kit.git
cd router-test-kit
pip install -e ".[dev]"
python -m pytest tests/unit/ -v
ruff check src/ tests/

License

MIT — see LICENSE.

Release files for router-test-kit 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for router-test-kit 0.3.0
File Size Uploaded
router_test_kit-0.3.0.tar.gz 28.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for router-test-kit 0.3.0
File Interpreter ABI Platform
router_test_kit-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.4 kB

Release files / router_test_kit-0.3.0.tar.gz

Download URL router_test_kit-0.3.0.tar.gz
Size 28.6 kB
Tags Source
SHA-256 checksum
How to use checksums
08d76e78bee2b4ab3beac11492894d4e900edfd2d416a823762151759e472bcd
BLAKE2b-256 checksum
How to use checksums
a0937a8fc29dea9fded4ec5b437b62e45e6640b25e7d94f53c98e7d3b723b0ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / router_test_kit-0.3.0-py3-none-any.whl

Download URL router_test_kit-0.3.0-py3-none-any.whl
Size 28.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad81fa09d841213633d0178cc061c02c49bea645b058194cdd778c7f4b1b78e3
BLAKE2b-256 checksum
How to use checksums
dd1cf83921f28337eb3f8882bcd5881310bbe85f54ef072821378cb776a0401e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page