What does this skill do?

Network Automation with Netmiko Skill generates and reviews Python scripts that connect to routers, switches, and firewalls via SSH using Netmiko. It always prioritizes read-only operations, implements timeouts and robust exception handling, and requires peer review and an explicit flag before applying any configuration changes in production.

Compilation of Show Performances
It automatically and systematically collects the output of "show" commands from routers, switches, or firewalls.
Configuration Audit
Create audit scripts for interfaces, routes, or configuration evidence across multiple devices.
SSH Error Handling
Implement connection and read timeouts along with exception handling to prevent deadlocks on older devices.
Analysis Using TextFSM
Parse command output using TextFSM templates to extract structured data when a compatible template is available.

Usage examples

📋 Read-only collection
Write a Python script using Netmiko that connects to a Cisco switch and runs 'show ip interface brief' with error handling and timeouts.
🔍 Batch Audit
Create a script that iterates through a list of 10 routers, runs 'show running-config' on each one, and returns a list containing the hostname, status, and either the output or an error message.
📊 Parsing with TextFSM
Generate a script that runs 'show interfaces' on multiple devices and parses the output using TextFSM to obtain a list of dictionaries containing the name, status, and IP address.
🛡️ Protected Switch (Dry Run)
Write a script that changes the description of the GigabitEthernet0/1 interface, but only applies the change if the APPLY_NETWORK_CHANGES environment variable is set to 1.

Features

Read-only operations by default The skill always prioritizes data collection using `send_command()` before making any configuration changes.
Timeouts and Exception Handling Set `conn_timeout`, `auth_timeout`, and `read_timeout` to prevent deadlocks on older devices, and catch `NetmikoAuthenticationException`, `NetmikoTimeoutException`, and `ReadTimeout`.
Protected Configuration Changes It requires an explicit operator flag (environment variable) before using `send_config_set()` and does not execute `save_config()` until the change has been verified.
Structured Analysis with TextFSM Parse command output using TextFSM templates to extract structured data when a compatible template is available.
Fault-tolerant batch processing Batch scripts return a list of dictionaries containing the host, status, and output or error, ensuring that a device failure does not halt the process.

Frequently asked questions

Python with the Netmiko library installed (pip install netmiko) and SSH access to network devices. It is also recommended to install TextFSM for structured parsing of output.
No. By default, it operates in read-only mode. Configuration changes require an explicit flag (the APPLY_NETWORK_CHANGES=1 environment variable), peer review, and a rollback plan.
The skill recommends using environment variables, a secret manager, or getpass. Never hard-code credentials into the source code.
Any device supported by Netmiko: routers, switches, and firewalls from Cisco, Juniper, Arista, HP, Fortinet, and other manufacturers with SSH enabled.
Network Automation with Netmiko — Secure Templates with Claude AI

¿Prefieres escuchar el contenido? Genera la narración de audio con un clic.