Skip to content

Commit b4dbfcc

Browse files
added faculty and student network slicing script
1 parent c2ce3af commit b4dbfcc

File tree

3 files changed

+36
-33
lines changed

3 files changed

+36
-33
lines changed

scripts/step2_network_slicing.py

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@
1313
'SEA': {'dpid': '000000000000010%s'},
1414
'SFO': {'dpid': '000000000000020%s'},
1515
'LAX': {'dpid': '000000000000030%s'},
16-
'ATL': {'dpid': '000000000000040%s'},
17-
'IAD': {'dpid': '000000000000050%s'},
18-
'EWR': {'dpid': '000000000000060%s'},
19-
'SLC': {'dpid': '000000000000070%s'},
20-
'MCI': {'dpid': '000000000000080%s'},
21-
'ORD': {'dpid': '000000000000090%s'},
22-
'CLE': {'dpid': '0000000000000a0%s'},
23-
'IAH': {'dpid': '0000000000000b0%s'},
2416
}
2517

2618
FANOUT = 4
@@ -40,32 +32,28 @@ def __init__(self, enable_all = True):
4032

4133
# Add hosts and connect them to their core switch
4234
for switch in CORES:
43-
for count in xrange(1, FANOUT + 1):
44-
# Add hosts
45-
host = 'h_%s_%s' % (switch, count)
46-
ip = '10.0.0.%s' % count
47-
mac = CORES[switch]['dpid'][4:] % count
48-
h = self.addHost(host, ip=ip, mac=mac)
49-
# Connect hosts to core switches
50-
self.addLink(h, self.cores[switch], bw=10, delay='5ms', loss=2,
51-
max_queue_size=1000, use_htb=True)
52-
35+
for count in xrange(1, FANOUT + 1):
36+
# Add hosts
37+
host = 'h_%s_%s' % (switch, count)
38+
ip = '10.0.0.%s' % count
39+
mac = CORES[switch]['dpid'][4:] % count
40+
h = self.addHost(host, ip=ip, mac=mac)
41+
42+
self.addLink('h_SEA_1', 'SEA', bw=10, delay='5ms', loss=2, max_queue_size=1000, use_htb=True)
43+
self.addLink('h_SEA_2', 'SEA')
44+
self.addLink('h_SEA_3', 'SEA')
45+
self.addLink('h_SEA_4', 'SEA')
46+
self.addLink('h_LAX_1', 'LAX')
47+
self.addLink('h_LAX_2', 'LAX', bw=10, delay='5ms', loss=2, max_queue_size=1000, use_htb=True)
48+
self.addLink('h_LAX_3', 'LAX')
49+
self.addLink('h_LAX_4', 'LAX')
50+
self.addLink('h_SFO_1', 'SFO')
51+
self.addLink('h_SFO_2', 'SFO')
52+
self.addLink('h_SFO_3', 'SFO')
53+
self.addLink('h_SFO_4', 'SFO')
5354
# Connect core switches
54-
self.addLink(self.cores['SFO'], self.cores['SEA'],bw=10)
55-
self.addLink(self.cores['SEA'], self.cores['SLC'],bw=10)
56-
self.addLink(self.cores['SFO'], self.cores['LAX'],bw=10)
57-
self.addLink(self.cores['LAX'], self.cores['SLC'],bw=10)
58-
self.addLink(self.cores['LAX'], self.cores['IAH'],bw=10)
59-
self.addLink(self.cores['SLC'], self.cores['MCI'],bw=10)
60-
self.addLink(self.cores['MCI'], self.cores['IAH'],bw=10)
61-
self.addLink(self.cores['MCI'], self.cores['ORD'],bw=10)
62-
self.addLink(self.cores['IAH'], self.cores['ATL'],bw=10)
63-
self.addLink(self.cores['ORD'], self.cores['ATL'],bw=10)
64-
self.addLink(self.cores['ORD'], self.cores['CLE'],bw=10)
65-
self.addLink(self.cores['ATL'], self.cores['IAD'],bw=10)
66-
self.addLink(self.cores['CLE'], self.cores['IAD'],bw=10)
67-
self.addLink(self.cores['CLE'], self.cores['EWR'],bw=10)
68-
self.addLink(self.cores['EWR'], self.cores['IAD'],bw=10)
55+
self.addLink(self.cores['SFO'], self.cores['SEA'])
56+
self.addLink(self.cores['SFO'], self.cores['LAX'])
6957

7058

7159
if __name__ == '__main__':
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
python ovxctl.py -n createNetwork tcp:localhost:20000 10.0.0.0 16
2+
python ovxctl.py -n createSwitch 2 00:00:00:00:00:00:01:00
3+
python ovxctl.py -n createSwitch 2 00:00:00:00:00:00:02:00
4+
python ovxctl.py -n createSwitch 2 00:00:00:00:00:00:03:00
5+
python ovxctl.py -n createPort 2 00:00:00:00:00:00:01:00 3
6+
python ovxctl.py -n createPort 2 00:00:00:00:00:00:01:00 5
7+
python ovxctl.py -n createPort 2 00:00:00:00:00:00:02:00 5
8+
python ovxctl.py -n createPort 2 00:00:00:00:00:00:02:00 6
9+
python ovxctl.py -n createPort 2 00:00:00:00:00:00:03:00 5
10+
python ovxctl.py -n createPort 2 00:00:00:00:00:00:03:00 4
11+
python ovxctl.py -n connectLink 2 00:a4:23:05:00:00:00:01 2 00:a4:23:05:00:00:00:02 1 spf 1
12+
python ovxctl.py -n connectLink 2 00:a4:23:05:00:00:00:02 2 00:a4:23:05:00:00:00:03 1 spf 1
13+
python ovxctl.py -n connectHost 2 00:a4:23:05:00:00:00:01 1 00:00:00:00:01:03
14+
python ovxctl.py -n connectHost 2 00:a4:23:05:00:00:00:03 2 00:00:00:00:03:04
15+
python ovxctl.py -n startNetwork 2

0 commit comments

Comments
 (0)