A Python-based network automation tool for managing Cisco IOS devices through SSH connections. This tool provides a command-line interface to execute configuration commands across multiple network devices simultaneously.
- Multi-device Management: Configure routers, switches, and firewalls in groups
- SSH Automation: Secure SSH connections using Netmiko library
- Command Execution: Execute custom command sets from configuration files
- Error Handling: Robust error handling with detailed logging
- GUI Login: Secure credential input through GUI prompts
- Colored Output: Enhanced terminal output with color-coded status messages
- Flexible Configuration: Support for different device groups and ad-hoc operations
- Python 3.6 or higher
- Network devices with SSH enabled
- Valid credentials for network devices
-
Clone or download the project files
-
Install required dependencies:
pip install -r requirements.txt
-
Configure your devices:
- Edit
ESSENTIAL_values.py
to add your device IP addresses or hostnames - Update
ESSENTIAL_commands.txt
with your desired commands
- Edit
├── METHOD_controller.py # Main controller script
├── METHOD_class.py # Core ALPHA class with SSH functionality
├── ESSENTIAL_values.py # Device configuration and IP addresses
├── ESSENTIAL_instance.py # Device group instances
├── ESSENTIAL_commands.txt # Commands to execute on devices
├── requirements.txt # External dependencies
├── requirements_built-ins.txt # Built-in Python modules used
└── README.md # This file
Update the device IP addresses or hostnames:
north_router = "192.168.1.1"
north_switch = "192.168.1.2"
north_firewall = "192.168.1.3"
# ... add more devices as needed
Add the commands you want to execute on devices:
terminal length 0
show logging last 100
show interfaces
show version
The tool supports several device group operations:
# Configure all routers
python METHOD_controller.py routers
# Configure all switches
python METHOD_controller.py switches
# Configure all firewalls
python METHOD_controller.py firewalls
# Configure routers (adhoc group)
python METHOD_controller.py routers_adhoc
# Configure switches (adhoc group)
python METHOD_controller.py switches_adhoc
# Configure firewalls (adhoc group)
python METHOD_controller.py firewalls_adhoc
# Configure a single device manually
python METHOD_controller.py manual_device
- routers: Execute commands on all configured routers
- switches: Execute commands on all configured switches
- firewalls: Execute commands on all configured firewalls
- routers_adhoc: Execute commands on ad-hoc router group
- switches_adhoc: Execute commands on ad-hoc switch group
- firewalls_adhoc: Execute commands on ad-hoc firewall group
- manual_device: Configure a single device with manual IP input
When you run the tool, it will prompt for:
- Username: SSH username for network devices
- Password: SSH password for network devices
These credentials are used for all device connections.
The tool includes comprehensive error handling for:
- Network Timeouts: Connection timeouts are handled gracefully
- Authentication Failures: Invalid credentials are reported clearly
- File Errors: Missing or inaccessible files are handled
- Invalid Inputs: Empty or invalid device configurations are caught
- Import Errors: Missing dependencies are reported
The tool provides color-coded output:
- Green: Successful operations and device headers
- Red: Errors and connection failures
- Yellow: Warnings and skipped operations
- Blue: Performance information
The tool tracks execution time and provides feedback:
- Under 20 seconds: "Not Bad... Under 10 seconds"
- Over 20 seconds: "This was a tough one..."
netmiko>=4.2.0
- SSH connection libraryeasygui>=0.98.3
- GUI for credential inputtermcolor>=2.3.0
- Colored terminal outputcolorama>=0.4.6
- Cross-platform color support
datetime
- Time trackingos
- File system operationssys
- System functionsargparse
- Command line parsing
- Credentials are handled securely through GUI prompts
- SSH connections use industry-standard encryption
- No credentials are stored in plain text
- Connection objects are properly cleaned up after use
-
Connection Timeout:
- Verify device IP addresses are correct
- Check network connectivity
- Ensure SSH is enabled on devices
-
Authentication Failure:
- Verify username and password
- Check if credentials have proper access levels
- Ensure SSH authentication is configured correctly
-
File Not Found:
- Verify
ESSENTIAL_commands.txt
exists - Check file permissions
- Ensure working directory is correct
- Verify
-
Import Errors:
- Install missing dependencies:
pip install -r requirements.txt
- Verify Python version compatibility
- Install missing dependencies:
When contributing to this project:
- Maintain the existing code structure
- Add appropriate error handling
- Test with various device configurations
- Update documentation as needed
This project is provided as-is for educational and operational use.
For issues or questions:
- Check the troubleshooting section
- Verify all dependencies are installed
- Test with a single device first
- Review error messages for specific guidance