From b8ed68003b0ecad595a79a339b6a8e2a8d2b2c78 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Thu, 5 Jan 2023 15:53:57 -0500 Subject: [PATCH 1/8] added new cisco ios ping textfsm --- .../templates/cisco_ios_ping.textfsm | 22 +++++++++++++++++++ .../templates/cisco_ios_ping_df.textfsm | 22 +++++++++++++++++++ ntc_templates/templates/index | 2 ++ 3 files changed, 46 insertions(+) create mode 100644 ntc_templates/templates/cisco_ios_ping.textfsm create mode 100644 ntc_templates/templates/cisco_ios_ping_df.textfsm diff --git a/ntc_templates/templates/cisco_ios_ping.textfsm b/ntc_templates/templates/cisco_ios_ping.textfsm new file mode 100644 index 0000000000..4e73d264b2 --- /dev/null +++ b/ntc_templates/templates/cisco_ios_ping.textfsm @@ -0,0 +1,22 @@ +Value Required SENT_QTY (\d+) +Value Required SENT_TYPE (.*) +Value Required DESTINATION (\S+) +Value Required TIMEOUT (\d+) +Value SOURCE (\S+) +Value Required RESPONSE_STREAM ([\.\!]+) +Value Required SUCCESS_PCT (\d+) +Value Required SUCCESS_QTY (\d+) +Value RTT_MIN (\d+) +Value RTT_AVG (\d+) +Value RTT_MAX (\d+) + + +Start + ^Type\s+escape\s+sequence\s+to\s+abort. + ^Sending\s+${SENT_QTY},\s+${SENT_TYPE}\s+to\s+${DESTINATION},\s+timeout\s+is\s+${TIMEOUT}\s+seconds: + ^Packet\s+sent\s+with\s+a\s+source\s+address\s+of\s+${SOURCE} + ^${RESPONSE_STREAM} + ^Success\s+rate\s+is\s+${SUCCESS_PCT}\s+percent\s+\(${SUCCESS_QTY}\/\d+\)(?:,\s+round-trip\s+min/avg/max\s+\=\s+)?(?:${RTT_MIN}/${RTT_AVG}/${RTT_MAX})?(?:\sms)? + ^\s*$$ + ^. -> Error + \ No newline at end of file diff --git a/ntc_templates/templates/cisco_ios_ping_df.textfsm b/ntc_templates/templates/cisco_ios_ping_df.textfsm new file mode 100644 index 0000000000..2a9336ce60 --- /dev/null +++ b/ntc_templates/templates/cisco_ios_ping_df.textfsm @@ -0,0 +1,22 @@ +Value Required SENT_QTY (\d+) +Value Required SENT_TYPE (.*) +Value Required DESTINATION (\S+) +Value Required TIMEOUT (\d+) +Value SOURCE (\S+) +Value Required RESPONSE_STREAM ([\.\!]+) +Value Required SUCCESS_PCT (\d+) +Value Required SUCCESS_QTY (\d+) +Value RTT_MIN (\d+) +Value RTT_AVG (\d+) +Value RTT_MAX (\d+) + + +Start + ^Type\s+escape\s+sequence\s+to\s+abort. + ^Sending\s+${SENT_QTY},\s+${SENT_TYPE}\s+to\s+${DESTINATION},\s+timeout\s+is\s+${TIMEOUT}\s+seconds: + ^Packet\s+sent\s+with\s+a\s+source\s+address\s+of\s+${SOURCE} + ^Packet\s+sent\s+with\s+the\s+DF\s+bit\s+set + ^${RESPONSE_STREAM} + ^Success\s+rate\s+is\s+${SUCCESS_PCT}\s+percent\s+\(${SUCCESS_QTY}\/\d+\)(?:,\s+round-trip\s+min/avg/max\s+\=\s+)?(?:${RTT_MIN}/${RTT_AVG}/${RTT_MAX})?(?:\sms)? + ^\s*$$ + ^. -> Error diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 59d6c6db8b..756fee8ef1 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -290,6 +290,8 @@ cisco_ios_traceroute.textfsm, .*, cisco_ios, tr[[aceroute]] cisco_ios_show_boot.textfsm, .*, cisco_ios, sh[[ow]] boot cisco_ios_show_vlan.textfsm, .*, cisco_ios, sh[[ow]] vlan cisco_ios_show_vrf.textfsm, .*, cisco_ios, sh[[ow]] vrf +cisco_ios_ping_df.textfsm, .*, cisco_ios, ping (?:ipv4) df +cisco_ios_ping.textfsm, .*, cisco_ios, ping cisco_ios_dir.textfsm, .*, cisco_ios, dir cisco_nxos_show_l2rib_internal_permanently-frozen-list.textfsm, .*, cisco_nxos, sh[[ow]] l2ri[[b]] i[[nternal]] pe[[rmanently-frozen-list]] From c57c98e662f12345a2f180f12d112d0f693d060e Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Thu, 5 Jan 2023 15:54:17 -0500 Subject: [PATCH 2/8] added tests for cisco ios ping --- tests/cisco_ios/ping/cisco_ios_ping.raw | 5 +++++ tests/cisco_ios/ping/cisco_ios_ping.yml | 13 +++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 tests/cisco_ios/ping/cisco_ios_ping.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping.yml diff --git a/tests/cisco_ios/ping/cisco_ios_ping.raw b/tests/cisco_ios/ping/cisco_ios_ping.raw new file mode 100644 index 0000000000..dfe9634538 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping.raw @@ -0,0 +1,5 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with a source address of 192.168.0.10 +!!!! +Success rate is 100 percent (4/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping.yml b/tests/cisco_ios/ping/cisco_ios_ping.yml new file mode 100644 index 0000000000..08349a55c7 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "192.168.0.10" + response_stream: "!!!!" + success_pct: "100" + success_qty: "4" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" From 86c7e4f709507dc626576138218f9092861c7086 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Wed, 11 Jan 2023 15:57:35 -0500 Subject: [PATCH 3/8] added the .idea directory for all jetbrains products --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cbb9133b68..1b1e55d7e5 100644 --- a/.gitignore +++ b/.gitignore @@ -290,6 +290,7 @@ fabric.properties # CodeStream plugin # https://plugins.jetbrains.com/plugin/12206-codestream .idea/codestream.xml +.idea/ ### vscode ### .vscode/* From d9bf45d4cf6366c3b3e18224c5fa0e2963ffc762 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Wed, 11 Jan 2023 15:58:29 -0500 Subject: [PATCH 4/8] updated cisco ios ping template to account for possible source and df commands --- ntc_templates/templates/cisco_ios_ping.textfsm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ntc_templates/templates/cisco_ios_ping.textfsm b/ntc_templates/templates/cisco_ios_ping.textfsm index 4e73d264b2..047148bf39 100644 --- a/ntc_templates/templates/cisco_ios_ping.textfsm +++ b/ntc_templates/templates/cisco_ios_ping.textfsm @@ -15,8 +15,9 @@ Start ^Type\s+escape\s+sequence\s+to\s+abort. ^Sending\s+${SENT_QTY},\s+${SENT_TYPE}\s+to\s+${DESTINATION},\s+timeout\s+is\s+${TIMEOUT}\s+seconds: ^Packet\s+sent\s+with\s+a\s+source\s+address\s+of\s+${SOURCE} + ^Packet\s+sent\s+with\s+the\s+DF\s+bit\s+set ^${RESPONSE_STREAM} ^Success\s+rate\s+is\s+${SUCCESS_PCT}\s+percent\s+\(${SUCCESS_QTY}\/\d+\)(?:,\s+round-trip\s+min/avg/max\s+\=\s+)?(?:${RTT_MIN}/${RTT_AVG}/${RTT_MAX})?(?:\sms)? ^\s*$$ - ^. -> Error - \ No newline at end of file + # Error out if raw data does not match any above rules. + ^.* -> Error "Could not parse line:" From 7d705a1afa2f66000c1ca92eedd1cf8ff1e9f6b3 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Wed, 11 Jan 2023 15:59:07 -0500 Subject: [PATCH 5/8] adding the cisco ios ping and dir to the index file --- ntc_templates/templates/index | 1 - 1 file changed, 1 deletion(-) diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 756fee8ef1..2eb6faf0eb 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -290,7 +290,6 @@ cisco_ios_traceroute.textfsm, .*, cisco_ios, tr[[aceroute]] cisco_ios_show_boot.textfsm, .*, cisco_ios, sh[[ow]] boot cisco_ios_show_vlan.textfsm, .*, cisco_ios, sh[[ow]] vlan cisco_ios_show_vrf.textfsm, .*, cisco_ios, sh[[ow]] vrf -cisco_ios_ping_df.textfsm, .*, cisco_ios, ping (?:ipv4) df cisco_ios_ping.textfsm, .*, cisco_ios, ping cisco_ios_dir.textfsm, .*, cisco_ios, dir From 362d27c719a98a5dfb7eb3669fb2c051f001d0fa Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Wed, 11 Jan 2023 16:00:25 -0500 Subject: [PATCH 6/8] adding the cisco ios ping tests, added pass and fail tests for a (1) simple ping, (2) ping with df bit (3) ping with defined source (4) ping with defined source and a df bit --- tests/cisco_ios/ping/cisco_ios_ping.raw | 7 +++---- tests/cisco_ios/ping/cisco_ios_ping.yml | 14 +++++++------- tests/cisco_ios/ping/cisco_ios_ping_df.raw | 5 +++++ tests/cisco_ios/ping/cisco_ios_ping_df.yml | 13 +++++++++++++ tests/cisco_ios/ping/cisco_ios_ping_df_fail.raw | 5 +++++ tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml | 13 +++++++++++++ tests/cisco_ios/ping/cisco_ios_ping_fail.raw | 4 ++++ tests/cisco_ios/ping/cisco_ios_ping_fail.yml | 13 +++++++++++++ tests/cisco_ios/ping/cisco_ios_ping_source.raw | 5 +++++ tests/cisco_ios/ping/cisco_ios_ping_source.yml | 13 +++++++++++++ tests/cisco_ios/ping/cisco_ios_ping_source_df.raw | 6 ++++++ tests/cisco_ios/ping/cisco_ios_ping_source_df.yml | 13 +++++++++++++ .../ping/cisco_ios_ping_source_df_fail.raw | 6 ++++++ .../ping/cisco_ios_ping_source_df_fail.yml | 13 +++++++++++++ .../cisco_ios/ping/cisco_ios_ping_source_fail.raw | 5 +++++ .../cisco_ios/ping/cisco_ios_ping_source_fail.yml | 13 +++++++++++++ 16 files changed, 137 insertions(+), 11 deletions(-) create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_df.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_df.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_df_fail.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_fail.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_fail.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source_df.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source_df.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source_fail.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml diff --git a/tests/cisco_ios/ping/cisco_ios_ping.raw b/tests/cisco_ios/ping/cisco_ios_ping.raw index dfe9634538..75eba41c9b 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping.raw +++ b/tests/cisco_ios/ping/cisco_ios_ping.raw @@ -1,5 +1,4 @@ Type escape sequence to abort. -Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: -Packet sent with a source address of 192.168.0.10 -!!!! -Success rate is 100 percent (4/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file +Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/10 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping.yml b/tests/cisco_ios/ping/cisco_ios_ping.yml index 08349a55c7..e8e42efc59 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping.yml @@ -1,13 +1,13 @@ --- parsed_sample: - - sent_qty: "4" - sent_type: "1500-byte ICMP Echos" + - sent_qty: "5" + sent_type: "100-byte ICMP Echos" destination: "192.168.0.1" timeout: "2" - source: "192.168.0.10" - response_stream: "!!!!" + source: "" + response_stream: "!!!!!" success_pct: "100" - success_qty: "4" + success_qty: "5" rtt_min: "1" - rtt_avg: "8" - rtt_max: "17" + rtt_avg: "2" + rtt_max: "10" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_df.raw b/tests/cisco_ios/ping/cisco_ios_ping_df.raw new file mode 100644 index 0000000000..ab32b3472a --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_df.raw @@ -0,0 +1,5 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with the DF bit set +!!!! +Success rate is 100 percent (4/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_df.yml b/tests/cisco_ios/ping/cisco_ios_ping_df.yml new file mode 100644 index 0000000000..5d883e7409 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_df.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "" + response_stream: "!!!!" + success_pct: "100" + success_qty: "4" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_df_fail.raw b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.raw new file mode 100644 index 0000000000..eac6f2517f --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.raw @@ -0,0 +1,5 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with the DF bit set +.... +Success rate is 0 percent (0/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml new file mode 100644 index 0000000000..0cac79b1d7 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "" + response_stream: "...." + success_pct: "0" + success_qty: "0" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_fail.raw b/tests/cisco_ios/ping/cisco_ios_ping_fail.raw new file mode 100644 index 0000000000..86719caa83 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_fail.raw @@ -0,0 +1,4 @@ +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +..... +Success rate is 0 percent (0/5), round-trip min/avg/max = 1/2/10 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_fail.yml new file mode 100644 index 0000000000..c9ecbeda1f --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_fail.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "5" + sent_type: "100-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "" + response_stream: "....." + success_pct: "0" + success_qty: "0" + rtt_min: "1" + rtt_avg: "2" + rtt_max: "10" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source.raw b/tests/cisco_ios/ping/cisco_ios_ping_source.raw new file mode 100644 index 0000000000..dfe9634538 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source.raw @@ -0,0 +1,5 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with a source address of 192.168.0.10 +!!!! +Success rate is 100 percent (4/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source.yml b/tests/cisco_ios/ping/cisco_ios_ping_source.yml new file mode 100644 index 0000000000..08349a55c7 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "192.168.0.10" + response_stream: "!!!!" + success_pct: "100" + success_qty: "4" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_df.raw b/tests/cisco_ios/ping/cisco_ios_ping_source_df.raw new file mode 100644 index 0000000000..357c64226c --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df.raw @@ -0,0 +1,6 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with a source address of 192.168.0.10 +Packet sent with the DF bit set +!!!! +Success rate is 100 percent (4/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml b/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml new file mode 100644 index 0000000000..08349a55c7 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "192.168.0.10" + response_stream: "!!!!" + success_pct: "100" + success_qty: "4" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.raw b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.raw new file mode 100644 index 0000000000..5427546394 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.raw @@ -0,0 +1,6 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with a source address of 192.168.0.10 +Packet sent with the DF bit set +.... +Success rate is 0 percent (0/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml new file mode 100644 index 0000000000..bdec6b034e --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "192.168.0.10" + response_stream: "...." + success_pct: "0" + success_qty: "0" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_fail.raw b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.raw new file mode 100644 index 0000000000..935ca8dcac --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.raw @@ -0,0 +1,5 @@ +Type escape sequence to abort. +Sending 4, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +Packet sent with a source address of 192.168.0.10 +.... +Success rate is 0 percent (0/4), round-trip min/avg/max = 1/8/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml new file mode 100644 index 0000000000..bdec6b034e --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml @@ -0,0 +1,13 @@ +--- +parsed_sample: + - sent_qty: "4" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "192.168.0.10" + response_stream: "...." + success_pct: "0" + success_qty: "0" + rtt_min: "1" + rtt_avg: "8" + rtt_max: "17" From d41961ae440ef18810c35083383b96c721184af5 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Wed, 18 Jan 2023 11:49:49 -0500 Subject: [PATCH 7/8] removed not needed textfsm template --- .../templates/cisco_ios_ping_df.textfsm | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 ntc_templates/templates/cisco_ios_ping_df.textfsm diff --git a/ntc_templates/templates/cisco_ios_ping_df.textfsm b/ntc_templates/templates/cisco_ios_ping_df.textfsm deleted file mode 100644 index 2a9336ce60..0000000000 --- a/ntc_templates/templates/cisco_ios_ping_df.textfsm +++ /dev/null @@ -1,22 +0,0 @@ -Value Required SENT_QTY (\d+) -Value Required SENT_TYPE (.*) -Value Required DESTINATION (\S+) -Value Required TIMEOUT (\d+) -Value SOURCE (\S+) -Value Required RESPONSE_STREAM ([\.\!]+) -Value Required SUCCESS_PCT (\d+) -Value Required SUCCESS_QTY (\d+) -Value RTT_MIN (\d+) -Value RTT_AVG (\d+) -Value RTT_MAX (\d+) - - -Start - ^Type\s+escape\s+sequence\s+to\s+abort. - ^Sending\s+${SENT_QTY},\s+${SENT_TYPE}\s+to\s+${DESTINATION},\s+timeout\s+is\s+${TIMEOUT}\s+seconds: - ^Packet\s+sent\s+with\s+a\s+source\s+address\s+of\s+${SOURCE} - ^Packet\s+sent\s+with\s+the\s+DF\s+bit\s+set - ^${RESPONSE_STREAM} - ^Success\s+rate\s+is\s+${SUCCESS_PCT}\s+percent\s+\(${SUCCESS_QTY}\/\d+\)(?:,\s+round-trip\s+min/avg/max\s+\=\s+)?(?:${RTT_MIN}/${RTT_AVG}/${RTT_MAX})?(?:\sms)? - ^\s*$$ - ^. -> Error From 0dc3f23dc2da3da023c1345a8ef149367c254dd9 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" Date: Wed, 18 Jan 2023 12:27:14 -0500 Subject: [PATCH 8/8] updated the cisco ios ping template to be a list for the response stream, added a test for 200 pings to force a new line and use the test, adjusted the other tests to also show a returned list --- ntc_templates/templates/cisco_ios_ping.textfsm | 2 +- tests/cisco_ios/ping/cisco_ios_ping.yml | 3 ++- tests/cisco_ios/ping/cisco_ios_ping_200.raw | 6 ++++++ tests/cisco_ios/ping/cisco_ios_ping_200.yml | 16 ++++++++++++++++ tests/cisco_ios/ping/cisco_ios_ping_df.yml | 3 ++- tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml | 3 ++- tests/cisco_ios/ping/cisco_ios_ping_fail.yml | 3 ++- tests/cisco_ios/ping/cisco_ios_ping_source.yml | 3 ++- .../cisco_ios/ping/cisco_ios_ping_source_df.yml | 3 ++- .../ping/cisco_ios_ping_source_df_fail.yml | 3 ++- .../ping/cisco_ios_ping_source_fail.yml | 3 ++- 11 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_200.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_200.yml diff --git a/ntc_templates/templates/cisco_ios_ping.textfsm b/ntc_templates/templates/cisco_ios_ping.textfsm index 047148bf39..815546879c 100644 --- a/ntc_templates/templates/cisco_ios_ping.textfsm +++ b/ntc_templates/templates/cisco_ios_ping.textfsm @@ -3,7 +3,7 @@ Value Required SENT_TYPE (.*) Value Required DESTINATION (\S+) Value Required TIMEOUT (\d+) Value SOURCE (\S+) -Value Required RESPONSE_STREAM ([\.\!]+) +Value List RESPONSE_STREAM ([\.\!]+) Value Required SUCCESS_PCT (\d+) Value Required SUCCESS_QTY (\d+) Value RTT_MIN (\d+) diff --git a/tests/cisco_ios/ping/cisco_ios_ping.yml b/tests/cisco_ios/ping/cisco_ios_ping.yml index e8e42efc59..a1ee5d8e29 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "" - response_stream: "!!!!!" + response_stream: + - "!!!!!" success_pct: "100" success_qty: "5" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_200.raw b/tests/cisco_ios/ping/cisco_ios_ping_200.raw new file mode 100644 index 0000000000..ff81b8589a --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_200.raw @@ -0,0 +1,6 @@ +Type escape sequence to abort. +Sending 200, 1500-byte ICMP Echos to 192.168.0.1, timeout is 2 seconds: +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +Success rate is 100 percent (200/200), round-trip min/avg/max = 1/7/17 ms \ No newline at end of file diff --git a/tests/cisco_ios/ping/cisco_ios_ping_200.yml b/tests/cisco_ios/ping/cisco_ios_ping_200.yml new file mode 100644 index 0000000000..8e6bdb8684 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_200.yml @@ -0,0 +1,16 @@ +--- +parsed_sample: + - sent_qty: "200" + sent_type: "1500-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "" + response_stream: + - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + - "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" + success_pct: "100" + success_qty: "200" + rtt_min: "1" + rtt_avg: "7" + rtt_max: "17" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_df.yml b/tests/cisco_ios/ping/cisco_ios_ping_df.yml index 5d883e7409..698a686af3 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_df.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_df.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "" - response_stream: "!!!!" + response_stream: + - "!!!!" success_pct: "100" success_qty: "4" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml index 0cac79b1d7..976d224b77 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "" - response_stream: "...." + response_stream: + - "...." success_pct: "0" success_qty: "0" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_fail.yml index c9ecbeda1f..0570e179af 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_fail.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_fail.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "" - response_stream: "....." + response_stream: + - "....." success_pct: "0" success_qty: "0" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source.yml b/tests/cisco_ios/ping/cisco_ios_ping_source.yml index 08349a55c7..2e0d2d7aa5 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_source.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_source.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "192.168.0.10" - response_stream: "!!!!" + response_stream: + - "!!!!" success_pct: "100" success_qty: "4" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml b/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml index 08349a55c7..2e0d2d7aa5 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "192.168.0.10" - response_stream: "!!!!" + response_stream: + - "!!!!" success_pct: "100" success_qty: "4" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml index bdec6b034e..ee6838b45b 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "192.168.0.10" - response_stream: "...." + response_stream: + - "...." success_pct: "0" success_qty: "0" rtt_min: "1" diff --git a/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml index bdec6b034e..ee6838b45b 100644 --- a/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml @@ -5,7 +5,8 @@ parsed_sample: destination: "192.168.0.1" timeout: "2" source: "192.168.0.10" - response_stream: "...." + response_stream: + - "...." success_pct: "0" success_qty: "0" rtt_min: "1"