blob: 0a8092f5fac1e9368392a6d655f10a87b8adb24a [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
319 def CASE1001( self, main ):
320 """
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
350 main.case( "Add host intents between 2 host" )
351
352 stepResult = main.TRUE
353 main.step( "IPV4: Add host intents between h1 and h9" )
354 stepResult = main.intentFunction.hostIntent( main,
355 onosNode='0',
356 name='IPV4',
357 host1='h1',
358 host2='h9',
359 host1Id='00:00:00:00:00:01/-1',
360 host2Id='00:00:00:00:00:09/-1',
361 sw1='s5',
362 sw2='s2',
363 expectedLink=18 )
364
365 utilities.assert_equals( expect=main.TRUE,
366 actual=stepResult,
367 onpass="IPV4: Add host intent successful",
368 onfail="IPV4: Add host intent failed" )
369
370 stepResult = main.TRUE
371 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
372 stepResult = main.intentFunction.hostIntent( main,
373 name='DUALSTACK',
374 host1='h3',
375 host2='h11',
376 host1Id='00:00:00:00:00:03/-1',
377 host2Id='00:00:00:00:00:0B/-1',
378 sw1='s5',
379 sw2='s2',
380 expectedLink=18 )
381
382 utilities.assert_equals( expect=main.TRUE,
383 actual=stepResult,
384 onpass="DUALSTACK1: Add host intent" +
385 " successful",
386 onfail="DUALSTACK1: Add host intent failed" )
387
388 stepResult = main.TRUE
389 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
390 stepResult = main.intentFunction.hostIntent( main,
391 name='DUALSTACK2',
392 host1='h1',
393 host2='h11',
394 sw1='s5',
395 sw2='s2',
396 expectedLink=18 )
397
398 utilities.assert_equals( expect=main.TRUE,
399 actual=stepResult,
400 onpass="DUALSTACK2: Add host intent" +
401 " successful",
402 onfail="DUALSTACK2: Add host intent failed" )
403
404 stepResult = main.TRUE
405 main.step( "1HOP: Add host intents between h1 and h3" )
406 stepResult = main.intentFunction.hostIntent( main,
407 name='1HOP',
408 host1='h1',
409 host2='h3' )
410
411 utilities.assert_equals( expect=main.TRUE,
412 actual=stepResult,
413 onpass="1HOP: Add host intent" +
414 " successful",
415 onfail="1HOP: Add host intent failed" )
416
417 stepResult = main.TRUE
418 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
419 stepResult = main.intentFunction.hostIntent( main,
420 name='VLAN1',
421 host1='h4',
422 host2='h12',
423 host1Id='00:00:00:00:00:04/100',
424 host2Id='00:00:00:00:00:0C/100',
425 sw1='s5',
426 sw2='s2',
427 expectedLink=18 )
428
429 utilities.assert_equals( expect=main.TRUE,
430 actual=stepResult,
431 onpass="VLAN1: Add vlan host" +
432 " intent successful",
433 onfail="VLAN1: Add vlan host intent failed" )
434
435 stepResult = main.TRUE
436 main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
437 stepResult = main.intentFunction.hostIntent( main,
438 name='VLAN2',
439 host1='h13',
440 host2='h20' )
441
442 utilities.assert_equals( expect=main.FALSE,
443 actual=stepResult,
444 onpass="VLAN2: Add inter vlan host" +
445 " intent successful",
446 onfail="VLAN2: Add inter vlan host" +
447 " intent failed" )
448
449 def CASE1002( self, main ):
450 """
451 Add point intents between 2 hosts:
452 - Get device ids | ports
453 - Add point intents
454 - Check intents
455 - Verify flows
456 - Ping hosts
457 - Reroute
458 - Link down
459 - Verify flows
460 - Check topology
461 - Ping hosts
462 - Link up
463 - Verify flows
464 - Check topology
465 - Ping hosts
466 - Remove intents
467 """
468 import time
469 import json
470 import re
471
472 # Assert variables - These variable's name|format must be followed
473 # if you want to use the wrapper function
474 assert main, "There is no main"
475 assert main.CLIs, "There is no main.CLIs"
476 assert main.Mininet1, "Mininet handle should be named Mininet1"
477 assert main.numSwitch, "Placed the total number of switch topology in \
478 main.numSwitch"
479
480 main.case( "Add point intents between 2 devices" )
481
482 stepResult = main.TRUE
483 # No option point intents
484 main.step( "NOOPTION: Add point intents between h1 and h9" )
485 stepResult = main.intentFunction.pointIntent(
486 main,
487 name="NOOPTION",
488 host1="h1",
489 host2="h9",
490 deviceId1="of:0000000000000005/1",
491 deviceId2="of:0000000000000006/1",
492 sw1="s5",
493 sw2="s2",
494 expectedLink=18 )
495
496 stepResult = main.TRUE
497 utilities.assert_equals( expect=main.TRUE,
498 actual=stepResult,
499 onpass="NOOPTION: Add point intent successful",
500 onfail="NOOPTION: Add point intent failed" )
501
502 stepResult = main.TRUE
503 stepResult = main.intentFunction.pointIntent(
504 main,
505 name="IPV4",
506 host1="h1",
507 host2="h9",
508 deviceId1="of:0000000000000005/1",
509 deviceId2="of:0000000000000006/1",
510 port1="",
511 port2="",
512 ethType="IPV4",
513 mac1="00:00:00:00:00:01",
514 mac2="00:00:00:00:00:09",
515 bandwidth="",
516 lambdaAlloc=False,
517 ipProto="",
518 ip1="",
519 ip2="",
520 tcp1="",
521 tcp2="",
522 sw1="s5",
523 sw2="s2",
524 expectedLink=18 )
525
526 utilities.assert_equals( expect=main.TRUE,
527 actual=stepResult,
528 onpass="IPV4: Add point intent successful",
529 onfail="IPV4: Add point intent failed" )
530
531 stepResult = main.TRUE
532 stepResult = main.intentFunction.pointIntent(
533 main,
534 name="IPV4_2",
535 host1="h1",
536 host2="h9",
537 deviceId1="of:0000000000000005/1",
538 deviceId2="of:0000000000000006/1",
539 ipProto=1,
540 ip1="",
541 ip2="",
542 tcp1="",
543 tcp2="",
544 sw1="s5",
545 sw2="s2",
546 expectedLink=18 )
547
548 utilities.assert_equals( expect=main.TRUE,
549 actual=stepResult,
550 onpass="IPV4_2: Add point intent successful",
551 onfail="IPV4_2: Add point intent failed" )
552
553 stepResult = main.TRUE
554 main.step( "DUALSTACK1: Add point intents between h1 and h9" )
555 stepResult = main.intentFunction.pointIntent(
556 main,
557 name="DUALSTACK1",
558 host1="h3",
559 host2="h11",
560 deviceId1="of:0000000000000005",
561 deviceId2="of:0000000000000006",
562 port1="3",
563 port2="3",
564 ethType="IPV4",
565 mac1="00:00:00:00:00:03",
566 mac2="00:00:00:00:00:0B",
567 bandwidth="",
568 lambdaAlloc=False,
569 ipProto="",
570 ip1="",
571 ip2="",
572 tcp1="",
573 tcp2="",
574 sw1="s5",
575 sw2="s2",
576 expectedLink=18 )
577
578 utilities.assert_equals( expect=main.TRUE,
579 actual=stepResult,
580 onpass="DUALSTACK1: Add point intent" +
581 " successful",
582 onfail="DUALSTACK1: Add point intent failed" )
583 stepResult = main.TRUE
584 main.step( "VLAN: Add point intents between h5 and h21" )
585 stepResult = main.intentFunction.pointIntent(
586 main,
587 name="VLAN",
588 host1="h5",
589 host2="h21",
590 deviceId1="of:0000000000000005/5",
591 deviceId2="of:0000000000000007/5",
592 port1="",
593 port2="",
594 ethType="IPV4",
595 mac1="00:00:00:00:00:05",
596 mac2="00:00:00:00:00:15",
597 bandwidth="",
598 lambdaAlloc=False,
599 ipProto="",
600 ip1="",
601 ip2="",
602 tcp1="",
603 tcp2="",
604 sw1="s5",
605 sw2="s2",
606 expectedLink=18 )
607
608 utilities.assert_equals( expect=main.TRUE,
609 actual=stepResult,
610 onpass="VLAN: Add point intent successful",
611 onfail="VLAN: Add point intent failed" )
612
613 stepResult = main.TRUE
614 main.step( "1HOP: Add point intents between h1 and h3" )
615 stepResult = main.intentFunction.hostIntent( main,
616 name='1HOP',
617 host1='h1',
618 host2='h3' )
619
620 utilities.assert_equals( expect=main.TRUE,
621 actual=stepResult,
622 onpass="1HOP: Add point intent" +
623 " successful",
624 onfail="1HOP: Add point intent failed" )
625
626 def CASE1003( self, main ):
627 """
628 Add single point to multi point intents
629 - Get device ids
630 - Add single point to multi point intents
631 - Check intents
632 - Verify flows
633 - Ping hosts
634 - Reroute
635 - Link down
636 - Verify flows
637 - Check topology
638 - Ping hosts
639 - Link up
640 - Verify flows
641 - Check topology
642 - Ping hosts
643 - Remove intents
644 """
645 assert main, "There is no main"
646 assert main.CLIs, "There is no main.CLIs"
647 assert main.Mininet1, "Mininet handle should be named Mininet1"
648 assert main.numSwitch, "Placed the total number of switch topology in \
649 main.numSwitch"
650
651 main.case( "Add single point to multi point intents between devices" )
652
653 stepResult = main.TRUE
654 hostNames = [ 'h8', 'h16', 'h24' ]
655 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
656 'of:0000000000000007/8' ]
657 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
658
659 main.step( "NOOPTION: Add single point to multi point intents" )
660 stepResult = main.intentFunction.singleToMultiIntent(
661 main,
662 name="NOOPTION",
663 hostNames=hostNames,
664 devices=devices,
665 sw1="s5",
666 sw2="s2",
667 expectedLink=18 )
668
669 utilities.assert_equals( expect=main.TRUE,
670 actual=stepResult,
671 onpass="NOOPTION: Successfully added single "
672 + " point to multi point intents",
673 onfail="NOOPTION: Failed to add single point" +
674 " to multi point intents" )
675
676 stepResult = main.TRUE
677 main.step( "IPV4: Add single point to multi point intents" )
678 stepResult = main.intentFunction.singleToMultiIntent(
679 main,
680 name="IPV4",
681 hostNames=hostNames,
682 devices=devices,
683 ports=None,
684 ethType="IPV4",
685 macs=macs,
686 bandwidth="",
687 lambdaAlloc=False,
688 ipProto="",
689 ipAddresses="",
690 tcp="",
691 sw1="s5",
692 sw2="s2",
693 expectedLink=18 )
694
695 utilities.assert_equals( expect=main.TRUE,
696 actual=stepResult,
697 onpass="IPV4: Successfully added single point"
698 + " to multi point intents",
699 onfail="IPV4: Failed to add single point" +
700 " to multi point intents" )
701
702 stepResult = main.TRUE
703 main.step( "IPV4_2: Add single point to multi point intents" )
704 hostNames = [ 'h8', 'h16', 'h24' ]
705 stepResult = main.intentFunction.singleToMultiIntent(
706 main,
707 name="IPV4",
708 hostNames=hostNames,
709 ethType="IPV4",
710 lambdaAlloc=False )
711
712 utilities.assert_equals( expect=main.TRUE,
713 actual=stepResult,
714 onpass="IPV4_2: Successfully added single "
715 + " point to multi point intents",
716 onfail="IPV4_2: Failed to add single point" +
717 " to multi point intents" )
718 stepResult = main.TRUE
719 main.step( "VLAN: Add single point to multi point intents" )
720 hostNames = [ 'h4', 'h12', 'h20' ]
721 devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
722 'of:0000000000000007/4' ]
723 macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
724 stepResult = main.intentFunction.singleToMultiIntent(
725 main,
726 name="VLAN",
727 hostNames=hostNames,
728 devices=devices,
729 ports=None,
730 ethType="IPV4",
731 macs=macs,
732 bandwidth="",
733 lambdaAlloc=False,
734 ipProto="",
735 ipAddresses="",
736 tcp="",
737 sw1="s5",
738 sw2="s2",
739 expectedLink=18 )
740
741 utilities.assert_equals( expect=main.TRUE,
742 actual=stepResult,
743 onpass="VLAN: Successfully added single point"
744 + " to multi point intents",
745 onfail="VLAN: Failed to add single point" +
746 " to multi point intents" )
747
748 def CASE1004( self, main ):
749 """
750 Add multi point to single point intents
751 - Get device ids
752 - Add multi point to single point intents
753 - Check intents
754 - Verify flows
755 - Ping hosts
756 - Reroute
757 - Link down
758 - Verify flows
759 - Check topology
760 - Ping hosts
761 - Link up
762 - Verify flows
763 - Check topology
764 - Ping hosts
765 - Remove intents
766 """
767 assert main, "There is no main"
768 assert main.CLIs, "There is no main.CLIs"
769 assert main.Mininet1, "Mininet handle should be named Mininet1"
770 assert main.numSwitch, "Placed the total number of switch topology in \
771 main.numSwitch"
772
773 main.case( "Add multi point to single point intents between devices" )
774
775 stepResult = main.TRUE
776 hostNames = [ 'h8', 'h16', 'h24' ]
777 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
778 'of:0000000000000007/8' ]
779 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
780
781 main.step( "NOOPTION: Add multi point to single point intents" )
782 stepResult = main.intentFunction.multiToSingleIntent(
783 main,
784 name="NOOPTION",
785 hostNames=hostNames,
786 devices=devices,
787 sw1="s5",
788 sw2="s2",
789 expectedLink=18 )
790
791 utilities.assert_equals( expect=main.TRUE,
792 actual=stepResult,
793 onpass="NOOPTION: Successfully added multi "
794 + " point to single point intents",
795 onfail="NOOPTION: Failed to add multi point" +
796 " to single point intents" )
797
798 stepResult = main.TRUE
799 main.step( "IPV4: Add multi point to single point intents" )
800 stepResult = main.intentFunction.multiToSingleIntent(
801 main,
802 name="IPV4",
803 hostNames=hostNames,
804 devices=devices,
805 ports=None,
806 ethType="IPV4",
807 macs=macs,
808 bandwidth="",
809 lambdaAlloc=False,
810 ipProto="",
811 ipAddresses="",
812 tcp="",
813 sw1="s5",
814 sw2="s2",
815 expectedLink=18 )
816
817 utilities.assert_equals( expect=main.TRUE,
818 actual=stepResult,
819 onpass="IPV4: Successfully added multi point"
820 + " to single point intents",
821 onfail="IPV4: Failed to add multi point" +
822 " to single point intents" )
823
824 stepResult = main.TRUE
825 main.step( "IPV4_2: Add multi point to single point intents" )
826 hostNames = [ 'h8', 'h16', 'h24' ]
827 stepResult = main.intentFunction.multiToSingleIntent(
828 main,
829 name="IPV4",
830 hostNames=hostNames,
831 ethType="IPV4",
832 lambdaAlloc=False )
833
834 utilities.assert_equals( expect=main.TRUE,
835 actual=stepResult,
836 onpass="IPV4_2: Successfully added multi point"
837 + " to single point intents",
838 onfail="IPV4_2: Failed to add multi point" +
839 " to single point intents" )
840
841 stepResult = main.TRUE
842 main.step( "VLAN: Add multi point to single point intents" )
843 hostNames = [ 'h5', 'h13', 'h21' ]
844 devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
845 'of:0000000000000007/5' ]
846 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
847 stepResult = main.intentFunction.multiToSingleIntent(
848 main,
849 name="VLAN",
850 hostNames=hostNames,
851 devices=devices,
852 ports=None,
853 ethType="IPV4",
854 macs=macs,
855 bandwidth="",
856 lambdaAlloc=False,
857 ipProto="",
858 ipAddresses="",
859 tcp="",
860 sw1="s5",
861 sw2="s2",
862 expectedLink=18 )
863
864 utilities.assert_equals( expect=main.TRUE,
865 actual=stepResult,
866 onpass="VLAN: Successfully added multi point"
867 + " to single point intents",
868 onfail="VLAN: Failed to add multi point" +
869 " to single point intents" )