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

Update Cisco IOS-XR template for show ip route command #266

Merged
merged 6 commits into from
Oct 14, 2018
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
23 changes: 8 additions & 15 deletions templates/cisco_xr_show_ip_route.template
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
Value Filldown PROTOCOL (\S+)
Value Filldown PROTOCOL (\S+|\S+\s\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+)
Value UPTIME (\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+(\S+\s+-\s+.+[,]*)+
^Gateway\s+of\s+last\s+resort
^${PROTOCOL}\s+${NETWORK}/${MASK}\s+(?:\[${DISTANCE}/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+${UPTIME},\s+${INTERFACE} -> Record
^\s+(?:\[${DISTANCE}/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+${UPTIME},\s+${INTERFACE} -> Record
^${PROTOCOL}\s+${NETWORK}/${MASK}\s+(?:\[${DISTANCE}/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+${UPTIME} -> Record
^\s+(?:\[${DISTANCE}/${METRIC}\]|is)\s+${TYPE}\s+${NEXT_HOP},\s+${UPTIME} -> Record
^\s+$$
^$$
^.* -> Error "LINE NOT FOUND"

34 changes: 34 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
Expand Up @@ -9,6 +9,7 @@ parsed_sample:
next_hop: 172.16.1.1
protocol: S*
type: via
uptime: '04:43:54'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
Expand All @@ -17,6 +18,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:27'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
Expand All @@ -25,6 +27,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:27'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
Expand All @@ -33,6 +36,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:21'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
Expand All @@ -41,6 +45,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:21'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
Expand All @@ -49,6 +54,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
Expand All @@ -57,6 +63,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
Expand All @@ -65,6 +72,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
Expand All @@ -73,6 +81,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '32'
Expand All @@ -81,6 +90,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '32'
Expand All @@ -89,6 +99,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: ''
interface: Loopback0
mask: '32'
Expand All @@ -97,6 +108,7 @@ parsed_sample:
next_hop: connected
protocol: L
type: directly
uptime: '04:43:54'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -105,6 +117,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -113,6 +126,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -121,6 +135,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -129,6 +144,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -137,6 +153,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -145,6 +162,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: ''
interface: GigabitEthernet0/0/0/1
mask: '30'
Expand All @@ -153,6 +171,7 @@ parsed_sample:
next_hop: connected
protocol: C
type: directly
uptime: '04:43:54'
- distance: ''
interface: GigabitEthernet0/0/0/1
mask: '32'
Expand All @@ -161,6 +180,7 @@ parsed_sample:
next_hop: connected
protocol: L
type: directly
uptime: '04:43:54'
- distance: ''
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -169,6 +189,7 @@ parsed_sample:
next_hop: connected
protocol: C
type: directly
uptime: '04:43:54'
- distance: ''
interface: GigabitEthernet0/0/0/0
mask: '32'
Expand All @@ -177,6 +198,7 @@ parsed_sample:
next_hop: connected
protocol: L
type: directly
uptime: '04:43:54'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -185,6 +207,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -193,6 +216,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -201,6 +225,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:41'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -209,6 +234,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:41'
- distance: '110'
interface: GigabitEthernet0/0/0/0
mask: '30'
Expand All @@ -217,6 +243,7 @@ parsed_sample:
next_hop: 10.1.1.9
protocol: O
type: via
uptime: '04:43:40'
- distance: '110'
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -225,6 +252,7 @@ parsed_sample:
next_hop: 10.1.1.34
protocol: O
type: via
uptime: '04:43:40'
- distance: ''
interface: GigabitEthernet0/0/0/2
mask: '30'
Expand All @@ -233,6 +261,7 @@ parsed_sample:
next_hop: connected
protocol: C
type: directly
uptime: '04:43:54'
- distance: ''
interface: GigabitEthernet0/0/0/2
mask: '32'
Expand All @@ -241,6 +270,7 @@ parsed_sample:
next_hop: connected
protocol: L
type: directly
uptime: '04:43:54'
- distance: ''
interface: GigabitEthernet0/0/0/3
mask: '30'
Expand All @@ -249,6 +279,7 @@ parsed_sample:
next_hop: connected
protocol: C
type: directly
uptime: '04:43:54'
- distance: ''
interface: GigabitEthernet0/0/0/3
mask: '32'
Expand All @@ -257,6 +288,7 @@ parsed_sample:
next_hop: connected
protocol: L
type: directly
uptime: '04:43:54'
- distance: ''
interface: MgmtEth0/0/CPU0/0
mask: '24'
Expand All @@ -265,6 +297,7 @@ parsed_sample:
next_hop: connected
protocol: C
type: directly
uptime: '04:43:54'
- distance: ''
interface: MgmtEth0/0/CPU0/0
mask: '32'
Expand All @@ -273,3 +306,4 @@ parsed_sample:
next_hop: connected
protocol: L
type: directly
uptime: '04:43:54'
66 changes: 66 additions & 0 deletions tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route2.parsed
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
parsed_sample:

- distance: '1'
interface: ''
mask: '0'
metric: '0'
network: '0.0.0.0'
next_hop: '10.72.0.1'
protocol: 'S*'
type: 'via'
uptime: '4d01h'
- distance: '20'
interface: ''
mask: '16'
metric: '0'
network: '10.39.0.0'
next_hop: '192.168.50.1'
protocol: 'B'
type: 'via'
uptime: '1w4d'
- distance: '170'
interface: 'TenGigE0/0/0/1.5'
mask: '16'
metric: '153600'
network: '10.14.0.0'
next_hop: '192.168.150.130'
protocol: 'D EX'
type: 'via'
uptime: '14:56:35'
- distance: '170'
interface: 'TenGigE0/0/0/2.5'
mask: '16'
metric: '153600'
network: '10.14.0.0'
next_hop: '192.168.150.134'
protocol: 'D EX'
type: 'via'
uptime: '6d21h'
- distance: '170'
interface: 'TenGigE0/0/0/3.5'
mask: '16'
metric: '153600'
network: '10.14.0.0'
next_hop: '192.168.150.138'
protocol: 'D EX'
type: 'via'
uptime: '6d21h'
- distance: '170'
interface: 'TenGigE0/0/0/4.5'
mask: '16'
metric: '153600'
network: '10.14.0.0'
next_hop: '192.168.150.142'
protocol: 'D EX'
type: 'via'
uptime: '6d21h'
- distance: '20'
interface: ''
mask: '16'
metric: '0'
network: '10.15.0.0'
next_hop: '192.168.250.130'
protocol: 'B'
type: 'via'
uptime: '1y03w'
21 changes: 21 additions & 0 deletions tests/cisco_xr/show_ip_route/cisco_xr_show_ip_route2.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Tue May 22 22:32:30.765 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 10.72.0.1 to network 0.0.0.0

S* 0.0.0.0/0 [1/0] via 10.72.0.1, 4d01h
B 10.39.0.0/16 [20/0] via 192.168.50.1, 1w4d
D EX 10.14.0.0/16 [170/153600] via 192.168.150.130, 14:56:35, TenGigE0/0/0/1.5
[170/153600] via 192.168.150.134, 6d21h, TenGigE0/0/0/2.5
[170/153600] via 192.168.150.138, 6d21h, TenGigE0/0/0/3.5
[170/153600] via 192.168.150.142, 6d21h, TenGigE0/0/0/4.5
B 10.15.0.0/16 [20/0] via 192.168.250.130, 1y03w