Script that sets port alias based on LLDP; Update Alias if device moved.

  • 1
  • Idea
  • Updated 3 weeks ago
  • (Edited)
Anyone come up with a good idea for automating port aliases?
Being able to run a script on the that sets port description based on lldp would be useful. 
Or if a device gets moved having a way to move the alias with the device would be useful.

Photo of Byron Morales

Byron Morales

  • 272 Points 250 badge 2x thumb

Posted 3 weeks ago

  • 1
Photo of Ed Uhler

Ed Uhler, Employee

  • 160 Points 100 badge 2x thumb
Photo of Byron Morales

Byron Morales

  • 272 Points 250 badge 2x thumb
Hi Ed,

I've never used UPM scripting before. Is there a document for the syntax or variables that can be used to create a UPM script?
Photo of Tomasz

Tomasz

  • 1,642 Points 1k badge 2x thumb
You can use TCL or Python scripts in EXOS to do show lldp for each port (or IMO better for all ports at once), and then take the Neighbor System-Name from $CLI.OUT variable (that needs some parsing definitely, perhaps you would feel better with Python scripts instead of TCL) and issue configure port display-string for each port. That would be a one-shot port alias syncing.

I believe it could also work with a UPM script with an LLDP trigger (configure upm event device-detect profile <update script name> port <port list>). Also device-undetected trigger with another script should be there so once a device goes away port alias turns blank.

HTH,
Tomasz
Photo of Byron Morales

Byron Morales

  • 272 Points 250 badge 2x thumb
Nice thanks Tomasz. I've made a few simple TCL's before, no python scripts or UPM's although but I can usually put something together if there's an example I can work off of.
Photo of Tomasz

Tomasz

  • 1,642 Points 1k badge 2x thumb
I believe Ed's link to another topic is a good starting point for this kind of UPM, take also care about scripting and UPM chapters here: https://documentation.extremenetworks.com/exos_22.5/EXOS_User_Guide_22_5.pdf

Regards,
Tomasz

Photo of SH

SH

  • 4,792 Points 4k badge 2x thumb
Hello Byron,

another approach can be to use XMC (if available).

Because you wrote you have some experience with TCL it's a good starting point.
You can write a TCP script to ask the switches for LLDP infos ( simplified do an "show lldp neighbour detail") via cli and parse the output.

In an second step wrote the infos back as port alias via CLI.

This can be done in one script. No UPM needed. Only CLI knowledge and a little bit TCL for parsing.

One big advantage of XMC is you do not need to transport the script to every switch. Just do it centrally. Select all of you switches and start the script.

Best regards
Stephan
(Edited)