Your browser failed to load CSS style sheets. Your browser or web proxy might not support elliptic-curve TLS

Building network automation solutions

9 module online course

Start now!
back to overview

Automation Solution: Create Switch Stack Reports

Have you ever wondered how many free ports you have on your stackable campus switches? I’m sure there must be a wonderful network management tool that creates that reports with a click of a button… but what if the tool your PHB purchased based on awesome PowerPoint and glitzy demo can’t do that?

Nadeem Lughmani decided to solve this challenge as a hands-on assignment in the Building Network Automation Solutions online course and created an Ansible playbook and a Python plugin that counts the total number of ports and number of free ports for each switch stack specified in the device inventory.

Wonder what else course attendees created in the past? Here’s a small sample.

Please read our Blog Commenting Policy before writing a comment.

3 comments:

  1. That's a great script but it misses one key point in campus networks: how do you know if a down port is actually unused?

    Collecting the ifLastChange value helps to find down ports for a long time, meaning they are most likely to be actually down and free.

    I've implemented it using SNMP as a CLI tool, it works to check one switch at a time:
    https://github.com/routetonull/unpatchable


    A better implementation with Ansible could scale the solution to the whole campus network.

    ReplyDelete
    Replies
    1. You're totally correct... and it absolutely annoys me that I can't figure out how to get that information with a SHOW command ;))

      As for scaling - if you don't care about performance, you could just modify your script to return JSON data structure and then slap Ansible on top of that to handle inventory etc.

      Delete
  2. Automating TDR test and catching 0m could be a viable solution for down ports. That's what I do manually to re-check reports of "a wonderful network management tool".

    ReplyDelete

Constructive courteous comments are most welcome. Anonymous trolling will be removed with prejudice.

Sidebar