Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Cisco Network Automation with Python (Netmiko + Cisco DevNet)

1 2 Added Routers int ip for SSH capability (Password is 12345678 not admin123)

📌 Project Overview

This project is a Python-based network automation tool that connects to a real Cisco IOS XE device using SSH (via Netmiko) and allows users to run common networking show commands through an interactive command-line menu.

The system is designed to simulate real-world network automation workflows used by network engineers in enterprise environments.

It was tested using the Cisco DevNet Sandbox (Catalyst 8000V Always-On), which provides a real Cisco IOS XE device accessible via SSH.

🚀 Features

  • Interactive CLI menu for Cisco IOS commands
  • SSH connection to real Cisco IOS XE router (DevNet Sandbox)
  • Execution of common "show" commands
  • Loop-based execution (run multiple commands without restarting script)
  • Multi-device structure (easily expandable to multiple routers/switches)
  • Automatic logging of command outputs to local files
  • Error handling for SSH connection issues

🧰 Technologies Used

  • Python 3
  • Netmiko (SSH automation library)
  • Cisco IOS XE (DevNet Sandbox)
  • VS Code
  • SSH (Paramiko backend via Netmiko)

🌐 Lab Environment

This project was tested using:

  • Cisco DevNet Sandbox: Catalyst 8000V Always-On
  • Real Cisco IOS XE device
  • SSH access provided via dynamically generated credentials
  • Public internet-accessible Cisco router instance

⚠️ Note: Credentials are dynamically generated per session in Cisco DevNet Sandbox and are NOT included in this repository for security reasons.

📂 Project Structure

Python-Network-Automation/ │ ├── CLI_Automation_Basic.py # Main Python automation script ├── requirements.txt # Required Python packages └── logs/ # Auto-generated command output logs

⚙️ How It Works

  1. User runs the Python script
  2. Script displays a list of Cisco devices
  3. User selects a device
  4. SSH connection is established using Netmiko
  5. User selects a "show" command from the menu
  6. Command is executed on the Cisco IOS XE device
  7. Output is displayed in the terminal
  8. Output is saved automatically into a log file
  9. User can repeat without restarting the script

🧠 Code Breakdown

Device Configuration

devices = {
    "R1": {
        "device_type": "cisco_ios",
        "host": "devnetsandboxiosxec8k.cisco.com",
        "username": "your_username",
        "password": "your_password",
        "fast_cli": False
    }
}

Command Menu

menu = {
    1: "show version",
    2: "show ip interface brief",
    3: "show vlan brief",
    4: "show spanning-tree",
    5: "show cdp neighbors",
    6: "show ip route",
    7: "exit"
}

Netmiko Connection

from netmiko import ConnectHandler

conn = ConnectHandler(**device)
output = conn.send_command(command, delay_factor=2)

🔥 Key Learning Outcomes

  • SSH automation using Python
  • Working with real Cisco IOS XE devices
  • Network device interaction using Netmiko
  • CLI-based user input systems
  • Logging and output capture
  • Building scalable automation scripts

🚀 Future Improvements

  • Multi-device parallel execution
  • Configuration push (beyond show commands)
  • Web dashboard using Flask
  • Real-time monitoring system
  • RESTCONF / NETCONF integration
  • Export outputs to CSV or Excel

👨‍💻 Author

Jamill Naipao
Network & Systems Administration Focus: Network Automation | Cisco Networking | Python Scripting

📜 License

This project is for educational purposes only.

About

This project is a Python-based network automation tool that connects to a real Cisco IOS XE device using SSH (via Netmiko) and allows users to run common networking show commands through an interactive command-line menu.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages