blob: 48c4619bdf4d2a9e42fa2db7f796e1a4b6f3c015 [file] [log] [blame]
You Wangdb927a52016-02-26 11:03:28 -08001#!/usr/bin/python
2
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07004Copyright 2016 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07005
6Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
7the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
8or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
9
10 TestON is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 2 of the License, or
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070013 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070014
15 TestON is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with TestON. If not, see <http://www.gnu.org/licenses/>.
22"""
You Wangdb927a52016-02-26 11:03:28 -080023from mininet.topo import Topo
24from mininet.net import Mininet
25from mininet.node import Controller, RemoteController, OVSController
26from mininet.node import CPULimitedHost, Host, Node
27from mininet.cli import CLI
28from mininet.log import setLogLevel, info
29from mininet.link import TCLink, Intf
30from subprocess import call
31from mininet.util import dumpNodeConnections
32from mininet.node import ( UserSwitch, OVSSwitch, IVSSwitch )
33
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070034
You Wangdb927a52016-02-26 11:03:28 -080035class spineTopo( Topo ):
36
37 def __init__( self, **opts ):
38 "Create a topology."
39
40 # Initialize Topology
41 Topo.__init__( self, **opts )
42
43 # add nodes, Leaf switches
44 s1 = self.addSwitch( 's1' )
45 s2 = self.addSwitch( 's2' )
46 s3 = self.addSwitch( 's3' )
47 s4 = self.addSwitch( 's4' )
48 s5 = self.addSwitch( 's5' )
49 s6 = self.addSwitch( 's6' )
50 s7 = self.addSwitch( 's7' )
51 s8 = self.addSwitch( 's8' )
52 s9 = self.addSwitch( 's9' )
53 s10 = self.addSwitch( 's10' )
54 s11 = self.addSwitch( 's11' )
55 s12 = self.addSwitch( 's12' )
56 s13 = self.addSwitch( 's13' )
57 s14 = self.addSwitch( 's14' )
58
59 # add nodes, Spine switches first...
60 s15 = self.addSwitch( 's15' )
61 s16 = self.addSwitch( 's16' )
62 s17 = self.addSwitch( 's17' )
63 s18 = self.addSwitch( 's18' )
64 s19 = self.addSwitch( 's19' )
65 s20 = self.addSwitch( 's20' )
66 s21 = self.addSwitch( 's21' )
67 s22 = self.addSwitch( 's22' )
68 s23 = self.addSwitch( 's23' )
69 s24 = self.addSwitch( 's24' )
70 s25 = self.addSwitch( 's25' )
71 s26 = self.addSwitch( 's26' )
72 s27 = self.addSwitch( 's27' )
73 s28 = self.addSwitch( 's28' )
74 s29 = self.addSwitch( 's29' )
75 s30 = self.addSwitch( 's30' )
76 s31 = self.addSwitch( 's31' )
77 s32 = self.addSwitch( 's32' )
78 s33 = self.addSwitch( 's33' )
79 s34 = self.addSwitch( 's34' )
80 s35 = self.addSwitch( 's35' )
81 s36 = self.addSwitch( 's36' )
82 s37 = self.addSwitch( 's37' )
83 s38 = self.addSwitch( 's38' )
84 s39 = self.addSwitch( 's39' )
85 s40 = self.addSwitch( 's40' )
86 s41 = self.addSwitch( 's41' )
87 s42 = self.addSwitch( 's42' )
88 s43 = self.addSwitch( 's43' )
89 s44 = self.addSwitch( 's44' )
90 s45 = self.addSwitch( 's45' )
91 s46 = self.addSwitch( 's46' )
92 s47 = self.addSwitch( 's47' )
93 s48 = self.addSwitch( 's48' )
94 s49 = self.addSwitch( 's49' )
95 s50 = self.addSwitch( 's50' )
96 s51 = self.addSwitch( 's51' )
97 s52 = self.addSwitch( 's52' )
98 s53 = self.addSwitch( 's53' )
99 s54 = self.addSwitch( 's54' )
100 s55 = self.addSwitch( 's55' )
101 s56 = self.addSwitch( 's56' )
102 s57 = self.addSwitch( 's57' )
103 s58 = self.addSwitch( 's58' )
104 s59 = self.addSwitch( 's59' )
105 s60 = self.addSwitch( 's60' )
106 s61 = self.addSwitch( 's61' )
107 s62 = self.addSwitch( 's62' )
108 s63 = self.addSwitch( 's63' )
109 s64 = self.addSwitch( 's64' )
110 s65 = self.addSwitch( 's65' )
111 s66 = self.addSwitch( 's66' )
112 s67 = self.addSwitch( 's67' )
113 s68 = self.addSwitch( 's68' )
114 s69 = self.addSwitch( 's69' )
115 s70 = self.addSwitch( 's70' )
116 s71 = self.addSwitch( 's71' )
117 s72 = self.addSwitch( 's72' )
118 s73 = self.addSwitch( 's73' )
119 s74 = self.addSwitch( 's74' )
120 s75 = self.addSwitch( 's75' )
121 s76 = self.addSwitch( 's76' )
122 s77 = self.addSwitch( 's77' )
123 s78 = self.addSwitch( 's78' )
124
125 # ... and now hosts
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700126 # s1_host = self.addHost( 'h1' )
127 # s2_host = self.addHost( 'h2' )
128 # s3_host = self.addHost( 'h3' )
129 # s4_host = self.addHost( 'h4' )
130 # s5_host = self.addHost( 'h5' )
131 # s6_host = self.addHost( 'h6' )
132 # s7_host = self.addHost( 'h7' )
133 # s8_host = self.addHost( 'h8' )
134 # s9_host = self.addHost( 'h9' )
135 # s10_host = self.addHost( 'h10' )
You Wangdb927a52016-02-26 11:03:28 -0800136 s11_host = self.addHost( 'h11' )
137 s12_host = self.addHost( 'h12' )
138 s13_host = self.addHost( 'h13' )
139 s14_host = self.addHost( 'h14' )
140 s15_host = self.addHost( 'h15' )
141 s16_host = self.addHost( 'h16' )
142 s17_host = self.addHost( 'h17' )
143 s18_host = self.addHost( 'h18' )
144 s19_host = self.addHost( 'h19' )
145 s20_host = self.addHost( 'h20' )
146 s21_host = self.addHost( 'h21' )
147 s22_host = self.addHost( 'h22' )
148 s23_host = self.addHost( 'h23' )
149 s24_host = self.addHost( 'h24' )
150 s25_host = self.addHost( 'h25' )
151 s26_host = self.addHost( 'h26' )
152 s27_host = self.addHost( 'h27' )
153 s28_host = self.addHost( 'h28' )
154 s29_host = self.addHost( 'h29' )
155 s30_host = self.addHost( 'h30' )
156 s31_host = self.addHost( 'h31' )
157 s32_host = self.addHost( 'h32' )
158 s33_host = self.addHost( 'h33' )
159 s34_host = self.addHost( 'h34' )
160 s35_host = self.addHost( 'h35' )
161 s36_host = self.addHost( 'h36' )
162 s37_host = self.addHost( 'h37' )
163 s38_host = self.addHost( 'h38' )
164 s39_host = self.addHost( 'h39' )
165 s40_host = self.addHost( 'h40' )
166 s41_host = self.addHost( 'h41' )
167 s42_host = self.addHost( 'h42' )
168 s43_host = self.addHost( 'h43' )
169 s44_host = self.addHost( 'h44' )
170 s45_host = self.addHost( 'h45' )
171 s46_host = self.addHost( 'h46' )
172 s47_host = self.addHost( 'h47' )
173 s48_host = self.addHost( 'h48' )
174 s49_host = self.addHost( 'h49' )
175 s50_host = self.addHost( 'h50' )
176 s51_host = self.addHost( 'h51' )
177 s52_host = self.addHost( 'h52' )
178 s53_host = self.addHost( 'h53' )
179 s54_host = self.addHost( 'h54' )
180 s55_host = self.addHost( 'h55' )
181 s56_host = self.addHost( 'h56' )
182 s57_host = self.addHost( 'h57' )
183 s58_host = self.addHost( 'h58' )
184 s59_host = self.addHost( 'h59' )
185 s60_host = self.addHost( 'h60' )
186 s61_host = self.addHost( 'h61' )
187 s62_host = self.addHost( 'h62' )
188 s63_host = self.addHost( 'h63' )
189 s64_host = self.addHost( 'h64' )
190 s65_host = self.addHost( 'h65' )
191 s66_host = self.addHost( 'h66' )
192 s67_host = self.addHost( 'h67' )
193 s68_host = self.addHost( 'h68' )
194 s69_host = self.addHost( 'h69' )
195 s70_host = self.addHost( 'h70' )
196 s71_host = self.addHost( 'h71' )
197 s72_host = self.addHost( 'h72' )
198 s73_host = self.addHost( 'h73' )
199 s74_host = self.addHost( 'h74' )
200 s75_host = self.addHost( 'h75' )
201 s76_host = self.addHost( 'h76' )
202 s77_host = self.addHost( 'h77' )
203 s78_host = self.addHost( 'h78' )
204
205 # add edges between switch and corresponding host
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700206 # self.addLink( s1 , s1_host )
207 # self.addLink( s2 , s2_host )
208 # self.addLink( s3 , s3_host )
209 # self.addLink( s4 , s4_host )
210 # self.addLink( s5 , s5_host )
211 # self.addLink( s6 , s6_host )
212 # self.addLink( s7 , s7_host )
213 # self.addLink( s8 , s8_host )
214 # self.addLink( s9 , s9_host )
215 # self.addLink( s10 , s10_host )
216 self.addLink( s11, s11_host )
217 self.addLink( s12, s12_host )
218 self.addLink( s13, s13_host )
219 self.addLink( s14, s14_host )
220 self.addLink( s15, s15_host )
221 self.addLink( s16, s16_host )
222 self.addLink( s17, s17_host )
223 self.addLink( s18, s18_host )
224 self.addLink( s19, s19_host )
225 self.addLink( s20, s20_host )
226 self.addLink( s21, s21_host )
227 self.addLink( s22, s22_host )
228 self.addLink( s23, s23_host )
229 self.addLink( s24, s24_host )
230 self.addLink( s25, s25_host )
231 self.addLink( s26, s26_host )
232 self.addLink( s27, s27_host )
233 self.addLink( s28, s28_host )
234 self.addLink( s29, s29_host )
235 self.addLink( s30, s30_host )
236 self.addLink( s31, s31_host )
237 self.addLink( s32, s32_host )
238 self.addLink( s33, s33_host )
239 self.addLink( s34, s34_host )
240 self.addLink( s35, s35_host )
241 self.addLink( s36, s36_host )
242 self.addLink( s37, s37_host )
243 self.addLink( s38, s38_host )
244 self.addLink( s39, s39_host )
245 self.addLink( s40, s40_host )
246 self.addLink( s41, s41_host )
247 self.addLink( s42, s42_host )
248 self.addLink( s43, s43_host )
249 self.addLink( s44, s44_host )
250 self.addLink( s45, s45_host )
251 self.addLink( s46, s46_host )
252 self.addLink( s47, s47_host )
253 self.addLink( s48, s48_host )
254 self.addLink( s49, s49_host )
255 self.addLink( s50, s50_host )
256 self.addLink( s51, s51_host )
257 self.addLink( s52, s52_host )
258 self.addLink( s53, s53_host )
259 self.addLink( s54, s54_host )
260 self.addLink( s55, s55_host )
261 self.addLink( s56, s56_host )
262 self.addLink( s57, s57_host )
263 self.addLink( s58, s58_host )
264 self.addLink( s59, s59_host )
265 self.addLink( s60, s60_host )
266 self.addLink( s61, s61_host )
267 self.addLink( s62, s62_host )
268 self.addLink( s63, s63_host )
269 self.addLink( s64, s64_host )
270 self.addLink( s65, s65_host )
271 self.addLink( s66, s66_host )
272 self.addLink( s67, s67_host )
273 self.addLink( s68, s68_host )
274 self.addLink( s69, s69_host )
275 self.addLink( s70, s70_host )
276 self.addLink( s71, s71_host )
277 self.addLink( s72, s72_host )
278 self.addLink( s73, s73_host )
279 self.addLink( s74, s74_host )
280 self.addLink( s75, s75_host )
281 self.addLink( s76, s76_host )
282 self.addLink( s77, s77_host )
283 self.addLink( s78, s78_host )
You Wangdb927a52016-02-26 11:03:28 -0800284
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700285 # info( '*** Add Leaf links\n' )
286 self.addLink( s1, s9 )
287 self.addLink( s2, s10 )
288 self.addLink( s3, s9 )
289 self.addLink( s4, s10 )
290 self.addLink( s5, s9 )
291 self.addLink( s6, s10 )
292 self.addLink( s7, s9 )
293 self.addLink( s8, s10 )
294 self.addLink( s9, s11 )
295 self.addLink( s9, s12 )
296 self.addLink( s10, s13 )
297 self.addLink( s10, s14 )
298 self.addLink( s11, s12 )
299 self.addLink( s13, s14 )
You Wangdb927a52016-02-26 11:03:28 -0800300
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700301 # info( '*** Add Spine-1 links\n' )
302 self.addLink( s15, s1 )
303 self.addLink( s15, s2 )
304 self.addLink( s16, s1 )
305 self.addLink( s16, s2 )
306 self.addLink( s17, s1 )
307 self.addLink( s17, s2 )
308 self.addLink( s18, s1 )
309 self.addLink( s18, s2 )
310 self.addLink( s19, s1 )
311 self.addLink( s19, s2 )
312 self.addLink( s20, s1 )
313 self.addLink( s20, s2 )
314 self.addLink( s21, s1 )
315 self.addLink( s21, s2 )
316 self.addLink( s22, s1 )
317 self.addLink( s22, s2 )
318 self.addLink( s23, s1 )
319 self.addLink( s23, s2 )
320 self.addLink( s24, s1 )
321 self.addLink( s24, s2 )
322 self.addLink( s25, s1 )
323 self.addLink( s25, s2 )
324 self.addLink( s26, s1 )
325 self.addLink( s26, s2 )
326 self.addLink( s27, s1 )
327 self.addLink( s27, s2 )
328 self.addLink( s28, s1 )
329 self.addLink( s28, s2 )
330 self.addLink( s29, s1 )
331 self.addLink( s29, s2 )
332 self.addLink( s30, s1 )
333 self.addLink( s30, s2 )
You Wangdb927a52016-02-26 11:03:28 -0800334
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700335 # info( '*** Add Spine-2 links\n' )
336 self.addLink( s31, s3 )
337 self.addLink( s31, s4 )
338 self.addLink( s32, s3 )
339 self.addLink( s32, s4 )
340 self.addLink( s33, s3 )
341 self.addLink( s33, s4 )
342 self.addLink( s34, s3 )
343 self.addLink( s34, s4 )
344 self.addLink( s35, s3 )
345 self.addLink( s35, s4 )
346 self.addLink( s36, s3 )
347 self.addLink( s36, s4 )
348 self.addLink( s37, s3 )
349 self.addLink( s37, s4 )
350 self.addLink( s38, s3 )
351 self.addLink( s38, s4 )
352 self.addLink( s39, s3 )
353 self.addLink( s39, s4 )
354 self.addLink( s40, s3 )
355 self.addLink( s40, s4 )
356 self.addLink( s41, s3 )
357 self.addLink( s41, s4 )
358 self.addLink( s42, s3 )
359 self.addLink( s42, s4 )
360 self.addLink( s43, s3 )
361 self.addLink( s43, s4 )
362 self.addLink( s44, s3 )
363 self.addLink( s44, s4 )
364 self.addLink( s45, s3 )
365 self.addLink( s45, s4 )
366 self.addLink( s46, s3 )
367 self.addLink( s46, s4 )
You Wangdb927a52016-02-26 11:03:28 -0800368
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700369 # info( '*** Add Spine-3 links\n' )
370 self.addLink( s47, s5 )
371 self.addLink( s47, s6 )
372 self.addLink( s48, s5 )
373 self.addLink( s48, s6 )
374 self.addLink( s49, s5 )
375 self.addLink( s49, s6 )
376 self.addLink( s50, s5 )
377 self.addLink( s50, s6 )
378 self.addLink( s51, s5 )
379 self.addLink( s51, s6 )
380 self.addLink( s52, s5 )
381 self.addLink( s52, s6 )
382 self.addLink( s53, s5 )
383 self.addLink( s53, s6 )
384 self.addLink( s54, s5 )
385 self.addLink( s54, s6 )
386 self.addLink( s55, s5 )
387 self.addLink( s55, s6 )
388 self.addLink( s56, s5 )
389 self.addLink( s56, s6 )
390 self.addLink( s57, s5 )
391 self.addLink( s57, s6 )
392 self.addLink( s58, s5 )
393 self.addLink( s58, s6 )
394 self.addLink( s59, s5 )
395 self.addLink( s59, s6 )
396 self.addLink( s60, s5 )
397 self.addLink( s60, s6 )
398 self.addLink( s61, s5 )
399 self.addLink( s61, s6 )
400 self.addLink( s62, s5 )
401 self.addLink( s62, s6 )
You Wangdb927a52016-02-26 11:03:28 -0800402
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700403 # info( '*** Add Spine-4 links\n' )
404 self.addLink( s63, s7 )
405 self.addLink( s63, s8 )
406 self.addLink( s64, s7 )
407 self.addLink( s64, s8 )
408 self.addLink( s65, s7 )
409 self.addLink( s65, s8 )
410 self.addLink( s66, s7 )
411 self.addLink( s66, s8 )
412 self.addLink( s67, s7 )
413 self.addLink( s67, s8 )
414 self.addLink( s68, s7 )
415 self.addLink( s68, s8 )
416 self.addLink( s69, s7 )
417 self.addLink( s69, s8 )
418 self.addLink( s70, s7 )
419 self.addLink( s70, s8 )
420 self.addLink( s71, s7 )
421 self.addLink( s71, s8 )
422 self.addLink( s72, s7 )
423 self.addLink( s72, s8 )
424 self.addLink( s73, s7 )
425 self.addLink( s73, s8 )
426 self.addLink( s74, s7 )
427 self.addLink( s74, s8 )
428 self.addLink( s75, s7 )
429 self.addLink( s75, s8 )
430 self.addLink( s76, s7 )
431 self.addLink( s76, s8 )
432 self.addLink( s77, s7 )
433 self.addLink( s77, s8 )
434 self.addLink( s78, s7 )
435 self.addLink( s78, s8 )
You Wangdb927a52016-02-26 11:03:28 -0800436
437topos = { 'spine': ( lambda: spineTopo() ) }
438
439# HERE THE CODE DEFINITION OF THE TOPOLOGY ENDS
440
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700441
You Wangdb927a52016-02-26 11:03:28 -0800442def setupNetwork():
443 "Create network"
444 topo = spineTopo()
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700445 # if controller_ip == '':
446 # controller_ip = '10.0.2.2';
You Wangdb927a52016-02-26 11:03:28 -0800447 # controller_ip = '127.0.0.1';
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700448 network = Mininet( topo=topo, switch=OVSSwitch, link=TCLink, autoSetMacs=True, controller=None )
You Wangdb927a52016-02-26 11:03:28 -0800449 network.start()
450 CLI( network )
451 network.stop()
452
453if __name__ == '__main__':
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700454 setLogLevel( 'info' )
455 # setLogLevel( 'debug' )
You Wangdb927a52016-02-26 11:03:28 -0800456 setupNetwork()