SSH-based toolkit for routine Cisco IOS administration — health checks, interface validation, connectivity tests, config backups, and simple health reports.
Developed against a small lab of Catalyst switches and an ISR router. Works with Netmiko for day-to-day sessions, with a Paramiko fallback when Netmiko can't negotiate a session cleanly.
Manual checks across a handful of switches get old fast. This project automates the boring parts:
- Pull hostname, IOS version, uptime, CPU, memory, serial, and model
- Flag interfaces that are admin-up / protocol-down, or accumulating CRC / input errors
- Ping gateway, DNS, and a management server from each device
- Archive
running-configandstartup-config - Emit CSV + JSON + text summaries so results are easy to skim or hand to someone else
It's intentionally small. No inventory database, no web UI — YAML in, reports out.
devices.yaml ──► inventory.py ──► main.py (CLI)
│
▼
ssh_manager.py
(Netmiko → Paramiko)
│
┌─────────────┬─────────────┼─────────────┬──────────────┐
▼ ▼ ▼ ▼ ▼
health_check interface_val connectivity config_backup report_generator
| Module | Role |
|---|---|
ssh_manager.py |
Session lifecycle, enable mode, Paramiko fallback |
health_check.py |
show version / CPU / memory parsing |
interface_validator.py |
show interfaces + issue rules |
connectivity.py |
Device-originated pings |
config_backup.py |
Config archival under backups/ |
report_generator.py |
CSV / JSON / text output |
demo_data.py |
Canned CLI output for offline demos |
network-automation/
├── README.md
├── requirements.txt
├── .gitignore
├── config/
│ ├── devices.yaml # inventory
│ └── settings.yaml # timeouts, thresholds, ping targets
├── reports/ # generated reports land here
├── logs/ # automation.log
├── backups/ # running/startup configs
├── output/ # scratch / misc output
├── src/
│ ├── main.py
│ ├── ssh_manager.py
│ ├── health_check.py
│ ├── interface_validator.py
│ ├── connectivity.py
│ ├── config_backup.py
│ ├── inventory.py
│ ├── report_generator.py
│ ├── demo_data.py
│ ├── utils.py
│ └── exceptions.py
└── tests/
- Python 3.9+
- Network reachability to devices on TCP/22 (or your SSH port)
- Local credentials with privilege to run show commands (enable secret if needed)
Python packages (see requirements.txt):
- netmiko
- paramiko
- PyYAML
- pytest (tests only)
git clone <repo-url>
cd network-automation # or repo root
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtEdit config/devices.yaml:
devices:
- name: core-sw-01
host: 192.168.10.1
device_type: cisco_ios
username: netadmin
password: "LabPass123"
secret: "LabEnable123"
port: 22
site: hq-core
role: distributionNotes:
device_typemust be a Netmiko platform key (cisco_iosfor most Catalyst/ISR boxes).- Prefer keeping real passwords out of git — copy to
config/devices.local.yaml(gitignored) or swap credentials before running. - Optional fields (
site,role) are informational and show up inlist-devices.
Global knobs live in config/settings.yaml (timeouts, CPU/memory thresholds, ping targets, demo_mode).
# inventory sanity check
./run.sh list-devices
# or: python src/main.py list-devices
# health only (one device)
python src/main.py health -d core-sw-01
# interfaces / connectivity / backups
python src/main.py interfaces
python src/main.py connectivity
python src/main.py backup -d edge-rtr-01
# everything + reports
python src/main.py full-report
# offline demo (no SSH) — uses canned show/ping output
python src/main.py --demo full-report
# debug logging
python src/main.py -v healthExit codes: 0 ok, 1 usage/inventory error, 2 one or more devices failed checks.
$ python src/main.py --demo full-report
=== Summary ===
Devices checked : 4
Failed devices : access-sw-02
Warnings : 1
Interface issues: 4
CSV report : reports/health_report_20260728_143022.csv
JSON report : reports/full_report_20260728_143022.json
Text summary : reports/health_summary_20260728_143022.txt
Text summary excerpt:
============================================================
NETWORK HEALTH SUMMARY
============================================================
Generated: 2026-07-28T14:30:22
Devices checked: 4
Failed devices (1):
- access-sw-02
Warnings (1):
- access-sw-02: High CPU (5min avg 81%)
Interface issues (4):
- access-sw-01 GigabitEthernet0/2: admin up but line protocol down
- access-sw-01 GigabitEthernet0/5: CRC errors: 188
- access-sw-02 GigabitEthernet0/10: CRC errors: 940
...
Sample reports from a lab/demo run are checked in under reports/sample/.
Placeholder — drop terminal captures here when documenting a lab run.
- Parsing is regex-based against classic IOS output. IOS-XE / NX-OS quirks will need tweaks.
- Paramiko fallback is intentionally minimal (no full Netmiko feature parity).
- No parallel device sessions yet — large inventories will be slow (fine for a small lab batch).
- Interface validation skips
Null/Loopback/Vlanby default; adjust if you care about SVIs. - Credentials in YAML are plain text. Fine for a lab, not fine for production secrets management.
- Threaded / async device workers
- Diff last two config backups and email on change
- NAPALM getters as an optional backend
- Slack / email notification hook for failed devices
- Richer interface baselines (expected speed/duplex per port)
pytest -qParser tests run fully offline.
Personal / portfolio project. Use and adapt as you like.

