blob: 2c47b4f95435857d1a9dc97592b4fe265909188c [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" )
100
101 def CASE2( self, main ):
102 """
103 - Set up cell
104 - Create cell file
105 - Set cell file
106 - Verify cell file
107 - Kill ONOS process
108 - Uninstall ONOS cluster
109 - Verify ONOS start up
110 - Install ONOS cluster
111 - Connect to cli
112 """
113
114 # main.scale[ 0 ] determines the current number of ONOS controller
115 main.numCtrls = int( main.scale[ 0 ] )
116
117 main.case( "Starting up " + str( main.numCtrls ) +
118 " node(s) ONOS cluster" )
119
120 #kill off all onos processes
121 main.log.info( "Safety check, killing all ONOS processes" +
122 " before initiating enviornment setup" )
123
124 for i in range( main.maxNodes ):
125 main.ONOSbench.onosDie( main.ONOSip[ i ] )
126
127 print "NODE COUNT = ", main.numCtrls
128
129 tempOnosIp = []
130 for i in range( main.numCtrls ):
131 tempOnosIp.append( main.ONOSip[i] )
132
133 main.ONOSbench.createCellFile( main.ONOSbench.ip_address, "temp", main.Mininet1.ip_address, main.apps, tempOnosIp )
134
135 main.step( "Apply cell to environment" )
136 cellResult = main.ONOSbench.setCell( "temp" )
137 verifyResult = main.ONOSbench.verifyCell()
138 stepResult = cellResult and verifyResult
139 utilities.assert_equals( expect=main.TRUE,
140 actual=stepResult,
141 onpass="Successfully applied cell to " + \
142 "environment",
143 onfail="Failed to apply cell to environment " )
144
145 main.step( "Creating ONOS package" )
146 packageResult = main.ONOSbench.onosPackage()
147 stepResult = packageResult
148 utilities.assert_equals( expect=main.TRUE,
149 actual=stepResult,
150 onpass="Successfully created ONOS package",
151 onfail="Failed to create ONOS package" )
152
153 time.sleep( main.startUpSleep )
154 main.step( "Uninstalling ONOS package" )
155 onosUninstallResult = main.TRUE
156 for i in range( main.numCtrls ):
157 onosUninstallResult = onosUninstallResult and \
158 main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
159 stepResult = onosUninstallResult
160 utilities.assert_equals( expect=main.TRUE,
161 actual=stepResult,
162 onpass="Successfully uninstalled ONOS package",
163 onfail="Failed to uninstall ONOS package" )
164
165 time.sleep( main.startUpSleep )
166 main.step( "Installing ONOS package" )
167 onosInstallResult = main.TRUE
168 for i in range( main.numCtrls ):
169 onosInstallResult = onosInstallResult and \
170 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
171 stepResult = onosInstallResult
172 utilities.assert_equals( expect=main.TRUE,
173 actual=stepResult,
174 onpass="Successfully installed ONOS package",
175 onfail="Failed to install ONOS package" )
176
177 time.sleep( main.startUpSleep )
178 main.step( "Starting ONOS service" )
179 stopResult = main.TRUE
180 startResult = main.TRUE
181 onosIsUp = main.TRUE
182
183 for i in range( main.numCtrls ):
184 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
185 if onosIsUp == main.TRUE:
186 main.log.report( "ONOS instance is up and ready" )
187 else:
188 main.log.report( "ONOS instance may not be up, stop and " +
189 "start ONOS again " )
190 for i in range( main.numCtrls ):
191 stopResult = stopResult and \
192 main.ONOSbench.onosStop( main.ONOSip[ i ] )
193 for i in range( main.numCtrls ):
194 startResult = startResult and \
195 main.ONOSbench.onosStart( main.ONOSip[ i ] )
196 stepResult = onosIsUp and stopResult and startResult
197 utilities.assert_equals( expect=main.TRUE,
198 actual=stepResult,
199 onpass="ONOS service is ready",
200 onfail="ONOS service did not start properly" )
201
202 main.step( "Start ONOS cli" )
203 cliResult = main.TRUE
204 for i in range( main.numCtrls ):
205 cliResult = cliResult and \
206 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
207 stepResult = cliResult
208 utilities.assert_equals( expect=main.TRUE,
209 actual=stepResult,
210 onpass="Successfully start ONOS cli",
211 onfail="Failed to start ONOS cli" )
212
213 # Remove the first element in main.scale list
214 main.scale.remove( main.scale[ 0 ] )
215
216 def CASE9( self, main ):
217 '''
218 Report errors/warnings/exceptions
219 '''
220 main.log.info( "Error report: \n" )
221 main.ONOSbench.logReport( globalONOSip[0],
222 [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
223 "s" )
224 #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
225
226 def CASE11( self, main ):
227 """
228 Start mininet
229 """
230 main.log.report( "Start Mininet topology" )
231 main.log.case( "Start Mininet topology" )
232
233 main.step( "Starting Mininet Topology" )
234 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
235 main.topology )
236 stepResult = topoResult
237 utilities.assert_equals( expect=main.TRUE,
238 actual=stepResult,
239 onpass="Successfully loaded topology",
240 onfail="Failed to load topology" )
241 # Exit if topology did not load properly
242 if not topoResult:
243 main.cleanup()
244 main.exit()
245
246 def CASE12( self, main ):
247 """
248 Assign mastership to controllers
249 """
250 import re
251
252 main.case( "Assign switches to controllers" )
253 main.step( "Assigning switches to controllers" )
254 assignResult = main.TRUE
255 switchList = []
256
257 # Creates a list switch name, use getSwitch() function later...
258 for i in range( 1, ( main.numSwitch + 1 ) ):
259 switchList.append( 's' + str( i ) )
260
261 tempONOSip = []
262 for i in range( main.numCtrls ):
263 tempONOSip.append( main.ONOSip[ i ] )
264
265 assignResult = main.Mininet1.assignSwController( sw=switchList,
266 ip=tempONOSip,
267 port='6633' )
268 if not assignResult:
269 main.cleanup()
270 main.exit()
271
272 for i in range( 1, ( main.numSwitch + 1 ) ):
273 response = main.Mininet1.getSwController( "s" + str( i ) )
274 print( "Response is " + str( response ) )
275 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
276 assignResult = assignResult and main.TRUE
277 else:
278 assignResult = main.FALSE
279 stepResult = assignResult
280 utilities.assert_equals( expect=main.TRUE,
281 actual=stepResult,
282 onpass="Successfully assigned switches" +
283 "to controller",
284 onfail="Failed to assign switches to " +
285 "controller" )
286 def CASE13( self, main ):
287 """
288 Discover all hosts and store its data to a dictionary
289 """
290 main.case( "Discover all hosts" )
291
292 stepResult = main.TRUE
293 main.step( "Discover all hosts using pingall " )
294 stepResult = main.intentFunction.getHostsData( main )
295 utilities.assert_equals( expect=main.TRUE,
296 actual=stepResult,
297 onpass="Successfully discovered hosts",
298 onfail="Failed to discover hosts" )
299
300 def CASE14( self, main ):
301 """
302 Stop mininet
303 """
304 main.log.report( "Stop Mininet topology" )
305 main.log.case( "Stop Mininet topology" )
306
307 main.step( "Stopping Mininet Topology" )
308 topoResult = main.Mininet1.stopNet( )
309 stepResult = topoResult
310 utilities.assert_equals( expect=main.TRUE,
311 actual=stepResult,
312 onpass="Successfully stop mininet",
313 onfail="Failed to stop mininet" )
314 # Exit if topology did not load properly
315 if not topoResult:
316 main.cleanup()
317 main.exit()
318
kelvin-onlabb769f562015-07-15 17:05:10 -0700319 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700320 """
321 Add host intents between 2 host:
322 - Discover hosts
323 - Add host intents
324 - Check intents
325 - Verify flows
326 - Ping hosts
327 - Reroute
328 - Link down
329 - Verify flows
330 - Check topology
331 - Ping hosts
332 - Link up
333 - Verify flows
334 - Check topology
335 - Ping hosts
336 - Remove intents
337 """
338 import time
339 import json
340 import re
341
342 # Assert variables - These variable's name|format must be followed
343 # if you want to use the wrapper function
344 assert main, "There is no main"
345 assert main.CLIs, "There is no main.CLIs"
346 assert main.Mininet1, "Mininet handle should be named Mininet1"
347 assert main.numSwitch, "Placed the total number of switch topology in \
348 main.numSwitch"
349
acsmarse6b410f2015-07-17 14:39:34 -0700350 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
351
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700352 main.case( "Add host intents between 2 host" )
353
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700354 main.step( "IPV4: Add host intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700355 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700356 stepResult = main.intentFunction.hostIntent( main,
357 onosNode='0',
358 name='IPV4',
359 host1='h1',
360 host2='h9',
361 host1Id='00:00:00:00:00:01/-1',
362 host2Id='00:00:00:00:00:09/-1',
363 sw1='s5',
364 sw2='s2',
365 expectedLink=18 )
366
367 utilities.assert_equals( expect=main.TRUE,
368 actual=stepResult,
369 onpass="IPV4: Add host intent successful",
370 onfail="IPV4: Add host intent failed" )
371
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700372 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700373 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700374 stepResult = main.intentFunction.hostIntent( main,
375 name='DUALSTACK',
376 host1='h3',
377 host2='h11',
378 host1Id='00:00:00:00:00:03/-1',
379 host2Id='00:00:00:00:00:0B/-1',
380 sw1='s5',
381 sw2='s2',
382 expectedLink=18 )
383
384 utilities.assert_equals( expect=main.TRUE,
385 actual=stepResult,
386 onpass="DUALSTACK1: Add host intent" +
387 " successful",
388 onfail="DUALSTACK1: Add host intent failed" )
389
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700390 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700391 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700392 stepResult = main.intentFunction.hostIntent( main,
393 name='DUALSTACK2',
394 host1='h1',
395 host2='h11',
396 sw1='s5',
397 sw2='s2',
398 expectedLink=18 )
399
400 utilities.assert_equals( expect=main.TRUE,
401 actual=stepResult,
402 onpass="DUALSTACK2: Add host intent" +
403 " successful",
404 onfail="DUALSTACK2: Add host intent failed" )
405
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700406 main.step( "1HOP: Add host intents between h1 and h3" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700407 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700408 stepResult = main.intentFunction.hostIntent( main,
409 name='1HOP',
410 host1='h1',
411 host2='h3' )
412
413 utilities.assert_equals( expect=main.TRUE,
414 actual=stepResult,
415 onpass="1HOP: Add host intent" +
416 " successful",
417 onfail="1HOP: Add host intent failed" )
418
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700419 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700420 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700421 stepResult = main.intentFunction.hostIntent( main,
422 name='VLAN1',
423 host1='h4',
424 host2='h12',
425 host1Id='00:00:00:00:00:04/100',
426 host2Id='00:00:00:00:00:0C/100',
427 sw1='s5',
428 sw2='s2',
429 expectedLink=18 )
430
431 utilities.assert_equals( expect=main.TRUE,
432 actual=stepResult,
433 onpass="VLAN1: Add vlan host" +
434 " intent successful",
435 onfail="VLAN1: Add vlan host intent failed" )
436
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700437 main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700438 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700439 stepResult = main.intentFunction.hostIntent( main,
440 name='VLAN2',
441 host1='h13',
442 host2='h20' )
443
444 utilities.assert_equals( expect=main.FALSE,
445 actual=stepResult,
446 onpass="VLAN2: Add inter vlan host" +
447 " intent successful",
448 onfail="VLAN2: Add inter vlan host" +
449 " intent failed" )
450
acsmarse6b410f2015-07-17 14:39:34 -0700451
452 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
453 main.intentFunction.checkLeaderChange( intentLeadersOld,
454 intentLeadersNew )
455
kelvin-onlabb769f562015-07-15 17:05:10 -0700456 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700457 """
458 Add point intents between 2 hosts:
459 - Get device ids | ports
460 - Add point intents
461 - Check intents
462 - Verify flows
463 - Ping hosts
464 - Reroute
465 - Link down
466 - Verify flows
467 - Check topology
468 - Ping hosts
469 - Link up
470 - Verify flows
471 - Check topology
472 - Ping hosts
473 - Remove intents
474 """
475 import time
476 import json
477 import re
478
479 # Assert variables - These variable's name|format must be followed
480 # if you want to use the wrapper function
481 assert main, "There is no main"
482 assert main.CLIs, "There is no main.CLIs"
483 assert main.Mininet1, "Mininet handle should be named Mininet1"
484 assert main.numSwitch, "Placed the total number of switch topology in \
485 main.numSwitch"
486
487 main.case( "Add point intents between 2 devices" )
488
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700489 # No option point intents
490 main.step( "NOOPTION: Add point intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700491 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700492 stepResult = main.intentFunction.pointIntent(
493 main,
494 name="NOOPTION",
495 host1="h1",
496 host2="h9",
497 deviceId1="of:0000000000000005/1",
498 deviceId2="of:0000000000000006/1",
499 sw1="s5",
500 sw2="s2",
501 expectedLink=18 )
502
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700503 utilities.assert_equals( expect=main.TRUE,
504 actual=stepResult,
505 onpass="NOOPTION: Add point intent successful",
506 onfail="NOOPTION: Add point intent failed" )
507
508 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700509 main.step( "IPV4: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700510 stepResult = main.intentFunction.pointIntent(
511 main,
512 name="IPV4",
513 host1="h1",
514 host2="h9",
515 deviceId1="of:0000000000000005/1",
516 deviceId2="of:0000000000000006/1",
517 port1="",
518 port2="",
519 ethType="IPV4",
520 mac1="00:00:00:00:00:01",
521 mac2="00:00:00:00:00:09",
522 bandwidth="",
523 lambdaAlloc=False,
524 ipProto="",
525 ip1="",
526 ip2="",
527 tcp1="",
528 tcp2="",
529 sw1="s5",
530 sw2="s2",
531 expectedLink=18 )
532
533 utilities.assert_equals( expect=main.TRUE,
534 actual=stepResult,
535 onpass="IPV4: Add point intent successful",
536 onfail="IPV4: Add point intent failed" )
537
kelvin-onlabb769f562015-07-15 17:05:10 -0700538 main.step( "IPV4_2: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700539 stepResult = main.TRUE
540 stepResult = main.intentFunction.pointIntent(
541 main,
542 name="IPV4_2",
543 host1="h1",
544 host2="h9",
545 deviceId1="of:0000000000000005/1",
546 deviceId2="of:0000000000000006/1",
kelvin-onlabb769f562015-07-15 17:05:10 -0700547 ipProto="",
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700548 ip1="",
549 ip2="",
550 tcp1="",
551 tcp2="",
552 sw1="s5",
553 sw2="s2",
554 expectedLink=18 )
555
556 utilities.assert_equals( expect=main.TRUE,
557 actual=stepResult,
558 onpass="IPV4_2: Add point intent successful",
559 onfail="IPV4_2: Add point intent failed" )
560
kelvin-onlabb769f562015-07-15 17:05:10 -0700561 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700562 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700563 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
564 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
565 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
566 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
567 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
568 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
569 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
570
571 stepResult = main.intentFunction.pointIntent(
572 main,
573 name="SDNIP-TCP",
574 host1="h1",
575 host2="h9",
576 deviceId1="of:0000000000000005/1",
577 deviceId2="of:0000000000000006/1",
578 mac1=mac1,
579 mac2=mac2,
580 ethType="IPV4",
581 ipProto=ipProto,
582 ip1=ip1,
583 ip2=ip2,
584 tcp1=tcp1,
585 tcp2=tcp2 )
586
587 utilities.assert_equals( expect=main.TRUE,
588 actual=stepResult,
589 onpass="SDNIP-TCP: Add point intent successful",
590 onfail="SDNIP-TCP: Add point intent failed" )
591
592 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
593 stepResult = main.TRUE
594 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
595 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
596 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
597 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
598 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
599 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
600 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
601
602 stepResult = main.intentFunction.pointIntent(
603 main,
604 name="SDNIP-ICMP",
605 host1="h1",
606 host2="h9",
607 deviceId1="of:0000000000000005/1",
608 deviceId2="of:0000000000000006/1",
609 mac1=mac1,
610 mac2=mac2,
611 ethType="IPV4",
612 ipProto=ipProto )
613
614 utilities.assert_equals( expect=main.TRUE,
615 actual=stepResult,
616 onpass="SDNIP-ICMP: Add point intent successful",
617 onfail="SDNIP-ICMP: Add point intent failed" )
618
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700619 main.step( "DUALSTACK1: Add point intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700620 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700621 stepResult = main.intentFunction.pointIntent(
622 main,
623 name="DUALSTACK1",
624 host1="h3",
625 host2="h11",
626 deviceId1="of:0000000000000005",
627 deviceId2="of:0000000000000006",
628 port1="3",
629 port2="3",
630 ethType="IPV4",
631 mac1="00:00:00:00:00:03",
632 mac2="00:00:00:00:00:0B",
633 bandwidth="",
634 lambdaAlloc=False,
635 ipProto="",
636 ip1="",
637 ip2="",
638 tcp1="",
639 tcp2="",
640 sw1="s5",
641 sw2="s2",
642 expectedLink=18 )
643
644 utilities.assert_equals( expect=main.TRUE,
645 actual=stepResult,
646 onpass="DUALSTACK1: Add point intent" +
647 " successful",
acsmarse6b410f2015-07-17 14:39:34 -0700648 onfail="DUALSTACK1: Add point intent failed" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700649
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700650 main.step( "VLAN: Add point intents between h5 and h21" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700651 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700652 stepResult = main.intentFunction.pointIntent(
653 main,
654 name="VLAN",
655 host1="h5",
656 host2="h21",
657 deviceId1="of:0000000000000005/5",
658 deviceId2="of:0000000000000007/5",
659 port1="",
660 port2="",
661 ethType="IPV4",
662 mac1="00:00:00:00:00:05",
663 mac2="00:00:00:00:00:15",
664 bandwidth="",
665 lambdaAlloc=False,
666 ipProto="",
667 ip1="",
668 ip2="",
669 tcp1="",
670 tcp2="",
671 sw1="s5",
672 sw2="s2",
673 expectedLink=18 )
674
675 utilities.assert_equals( expect=main.TRUE,
676 actual=stepResult,
677 onpass="VLAN: Add point intent successful",
678 onfail="VLAN: Add point intent failed" )
679
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700680 main.step( "1HOP: Add point intents between h1 and h3" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700681 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700682 stepResult = main.intentFunction.hostIntent( main,
683 name='1HOP',
684 host1='h1',
685 host2='h3' )
686
687 utilities.assert_equals( expect=main.TRUE,
688 actual=stepResult,
689 onpass="1HOP: Add point intent" +
690 " successful",
691 onfail="1HOP: Add point intent failed" )
692
kelvin-onlabb769f562015-07-15 17:05:10 -0700693 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700694 """
695 Add single point to multi point intents
696 - Get device ids
697 - Add single point to multi point intents
698 - Check intents
699 - Verify flows
700 - Ping hosts
701 - Reroute
702 - Link down
703 - Verify flows
704 - Check topology
705 - Ping hosts
706 - Link up
707 - Verify flows
708 - Check topology
709 - Ping hosts
710 - Remove intents
711 """
712 assert main, "There is no main"
713 assert main.CLIs, "There is no main.CLIs"
714 assert main.Mininet1, "Mininet handle should be named Mininet1"
715 assert main.numSwitch, "Placed the total number of switch topology in \
716 main.numSwitch"
717
718 main.case( "Add single point to multi point intents between devices" )
719
kelvin-onlabb769f562015-07-15 17:05:10 -0700720 main.step( "NOOPTION: Add single point to multi point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700721 stepResult = main.TRUE
722 hostNames = [ 'h8', 'h16', 'h24' ]
723 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
724 'of:0000000000000007/8' ]
725 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 -0700726 stepResult = main.intentFunction.singleToMultiIntent(
727 main,
728 name="NOOPTION",
729 hostNames=hostNames,
730 devices=devices,
731 sw1="s5",
732 sw2="s2",
733 expectedLink=18 )
734
735 utilities.assert_equals( expect=main.TRUE,
736 actual=stepResult,
737 onpass="NOOPTION: Successfully added single "
738 + " point to multi point intents",
739 onfail="NOOPTION: Failed to add single point" +
740 " to multi point intents" )
741
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700742 main.step( "IPV4: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700743 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700744 stepResult = main.intentFunction.singleToMultiIntent(
745 main,
746 name="IPV4",
747 hostNames=hostNames,
748 devices=devices,
749 ports=None,
750 ethType="IPV4",
751 macs=macs,
752 bandwidth="",
753 lambdaAlloc=False,
754 ipProto="",
755 ipAddresses="",
756 tcp="",
757 sw1="s5",
758 sw2="s2",
759 expectedLink=18 )
760
761 utilities.assert_equals( expect=main.TRUE,
762 actual=stepResult,
763 onpass="IPV4: Successfully added single point"
764 + " to multi point intents",
765 onfail="IPV4: Failed to add single point" +
766 " to multi point intents" )
767
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700768 main.step( "IPV4_2: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700769 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700770 hostNames = [ 'h8', 'h16', 'h24' ]
771 stepResult = main.intentFunction.singleToMultiIntent(
772 main,
773 name="IPV4",
774 hostNames=hostNames,
775 ethType="IPV4",
776 lambdaAlloc=False )
777
778 utilities.assert_equals( expect=main.TRUE,
779 actual=stepResult,
780 onpass="IPV4_2: Successfully added single "
781 + " point to multi point intents",
782 onfail="IPV4_2: Failed to add single point" +
783 " to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700784
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700785 main.step( "VLAN: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700786 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700787 hostNames = [ 'h4', 'h12', 'h20' ]
788 devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
789 'of:0000000000000007/4' ]
790 macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
791 stepResult = main.intentFunction.singleToMultiIntent(
792 main,
793 name="VLAN",
794 hostNames=hostNames,
795 devices=devices,
796 ports=None,
797 ethType="IPV4",
798 macs=macs,
799 bandwidth="",
800 lambdaAlloc=False,
801 ipProto="",
802 ipAddresses="",
803 tcp="",
804 sw1="s5",
805 sw2="s2",
806 expectedLink=18 )
807
808 utilities.assert_equals( expect=main.TRUE,
809 actual=stepResult,
810 onpass="VLAN: Successfully added single point"
811 + " to multi point intents",
812 onfail="VLAN: Failed to add single point" +
acsmarse6b410f2015-07-17 14:39:34 -0700813 " to multi point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700814
kelvin-onlabb769f562015-07-15 17:05:10 -0700815 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700816 """
817 Add multi point to single point intents
818 - Get device ids
819 - Add multi point to single point intents
820 - Check intents
821 - Verify flows
822 - Ping hosts
823 - Reroute
824 - Link down
825 - Verify flows
826 - Check topology
827 - Ping hosts
828 - Link up
829 - Verify flows
830 - Check topology
831 - Ping hosts
832 - Remove intents
833 """
834 assert main, "There is no main"
835 assert main.CLIs, "There is no main.CLIs"
836 assert main.Mininet1, "Mininet handle should be named Mininet1"
837 assert main.numSwitch, "Placed the total number of switch topology in \
838 main.numSwitch"
839
840 main.case( "Add multi point to single point intents between devices" )
841
kelvin-onlabb769f562015-07-15 17:05:10 -0700842 main.step( "NOOPTION: Add multi point to single point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700843 stepResult = main.TRUE
844 hostNames = [ 'h8', 'h16', 'h24' ]
845 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
846 'of:0000000000000007/8' ]
847 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 -0700848 stepResult = main.intentFunction.multiToSingleIntent(
849 main,
850 name="NOOPTION",
851 hostNames=hostNames,
852 devices=devices,
853 sw1="s5",
854 sw2="s2",
855 expectedLink=18 )
856
857 utilities.assert_equals( expect=main.TRUE,
858 actual=stepResult,
859 onpass="NOOPTION: Successfully added multi "
860 + " point to single point intents",
861 onfail="NOOPTION: Failed to add multi point" +
862 " to single point intents" )
863
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700864 main.step( "IPV4: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700865 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700866 stepResult = main.intentFunction.multiToSingleIntent(
867 main,
868 name="IPV4",
869 hostNames=hostNames,
870 devices=devices,
871 ports=None,
872 ethType="IPV4",
873 macs=macs,
874 bandwidth="",
875 lambdaAlloc=False,
876 ipProto="",
877 ipAddresses="",
878 tcp="",
879 sw1="s5",
880 sw2="s2",
881 expectedLink=18 )
882
883 utilities.assert_equals( expect=main.TRUE,
884 actual=stepResult,
885 onpass="IPV4: Successfully added multi point"
886 + " to single point intents",
887 onfail="IPV4: Failed to add multi point" +
888 " to single point intents" )
889
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700890 main.step( "IPV4_2: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700891 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700892 hostNames = [ 'h8', 'h16', 'h24' ]
893 stepResult = main.intentFunction.multiToSingleIntent(
894 main,
895 name="IPV4",
896 hostNames=hostNames,
897 ethType="IPV4",
898 lambdaAlloc=False )
899
900 utilities.assert_equals( expect=main.TRUE,
901 actual=stepResult,
902 onpass="IPV4_2: Successfully added multi point"
903 + " to single point intents",
904 onfail="IPV4_2: Failed to add multi point" +
905 " to single point intents" )
906
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700907 main.step( "VLAN: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700908 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700909 hostNames = [ 'h5', 'h13', 'h21' ]
910 devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
911 'of:0000000000000007/5' ]
912 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
913 stepResult = main.intentFunction.multiToSingleIntent(
914 main,
915 name="VLAN",
916 hostNames=hostNames,
917 devices=devices,
918 ports=None,
919 ethType="IPV4",
920 macs=macs,
921 bandwidth="",
922 lambdaAlloc=False,
923 ipProto="",
924 ipAddresses="",
925 tcp="",
926 sw1="s5",
927 sw2="s2",
928 expectedLink=18 )
929
930 utilities.assert_equals( expect=main.TRUE,
931 actual=stepResult,
932 onpass="VLAN: Successfully added multi point"
933 + " to single point intents",
934 onfail="VLAN: Failed to add multi point" +
935 " to single point intents" )