From 45b20a949931c6b3f3bb66fe5eee7e359b8c8056 Mon Sep 17 00:00:00 2001 From: Micah Culpepper Date: Wed, 29 Apr 2020 14:07:04 -0500 Subject: [PATCH] New Template: Adds support for Cisco FTD and cisco_asa_ping (#654) --- templates/cisco_asa_ping.textfsm | 19 +++++++++++++++++++ templates/index | 3 ++- tests/cisco_asa/ping/cisco_asa_ping.raw | 4 ++++ tests/cisco_asa/ping/cisco_asa_ping.yml | 12 ++++++++++++ tests/cisco_ftd/ping/cisco_ftd_ping.raw | 4 ++++ tests/cisco_ftd/ping/cisco_ftd_ping.yml | 12 ++++++++++++ tests/test_index_order.py | 1 + 7 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 templates/cisco_asa_ping.textfsm create mode 100644 tests/cisco_asa/ping/cisco_asa_ping.raw create mode 100644 tests/cisco_asa/ping/cisco_asa_ping.yml create mode 100644 tests/cisco_ftd/ping/cisco_ftd_ping.raw create mode 100644 tests/cisco_ftd/ping/cisco_ftd_ping.yml diff --git a/templates/cisco_asa_ping.textfsm b/templates/cisco_asa_ping.textfsm new file mode 100644 index 0000000000..5830166e2f --- /dev/null +++ b/templates/cisco_asa_ping.textfsm @@ -0,0 +1,19 @@ +Value Required SENT_QTY (\d+) +Value Required SENT_TYPE (.*) +Value Required DESTINATION (\S+) +Value Required TIMEOUT (\d+) +Value Required RESPONSE_STREAM ([\.\!]+) +Value Required SUCCESS_PCT (\d+) +Value Required SUCCESS_QTY (\d+) +Value Required RTT_MIN (\d+) +Value Required RTT_AVG (\d+) +Value Required 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: + ^${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}\s+ms + ^\s*$$ + ^. -> Error diff --git a/templates/index b/templates/index index 51f70e3ebe..b357df9e05 100644 --- a/templates/index +++ b/templates/index @@ -136,8 +136,9 @@ cisco_asa_show_version.textfsm, .*, cisco_asa, sh[[ow]] ver[[sion]] cisco_asa_show_route.textfsm, .*, cisco_asa, sh[[ow]] ro[[ute]] cisco_asa_show_xlate.textfsm, .*, cisco_asa, sh[[ow]] x[[late]] cisco_asa_show_name.textfsm, .*, cisco_asa, sh[[ow]] nam[[e]] -cisco_asa_show_arp.textfsm, .*, cisco_asa, sh[[ow]] arp +cisco_asa_show_arp.textfsm, .*, cisco_(asa|ftd), sh[[ow]] arp cisco_asa_show_nat.textfsm, .*, cisco_asa, sh[[ow]] nat +cisco_asa_ping.textfsm, .*, cisco_(asa|ftd), ping cisco_asa_dir.textfsm, .*, cisco_asa, dir cisco_ios_show_module.textfsm:cisco_ios_show_module_status.textfsm:cisco_ios_show_module_submodule.textfsm:cisco_ios_show_module_online_diag.textfsm, .*, cisco_ios, sh[[ow]] mod[[ule]] diff --git a/tests/cisco_asa/ping/cisco_asa_ping.raw b/tests/cisco_asa/ping/cisco_asa_ping.raw new file mode 100644 index 0000000000..ccc133732d --- /dev/null +++ b/tests/cisco_asa/ping/cisco_asa_ping.raw @@ -0,0 +1,4 @@ +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 192.168.10.45, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/10 ms diff --git a/tests/cisco_asa/ping/cisco_asa_ping.yml b/tests/cisco_asa/ping/cisco_asa_ping.yml new file mode 100644 index 0000000000..9f44b9337c --- /dev/null +++ b/tests/cisco_asa/ping/cisco_asa_ping.yml @@ -0,0 +1,12 @@ +--- +parsed_sample: + - sent_qty: "5" + sent_type: "100-byte ICMP Echos" + destination: "192.168.10.45" + timeout: "2" + response_stream: "!!!!!" + success_pct: "100" + success_qty: "5" + rtt_min: "1" + rtt_avg: "2" + rtt_max: "10" diff --git a/tests/cisco_ftd/ping/cisco_ftd_ping.raw b/tests/cisco_ftd/ping/cisco_ftd_ping.raw new file mode 100644 index 0000000000..9f3b7f0768 --- /dev/null +++ b/tests/cisco_ftd/ping/cisco_ftd_ping.raw @@ -0,0 +1,4 @@ +Type escape sequence to abort. +Sending 5, 100-byte ICMP Echos to 10.91.108.200, timeout is 2 seconds: +!!!!! +Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms diff --git a/tests/cisco_ftd/ping/cisco_ftd_ping.yml b/tests/cisco_ftd/ping/cisco_ftd_ping.yml new file mode 100644 index 0000000000..f60516b544 --- /dev/null +++ b/tests/cisco_ftd/ping/cisco_ftd_ping.yml @@ -0,0 +1,12 @@ +--- +parsed_sample: + - sent_qty: "5" + sent_type: "100-byte ICMP Echos" + destination: "10.91.108.200" + timeout: "2" + response_stream: "!!!!!" + success_pct: "100" + success_qty: "5" + rtt_min: "1" + rtt_avg: "1" + rtt_max: "1" diff --git a/tests/test_index_order.py b/tests/test_index_order.py index 8ac187f468..01dda63add 100755 --- a/tests/test_index_order.py +++ b/tests/test_index_order.py @@ -77,6 +77,7 @@ def test_index_ordering(): "checkpoint_gaia", "ciena_saos", "cisco_asa", + "cisco_ftd", "cisco_ios", "cisco_nxos", "cisco_s300",