cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
965
Views
0
Helpful
1
Replies

Script to read from a file and apply port descriptions.

David Rollins
Level 1
Level 1

We are replacing some older 3750 switches, with a 4500 switch. I want to be able to restore connectivity without having to worry about making sure a specific connection is plugged into a specific port (Time constraints).

Is it possible to read a mac address from a file and based on the mac discovered on the port, configure a description for that port. I have found various examples on these forums, but nothing that comes close to what I want to accomplish. 

 

Something like this, but the oui is a variable read from a different file.

https://community.cisco.com/t5/network-management/eem-3-2-mac-address-prefix-gt-switch-port-config-examples/td-p/1813741

1 Reply 1

Seb Rupik
VIP Alumni
VIP Alumni

Hi there,

I am guessing these are access ports you are talking about?...and they are all using the same VLAN?...with the same switchport config?

 

Unless the answer is ‘yes’ to the above three questions you will be walking yourself into patching nightmare if you are planning on unplugging all the cables and then just inserting them at random into your new 4500!

 

…but to answer your question, yes it should be easy enough to write a python script to ssh onto the 4500, read the MAC address table and then cross reference the values to a local file to determine a port description. You could even write some jinga2 switchport templates allowing you to push a variety of different configs to the switchports depending on MAC address.

 

I’d wager about 5 hours to write and test the script… probably considerably longer than it would take to audit your existing 3750 patching!

 

Cheers,

Seb.