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