cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1200
Views
0
Helpful
5
Replies

EEM configuring the Interface Description from LLDP on Cat9300

Seven11
Level 1
Level 1

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?

5 Replies 5

Mohamed Alhenawy
Spotlight
Spotlight

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"

 

Hi @Mohamed Alhenawy 

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

Mohamed Alhenawy
Spotlight
Spotlight

hi @Seven11 

most welcome , Please share show event manager environment

Switch#show event manager environment
Switch#

Its empty.

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.