Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cisco show cdp neighbor details leaves whitespace in capabilities field #683

Closed
moscal65 opened this issue May 4, 2020 · 2 comments · Fixed by #684
Closed

Cisco show cdp neighbor details leaves whitespace in capabilities field #683

moscal65 opened this issue May 4, 2020 · 2 comments · Fixed by #684

Comments

@moscal65
Copy link

moscal65 commented May 4, 2020

  • Bug Report
TEMPLATE USING
Value Required DESTINATION_HOST (\S+)
Value MANAGEMENT_IP (\d+\.\d+\.\d+\.\d+|\w+\.\w+\.\w+)
Value PLATFORM (.*)
Value REMOTE_PORT (.*)
Value LOCAL_PORT (.*)
Value SOFTWARE_VERSION (.*$)
Value CAPABILITIES (.*)

Start
  ^Device ID: ${DESTINATION_HOST}
  ^Entry address\(es\)\s*:\s* -> ParseIP
  ^Platform\s*:\s*${PLATFORM}\s*,\s*Capabilities\s*:\s*${CAPABILITIES}
  ^Interface: ${LOCAL_PORT},  Port ID \(outgoing port\): ${REMOTE_PORT}
  ^Version : -> GetVersion
  # Capture time-stamp if vty line has command time-stamping turned on
  ^Load\s+for\s+
  ^Time\s+source\s+is

ParseIP
  ^.*IP address: ${MANAGEMENT_IP} -> Start
  ^Platform\s*:\s*${PLATFORM}\s*,\s*Capabilities\s*:\s*${CAPABILITIES} -> Start
  ^.* -> Start

GetVersion
  ^${SOFTWARE_VERSION} -> Record Start

SAMPLE COMMAND OUTPUT

Private details omitted

Device ID: switchxxxxx
Entry address(es): 
  IP address: 1.1.1.1
Platform: cisco WS-C3560X-24P,  Capabilities: Switch IGMP 
Interface: GigabitEthernet0/3,  Port ID (outgoing port): GigabitEthernet0/8
Holdtime : 154 sec

Version :
Cisco IOS Software, C3560E Software (C3560E-UNIVERSALK9-M), Version 12.2(55)SE10, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2015 by Cisco Systems, Inc.
Compiled Wed 11-Feb-15 11:28 by prod_rel_team

advertisement version: 2
Protocol Hello:  OUI=0x00000C, Protocol ID=0x0112; payload len=27, value=00000000FFFFFFFF010221FF00000000000000C88BC41880FF0000
VTP Management Domain: ''
Native VLAN: 1
Duplex: full
Power Available TLV:

    Power request id: 0, Power management id: 1, Power available: 0, Power management level: -1
Management address(es): 
  IP address: 1.1.1.1
SUMMARY

See title

STEPS TO REPRODUCE

Using netmiko

show_cdp = self.connection.send_command('show cdp neighbors detail', use_textfsm=True)  # Use TextFSM to parse
pprint(show_cdp)
EXPECTED RESULTS

Capabilities field should not have the whitespace at the end of "Switch IGMP".

ACTUAL RESULTS
{'capabilities': 'Switch IGMP ',
  'destination_host': 'switchxxxxx',
  'local_port': 'GigabitEthernet0/3',
  'management_ip': '1.1.1.1',
  'platform': 'cisco WS-C3560X-24P',
  'remote_port': 'GigabitEthernet0/8',
  'software_version': 'Cisco IOS Software, C3560E Software '
                      '(C3560E-UNIVERSALK9-M), Version 12.2(55)SE10, RELEASE '
                      'SOFTWARE (fc2)'},
@FragmentedPacket
Copy link
Contributor

@prochobo Can you try the attached PR and let me know if that solves your issue?

@moscal65
Copy link
Author

moscal65 commented May 5, 2020

That fixed it. The trailing whitespace is gone. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants