From 97cc6990b3f17b0fc00a12ddd247b09f3fcd20a4 Mon Sep 17 00:00:00 2001 From: evilmonkey19 Date: Tue, 4 Nov 2025 11:55:14 +0100 Subject: [PATCH 1/4] New template for Mikrotik RouterOS: `/ip firewall connection print terse without-paging` --- ntc_templates/templates/index | 1 + ...nection_print_terse_without-paging.textfsm | 29 +++++++++++++++++++ ..._connection_print_terse_without-paging.raw | 1 + ..._connection_print_terse_without-paging.yml | 27 +++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm create mode 100644 tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw create mode 100644 tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 12bed5edd8..2ced0dd267 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -838,6 +838,7 @@ linux_arp_-a.textfsm, .*, linux, arp -a linux_vzlist.textfsm, .*, linux, vzlist linux_top.textfsm, .*, linux, top +mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip firewall con[[nection]] p[[rint]] t[[erse]] wi[[thout-paging]] mikrotik_routeros_interface_bridge_host_print_terse_without-paging.textfsm, .*, mikrotik_routeros, [[/]]in[[terface]] b[[ridge]] h[[ost]] p[[rint]] t[[erse]] wi[[thout-paging]] mikrotik_routeros_ip_hotspot_ip-binding_print_terse_without-paging.textfsm, .*, mikrotik_routeros, [[/]]ip h[[otspot]] ip-b[[inding]] p[[rint]] t[[erse]] wi[[thout-paging]] mikrotik_routeros_routing_ospf_neighbor_print_terse_without-paging.textfsm, .*, mikrotik_routeros, [[/]]r[[outing]] o[[spf]] nei[[ghbor]] p[[rint]] t[[erse]] wi[[thout-paging]] diff --git a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm new file mode 100644 index 0000000000..7d5de4f829 --- /dev/null +++ b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm @@ -0,0 +1,29 @@ +Value INDEX (\d+) +Value SEEN_REPLY (S?) +Value ASSURED (A?) +Value CONFIRMED (C?) +Value PROTOCOL (\w+) +Value SOURCE_ADDRESS (\S+) +Value SOURCE_PORT (\S+) +Value DESTINATION_ADDRESS (\S+) +Value DESTINATION_PORT (\S+) +Value REPLY_SOURCE_ADDRESS (\S+) +Value REPLY_SOURCE_PORT (\S+) +Value REPLY_DESTINATION_ADDRESS (\S+) +Value REPLY_DESTINATION_PORT (\S+) +Value TCP_STATE (\S+) +Value TIMEOUT (\S+) +Value ORIGIN_PACKETS (\d.+\d|\d+) +Value ORIGIN_BYTES (\d.+\d|\d+) +Value ORIGIN_FASTTRACK_PACKETS (\d.+\d|\d+) +Value ORIGIN_FASTTRACK_BYTES (\d.+\d|\d+) +Value REPLY_PACKETS (\d.+\d|\d+) +Value REPLY_BYTES (\d.+\d|\d+) +Value REPLY_FASTTRACK_PACKETS (\d.+\d|\d+) +Value REPLY_FASTTRACK_BYTES (\d.+\d|\d+) +Value ORIGIN_RATE (\S+) +Value REPLY_RATE (\S+) + +Start + ^\s*${INDEX}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + ^. -> Error \ No newline at end of file diff --git a/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw new file mode 100644 index 0000000000..3e965edb04 --- /dev/null +++ b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw @@ -0,0 +1 @@ +0 SAC protocol=tcp src-address=172.31.255.29 src-port=56454 dst-address=172.31.255.30 dst-port=22 reply-src-address=172.31.255.30 reply-src-port=22 reply-dst-address=172.31.255.29 reply-dst-port=56454 tcp-state=established timeout=23h59m52s orig-packets=520 orig-bytes=47 603 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=363 repl-bytes=53 460 repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=1760bps repl-rate=6.4kbps \ No newline at end of file diff --git a/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml new file mode 100644 index 0000000000..7e9e04ab7c --- /dev/null +++ b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml @@ -0,0 +1,27 @@ +--- +parsed_sample: + - assured: "A" + confirmed: "C" + destination_address: "172.31.255.30" + destination_port: "22" + index: "0" + origin_bytes: "47 603" + origin_fasttrack_bytes: "0" + origin_fasttrack_packets: "0" + origin_packets: "520" + origin_rate: "1760bps" + protocol: "tcp" + reply_bytes: "53 460" + reply_destination_address: "172.31.255.29" + reply_destination_port: "56454" + reply_fasttrack_bytes: "0" + reply_fasttrack_packets: "0" + reply_packets: "363" + reply_rate: "6.4kbps" + reply_source_address: "172.31.255.30" + reply_source_port: "22" + seen_reply: "S" + source_address: "172.31.255.29" + source_port: "56454" + tcp_state: "established" + timeout: "23h59m52s" From 477b6e5c25937014aa5a01ae1731784e909461d8 Mon Sep 17 00:00:00 2001 From: evilmonkey19 Date: Tue, 4 Nov 2025 14:16:47 +0100 Subject: [PATCH 2/4] Added new flags and augmented tests --- ...nection_print_terse_without-paging.textfsm | 13 +++++- ..._connection_print_terse_without-paging.raw | 3 +- ..._connection_print_terse_without-paging.yml | 43 +++++++++++++++++++ 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm index 7d5de4f829..8318f1be68 100644 --- a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm +++ b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm @@ -1,7 +1,13 @@ Value INDEX (\d+) +Value EXPECTED (E?) Value SEEN_REPLY (S?) Value ASSURED (A?) Value CONFIRMED (C?) +Value DYING (D?) +Value FASTTRACK (F?) +Value HARDWARE_OFFLOAD (H?) +Value SOURCE_NAT (s?) +Value DESTINATION_NAT (d?) Value PROTOCOL (\w+) Value SOURCE_ADDRESS (\S+) Value SOURCE_PORT (\S+) @@ -12,6 +18,9 @@ Value REPLY_SOURCE_PORT (\S+) Value REPLY_DESTINATION_ADDRESS (\S+) Value REPLY_DESTINATION_PORT (\S+) Value TCP_STATE (\S+) +Value ICMP_TYPE (\d+) +Value ICMP_CODE (\d+) +Value ICMP_ID (\d+) Value TIMEOUT (\S+) Value ORIGIN_PACKETS (\d.+\d|\d+) Value ORIGIN_BYTES (\d.+\d|\d+) @@ -25,5 +34,7 @@ Value ORIGIN_RATE (\S+) Value REPLY_RATE (\S+) Start - ^\s*${INDEX}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + # Copy flags for new lines: ${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT} + ^\s*${INDEX}\s*${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT}\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + ^\s*${INDEX}\s*${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT}\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*dst-address=${DESTINATION_ADDRESS}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*icmp-type=${ICMP_TYPE}\s*icmp-code=${ICMP_CODE}\s*icmp-id=${ICMP_ID}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record ^. -> Error \ No newline at end of file diff --git a/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw index 3e965edb04..d29a07c2af 100644 --- a/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw +++ b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.raw @@ -1 +1,2 @@ -0 SAC protocol=tcp src-address=172.31.255.29 src-port=56454 dst-address=172.31.255.30 dst-port=22 reply-src-address=172.31.255.30 reply-src-port=22 reply-dst-address=172.31.255.29 reply-dst-port=56454 tcp-state=established timeout=23h59m52s orig-packets=520 orig-bytes=47 603 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=363 repl-bytes=53 460 repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=1760bps repl-rate=6.4kbps \ No newline at end of file +0 SAC protocol=tcp src-address=172.31.255.29 src-port=56454 dst-address=172.31.255.30 dst-port=22 reply-src-address=172.31.255.30 reply-src-port=22 reply-dst-address=172.31.255.29 reply-dst-port=56454 tcp-state=established timeout=23h59m52s orig-packets=520 orig-bytes=47 603 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=363 repl-bytes=53 460 repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=1760bps repl-rate=6.4kbps +1 S Cs protocol=icmp src-address=192.168.80.254 dst-address=216.58.215.142 reply-src-address=216.58.215.142 reply-dst-address=172.31.255.30 icmp-type=8 icmp-code=0 icmp-id=69 timeout=9s orig-packets=7 269 orig-bytes=610 596 orig-fasttrack-packets=0 orig-fasttrack-bytes=0 repl-packets=7 269 repl-bytes=610 596 repl-fasttrack-packets=0 repl-fasttrack-bytes=0 orig-rate=1344bps repl-rate=1344bps diff --git a/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml index 7e9e04ab7c..b56f39aa01 100644 --- a/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml +++ b/tests/mikrotik_routeros/ip_firewall_connection_print_terse_without-paging/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.yml @@ -3,7 +3,15 @@ parsed_sample: - assured: "A" confirmed: "C" destination_address: "172.31.255.30" + destination_nat: "" destination_port: "22" + dying: "" + expected: "" + fasttrack: "" + hardware_offload: "" + icmp_code: "" + icmp_id: "" + icmp_type: "" index: "0" origin_bytes: "47 603" origin_fasttrack_bytes: "0" @@ -22,6 +30,41 @@ parsed_sample: reply_source_port: "22" seen_reply: "S" source_address: "172.31.255.29" + source_nat: "" source_port: "56454" tcp_state: "established" timeout: "23h59m52s" + - assured: "" + confirmed: "C" + destination_address: "216.58.215.142" + destination_nat: "" + destination_port: "" + dying: "" + expected: "" + fasttrack: "" + hardware_offload: "" + icmp_code: "0" + icmp_id: "69" + icmp_type: "8" + index: "1" + origin_bytes: "610 596" + origin_fasttrack_bytes: "0" + origin_fasttrack_packets: "0" + origin_packets: "7 269" + origin_rate: "1344bps" + protocol: "icmp" + reply_bytes: "610 596" + reply_destination_address: "172.31.255.30" + reply_destination_port: "" + reply_fasttrack_bytes: "0" + reply_fasttrack_packets: "0" + reply_packets: "7 269" + reply_rate: "1344bps" + reply_source_address: "216.58.215.142" + reply_source_port: "" + seen_reply: "S" + source_address: "192.168.80.254" + source_nat: "s" + source_port: "" + tcp_state: "" + timeout: "9s" From 02bca3e0fed73b76e3fcb9dac59b0939ba05b953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enric=20Perpiny=C3=A0=20Pitarch?= Date: Tue, 11 Nov 2025 10:27:15 +0000 Subject: [PATCH 3/4] Done change suggested by @mjbear --- ...nection_print_terse_without-paging.textfsm | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm index 8318f1be68..dcde506827 100644 --- a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm +++ b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm @@ -1,13 +1,13 @@ Value INDEX (\d+) -Value EXPECTED (E?) -Value SEEN_REPLY (S?) -Value ASSURED (A?) -Value CONFIRMED (C?) -Value DYING (D?) -Value FASTTRACK (F?) -Value HARDWARE_OFFLOAD (H?) -Value SOURCE_NAT (s?) -Value DESTINATION_NAT (d?) +Value EXPECTED (E) +Value SEEN_REPLY (S) +Value ASSURED (A) +Value CONFIRMED (C) +Value DYING (D) +Value FASTTRACK (F) +Value HARDWARE_OFFLOAD (H) +Value SOURCE_NAT (s) +Value DESTINATION_NAT (d) Value PROTOCOL (\w+) Value SOURCE_ADDRESS (\S+) Value SOURCE_PORT (\S+) @@ -35,6 +35,6 @@ Value REPLY_RATE (\S+) Start # Copy flags for new lines: ${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT} - ^\s*${INDEX}\s*${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT}\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record - ^\s*${INDEX}\s*${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT}\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*dst-address=${DESTINATION_ADDRESS}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*icmp-type=${ICMP_TYPE}\s*icmp-code=${ICMP_CODE}\s*icmp-id=${ICMP_ID}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + ^\s*${INDEX}(\s*${EXPECTED})?(\s*${SEEN_REPLY})?(\s*${ASSURED})?(\s*${CONFIRMED})?(\s*${DYING})?(\s*${FASTTRACK})?(\s*${HARDWARE_OFFLOAD})?(\s*${SOURCE_NAT})?(\s*${DESTINATION_NAT})?\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + ^\s*${INDEX}(\s*${EXPECTED})?(\s*${SEEN_REPLY})?(\s*${ASSURED})?(\s*${CONFIRMED})?(\s*${DYING})?(\s*${FASTTRACK})?(\s*${HARDWARE_OFFLOAD})?(\s*${SOURCE_NAT})?(\s*${DESTINATION_NAT})?\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*dst-address=${DESTINATION_ADDRESS}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*icmp-type=${ICMP_TYPE}\s*icmp-code=${ICMP_CODE}\s*icmp-id=${ICMP_ID}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record ^. -> Error \ No newline at end of file From e2ff5391ec3e5176876fb3fa768724d79342a060 Mon Sep 17 00:00:00 2001 From: Michael Bear <38406045+mjbear@users.noreply.github.com> Date: Sat, 22 Nov 2025 14:22:10 -0500 Subject: [PATCH 4/4] Reduce extra parens for optional status codes Since there are no other characters along with the capture group that are optional, we can simply remove parentheses. --- ..._ip_firewall_connection_print_terse_without-paging.textfsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm index dcde506827..db1161b62e 100644 --- a/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm +++ b/ntc_templates/templates/mikrotik_routeros_ip_firewall_connection_print_terse_without-paging.textfsm @@ -35,6 +35,6 @@ Value REPLY_RATE (\S+) Start # Copy flags for new lines: ${EXPECTED}\s*${SEEN_REPLY}\s*${ASSURED}\s*${CONFIRMED}\s*${DYING}\s*${FASTTRACK}\s*${HARDWARE_OFFLOAD}\s*${SOURCE_NAT}\s*${DESTINATION_NAT} - ^\s*${INDEX}(\s*${EXPECTED})?(\s*${SEEN_REPLY})?(\s*${ASSURED})?(\s*${CONFIRMED})?(\s*${DYING})?(\s*${FASTTRACK})?(\s*${HARDWARE_OFFLOAD})?(\s*${SOURCE_NAT})?(\s*${DESTINATION_NAT})?\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record - ^\s*${INDEX}(\s*${EXPECTED})?(\s*${SEEN_REPLY})?(\s*${ASSURED})?(\s*${CONFIRMED})?(\s*${DYING})?(\s*${FASTTRACK})?(\s*${HARDWARE_OFFLOAD})?(\s*${SOURCE_NAT})?(\s*${DESTINATION_NAT})?\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*dst-address=${DESTINATION_ADDRESS}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*icmp-type=${ICMP_TYPE}\s*icmp-code=${ICMP_CODE}\s*icmp-id=${ICMP_ID}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + ^\s*${INDEX}\s*${EXPECTED}?\s*${SEEN_REPLY}?\s*${ASSURED}?\s*${CONFIRMED}?\s*${DYING}?\s*${FASTTRACK}?\s*${HARDWARE_OFFLOAD}?\s*${SOURCE_NAT}?\s*${DESTINATION_NAT}?\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*src-port=${SOURCE_PORT}\s*dst-address=${DESTINATION_ADDRESS}\s*dst-port=${DESTINATION_PORT}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-src-port=${REPLY_SOURCE_PORT}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*reply-dst-port=${REPLY_DESTINATION_PORT}\s*tcp-state=${TCP_STATE}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record + ^\s*${INDEX}\s*${EXPECTED}?\s*${SEEN_REPLY}?\s*${ASSURED}?\s*${CONFIRMED}?\s*${DYING}?\s*${FASTTRACK}?\s*${HARDWARE_OFFLOAD}?\s*${SOURCE_NAT}?\s*${DESTINATION_NAT}?\s*protocol=${PROTOCOL}\s*src-address=${SOURCE_ADDRESS}\s*dst-address=${DESTINATION_ADDRESS}\s*reply-src-address=${REPLY_SOURCE_ADDRESS}\s*reply-dst-address=${REPLY_DESTINATION_ADDRESS}\s*icmp-type=${ICMP_TYPE}\s*icmp-code=${ICMP_CODE}\s*icmp-id=${ICMP_ID}\s*timeout=${TIMEOUT}\s*orig-packets=${ORIGIN_PACKETS}\s*orig-bytes=${ORIGIN_BYTES}\s*orig-fasttrack-packets=${ORIGIN_FASTTRACK_PACKETS}\s*orig-fasttrack-bytes=${ORIGIN_FASTTRACK_BYTES}\s*repl-packets=${REPLY_PACKETS}\s*repl-bytes=${REPLY_BYTES}\s*repl-fasttrack-packets=${REPLY_FASTTRACK_PACKETS}\s*repl-fasttrack-bytes=${REPLY_FASTTRACK_BYTES}\s*orig-rate=${ORIGIN_RATE}\s*repl-rate=${REPLY_RATE}\s*$$ -> Record ^. -> Error \ No newline at end of file