找不到所需的可执行ovs-controller:Mininet

时间:2018-03-22 10:00:55

标签: python controller mininet

sudo python Topology.py 
N = 6
*** Creating network
*** Adding controller
*** Adding hosts:
a b c d e u 
*** Adding switches:
s1 s2 
*** Adding links:
(5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(a, s1) (5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(b, s1) (5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(c, s2) (5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(d, s2) (5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(5.00Mbit 3ms delay 2% loss) *** Error: RTNETLINK answers: No such file or directory
(e, s1) Traceback (most recent call last):
  File "Topology.py", line 45, in <module>
    perfTest()
  File "Topology.py", line 33, in perfTest
    net = Mininet(topo=topo,host=CPULimitedHost,link=TCLink,controller=OVSController)
  File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 172, in __init__
    self.build()
  File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 442, in build
    self.buildFromTopo( self.topo )
  File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 429, in buildFromTopo
    self.addLink( **params )
  File "/usr/lib/python2.7/dist-packages/mininet/net.py", line 364, in addLink
    link = cls( node1, node2, **options )
  File "/usr/lib/python2.7/dist-packages/mininet/link.py", line 534, in __init__
    params2=params )
  File "/usr/lib/python2.7/dist-packages/mininet/link.py", line 424, in __init__
    node1, node2, deleteIntfs=False )
  File "/usr/lib/python2.7/dist-packages/mininet/link.py", line 468, in makeIntfPair
    deleteIntfs=deleteIntfs )
  File "/usr/lib/python2.7/dist-packages/mininet/util.py", line 194, in makeIntfPair
    ( intf1, intf2, cmdOutput ) )
Exception: Error creating interface pair (s1-eth4,s2-eth4): RTNETLINK answers: File exists

当我运行我的python程序实现mininet时,这是错误。 我找到了一个关于同一问题的帖子,但没有一种方法适合我。

这是我的代码:

#! /usr/bin/python

from mininet.topo import Topo
from mininet.net import Mininet
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.node import OVSController,CPULimitedHost
from mininet.link import TCLink
from mininet.cli import CLI

class SingleSwitchTopo(Topo):
    "Single switch connected to n hosts"
    def build(self,n=2):
        print('N = %s' %(n))
        switch_1 = self.addSwitch('s1')
        switch_2 = self.addSwitch('s2')
        host=self.addHost('a')
        self.addLink(host,switch_1,bw=5,delay='3ms',loss=2,max_queue_size=300)
        host=self.addHost('b')
        self.addLink(host,switch_1,bw=5,delay='3ms',loss=2,max_queue_size=300)
        host=self.addHost('e')
        self.addLink(host,switch_1,bw=5,delay='3ms',loss=2,max_queue_size=300)
        host=self.addHost('c')
        self.addLink(host,switch_2,bw=5,delay='3ms',loss=2,max_queue_size=300)
        host=self.addHost('d')
        self.addLink(host,switch_2,bw=5,delay='3ms',loss=2,max_queue_size=300)
        host=self.addHost('u')
        self.addLink(host,switch_2,bw=5,delay='3ms',loss=2,max_queue_size=300)
        self.addLink(switch_1,switch_2,bw=15,delay='2ms')

def perfTest():
    topo = SingleSwitchTopo(6)
    net = Mininet(topo=topo,host=CPULimitedHost,link=TCLink,controller=OVSController)
    net.start()
    print "Dumping the Node Information"
    dumpNodeConnections(net.hosts)
    print "Testing the network connectivity"
    net.pingAll()
    CLI(net)
    net.stop()

if __name__ == '__main__':
    #Start mininet using perfTest Function
    setLogLevel('info')
    perfTest()

我正在尝试使用2个交换机添加6台主机。有没有做过这方面的工作?

与此问题相关的类似线程:Mininet Cannot find required executable controller

尝试一切都是上面的线程。没有什么对我有用。

1 个答案:

答案 0 :(得分:0)

你的问题依赖于单一开关topo。

通过perfTest

调用函数时尝试传递6
class SingleSwitchTopo(Topo):
  "Single switch connected to n hosts."
  def __init__(self, n=2, **opts):
    Topo.__init__(self, **opts)
    switch = self.addSwitch('s1')
    for h in range(n):
      host = self.addHost('h%s' % (h + 1))
      self.addLink(host, switch) 

如果问题仍然存在,请尝试使用像pox(pox)这样的控制器来配置代码