0
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

This is the error is get when I run my python program implementing mininet. I found a thread regarding same issue but none of the methods worked for me.

Here is my code :

#! /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()

I am trying to add 6 hosts with 2 switches. Is there any work through for this?

Similar thread related to this issue : Mininet Cannot find required executable controller

Tried everything is the above thread. Nothing is working for me.

Kancha
  • 409
  • 1
  • 3
  • 11

1 Answers1

0

your problem relies on the single switch topo.

try this passing 6 when you call the function via perfTest

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) 

In case the problem continues, try to configure your code usinh a controller like pox (pox)

dside
  • 98
  • 7