blob: fbf12a511b99c6fd573e7b59a0b53e939b0b9a15 [file] [log] [blame]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001
2# Testing the basic intent functionality of ONOS
3
4import time
5import json
6
7class FUNCintent:
8
9 def __init__( self ):
10 self.default = ''
11
12 def CASE1( self, main ):
13 import time
14 import os
15 import imp
16
17 """
18 - Construct tests variables
19 - GIT ( optional )
20 - Checkout ONOS master branch
21 - Pull latest ONOS code
22 - Building ONOS ( optional )
23 - Install ONOS package
24 - Build ONOS package
25 """
26
27 main.case( "Constructing test variables and building ONOS package" )
28 main.step( "Constructing test variables" )
29 stepResult = main.FALSE
30
31 # Test variables
32 main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
33 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
34 gitBranch = main.params[ 'GIT' ][ 'branch' ]
35 main.dependencyPath = main.testOnDirectory + \
36 main.params[ 'DEPENDENCY' ][ 'path' ]
37 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
38 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
39 main.maxNodes = int( main.ONOSbench.maxNodes )
40 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
41 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
42 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
43 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
44 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
45 gitPull = main.params[ 'GIT' ][ 'pull' ]
46 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
47 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
48 main.cellData = {} # for creating cell file
49 main.hostsData = {}
50 main.CLIs = []
51 main.ONOSip = []
52
53 main.ONOSip = main.ONOSbench.getOnosIps()
54 print main.ONOSip
55
56 # Assigning ONOS cli handles to a list
57 for i in range( 1, main.maxNodes + 1 ):
58 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
59
60 # -- INIT SECTION, ONLY RUNS ONCE -- #
61 main.startUp = imp.load_source( wrapperFile1,
62 main.dependencyPath +
63 wrapperFile1 +
64 ".py" )
65
66 main.intentFunction = imp.load_source( wrapperFile2,
67 main.dependencyPath +
68 wrapperFile2 +
69 ".py" )
70
71 copyResult = main.ONOSbench.copyMininetFile( main.topology,
72 main.dependencyPath,
73 main.Mininet1.user_name,
74 main.Mininet1.ip_address )
75 if main.CLIs:
76 stepResult = main.TRUE
77 else:
78 main.log.error( "Did not properly created list of ONOS CLI handle" )
79 stepResult = main.FALSE
80
81 utilities.assert_equals( expect=main.TRUE,
82 actual=stepResult,
83 onpass="Successfully construct " +
84 "test variables ",
85 onfail="Failed to construct test variables" )
86
87 if gitPull == 'True':
88 main.step( "Building ONOS in " + gitBranch + " branch" )
89 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
90 stepResult = onosBuildResult
91 utilities.assert_equals( expect=main.TRUE,
92 actual=stepResult,
93 onpass="Successfully compiled " +
94 "latest ONOS",
95 onfail="Failed to compile " +
96 "latest ONOS" )
97 else:
98 main.log.warn( "Did not pull new code so skipping mvn " +
99 "clean install" )
Jon Hall106be082015-07-22 09:53:00 -0700100 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700101
102 def CASE2( self, main ):
103 """
104 - Set up cell
105 - Create cell file
106 - Set cell file
107 - Verify cell file
108 - Kill ONOS process
109 - Uninstall ONOS cluster
110 - Verify ONOS start up
111 - Install ONOS cluster
112 - Connect to cli
113 """
114
115 # main.scale[ 0 ] determines the current number of ONOS controller
116 main.numCtrls = int( main.scale[ 0 ] )
117
118 main.case( "Starting up " + str( main.numCtrls ) +
119 " node(s) ONOS cluster" )
120
121 #kill off all onos processes
122 main.log.info( "Safety check, killing all ONOS processes" +
123 " before initiating enviornment setup" )
124
125 for i in range( main.maxNodes ):
126 main.ONOSbench.onosDie( main.ONOSip[ i ] )
127
128 print "NODE COUNT = ", main.numCtrls
129
130 tempOnosIp = []
131 for i in range( main.numCtrls ):
132 tempOnosIp.append( main.ONOSip[i] )
133
134 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp )
135
136 main.step( "Apply cell to environment" )
137 cellResult = main.ONOSbench.setCell( "temp" )
138 verifyResult = main.ONOSbench.verifyCell()
139 stepResult = cellResult and verifyResult
140 utilities.assert_equals( expect=main.TRUE,
141 actual=stepResult,
142 onpass="Successfully applied cell to " + \
143 "environment",
144 onfail="Failed to apply cell to environment " )
145
146 main.step( "Creating ONOS package" )
147 packageResult = main.ONOSbench.onosPackage()
148 stepResult = packageResult
149 utilities.assert_equals( expect=main.TRUE,
150 actual=stepResult,
151 onpass="Successfully created ONOS package",
152 onfail="Failed to create ONOS package" )
153
154 time.sleep( main.startUpSleep )
155 main.step( "Uninstalling ONOS package" )
156 onosUninstallResult = main.TRUE
157 for i in range( main.numCtrls ):
158 onosUninstallResult = onosUninstallResult and \
159 main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
160 stepResult = onosUninstallResult
161 utilities.assert_equals( expect=main.TRUE,
162 actual=stepResult,
163 onpass="Successfully uninstalled ONOS package",
164 onfail="Failed to uninstall ONOS package" )
165
166 time.sleep( main.startUpSleep )
167 main.step( "Installing ONOS package" )
168 onosInstallResult = main.TRUE
169 for i in range( main.numCtrls ):
170 onosInstallResult = onosInstallResult and \
171 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
172 stepResult = onosInstallResult
173 utilities.assert_equals( expect=main.TRUE,
174 actual=stepResult,
175 onpass="Successfully installed ONOS package",
176 onfail="Failed to install ONOS package" )
177
178 time.sleep( main.startUpSleep )
179 main.step( "Starting ONOS service" )
180 stopResult = main.TRUE
181 startResult = main.TRUE
182 onosIsUp = main.TRUE
183
184 for i in range( main.numCtrls ):
185 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
186 if onosIsUp == main.TRUE:
187 main.log.report( "ONOS instance is up and ready" )
188 else:
189 main.log.report( "ONOS instance may not be up, stop and " +
190 "start ONOS again " )
191 for i in range( main.numCtrls ):
192 stopResult = stopResult and \
193 main.ONOSbench.onosStop( main.ONOSip[ i ] )
194 for i in range( main.numCtrls ):
195 startResult = startResult and \
196 main.ONOSbench.onosStart( main.ONOSip[ i ] )
197 stepResult = onosIsUp and stopResult and startResult
198 utilities.assert_equals( expect=main.TRUE,
199 actual=stepResult,
200 onpass="ONOS service is ready",
201 onfail="ONOS service did not start properly" )
202
203 main.step( "Start ONOS cli" )
204 cliResult = main.TRUE
205 for i in range( main.numCtrls ):
206 cliResult = cliResult and \
207 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
208 stepResult = cliResult
209 utilities.assert_equals( expect=main.TRUE,
210 actual=stepResult,
211 onpass="Successfully start ONOS cli",
212 onfail="Failed to start ONOS cli" )
213
214 # Remove the first element in main.scale list
215 main.scale.remove( main.scale[ 0 ] )
216
217 def CASE9( self, main ):
218 '''
219 Report errors/warnings/exceptions
220 '''
221 main.log.info( "Error report: \n" )
222 main.ONOSbench.logReport( globalONOSip[0],
223 [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
224 "s" )
225 #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
226
227 def CASE11( self, main ):
228 """
229 Start mininet
230 """
231 main.log.report( "Start Mininet topology" )
232 main.log.case( "Start Mininet topology" )
233
234 main.step( "Starting Mininet Topology" )
235 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
236 main.topology )
237 stepResult = topoResult
238 utilities.assert_equals( expect=main.TRUE,
239 actual=stepResult,
240 onpass="Successfully loaded topology",
241 onfail="Failed to load topology" )
242 # Exit if topology did not load properly
243 if not topoResult:
244 main.cleanup()
245 main.exit()
246
247 def CASE12( self, main ):
248 """
249 Assign mastership to controllers
250 """
251 import re
252
253 main.case( "Assign switches to controllers" )
254 main.step( "Assigning switches to controllers" )
255 assignResult = main.TRUE
256 switchList = []
257
258 # Creates a list switch name, use getSwitch() function later...
259 for i in range( 1, ( main.numSwitch + 1 ) ):
260 switchList.append( 's' + str( i ) )
261
262 tempONOSip = []
263 for i in range( main.numCtrls ):
264 tempONOSip.append( main.ONOSip[ i ] )
265
266 assignResult = main.Mininet1.assignSwController( sw=switchList,
267 ip=tempONOSip,
268 port='6633' )
269 if not assignResult:
270 main.cleanup()
271 main.exit()
272
273 for i in range( 1, ( main.numSwitch + 1 ) ):
274 response = main.Mininet1.getSwController( "s" + str( i ) )
275 print( "Response is " + str( response ) )
276 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
277 assignResult = assignResult and main.TRUE
278 else:
279 assignResult = main.FALSE
280 stepResult = assignResult
281 utilities.assert_equals( expect=main.TRUE,
282 actual=stepResult,
283 onpass="Successfully assigned switches" +
284 "to controller",
285 onfail="Failed to assign switches to " +
286 "controller" )
287 def CASE13( self, main ):
288 """
289 Discover all hosts and store its data to a dictionary
290 """
291 main.case( "Discover all hosts" )
292
293 stepResult = main.TRUE
294 main.step( "Discover all hosts using pingall " )
295 stepResult = main.intentFunction.getHostsData( main )
296 utilities.assert_equals( expect=main.TRUE,
297 actual=stepResult,
298 onpass="Successfully discovered hosts",
299 onfail="Failed to discover hosts" )
300
301 def CASE14( self, main ):
302 """
303 Stop mininet
304 """
305 main.log.report( "Stop Mininet topology" )
306 main.log.case( "Stop Mininet topology" )
307
308 main.step( "Stopping Mininet Topology" )
309 topoResult = main.Mininet1.stopNet( )
310 stepResult = topoResult
311 utilities.assert_equals( expect=main.TRUE,
312 actual=stepResult,
313 onpass="Successfully stop mininet",
314 onfail="Failed to stop mininet" )
315 # Exit if topology did not load properly
316 if not topoResult:
317 main.cleanup()
318 main.exit()
319
kelvin-onlabb769f562015-07-15 17:05:10 -0700320 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700321 """
322 Add host intents between 2 host:
323 - Discover hosts
324 - Add host intents
325 - Check intents
326 - Verify flows
327 - Ping hosts
328 - Reroute
329 - Link down
330 - Verify flows
331 - Check topology
332 - Ping hosts
333 - Link up
334 - Verify flows
335 - Check topology
336 - Ping hosts
337 - Remove intents
338 """
339 import time
340 import json
341 import re
342
343 # Assert variables - These variable's name|format must be followed
344 # if you want to use the wrapper function
345 assert main, "There is no main"
346 assert main.CLIs, "There is no main.CLIs"
347 assert main.Mininet1, "Mininet handle should be named Mininet1"
348 assert main.numSwitch, "Placed the total number of switch topology in \
349 main.numSwitch"
350
acsmarse6b410f2015-07-17 14:39:34 -0700351 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
352
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700353 main.case( "Add host intents between 2 host" )
354
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700355 main.step( "IPV4: Add host intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700356 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700357 stepResult = main.intentFunction.hostIntent( main,
358 onosNode='0',
359 name='IPV4',
360 host1='h1',
361 host2='h9',
362 host1Id='00:00:00:00:00:01/-1',
363 host2Id='00:00:00:00:00:09/-1',
364 sw1='s5',
365 sw2='s2',
366 expectedLink=18 )
367
368 utilities.assert_equals( expect=main.TRUE,
369 actual=stepResult,
370 onpass="IPV4: Add host intent successful",
371 onfail="IPV4: Add host intent failed" )
372
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700373 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700374 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700375 stepResult = main.intentFunction.hostIntent( main,
376 name='DUALSTACK',
377 host1='h3',
378 host2='h11',
379 host1Id='00:00:00:00:00:03/-1',
380 host2Id='00:00:00:00:00:0B/-1',
381 sw1='s5',
382 sw2='s2',
383 expectedLink=18 )
384
385 utilities.assert_equals( expect=main.TRUE,
386 actual=stepResult,
387 onpass="DUALSTACK1: Add host intent" +
388 " successful",
389 onfail="DUALSTACK1: Add host intent failed" )
390
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700391 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700392 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700393 stepResult = main.intentFunction.hostIntent( main,
394 name='DUALSTACK2',
395 host1='h1',
396 host2='h11',
397 sw1='s5',
398 sw2='s2',
399 expectedLink=18 )
400
401 utilities.assert_equals( expect=main.TRUE,
402 actual=stepResult,
403 onpass="DUALSTACK2: Add host intent" +
404 " successful",
405 onfail="DUALSTACK2: Add host intent failed" )
406
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700407 main.step( "1HOP: Add host intents between h1 and h3" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700408 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700409 stepResult = main.intentFunction.hostIntent( main,
410 name='1HOP',
411 host1='h1',
412 host2='h3' )
413
414 utilities.assert_equals( expect=main.TRUE,
415 actual=stepResult,
416 onpass="1HOP: Add host intent" +
417 " successful",
418 onfail="1HOP: Add host intent failed" )
419
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700420 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700421 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700422 stepResult = main.intentFunction.hostIntent( main,
423 name='VLAN1',
424 host1='h4',
425 host2='h12',
426 host1Id='00:00:00:00:00:04/100',
427 host2Id='00:00:00:00:00:0C/100',
428 sw1='s5',
429 sw2='s2',
430 expectedLink=18 )
431
432 utilities.assert_equals( expect=main.TRUE,
433 actual=stepResult,
434 onpass="VLAN1: Add vlan host" +
435 " intent successful",
436 onfail="VLAN1: Add vlan host intent failed" )
437
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700438 main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700439 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700440 stepResult = main.intentFunction.hostIntent( main,
441 name='VLAN2',
442 host1='h13',
443 host2='h20' )
444
445 utilities.assert_equals( expect=main.FALSE,
446 actual=stepResult,
447 onpass="VLAN2: Add inter vlan host" +
448 " intent successful",
449 onfail="VLAN2: Add inter vlan host" +
450 " intent failed" )
451
acsmarse6b410f2015-07-17 14:39:34 -0700452
453 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
454 main.intentFunction.checkLeaderChange( intentLeadersOld,
455 intentLeadersNew )
456
kelvin-onlabb769f562015-07-15 17:05:10 -0700457 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700458 """
459 Add point intents between 2 hosts:
460 - Get device ids | ports
461 - Add point intents
462 - Check intents
463 - Verify flows
464 - Ping hosts
465 - Reroute
466 - Link down
467 - Verify flows
468 - Check topology
469 - Ping hosts
470 - Link up
471 - Verify flows
472 - Check topology
473 - Ping hosts
474 - Remove intents
475 """
476 import time
477 import json
478 import re
479
480 # Assert variables - These variable's name|format must be followed
481 # if you want to use the wrapper function
482 assert main, "There is no main"
483 assert main.CLIs, "There is no main.CLIs"
484 assert main.Mininet1, "Mininet handle should be named Mininet1"
485 assert main.numSwitch, "Placed the total number of switch topology in \
486 main.numSwitch"
487
488 main.case( "Add point intents between 2 devices" )
489
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490 # No option point intents
491 main.step( "NOOPTION: Add point intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700492 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700493 stepResult = main.intentFunction.pointIntent(
494 main,
495 name="NOOPTION",
496 host1="h1",
497 host2="h9",
498 deviceId1="of:0000000000000005/1",
499 deviceId2="of:0000000000000006/1",
500 sw1="s5",
501 sw2="s2",
502 expectedLink=18 )
503
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700504 utilities.assert_equals( expect=main.TRUE,
505 actual=stepResult,
506 onpass="NOOPTION: Add point intent successful",
507 onfail="NOOPTION: Add point intent failed" )
508
509 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700510 main.step( "IPV4: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700511 stepResult = main.intentFunction.pointIntent(
512 main,
513 name="IPV4",
514 host1="h1",
515 host2="h9",
516 deviceId1="of:0000000000000005/1",
517 deviceId2="of:0000000000000006/1",
518 port1="",
519 port2="",
520 ethType="IPV4",
521 mac1="00:00:00:00:00:01",
522 mac2="00:00:00:00:00:09",
523 bandwidth="",
524 lambdaAlloc=False,
525 ipProto="",
526 ip1="",
527 ip2="",
528 tcp1="",
529 tcp2="",
530 sw1="s5",
531 sw2="s2",
532 expectedLink=18 )
533
534 utilities.assert_equals( expect=main.TRUE,
535 actual=stepResult,
536 onpass="IPV4: Add point intent successful",
537 onfail="IPV4: Add point intent failed" )
538
kelvin-onlabb769f562015-07-15 17:05:10 -0700539 main.step( "IPV4_2: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700540 stepResult = main.TRUE
541 stepResult = main.intentFunction.pointIntent(
542 main,
543 name="IPV4_2",
544 host1="h1",
545 host2="h9",
546 deviceId1="of:0000000000000005/1",
547 deviceId2="of:0000000000000006/1",
kelvin-onlabb769f562015-07-15 17:05:10 -0700548 ipProto="",
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700549 ip1="",
550 ip2="",
551 tcp1="",
552 tcp2="",
553 sw1="s5",
554 sw2="s2",
555 expectedLink=18 )
556
557 utilities.assert_equals( expect=main.TRUE,
558 actual=stepResult,
559 onpass="IPV4_2: Add point intent successful",
560 onfail="IPV4_2: Add point intent failed" )
561
kelvin-onlabb769f562015-07-15 17:05:10 -0700562 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700563 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700564 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
565 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
566 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
567 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
568 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
569 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
570 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
571
572 stepResult = main.intentFunction.pointIntent(
573 main,
574 name="SDNIP-TCP",
575 host1="h1",
576 host2="h9",
577 deviceId1="of:0000000000000005/1",
578 deviceId2="of:0000000000000006/1",
579 mac1=mac1,
580 mac2=mac2,
581 ethType="IPV4",
582 ipProto=ipProto,
583 ip1=ip1,
584 ip2=ip2,
585 tcp1=tcp1,
586 tcp2=tcp2 )
587
588 utilities.assert_equals( expect=main.TRUE,
589 actual=stepResult,
590 onpass="SDNIP-TCP: Add point intent successful",
591 onfail="SDNIP-TCP: Add point intent failed" )
592
593 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
594 stepResult = main.TRUE
595 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
596 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
597 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
598 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
599 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
600 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
601 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
602
603 stepResult = main.intentFunction.pointIntent(
604 main,
605 name="SDNIP-ICMP",
606 host1="h1",
607 host2="h9",
608 deviceId1="of:0000000000000005/1",
609 deviceId2="of:0000000000000006/1",
610 mac1=mac1,
611 mac2=mac2,
612 ethType="IPV4",
613 ipProto=ipProto )
614
615 utilities.assert_equals( expect=main.TRUE,
616 actual=stepResult,
617 onpass="SDNIP-ICMP: Add point intent successful",
618 onfail="SDNIP-ICMP: Add point intent failed" )
619
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700620 main.step( "DUALSTACK1: Add point intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700621 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700622 stepResult = main.intentFunction.pointIntent(
623 main,
624 name="DUALSTACK1",
625 host1="h3",
626 host2="h11",
627 deviceId1="of:0000000000000005",
628 deviceId2="of:0000000000000006",
629 port1="3",
630 port2="3",
631 ethType="IPV4",
632 mac1="00:00:00:00:00:03",
633 mac2="00:00:00:00:00:0B",
634 bandwidth="",
635 lambdaAlloc=False,
636 ipProto="",
637 ip1="",
638 ip2="",
639 tcp1="",
640 tcp2="",
641 sw1="s5",
642 sw2="s2",
643 expectedLink=18 )
644
645 utilities.assert_equals( expect=main.TRUE,
646 actual=stepResult,
647 onpass="DUALSTACK1: Add point intent" +
648 " successful",
acsmarse6b410f2015-07-17 14:39:34 -0700649 onfail="DUALSTACK1: Add point intent failed" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700650
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700651 main.step( "VLAN: Add point intents between h5 and h21" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700652 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700653 stepResult = main.intentFunction.pointIntent(
654 main,
655 name="VLAN",
656 host1="h5",
657 host2="h21",
658 deviceId1="of:0000000000000005/5",
659 deviceId2="of:0000000000000007/5",
660 port1="",
661 port2="",
662 ethType="IPV4",
663 mac1="00:00:00:00:00:05",
664 mac2="00:00:00:00:00:15",
665 bandwidth="",
666 lambdaAlloc=False,
667 ipProto="",
668 ip1="",
669 ip2="",
670 tcp1="",
671 tcp2="",
672 sw1="s5",
673 sw2="s2",
674 expectedLink=18 )
675
676 utilities.assert_equals( expect=main.TRUE,
677 actual=stepResult,
678 onpass="VLAN: Add point intent successful",
679 onfail="VLAN: Add point intent failed" )
680
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700681 main.step( "1HOP: Add point intents between h1 and h3" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700682 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700683 stepResult = main.intentFunction.hostIntent( main,
684 name='1HOP',
685 host1='h1',
686 host2='h3' )
687
688 utilities.assert_equals( expect=main.TRUE,
689 actual=stepResult,
690 onpass="1HOP: Add point intent" +
691 " successful",
692 onfail="1HOP: Add point intent failed" )
693
kelvin-onlabb769f562015-07-15 17:05:10 -0700694 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700695 """
696 Add single point to multi point intents
697 - Get device ids
698 - Add single point to multi point intents
699 - Check intents
700 - Verify flows
701 - Ping hosts
702 - Reroute
703 - Link down
704 - Verify flows
705 - Check topology
706 - Ping hosts
707 - Link up
708 - Verify flows
709 - Check topology
710 - Ping hosts
711 - Remove intents
712 """
713 assert main, "There is no main"
714 assert main.CLIs, "There is no main.CLIs"
715 assert main.Mininet1, "Mininet handle should be named Mininet1"
716 assert main.numSwitch, "Placed the total number of switch topology in \
717 main.numSwitch"
718
719 main.case( "Add single point to multi point intents between devices" )
720
kelvin-onlabb769f562015-07-15 17:05:10 -0700721 main.step( "NOOPTION: Add single point to multi point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700722 stepResult = main.TRUE
723 hostNames = [ 'h8', 'h16', 'h24' ]
724 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
725 'of:0000000000000007/8' ]
726 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700727 stepResult = main.intentFunction.singleToMultiIntent(
728 main,
729 name="NOOPTION",
730 hostNames=hostNames,
731 devices=devices,
732 sw1="s5",
733 sw2="s2",
734 expectedLink=18 )
735
736 utilities.assert_equals( expect=main.TRUE,
737 actual=stepResult,
738 onpass="NOOPTION: Successfully added single "
739 + " point to multi point intents",
740 onfail="NOOPTION: Failed to add single point" +
741 " to multi point intents" )
742
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700743 main.step( "IPV4: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700744 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700745 stepResult = main.intentFunction.singleToMultiIntent(
746 main,
747 name="IPV4",
748 hostNames=hostNames,
749 devices=devices,
750 ports=None,
751 ethType="IPV4",
752 macs=macs,
753 bandwidth="",
754 lambdaAlloc=False,
755 ipProto="",
756 ipAddresses="",
757 tcp="",
758 sw1="s5",
759 sw2="s2",
760 expectedLink=18 )
761
762 utilities.assert_equals( expect=main.TRUE,
763 actual=stepResult,
764 onpass="IPV4: Successfully added single point"
765 + " to multi point intents",
766 onfail="IPV4: Failed to add single point" +
767 " to multi point intents" )
768
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700769 main.step( "IPV4_2: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700770 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700771 hostNames = [ 'h8', 'h16', 'h24' ]
772 stepResult = main.intentFunction.singleToMultiIntent(
773 main,
774 name="IPV4",
775 hostNames=hostNames,
776 ethType="IPV4",
777 lambdaAlloc=False )
778
779 utilities.assert_equals( expect=main.TRUE,
780 actual=stepResult,
781 onpass="IPV4_2: Successfully added single "
782 + " point to multi point intents",
783 onfail="IPV4_2: Failed to add single point" +
784 " to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700785
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700786 main.step( "VLAN: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700787 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700788 hostNames = [ 'h4', 'h12', 'h20' ]
789 devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
790 'of:0000000000000007/4' ]
791 macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
792 stepResult = main.intentFunction.singleToMultiIntent(
793 main,
794 name="VLAN",
795 hostNames=hostNames,
796 devices=devices,
797 ports=None,
798 ethType="IPV4",
799 macs=macs,
800 bandwidth="",
801 lambdaAlloc=False,
802 ipProto="",
803 ipAddresses="",
804 tcp="",
805 sw1="s5",
806 sw2="s2",
807 expectedLink=18 )
808
809 utilities.assert_equals( expect=main.TRUE,
810 actual=stepResult,
811 onpass="VLAN: Successfully added single point"
812 + " to multi point intents",
813 onfail="VLAN: Failed to add single point" +
acsmarse6b410f2015-07-17 14:39:34 -0700814 " to multi point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700815
kelvin-onlabb769f562015-07-15 17:05:10 -0700816 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700817 """
818 Add multi point to single point intents
819 - Get device ids
820 - Add multi point to single point intents
821 - Check intents
822 - Verify flows
823 - Ping hosts
824 - Reroute
825 - Link down
826 - Verify flows
827 - Check topology
828 - Ping hosts
829 - Link up
830 - Verify flows
831 - Check topology
832 - Ping hosts
833 - Remove intents
834 """
835 assert main, "There is no main"
836 assert main.CLIs, "There is no main.CLIs"
837 assert main.Mininet1, "Mininet handle should be named Mininet1"
838 assert main.numSwitch, "Placed the total number of switch topology in \
839 main.numSwitch"
840
841 main.case( "Add multi point to single point intents between devices" )
842
kelvin-onlabb769f562015-07-15 17:05:10 -0700843 main.step( "NOOPTION: Add multi point to single point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700844 stepResult = main.TRUE
845 hostNames = [ 'h8', 'h16', 'h24' ]
846 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
847 'of:0000000000000007/8' ]
848 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700849 stepResult = main.intentFunction.multiToSingleIntent(
850 main,
851 name="NOOPTION",
852 hostNames=hostNames,
853 devices=devices,
854 sw1="s5",
855 sw2="s2",
856 expectedLink=18 )
857
858 utilities.assert_equals( expect=main.TRUE,
859 actual=stepResult,
860 onpass="NOOPTION: Successfully added multi "
861 + " point to single point intents",
862 onfail="NOOPTION: Failed to add multi point" +
863 " to single point intents" )
864
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700865 main.step( "IPV4: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700866 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700867 stepResult = main.intentFunction.multiToSingleIntent(
868 main,
869 name="IPV4",
870 hostNames=hostNames,
871 devices=devices,
872 ports=None,
873 ethType="IPV4",
874 macs=macs,
875 bandwidth="",
876 lambdaAlloc=False,
877 ipProto="",
878 ipAddresses="",
879 tcp="",
880 sw1="s5",
881 sw2="s2",
882 expectedLink=18 )
883
884 utilities.assert_equals( expect=main.TRUE,
885 actual=stepResult,
886 onpass="IPV4: Successfully added multi point"
887 + " to single point intents",
888 onfail="IPV4: Failed to add multi point" +
889 " to single point intents" )
890
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700891 main.step( "IPV4_2: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700892 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700893 hostNames = [ 'h8', 'h16', 'h24' ]
894 stepResult = main.intentFunction.multiToSingleIntent(
895 main,
896 name="IPV4",
897 hostNames=hostNames,
898 ethType="IPV4",
899 lambdaAlloc=False )
900
901 utilities.assert_equals( expect=main.TRUE,
902 actual=stepResult,
903 onpass="IPV4_2: Successfully added multi point"
904 + " to single point intents",
905 onfail="IPV4_2: Failed to add multi point" +
906 " to single point intents" )
907
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700908 main.step( "VLAN: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700909 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700910 hostNames = [ 'h5', 'h13', 'h21' ]
911 devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
912 'of:0000000000000007/5' ]
913 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
914 stepResult = main.intentFunction.multiToSingleIntent(
915 main,
916 name="VLAN",
917 hostNames=hostNames,
918 devices=devices,
919 ports=None,
920 ethType="IPV4",
921 macs=macs,
922 bandwidth="",
923 lambdaAlloc=False,
924 ipProto="",
925 ipAddresses="",
926 tcp="",
927 sw1="s5",
928 sw2="s2",
929 expectedLink=18 )
930
931 utilities.assert_equals( expect=main.TRUE,
932 actual=stepResult,
933 onpass="VLAN: Successfully added multi point"
934 + " to single point intents",
935 onfail="VLAN: Failed to add multi point" +
936 " to single point intents" )