ModuleNotFoundError: No module named 'mininet'

14 views
Skip to first unread message

Rishabh Vyas

unread,
Dec 6, 2022, 10:10:17 AM12/6/22
to sFlow-RT
Hi Peter, I created a custom mininet topology and have floodlight as a controller with sflow-rt running and mininet-dashboard installed.

from mininet.net import Mininet
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.topo import Topo
from mininet.node import RemoteController
import pdb
import time
import sys

sys.path.insert(0,'/home/rishabh/sflow-rt/extras')
import sflow
from mininet.util import customClass
from mininet.link import TCLink

execfile('/home/rishabh/sflow-rt/extras/sflow.py')
link = customClass({'tc':TCLink}, 'tc,bw=10')

def myNet():
   
    net = Mininet(topo=None,build=False,link=link)
   
    info( '*** Adding controller\n')
    net.addController('c0', controller=RemoteController,ip="127.0.0.1",port=6653)
   
    info( '*** Adding hosts\n')
    h1=net.addHost('h1')
    h2=net.addHost('h2')
    h3=net.addHost('h3')
    h4=net.addHost('h4')
    h5=net.addHost('h5')
    h6=net.addHost('h6')
    h7=net.addHost('h7')
    h8=net.addHost('h8')
    h9=net.addHost('h9')
    h10=net.addHost('h10')
       
    info( '*** Adding switch\n' )
    s1=net.addSwitch('s1')
    s2=net.addSwitch('s2')
    s3=net.addSwitch('s3')
    s4=net.addSwitch('s4')
    s5=net.addSwitch('s5')
       
    info( '*** Creating links\n' )
    net.addLink(s1,s2)
    net.addLink(s2,s3)
    net.addLink(s3,s4)
    net.addLink(s4,s5)
   
    net.addLink(h1,s1)
    net.addLink(h2,s1)
       
    net.addLink(h3,s2)
    net.addLink(h4,s2)
       
    net.addLink(h5,s3)
    net.addLink(h6,s3)
       
    net.addLink(h7,s4)
    net.addLink(h8,s4)
       
    net.addLink(h9,s5)
    net.addLink(h10,s5)
       
    info( '*** Starting network\n')
    net.start()
   
    info( '*** Running CLI\n' )
    CLI( net )

    info( '*** Stopping network' )
    net.stop()


if __name__ == '__main__':
    setLogLevel( 'info' )
    myNet()

I am receiving the error message as follows:
  File "./second.py", line 1, in <module>
    from mininet.net import Mininet
ModuleNotFoundError: No module named 'mininet'

sflow-rt was running in new tab

Peter Phaal

unread,
Dec 9, 2022, 9:36:29 PM12/9/22
to sFlow-RT
This doesn't look like an sFlow-RT related issue, but is instead related to your Python / Mininet installation.

Reply all
Reply to author
Forward
0 new messages