Tuesday, May 25, 2021

Sharing my python script to automatically clear port security and reset err-disabled ports

A few people asked about this script in another post, so thought I would share it in hopes it helps others. This script uses textfsm and scans cisco IOS switches for ports in err-disabled mode, then selects those interfaces and does a "shut, clear port-security all, no shut". I know setting up err-disable recovery would avoid all this, but I am new to python and was looking to automate this with netmiko for learning purposes and to also have a baseline script to do anything I want with after making a few changes. For example, I also use this same script to shutdown unused ports in specific vlans just by making a few minor changes.

But anyways here it is, hopefully some people find it useful.

https://github.com/Alston518/Netmiko/commit/8432c1e535a88b395e2e67ad4ff4169db698979b

u/spaceman_sloth u/SlimLowJack

Also, thanks for all the people from r/networking that assisted me in getting this together by answering any questions I had when putting this script together. The support on the sub is amazing!



No comments:

Post a Comment