ntc-templates
ntc-templates copied to clipboard
cisco_nxos_show_lldp_neighbor_detail
ISSUE TYPE
- Bug Report
TEMPLATE USING
Value Required NEIGHBOR (\S+)
Value Required LOCAL_INTERFACE (\S+)
Value Required NEIGHBOR_INTERFACE (\S+)
Value CHASSIS_ID (\w+?\.\w+?\.\w+?)
Value MGMT_ADDRESS (\d+?\.\d+?\.\d+?\.\d+?|\w+?\.\w+?\.\w+?)
Value SYSTEM_DESCRIPTION (.*)
Value CAPABILITIES (.*)
Value VLAN ([0-9]+)
Start
^[Cc]hassis\s[idID]{2}\:\s${CHASSIS_ID}$$
^[Pp]ort\s[idID]{2}\:\s${NEIGHBOR_INTERFACE}$$
^[Ll]ocal\s[Pp]ort\s[idID]{2}\:\s${LOCAL_INTERFACE}$$
^[Ss]ystem\s[Nn]ame\:\s${NEIGHBOR}$$
^[Ss]ystem\s[Dd]escription\:\s${SYSTEM_DESCRIPTION}$$
^[Ee]nabled\s[Cc]apabilities\:\s${CAPABILITIES}$$
^[Mm]anagement\s[Aa]ddress\:\s${MGMT_ADDRESS}$$
^[Vv]lan\s[idID]{2}\:\s${VLAN}$$ -> Record
^[Vv]lan\s[idID]{2}\:\snot advertised -> Record
SAMPLE COMMAND OUTPUT
! All chassis IDs have been set to 0000.0000.0000 and all Mgmt IPs 192.168.100.100 (2001:DB8::/32) to anonymize the data
r1-services# show lldp neighbor detail
Capability codes:
(R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device
(W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other
Device ID Local Intf Hold-time Capability Port ID
Chassis id: 0000.0000.0000
Port id: Gi1/0/37
Local Port id: mgmt0
Port Description: key:Te1/0/37:r1-services:mgmt0
System Name: dcx3.org.local
System Description: Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.6.5, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Mon 10-Dec-18 11:34 by
Time remaining: 107 seconds
System Capabilities: B, R
Enabled Capabilities: B
Management Address: 192.168.100.100
Management Address IPV6: not advertised
Vlan ID: 699
Chassis id: 0000.0000.0000
Port id: Eth1/1
Local Port id: Eth1/1
Port Description: Ethernet1/1
System Name: r2-services
System Description: Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, In
c. Compiled 4/30/2018 23:00:00
Time remaining: 90 seconds
System Capabilities: B, R
Enabled Capabilities: B, R
Management Address: 192.168.100.100
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: Te1/1/1
Local Port id: Eth1/3
Port Description: #t1/1/1:r2-services:e1/3
System Name: dx1.org.local
System Description: Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.6.5, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Mon 10-Dec-18 12:52 by mcpre
Time remaining: 118 seconds
System Capabilities: B, R
Enabled Capabilities: B
Management Address: 192.168.100.100
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: ethernet1/9
Local Port id: Eth1/5
Port Description: 9 <-> r1-services e1/5
System Name: fw1-clinical-partner
System Description: not advertised
Time remaining: 97 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: ethernet1/10
Local Port id: Eth1/6
Port Description: 10 <-> r1-services e1/6
System Name: fw1-clinical-partner
System Description: not advertised
Time remaining: 98 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: ethernet1/9
Local Port id: Eth1/7
Port Description: 9 <-> r1-services e1/5
System Name: fw2-clinical-partner
System Description: not advertised
Time remaining: 117 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: ethernet1/10
Local Port id: Eth1/8
Port Description: 10 <-> r1-services e1/6
System Name: fw2-clinical-partner
System Description: not advertised
Time remaining: 119 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: Fo1/0/8
Local Port id: Eth3/1
Port Description: #For1/0/8:cr-ebc<->r1-services-ebc:Eth3/1
System Name: cr-ebc.org.local
System Description: Cisco IOS Software [Gibraltar], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.12.5b, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2021 by Cisco Systems, Inc.
Compiled Thu 25-Mar-21 13:21 by mcpre
Time remaining: 91 seconds
System Capabilities: B, R
Enabled Capabilities: B, R
Management Address: 192.168.100.100
Management Address IPV6: 2001:DB8::1
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: Eth3/13
Local Port id: Eth3/13
Port Description: vpc-peerlink
System Name: r2-services
System Description: Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, In
c. Compiled 4/30/2018 23:00:00
Time remaining: 119 seconds
System Capabilities: B, R
Enabled Capabilities: B, R
Management Address: 192.168.100.100
\
Vlan ID: 1
Chassis id: 0000.0000.0000
Port id: ethernet1/21
Local Port id: Eth3/23
Port Description: r1-services
System Name: fw1-services
System Description: not advertised
Time remaining: 115 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
\ not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: ethernet1/23
Local Port id: Eth3/24
Port Description: r2-services e1/24
System Name: fw2-services
System Description: not advertised
Time remaining: 117 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
\ not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: Fo1/0/8
Local Port id: Eth4/1
Port Description: #For1/0/8:cr-park<->r1-services-ebc:Eth4/1
System Name: cr-park.org.local
System Description: Cisco IOS Software [Gibraltar], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.12.5b, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2021 by Cisco Systems, Inc.
Compiled Thu 25-Mar-21 13:21 by mcpre
Time remaining: 99 seconds
System Capabilities: B, R
Enabled Capabilities: B, R
Management Address: 192.168.100.100
Management Address IPV6: 2001:DB8::3
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: Eth4/13
Local Port id: Eth4/13
Port Description: vpc-peerlink
System Name: r2-services
System Description: Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, In
c. Compiled 4/30/2018 23:00:00
Time remaining: 90 seconds
System Capabilities: B, R
Enabled Capabilities: B, R
Management Address: 192.168.100.100
Management Address IPV6: not advertised
Vlan ID: 1
Chassis id: 0000.0000.0000
Port id: ethernet1/22
Local Port id: Eth4/23
Port Description: r1-services
System Name: fw1-services
System Description: not advertised
Time remaining: 115 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
Management Address IPV6: not advertised
Vlan ID: not advertised
Chassis id: 0000.0000.0000
Port id: ethernet1/24
Local Port id: Eth4/24
Port Description: r2-services e3/24
System Name: fw2-services
System Description: not advertised
Time remaining: 117 seconds
System Capabilities: not advertised
Enabled Capabilities: not advertised
Management Address: not advertised
Management Address IPV6: not advertised
Vlan ID: not advertised
Total entries displayed: 15
SUMMARY
When parsing the list of neighbors, not all neighbors create records.
STEPS TO REPRODUCE
from ntc_templates.parse import parse_output
show = (
"Capability codes:\n (R) Router, (B) Bridge, (T) Telephone, (C) DOCSIS Cable Device\n (W) WLAN Access Point, (P) Repeater, (S) Station, (O) Other\nDevice ID Local Intf Hold-time Capability Port ID \n\nChassis id: 0000.0000.0000\nPort id: Gi1/0/37\nLocal Port id: mgmt0\nPort Description: key:Te1/0/37:r1-services:mgmt0\nSystem Name: dcx3-179ebc-cbnmgmt.org.local\nSystem Description: Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.6.5, RELEASE SOFTWARE (fc3)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2018 by Cisco Systems, Inc.\nCompiled Mon 10-Dec-18 11:34 by \nTime remaining: 107 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B\nManagement Address: 192.168.100.100\nManagement Address IPV6: not advertised\nVlan ID: 699\n\n\nChassis id: 0000.0000.0000\nPort id: Eth1/1\nLocal Port id: Eth1/1\nPort Description: Ethernet1/1\nSystem Name: r2-services\nSystem Description: Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, Inc. Compiled 4/30/2018 23:00:00\nTime remaining: 110 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B, R\nManagement Address: 192.168.100.100\nManagement Address IPV6: 7018.a77e.04ec\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: Te1/1/1\nLocal Port id: Eth1/3\nPort Description: #t1/1/1:r2-services:e1/3\nSystem Name: dx1.org.local\nSystem Description: Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.6.5, RELEASE SOFTWARE (fc3)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2018 by Cisco Systems, Inc.\nCompiled Mon 10-Dec-18 12:52 by mcpre\nTime remaining: 119 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B\nManagement Address: 192.168.100.100\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/9\nLocal Port id: Eth1/5\nPort Description: 9 <-> r1-services e1/5\nSystem Name: fw1-clinical-partner\nSystem Description: not advertised\nTime remaining: 117 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/10\nLocal Port id: Eth1/6\nPort Description: 10 <-> r1-services e1/6\nSystem Name: fw1-clinical-partner\nSystem Description: not advertised\nTime remaining: 118 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/9\nLocal Port id: Eth1/7\nPort Description: 9 <-> r1-services e1/5\nSystem Name: fw2-clinical-partner\nSystem Description: not advertised\nTime remaining: 107 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/10\nLocal Port id: Eth1/8\nPort Description: 10 <-> r1-services e1/6\nSystem Name: fw2-clinical-partner\nSystem Description: not advertised\nTime remaining: 109 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: Fo1/0/8\nLocal Port id: Eth3/1\nPort Description: #For1/0/8:cr-ebc<->r1-services-ebc:Eth3/1\nSystem Name: cr-ebc.org.local\nSystem Description: Cisco IOS Software [Gibraltar], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.12.5b, RELEASE SOFTWARE (fc3)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2021 by Cisco Systems, Inc.\nCompiled Thu 25-Mar-21 13:21 by mcpre\nTime remaining: 92 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B, R\nManagement Address: 192.168.100.100\nManagement Address IPV6: 2001:DB8::1\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: Eth3/13\nLocal Port id: Eth3/13\nPort Description: vpc-peerlink\nSystem Name: r2-services\nSystem Description: Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, Inc. Compiled 4/30/2018 23:00:00\nTime remaining: 109 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B, R\nManagement Address: 192.168.100.100\nManagement Address IPV6: 34f8.e7a5.4624\nVlan ID: 1\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/21\nLocal Port id: Eth3/23\nPort Description: r1-services\nSystem Name: fw1-services\nSystem Description: not advertised\nTime remaining: 105 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/23\nLocal Port id: Eth3/24\nPort Description: r2-services e1/24\nSystem Name: fw2-services\nSystem Description: not advertised\nTime remaining: 107 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: Fo1/0/8\nLocal Port id: Eth4/1\nPort Description: #For1/0/8:cr-park<->r1-services-ebc:Eth4/1\nSystem Name: cr-park.org.local\nSystem Description: Cisco IOS Software [Gibraltar], Catalyst L3 Switch Software (CAT9K_IOSXE), Version 16.12.5b, RELEASE SOFTWARE (fc3)\nTechnical Support: http://www.cisco.com/techsupport\nCopyright (c) 1986-2021 by Cisco Systems, Inc.\nCompiled Thu 25-Mar-21 13:21 by mcpre\nTime remaining: 101 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B, R\nManagement Address: 192.168.100.100\nManagement Address IPV6: 2001:DB8::3\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: Eth4/13\nLocal Port id: Eth4/13\nPort Description: vpc-peerlink\nSystem Name: r2-services\nSystem Description: Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, Inc. Compiled 4/30/2018 23:00:00\nTime remaining: 110 seconds\nSystem Capabilities: B, R\nEnabled Capabilities: B, R\nManagement Address: 192.168.100.100\nManagement Address IPV6: 34f8.e7a5.8c74\nVlan ID: 1\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/22\nLocal Port id: Eth4/23\nPort Description: r1-services\nSystem Name: fw1-services\nSystem Description: not advertised\nTime remaining: 105 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\n\nChassis id: 0000.0000.0000\nPort id: ethernet1/24\nLocal Port id: Eth4/24\nPort Description: r2-services e3/24\nSystem Name: fw2-services\nSystem Description: not advertised\nTime remaining: 107 seconds\nSystem Capabilities: not advertised\nEnabled Capabilities: not advertised\nManagement Address: not advertised\nManagement Address IPV6: not advertised\nVlan ID: not advertised\n\nTotal entries displayed: 15\n"
)
parse = parse_output(platform="cisco_nxos",command="show lldp neighbors detail",data=show)
print(parse)
EXPECTED RESULTS
All 15 records should generate a record in the parse output.
ACTUAL RESULTS
We only see 4 devices out of the 15. I cannot see a difference in the records that work and those that do not so I'm not sure if it is a regex parsing error or something else causing the records to not all show up.
[{"neighbor": "dcx3.org.local", "local_interface": "mgmt0", "neighbor_interface": "Gi1/0/37", "chassis_id": "0000.0000.0000", "mgmt_address": "192.168.100.100", "system_description": "Cisco IOS Software [Everest], Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 16.6.5, RELEASE SOFTWARE (fc3)", "capabilities": "B", "vlan": "699"}, {"neighbor": "r2-services", "local_interface": "Eth3/13", "neighbor_interface": "Eth3/13", "chassis_id": "0000.0000.0000", "mgmt_address": "192.168.100.100", "system_description": "Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, Inc. Compiled 4/30/2018 23:00:00", "capabilities": "B, R", "vlan": "1"}, {"neighbor": "r2-services", "local_interface": "Eth4/13", "neighbor_interface": "Eth4/13", "chassis_id": "0000.0000.0000", "mgmt_address": "192.168.100.100", "system_description": "Cisco NX-OS(tm) n7700, Software (n7700-s2-dk9), Version 8.2(2), RELEASE SOFTWARE Copyright (c) 2002-2018 by Cisco Systems, Inc. Compiled 4/30/2018 23:00:00", "capabilities": "B, R", "vlan": "1"}, {"neighbor": "fw2-services", "local_interface": "Eth4/24", "neighbor_interface": "ethernet1/24", "chassis_id": "0000.0000.0000", "mgmt_address": "", "system_description": "", "capabilities": "", "vlan": ""}]
Related to Issue #1166 (where it is the brief output and this is the detailed)
Update: Related as in they both pertain to LLDP template, but that's it. :roll_eyes: :man_facepalming:
@IamBuldog I see several backslashes in the sample output and labels for output lines that appear they're missing. Is there an issue with the sample output?
Chassis id: 0000.0000.0000
Port id: ethernet1/21
Local Port id: Eth3/23
Port Description: r1-services
... snipped ...
Management Address: not advertised
\ not advertised
Vlan ID: not advertised
So far the only thing I've noticed is that for some neighbors MGMT_ADDRESS
and/or VLAN_ID
are not being parsed (possibly because they show up as "not advertised").
Edit: I do not experience an error with either your sample output nor your sample Python code. Both parse without error. Maybe something came along that fixed this since December 2022?
@mjbear - It's possible something has fixed this in newer versions, I haven't tested recently. I'll update to the latest instance of ntc-templates and re-run script using a direct pull from our production switches to test. It'll take a few days bit to do that but I'll try to reply before Jan 20.
Can we close this?
Yes. It works in textfsm 1.1.3 installed via PIP3