我为拓扑做了以下代码:
from mininet.topo import Topo
from mininet.net import Mininet
from mininet.log import setLogLevel, info
from mininet.node import OVSSwitch, Controller, RemoteController
from mininet.cli import CLI
class Project( Topo ):
def build (self, **_opts ):
# Add hosts
h11 = self.addHost('h11', ip='192.168.1.10')
h12 = self.addHost('h12', ip='192.168.1.11')
h13 = self.addHost('h13', ip='192.168.1.12')
h14 = self.addHost('h14', ip='192.168.1.13')
h21 = self.addHost('h21', ip='192.168.2.10')
h22 = self.addHost('h22', ip='192.168.2.11')
h23 = self.addHost('h23', ip='192.168.2.12')
h24 = self.addHost('h24', ip='192.168.2.13')
h31 = self.addHost('h31', ip='192.168.3.10')
h32 = self.addHost('h32', ip='192.168.3.11')
h33 = self.addHost('h33', ip='192.168.3.12')
h34 = self.addHost('h34', ip='192.168.3.13')
# Add switches
s1 = self.addSwitch('s1', cls=OVSSwitch, protocols ="OpenFlow13", ip='192.168.1.1')
s2 = self.addSwitch('s2', cls=OVSSwitch, protocols ="OpenFlow13", ip='192.168.2.1')
s3 = self.addSwitch('s3', cls=OVSSwitch, protocols ="OpenFlow13", ip='192.168.3.1')
# Add links
self.addLink(h11,s1)
self.addLink(h12,s1)
self.addLink(h13,s1)
self.addLink(h14,s1)
self.addLink(h21,s2)
self.addLink(h22,s2)
self.addLink(h23,s2)
self.addLink(h24,s2)
self.addLink(h31,s3)
self.addLink(h32,s3)
self.addLink(h33,s3)
self.addLink(h34,s3)
self.addLink(s1,s2)
self.addLink(s1,s3)
self.addLink(s2,s3)
def run():
topo = Project()
net = Mininet (topo=topo, controller=None)
c1 = net.addController( 'c1', controller=RemoteController, ip='172.17.0.7')
c1.start()
net.start()
CLI ( net )
net.stop()
if '_main_':
setLogLevel( 'info')
run()
我使用以下脚本运行脚本:“ sudo python topology.py”
Creating network
Adding controller
Adding hosts: h11 h12 h13 h14 h21 h22 h23 h24 h31 h32 h33 h34
Adding switches: s1 s2 s3
Adding links: (h11, s1) (h12, s1) (h13, s1) (h14, s1) (h21, s2) (h22, s2) (h23, s2) (h24, s2) (h31, s3) (h32, s3) (h33, s3) (h34, s3) (s1, s2) (s1, s3) (s2, s3)
Configuring hosts h11 h12 h13 h14 h21 h22 h23 h24 h31 h32 h33 h34 Connecting to remote controller at 172.17.0.7:6653
Starting controller c1
Starting 3 switches s1 s2 s3 ...
Starting CLI:
mininet>
到目前为止一切都还不错,但是当我处于ONOS CLI(我正在使用的控制器)中时,它无法检测到网络上的主机... 我正在使用ONOS教程OVA(针对1.15.0版)。
安装完虚拟机并运行上面的脚本后,我在ONOS上运行了命令以激活响应式转发:
onos > app activate org.onosproject.fwd
在以下情况下,我可以在mininet的CLI上ping主机:
mininet > h11 ping -c 3 h31
...
mininet > pingall
仅在执行此ping操作后,控制器才能看到/显示有关拓扑上主机的信息...控制器从拓扑实施的开始就如何做到这一点?
答案 0 :(得分:0)
需要ONOS具有三个以上的应用程序。 所需的应用程序是:
交换机需要拓扑中的控制器或主机的激励。