def stringBandwidthTest(host_class, controller_class, link_class, size, tdf, data_file): "Check bandwidth at various lengths along a switch chain." topo_class = StringTestTopo(size) net = Mininet(topo=topo_class, host=host_class, switch=OVSKernelSwitch, controller=controller_class, waitConnected=False, link=link_class) net.start() if tdf != 1: net.dilateEmulation(tdf) print "*** testing basic connectivity\n" src, dst = net.hosts num_pings = 3 for i in irange(1, num_pings): ping_result = list(net.pingFull( [ src, dst ] )) # ping_result=[(host1), (host2)] # host = (src, dst, data) # data = (#sent, #received, rttmin, rttavg, rttmax, rttdev) print "Ping avg rtt = %s\n" % ping_result[0][2][3] rttavg = ping_result[0][2][3] data_file.write( "RTT Avg = %s ms\n" % rttavg) print "*** testing bandwidth\n" num_rounds = 2 client_history = [] time = 10 for i in irange(1, num_rounds): net.showDilation() bandwidth = net.iperf( [src, dst], l4Type = 'TCP', fmt = 'm', seconds=time, clifile=data_file, serfile=data_file ) # bandwidth = net.iperf( [src, dst], l4Type = 'UDP', # fmt = 'm', seconds=time, # clifile=data_file, serfile=data_file ) flush() net.showDilation() serout = bandwidth[0] cliout = bandwidth[1] if len(serout) > 0 and len(cliout) > 0: serDataStr, unit = serout.split(" ") serData = float(serDataStr) cliDataStr, unit = cliout.split(" ") cliData = float(cliDataStr) client_history.append(cliData) data_file.write("%s\t%f\t%s\t%s\n" % (size, tdf, serData, cliData)) client_mean = numpy.mean(client_history) client_stdev = numpy.std(client_history) data_file.write( "Avg Throughtput = %f\n" % client_mean ) data_file.write( "STD Throughput = %f\n" % client_stdev ) print "AVG = %f " % client_mean print "STD = %f " % client_stdev data_file.write('\n\n') # CLI(net) net.stop() cleanup() return client_mean, client_stdev
def stringBandwidthTest(host_class, controller_class, link_class, size, tdf, data_file): "Check bandwidth at various lengths along a switch chain." topo_class = StringTestTopo(size) net = Mininet(topo=topo_class, host=host_class, switch=OVSKernelSwitch, controller=controller_class, waitConnected=False, link=link_class) net.start() if tdf != 1: net.dilateEmulation(tdf) print "*** testing basic connectivity\n" src, dst = net.hosts num_pings = 3 for i in irange(1, num_pings): ping_result = list(net.pingFull([src, dst])) # ping_result=[(host1), (host2)] # host = (src, dst, data) # data = (#sent, #received, rttmin, rttavg, rttmax, rttdev) print "Ping avg rtt = %s\n" % ping_result[0][2][3] rttavg = ping_result[0][2][3] data_file.write("RTT Avg = %s ms\n" % rttavg) print "*** testing bandwidth\n" num_rounds = 2 client_history = [] time = 10 for i in irange(1, num_rounds): net.showDilation() bandwidth = net.iperf([src, dst], l4Type='TCP', fmt='m', seconds=time, clifile=data_file, serfile=data_file) # bandwidth = net.iperf( [src, dst], l4Type = 'UDP', # fmt = 'm', seconds=time, # clifile=data_file, serfile=data_file ) flush() net.showDilation() serout = bandwidth[0] cliout = bandwidth[1] if len(serout) > 0 and len(cliout) > 0: serDataStr, unit = serout.split(" ") serData = float(serDataStr) cliDataStr, unit = cliout.split(" ") cliData = float(cliDataStr) client_history.append(cliData) data_file.write("%s\t%f\t%s\t%s\n" % (size, tdf, serData, cliData)) client_mean = numpy.mean(client_history) client_stdev = numpy.std(client_history) data_file.write("Avg Throughtput = %f\n" % client_mean) data_file.write("STD Throughput = %f\n" % client_stdev) print "AVG = %f " % client_mean print "STD = %f " % client_stdev data_file.write('\n\n') # CLI(net) net.stop() cleanup() return client_mean, client_stdev