A framework for remotely testing routers, physical or virtual.
Project description
Router Test Kit
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
examples/example1_connect.py— basic device connectionexamples/example2_ping_between_vms.py— inter-VM connectivity testingexamples/advanced_ipsec_test/— IPSec tunnel verification on OneOS6
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.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file router_test_kit-0.3.0.tar.gz.
File metadata
- Download URL: router_test_kit-0.3.0.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d76e78bee2b4ab3beac11492894d4e900edfd2d416a823762151759e472bcd
|
|
| MD5 |
8ccb17df3b8575541b22bea610341104
|
|
| BLAKE2b-256 |
a0937a8fc29dea9fded4ec5b437b62e45e6640b25e7d94f53c98e7d3b723b0ac
|
File details
Details for the file router_test_kit-0.3.0-py3-none-any.whl.
File metadata
- Download URL: router_test_kit-0.3.0-py3-none-any.whl
- Upload date:
- Size: 28.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad81fa09d841213633d0178cc061c02c49bea645b058194cdd778c7f4b1b78e3
|
|
| MD5 |
887bfaeadf459c431d4f898d7520bb4e
|
|
| BLAKE2b-256 |
dd1cf83921f28337eb3f8882bcd5881310bbe85f54ef072821378cb776a0401e
|