forked from onstutorial/onstutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflowvisor_topo.py
More file actions
38 lines (29 loc) · 1.11 KB
/
flowvisor_topo.py
File metadata and controls
38 lines (29 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/python
from mininet.topo import Topo
class FVTopo(Topo):
def __init__(self):
# Initialize topology
Topo.__init__(self)
# Create template host, switch, and link
hconfig = {'inNamespace':True}
http_link_config = {'bw': 1}
video_link_config = {'bw': 10}
host_link_config = {}
# Create switch nodes
for i in range(4):
sconfig = {'dpid': "%016x" % (i+1)}
self.addSwitch('s%d' % (i+1), **sconfig)
# Create host nodes
for i in range(4):
self.addHost('h%d' % (i+1), **hconfig)
# Add switch links
self.addLink('s1', 's2', **http_link_config)
self.addLink('s2', 's4', **http_link_config)
self.addLink('s1', 's3', **video_link_config)
self.addLink('s3', 's4', **video_link_config)
# Add host links
self.addLink('h1', 's1', **host_link_config)
self.addLink('h2', 's1', **host_link_config)
self.addLink('h3', 's4', **host_link_config)
self.addLink('h4', 's4', **host_link_config)
topos = { 'fvtopo': ( lambda: FVTopo() ) }