blob: 4cc4bc9521d96e98c90be9957c435c4564e71548 [file] [log] [blame]
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -08001# Testing the basic intent for ipv6 functionality of ONOS
2
Jon Hall314b74a2017-05-24 16:25:52 -07003
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -08004class FUNCipv6Intent:
5
6 def __init__( self ):
7 self.default = ''
8
9 def CASE1( self, main ):
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080010 import imp
11 import re
12
13 """
14 - Construct tests variables
15 - GIT ( optional )
16 - Checkout ONOS master branch
17 - Pull latest ONOS code
18 - Building ONOS ( optional )
19 - Install ONOS package
20 - Build ONOS package
21 """
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080022 main.case( "Constructing test variables and building ONOS package" )
23 main.step( "Constructing test variables" )
24 main.caseExplanation = "This test case is mainly for loading " +\
25 "from params file, and pull and build the " +\
26 " latest ONOS package"
27 stepResult = main.FALSE
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080028 # Test variables
29 try:
30 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
31 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
32 gitBranch = main.params[ 'GIT' ][ 'branch' ]
33 main.dependencyPath = main.testOnDirectory + \
34 main.params[ 'DEPENDENCY' ][ 'path' ]
35 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
36 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
37 if main.ONOSbench.maxNodes:
38 main.maxNodes = int( main.ONOSbench.maxNodes )
39 else:
40 main.maxNodes = 0
41 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
42 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
43 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
44 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
45 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
46 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
47 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
48 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
49 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
50 gitPull = main.params[ 'GIT' ][ 'pull' ]
51 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
52 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
Jon Hall314b74a2017-05-24 16:25:52 -070053 main.cellData = {} # for creating cell file
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080054 main.hostsData = {}
55 main.CLIs = []
56 main.ONOSip = []
57 main.assertReturnString = '' # Assembled assert return string
58
59 main.ONOSip = main.ONOSbench.getOnosIps()
60 print main.ONOSip
61
62 # Assigning ONOS cli handles to a list
Jon Hall314b74a2017-05-24 16:25:52 -070063 for i in range( 1, main.maxNodes + 1 ):
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080064 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
65
66 # -- INIT SECTION, ONLY RUNS ONCE -- #
67 main.startUp = imp.load_source( wrapperFile1,
68 main.dependencyPath +
69 wrapperFile1 +
70 ".py" )
71
72 main.intentFunction = imp.load_source( wrapperFile2,
Jon Hall314b74a2017-05-24 16:25:52 -070073 main.dependencyPath +
74 wrapperFile2 +
75 ".py" )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080076
77 main.topo = imp.load_source( wrapperFile3,
78 main.dependencyPath +
79 wrapperFile3 +
80 ".py" )
81
82 copyResult1 = main.ONOSbench.scp( main.Mininet1,
83 main.dependencyPath +
84 main.topology,
85 main.Mininet1.home,
86 direction="to" )
87 if main.CLIs:
88 stepResult = main.TRUE
89 else:
90 main.log.error( "Did not properly created list of ONOS CLI handle" )
91 stepResult = main.FALSE
92 except Exception as e:
Jon Hall314b74a2017-05-24 16:25:52 -070093 main.log.exception( e )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -080094 main.cleanup()
95 main.exit()
96
97 utilities.assert_equals( expect=main.TRUE,
98 actual=stepResult,
99 onpass="Successfully construct " +
100 "test variables ",
101 onfail="Failed to construct test variables" )
102
103 if gitPull == 'True':
104 main.step( "Building ONOS in " + gitBranch + " branch" )
105 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
106 stepResult = onosBuildResult
107 utilities.assert_equals( expect=main.TRUE,
108 actual=stepResult,
109 onpass="Successfully compiled " +
110 "latest ONOS",
111 onfail="Failed to compile " +
112 "latest ONOS" )
113 else:
114 main.log.warn( "Did not pull new code so skipping mvn " +
115 "clean install" )
116 main.ONOSbench.getVersion( report=True )
117
118 def CASE2( self, main ):
119 """
120 - Set up cell
121 - Create cell file
122 - Set cell file
123 - Verify cell file
124 - Kill ONOS process
125 - Uninstall ONOS cluster
126 - Verify ONOS start up
127 - Install ONOS cluster
128 - Connect to cli
129 """
alisona2905c12016-09-19 15:18:07 -0700130 import time
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800131 # main.scale[ 0 ] determines the current number of ONOS controller
132 main.numCtrls = int( main.scale[ 0 ] )
133
134 main.case( "Starting up " + str( main.numCtrls ) +
135 " node(s) ONOS cluster" )
136 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
137 " node(s) ONOS cluster"
138
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800139 #kill off all onos processes
140 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800141 " before initiating environment setup" )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800142
143 for i in range( main.maxNodes ):
144 main.ONOSbench.onosDie( main.ONOSip[ i ] )
145
146 print "NODE COUNT = ", main.numCtrls
147
148 tempOnosIp = []
149 for i in range( main.numCtrls ):
Jon Hall314b74a2017-05-24 16:25:52 -0700150 tempOnosIp.append( main.ONOSip[ i ] )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800151
152 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
153 "temp", main.Mininet1.ip_address,
154 main.apps, tempOnosIp )
155
156 main.step( "Apply cell to environment" )
157 cellResult = main.ONOSbench.setCell( "temp" )
158 verifyResult = main.ONOSbench.verifyCell()
159 stepResult = cellResult and verifyResult
160 utilities.assert_equals( expect=main.TRUE,
161 actual=stepResult,
Jon Hall314b74a2017-05-24 16:25:52 -0700162 onpass="Successfully applied cell to " +
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800163 "environment",
164 onfail="Failed to apply cell to environment " )
Jon Hall439c8912016-04-15 02:22:03 -0700165
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800166 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700167 packageResult = main.ONOSbench.buckBuild()
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800168 stepResult = packageResult
169 utilities.assert_equals( expect=main.TRUE,
170 actual=stepResult,
171 onpass="Successfully created ONOS package",
172 onfail="Failed to create ONOS package" )
173
174 time.sleep( main.startUpSleep )
175 main.step( "Uninstalling ONOS package" )
176 onosUninstallResult = main.TRUE
177 for ip in main.ONOSip:
178 onosUninstallResult = onosUninstallResult and \
179 main.ONOSbench.onosUninstall( nodeIp=ip )
180 stepResult = onosUninstallResult
181 utilities.assert_equals( expect=main.TRUE,
182 actual=stepResult,
183 onpass="Successfully uninstalled ONOS package",
184 onfail="Failed to uninstall ONOS package" )
185
186 time.sleep( main.startUpSleep )
187 main.step( "Installing ONOS package" )
188 onosInstallResult = main.TRUE
189 for i in range( main.numCtrls ):
190 onosInstallResult = onosInstallResult and \
191 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
192 stepResult = onosInstallResult
193 utilities.assert_equals( expect=main.TRUE,
194 actual=stepResult,
195 onpass="Successfully installed ONOS package",
196 onfail="Failed to install ONOS package" )
197
You Wangf5de25b2017-01-06 15:13:01 -0800198 main.step( "Set up ONOS secure SSH" )
199 secureSshResult = main.TRUE
200 for i in range( int( main.numCtrls ) ):
Jon Hall314b74a2017-05-24 16:25:52 -0700201 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
You Wangf5de25b2017-01-06 15:13:01 -0800202 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
203 onpass="Test step PASS",
204 onfail="Test step FAIL" )
205
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800206 time.sleep( main.startUpSleep )
207 main.step( "Starting ONOS service" )
208 stopResult = main.TRUE
209 startResult = main.TRUE
210 onosIsUp = main.TRUE
211
212 for i in range( main.numCtrls ):
213 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
214 if onosIsUp == main.TRUE:
215 main.log.report( "ONOS instance is up and ready" )
216 else:
217 main.log.report( "ONOS instance may not be up, stop and " +
218 "start ONOS again " )
219
220 for i in range( main.numCtrls ):
221 stopResult = stopResult and \
222 main.ONOSbench.onosStop( main.ONOSip[ i ] )
223 for i in range( main.numCtrls ):
224 startResult = startResult and \
225 main.ONOSbench.onosStart( main.ONOSip[ i ] )
226 stepResult = onosIsUp and stopResult and startResult
227 utilities.assert_equals( expect=main.TRUE,
228 actual=stepResult,
229 onpass="ONOS service is ready",
230 onfail="ONOS service did not start properly" )
231
232 main.step( "Start ONOS cli" )
233 cliResult = main.TRUE
234 for i in range( main.numCtrls ):
235 cliResult = cliResult and \
236 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
237 stepResult = cliResult
238 utilities.assert_equals( expect=main.TRUE,
239 actual=stepResult,
240 onpass="Successfully start ONOS cli",
241 onfail="Failed to start ONOS cli" )
242
Jon Hall11845ed2016-02-11 11:25:31 -0800243 main.step( "Checking that ONOS is ready" )
sathishmad953462015-12-03 17:42:07 +0530244 for i in range( 3 ):
Jon Hall11845ed2016-02-11 11:25:31 -0800245 ready = True
Jeremy5f820072016-02-11 13:50:35 -0800246 for i in range( int( main.scale[ 0 ] ) ):
247 output = main.CLIs[ i ].summary()
Jon Hall11845ed2016-02-11 11:25:31 -0800248 if not output:
249 ready = False
250 time.sleep( 30 )
251 utilities.assert_equals( expect=True, actual=ready,
252 onpass="ONOS summary command succeded",
253 onfail="ONOS summary command failed" )
254 if not ready:
255 main.cleanup()
256 main.exit()
257
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530258 main.step( "setup the ipv6NeighbourDiscovery" )
Jon Hall314b74a2017-05-24 16:25:52 -0700259 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
260 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530261 cfgResult = cfgResult1 and cfgResult2
262 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
Jon Hall314b74a2017-05-24 16:25:52 -0700263 onpass="ipv6NeighborDiscovery cfg is set to true",
264 onfail="Failed to cfg set ipv6NeighborDiscovery" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530265
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800266 # Remove the first element in main.scale list
267 main.scale.remove( main.scale[ 0 ] )
268
269 main.intentFunction.report( main )
270
271 def CASE11( self, main ):
272 """
273 Start Mininet topology with OF 1.3 switches
274 """
275 main.OFProtocol = "1.3"
276 main.log.report( "Start Mininet topology with OF 1.3 switches" )
277 main.case( "Start Mininet topology with OF 1.3 switches" )
278 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
279 "switches to test intents, exits out if " +\
280 "topology did not start correctly"
281
282 main.step( "Starting Mininet topology with OF 1.3 switches" )
283 args = "--switch ovs,protocols=OpenFlow13"
284 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
285 main.topology,
286 args=args )
287 stepResult = topoResult
288 utilities.assert_equals( expect=main.TRUE,
289 actual=stepResult,
290 onpass="Successfully loaded topology",
291 onfail="Failed to load topology" )
292 # Exit if topology did not load properly
293 if not topoResult:
294 main.cleanup()
295 main.exit()
296
297 def CASE12( self, main ):
298 """
299 Assign mastership to controllers
300 """
301 import re
302
303 main.case( "Assign switches to controllers" )
304 main.step( "Assigning switches to controllers" )
305 main.caseExplanation = "Assign OF " + main.OFProtocol +\
306 " switches to ONOS nodes"
307
308 assignResult = main.TRUE
309 switchList = []
310
311 # Creates a list switch name, use getSwitch() function later...
312 for i in range( 1, ( main.numSwitch + 1 ) ):
313 switchList.append( 's' + str( i ) )
314
315 tempONOSip = []
316 for i in range( main.numCtrls ):
317 tempONOSip.append( main.ONOSip[ i ] )
318
319 assignResult = main.Mininet1.assignSwController( sw=switchList,
320 ip=tempONOSip,
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530321 port='6633' )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800322 if not assignResult:
323 main.cleanup()
324 main.exit()
325
326 for i in range( 1, ( main.numSwitch + 1 ) ):
327 response = main.Mininet1.getSwController( "s" + str( i ) )
328 print( "Response is " + str( response ) )
329 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
330 assignResult = assignResult and main.TRUE
331 else:
332 assignResult = main.FALSE
333 stepResult = assignResult
334 utilities.assert_equals( expect=main.TRUE,
335 actual=stepResult,
336 onpass="Successfully assigned switches" +
337 "to controller",
338 onfail="Failed to assign switches to " +
339 "controller" )
340
sathishmad953462015-12-03 17:42:07 +0530341 def CASE13( self, main ):
342 """
343 Discover all hosts and store its data to a dictionary
344 """
345 main.case( "Discover all hosts" )
346
sathishmad953462015-12-03 17:42:07 +0530347 main.step( "Discover all hosts using pingall " )
348 stepResult = main.intentFunction.getHostsData( main )
349 utilities.assert_equals( expect=main.TRUE,
Jon Hall314b74a2017-05-24 16:25:52 -0700350 actual=stepResult,
351 onpass="Successfully discovered hosts",
352 onfail="Failed to discover hosts" )
sathishmad953462015-12-03 17:42:07 +0530353
sathishmc4362252016-04-20 18:29:48 +0530354 def CASE16( self, main ):
355 """
356 Balance Masters
357 """
358 main.case( "Balance mastership of switches" )
359 main.step( "Balancing mastership of switches" )
360
361 balanceResult = main.FALSE
362 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
363
364 utilities.assert_equals( expect=main.TRUE,
365 actual=balanceResult,
366 onpass="Successfully balanced mastership of switches",
367 onfail="Failed to balance mastership of switches" )
368
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800369 def CASE14( self, main ):
370 """
371 Stop mininet
372 """
373 main.log.report( "Stop Mininet topology" )
374 main.case( "Stop Mininet topology" )
375 main.caseExplanation = "Stopping the current mininet topology " +\
376 "to start up fresh"
377
378 main.step( "Stopping Mininet Topology" )
Jon Hall314b74a2017-05-24 16:25:52 -0700379 topoResult = main.Mininet1.stopNet()
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800380 stepResult = topoResult
381 utilities.assert_equals( expect=main.TRUE,
382 actual=stepResult,
383 onpass="Successfully stop mininet",
384 onfail="Failed to stop mininet" )
385 # Exit if topology did not load properly
386 if not topoResult:
387 main.cleanup()
388 main.exit()
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530389
sathishmc4362252016-04-20 18:29:48 +0530390 def CASE1000( self, main ):
391 """
392 Add host intents between 2 host:
393 - Discover hosts
394 - Add host intents
395 - Check intents
396 - Verify flows
397 - Ping hosts
398 - Reroute
399 - Link down
400 - Verify flows
401 - Check topology
402 - Ping hosts
403 - Link up
404 - Verify flows
405 - Check topology
406 - Ping hosts
407 - Remove intents
408 """
409 import time
410 import json
411 import re
412
413 # Assert variables - These variable's name|format must be followed
414 # if you want to use the wrapper function
415 assert main, "There is no main"
416 assert main.CLIs, "There is no main.CLIs"
417 assert main.Mininet1, "Mininet handle should be named Mininet1"
418 assert main.numSwitch, "Placed the total number of switch topology in \
419 main.numSwitch"
420
421 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
422
423 main.testName = "Host Intents"
424 main.case( main.testName + " Test - " + str( main.numCtrls ) +
425 " NODE(S) - OF " + main.OFProtocol )
426 main.caseExplanation = "This test case tests Host intents using " +\
427 str( main.numCtrls ) + " node(s) cluster;\n" +\
428 "Different type of hosts will be tested in " +\
429 "each step such as IPV6, Dual stack, VLAN " +\
430 "etc;\nThe test will use OF " + main.OFProtocol\
431 + " OVS running in Mininet"
432
433 main.step( "IPV6: Add host intents between h1 and h9" )
434 stepResult = main.TRUE
435 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700436 name='IPV6',
437 host1='h1',
438 host2='h9',
439 host1Id='00:00:00:00:00:01/-1',
440 host2Id='00:00:00:00:00:09/-1',
441 sw1='s5',
442 sw2='s2',
443 expectedLink=18 )
sathishmc4362252016-04-20 18:29:48 +0530444
445 utilities.assert_equals( expect=main.TRUE,
446 actual=stepResult,
447 onpass="IPV6: Host intent test successful " +
448 "between two IPV6 hosts",
449 onfail="IPV6: Host intent test failed " +
Jon Hall314b74a2017-05-24 16:25:52 -0700450 "between two IPV6 hosts" )
sathishmc4362252016-04-20 18:29:48 +0530451
452 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
453 stepResult = main.TRUE
454 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700455 name='DUALSTACK',
456 host1='h3',
457 host2='h11',
458 host1Id='00:00:00:00:00:03/-1',
459 host2Id='00:00:00:00:00:0B/-1',
460 sw1='s5',
461 sw2='s2',
462 expectedLink=18 )
sathishmc4362252016-04-20 18:29:48 +0530463
464 utilities.assert_equals( expect=main.TRUE,
465 actual=stepResult,
466 onpass="DUALSTACK: Host intent test " +
467 "successful between two " +
468 "dual stack host using IPV6",
469 onfail="DUALSTACK: Host intent test " +
470 "failed between two" +
471 "dual stack host using IPV6" )
472
473 main.step( "1HOP: Add host intents between h1 and h3" )
474 stepResult = main.TRUE
475 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700476 name='1HOP',
477 host1='h1',
478 host2='h9',
479 host1Id='00:00:00:00:00:01/-1',
480 host2Id='00:00:00:00:00:09/-1' )
sathishmc4362252016-04-20 18:29:48 +0530481
482 utilities.assert_equals( expect=main.TRUE,
483 actual=stepResult,
484 onpass="1HOP: Host intent test " +
485 "successful between two " +
486 "host using IPV6 in the same switch",
487 onfail="1HOP: Host intent test " +
488 "failed between two" +
489 "host using IPV6 in the same switch" )
490
491 main.step( "VLAN: Add vlan host intents between h5 and h24" )
492 stepResult = main.TRUE
493 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700494 name='VLAN1',
495 host1='h5',
496 host2='h24',
497 host1Id='00:00:00:00:00:05/100',
498 host2Id='00:00:00:00:00:18/100',
499 sw1='s5',
500 sw2='s2',
501 expectedLink=18 )
sathishmc4362252016-04-20 18:29:48 +0530502
503 utilities.assert_equals( expect=main.TRUE,
504 actual=stepResult,
505 onpass="VLAN: Host intent test " +
506 "successful between two " +
507 "host using IPV6 in the same VLAN",
508 onfail="VLAN1: Host intent test " +
509 "failed between two" +
510 "host using IPV6 in the same VLAN" )
511
512 main.intentFunction.report( main )
513
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530514 def CASE2000( self, main ):
515 """
516 add point intents between 2 hosts:
517 - Get device ids | ports
518 - Add point intents
519 - Check intents
520 - Verify flows
521 - Ping hosts
522 - Reroute
523 - Link down
524 - Verify flows
525 - Check topology
526 - Ping hosts
527 - Link up
528 - Verify flows
529 - Check topology
530 - Ping hosts
531 - Remove intents
532 """
533 import time
534 import json
535 import re
536
537 # Assert variables - These variable's name|format must be followed
538 # if you want to use the wrapper function
539 assert main, "There is no main"
540 assert main.CLIs, "There is no main.CLIs"
541 assert main.Mininet1, "Mininet handle should be named Mininet1"
542 assert main.numSwitch, "Placed the total number of switch topology in \
543 main.numSwitch"
544
545 main.testName = "Point Intents"
546 main.case( main.testName + " Test - " + str( main.numCtrls ) +
547 " NODE(S) - OF " + main.OFProtocol )
548 main.caseExplanation = "This test case will test point to point" +\
549 " intents using " + str( main.numCtrls ) +\
550 " node(s) cluster;\n" +\
551 "Different type of hosts will be tested in " +\
Jon Hall439c8912016-04-15 02:22:03 -0700552 "each step such as IPV6, Dual stack, VLAN etc" +\
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530553 ";\nThe test will use OF " + main.OFProtocol +\
554 " OVS running in Mininet"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530555 # No option point intents
556 main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" )
557 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
558 stepResult = main.TRUE
559 stepResult = main.intentFunction.pointIntent(
560 main,
561 name="NOOPTION",
562 host1="h1",
563 host2="h9",
564 deviceId1="of:0000000000000005/1",
Jon Hall314b74a2017-05-24 16:25:52 -0700565 deviceId2="of:0000000000000006/1" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530566
567 utilities.assert_equals( expect=main.TRUE,
568 actual=stepResult,
569 onpass=main.assertReturnString,
570 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530571 stepResult = main.TRUE
572 main.step( "IPV6: Add point intents between h1 and h9" )
573 main.assertReturnString = "Assertion Result for IPV6 point intent\n"
574 stepResult = main.intentFunction.pointIntent(
575 main,
576 name="IPV6",
577 host1="h1",
578 host2="h9",
579 deviceId1="of:0000000000000005/1",
580 deviceId2="of:0000000000000006/1",
581 port1="",
582 port2="",
583 ethType="IPV6",
584 mac1="00:00:00:00:00:01",
585 mac2="00:00:00:00:00:09",
586 bandwidth="",
587 lambdaAlloc=False,
588 ipProto="",
589 ip1="",
590 ip2="",
591 tcp1="",
592 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700593 sw1="s5",
594 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530595 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530596 utilities.assert_equals( expect=main.TRUE,
597 actual=stepResult,
598 onpass=main.assertReturnString,
599 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530600 main.step( "IPV6_2: Add point intents between h1 and h9" )
601 main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n"
602 stepResult = main.intentFunction.pointIntent(
603 main,
604 name="IPV6_2",
605 host1="h1",
606 host2="h9",
607 deviceId1="of:0000000000000005/1",
608 deviceId2="of:0000000000000006/1",
609 ipProto="",
610 ip1="",
611 ip2="",
612 tcp1="",
613 tcp2="",
Jon Hall314b74a2017-05-24 16:25:52 -0700614 expectedLink="" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530615 utilities.assert_equals( expect=main.TRUE,
616 actual=stepResult,
617 onpass=main.assertReturnString,
618 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530619 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
sathishmad953462015-12-03 17:42:07 +0530620 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530621 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
622 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700623 main.log.debug( mac2 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530624 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
sathishmad953462015-12-03 17:42:07 +0530625 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
626 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530627 stepResult = main.intentFunction.pointIntent(
628 main,
629 name="SDNIP-ICMP",
630 host1="h1",
631 host2="h9",
632 deviceId1="of:0000000000000005/1",
633 deviceId2="of:0000000000000006/1",
634 mac1=mac1,
635 mac2=mac2,
636 ethType="IPV6",
637 ipProto=ipProto,
638 ip1=ip1,
639 ip2=ip2 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530640 utilities.assert_equals( expect=main.TRUE,
641 actual=stepResult,
642 onpass=main.assertReturnString,
643 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530644 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
sathishmad953462015-12-03 17:42:07 +0530645 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV6 using TCP point intents\n"
Jon Hall439c8912016-04-15 02:22:03 -0700646 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
647 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
648 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
649 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530650 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
651 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
652 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530653 stepResult = main.intentFunction.pointIntentTcp(
654 main,
655 name="SDNIP-TCP",
Jon Hall439c8912016-04-15 02:22:03 -0700656 host1="h1",
657 host2="h9",
658 deviceId1="of:0000000000000005/1",
659 deviceId2="of:0000000000000006/1",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530660 mac1=mac1,
661 mac2=mac2,
Jon Hall439c8912016-04-15 02:22:03 -0700662 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530663 ipProto=ipProto,
664 ip1=ip1,
665 ip2=ip2,
666 tcp1=tcp1,
Jon Hall439c8912016-04-15 02:22:03 -0700667 tcp2=tcp2,
668 sw1="",
669 sw2="",
670 expectedLink="" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530671 utilities.assert_equals( expect=main.TRUE,
sathishmad953462015-12-03 17:42:07 +0530672 actual=stepResult,
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530673 onpass=main.assertReturnString,
674 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530675 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
sathishmad953462015-12-03 17:42:07 +0530676 main.assertReturnString = "Assertion Result for Dualstack1 IPV6 with mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530677 stepResult = main.intentFunction.pointIntent(
678 main,
679 name="DUALSTACK1",
680 host1="h3",
681 host2="h11",
sathishmad953462015-12-03 17:42:07 +0530682 deviceId1="of:0000000000000005/3",
683 deviceId2="of:0000000000000006/3",
684 port1="",
685 port2="",
686 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530687 mac1="00:00:00:00:00:03",
688 mac2="00:00:00:00:00:0B",
689 bandwidth="",
690 lambdaAlloc=False,
691 ipProto="",
692 ip1="",
693 ip2="",
694 tcp1="",
695 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700696 sw1="s5",
697 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530698 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530699 utilities.assert_equals( expect=main.TRUE,
700 actual=stepResult,
701 onpass=main.assertReturnString,
702 onfail=main.assertReturnString )
sathishmad953462015-12-03 17:42:07 +0530703 main.step( "VLAN: Add point intents between h5 and h24" )
704 main.assertReturnString = "Assertion Result for VLAN IPV6 with mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530705 stepResult = main.intentFunction.pointIntent(
706 main,
707 name="VLAN",
708 host1="h5",
sathishmad953462015-12-03 17:42:07 +0530709 host2="h24",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530710 deviceId1="of:0000000000000005/5",
sathishmad953462015-12-03 17:42:07 +0530711 deviceId2="of:0000000000000007/8",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530712 port1="",
713 port2="",
sathishmad953462015-12-03 17:42:07 +0530714 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530715 mac1="00:00:00:00:00:05",
sathishmad953462015-12-03 17:42:07 +0530716 mac2="00:00:00:00:00:18",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530717 bandwidth="",
718 lambdaAlloc=False,
719 ipProto="",
720 ip1="",
721 ip2="",
722 tcp1="",
723 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700724 sw1="s5",
725 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530726 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530727 utilities.assert_equals( expect=main.TRUE,
728 actual=stepResult,
729 onpass=main.assertReturnString,
730 onfail=main.assertReturnString )
sathishmad953462015-12-03 17:42:07 +0530731 main.step( "1HOP: Add point intents between h1 and h9" )
732 main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
sathishmc4362252016-04-20 18:29:48 +0530733 stepResult = main.intentFunction.pointIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700734 name='1HOP',
735 host1="h1",
736 host2="h9",
737 deviceId1="of:0000000000000005/1",
738 deviceId2="of:0000000000000006/1" )
Jon Hall439c8912016-04-15 02:22:03 -0700739 utilities.assert_equals( expect=main.TRUE,
740 actual=stepResult,
741 onpass=main.assertReturnString,
742 onfail=main.assertReturnString )
743 main.intentFunction.report( main )
744
745 def CASE3000( self, main ):
746 """
747 Add single point to multi point intents
748 - Get device ids
749 - Add single point to multi point intents
750 - Check intents
751 - Verify flows
752 - Ping hosts
753 - Reroute
754 - Link down
755 - Verify flows
756 - Check topology
757 - Ping hosts
758 - Link up
759 - Verify flows
760 - Check topology
761 - Ping hosts
762 - Remove intents
763 """
764 import time
765 import json
766 import re
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 main.testName = "Single to Multi Point Intents"
773 main.case( main.testName + " Test - " + str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol )
774 main.caseExplanation = "This test case will test single point to" +\
775 " multi point intents using " +\
776 str( main.numCtrls ) + " node(s) cluster;\n" +\
777 "Different type of hosts will be tested in " +\
778 "each step such as IPV6, Dual stack, VLAN etc" +\
779 ";\nThe test will use OF " + main.OFProtocol +\
780 " OVS running in Mininet "
781 main.step( "NOOPTION: Add single point to multi point intents" )
782 hostNames = [ 'h1', 'h9', 'h17' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700783 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall439c8912016-04-15 02:22:03 -0700784 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n"
785 stepResult = main.TRUE
786 stepResult = main.intentFunction.singleToMultiIntent(
787 main,
788 name="NOOPTION",
789 hostNames=hostNames,
790 devices=devices,
791 sw1="s5",
792 sw2="s2",
Jon Hall314b74a2017-05-24 16:25:52 -0700793 expectedLink=18 )
Jon Hall439c8912016-04-15 02:22:03 -0700794 utilities.assert_equals( expect=main.TRUE,
795 actual=stepResult,
796 onpass=main.assertReturnString,
797 onfail=main.assertReturnString )
798 main.step( "IPV6: Add single point to multi point intents" )
799 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n"
800 hostNames = [ 'h1', 'h9', 'h17' ]
801 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700802 macs = [ '00:00:00:00:00:01', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
Jon Hall439c8912016-04-15 02:22:03 -0700803 stepResult = main.TRUE
804 stepResult = main.intentFunction.singleToMultiIntent(
805 main,
806 name="IPV6",
807 hostNames=hostNames,
808 devices=devices,
809 macs=macs,
810 ethType="IPV6",
811 sw1="",
Jon Hall314b74a2017-05-24 16:25:52 -0700812 sw2="" )
Jon Hall439c8912016-04-15 02:22:03 -0700813 utilities.assert_equals( expect=main.TRUE,
814 actual=stepResult,
815 onpass=main.assertReturnString,
816 onfail=main.assertReturnString )
817 main.step( "IPV6_2: Add single point to multi point intents" )
818 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and no MAC addresses\n"
819 hostNames = [ 'h1', 'h9', 'h17' ]
820 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
821 stepResult = main.TRUE
822 stepResult = main.intentFunction.singleToMultiIntent(
823 main,
824 name="IPV6_2",
825 hostNames=hostNames,
826 devices=devices,
827 ethType="IPV6",
828 sw1="",
Jon Hall314b74a2017-05-24 16:25:52 -0700829 sw2="" )
Jon Hall439c8912016-04-15 02:22:03 -0700830 utilities.assert_equals( expect=main.TRUE,
831 actual=stepResult,
832 onpass=main.assertReturnString,
833 onfail=main.assertReturnString )
834 main.step( "VLAN: Add single point to multi point intents" )
835 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n"
836 hostNames = [ 'h5', 'h24' ]
837 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700838 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
Jon Hall439c8912016-04-15 02:22:03 -0700839 stepResult = main.TRUE
840 stepResult = main.intentFunction.singleToMultiIntent(
841 main,
842 name="IPV6",
843 hostNames=hostNames,
844 devices=devices,
845 macs=macs,
846 ethType="IPV6",
847 sw1="",
Jon Hall314b74a2017-05-24 16:25:52 -0700848 sw2="" )
Jon Hall439c8912016-04-15 02:22:03 -0700849 utilities.assert_equals( expect=main.TRUE,
850 actual=stepResult,
851 onpass=main.assertReturnString,
852 onfail=main.assertReturnString )
853 main.intentFunction.report( main )
Jon Hall314b74a2017-05-24 16:25:52 -0700854
Jon Hall439c8912016-04-15 02:22:03 -0700855 def CASE4000( self, main ):
856 """
857 Add multi point to single point intents
858 - Get device ids
859 - Add multi point to single point intents
860 - Check intents
861 - Verify flows
862 - Ping hosts
863 - Reroute
864 - Link down
865 - Verify flows
866 - Check topology
867 - Ping hosts
868 - Link up
869 - Verify flows
870 - Check topology
871 - Ping hosts
872 - Remove intents
873 """
874 assert main, "There is no main"
875 assert main.CLIs, "There is no main.CLIs"
876 assert main.Mininet1, "Mininet handle should be named Mininet1"
877 assert main.numSwitch, "Placed the total number of switch topology in \
878 main.numSwitch"
879
880 main.testName = "Multi To Single Point Intents"
881 main.case( main.testName + " Test - " + str( main.numCtrls ) +
882 " NODE(S) - OF " + main.OFProtocol )
883 main.caseExplanation = "This test case will test single point to" +\
884 " multi point intents using " +\
885 str( main.numCtrls ) + " node(s) cluster;\n" +\
886 "Different type of hosts will be tested in " +\
887 "each step such as IPV6, Dual stack, VLAN etc" +\
888 ";\nThe test will use OF " + main.OFProtocol +\
889 " OVS running in Mininet"
890
891 main.step( "NOOPTION: Add multi point to single point intents" )
892 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
893 stepResult = main.TRUE
894 hostNames = [ 'h17', 'h9' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700895 devices = [ 'of:0000000000000007/1', 'of:0000000000000006/1' ]
Jon Hall439c8912016-04-15 02:22:03 -0700896 stepResult = main.intentFunction.multiToSingleIntent(
897 main,
898 name="NOOPTION",
899 hostNames=hostNames,
900 devices=devices,
901 sw1="s6",
902 sw2="s2",
903 expectedLink=18 )
904 utilities.assert_equals( expect=main.TRUE,
905 actual=stepResult,
906 onpass=main.assertReturnString,
907 onfail=main.assertReturnString )
908 main.step( "IPV6: Add multi point to single point intents" )
909 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n"
910 hostNames = [ 'h1', 'h9', 'h17' ]
911 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700912 macs = [ '00:00:00:00:00:01', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
Jon Hall439c8912016-04-15 02:22:03 -0700913 stepResult = main.TRUE
914 installResult = main.intentFunction.multiToSingleIntent(
915 main,
916 name="IPV6",
917 hostNames=hostNames,
918 devices=devices,
919 macs=macs,
920 ethType="IPV6",
921 sw1="",
922 sw2="",
923 expectedLink="" )
924 utilities.assert_equals( expect=main.TRUE,
925 actual=stepResult,
926 onpass=main.assertReturnString,
927 onfail=main.assertReturnString )
928 main.step( "IPV6_2: Add multi point to single point intents" )
929 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses\n"
930 hostNames = [ 'h1', 'h9' ]
931 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1' ]
932 stepResult = main.TRUE
933 stepResult = main.intentFunction.multiToSingleIntent(
934 main,
935 name="IPV6_2",
936 hostNames=hostNames,
937 devices=devices,
938 ethType="IPV6",
939 sw1="",
940 sw2="",
Jon Hall314b74a2017-05-24 16:25:52 -0700941 expectedLink="" )
Jon Hall439c8912016-04-15 02:22:03 -0700942 utilities.assert_equals( expect=main.TRUE,
943 actual=stepResult,
944 onpass=main.assertReturnString,
945 onfail=main.assertReturnString )
946
947 main.step( "VLAN: Add multi point to single point intents" )
948 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n"
949 hostNames = [ 'h5', 'h24' ]
950 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700951 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
Jon Hall439c8912016-04-15 02:22:03 -0700952 stepResult = main.TRUE
953 stepResult = main.intentFunction.multiToSingleIntent(
954 main,
955 name="VLAN",
956 hostNames=hostNames,
957 devices=devices,
958 macs=macs,
959 ethType="IPV6",
960 sw1="",
961 sw2="",
Jon Hall314b74a2017-05-24 16:25:52 -0700962 expectedLink="" )
Jon Hall439c8912016-04-15 02:22:03 -0700963 utilities.assert_equals( expect=main.TRUE,
964 actual=stepResult,
965 onpass=main.assertReturnString,
966 onfail=main.assertReturnString )
967 main.intentFunction.report( main )
968
969 def CASE5000( self, main ):
970 """
971 Tests Host Mobility
972 Modifies the topology location of h1
973 """
974 assert main, "There is no main"
975 assert main.CLIs, "There is no main.CLIs"
976 assert main.Mininet1, "Mininet handle should be named Mininet1"
977 assert main.numSwitch, "Placed the total number of switch topology in \
978 main.numSwitch"
979 main.case( "Test host mobility with host intents " )
980 main.step( "Testing host mobility by moving h1 from s5 to s6" )
981 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
982
Jon Hall314b74a2017-05-24 16:25:52 -0700983 main.log.info( "Moving h1 from s5 to s6" )
984 main.Mininet1.moveHostv6( "h1", "s5", "s6" )
Jon Hall439c8912016-04-15 02:22:03 -0700985 main.intentFunction.getHostsData( main )
986 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
987
988 utilities.assert_equals( expect="of:0000000000000006",
989 actual=h1PostMove,
990 onpass="Mobility: Successfully moved h1 to s6",
991 onfail="Mobility: Failed to move h1 to s6" +
992 " to single point intents" +
993 " with IPV6 type and MAC addresses" +
994 " in the same VLAN" )
995 main.step( "IPV6: Add host intents between h1 and h9" )
996 main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n"
997 stepResult = main.TRUE
998 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700999 name='IPV6 Mobility IPV6',
1000 host1='h1',
1001 host2='h9',
1002 host1Id='00:00:00:00:00:01/-1',
1003 host2Id='00:00:00:00:00:09/-1' )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +05301004
1005 utilities.assert_equals( expect=main.TRUE,
1006 actual=stepResult,
1007 onpass=main.assertReturnString,
1008 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +05301009 main.intentFunction.report( main )
sathishmc4362252016-04-20 18:29:48 +05301010
1011 def CASE6000( self, main ):
1012 """
1013 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1014 """
1015 assert main, "There is no main"
1016 assert main.CLIs, "There is no main.CLIs"
1017 assert main.Mininet1, "Mininet handle should be named Mininet1"
1018 assert main.numSwitch, "Placed the total number of switch topology in \
1019 main.numSwitch"
1020 main.case( "Test Multi to Single End Point Failure" )
1021 main.step( "NOOPTION: test end point failure for multi point to single point intents" )
1022 main.assertReturnString = "Assertion results for IPV6 multi to single \
1023 point intent end point failure with no options set\n"
1024 hostNames = [ 'h8', 'h17' ]
1025 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1026 testResult = main.TRUE
1027 testResult = main.intentFunction.testEndPointFail(
1028 main,
1029 name="NOOPTION",
1030 test="MultipletoSingle",
1031 hostNames=hostNames,
1032 devices=devices,
1033 sw1="s6",
1034 sw2="s2",
1035 sw3="s4",
1036 sw4="s1",
1037 sw5="s3",
1038 expectedLink1=16,
1039 expectedLink2=14 )
1040 utilities.assert_equals( expect=main.TRUE,
1041 actual=testResult,
1042 onpass=main.assertReturnString,
1043 onfail=main.assertReturnString )
1044
1045 main.step( "IPV6: test end point failure for multi point to single point intents" )
1046 main.assertReturnString = "Assertion results for IPV6 multi to single \
1047 point intent end point failure with IPV6 type and MAC addresses\n"
1048 hostNames = [ 'h8', 'h9', 'h17' ]
1049 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001050 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
sathishmc4362252016-04-20 18:29:48 +05301051 testResult = main.TRUE
1052 testResult = main.intentFunction.testEndPointFail(
1053 main,
1054 test="MultipletoSingle",
1055 name="IPV6",
1056 hostNames=hostNames,
1057 devices=devices,
1058 macs=macs,
1059 ethType="IPV6",
1060 sw1="s6",
1061 sw2="s2",
1062 sw3="s4",
1063 sw4="s1",
1064 sw5="s3",
1065 expectedLink1=16,
1066 expectedLink2=14 )
1067 utilities.assert_equals( expect=main.TRUE,
1068 actual=testResult,
1069 onpass=main.assertReturnString,
1070 onfail=main.assertReturnString )
1071
1072 main.step( "IPV6_2: test end point faliure for multi point to single point intents" )
1073 main.assertReturnString = "Assertion results for IPV6 multi to single \
1074 point intent end point failure with IPV6 type and no MAC addresses\n"
1075 hostNames = [ 'h8', 'h17' ]
1076 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1077 testResult = main.TRUE
1078 testResult = main.intentFunction.testEndPointFail(
1079 main,
1080 test="MultipletoSingle",
1081 name="IPV6_2",
1082 hostNames=hostNames,
1083 devices=devices,
1084 ethType="IPV6",
1085 sw1="s6",
1086 sw2="s2",
1087 sw3="s4",
1088 sw4="s1",
1089 sw5="s3",
1090 expectedLink1=16,
1091 expectedLink2=14 )
1092
1093 utilities.assert_equals( expect=main.TRUE,
1094 actual=testResult,
1095 onpass=main.assertReturnString,
1096 onfail=main.assertReturnString )
1097
1098 main.step( "VLAN: test end point failure for multi point to single point intents" )
1099 main.assertReturnString = "Assertion results for IPV6 multi to single \
1100 point intent end point failure with IPV6 type and no MAC addresses in the same VLAN\n"
1101 hostNames = [ 'h5', 'h24' ]
1102 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001103 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
sathishmc4362252016-04-20 18:29:48 +05301104 testResult = main.TRUE
1105 testResult = main.intentFunction.testEndPointFail(
1106 main,
1107 test="MultipletoSingle",
1108 name="VLAN",
1109 hostNames=hostNames,
1110 devices=devices,
1111 ethType="IPV6",
1112 sw1="s6",
1113 sw2="s2",
1114 sw3="s4",
1115 sw4="s1",
1116 sw5="s3",
1117 expectedLink1=16,
1118 expectedLink2=14 )
1119 utilities.assert_equals( expect=main.TRUE,
1120 actual=testResult,
1121 onpass=main.assertReturnString,
1122 onfail=main.assertReturnString )
1123
1124 main.case( "Test Single to Multiple End Point Failure" )
1125 main.step( "NOOPTION: test end point failure for single point to multi point intents" )
1126 main.assertReturnString = "Assertion results for IPV6 single to multi \
1127 point intent end point failure with no options set\n"
1128 hostNames = [ 'h8', 'h17' ]
1129 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1130 testResult = main.TRUE
1131 testResult = main.intentFunction.testEndPointFail(
1132 main,
1133 test="SingletoMultiple",
1134 name="NOOPTION",
1135 hostNames=hostNames,
1136 devices=devices,
1137 sw1="s6",
1138 sw2="s2",
1139 sw3="s4",
1140 sw4="s1",
1141 sw5="s3",
1142 expectedLink1=16,
1143 expectedLink2=14 )
1144 utilities.assert_equals( expect=main.TRUE,
1145 actual=testResult,
1146 onpass=main.assertReturnString,
1147 onfail=main.assertReturnString )
1148 main.step( "IPV6: test end point failure for single point to multi point intents" )
1149 main.assertReturnString = "Assertion results for IPV6 single to multi \
1150 point intent end point failure with IPV6 type and MAC addresses\n"
1151 hostNames = [ 'h8', 'h9', 'h17' ]
1152 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001153 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:09', '00:00:00:00:00:11' ]
sathishmc4362252016-04-20 18:29:48 +05301154 testResult = main.TRUE
1155 testResult = main.intentFunction.testEndPointFail(
1156 main,
1157 test="SingletoMultiple",
1158 name="IPV6",
1159 hostNames=hostNames,
1160 devices=devices,
1161 ethType="IPV6",
1162 macs=macs,
1163 sw1="s6",
1164 sw2="s2",
1165 sw3="s4",
1166 sw4="s1",
1167 sw5="s3",
1168 expectedLink1=16,
1169 expectedLink2=14 )
1170 utilities.assert_equals( expect=main.TRUE,
1171 actual=testResult,
1172 onpass=main.assertReturnString,
1173 onfail=main.assertReturnString )
1174
1175 main.step( "IPV6_2: test end point failure for single point to multi point intents" )
1176 main.assertReturnString = "Assertion results for IPV6 single to multi\
1177 point intent endpoint failure with IPV6 type and no MAC addresses\n"
1178 hostNames = [ 'h8', 'h17' ]
1179 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1180 testResult = main.TRUE
1181 testResult = main.intentFunction.testEndPointFail(
1182 main,
1183 test="SingletoMultiple",
1184 name="IPV6_2",
1185 hostNames=hostNames,
1186 devices=devices,
1187 ethType="IPV6",
1188 sw1="s6",
1189 sw2="s2",
1190 sw3="s4",
1191 sw4="s1",
1192 sw5="s3",
1193 expectedLink1=16,
1194 expectedLink2=14 )
1195 utilities.assert_equals( expect=main.TRUE,
1196 actual=testResult,
1197 onpass=main.assertReturnString,
1198 onfail=main.assertReturnString )
1199
1200 main.step( "VLAN: test end point failure for single point to multi point intents" )
1201 main.assertReturnString = "Assertion results for IPV6 single to multi point\
1202 intent endpoint failure with IPV6 type and MAC addresses in the same VLAN\n"
1203 hostNames = [ 'h5', 'h24' ]
1204 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001205 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
sathishmc4362252016-04-20 18:29:48 +05301206 testResult = main.TRUE
1207 testResult = main.intentFunction.testEndPointFail(
1208 main,
1209 test="SingletoMultiple",
1210 name="IPV6",
1211 hostNames=hostNames,
1212 devices=devices,
1213 macs=macs,
1214 ethType="IPV6",
1215 sw1="s6",
1216 sw2="s2",
1217 sw3="s4",
1218 sw4="s1",
1219 sw5="s3",
1220 expectedLink1=16,
1221 expectedLink2=14 )
1222 utilities.assert_equals( expect=main.TRUE,
1223 actual=testResult,
1224 onpass=main.assertReturnString,
1225 onfail=main.assertReturnString )
1226
1227 main.intentFunction.report( main )