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 IOS show cdp neighbors issue #727

Closed
alepodj opened this issue May 24, 2020 · 6 comments
Closed

Cisco IOS show cdp neighbors issue #727

alepodj opened this issue May 24, 2020 · 6 comments

Comments

@alepodj
Copy link
Contributor

alepodj commented May 24, 2020

ISSUE TYPE
  • Bug Report
TEMPLATE USING
Value Required NEIGHBOR (\S+)
Value LOCAL_INTERFACE (\S+(?:\s\S+)?)
Value CAPABILITY ((?:\w\s*?)*?)
Value PLATFORM (\S{2,}\s\S+|\S{2,})
Value NEIGHBOR_INTERFACE ([a-zA-Z]\S+(?:\s\S+)?)

Start
  ^Device.*ID -> CDP
  # Capture time-stamp if vty line has command time-stamping turned on
  ^Load\s+for\s+
  ^Time\s+source\s+is

CDP
  ^${NEIGHBOR}$$
  ^\s*${LOCAL_INTERFACE}\s+\d+\s+${CAPABILITY}\s*${PLATFORM}\s+${NEIGHBOR_INTERFACE} -> Record
  ^${NEIGHBOR}\s+${LOCAL_INTERFACE}\s+\d+\s+${CAPABILITY}\s*${PLATFORM}\s+${NEIGHBOR_INTERFACE} -> Record
SAMPLE COMMAND OUTPUT

OUTPUT1:

Router1#show cdp neighbors TenGigabitEthernet3/7
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
acc-sw101.domain.com
                 Ten 3/7           163              S I   C9500-48T Ten 1/1/1

Total cdp entries displayed : 1

OUTPUT2:

Router2#show cdp neighbors TenGigabitEthernet3/7
Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge
                  S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone,
                  D - Remote, C - CVTA, M - Two-port Mac Relay

Device ID        Local Intrfce     Holdtme    Capability  Platform  Port ID
acc-sw101
                 Ten 3/7           175               R    AS5610-52 0/47

Total cdp entries displayed : 1
SUMMARY
STEPS TO REPRODUCE

When using show cdp neighbors on Router1(Output1) i get the expected output:

[{'capability': 'S I',
 'local_interface': 'Ten 3/7',
 'neighbor': 'acc-sw101.domain.com',
 'neighbor_interface': 'Ten 1/0/39',
 'platform': 'C9500-40X'}]

...but on Router2(Output2) i get:

[{'capability': '',
 'local_interface': '',
 'neighbor': 'acc-sw1001',
 'neighbor_interface': '',
 'platform': ''}]

Main differences i see is Router1 has Device ID value with the domain portion while Router2 doesnt and the Capabilities changes are R and S I. Found the interface under PORT ID is also quite different

Running a full show cdp neighbors without providing a filter interface, will only pick up the entries that include the domain.com part at the end of their IDs and ignore ones without it. I guess i could say thats the source of my issues.

EXPECTED RESULTS

Both routers return a list of data as Router1 Output

ACTUAL RESULTS

Router2 is only displaying Device ID

@alepodj
Copy link
Contributor Author

alepodj commented May 24, 2020

Going thru the regex i think i found my issue

0/47 --> https://regex101.com/r/X4KRsB/3
0/47 --> https://regex101.com/r/qiOfyD/1

Fastpath/ICOS interfaces dont follow the pattern of Cisco for interfaces names
Trying to get one that matches both now...or one that matches anything, since im not sure making that specific value strict will affect other non cisco devices, maybe something more generic will be better suited in there

https://regex101.com/r/utctz5/2

Even after getting full matches for either case i still cant get the full cdo nei.. output for devices with no domain.com

@itdependsnetworks
Copy link
Contributor

Fast OS as in the Cisco 1900 switch last sold in 02?

@alepodj
Copy link
Contributor Author

alepodj commented May 24, 2020

Nop :)

Theseare relatively new devices.
https://www.broadcom.com/products/ethernet-connectivity/software/fastpath

Broadcom ICOS/FASTPATH is an off-the-shelf (Linux based) network operating system (NOS), providing traditional L2 and L3 functions and management, with an API-structure for value-added applications and integration with provisioning and orchestration systems.

ICOS is a robust, programmable full featured and most widely deployed networking operating system for enterprise and data center networking. Its built-in arbitration between conventional and SDN flows allowing customers seamless integration to Next-Gen Open programmable networks.

FASTPATH production-ready networking software helps manufacturers achieve record-setting time-to-market performance for introducing new Ethernet products. In part, this advantage comes from the extensive feature set and integration capabilities that give Broadcom’s software unprecedented application flexibility.

Im currently working with them joined to Cisco routers on enterprise networks, also didnt see any apparent templates for them so i was thinking i could help on that front:

#726

EDIT: I created a workaround parsing raw data manually for now

cmd = 'show cdp neighbors TenGigabitEthernet7/11'

show_cdp_neighbors = sw.send_command(cmd, use_textfsm=True)

if not show_cdp_neighbors[0]['platform']:
    show_cdp_neighbors_raw = sw.send_command(cmd)
    platform = show_cdp_neighbors_raw.split()[54]

@alepodj
Copy link
Contributor Author

alepodj commented May 27, 2020

Was able to match my cases with:

Value PLATFORM (\S{2,}\S+|\S{2,})
Value NEIGHBOR_INTERFACE (([a-zA-Z]+[ ]\S+)|([a-zA-Z0-9]\S+))
acc-sw101
                 Ten 3/7           183              R   C9500-40X 0/47

acc-sw101.domain.com
                 Ten 3/7           161              S I   AS5610-452 Te 1/1/1
https://regex101.com/r/57PDLM/1
https://regex101.com/r/V16dPk/1

@FragmentedPacket
Copy link
Contributor

Thanks for looking into it. That does appear to solve your issue, but breaks existing raw data.

@jmcgill298
Copy link
Contributor

@alepodj the fix is now in master. Thanks for reporting and providing data

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

No branches or pull requests

4 participants