added optical-2.py
added oe-nonlinear-topo10 Change-Id: I1add3ddc8c775802ee89c7ca8c88b62382e2613d
Showing
3 changed files
with
454 additions
and
11 deletions
tools/test/bin/old.json
0 → 100644
1 | +{ | ||
2 | + "linkConfig": [ | ||
3 | + { | ||
4 | + "allowed": true, | ||
5 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:01", | ||
6 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:02", | ||
7 | + "params": { | ||
8 | + "nodeName1": "SFO-W10", | ||
9 | + "nodeName2": "SJC-W10", | ||
10 | + "numWaves": 80, | ||
11 | + "port1": 50, | ||
12 | + "port2": 30 | ||
13 | + }, | ||
14 | + "type": "wdmLink" | ||
15 | + }, | ||
16 | + { | ||
17 | + "allowed": true, | ||
18 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:02", | ||
19 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:03", | ||
20 | + "params": { | ||
21 | + "nodeName1": "SJC-W10", | ||
22 | + "nodeName2": "LAX-W10", | ||
23 | + "numWaves": 80, | ||
24 | + "port1": 50, | ||
25 | + "port2": 30 | ||
26 | + }, | ||
27 | + "type": "wdmLink" | ||
28 | + }, | ||
29 | + { | ||
30 | + "allowed": true, | ||
31 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:03", | ||
32 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:04", | ||
33 | + "params": { | ||
34 | + "nodeName1": "LAX-W10", | ||
35 | + "nodeName2": "SDG-W10", | ||
36 | + "numWaves": 80, | ||
37 | + "port1": 50, | ||
38 | + "port2": 50 | ||
39 | + }, | ||
40 | + "type": "wdmLink" | ||
41 | + }, | ||
42 | + { | ||
43 | + "allowed": true, | ||
44 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:01", | ||
45 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:05", | ||
46 | + "params": { | ||
47 | + "nodeName1": "SFO-W10", | ||
48 | + "nodeName2": "MSP-M10", | ||
49 | + "numWaves": 80, | ||
50 | + "port1": 20, | ||
51 | + "port2": 50 | ||
52 | + }, | ||
53 | + "type": "wdmLink" | ||
54 | + }, | ||
55 | + { | ||
56 | + "allowed": true, | ||
57 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:02", | ||
58 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:05", | ||
59 | + "params": { | ||
60 | + "nodeName1": "SJC-W10", | ||
61 | + "nodeName2": "MSP-M10", | ||
62 | + "numWaves": 80, | ||
63 | + "port1": 20, | ||
64 | + "port2": 20 | ||
65 | + }, | ||
66 | + "type": "wdmLink" | ||
67 | + }, | ||
68 | + { | ||
69 | + "allowed": true, | ||
70 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:03", | ||
71 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:06", | ||
72 | + "params": { | ||
73 | + "nodeName1": "LAX-W10", | ||
74 | + "nodeName2": "DFW-M10", | ||
75 | + "numWaves": 80, | ||
76 | + "port1": 20, | ||
77 | + "port2": 50 | ||
78 | + }, | ||
79 | + "type": "wdmLink" | ||
80 | + }, | ||
81 | + { | ||
82 | + "allowed": true, | ||
83 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:04", | ||
84 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:06", | ||
85 | + "params": { | ||
86 | + "nodeName1": "SDG-W10", | ||
87 | + "nodeName2": "DFW-M10", | ||
88 | + "numWaves": 80, | ||
89 | + "port1": 20, | ||
90 | + "port2": 20 | ||
91 | + }, | ||
92 | + "type": "wdmLink" | ||
93 | + }, | ||
94 | + { | ||
95 | + "allowed": true, | ||
96 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:05", | ||
97 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:06", | ||
98 | + "params": { | ||
99 | + "nodeName1": "MSP-M10", | ||
100 | + "nodeName2": "DFW-M10", | ||
101 | + "numWaves": 80, | ||
102 | + "port1": 30, | ||
103 | + "port2": 40 | ||
104 | + }, | ||
105 | + "type": "wdmLink" | ||
106 | + }, | ||
107 | + { | ||
108 | + "allowed": true, | ||
109 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:05", | ||
110 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:07", | ||
111 | + "params": { | ||
112 | + "nodeName1": "MSP-M10", | ||
113 | + "nodeName2": "CHG-N10", | ||
114 | + "numWaves": 80, | ||
115 | + "port1": 40, | ||
116 | + "port2": 50 | ||
117 | + }, | ||
118 | + "type": "wdmLink" | ||
119 | + }, | ||
120 | + { | ||
121 | + "allowed": true, | ||
122 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:06", | ||
123 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:08", | ||
124 | + "params": { | ||
125 | + "nodeName1": "DFW-M10", | ||
126 | + "nodeName2": "IAD-M10", | ||
127 | + "numWaves": 80, | ||
128 | + "port1": 30, | ||
129 | + "port2": 50 | ||
130 | + }, | ||
131 | + "type": "wdmLink" | ||
132 | + }, | ||
133 | + { | ||
134 | + "allowed": true, | ||
135 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:07", | ||
136 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:08", | ||
137 | + "params": { | ||
138 | + "nodeName1": "CHG-N10", | ||
139 | + "nodeName2": "IAD-M10", | ||
140 | + "numWaves": 80, | ||
141 | + "port1": 20, | ||
142 | + "port2": 30 | ||
143 | + }, | ||
144 | + "type": "wdmLink" | ||
145 | + }, | ||
146 | + { | ||
147 | + "allowed": true, | ||
148 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:07", | ||
149 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:09", | ||
150 | + "params": { | ||
151 | + "nodeName1": "CHG-N10", | ||
152 | + "nodeName2": "JFK-M10", | ||
153 | + "numWaves": 80, | ||
154 | + "port1": 30, | ||
155 | + "port2": 50 | ||
156 | + }, | ||
157 | + "type": "wdmLink" | ||
158 | + }, | ||
159 | + { | ||
160 | + "allowed": true, | ||
161 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:08", | ||
162 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:0A", | ||
163 | + "params": { | ||
164 | + "nodeName1": "IAD-M10", | ||
165 | + "nodeName2": "ATL-S10", | ||
166 | + "numWaves": 80, | ||
167 | + "port1": 20, | ||
168 | + "port2": 50 | ||
169 | + }, | ||
170 | + "type": "wdmLink" | ||
171 | + }, | ||
172 | + { | ||
173 | + "allowed": true, | ||
174 | + "nodeDpid1": "00:00:ff:ff:ff:ff:ff:09", | ||
175 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:0A", | ||
176 | + "params": { | ||
177 | + "nodeName1": "JFK-M10", | ||
178 | + "nodeName2": "ATL-S10", | ||
179 | + "numWaves": 80, | ||
180 | + "port1": 20, | ||
181 | + "port2": 20 | ||
182 | + }, | ||
183 | + "type": "wdmLink" | ||
184 | + }, | ||
185 | + { | ||
186 | + "allowed": true, | ||
187 | + "nodeDpid1": "00:00:ff:ff:ff:ff:00:01", | ||
188 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:01", | ||
189 | + "params": { | ||
190 | + "bandwidth": 100000, | ||
191 | + "nodeName1": "SFO-R10", | ||
192 | + "nodeName2": "SFO-W10", | ||
193 | + "port1": 2, | ||
194 | + "port2": 10 | ||
195 | + }, | ||
196 | + "type": "pktOptLink" | ||
197 | + }, | ||
198 | + { | ||
199 | + "allowed": true, | ||
200 | + "nodeDpid1": "00:00:ff:ff:ff:ff:00:02", | ||
201 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:04", | ||
202 | + "params": { | ||
203 | + "bandwidth": 100000, | ||
204 | + "nodeName1": null, | ||
205 | + "nodeName2": "SDG-W10", | ||
206 | + "port1": 2, | ||
207 | + "port2": 10 | ||
208 | + }, | ||
209 | + "type": "pktOptLink" | ||
210 | + }, | ||
211 | + { | ||
212 | + "allowed": true, | ||
213 | + "nodeDpid1": "00:00:ff:ff:ff:ff:00:03", | ||
214 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:06", | ||
215 | + "params": { | ||
216 | + "bandwidth": 100000, | ||
217 | + "nodeName1": "LAX-R10", | ||
218 | + "nodeName2": "DFW-M10", | ||
219 | + "port1": 2, | ||
220 | + "port2": 10 | ||
221 | + }, | ||
222 | + "type": "pktOptLink" | ||
223 | + }, | ||
224 | + { | ||
225 | + "allowed": true, | ||
226 | + "nodeDpid1": "00:00:ff:ff:ff:ff:00:04", | ||
227 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:07", | ||
228 | + "params": { | ||
229 | + "bandwidth": 100000, | ||
230 | + "nodeName1": "SDG-R10", | ||
231 | + "nodeName2": "CHG-N10", | ||
232 | + "port1": 2, | ||
233 | + "port2": 10 | ||
234 | + }, | ||
235 | + "type": "pktOptLink" | ||
236 | + }, | ||
237 | + { | ||
238 | + "allowed": true, | ||
239 | + "nodeDpid1": "00:00:ff:ff:ff:ff:00:05", | ||
240 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:09", | ||
241 | + "params": { | ||
242 | + "bandwidth": 100000, | ||
243 | + "nodeName1": null, | ||
244 | + "nodeName2": "JFK-M10", | ||
245 | + "port1": 2, | ||
246 | + "port2": 10 | ||
247 | + }, | ||
248 | + "type": "pktOptLink" | ||
249 | + }, | ||
250 | + { | ||
251 | + "allowed": true, | ||
252 | + "nodeDpid1": "00:00:ff:ff:ff:ff:00:06", | ||
253 | + "nodeDpid2": "00:00:ff:ff:ff:ff:ff:0A", | ||
254 | + "params": { | ||
255 | + "bandwidth": 100000, | ||
256 | + "nodeName1": null, | ||
257 | + "nodeName2": "ATL-S10", | ||
258 | + "port1": 2, | ||
259 | + "port2": 10 | ||
260 | + }, | ||
261 | + "type": "pktOptLink" | ||
262 | + } | ||
263 | + ], | ||
264 | + "switchConfig": [ | ||
265 | + { | ||
266 | + "allowed": true, | ||
267 | + "latitude": 37.6, | ||
268 | + "longitude": 122.3, | ||
269 | + "name": "SFO-W10", | ||
270 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:01", | ||
271 | + "params": { | ||
272 | + "numRegen": 0 | ||
273 | + }, | ||
274 | + "type": "Roadm" | ||
275 | + }, | ||
276 | + { | ||
277 | + "allowed": true, | ||
278 | + "latitude": 37.3, | ||
279 | + "longitude": 121.9, | ||
280 | + "name": "SJC-W10", | ||
281 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:02", | ||
282 | + "params": { | ||
283 | + "numRegen": 0 | ||
284 | + }, | ||
285 | + "type": "Roadm" | ||
286 | + }, | ||
287 | + { | ||
288 | + "allowed": true, | ||
289 | + "latitude": 33.9, | ||
290 | + "longitude": 118.4, | ||
291 | + "name": "LAX-W10", | ||
292 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:03", | ||
293 | + "params": { | ||
294 | + "numRegen": 0 | ||
295 | + }, | ||
296 | + "type": "Roadm" | ||
297 | + }, | ||
298 | + { | ||
299 | + "allowed": true, | ||
300 | + "latitude": 32.8, | ||
301 | + "longitude": 117.1, | ||
302 | + "name": "SDG-W10", | ||
303 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:04", | ||
304 | + "params": { | ||
305 | + "numRegen": 3 | ||
306 | + }, | ||
307 | + "type": "Roadm" | ||
308 | + }, | ||
309 | + { | ||
310 | + "allowed": true, | ||
311 | + "latitude": 44.8, | ||
312 | + "longitude": 93.1, | ||
313 | + "name": "MSP-M10", | ||
314 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:05", | ||
315 | + "params": { | ||
316 | + "numRegen": 3 | ||
317 | + }, | ||
318 | + "type": "Roadm" | ||
319 | + }, | ||
320 | + { | ||
321 | + "allowed": true, | ||
322 | + "latitude": 32.8, | ||
323 | + "longitude": 97.1, | ||
324 | + "name": "DFW-M10", | ||
325 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:06", | ||
326 | + "params": { | ||
327 | + "numRegen": 3 | ||
328 | + }, | ||
329 | + "type": "Roadm" | ||
330 | + }, | ||
331 | + { | ||
332 | + "allowed": true, | ||
333 | + "latitude": 41.8, | ||
334 | + "longitude": 120.1, | ||
335 | + "name": "CHG-N10", | ||
336 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:07", | ||
337 | + "params": { | ||
338 | + "numRegen": 3 | ||
339 | + }, | ||
340 | + "type": "Roadm" | ||
341 | + }, | ||
342 | + { | ||
343 | + "allowed": true, | ||
344 | + "latitude": 38.8, | ||
345 | + "longitude": 77.1, | ||
346 | + "name": "IAD-M10", | ||
347 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:08", | ||
348 | + "params": { | ||
349 | + "numRegen": 3 | ||
350 | + }, | ||
351 | + "type": "Roadm" | ||
352 | + }, | ||
353 | + { | ||
354 | + "allowed": true, | ||
355 | + "latitude": 40.8, | ||
356 | + "longitude": 73.1, | ||
357 | + "name": "JFK-M10", | ||
358 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:09", | ||
359 | + "params": { | ||
360 | + "numRegen": 0 | ||
361 | + }, | ||
362 | + "type": "Roadm" | ||
363 | + }, | ||
364 | + { | ||
365 | + "allowed": true, | ||
366 | + "latitude": 33.8, | ||
367 | + "longitude": 84.1, | ||
368 | + "name": "ATL-S10", | ||
369 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:0A", | ||
370 | + "params": { | ||
371 | + "numRegen": 0 | ||
372 | + }, | ||
373 | + "type": "Roadm" | ||
374 | + }, | ||
375 | + { | ||
376 | + "allowed": true, | ||
377 | + "latitude": 32.8, | ||
378 | + "longitude": 97.1, | ||
379 | + "name": "DFW-M10", | ||
380 | + "nodeDpid": "00:00:ff:ff:ff:ff:ff:06", | ||
381 | + "params": { | ||
382 | + "numRegen": 3 | ||
383 | + }, | ||
384 | + "type": "Roadm" | ||
385 | + } | ||
386 | + ] | ||
387 | +} |
... | @@ -31,12 +31,6 @@ | ... | @@ -31,12 +31,6 @@ |
31 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] | 31 | "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] |
32 | }, | 32 | }, |
33 | { | 33 | { |
34 | - "uri": "of:0000ffffffffff06", "mac": "ffffffffffff06", "type": "ROADM", | ||
35 | - "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "DFW-M10", | ||
36 | - "annotations": { "latitude": 32.8, "longitude": 97.1, "optical.regens": 3 }, | ||
37 | - "ports": [ { "port": 30, "speed": 0, "type": "FIBER" }, { "port": 31, "speed": 0, "type": "FIBER" } ] | ||
38 | - }, | ||
39 | - { | ||
40 | "uri": "of:0000ffffffffff07", "mac": "ffffffffffff07", "type": "ROADM", | 34 | "uri": "of:0000ffffffffff07", "mac": "ffffffffffff07", "type": "ROADM", |
41 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "CHG-N10", | 35 | "mfr": "Linc", "hw": "OE", "sw": "?", "serial": "?", "name": "CHG-N10", |
42 | "annotations": { "latitude": 41.8, "longitude": 120.1, "optical.regens": 3 }, | 36 | "annotations": { "latitude": 41.8, "longitude": 120.1, "optical.regens": 3 }, |
... | @@ -67,31 +61,31 @@ | ... | @@ -67,31 +61,31 @@ |
67 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 61 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
68 | }, | 62 | }, |
69 | { | 63 | { |
70 | - "uri": "of:0000ffffffff0003", "mac": "ffffffffff0003", "type": "SWITCH", | 64 | + "uri": "of:0000ffffffff0002", "mac": "ffffffffff0003", "type": "SWITCH", |
71 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "LAX-R10", | 65 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "LAX-R10", |
72 | "annotations": { "latitude": 33.9, "longitude": 118.4 }, | 66 | "annotations": { "latitude": 33.9, "longitude": 118.4 }, |
73 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 67 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
74 | }, | 68 | }, |
75 | { | 69 | { |
76 | - "uri": "of:0000ffffffff0004", "mac": "ffffffffff0004", "type": "SWITCH", | 70 | + "uri": "of:0000ffffffff0003", "mac": "ffffffffff0004", "type": "SWITCH", |
77 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SDG-R10", | 71 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "SDG-R10", |
78 | "annotations": { "latitude": 32.8, "longitude": 117.1 }, | 72 | "annotations": { "latitude": 32.8, "longitude": 117.1 }, |
79 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 73 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
80 | }, | 74 | }, |
81 | { | 75 | { |
82 | - "uri": "of:0000ffffffff0007", "mac": "ffffffffff0007", "type": "SWITCH", | 76 | + "uri": "of:0000ffffffff0004", "mac": "ffffffffff0007", "type": "SWITCH", |
83 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "CHG-R10", | 77 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "CHG-R10", |
84 | "annotations": { "latitude": 41.8, "longitude": 120.1 }, | 78 | "annotations": { "latitude": 41.8, "longitude": 120.1 }, |
85 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 79 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
86 | }, | 80 | }, |
87 | { | 81 | { |
88 | - "uri": "of:0000ffffffff0009", "mac": "ffffffffff0009", "type": "SWITCH", | 82 | + "uri": "of:0000ffffffff0005", "mac": "ffffffffff0009", "type": "SWITCH", |
89 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "JFK-R10", | 83 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "JFK-R10", |
90 | "annotations": { "latitude": 40.8, "longitude": 73.1 }, | 84 | "annotations": { "latitude": 40.8, "longitude": 73.1 }, |
91 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 85 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] |
92 | }, | 86 | }, |
93 | { | 87 | { |
94 | - "uri": "of:0000ffffffff000A", "mac": "ffffffffff000A", "type": "SWITCH", | 88 | + "uri": "of:0000ffffffff0006", "mac": "ffffffffff000A", "type": "SWITCH", |
95 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ATL-R10", | 89 | "mfr": "Linc", "hw": "PK", "sw": "?", "serial": "?", "name": "ATL-R10", |
96 | "annotations": { "latitude": 33.8, "longitude": 84.1 }, | 90 | "annotations": { "latitude": 33.8, "longitude": 84.1 }, |
97 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | 91 | "ports": [ { "port": 1, "speed": 10000, "type": "COPPER" }, { "port": 2, "speed": 100000, "type": "FIBER" } ] | ... | ... |
tools/test/topos/optical-2.py
0 → 100755
1 | +#!/usr/bin/env python | ||
2 | + | ||
3 | +''' file: custom/optical.py ''' | ||
4 | +from mininet.node import RemoteController | ||
5 | +from mininet.topo import Topo | ||
6 | +from mininet.net import Mininet | ||
7 | +from mininet.cli import CLI | ||
8 | +from mininet.log import setLogLevel, info | ||
9 | +from mininet.util import irange | ||
10 | + | ||
11 | +switches = [] | ||
12 | + | ||
13 | +class OpticalTopo( Topo ): | ||
14 | + | ||
15 | + def build( self, n=6, tapStart=29 ): | ||
16 | + global switches | ||
17 | + # Add hosts and switches | ||
18 | + hosts = [] | ||
19 | + switches = [] | ||
20 | + for i in irange( 1, n ): | ||
21 | + h = self.addHost( 'h%d' % i ) | ||
22 | + s = self.addSwitch( 's%d' % i, dpid='0000ffffffff%04d' % i ) | ||
23 | + self.addLink( h, s ) | ||
24 | + hosts.append( h ) | ||
25 | + switches.append( s ) | ||
26 | + | ||
27 | + # Add optical tap interfaces | ||
28 | + tapNum = tapStart | ||
29 | + #for sw in switches: | ||
30 | + # self.addLink( sw, sw, intfName1='%s-eth0' % sw, intfName2='tap%d' % tapNum ) | ||
31 | + #Add tap interface up | ||
32 | + #sudo ip link set dev tap25 up | ||
33 | + # tapNum += 1 | ||
34 | + | ||
35 | +# if you use, sudo mn --custom custom/optical.py, then register the topo: | ||
36 | +#sudo mn --custom ~/mininet/custom/optical-2.py --topo optical,6 --controller=remote | ||
37 | +#sudo ./mininet/custom/optical-2.py | ||
38 | +topos = { 'optical': OpticalTopo } | ||
39 | + | ||
40 | +def installStaticFlows( net ): | ||
41 | + for swName in [ 's1', 's2', 's3', 's4', 's5', 's6' ]: | ||
42 | + info( 'Adding flows to %s...' % swName ) | ||
43 | + sw = net[ swName ] | ||
44 | + sw.dpctl( 'add-flow', 'in_port=1,actions=output=2' ) | ||
45 | + sw.dpctl( 'add-flow', 'in_port=2,actions=output=1' ) | ||
46 | + info( sw.dpctl( 'dump-flows' ) ) | ||
47 | + | ||
48 | +def run(): | ||
49 | + net = Mininet( topo=OpticalTopo(), controller=RemoteController ) | ||
50 | + net.start() | ||
51 | + #installStaticFlows( net ) | ||
52 | + tapStart = 29 | ||
53 | + for sw in switches: | ||
54 | + net.get(sw).attach( 'tap%d' %tapStart ) | ||
55 | + tapStart += 1 | ||
56 | + CLI( net ) | ||
57 | + net.stop() | ||
58 | + | ||
59 | +# if the script is run directly (sudo custom/optical.py): | ||
60 | +if __name__ == '__main__': | ||
61 | + setLogLevel( 'info' ) | ||
62 | + run() |
-
Please register or login to post a comment