From b29486685619d07d28dfb5976db65f337f2d5d35 Mon Sep 17 00:00:00 2001 From: Maxim Shpak Date: Wed, 31 Jan 2024 16:40:37 +0300 Subject: [PATCH] Fix Fortinet's 'execute ping' template --- .../templates/fortinet_execute_ping.textfsm | 1 + .../fortinet_execute_ping_sendto_failed.raw | 8 ++++++++ .../fortinet_execute_ping_sendto_failed.yml | 14 ++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.raw create mode 100644 tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.yml diff --git a/ntc_templates/templates/fortinet_execute_ping.textfsm b/ntc_templates/templates/fortinet_execute_ping.textfsm index fc8ffaf7b0..bd0f287d01 100644 --- a/ntc_templates/templates/fortinet_execute_ping.textfsm +++ b/ntc_templates/templates/fortinet_execute_ping.textfsm @@ -14,6 +14,7 @@ Value MAX_RTT (\d+(?:\.\d+)?) Start ^\s*PING.*\s*$$ ^\s*${SENT_PACKET_SIZE}\s+bytes\s+from\s+${SENT_PACKET_ADDRESS}:\s+icmp_seq=${SENT_PACKET_ICMP_SEQ}\s+ttl=${SENT_PACKET_TTL}\s+time=${SENT_PACKET_TIME}\s+.*$$ + ^\s*sendto\s+failed\s*$$ ^\s*---\s+${ADDRESS}\s+ping\s+statistics\s+---\s*$$ ^\s*${TRANSMITTED}\s+packets\s+transmitted\,\s+${RECEIVED}\s+packets\s+received\,\s+${PACKET_LOSS}\%\s+packet\s+loss\s*$$ ^\s*round-trip\s+min/avg/max\s+=\s+${MIN_RTT}/${AVG_RTT}/${MAX_RTT}\s+ms\s*$$ diff --git a/tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.raw b/tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.raw new file mode 100644 index 0000000000..ad20a82efd --- /dev/null +++ b/tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.raw @@ -0,0 +1,8 @@ +PING 8.8.8.8 (8.8.8.8): 56 data bytes +sendto failed +sendto failed +sendto failed +sendto failed + +--- 8.8.8.8 ping statistics --- +10 packets transmitted, 0 packets received, 100% packet loss diff --git a/tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.yml b/tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.yml new file mode 100644 index 0000000000..4ce4d38493 --- /dev/null +++ b/tests/fortinet/execute_ping/fortinet_execute_ping_sendto_failed.yml @@ -0,0 +1,14 @@ +--- +parsed_sample: + - address: "8.8.8.8" + avg_rtt: "" + max_rtt: "" + min_rtt: "" + packet_loss: "100" + received: "0" + sent_packet_address: [] + sent_packet_icmp_seq: [] + sent_packet_size: [] + sent_packet_time: [] + sent_packet_ttl: [] + transmitted: "10"