06-19-2023 09:04 AM
How can i automatically set the Description of an Interface using LLDP?
CDP works fine but LLDP not.
Running CDP Version:
event manager applet update-port-description
event neighbor-discovery interface regexp GigabitEthernet.* cdp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_name"
action 4.0 cli command "description $_nd_cdp_entry_name:$_nd_port_id"
"Not" running LLDP Version:
event manager applet update-port-description2
event neighbor-discovery interface regexp GigabitEthernet.* lldp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_name"
action 4.0 cli command "description $_nd_lldp_system_name:$_nd_lldp_port_description"
Log / Debug Log:
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : CTL : cli_open called.
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : OUT : switch>
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : IN : switch>enable
%PARSER-5-CFGLOG_LOGGEDCMD: User:unknown user logged command:!exec: enable
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : OUT : switch#
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : IN : switch#config t
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : OUT : Enter configuration commands, one per line. End with CNTL/Z.
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : OUT : switch(config)#
%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: _nd_local_intf_name
%HA_EM-3-FMPD_ERROR: Error executing applet update-port-description2 statement 3.0
%HA_EM-6-LOG: update-port-description2 : DEBUG(cli_lib) : : CTL : cli_close called.
tty is now going through its death sequence
Why is $_nd_local_intf_name which is used in the cdp example not found in lldp?
06-19-2023 10:11 AM
Hi @Seven11
The variable of (((( action 3.0 cli command "interface $_nd_local_intf_name" )))) represents the local interface name for the CDP event. However, for LLDP, the equivalent variable is different. In the case of LLDP (( action 3.0 cli command "interface $_nd_local_intf_name"))) , you should use $_nd_local_intf_id instead.
Here's an updated version of your applet using the correct variable for LLDP:
event manager applet update-port-description2
event neighbor-discovery interface regexp GigabitEthernet.* lldp add
action 1.0 cli command "enable"
action 2.0 cli command "config t"
action 3.0 cli command "interface $_nd_local_intf_id"
action 4.0 cli command "description $_nd_lldp_system_name:$_nd_lldp_port_description"
06-20-2023 12:57 AM
thanks for the quick answer.
Ive tried it with your Version but the result is the same:
%HA_EM-3-FMPD_UNKNOWN_ENV: fh_parse_var: could not find environment variable: _nd_local_intf_id
06-20-2023 07:45 AM
hi @Seven11
most welcome , Please share show event manager environment
06-20-2023 08:02 AM
Switch#show event manager environment
Switch#
Its empty.
06-20-2023 08:55 AM
You can use SNMP queries to retrieve LLDP information from the device and then update the interface description accordingly. SNMP libraries or tools can help you achieve this programmatically.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide