我使用 mininet python 脚本构建了一个简单的网络拓扑。但是,我想通过使用 networkX 在 mininet 脚本中构建拓扑来扩展此代码。因此,首先,我应该将网络导入为 nx。使用networkX的原因是在任何源主机和目标主机之间找到最短路径非常容易和简单。
拓扑代码:
#!/usr/bin/env python
from mininet.net import Mininet # IMPORT Mininet
from mininet.cli import CLI ## IMPORT COMMAND LINE
from mininet.link import TCLink
from mininet.log import setLogLevel # FOR DEPUG
from mininet.node import RemoteController # TO BE ABLE O ADD REMOTE CONTROLLER
net = Mininet(link=TCLink)
# ADDING hosts with given MAC
h1 = net.addHost("h1",mac='00:00:00:00:00:01')
h2 = net.addHost("h2",mac='00:00:00:00:00:02')
h3 = net.addHost("h3",mac='00:00:00:00:00:03')
# ADDING Switch
s1 = net.addSwitch("s1")
net.addLink(h1,s1,bw=10, delay='5ms' )
net.addLink(h2,s1,bw=10, delay='5ms' )
net.addLink(h3,s1,bw=10, delay='5ms' )
# ADDING COTROLLER
net.addController("c0",controller=RemoteController,ip="127.0.0.1",port=6633)
# START Mininet
net.start()
CLI(net)
net.stop()
# EXIT Miminet
你们中的任何人都可以帮助我修改networkX并将其与mininet连接以构建拓扑吗?
感谢您的帮助。