-
-
Save wh5a/5952253 to your computer and use it in GitHub Desktop.
''' | |
Coursera: | |
- Software Defined Networking (SDN) course | |
-- Module 3 Programming Assignment | |
Professor: Nick Feamster | |
Teaching Assistant: Muhammad Shahbaz | |
''' | |
from mininet.topo import Topo | |
class CustomTopo(Topo): | |
"Simple Data Center Topology" | |
"linkopts - (1:core, 2:aggregation, 3: edge) parameters" | |
"fanout - number of child switch per parent switch" | |
def __init__(self, linkopts1, linkopts2, linkopts3, fanout=2, **opts): | |
# Initialize topology and default options | |
Topo.__init__(self, **opts) | |
# Numbering: h1..N, s1..M | |
self.hostNum = 1 | |
self.switchNum = 1 | |
self.addTree([linkopts1, linkopts2, linkopts3], fanout); | |
# Derived from class TreeTopo | |
def addTree(self, linkopts, fanout, depth=0): | |
isSwitch = depth < 3 | |
if isSwitch: | |
node = self.addSwitch('s%s' % self.switchNum) | |
self.switchNum += 1 | |
for _ in range(fanout): | |
child = self.addTree(linkopts, fanout, depth + 1) | |
self.addLink(node, child, **linkopts[depth]) | |
else: | |
# host | |
node = self.addHost('h%s' % self.hostNum) | |
self.hostNum += 1 | |
return node | |
topos = { 'custom': ( lambda: CustomTopo() ) } | |
from mininet.log import setLogLevel | |
setLogLevel('info') |
You shouldn't run it directly. The assignment page tells you how to run it.
Hi, I got similar error, yet when switched to using python XXX.py, I got the error that mininet.log could not be found, anyone has any idea where the mininet lib is located, or it only has got binary lib?
Hello,
Getting following error can you suggest the solution for this
Traceback (most recent call last):
File "submit.py", line 201, in
submit()
File "submit.py", line 52, in submit
(result, string) = submitSolution(login, ch_resp, sid, output(partIdx),
File "submit.py", line 190, in output
h27 = net.get('h27')
File "build/bdist.linux-x86_64/egg/mininet/net.py", line 302, in get
File "build/bdist.linux-x86_64/egg/mininet/net.py", line 297, in getNodeByName
KeyError: 'h27'
vagrant@coursera-sdn:/vagrant/assignments/mininet-topology$
Hi can anybody help me to figure out this problem ....
net = Mininet(topo = topo, link=TCLink)
File "build/bdist.linux-x86_64/egg/mininet/net.py", line 172, in init
File "build/bdist.linux-x86_64/egg/mininet/net.py", line 444, in build
File "build/bdist.linux-x86_64/egg/mininet/net.py", line 431, in buildFromTopo
File "build/bdist.linux-x86_64/egg/mininet/net.py", line 366, in addLink
File "build/bdist.linux-x86_64/egg/mininet/link.py", line 534, in init
File "build/bdist.linux-x86_64/egg/mininet/link.py", line 424, in init
File "build/bdist.linux-x86_64/egg/mininet/link.py", line 468, in makeIntfPair
File "build/bdist.linux-x86_64/egg/mininet/util.py", line 194, in makeIntfPair
Exception: Error creating interface pair (a1-eth1,c1-eth1): RTNETLINK answers: File exists
Hello,
I'm getting error on this code
mininet@mininet-vm:~$ ./CustomTopo.py
./CustomTopo.py: line 8: $'\nCoursera:\n- Software Defined Networking (SDN) course\n-- Module 3 Programming Assignment\n\nProfessor: Nick Feamster\nTeaching Assistant: Muhammad Shahbaz\n': command not found
from: can't read /var/mail/mininet.topo
./CustomTopo.py: line 12: syntax error near unexpected token
(' ./CustomTopo.py: line 12:
class CustomTopo(Topo):'Pls help
Thanks