我想在Mininet自定义拓扑上设置带宽。
python代码是:
#!/usr/bin/python
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.link 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
self.addLink(h1,s1,bw=10)
self.addLink(h2,s3,bw=20)
self.addLink(s3,s2,bw=10)
self.addLink(s1,s3,bw=10)
topos = { 'mytopo': ( lambda: MyTopo() ) }
但是有错误
------------------------------------------------------------------
Caught exception. Cleaning up...
TypeError: __init__() got an unexpected keyword argument 'bw'
------------------------------------------------------------------
我能做什么?
如何在Mininet自定义拓扑上设置带宽?
最佳答案
您应该使用--link
参数。例如:sudo mn --topo tree,depth=2,fanout=5 --controller=remote,ip=10.0.0.1,port=6633 --switch ovsk,protocols=OpenFlow13, --link tc,bw=1,delay=10ms
我将尽快举例说明。
关于python - 如何在Mininet自定义拓扑上设置带宽?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30496161/