def multiping(netsize, chunksize, seconds):
 topo = SingleSwitchTopo(netsize)
 net = Mininet(topo=topo)
 net.start()
 hosts = net.hosts
 subnets = chunks(hosts, chunksize)
 fds = [host.stdout.fileno() for host in hosts]
 poller = poll()
 for fd in fds:
  poller.register(fd, POLLIN)
 for subnet in subnets:
  ips = [host.IP() for host in subnet]
  ips.append('10.0.0.200')
  for host in subnet:
   startpings(host, ips)
 endTime = (time() + seconds)
 while (time() < endTime):
  readable = poller.poll(1000)
  for (fd, _mask) in readable:
   node = Node.outToNode[fd]
   info(('%s:' % node.name), node.monitor().strip(), '\n')
 for host in hosts:
  host.cmd('kill %while')
 net.stop()

def multiping ( netsize , chunksize , seconds ) : topo = SingleSwitchTopo ( netsize ) net = Mininet ( topo = topo ) net . start ( ) hosts = net . hosts subnets = chunks ( hosts , chunksize ) fds = [ host . stdout . fileno ( ) for host in hosts ] poller = poll ( ) for fd in fds : poller . register ( fd , POLLIN ) for subnet in subnets : ips = [ host . IP ( ) for host in subnet ] ips . append ( '10.0.0.200' ) for host in subnet : startpings ( host , ips ) endTime = ( time ( ) + seconds ) while ( time ( ) < endTime ) : readable = poller . poll ( 1000 ) for ( fd , _mask ) in readable : node = Node . outToNode [ fd ] info ( ( '%s:' % node . name ) , node . monitor ( ) . strip ( ) , '\n' ) for host in hosts : host . cmd ( 'kill %while' ) net . stop ( )
ping subsets of size chunksize in net of size netsize .