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

Issue 415 cdp #480

Merged
merged 16 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions templates/cisco_ios_show_cdp_neighbors.template
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
Value Required NEIGHBOR (\S+)
Value LOCAL_INTERFACE (\S+\s\S+)
Value CAPABILITY ((?:\w(?:\s(?!\s))?){0,})
Value PLATFORM (\S{2,}\s\S{2,}|\S+)
Value NEIGHBOR_INTERFACE (\S+\s\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

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

^\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
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
parsed_sample:
- capability: H P
local_interface: Gig 1/0/16
neighbor: SEP000000000000
neighbor_interface: port 1
platform: IP Phone
- capability: T B I
local_interface: Gig 1/0/45
neighbor: AP000000000
neighbor_interface: Gig 0
platform: AIR-CAP35
- capability: T B I
local_interface: Gig 1/0/46
neighbor: AP000000001
neighbor_interface: Gig 0
platform: AIR-CAP35
- capability: T
local_interface: Gig 1/0/1
neighbor: WAAS0000000
neighbor_interface: InlinePort 1/1/lan
platform: OE474
- capability: H
local_interface: Gig 1/0/40
neighbor: WAAS0000000
neighbor_interface: Gig 1/0
platform: OE474
- capability: R B S
local_interface: Gig 1/0/1
neighbor: router.domain.local
neighbor_interface: Gig 0/0
platform: CISCO2911
- capability: H P M
local_interface: Gig 1/0/33
neighbor: SEP000000000001
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/29
neighbor: SEP000000000002
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/30
neighbor: SEP000000000003
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/14
neighbor: SEP000000000004
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/8
neighbor: SEP000000000005
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/13
neighbor: SEP000000000006
neighbor_interface: Port 1
platform: IP Phone
- capability: H P
local_interface: Gig 1/0/15
neighbor: SEP000000000007
neighbor_interface: eth0
platform: CTS-CODEC
- capability: H P M
local_interface: Gig 1/0/37
neighbor: SEP000000000008
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/34
neighbor: SEP000000000009
neighbor_interface: Port 1
platform: IP Phone
- capability: H P
local_interface: Gig 1/0/21
neighbor: SEP00000000000A
neighbor_interface: eth0
platform: CTS-CODEC
- capability: H P M
local_interface: Gig 1/0/35
neighbor: SEP00000000000B
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/24
neighbor: SEP00000000000C
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/9
neighbor: SEP00000000000D
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/17
neighbor: SEP00000000000E
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/20
neighbor: SEP00000000000F
neighbor_interface: Port 1
platform: IP Phone
- capability: H P M
local_interface: Gig 1/0/36
neighbor: SEP000000000010
neighbor_interface: Port 1
platform: IP Phone
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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
SEP000000000000 Gig 1/0/16 155 H P IP Phone port 1
AP000000000 Gig 1/0/45 158 T B I AIR-CAP35 Gig 0
AP000000001 Gig 1/0/46 173 T B I AIR-CAP35 Gig 0
WAAS0000000 Gig 1/0/1 138 T OE474 InlinePort 1/1/lan
WAAS0000000 Gig 1/0/40 138 H OE474 Gig 1/0
router.domain.local
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume these should be on the same line?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was looking at something else and noticed this may be the way the output is provided back. We would need to account for this within the template to make sure the data is what we need.

I will find the example and post it back, but I think it may have been a similar template to this, but different OS.

Gig 1/0/1 134 R B S CISCO2911 Gig 0/0
SEP000000000001 Gig 1/0/33 152 H P M IP Phone Port 1
SEP000000000002 Gig 1/0/29 173 H P M IP Phone Port 1
SEP000000000003 Gig 1/0/30 160 H P M IP Phone Port 1
SEP000000000004 Gig 1/0/14 169 H P M IP Phone Port 1
SEP000000000005 Gig 1/0/8 140 H P M IP Phone Port 1
SEP000000000006 Gig 1/0/13 135 H P M IP Phone Port 1
SEP000000000007 Gig 1/0/15 164 H P CTS-CODEC eth0
SEP000000000008 Gig 1/0/37 173 H P M IP Phone Port 1
SEP000000000009 Gig 1/0/34 176 H P M IP Phone Port 1
SEP00000000000A Gig 1/0/21 179 H P CTS-CODEC eth0
SEP00000000000B Gig 1/0/35 177 H P M IP Phone Port 1
SEP00000000000C Gig 1/0/24 164 H P M IP Phone Port 1
SEP00000000000D Gig 1/0/9 176 H P M IP Phone Port 1
SEP00000000000E Gig 1/0/17 131 H P M IP Phone Port 1
SEP00000000000F Gig 1/0/20 136 H P M IP Phone Port 1
SEP000000000010 Gig 1/0/36 162 H P M IP Phone Port 1