【发布时间】:2020-08-29 21:34:24
【问题描述】:
我正在 mininet 中构建自定义拓扑代码,但在连接 3 个路由器和 4 个交换机时遇到了困难。如果你能帮助我,我做错了我只想在路由器和交换机之间连接。
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
net = Mininet(topo=None,
build=False)
#Add controllers
c1 = net.addController(name='c1',
controller=RemoteController)
c2 = net.addController(name= 'c2',
controller=RemoteController)
# Add hosts and switches
HostOne = self.addHost( 'h1' )
HostTwo = self.addHost( 'h2' )
HostTree = self.addHost( 'h3' )
HostFour = self.addHost( 'h4' )
SwitchOne = self.addSwitch( 's1' )
SwitchTwo = self.addSwitch( 's2' )
SwitchTree = self.addSwitch( 's3' )
SwitchFour = self.addSwitch( 's4' )
# Add links
self.addLink( c1, SwitchOne )
self.addLink( c1, SwitchTwo )
self.addLink( c1, SwitchTree )
self.addLink( c1, SwitchFour )
self.addLink( c2, SwitchOne )
self.addLink( c2, SwitchTwo )
self.addLink( c2, SwitchTree )
self.addLink( c2, SwitchFour )
【问题讨论】: