def perfTest(): "Create network and run simple performance test" topo = LinearTopo(k=2) net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink) net.start() print "Dumping host connections" dumpNodeConnections(net.hosts) print "Testing network connectivity" net.pingAll() ping_latency(net) h1 = net.getNodeByName('h1') h2 = net.getNodeByName('h2') h3 = net.getNodeByName('h3') #h1.cmd("tc -s qdisc show dev h1-eth0") print "Allocate two Qs to s1" #os.system("tc -s qdisc show dev %s" % args.iface) os.system("bash tc_cmd_diff.sh %s" % args.iface) #h1.cmd("bash tc_cmd_diff.sh h1-eth0") #h1.cmd("tc -s show dev h1-eth0") # h2.cmd('iperf -s -w 16m -p 5001 -i 1 > iperf-recv.txt &') h2.cmd('iperf -s -p %s -i 1 > iperf_server_TCP.txt &' % 5001) # (CUSTOM_IPERF_PATH, 5001, args.dir)) h3.cmd('iperf -s -p %s -u -i 1 > iperf_server_UDP.txt &' % 5003) monitor = Process(target=monitor_qlen, args=("%s"%args.iface,float(args.sampleR),int(args.nQ), "%s_%s"% (args.exp,args.out))) monitor.start() #h1.cmd("./monitor.sh test1 h1-eth0") CLI(net) monitor.terminate() os.system('killall -9 iperf' ) net.stop() for i in xrange(int(args.nQ)): print "Saving and ploting output files..." plot_st("Q%d%s_%s" % (i+1,args.exp,args.out),int(args.btn),i+1) Popen("killall -9 cat", shell=True).wait()
def Test(): "Create network and run simple performance test" topo = SimpleTopo(k=2) net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink) addrealintf(net,args.intf,args.btn,args.maxq) rootnode = connectToInternet(net) print "Dumping host connections" dumpNodeConnections(net.hosts) print "Testing network connectivity" net.pingAll() h1 = net.getNodeByName('h1') h2 = net.getNodeByName('dhcp') #h1.cmd("tc -s qdisc show dev h1-eth0") print "Allocate two Qs to s1" #os.system("tc -s qdisc show dev %s" % args.iface) # os.system("bash tc_cmd_diff.sh %s" % args.iface) os.system("bash tc_diablo.sh %s" % args.iface) #h1.cmd("bash tc_cmd_diff.sh h1-eth0") #h1.cmd("tc -s show dev h1-eth0") # h2.cmd('iperf -s -w 16m -p 5001 -i 1 > iperf-recv.txt &') #h2.cmd('iperf -s -p %s -i 1 > iperf_server_TCP.txt &' % 5001) # (CUSTOM_IPERF_PATH, 5001, args.dir)) #monitoring the network monitor = Process(target=monitor_qlen, args=("%s"%args.iface,float(args.sampleR),int(args.nQ), "%s_%s"% (args.exp,args.out))) threadq = myThread(1,args.iface,120) monitor.start() threadq.start() #start mininet CLI CLI(net) #terminate monitor.terminate() threadq.stop() os.system('killall -9 iperf' ) net.hosts[0].cmd('killall -9 dhcpd') stopNAT( rootnode ) net.stop() #plot for i in xrange(int(args.nQ)): print "Saving and ploting output files..." plot_st("Q%d%s_%s" % (i+1,args.exp,args.out),int(args.btn),i+1) Popen("killall -9 cat", shell=True).wait()