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