blob: 542c3ed9f9d32f7cde49486260f6ee7630f4c120 [file] [log] [blame]
Hari Krishnac195f3b2015-07-08 20:02:24 -07001#!/usr/bin/python
2"""
3"""
4from mininet.topo import Topo
5from mininet.net import Mininet
6from mininet.node import RemoteController
7from mininet.node import Node
8from mininet.node import CPULimitedHost
9from mininet.link import TCLink
10from mininet.cli import CLI
11from mininet.log import setLogLevel
12from mininet.util import dumpNodeConnections
Hari Krishnaaf7fcaa2015-07-22 16:04:27 -070013from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
Hari Krishnac195f3b2015-07-08 20:02:24 -070014
15class chordalTopo( Topo ):
16
17 def __init__( self, **opts ):
18 "Create a topology."
19
20 # Initialize Topology
21 Topo.__init__( self, **opts )
22
23 # add nodes, switches first...
24 s1 = self.addSwitch( 's1' )
25 s2 = self.addSwitch( 's2' )
26 s3 = self.addSwitch( 's3' )
27 s4 = self.addSwitch( 's4' )
28 s5 = self.addSwitch( 's5' )
29 s6 = self.addSwitch( 's6' )
30 s7 = self.addSwitch( 's7' )
31 s8 = self.addSwitch( 's8' )
32 s9 = self.addSwitch( 's9' )
33 s10 = self.addSwitch( 's10' )
34 s11 = self.addSwitch( 's11' )
35 s12 = self.addSwitch( 's12' )
36 s13 = self.addSwitch( 's13' )
37 s14 = self.addSwitch( 's14' )
38 s15 = self.addSwitch( 's15' )
39 s16 = self.addSwitch( 's16' )
40 s17 = self.addSwitch( 's17' )
41 s18 = self.addSwitch( 's18' )
42 s19 = self.addSwitch( 's19' )
43 s20 = self.addSwitch( 's20' )
44 s21 = self.addSwitch( 's21' )
45 s22 = self.addSwitch( 's22' )
46 s23 = self.addSwitch( 's23' )
47 s24 = self.addSwitch( 's24' )
48 s25 = self.addSwitch( 's25' )
49
50 # ... and now hosts
51 s1_host = self.addHost( 'h1' )
52 s2_host = self.addHost( 'h2' )
53 s3_host = self.addHost( 'h3' )
54 s4_host = self.addHost( 'h4' )
55 s5_host = self.addHost( 'h5' )
56 s6_host = self.addHost( 'h6' )
57 s7_host = self.addHost( 'h7' )
58 s8_host = self.addHost( 'h8' )
59 s9_host = self.addHost( 'h9' )
60 s10_host = self.addHost( 'h10' )
61 s11_host = self.addHost( 'h11' )
62 s12_host = self.addHost( 'h12' )
63 s13_host = self.addHost( 'h13' )
64 s14_host = self.addHost( 'h14' )
65 s15_host = self.addHost( 'h15' )
66 s16_host = self.addHost( 'h16' )
67 s17_host = self.addHost( 'h17' )
68 s18_host = self.addHost( 'h18' )
69 s19_host = self.addHost( 'h19' )
70 s20_host = self.addHost( 'h20' )
71 s21_host = self.addHost( 'h21' )
72 s22_host = self.addHost( 'h22' )
73 s23_host = self.addHost( 'h23' )
74 s24_host = self.addHost( 'h24' )
75 s25_host = self.addHost( 'h25' )
76
77 # add edges between switch and corresponding host
78 self.addLink( s1 , s1_host )
79 self.addLink( s2 , s2_host )
80 self.addLink( s3 , s3_host )
81 self.addLink( s4 , s4_host )
82 self.addLink( s5 , s5_host )
83 self.addLink( s6 , s6_host )
84 self.addLink( s7 , s7_host )
85 self.addLink( s8 , s8_host )
86 self.addLink( s9 , s9_host )
87 self.addLink( s10 , s10_host )
88 self.addLink( s11 , s11_host )
89 self.addLink( s12 , s12_host )
90 self.addLink( s13 , s13_host )
91 self.addLink( s14 , s14_host )
92 self.addLink( s15 , s15_host )
93 self.addLink( s16 , s16_host )
94 self.addLink( s17 , s17_host )
95 self.addLink( s18 , s18_host )
96 self.addLink( s19 , s19_host )
97 self.addLink( s20 , s20_host )
98 self.addLink( s21 , s21_host )
99 self.addLink( s22 , s22_host )
100 self.addLink( s23 , s23_host )
101 self.addLink( s24 , s24_host )
102 self.addLink( s25 , s25_host )
103 self.addLink(s1, s2)
104 self.addLink(s1, s3)
105 self.addLink(s1, s4)
106 self.addLink(s1, s5)
107 self.addLink(s1, s6)
108 self.addLink(s1, s7)
109 self.addLink(s1, s8)
110 self.addLink(s1, s9)
111 self.addLink(s1, s10)
112 self.addLink(s1, s11)
113 self.addLink(s1, s12)
114 self.addLink(s1, s13)
115 self.addLink(s1, s14)
116 self.addLink(s1, s15)
117 self.addLink(s1, s16)
118 self.addLink(s1, s17)
119 self.addLink(s1, s18)
120 self.addLink(s1, s19)
121 self.addLink(s1, s20)
122 self.addLink(s1, s21)
123 self.addLink(s1, s22)
124 self.addLink(s1, s23)
125 self.addLink(s1, s24)
126 self.addLink(s1, s25)
127 self.addLink(s2, s3)
128 self.addLink(s2, s4)
129 self.addLink(s2, s5)
130 self.addLink(s2, s6)
131 self.addLink(s2, s7)
132 self.addLink(s2, s8)
133 self.addLink(s2, s9)
134 self.addLink(s2, s10)
135 self.addLink(s2, s11)
136 self.addLink(s2, s12)
137 self.addLink(s2, s13)
138 self.addLink(s2, s14)
139 self.addLink(s2, s15)
140 self.addLink(s2, s16)
141 self.addLink(s2, s17)
142 self.addLink(s2, s18)
143 self.addLink(s2, s19)
144 self.addLink(s2, s20)
145 self.addLink(s2, s21)
146 self.addLink(s2, s22)
147 self.addLink(s2, s23)
148 self.addLink(s2, s24)
149 self.addLink(s2, s25)
150 self.addLink(s3, s4)
151 self.addLink(s3, s5)
152 self.addLink(s3, s6)
153 self.addLink(s3, s7)
154 self.addLink(s3, s8)
155 self.addLink(s3, s9)
156 self.addLink(s3, s10)
157 self.addLink(s3, s11)
158 self.addLink(s3, s12)
159 self.addLink(s3, s13)
160 self.addLink(s3, s14)
161 self.addLink(s3, s15)
162 self.addLink(s3, s16)
163 self.addLink(s3, s17)
164 self.addLink(s3, s18)
165 self.addLink(s3, s19)
166 self.addLink(s3, s20)
167 self.addLink(s3, s21)
168 self.addLink(s3, s22)
169 self.addLink(s3, s23)
170 self.addLink(s3, s24)
171 self.addLink(s3, s25)
172 self.addLink(s4, s5)
173 self.addLink(s4, s6)
174 self.addLink(s4, s7)
175 self.addLink(s4, s8)
176 self.addLink(s4, s9)
177 self.addLink(s4, s10)
178 self.addLink(s4, s11)
179 self.addLink(s4, s12)
180 self.addLink(s4, s13)
181 self.addLink(s4, s14)
182 self.addLink(s4, s15)
183 self.addLink(s4, s16)
184 self.addLink(s4, s17)
185 self.addLink(s4, s18)
186 self.addLink(s4, s19)
187 self.addLink(s4, s20)
188 self.addLink(s4, s21)
189 self.addLink(s4, s22)
190 self.addLink(s4, s23)
191 self.addLink(s4, s24)
192 self.addLink(s4, s25)
193 self.addLink(s5, s6)
194 self.addLink(s5, s7)
195 self.addLink(s5, s8)
196 self.addLink(s5, s9)
197 self.addLink(s5, s10)
198 self.addLink(s5, s11)
199 self.addLink(s5, s12)
200 self.addLink(s5, s13)
201 self.addLink(s5, s14)
202 self.addLink(s5, s15)
203 self.addLink(s5, s16)
204 self.addLink(s5, s17)
205 self.addLink(s5, s18)
206 self.addLink(s5, s19)
207 self.addLink(s5, s20)
208 self.addLink(s5, s21)
209 self.addLink(s5, s22)
210 self.addLink(s5, s23)
211 self.addLink(s5, s24)
212 self.addLink(s5, s25)
213 self.addLink(s6, s7)
214 self.addLink(s6, s8)
215 self.addLink(s6, s9)
216 self.addLink(s6, s10)
217 self.addLink(s6, s11)
218 self.addLink(s6, s12)
219 self.addLink(s6, s13)
220 self.addLink(s6, s14)
221 self.addLink(s6, s15)
222 self.addLink(s6, s16)
223 self.addLink(s6, s17)
224 self.addLink(s6, s18)
225 self.addLink(s6, s19)
226 self.addLink(s6, s20)
227 self.addLink(s6, s21)
228 self.addLink(s6, s22)
229 self.addLink(s6, s23)
230 self.addLink(s6, s24)
231 self.addLink(s6, s25)
232 self.addLink(s7, s8)
233 self.addLink(s7, s9)
234 self.addLink(s7, s10)
235 self.addLink(s7, s11)
236 self.addLink(s7, s12)
237 self.addLink(s7, s13)
238 self.addLink(s7, s14)
239 self.addLink(s7, s15)
240 self.addLink(s7, s16)
241 self.addLink(s7, s17)
242 self.addLink(s7, s18)
243 self.addLink(s7, s19)
244 self.addLink(s7, s20)
245 self.addLink(s7, s21)
246 self.addLink(s7, s22)
247 self.addLink(s7, s23)
248 self.addLink(s7, s24)
249 self.addLink(s7, s25)
250 self.addLink(s8, s9)
251 self.addLink(s8, s10)
252 self.addLink(s8, s11)
253 self.addLink(s8, s12)
254 self.addLink(s8, s13)
255 self.addLink(s8, s14)
256 self.addLink(s8, s15)
257 self.addLink(s8, s16)
258 self.addLink(s8, s17)
259 self.addLink(s8, s18)
260 self.addLink(s8, s19)
261 self.addLink(s8, s20)
262 self.addLink(s8, s21)
263 self.addLink(s8, s22)
264 self.addLink(s8, s23)
265 self.addLink(s8, s24)
266 self.addLink(s8, s25)
267 self.addLink(s9, s10)
268 self.addLink(s9, s11)
269 self.addLink(s9, s12)
270 self.addLink(s9, s13)
271 self.addLink(s9, s14)
272 self.addLink(s9, s15)
273 self.addLink(s9, s16)
274 self.addLink(s9, s17)
275 self.addLink(s9, s18)
276 self.addLink(s9, s19)
277 self.addLink(s9, s20)
278 self.addLink(s9, s21)
279 self.addLink(s9, s22)
280 self.addLink(s9, s23)
281 self.addLink(s9, s24)
282 self.addLink(s9, s25)
283 self.addLink(s10, s11)
284 self.addLink(s10, s12)
285 self.addLink(s10, s13)
286 self.addLink(s10, s14)
287 self.addLink(s10, s15)
288 self.addLink(s10, s16)
289 self.addLink(s10, s17)
290 self.addLink(s10, s18)
291 self.addLink(s10, s19)
292 self.addLink(s10, s20)
293 self.addLink(s10, s21)
294 self.addLink(s10, s22)
295 self.addLink(s10, s23)
296 self.addLink(s10, s24)
297 self.addLink(s10, s25)
298 self.addLink(s11, s12)
299 self.addLink(s11, s13)
300 self.addLink(s11, s14)
301 self.addLink(s11, s15)
302 self.addLink(s11, s16)
303 self.addLink(s11, s17)
304 self.addLink(s11, s18)
305 self.addLink(s11, s19)
306 self.addLink(s11, s20)
307 self.addLink(s11, s21)
308 self.addLink(s11, s22)
309 self.addLink(s11, s23)
310 self.addLink(s11, s24)
311 self.addLink(s11, s25)
312 self.addLink(s12, s13)
313 self.addLink(s12, s14)
314 self.addLink(s12, s15)
315 self.addLink(s12, s16)
316 self.addLink(s12, s17)
317 self.addLink(s12, s18)
318 self.addLink(s12, s19)
319 self.addLink(s12, s20)
320 self.addLink(s12, s21)
321 self.addLink(s12, s22)
322 self.addLink(s12, s23)
323 self.addLink(s12, s24)
324 self.addLink(s12, s25)
325 self.addLink(s13, s14)
326 self.addLink(s13, s15)
327 self.addLink(s13, s16)
328 self.addLink(s13, s17)
329 self.addLink(s13, s18)
330 self.addLink(s13, s19)
331 self.addLink(s13, s20)
332 self.addLink(s13, s21)
333 self.addLink(s13, s22)
334 self.addLink(s13, s23)
335 self.addLink(s13, s24)
336 self.addLink(s13, s25)
337 self.addLink(s14, s15)
338 self.addLink(s14, s16)
339 self.addLink(s14, s17)
340 self.addLink(s14, s18)
341 self.addLink(s14, s19)
342 self.addLink(s14, s20)
343 self.addLink(s14, s21)
344 self.addLink(s14, s22)
345 self.addLink(s14, s23)
346 self.addLink(s14, s24)
347 self.addLink(s14, s25)
348 self.addLink(s15, s16)
349 self.addLink(s15, s17)
350 self.addLink(s15, s18)
351 self.addLink(s15, s19)
352 self.addLink(s15, s20)
353 self.addLink(s15, s21)
354 self.addLink(s15, s22)
355 self.addLink(s15, s23)
356 self.addLink(s15, s24)
357 self.addLink(s15, s25)
358 self.addLink(s16, s17)
359 self.addLink(s16, s18)
360 self.addLink(s16, s19)
361 self.addLink(s16, s20)
362 self.addLink(s16, s21)
363 self.addLink(s16, s22)
364 self.addLink(s16, s23)
365 self.addLink(s16, s24)
366 self.addLink(s16, s25)
367 self.addLink(s17, s18)
368 self.addLink(s17, s19)
369 self.addLink(s17, s20)
370 self.addLink(s17, s21)
371 self.addLink(s17, s22)
372 self.addLink(s17, s23)
373 self.addLink(s17, s24)
374 self.addLink(s17, s25)
375 self.addLink(s18, s19)
376 self.addLink(s18, s20)
377 self.addLink(s18, s21)
378 self.addLink(s18, s22)
379 self.addLink(s18, s23)
380 self.addLink(s18, s24)
381 self.addLink(s18, s25)
382 self.addLink(s19, s20)
383 self.addLink(s19, s21)
384 self.addLink(s19, s22)
385 self.addLink(s19, s23)
386 self.addLink(s19, s24)
387 self.addLink(s19, s25)
388 self.addLink(s20, s21)
389 self.addLink(s20, s22)
390 self.addLink(s20, s23)
391 self.addLink(s20, s24)
392 self.addLink(s20, s25)
393 self.addLink(s21, s22)
394 self.addLink(s21, s23)
395 self.addLink(s21, s24)
396 self.addLink(s21, s25)
397 self.addLink(s22, s23)
398 self.addLink(s22, s24)
399 self.addLink(s22, s25)
400 self.addLink(s23, s24)
401 self.addLink(s23, s25)
402 self.addLink(s24, s25)
403
404topos = { 'chordal': ( lambda: chordalTopo() ) }
405
406# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
407
408def setupNetwork():
409 "Create network"
410 topo = chordalTopo()
411 #if controller_ip == '':
412 #controller_ip = '10.0.2.2';
413 # controller_ip = '127.0.0.1';
414 network = Mininet(topo=topo, switch=OVSSwitch,autoSetMacs=True, controller=None)
415 network.start()
416 CLI( network )
417 network.stop()
418
419if __name__ == '__main__':
420 setLogLevel('info')
421 #setLogLevel('debug')
422 setupNetwork()