MCPcopy Create free account
hub / github.com/mininet/mininet / pingFull

Method pingFull

mininet/net.py:733–764  ·  view source on GitHub ↗

Ping between all specified hosts and return all data. hosts: list of hosts timeout: time to wait for a response, as string returns: all ping data; see function body.

( self, hosts=None, timeout=None )

Source from the content-addressed store, hash-verified

731 return sent, received, rttmin, rttavg, rttmax, rttdev
732
733 def pingFull( self, hosts=None, timeout=None ):
734 """Ping between all specified hosts and return all data.
735 hosts: list of hosts
736 timeout: time to wait for a response, as string
737 returns: all ping data; see function body."""
738 # should we check if running?
739 # Each value is a tuple: (src, dsd, [all ping outputs])
740 all_outputs = []
741 if not hosts:
742 hosts = self.hosts
743 output( '*** Ping: testing ping reachability\n' )
744 for node in hosts:
745 output( '%s -> ' % node.name )
746 for dest in hosts:
747 if node != dest:
748 opts = ''
749 if timeout:
750 opts = '-W %s' % timeout
751 result = node.cmd( 'ping -c1 %s %s' % (opts, dest.IP()) )
752 outputs = self._parsePingFull( result )
753 sent, received, rttmin, rttavg, rttmax, rttdev = outputs
754 all_outputs.append( (node, dest, outputs) )
755 output( ( '%s ' % dest.name ) if received else 'X ' )
756 output( '\n' )
757 output( "*** Results: \n" )
758 for outputs in all_outputs:
759 src, dest, ping_outputs = outputs
760 sent, received, rttmin, rttavg, rttmax, rttdev = ping_outputs
761 output( " %s->%s: %s/%s, " % (src, dest, sent, received ) )
762 output( "rtt min/avg/max/mdev %0.3f/%0.3f/%0.3f/%0.3f ms\n" %
763 (rttmin, rttavg, rttmax, rttdev) )
764 return all_outputs
765
766 def pingAll( self, timeout=None ):
767 """Ping between all hosts.

Callers 3

pingAllFullMethod · 0.95
pingPairFullMethod · 0.95
testLinkDelayMethod · 0.95

Calls 4

_parsePingFullMethod · 0.95
appendMethod · 0.80
cmdMethod · 0.45
IPMethod · 0.45

Tested by 1

testLinkDelayMethod · 0.76