From c0041b2f48efa74ce4bdc28fb0d863b05c9d0941 Mon Sep 17 00:00:00 2001 From: "Keith E. Truesdell" <2074768+KeithETruesdell@users.noreply.github.com> Date: Wed, 18 Jan 2023 13:40:51 -0500 Subject: [PATCH] Add template for cisco ios ping (#1282) --- .gitignore | 1 + .../templates/cisco_ios_ping.textfsm | 23 +++++++++++++++++++ ntc_templates/templates/index | 1 + tests/cisco_ios/ping/cisco_ios_ping.raw | 4 ++++ tests/cisco_ios/ping/cisco_ios_ping.yml | 14 +++++++++++ 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.raw | 5 ++++ tests/cisco_ios/ping/cisco_ios_ping_df.yml | 14 +++++++++++ .../cisco_ios/ping/cisco_ios_ping_df_fail.raw | 5 ++++ .../cisco_ios/ping/cisco_ios_ping_df_fail.yml | 14 +++++++++++ tests/cisco_ios/ping/cisco_ios_ping_fail.raw | 4 ++++ tests/cisco_ios/ping/cisco_ios_ping_fail.yml | 14 +++++++++++ .../cisco_ios/ping/cisco_ios_ping_source.raw | 5 ++++ .../cisco_ios/ping/cisco_ios_ping_source.yml | 14 +++++++++++ .../ping/cisco_ios_ping_source_df.raw | 6 +++++ .../ping/cisco_ios_ping_source_df.yml | 14 +++++++++++ .../ping/cisco_ios_ping_source_df_fail.raw | 6 +++++ .../ping/cisco_ios_ping_source_df_fail.yml | 14 +++++++++++ .../ping/cisco_ios_ping_source_fail.raw | 5 ++++ .../ping/cisco_ios_ping_source_fail.yml | 14 +++++++++++ 21 files changed, 199 insertions(+) create mode 100644 ntc_templates/templates/cisco_ios_ping.textfsm create mode 100644 tests/cisco_ios/ping/cisco_ios_ping.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping.yml create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_200.raw create mode 100644 tests/cisco_ios/ping/cisco_ios_ping_200.yml 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/.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/* diff --git a/ntc_templates/templates/cisco_ios_ping.textfsm b/ntc_templates/templates/cisco_ios_ping.textfsm new file mode 100644 index 0000000000..815546879c --- /dev/null +++ b/ntc_templates/templates/cisco_ios_ping.textfsm @@ -0,0 +1,23 @@ +Value Required SENT_QTY (\d+) +Value Required SENT_TYPE (.*) +Value Required DESTINATION (\S+) +Value Required TIMEOUT (\d+) +Value SOURCE (\S+) +Value List 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 out if raw data does not match any above rules. + ^.* -> Error "Could not parse line:" diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index f5bc11f248..4fe90116df 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -293,6 +293,7 @@ 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.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]] 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..75eba41c9b --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping.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 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 new file mode 100644 index 0000000000..a1ee5d8e29 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping.yml @@ -0,0 +1,14 @@ +--- +parsed_sample: + - sent_qty: "5" + sent_type: "100-byte ICMP Echos" + destination: "192.168.0.1" + timeout: "2" + source: "" + response_stream: + - "!!!!!" + success_pct: "100" + success_qty: "5" + rtt_min: "1" + rtt_avg: "2" + rtt_max: "10" 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.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..698a686af3 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_df.yml @@ -0,0 +1,14 @@ +--- +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..976d224b77 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_df_fail.yml @@ -0,0 +1,14 @@ +--- +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..0570e179af --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_fail.yml @@ -0,0 +1,14 @@ +--- +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..2e0d2d7aa5 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source.yml @@ -0,0 +1,14 @@ +--- +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..2e0d2d7aa5 --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df.yml @@ -0,0 +1,14 @@ +--- +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..ee6838b45b --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_df_fail.yml @@ -0,0 +1,14 @@ +--- +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..ee6838b45b --- /dev/null +++ b/tests/cisco_ios/ping/cisco_ios_ping_source_fail.yml @@ -0,0 +1,14 @@ +--- +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"