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 #384 cisco_asa_show_route - Fix uptime issue #401

Merged
merged 10 commits into from
Oct 22, 2019
15 changes: 7 additions & 8 deletions templates/cisco_asa_show_route.template
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ Value DISTANCE (\d+)
Value METRIC (\d+)
Value NEXTHOPIP (\d+\.\d+\.\d+\.\d+)
Value NEXTHOPIF (\S+)
Value UPTIME (\d+:\d+:\d+)
Value UPTIME (\d\S+?)

Start
^Gateway -> ROUTES

ROUTES
# Match regular routes with all data in same line
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s+${MASK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1} -> Record
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s+${MASK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1}\s*$$ -> Record
#
# Clear all non Filldown variables when line started with network that is variably subnetted
^\s+[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}${MASK} -> Clear
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1} -> Record
^\s+[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}${MASK}\s*$$ -> Clear
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1}\s*$$ -> Record
#
# Match load-balanced routes
^\s+\[${DISTANCE}\/${METRIC}\]\s+via\s+${NEXTHOPIP},\s+${NEXTHOPIF} -> Record
^\s+\[${DISTANCE}\/${METRIC}\]\s+via\s+${NEXTHOPIP},(?:\s+${UPTIME},)?\s+${NEXTHOPIF}\s*$$ -> Record
#
# Match directly connected routes
^${PROTOCOL}\s${TYPE}\s+${NETWORK}\sis\sdirectly\sconnected,\s${NEXTHOPIF} -> Record
Expand All @@ -29,8 +29,7 @@ ROUTES
# Clear all variables on empty lines
^\s* -> Clearall
#^${TYPE} -> Continue.Record
#^${TYPE}\s+${NETWORK}\s+${MASK}\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${INTFC}\s* -> Record
#^\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${INTFC} -> Record
#^${TYPE}\s+${NETWORK}\s+${MASK}\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${UPTIME},\s+${INTFC}\s*$$ -> Record
#^\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${UPTIME},\s+${INTFC}\s*$$ -> Record

EOF

56 changes: 55 additions & 1 deletion tests/cisco_asa/show_route/cisco_asa_show_route.parsed
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,60 @@ parsed_sample:
nexthopip: "192.168.1.2"
nexthopif: "outside"
uptime: "3:21:21"
- protocol: "O"
type: "E2"
network: "10.1.1.0"
mask: "255.255.255.0"
distance: "170"
metric: "3840"
nexthopip: "192.168.1.2"
nexthopif: "outside"
uptime: "2w6d"
- protocol: "O"
type: "E2"
network: "10.1.1.0"
mask: "255.255.255.0"
distance: "170"
metric: "3840"
nexthopip: "192.168.2.2"
nexthopif: "outside"
uptime: "2w6d"
- protocol: "O"
type: "E2"
network: "10.1.2.0"
mask: "255.255.255.0"
distance: "170"
metric: "3840"
nexthopip: "192.168.1.2"
nexthopif: "outside"
uptime: "2w6d"
- protocol: "O"
type: "E2"
network: "10.1.2.0"
mask: "255.255.255.0"
distance: "170"
metric: "3840"
nexthopip: "192.168.2.2"
nexthopif: "outside"
uptime: "2w6d"
- protocol: "O"
type: "E2"
network: "10.1.3.0"
mask: "255.255.255.0"
distance: "170"
metric: "3840"
nexthopip: "192.168.1.2"
nexthopif: "outside"
uptime: "2w6d"
- protocol: "O"
type: "E2"
network: "10.1.3.0"
mask: "255.255.255.0"
distance: "170"
metric: "3840"
nexthopip: "192.168.2.2"
nexthopif: "outside"
uptime: "2w6d"
- protocol: "C"
type: ""
network: "192.168.1.0"
Expand All @@ -225,4 +279,4 @@ parsed_sample:
metric: ""
nexthopip: ""
nexthopif: "inside"
uptime: ""
uptime: ""
6 changes: 6 additions & 0 deletions tests/cisco_asa/show_route/cisco_asa_show_route.raw
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,11 @@ O IA 10.0.4.254 255.255.255.255 [110/11] via 192.168.1.2, 3:21:21, outside
O IA 10.0.1.254 255.255.255.255 [110/11] via 192.168.1.2, 3:21:21, outside
O IA 10.0.2.254 255.255.255.255 [110/11] via 192.168.1.2, 3:21:21, outside
O IA 10.0.3.254 255.255.255.255 [110/11] via 192.168.1.2, 3:21:21, outside
O E2 10.1.1.0 255.255.255.0 [170/3840] via 192.168.1.2, 2w6d, outside
[170/3840] via 192.168.2.2, 2w6d, outside
O E2 10.1.2.0 255.255.255.0 [170/3840] via 192.168.1.2, 2w6d, outside
[170/3840] via 192.168.2.2, 2w6d, outside
O E2 10.1.3.0 255.255.255.0 [170/3840] via 192.168.1.2, 2w6d, outside
[170/3840] via 192.168.2.2, 2w6d, outside
C 192.168.1.0 255.255.255.0 is directly connected, outside
C 192.168.2.0 255.255.255.0 is directly connected, inside