Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortinet 'execute ping' template #1480

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ntc_templates/templates/fortinet_execute_ping.textfsm
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions ntc_templates/templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ fortinet_get_system_ha_status.textfsm, .*, fortinet, g[[et]] sy[[stem]] ha s[[ta
fortinet_get_system_interface.textfsm, .*, fortinet, g[[et]] sy[[stem]] in[[terface]]
fortinet_get_system_status.textfsm, .*, fortinet, g[[et]] sy[[stem]] stat[[us]]
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]]
Expand Down
10 changes: 10 additions & 0 deletions tests/fortinet/execute_ping/fortinet_execute_ping.raw
Original file line number Diff line number Diff line change
@@ -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
39 changes: 39 additions & 0 deletions tests/fortinet/execute_ping/fortinet_execute_ping.yml
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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"
Loading