Reputation: 81
I am attempting to create an SDN network from a python file I created, but it can't seem to find the directory. Is there anything I am doing wrong?
Here is the syntax I used:
sudo mn --custom ~/mininet/custom/project.py --topo project
Here's the directory the python file is in:
And just in case, I am also providing my code from my python file:
from mininet.topo import Topo
class Project( Topo ):
def __init__( self ):
# Initialize topology
Topo.__init__( self )
# Add hosts
h1 = self.addHost('h1')
h2 = self.addHost('h2')
h3 = self.addHost('h3')
h4 = self.addHost('h4')
h5 = self.addHost('h5')
h6 = self.addHost('h6')
h7 = self.addHost('h7')
h8 = self.addHost('h8')
h9 = self.addHost('h9')
h10 = self.addHost('h10')
h11 = self.addHost('h11')
h12 = self.addHost('h12')
h13 = self.addHost('h13')
h14 = self.addHost('h14')
h15 = self.addHost('h15')
h16 = self.addHost('h16')
h17 = self.addHost('h17')
h18 = self.addHost('h18')
# Add switches
s1 = self.addSwitch('s1')
s2 = self.addSwitch('s2')
s3 = self.addSwitch('s3')
s4 = self.addSwitch('s4')
s5 = self.addSwitch('s5')
s6 = self.addSwitch('s6')
s7 = self.addSwitch('s7')
s8 = self.addSwitch('s8')
# Add links
self.addLink(h1,s1)
self.addLink(h2,s1)
self.addLink(h3,s1)
self.addLink(h4,s2)
self.addLink(h5,s2)
self.addLink(h6,s2)
self.addLink(h7,s3)
self.addLink(h8,s3)
self.addLink(h9,s3)
self.addLink(s1,s7)
self.addLink(s2,s7)
self.addLink(s3,s7)
self.addLink(s7,s8)
self.addLink(s8,s4)
self.addLink(s8,s5)
self.addLink(s8,s6)
self.addLink(s4,h10)
self.addLink(s4,h11)
self.addLink(s4,h12)
self.addLink(s5,h13)
self.addLink(s5,h14)
self.addLink(s5,h15)
self.addLink(s6,h16)
self.addLink(s6,h17)
self.addLink(s6,h18)
topos = { 'project': ( lambda: Project() )}
Upvotes: 1
Views: 19155
Reputation: 1
When it comes to a custom mininet python file, for me it works using the following commands.
cd /to/the/python/file
,
then run the followingsudo mn --custom expr.py --topo expr --mac --switch ovsk --controller remote,ip=127.0.0.1,port=6653,protocols=OpenFlow13
Where the expr.py is the python script that holds the mininet topology.
Upvotes: 0
Reputation: 11
The error is small:
While trying to run the custom topology, use this command:
sudo mn --custom ~/mininet/custom/project.py --topo=project
Hope this answer solves
Upvotes: 1
Reputation: 37
You can create a topology using miniedit. It is very convinient to create a custom topology using miniedit using graphical user interface.
Upvotes: 0
Reputation: 178
First of all is the topology (.py) in that directory?
Secondly I don't see your controller in your topology (you said SDN). Your switches need a SDN Controller. If you use a remote controller you should execute
sudo mn --custom ~/mininet/custom/project.py --topo project --remote controller
Also check if there is a problem with the capital P at topo project (or Project)
Upvotes: 0
Reputation: 110
you can write the above code on a file with main python script and run it executing python file.
Upvotes: 0