'Ping between all specified hosts.
hosts: list of hosts
timeout: time to wait for a response, as string
returns: ploss packet loss percentage'

def ping(self, hosts=None, timeout=None):

    packets = 0
    lost = 0
    ploss = None
    if (not hosts):
        hosts = self.hosts
        output('***    Ping:    testing    ping    reachability\n')
    for node in hosts:
        output(('%s    ->    ' % node.name))
        for dest in hosts:
            if (node != dest):
                opts = ''
                if timeout:
                    opts = ('-W    %s' % timeout)
                if dest.intfs:
                    result = node.cmd(('ping    -c1    %s    %s' % (opts, dest.IP())))
                    (sent, received) = self._parsePing(result)
                else:
                    (sent, received) = (0, 0)
                packets += sent
                if (received > sent):
                    error('***    Error:    received    too    many    packets')
                    error(('%s' % result))
                    node.cmdPrint('route')
                    exit(1)
                lost += (sent - received)
                output((('%s    ' % dest.name) if received else 'X    '))
        output('\n')
    if (packets > 0):
        ploss = ((100.0 * lost) / packets)
        received = (packets - lost)
        output(('***    Results:    %i%%    dropped    (%d/%d    received)\n' % (ploss, received, packets)))
    else:
        ploss = 0
        output('***    Warning:    No    packets    sent\n')
    return ploss
