File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ def ping(target,
2121 out = sys .stdout ,
2222 match = False ,
2323 source = None ,
24- out_format = 'legacy' ):
24+ out_format = 'legacy' ,
25+ cisco = False ):
2526 """Pings a remote host and handles the responses
2627
2728 :param target: The remote hostname or IP address to ping
@@ -85,4 +86,16 @@ def ping(target,
8586
8687 SEED_IDs .remove (seed_id )
8788
89+ if cisco :
90+ # Cisco-like summary
91+ sent = comm .responses .stats_packets_sent
92+ received = comm .responses .stats_packets_returned
93+ loss = int ((1 - received / sent ) * 100 )
94+ min_rtt = comm .responses .rtt_min_ms
95+ avg_rtt = comm .responses .rtt_avg_ms
96+ max_rtt = comm .responses .rtt_max_ms
97+
98+ print (f"\n Success rate is { received } /{ sent } ({ 100 - loss } %), "
99+ f"round-trip min/avg/max = { min_rtt } /{ avg_rtt } /{ max_rtt } ms" , file = out )
100+
88101 return comm .responses
You can’t perform that action at this time.
0 commit comments