3

I am new to mininet and trying to figure it out. I am trying to use a remote controller and was checking how to do on https://github.com/mininet/mininet/wiki/Introduction-to-Mininet . Here is my mininet code:

#!/usr/bin/python

from mininet.topo import Topo
from mininet.net import Mininet
from mininet.cli import CLI
from mininet.link import TCLink
from mininet.log import setLogLevel, info
from functools import partial
from mininet.node import Controller, OVSKernelSwitch, RemoteController

class Topo1( Topo ):
    def __init__( self ):
        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        h1 = self.addHost( 'h1' )
        h2 = self.addHost( 'h2' )
        h3 = self.addHost( 'h3' )
        s1 = self.addSwitch( 's1' )
        s2 = self.addSwitch( 's2' )
        s3 = self.addSwitch( 's3' )

        # Add links
        self.addLink( h1, s1 )
        self.addLink( h2, s1 )
        self.addLink( s1, s2 )
        self.addLink( s2, s3 )
        self.addLink( h3, s3 )

def main():
    setLogLevel( 'info' )
    topo = Topo1()

    net = Mininet(topo=topo, link=TCLink, controller=None)
    net.addController( 'c0', controller=RemoteController, ip='127.0.0.1', port=6633 )
    net.start()
    CLI(net)
    net.stop()
    
if __name__ == '__main__':
    main()

When I try to run my scrip with command sudo python script.py I get like this:

*** Creating network
*** Adding hosts:
h1 h2 h3 
*** Adding switches:
s1 s2 s3 
*** Adding links:
(h1, s1) (h2, s1) (h3, s3) (s1, s2) (s2, s3) 
*** Configuring hosts
h1 h2 h3 
Unable to contact the remote controller at 127.0.0.1:6633
*** Starting controller
c0 
*** Starting 3 switches
s1 s2 s3 ...
*** Starting CLI:
mininet> 

What am I doing wrong?

Mohammed
  • 195
  • 1
  • 3
  • 12
  • Are you sure your controller is running at port 6633 specifically? – LTJ Dec 09 '20 at 11:31
  • when just creating a simple topology using `sudo mn` and then `dump` I get: so it is running on 6653. I have tried to change my code so that I add controller on port 6653 but I get the same error "Unable to contact the remote controller at 127.0.0.1:6653". . – Mohammed Dec 09 '20 at 12:07
  • Even using command like `sudo mn --controller=remote,ip=127.0.0.1,port=6633` or `sudo mn --controller=remote,ip=127.0.0.1,port=6653` gives me the same error. Is this supposed to happen? Seems weird – Mohammed Dec 09 '20 at 12:12

0 Answers0