1. 程式人生 > >使用iperf測sta1與h1的之間通過ap3的ap3-wlan1網絡卡的吞吐量

使用iperf測sta1與h1的之間通過ap3的ap3-wlan1網絡卡的吞吐量

➜  demos git:(master) ✗ sudo python ./handover_line.py
*** Creating nodes
*** Configuring wifi nodes
*** Associating and Creating links
*** Starting network
*** Configuring nodes
*** Running CLI
*** Starting CLI:
mininet-wifi> iperf sta1 h1
*** Iperf: testing TCP bandwidth between sta1 and h1 
***
Results: ['9.39 Mbits/sec', '9.99 Mbits/sec'] mininet-wifi> iperf sta1 h1 *** Iperf: testing TCP bandwidth between sta1 and h1 .*** Results: ['8.05 Mbits/sec', '8.34 Mbits/sec'] mininet-wifi>

這裡寫圖片描述

handover_line.py

#coding=utf-8
#!/usr/bin/python


from mininet.node import Controller
from mininet.log import
setLogLevel, info from mininet.wifi.node import OVSKernelAP from mininet.wifi.cli import CLI_wifi from mininet.wifi.net import Mininet_wifi def topology(): "Create a network." net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelAP) info("*** Creating nodes\n") h1 = net.addHost('h1'
, mac='00:00:00:00:00:01', ip='10.0.0.1/8') sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8', range=20) ap1 = net.addAccessPoint('ap1', ssid='ssid-ap1', mode='g', channel='1', position='30,50,0', range=30) ap2 = net.addAccessPoint('ap2', ssid='ssid-ap2', mode='g', channel='1', position='90,50,0', range=30) ap3 = net.addAccessPoint('ap3', ssid='ssid-ap3', mode='g', channel='1', position='130,50,0', range=30) #TODO 外部控制器 c1 = net.addController('c1', controller=Controller) net.propagationModel(model="logDistance", exp=5) info("*** Configuring wifi nodes\n") net.configureWifiNodes() info("*** Associating and Creating links\n") net.addLink(ap1, h1) net.addLink(ap1, ap2) net.addLink(ap2, ap3) net.plotGraph(max_x=160, max_y=160) net.startMobility(time=0, AC='ssf'), #或者llf, 這裡可以寫自己定義的演算法 # 只有sta1在動 net.mobility(sta1, 'start', time=20, position='1,50,0') net.mobility(sta1, 'stop', time=79, position='159,50,0') net.stopMobility(time=80) info("*** Starting network\n") net.build() c1.start() ap1.start([c1]) ap2.start([c1]) ap3.start([c1]) info("*** Running CLI\n") CLI_wifi(net) info("*** Stopping network\n") net.stop() if __name__ == '__main__': setLogLevel('info') topology()