Skip to content

Commit

Permalink
Standardize capture group NETMASK (#1430)
Browse files Browse the repository at this point in the history
* replace capture group NET_MASK with NETMASK

* replace capture group IP_NETMASK with NETMASK

* replace capture group MASK with NETMASK where the pattern is a dotted
decimal mask
  • Loading branch information
mjbear authored Aug 8, 2023
1 parent 6643b65 commit af8327a
Show file tree
Hide file tree
Showing 24 changed files with 349 additions and 349 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Value INTERFACE (\S+\s\S+)
Value IPADDR (\S+)
Value MASK (\S+)
Value NETMASK (\S+)
Value ADMIN (\S+)
Value PROTOCOL (\S+)

Start
^${INTERFACE}\s+${IPADDR}\s+/\s+${MASK}\s+${ADMIN}\s+${PROTOCOL} -> Record
^${INTERFACE}\s+${IPADDR}\s+/\s+${NETMASK}\s+${ADMIN}\s+${PROTOCOL} -> Record
4 changes: 2 additions & 2 deletions ntc_templates/templates/cisco_asa_show_interface.textfsm
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Value ADDRESS ([a-zA-Z0-9]+.[a-zA-Z0-9]+.[a-zA-Z0-9]+)
Value MTU (\d+)
Value VLAN_ID (\d+)
Value IP_ADDRESS (\d+\.\d+\.\d+\.\d+)
Value NET_MASK (\d+\.\d+\.\d+\.\d+)
Value NETMASK (\d+\.\d+\.\d+\.\d+)
Value ONEMIN_IN_PPS (\d+)
Value ONEMIN_IN_RATE (\d+)
Value ONEMIN_OUT_PPS (\d+)
Expand Down Expand Up @@ -48,7 +48,7 @@ Start
^.*MAC\s+address\s+${ADDRESS},\s+MTU\s+not\s+set
^\s+Available\s+but\s+not\s+configured\s+via\s+nameif
^.*MAC\s+address\s+N/A,\s+MTU\s+${MTU}
^.*IP\s+address\s+${IP_ADDRESS},\s+subnet\s+mask\s+${NET_MASK}
^.*IP\s+address\s+${IP_ADDRESS},\s+subnet\s+mask\s+${NETMASK}
^.*1\s+minute\s+input\s+rate\s+${ONEMIN_IN_PPS}\s+pkts/sec,\s+${ONEMIN_IN_RATE}\s+bytes/sec
^.*1\s+minute\s+output\s+rate\s+${ONEMIN_OUT_PPS}\s+pkts/sec,\s+${ONEMIN_OUT_RATE}\s+bytes/sec
^.*1\s+minute\s+drop\s+rate,\s+${ONEMIN_DROP_RATE}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Value DESCRIPTION (.*)
Value ADDRESS ([a-zA-Z0-9]+\.[a-zA-Z0-9]+\.[a-zA-Z0-9]+)
Value MTU (.+?)
Value IP_ADDRESS (.+?)
Value NET_MASK (.+?)
Value NETMASK (.+?)
Value IN_PACKETS (\d+)
Value IN_BYTES (\d+)
Value NO_BUFFER (\d+)
Expand Down Expand Up @@ -86,7 +86,7 @@ Start
^\s+Active\s+member\s+of\s+${BONDED_PORT}\s*$$
^\s+Description:\s+${DESCRIPTION}
^\s+MAC\s+address\s+${ADDRESS}.*MTU\s+${MTU}\s*$$
^\s+IP\s+[Aa]ddress\s+${IP_ADDRESS}(?:,\s+[Ss]ubnet\s+[Mm]ask\s+${NET_MASK})?\s*$$
^\s+IP\s+[Aa]ddress\s+${IP_ADDRESS}(?:,\s+[Ss]ubnet\s+[Mm]ask\s+${NETMASK})?\s*$$
^\s+${IN_PACKETS}\s+packets\s+input,\s+${IN_BYTES}\s+bytes,\s+${NO_BUFFER}\s+no\s+buffer
^\s+Received\s+${BROADCASTS}\s+broadcasts,\s+${RUNTS}\s+runts,\s+${GIANTS}\s+giants
^\s+${IN_ERRORS}\s+input\s+errors,\s+${CRC}\s+CRC,\s+${FRAME}\s+frame,\s+${OVERRUN}\s+overrun,\s+${IGNORED}\s+ignored,\s+${ABORT}\s+abort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Value TYPE ([newrkguphsobjct]+)
Value HOST (\d+.\d+.\d+.\d+)
Value NET_OBJECT (\S+)
Value NETWORK (\d+.\d+.\d+.\d+)
Value MASK (\d+.\d+.\d+.\d+)
Value NETMASK (\d+.\d+.\d+.\d+)
Value GRP_OBJECT (\S+)

Start
Expand All @@ -13,7 +13,7 @@ Start
^\s+description:?\s+${DESCRIPTION}\s*
^\s+network-object\s+${TYPE}\s+${HOST}\s* -> Record
^\s+network-object\s+${TYPE}\s+${NET_OBJECT}\s* -> Record
^\s+${TYPE}-object\s+${NETWORK}\s+${MASK}\s* -> Record
^\s+${TYPE}-object\s+${NETWORK}\s+${NETMASK}\s* -> Record
^\s+${TYPE}-object\s+${GRP_OBJECT}\s* -> Record

EOF
12 changes: 6 additions & 6 deletions ntc_templates/templates/cisco_asa_show_route.textfsm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Value Filldown PROTOCOL (C|S|R|B|D|O|i|L)
Value Filldown TYPE (\w{0,2})
Value Required,Filldown NETWORK (\d+\.\d+\.\d+\.\d+|\S+)
Value Filldown MASK (\d+\.\d+\.\d+\.\d+)
Value Filldown NETMASK (\d+\.\d+\.\d+\.\d+)
Value DISTANCE (\d+)
Value METRIC (\d+)
Value NEXTHOPIP (\d+\.\d+\.\d+\.\d+)
Expand All @@ -13,26 +13,26 @@ Start

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}\s*$$ -> Record
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s+${NETMASK}\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}\s*$$ -> Clear
^\s+[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}${NETMASK}\s*$$ -> Clear
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s\[${DISTANCE}\/${METRIC}\]\svia\s${NEXTHOPIP}(,\s${UPTIME}){0,1}(,\s${NEXTHOPIF}){0,1}\s*$$ -> Record
#
# Match multiline route statements
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s+${MASK}\s*$$
^${PROTOCOL}(\s|\*)${TYPE}\s+${NETWORK}\s+${NETMASK}\s*$$
#
# Match load-balanced routes
^\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
^${PROTOCOL}(\*){0,1}\s${TYPE}\s+${NETWORK}\s+${MASK}\sis\sdirectly\sconnected,\s${NEXTHOPIF} -> Record
^${PROTOCOL}(\*){0,1}\s${TYPE}\s+${NETWORK}\s+${NETMASK}\sis\sdirectly\sconnected,\s${NEXTHOPIF} -> Record
#
# Clear all variables on empty lines
^\s* -> Clearall
#^${TYPE} -> Continue.Record
#^${TYPE}\s+${NETWORK}\s+${MASK}\s+\[\d+\/\d+\]\s+via\s+${GATEWAY}\,\s+${UPTIME},\s+${INTFC}\s*$$ -> Record
#^${TYPE}\s+${NETWORK}\s+${NETMASK}\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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Value DESCRIPTION (.+)
Value TYPE ([hostubnerag]+)
Value HOST (\S+)
Value NETWORK (\S+)
Value MASK (\S+)
Value NETMASK (\S+)
Value CIDR (\/\d+)
Value START_IP (\S+)
Value END_IP (\S+)
Expand All @@ -14,7 +14,7 @@ Start
^object\s+network\s+${NAME}\s*
^\s+description\s+${DESCRIPTION}\s*
^\s+${TYPE} -> Continue
^\s+subnet\s+${NETWORK}\s+${MASK}\s*
^\s+subnet\s+${NETWORK}\s+${NETMASK}\s*
^\s+subnet\s+${NETWORK}${CIDR}\s*
^\s+range\s+${START_IP}\s+${END_IP}\s*
^\s+host\s+${HOST}\s*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Value INTERFACE_NAME (\S+)
Value MAC_ADDRESS (\w+\.\w+\.\w+|\w+\:\w+\:\w+\:\w+\:\w+\:\w+)
Value IP_ADDRESS (\d+.\d+.\d+.\d+)
Value IP_NETMASK (\d+.\d+.\d+.\d+)
Value NETMASK (\d+.\d+.\d+.\d+)
Value GATEWAY (\d+.\d+.\d+.\d+)
Value PRIMARY_DHCP_SERVER (\d+.\d+.\d+.\d+|Unconfigured)
Value SECONDARY_DHCP_SERVER (\d+.\d+.\d+.\d+|Unconfigured)
Expand All @@ -10,7 +10,7 @@ Start
^\s*Interface\s+Name\.+\s+${INTERFACE_NAME}\s*$$
^\s*MAC\s+Address\.+\s+${MAC_ADDRESS}\s*$$
^\s*IP\s+Address\.+\s+${IP_ADDRESS}\s*$$
^\s*IP\s+Netmask\.+\s+${IP_NETMASK}\s*$$
^\s*IP\s+Netmask\.+\s+${NETMASK}\s*$$
^\s*IP\s+Gateway\.+\s+${GATEWAY}\s*$$
^\s*Primary\s+DHCP\s+Server\.+\s+${PRIMARY_DHCP_SERVER}\s*$$
^\s*Secondary\s+DHCP\s+Server\.+\s+${SECONDARY_DHCP_SERVER}\s*$$ -> Record
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ parsed_sample:
- admin: "up"
interface: "vlan 93"
ipaddr: "162.25.53.4"
mask: "255.255.255.192"
netmask: "255.255.255.192"
protocol: "up"
- admin: "up"
interface: "vlan 1"
ipaddr: "unassigned"
mask: "unassigned"
netmask: "unassigned"
protocol: "up"
- admin: "up"
interface: "vlan 69"
ipaddr: "162.25.53.9"
mask: "255.255.255.192"
netmask: "255.255.255.192"
protocol: "up"
- admin: "up"
interface: "vlan 999"
ipaddr: "162.21.33.196"
mask: "255.255.255.240"
netmask: "255.255.255.240"
protocol: "up"
12 changes: 6 additions & 6 deletions tests/cisco_asa/show_interface/cisco_asa_show_interface.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: "10.0.0.5"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.252"
netmask: "255.255.255.252"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
Expand Down Expand Up @@ -50,7 +50,7 @@ parsed_sample:
ip_address: "10.0.0.13"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.252"
netmask: "255.255.255.252"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
Expand Down Expand Up @@ -82,7 +82,7 @@ parsed_sample:
ip_address: "172.16.1.222"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "1"
onemin_in_rate: "79"
Expand Down Expand Up @@ -114,7 +114,7 @@ parsed_sample:
ip_address: "10.6.2.1"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -146,7 +146,7 @@ parsed_sample:
ip_address: "10.12.16.237"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.248"
netmask: "255.255.255.248"
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -178,7 +178,7 @@ parsed_sample:
ip_address: "10.6.10.1"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down
12 changes: 6 additions & 6 deletions tests/cisco_asa/show_interface/cisco_asa_show_interface1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: "10.99.99.2"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
Expand Down Expand Up @@ -50,7 +50,7 @@ parsed_sample:
ip_address: "10.90.90.1"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
Expand Down Expand Up @@ -82,7 +82,7 @@ parsed_sample:
ip_address: ""
link_status: "administratively down"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -114,7 +114,7 @@ parsed_sample:
ip_address: ""
link_status: "administratively down"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -146,7 +146,7 @@ parsed_sample:
ip_address: ""
link_status: "administratively down"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -178,7 +178,7 @@ parsed_sample:
ip_address: "10.100.100.2"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: "0"
onemin_in_pps: "1"
onemin_in_rate: "90"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: "10.0.0.5"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.252"
netmask: "255.255.255.252"
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: "172.16.178.58"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: ""
link_status: "up"
mtu: "1500"
net_mask: ""
netmask: ""
onemin_drop_rate: "0"
onemin_in_pps: "0"
onemin_in_rate: "0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: ""
link_status: "up"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -50,7 +50,7 @@ parsed_sample:
ip_address: ""
link_status: "up"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -82,7 +82,7 @@ parsed_sample:
ip_address: ""
link_status: "up"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: ""
link_status: "down"
mtu: ""
net_mask: ""
netmask: ""
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down Expand Up @@ -50,7 +50,7 @@ parsed_sample:
ip_address: "192.168.101.2"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.252"
netmask: "255.255.255.252"
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ parsed_sample:
ip_address: "10.29.60.1"
link_status: "up"
mtu: "1500"
net_mask: "255.255.255.0"
netmask: "255.255.255.0"
onemin_drop_rate: ""
onemin_in_pps: ""
onemin_in_rate: ""
Expand Down
Loading

0 comments on commit af8327a

Please sign in to comment.