我是Mininet和ONOS的新成員,所以我遇到了非常簡單的問題。在這種情況下,我在Mininet中創建了以下拓撲。ONOS未檢測到使用Mininet創建的網絡中具有多個鏈接的主機
所生成的腳本如下。
#!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call
def myNetwork():
net = Mininet(topo=None,
build=False,
ipBase='10.0.0.0/8')
info('*** Adding controller\n')
c0=net.addController(name='c0',
controller=RemoteController,
protocol='tcp',
port=6633)
info('*** Add switches\n')
s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
s3 = net.addSwitch('s3', cls=OVSKernelSwitch)
s4 = net.addSwitch('s4', cls=OVSKernelSwitch)
s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
info('*** Add hosts\n')
h15 = net.addHost('h15', cls=Host, ip='10.0.0.15', defaultRoute=None)
h8 = net.addHost('h8', cls=Host, ip='10.0.0.8', defaultRoute=None)
h9 = net.addHost('h9', cls=Host, ip='10.0.0.9', defaultRoute=None)
h10 = net.addHost('h10', cls=Host, ip='10.0.0.10', defaultRoute=None)
h11 = net.addHost('h11', cls=Host, ip='10.0.0.11', defaultRoute=None)
h16 = net.addHost('h16', cls=Host, ip='10.0.0.16', defaultRoute=None)
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
h12 = net.addHost('h12', cls=Host, ip='10.0.0.12', defaultRoute=None)
h5 = net.addHost('h5', cls=Host, ip='10.0.0.5', defaultRoute=None)
h13 = net.addHost('h13', cls=Host, ip='10.0.0.13', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
h6 = net.addHost('h6', cls=Host, ip='10.0.0.6', defaultRoute=None)
h14 = net.addHost('h14', cls=Host, ip='10.0.0.14', defaultRoute=None)
h7 = net.addHost('h7', cls=Host, ip='10.0.0.7', defaultRoute=None)
info('*** Add links\n')
net.addLink(h1, s1)
net.addLink(h2, s1)
net.addLink(h3, s1)
net.addLink(h4, s1)
net.addLink(h5, s1)
net.addLink(h6, s1)
net.addLink(h7, s1)
net.addLink(h8, s1)
net.addLink(h9, s1)
net.addLink(h10, s1)
net.addLink(h1, s2)
net.addLink(h2, s2)
net.addLink(h3, s2)
net.addLink(h4, s2)
net.addLink(h5, s2)
net.addLink(h6, s2)
net.addLink(h7, s2)
net.addLink(h8, s2)
net.addLink(h9, s2)
net.addLink(h10, s2)
net.addLink(h11, s3)
net.addLink(h12, s3)
net.addLink(h13, s3)
net.addLink(s4, h14)
net.addLink(s4, h15)
net.addLink(s4, h16)
net.addLink(s1, s3)
net.addLink(s2, s4)
info('*** Starting network\n')
net.build()
info('*** Starting controllers\n')
for controller in net.controllers:
controller.start()
info('*** Starting switches\n')
net.get('s2').start([c0])
net.get('s3').start([c0])
net.get('s4').start([c0])
net.get('s1').start([c0])
info('*** Post configure switches and hosts\n')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
myNetwork()
但是接着,ONOS顯示以下拓撲。
我不知道如果我要更改腳本或ONOS東西。我會很感激一個簡單而一步一步的答案,因爲正如我所說,我對這項技術非常新穎。
非常感謝您的幫助。
編輯********************************************* ************************************************** ***************
我編輯了每臺主機上的第二個接口,並給他們一個IP地址爲ifconfig hx-eth1 10.0.0.x
,但這並沒有解決問題。 ONOS中的拓撲結構完全相同。以下是我添加到Python腳本中的代碼。
h1.cmd('ifconfig h1-eth1 10.0.0.17')
h2.cmd('ifconfig h2-eth1 10.0.0.18')
h3.cmd('ifconfig h3-eth1 10.0.0.19')
h4.cmd('ifconfig h4-eth1 10.0.0.20')
h5.cmd('ifconfig h5-eth1 10.0.0.21')
h6.cmd('ifconfig h6-eth1 10.0.0.22')
h7.cmd('ifconfig h7-eth1 10.0.0.23')
h8.cmd('ifconfig h8-eth1 10.0.0.24')
h9.cmd('ifconfig h9-eth1 10.0.0.25')
h10.cmd('ifconfig h10-eth1 10.0.0.26')
我在Mininet中執行了pingall,生成的拓撲結構就是我所顯示的那個。所以ONOS不檢測從主機到交換機S2的鏈路。這是我的問題。謝謝你的幫助。 – josiplayer
我改進我的回答@josiplayer –
我已經按照你的回答,但我沒有解決問題。我編輯了這篇文章。謝謝。 – josiplayer