Welcome, Guest. Please login or register.

Author Topic: Bulk Disabling of certain ports (NeDi 1.9.100)  (Read 2479 times)

Westy_87

  • Newbie
  • *
  • Posts: 14
    • View Profile
Bulk Disabling of certain ports (NeDi 1.9.100)
« on: September 24, 2021, 05:42:39 am »
Good Day Everyone,

In my organisation we are going to disable any non-trunk Ethernet port that has been inactive for over 14 days. Now, this job has fallen to me and it appears that there are close to 500 switches I'll need to sort through.

There is an EEM policy getting around the web that apparently achieves this (I've modified to not shut trunk ports) but I believe it needs to be running on the switch for at least the period of time defined before it can work, so if I apply it today I still have to wait 14 days for it to work.

What I would like to know, is if I can use NeDi to do bulk shut of interfaces. I found out quite by accident that I can shut an interface by clicking on the interface symbol in the interfaces list. If I could somehow get this to work on a defined set of interfaces that would be awesome, rather than 1 by 1.

I tried sorting in interfaces:
Interfaces Type = 6 (ethernet)
Status = 1 (operational down)
PVID = 0 (This should hopefully not include trunk ports?)
***Last Change > 14 days????
(I can't figure out what to put in to filter by last change > 14 days.)

Then once I have the list, any idea if it's possible for NeDi to do bulk shut of all those interfaces?

Also open to any other ideas!

We have Ansible in our environment but I have limited experience with it, though I feel I could use it to query switches and maybe the 'Last in' time per interface. Any Ansible experts here?

ascii

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Bulk Disabling of certain ports (NeDi 1.9.100)
« Reply #1 on: September 27, 2021, 11:36:05 am »
well i'm not sure if NeDi can do it.

i normaly get all the devices from NeDi and than use the list as in input for a shell script which  is running on the NeDi host.
you would need to modify the attached scripts a bit to fit your needs.
you will also need to have expect installed

basicly you will have a start script that reads the list line per line.
calls the actual ssh script with the parameters.
these parameters can be used in the script to connect to a switch and run predefined commands.

in this script i'm changing the network part of the IP and move it to a new subnet. so it will extract the  the last octet of the ip and send as parameter D to the actual changing script.
you would need to read the IP and port from your input file and hand it over.


in order to get the list try this under device -> interface

Last change <= 09/13/21 00:00

« Last Edit: September 27, 2021, 11:46:27 am by ascii »

Saguu

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Bulk Disabling of certain ports (NeDi 1.9.100)
« Reply #2 on: September 29, 2021, 08:06:47 am »
Hello,

You can also use Python with Netmiko.
For example : https://github.com/tnielsen2/cisco-port-shutdown