Beginner Tutorials
Beginner TutorialsΒΆ
"Master the Fundamentals β Build Confidence with Simple, Working Scripts"ΒΆ
Welcome to the Beginner Tutorial Series! These tutorials are designed for network engineers who are new to Python automation or want to solidify their understanding of core concepts.
Each tutorial provides complete, working code with exhaustive line-by-line explanations. You'll understand exactly what every line does, why it's there, and how to modify it for your own use.
π― What You'll LearnΒΆ
By completing these beginner tutorials, you'll be able to:
- β Connect to Cisco devices using Netmiko
- β Send show commands and retrieve structured data
- β Parse command output using TextFSM
- β Export data to Excel spreadsheets
- β Retrieve and archive running configurations
- β Create timestamped backups with organized directory structures
- β Handle basic errors and exceptions
- β Manage credentials securely (without hardcoding passwords)
- β Work with multiple devices using loops and CSV inventory
π Tutorial ListΒΆ
1. Send a Show Command and Export to ExcelΒΆ
The perfect starting point for network automation beginners.
Learn how to:
- Connect to a Cisco device using Netmiko
- Execute a show command with automatic TextFSM parsing
- Convert the structured data to an Excel spreadsheet using pandas
- Understand every line of code with detailed explanations
What You'll Build: A script that collects show version output and exports it to Excel.
Prerequisites: Basic Python knowledge only.
2. Multi-Device Show Command CollectionΒΆ
Build on Tutorial #1 to handle multiple devices from a CSV inventory.
Learn how to:
- Manage device inventory using CSV files
- Loop through multiple devices efficiently
- Handle per-device errors gracefully (one failure doesn't stop the job)
- Export results to a single Excel file with multiple sheets
- Provide user feedback during long operations
What You'll Build: Evolve your single-device script into a multi-device automation tool.
Prerequisites: Complete Tutorial #1 first.
3. Multi-Device Configuration BackupΒΆ
Build on Tutorial #2 to create a production-grade backup system.
Learn how to:
- Retrieve running configurations from network devices
- Save configs to timestamped backup files
- Organize backups by device and create directory structures
- Generate a backup manifest (Excel report of what was backed up)
- Handle backup validation and error recovery
- Implement file I/O and directory management in Python
What You'll Build: An automated configuration backup tool that saves configs to organized directories with metadata tracking.
Prerequisites: Complete Tutorial #2 first.
π§ Setup RequirementsΒΆ
Before starting these tutorials, ensure you have:
Python EnvironmentΒΆ
Test Device AccessΒΆ
You'll need at least one Cisco device (physical or virtual) with:
- SSH enabled
- Reachable IP address
- Valid username and password
- Appropriate privilege level for show commands
Supported PlatformsΒΆ
These tutorials work with:
- Cisco IOS
- Cisco IOS-XE
- Cisco NX-OS
- Cisco IOS-XR (with minor modifications)
π‘ How to Use These TutorialsΒΆ
- Read the Explanation β Each tutorial starts with an overview
- Review the Code β Complete, working script with annotations
- Understand Each Line β Detailed line-by-line breakdown
- Run It Yourself β Test on your own devices
- Experiment β Modify the code to learn how it works
π Learning PathΒΆ
We recommend working through these tutorials in order:
graph LR
A[1. Show Command to Excel] --> B[2. Multi-Device Collection]
B --> C[3. Configuration Backup]
C --> D[Ready for Intermediate!]
style A fill:#90EE90
style B fill:#90EE90
style D fill:#FFD700
After Completing Beginner Tutorials
Once you're comfortable with these concepts, move on to Intermediate Tutorials to learn about threading, advanced parsing, and configuration management.
π Troubleshooting TipsΒΆ
Common Issues:
- Authentication fails: Verify SSH is enabled and credentials are correct
- TextFSM parsing returns empty: Your device type might not be supported β try
use_textfsm=Falsefirst - Module not found: Run
pip install netmiko pandas openpyxl - Connection timeout: Check network connectivity and firewall rules
π Additional ResourcesΒΆ
- Netmiko Documentation β Official Netmiko guide
- TextFSM Templates β See all available parsing templates
- Pandas Documentation β Learn more about data manipulation