diff --git a/ntc_templates/templates/fortinet_execute_ping.textfsm b/ntc_templates/templates/fortinet_execute_ping.textfsm new file mode 100644 index 0000000000..fc8ffaf7b0 --- /dev/null +++ b/ntc_templates/templates/fortinet_execute_ping.textfsm @@ -0,0 +1,21 @@ +Value List SENT_PACKET_SIZE (\d+) +Value List SENT_PACKET_ADDRESS (\S+) +Value List SENT_PACKET_ICMP_SEQ (\d+) +Value List SENT_PACKET_TTL (\d+) +Value List SENT_PACKET_TIME (\d+(?:\.\d+)?) +Value ADDRESS (\S+) +Value TRANSMITTED (\d+) +Value RECEIVED (\d+) +Value PACKET_LOSS (\d+) +Value MIN_RTT (\d+(?:\.\d+)?) +Value AVG_RTT (\d+(?:\.\d+)?) +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*---\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*$$ + ^\s*$$ + ^. -> Error diff --git a/ntc_templates/templates/index b/ntc_templates/templates/index index 28563697f7..f7293099d6 100644 --- a/ntc_templates/templates/index +++ b/ntc_templates/templates/index @@ -583,6 +583,7 @@ fortinet_get_system_interface.textfsm, .*, fortinet, g[[et]] sy[[stem]] in[[terf fortinet_get_system_status.textfsm, .*, fortinet, g[[et]] sy[[stem]] stat[[us]] fortinet_get_hardware_nic.textfsm, .*, fortinet, g[[et]] hard[[ware]] n[[ic]] fortinet_get_system_arp.textfsm, .*, fortinet, g[[et]] sy[[stem]] arp +fortinet_execute_ping.textfsm, .*, fortinet, exec[[ute]] ping fortinet_execute_time.textfsm, .*, fortinet, exec[[ute]] ti[[me]] hp_comware_display_lldp_neighbor-information_verbose.textfsm, .*, hp_comware, di[[splay]] ll[[dp]] n[[eighbor-information]] v[[erbose]] diff --git a/tests/fortinet/execute_ping/fortinet_execute_ping.raw b/tests/fortinet/execute_ping/fortinet_execute_ping.raw new file mode 100644 index 0000000000..b38d110816 --- /dev/null +++ b/tests/fortinet/execute_ping/fortinet_execute_ping.raw @@ -0,0 +1,10 @@ +PING 8.8.8.8 (8.8.8.8): 56 data bytes +64 bytes from 8.8.8.8: icmp_seq=0 ttl=110 time=25.9 ms +64 bytes from 8.8.8.8: icmp_seq=1 ttl=110 time=25.8 ms +64 bytes from 8.8.8.8: icmp_seq=2 ttl=110 time=25.8 ms +64 bytes from 8.8.8.8: icmp_seq=3 ttl=110 time=25.8 ms +64 bytes from 8.8.8.8: icmp_seq=4 ttl=110 time=25.8 ms + +--- 8.8.8.8 ping statistics --- +5 packets transmitted, 5 packets received, 0% packet loss +round-trip min/avg/max = 25.8/25.8/25.9 ms diff --git a/tests/fortinet/execute_ping/fortinet_execute_ping.yml b/tests/fortinet/execute_ping/fortinet_execute_ping.yml new file mode 100644 index 0000000000..9df93df9e7 --- /dev/null +++ b/tests/fortinet/execute_ping/fortinet_execute_ping.yml @@ -0,0 +1,39 @@ +--- +parsed_sample: + - address: "8.8.8.8" + avg_rtt: "25.8" + max_rtt: "25.9" + min_rtt: "25.8" + packet_loss: "0" + received: "5" + sent_packet_address: + - "8.8.8.8" + - "8.8.8.8" + - "8.8.8.8" + - "8.8.8.8" + - "8.8.8.8" + sent_packet_icmp_seq: + - "0" + - "1" + - "2" + - "3" + - "4" + sent_packet_size: + - "64" + - "64" + - "64" + - "64" + - "64" + sent_packet_time: + - "25.9" + - "25.8" + - "25.8" + - "25.8" + - "25.8" + sent_packet_ttl: + - "110" + - "110" + - "110" + - "110" + - "110" + transmitted: "5" diff --git a/tests/fortinet/execute_ping/fortinet_execute_ping_unreachable.raw b/tests/fortinet/execute_ping/fortinet_execute_ping_unreachable.raw new file mode 100644 index 0000000000..fee02ef41e --- /dev/null +++ b/tests/fortinet/execute_ping/fortinet_execute_ping_unreachable.raw @@ -0,0 +1,4 @@ +PING 8.87.8.8 (8.87.8.8): 56 data bytes + +--- 8.87.8.8 ping statistics --- +5 packets transmitted, 0 packets received, 100% packet loss diff --git a/tests/fortinet/execute_ping/fortinet_execute_ping_unreachable.yml b/tests/fortinet/execute_ping/fortinet_execute_ping_unreachable.yml new file mode 100644 index 0000000000..b1e08289c0 --- /dev/null +++ b/tests/fortinet/execute_ping/fortinet_execute_ping_unreachable.yml @@ -0,0 +1,14 @@ +--- +parsed_sample: + - address: "8.87.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: "5"