view raw
Kown Kown - 9 months ago 171
Python Question

How to set bandwidth on Mininet custom topology?

I want to set bandwidth on Mininet custom topology.

The python code is:

from mininet.topo import Topo
from import Mininet
from mininet.node import CPULimitedHost
from import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel

class MyTopo( Topo ):
"Simple topology example."

def __init__( self, **opts):
"Create custom topo."

# Initialize topology
Topo.__init__( self, **opts )

# Add hosts and switches
h1 = self.addHost('h1')
h2 = self.addHost( 'h2' )

s3 = self.addSwitch( 's3' )
s1 = self.addSwitch( 's1' )
s2 = self.addSwitch( 's2' )

# Add links

topos = { 'mytopo': ( lambda: MyTopo() ) }

But it has error

Caught exception. Cleaning up...
TypeError: __init__() got an unexpected keyword argument 'bw'

What can I do?
How to set bandwidth on Mininet custom topology?


You should use --link argument. For example: sudo mn --topo tree,depth=2,fanout=5 --controller=remote,ip=,port=6633 --switch ovsk,protocols=OpenFlow13, --link tc,bw=1,delay=10ms

I'll update with an example soon.