Skip to content

Commit

Permalink
fix: Corrected Cisco IOS show_access-list template
Browse files Browse the repository at this point in the history
  • Loading branch information
k-ribot committed Nov 8, 2024
1 parent c18104e commit 9930f87
Show file tree
Hide file tree
Showing 3 changed files with 387 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ntc_templates/templates/cisco_ios_show_access-list.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ Value OPERATOR_DESTINATION_PORT (eq|gt|lt|neq|range)
#
# This can be either a single port or a list.
#
Value SOURCE_PORT ([\s\S]+)
Value DESTINATION_PORT ([\s\S]+)
Value SOURCE_PORT (((?! \(\d+ matches\))[\s\S])+)
Value DESTINATION_PORT (((?! \(\d+ matches\))[\s\S])+)
#
# DESTINATION RegEx must be able to catch every possible source combination including masks. 'any' and 'host' and 'wildcard bits' are possible too.
#
Expand All @@ -35,9 +35,9 @@ Value MATCHES (\d+)

Start
^${TYPE}.*list\s+${NAME}
^\s*${SN}\s+${ACTION}\s+${PROTOCOL}\s+${SOURCE}\s+${OPERATOR_SOURCE_PORT}\s${SOURCE_PORT}\s${DESTINATION}\s${OPERATOR_DESTINATION_PORT}\s${DESTINATION_PORT} -> Record
^\s*${SN}\s+${ACTION}\s+${PROTOCOL}\s+${SOURCE}\s+${DESTINATION}(\s+${OPERATOR_SOURCE_PORT})*(\s${SOURCE_PORT})* -> Record
^\s*${SN}\s+${ACTION}\s+${PROTOCOL}\s+${SOURCE}(\s+${OPERATOR_SOURCE_PORT})*(\s${SOURCE_PORT})*\s+${DESTINATION}(\s+${MODIFIER})*(\s\(*(\s\(${MATCHES}\smatches\))*\smatches\))* -> Record
^\s*${SN}\s+${ACTION}\s+${PROTOCOL}\s+${SOURCE}\s+${OPERATOR_SOURCE_PORT}\s${SOURCE_PORT}\s${DESTINATION}\s${OPERATOR_DESTINATION_PORT}\s${DESTINATION_PORT}(\s\(${MATCHES}\smatches\))* -> Record
^\s*${SN}\s+${ACTION}\s+${PROTOCOL}\s+${SOURCE}\s+${DESTINATION}(\s${OPERATOR_SOURCE_PORT}\s${SOURCE_PORT})?(\s\(${MATCHES}\smatches\))? -> Record
^\s*${SN}\s+${ACTION}\s+${PROTOCOL}\s+${SOURCE}(\s${OPERATOR_SOURCE_PORT}\s${SOURCE_PORT})*\s+${DESTINATION}(\s+${MODIFIER})*(\s\(${MATCHES}\smatches\))* -> Record
^\s*${SN}\s+${ACTION}\s+${SOURCE}(\s+${MODIFIER})*(\s\(${MATCHES}\smatches\))* -> Record
^Load\s+for\s+
^Time\s+source\s+is
29 changes: 29 additions & 0 deletions tests/cisco_ios/show_access-list/cisco_ios_show_access-list3.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Extended IP access list 115
9999 permit ip any any (10878 matches)
Extended IP access list 150
10 permit tcp any any eq 5060
20 permit udp any any eq 5060 (2 matches)
30 permit tcp any eq 5060 any
40 permit udp any eq 5060 any
50 permit tcp any any eq 5090
60 permit udp any any eq 5090
70 permit tcp any eq 5090 any
80 permit udp any eq 5090 any
90 permit ip 54.48.253.0 0.0.0.31 any
100 permit ip any 54.48.253.0 0.0.0.31
110 permit ip 54.48.254.0 0.0.0.15 any
120 permit ip any 54.48.254.0 0.0.0.15
130 permit ip 54.163.212.48 0.0.0.15 any
140 permit ip any 54.163.212.48 0.0.0.15
150 permit ip 54.163.212.64 0.0.0.15 any
160 permit ip any 54.163.212.64 0.0.0.15
170 permit ip any 17.195.31.0 0.0.0.255
180 permit ip 17.195.31.0 0.0.0.255 any
190 permit ip any 178.255.160.0 0.0.7.255
200 permit ip 178.255.160.0 0.0.7.255 any
210 permit ip any 17.171.23.0 0.0.0.255
220 permit ip 17.171.23.0 0.0.0.255 any
230 permit ip any 37.97.64.0 0.0.0.255
240 permit ip 37.97.64.0 0.0.0.255 any
250 permit ip any 81.93.0.0 0.0.31.255
260 permit ip 81.93.0.0 0.0.31.255 any
Loading

0 comments on commit 9930f87

Please sign in to comment.