π A professional-grade Python framework for automated network device testing
Router Test Kit provides a simple, secure, and comprehensive solution for testing virtual and physical routers, network devices, and Linux systems. Built with security-first principles and modern Python practices.
- π Security First: SSH-based connections with modern authentication
- π Multi-Device Support: OneOS6 routers, Cisco devices, Linux systems, RADIUS servers
- π§ͺ Test-Driven: Comprehensive test suite with >90% coverage
- π Professional Documentation: Auto-generated API docs with examples
- π CI/CD Ready: GitHub Actions integration for automated testing
- π― Type-Safe: Full type hints for better development experience
- π Modern Python: Support for Python 3.8 through 3.12
- Quick Start
- Installation
- Basic Usage
- Supported Devices
- Security
- Examples
- Documentation
- Contributing
- License
from router_test_kit.device import LinuxDevice
from router_test_kit.connection import SSHConnection
# Create device and establish secure connection
device = LinuxDevice(username="admin", password="secure_pass")
conn = SSHConnection().connect(device, "192.168.1.100")
# Execute commands and verify results
result = conn.exec("ip route show")
print(f"Routes: {result}")
# Clean up
conn.disconnect()pip install router-test-kitfrom router_test_kit.device import LinuxDevice
from router_test_kit.connection import SSHConnection
# Create a device with credentials
device = LinuxDevice(username="admin", password="secure_password")
# Establish SSH connection
with SSHConnection() as conn:
conn.connect(device, "192.168.1.100")
# Execute commands
result = conn.exec("ls -la")
print(result)
# Connection automatically closedfrom router_test_kit.device import OneOS6Device, RADIUSServer
from router_test_kit.static_utils import ping, print_banner
# Setup test environment
router = OneOS6Device(username="admin", password="router_pass")
radius = RADIUSServer(username="radius_admin", password="radius_pass")
# Execute network tests
print_banner("Network Connectivity Test")
loss_rate = ping(source_device=router, target_ip="192.168.1.1", count=10)
print(f"Packet loss: {loss_rate}%")| Device Type | Protocol | Authentication | Status |
|---|---|---|---|
| Linux Systems | SSH/Telnet | Password/Key | β Full Support |
| OneOS6 Routers | SSH/Telnet | Password | β Full Support |
| Cisco Devices | SSH/Telnet | Password | β Compatible |
| RADIUS Servers | SSH | Password | β Specialized Support |
| Generic Hosts | Local | N/A | β Host Commands |
Router Test Kit prioritizes security in network testing:
- SSH First: Default to secure SSH connections over insecure Telnet
- Credential Management: Secure handling of authentication credentials
- Input Validation: Comprehensive validation of all user inputs
- Error Handling: Secure error messages that don't leak sensitive information
- Dependency Security: Regular security audits of all dependencies
# β
Recommended: Use SSH connections
conn = SSHConnection()
# β οΈ Use only when SSH is not available
conn = TelnetConnection() # Consider security implications
# π Use environment variables for credentials
import os
device = LinuxDevice(
username=os.getenv("DEVICE_USERNAME"),
password=os.getenv("DEVICE_PASSWORD")
)- Basic Connection: Simple device connection and command execution
- Network Testing: Inter-VM connectivity testing
- Advanced IPSec: Comprehensive IPSec tunnel testing
# Network topology validation
def validate_network_topology():
devices = [
LinuxDevice("admin", "pass") for _ in range(3)
]
# Test connectivity matrix
for i, source in enumerate(devices):
for j, target in enumerate(devices):
if i != j:
loss = ping(source, f"192.168.1.{j+1}")
assert loss < 5, f"High packet loss: {loss}%"
# Router configuration testing
def test_router_config():
router = OneOS6Device("admin", "config_pass")
with SSHConnection() as conn:
conn.connect(router, "192.168.1.1")
# Load test configuration
conn.load_config("test_config.txt")
# Verify configuration
result = conn.exec("show running-config")
assert "test_interface" in result
# Cleanup
conn.unload_config()- API Reference: Complete API documentation
- User Guide: Detailed usage examples
- Installation Guide: Setup instructions
- Contributing Guide: Development guidelines
We welcome contributions! Please see our Contributing Guide for details.
git clone https://github.com/alex-anast/router-test-kit.git
cd router-test-kit
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Install development dependencies
pip install pytest pytest-cov ruff mypy mkdocs mkdocs-material
# Run tests
python -m pytest tests/unit/ -v
# Run linting
ruff check src/ tests/
ruff format src/ tests/
# Build documentation
mkdocs serve- π Bug Reports: Help us identify and fix issues
- π New Features: Add support for new device types or protocols
- π Documentation: Improve guides and API documentation
- π§ͺ Testing: Expand test coverage and add integration tests
- π Security: Security audits and improvements
This project is licensed under the MIT License - see the LICENSE file for details.
- Built for the network testing and automation community
- Inspired by the need for simple, secure router testing
- Special thanks to all contributors and users
- π Python: 3.8+ support
- π¦ Dependencies: Minimal, security-focused
- π§ͺ Tests: >90% coverage
- π Documentation: Auto-generated from code
- π CI/CD: Automated testing and deployment
Ready to automate your network testing? Install Router Test Kit and start building reliable network tests today!
This project is licensed under the MIT License - see the LICENSE file for details.