Skip to content

Commit

Permalink
cisco xr lldp and route
Browse files Browse the repository at this point in the history
  • Loading branch information
itdependsnetworks committed Jan 29, 2018
1 parent eabee5b commit d8bfed9
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers/create-parsed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

- name: SET FACT FOR ROOT DIR
set_fact:
root_directory: "{{ root_dir | default('..') }}"
root_directory: "{{ playbook_dir | dirname }}"

- name: OFFLINE NTC SHOW COMMAND
ntc_show_command:
Expand Down
30 changes: 30 additions & 0 deletions templates/cisco_xr_show_ip_route.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Value Filldown PROTOCOL (\S+)
Value Filldown NETWORK (\d+\.\d+\.\d+\.\d+)
Value Filldown MASK (\d+)
Value DISTANCE (\d+|is)
Value METRIC (\d+)
Value TYPE (directly|via)
Value Required NEXT_HOP (connected|\d+\.\d+\.\d+\.\d+)
Value INTERFACE (\S+)

Start
^Codes: C - connected, -> Route

Route
^ D - EIGRP, EX
^ N1 - OSPF NSSA
^ E1 - OSPF exte
^ i - ISIS, L1 -
^ ia - IS-IS int
^ U - per-user s
^ A - access/sub
^ M - mobile rou
^Gateway of last resort
^${PROTOCOL}\s+${NETWORK}\/${MASK}\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+),\s+${INTERFACE} -> Record
^\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+),\s+${INTERFACE} -> Record
^${PROTOCOL}\s+${NETWORK}\/${MASK}\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+) -> Record
^\s+(?:\[${DISTANCE}\/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+(\d+:\d+:\d+) -> Record
^\s+$$
^$$
^.* -> Error "LINE NOT FOUND"

15 changes: 15 additions & 0 deletions templates/cisco_xr_show_lldp_neighbors.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Value Required NEIGHBOR (\S+)
Value Required LOCAL_INTERFACE (\S+)
Value Required NEIGHBOR_INTERFACE (\S+)

Start
^Device.*ID -> LLDP

LLDP
^${NEIGHBOR}\s+${LOCAL_INTERFACE}\s+\d+\s+(.+?)\s+${NEIGHBOR_INTERFACE}$$ -> Record
^${NEIGHBOR}
^\s+${LOCAL_INTERFACE}\s+\d+\s+(.*?)\s+${NEIGHBOR_INTERFACE} -> Record
^Total entries
^\s+$$
^$$
^.* -> Error "LINE NOT FOUND"
2 changes: 2 additions & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ cisco_xr_show_redundancy_summary.template, .*, cisco_xr, sh[[ow]] redun[[dancy]]
cisco_xr_show_interface_brief.template, .*, cisco_xr, sh[[ow]] int[[erface]] br[[ief]]
cisco_xr_admin_show_platform.template, .*, cisco_xr, adm[[in]] sh[[ow]] pla[[tform]]
cisco_xr_show_isis_neighbors.template, .*, cisco_xr, sh[[ow]] isis ne[[ighbors]]
cisco_xr_show_lldp_neighbors.template, .*, cisco_xr, sh[[ow]] lld[[p]] neig[[hbors]]
cisco_xr_show_rsvp_neighbors.template, .*, cisco_xr, sh[[ow]] rs[[vp]] neigh[[bors]]
cisco_xr_show_ospf_neighbor.template, .*, cisco_xr, sh[[ow]] ospf nei[[ghbor]]
cisco_xr_show_processes_cpu.template, .*, cisco_xr, sh[[ow]] proc[[esses]] c[[pu]]
cisco_xr_show_bfd_sessions.template, .*, cisco_xr, sh[[ow]] bf[[d]] sess[[ions]]
cisco_xr_show_pim_neighbor.template, .*, cisco_xr, sh[[ow]] pi[[m]] neigh[[bor]]
cisco_xr_show_controllers.template, .*, cisco_xr, sh[[ow]] contr[[ollers]] (\S+) phy
cisco_xr_show_interfaces.template, .*, cisco_xr, sh[[ow]] inte[[rfaces]]
cisco_xr_show_ip_route.template, .*, cisco_xr, sh[[ow]] ip ro[[ute]]

dell_force10_show_vlan_brief.template, .*, dell_force10, sh[[ow]] vl[[an]] br[[ief]]
dell_force10_show_version.template, .*, dell_force10, sh[[ow]] ver[[sion]]
Expand Down
275 changes: 275 additions & 0 deletions tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.parsed
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
---
parsed_sample:

- distance: '1'
interface: ''
mask: '0'
metric: '0'
network: 0.0.0.0
next_hop: 172.16.1.1
protocol: S*
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
metric: '0'
network: 1.1.1.1
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
metric: '9164'
network: 1.1.1.1
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
metric: '0'
network: 1.1.1.3
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
metric: '6564'
network: 1.1.1.3
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
metric: '0'
network: 1.1.2.1
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
metric: '9163'
network: 1.1.2.1
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
metric: '0'
network: 1.1.2.3
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
metric: '6563'
network: 1.1.2.3
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
metric: '0'
network: 1.1.2.5
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
metric: '639'
network: 1.1.2.5
next_hop: 10.1.1.34
protocol: O
type: via
- distance: ''
interface: Loopback0
mask: '32'
metric: ''
network: 1.1.2.6
next_hop: connected
protocol: L
type: directly
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: '0'
network: 10.1.0.0
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: '9163'
network: 10.1.0.0
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: '0'
network: 10.1.0.8
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: '6563'
network: 10.1.0.8
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: '0'
network: 10.1.1.0
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: '11762'
network: 10.1.1.0
next_hop: 10.1.1.34
protocol: O
type: via
- distance: ''
interface: GigabitEthernet0/0/0/1
mask: '30'
metric: ''
network: 10.1.1.4
next_hop: connected
protocol: C
type: directly
- distance: ''
interface: GigabitEthernet0/0/0/1
mask: '32'
metric: ''
network: 10.1.1.6
next_hop: connected
protocol: L
type: directly
- distance: ''
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: ''
network: 10.1.1.8
next_hop: connected
protocol: C
type: directly
- distance: ''
interface: GigabitEthernet0/0/0/0
mask: '32'
metric: ''
network: 10.1.1.10
next_hop: connected
protocol: L
type: directly
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: '0'
network: 10.1.1.12
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: '9162'
network: 10.1.1.12
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: '0'
network: 10.1.1.20
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: '6562'
network: 10.1.1.20
next_hop: 10.1.1.34
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
metric: '0'
network: 10.1.1.24
next_hop: 10.1.1.9
protocol: O
type: via
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: '709'
network: 10.1.1.24
next_hop: 10.1.1.34
protocol: O
type: via
- distance: ''
interface: GigabitEthernet0/0/0/2
mask: '30'
metric: ''
network: 10.1.1.28
next_hop: connected
protocol: C
type: directly
- distance: ''
interface: GigabitEthernet0/0/0/2
mask: '32'
metric: ''
network: 10.1.1.30
next_hop: connected
protocol: L
type: directly
- distance: ''
interface: GigabitEthernet0/0/0/3
mask: '30'
metric: ''
network: 10.1.1.32
next_hop: connected
protocol: C
type: directly
- distance: ''
interface: GigabitEthernet0/0/0/3
mask: '32'
metric: ''
network: 10.1.1.33
next_hop: connected
protocol: L
type: directly
- distance: ''
interface: MgmtEth0/0/CPU0/0
mask: '24'
metric: ''
network: 172.16.1.0
next_hop: connected
protocol: C
type: directly
- distance: ''
interface: MgmtEth0/0/CPU0/0
mask: '32'
metric: ''
network: 172.16.1.120
next_hop: connected
protocol: L
type: directly
48 changes: 48 additions & 0 deletions tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
Mon Jan 29 19:00:32.892 UTC

Codes: C - connected, S - static, R - RIP, B - BGP, (>) - Diversion path
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - ISIS, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, su - IS-IS summary null, * - candidate default
U - per-user static route, o - ODR, L - local, G - DAGR, l - LISP
A - access/subscriber, a - Application route
M - mobile route, r - RPL, (!) - FRR Backup path

Gateway of last resort is 172.16.1.1 to network 0.0.0.0

S* 0.0.0.0/0 [1/0] via 172.16.1.1, 04:43:54
O 1.1.1.1/32 [110/0] via 10.1.1.9, 04:43:27, GigabitEthernet0/0/0/0 (!)
[110/9164] via 10.1.1.34, 04:43:27, GigabitEthernet0/0/0/3
O 1.1.1.3/32 [110/0] via 10.1.1.9, 04:43:21, GigabitEthernet0/0/0/0 (!)
[110/6564] via 10.1.1.34, 04:43:21, GigabitEthernet0/0/0/3
O 1.1.2.1/32 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/9163] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
O 1.1.2.3/32 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/6563] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
O 1.1.2.5/32 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/639] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
L 1.1.2.6/32 is directly connected, 04:43:54, Loopback0
O 10.1.0.0/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/9163] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
O 10.1.0.8/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/6563] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
O 10.1.1.0/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/11762] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
C 10.1.1.4/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/1
L 10.1.1.6/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/1
C 10.1.1.8/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/0
L 10.1.1.10/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/0
O 10.1.1.12/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/9162] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
O 10.1.1.20/30 [110/0] via 10.1.1.9, 04:43:41, GigabitEthernet0/0/0/0 (!)
[110/6562] via 10.1.1.34, 04:43:41, GigabitEthernet0/0/0/3
O 10.1.1.24/30 [110/0] via 10.1.1.9, 04:43:40, GigabitEthernet0/0/0/0 (!)
[110/709] via 10.1.1.34, 04:43:40, GigabitEthernet0/0/0/3
C 10.1.1.28/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/2
L 10.1.1.30/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/2
C 10.1.1.32/30 is directly connected, 04:43:54, GigabitEthernet0/0/0/3
L 10.1.1.33/32 is directly connected, 04:43:54, GigabitEthernet0/0/0/3
C 172.16.1.0/24 is directly connected, 04:43:54, MgmtEth0/0/CPU0/0
L 172.16.1.120/32 is directly connected, 04:43:54, MgmtEth0/0/CPU0/0
Loading

0 comments on commit d8bfed9

Please sign in to comment.