intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
431 stars 239 forks source link

The bw parameter is not work in the link for wifi mode #545

Closed raysuan closed 6 days ago

raysuan commented 6 days ago

Hello Ramon. I am currently want to use larger traffic than link capacity that send from one station to another station to see the network congestion. But when I use bw parameter in addLink, it seems not working. When I set the bw to 5Mbps, the output from iperf server still report 8.07 Mbits/sec as throughput. I want to know is my code wrong? Or is there any other way to change link capacity. Looking forward to hearing from you. This is my code: `#!/usr/bin/env python

'Setting position of the nodes'

import sys

from mininet.log import setLogLevel, info from mn_wifi.cli import CLI from mn_wifi.net import Mininet_wifi

def topology(args):

net = Mininet_wifi()

info("*** Creating nodes\n")
ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1',
                         failMode="standalone", mac='00:00:00:00:00:01',
                         position='50,50,0')
sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.1/8',
               position='30,60,0')
sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.2/8',
               position='70,30,0')

info("*** Configuring nodes\n")
net.configureNodes()

info("*** Creating links\n")
net.addLink(ap1, sta1,bw =5 )
net.addLink(ap1, sta2,bw =5 )

info("*** Starting network\n")
net.build()
ap1.start([])

info("*** Running iperf test\n")
sta1.cmd('iperf -s -u -i 1 > ch_iperf.txt &')
result = sta2.cmd('iperf -c 10.0.0.1 -u -t 10 -b 15M')  # 5 Mbps bandwidth for the iperf test
info(result)

info("*** Running CLI\n")
CLI(net)

info("*** Stopping network\n")
net.stop()

if name == 'main': setLogLevel('info') topology(sys.argv)`

This is the output from iperf test: ` sudo python po.py Creating nodes Configuring nodes Creating links Starting network *** Running iperf test

Client connecting to 10.0.0.1, UDP port 5001 Sending 1470 byte datagrams, IPG target: 747.68 us (kalman adjust) UDP buffer size: 208 KByte (default)

[ 1] local 10.0.0.2 port 37814 connected with 10.0.0.1 port 5001 [ ID] Interval Transfer Bandwidth [ 1] 0.0000-10.0011 sec 18.8 MBytes 15.7 Mbits/sec [ 1] Sent 13379 datagrams [ 1] Server Report: [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [ 1] 0.0000-7.1206 sec 6.85 MBytes 8.07 Mbits/sec 0.102 ms 8490/13378 (63%) Running CLI Starting CLI:`

ramonfontes commented 6 days ago

It seems to me that you didn't follow the suggestion I gave to you in https://github.com/intrig-unicamp/mininet-wifi/issues/544

Input and output port are the same and ifb is mandatory: https://mn-wifi.readthedocs.io/en/latest/

By the way, please consider to use the mailing list for questions like that.