blob: 148f52dc540bd57bdc7fd825339b3ba61bac2ee9 [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
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800103 main.ONOSbench.getVersion( report=True )
104
105 def CASE2( self, main ):
106 """
107 - Set up cell
108 - Create cell file
109 - Set cell file
110 - Verify cell file
111 - Kill ONOS process
112 - Uninstall ONOS cluster
113 - Verify ONOS start up
114 - Install ONOS cluster
115 - Connect to cli
116 """
alisona2905c12016-09-19 15:18:07 -0700117 import time
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800118 # main.scale[ 0 ] determines the current number of ONOS controller
119 main.numCtrls = int( main.scale[ 0 ] )
120
121 main.case( "Starting up " + str( main.numCtrls ) +
122 " node(s) ONOS cluster" )
123 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
124 " node(s) ONOS cluster"
125
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800126 #kill off all onos processes
127 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800128 " before initiating environment setup" )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800129
130 for i in range( main.maxNodes ):
131 main.ONOSbench.onosDie( main.ONOSip[ i ] )
132
133 print "NODE COUNT = ", main.numCtrls
134
135 tempOnosIp = []
136 for i in range( main.numCtrls ):
Jon Hall314b74a2017-05-24 16:25:52 -0700137 tempOnosIp.append( main.ONOSip[ i ] )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800138
139 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
140 "temp", main.Mininet1.ip_address,
Devin Limdc78e202017-06-09 18:30:07 -0700141 main.apps, tempOnosIp, main.ONOScli1.karafUser )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800142
143 main.step( "Apply cell to environment" )
144 cellResult = main.ONOSbench.setCell( "temp" )
145 verifyResult = main.ONOSbench.verifyCell()
146 stepResult = cellResult and verifyResult
147 utilities.assert_equals( expect=main.TRUE,
148 actual=stepResult,
Jon Hall314b74a2017-05-24 16:25:52 -0700149 onpass="Successfully applied cell to " +
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800150 "environment",
151 onfail="Failed to apply cell to environment " )
Jon Hall439c8912016-04-15 02:22:03 -0700152
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800153 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700154 packageResult = main.ONOSbench.buckBuild()
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800155 stepResult = packageResult
156 utilities.assert_equals( expect=main.TRUE,
157 actual=stepResult,
158 onpass="Successfully created ONOS package",
159 onfail="Failed to create ONOS package" )
160
161 time.sleep( main.startUpSleep )
162 main.step( "Uninstalling ONOS package" )
163 onosUninstallResult = main.TRUE
164 for ip in main.ONOSip:
165 onosUninstallResult = onosUninstallResult and \
166 main.ONOSbench.onosUninstall( nodeIp=ip )
167 stepResult = onosUninstallResult
168 utilities.assert_equals( expect=main.TRUE,
169 actual=stepResult,
170 onpass="Successfully uninstalled ONOS package",
171 onfail="Failed to uninstall ONOS package" )
172
173 time.sleep( main.startUpSleep )
174 main.step( "Installing ONOS package" )
175 onosInstallResult = main.TRUE
176 for i in range( main.numCtrls ):
177 onosInstallResult = onosInstallResult and \
178 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
179 stepResult = onosInstallResult
180 utilities.assert_equals( expect=main.TRUE,
181 actual=stepResult,
182 onpass="Successfully installed ONOS package",
183 onfail="Failed to install ONOS package" )
184
You Wangf5de25b2017-01-06 15:13:01 -0800185 main.step( "Set up ONOS secure SSH" )
186 secureSshResult = main.TRUE
187 for i in range( int( main.numCtrls ) ):
Jon Hall314b74a2017-05-24 16:25:52 -0700188 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
You Wangf5de25b2017-01-06 15:13:01 -0800189 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
190 onpass="Test step PASS",
191 onfail="Test step FAIL" )
192
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800193 time.sleep( main.startUpSleep )
194 main.step( "Starting ONOS service" )
195 stopResult = main.TRUE
196 startResult = main.TRUE
197 onosIsUp = main.TRUE
198
199 for i in range( main.numCtrls ):
200 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
201 if onosIsUp == main.TRUE:
202 main.log.report( "ONOS instance is up and ready" )
203 else:
204 main.log.report( "ONOS instance may not be up, stop and " +
205 "start ONOS again " )
206
207 for i in range( main.numCtrls ):
208 stopResult = stopResult and \
209 main.ONOSbench.onosStop( main.ONOSip[ i ] )
210 for i in range( main.numCtrls ):
211 startResult = startResult and \
212 main.ONOSbench.onosStart( main.ONOSip[ i ] )
213 stepResult = onosIsUp and stopResult and startResult
214 utilities.assert_equals( expect=main.TRUE,
215 actual=stepResult,
216 onpass="ONOS service is ready",
217 onfail="ONOS service did not start properly" )
218
219 main.step( "Start ONOS cli" )
220 cliResult = main.TRUE
221 for i in range( main.numCtrls ):
222 cliResult = cliResult and \
223 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
224 stepResult = cliResult
225 utilities.assert_equals( expect=main.TRUE,
226 actual=stepResult,
227 onpass="Successfully start ONOS cli",
228 onfail="Failed to start ONOS cli" )
229
Jon Hall11845ed2016-02-11 11:25:31 -0800230 main.step( "Checking that ONOS is ready" )
sathishmad953462015-12-03 17:42:07 +0530231 for i in range( 3 ):
Jon Hall11845ed2016-02-11 11:25:31 -0800232 ready = True
Jeremy5f820072016-02-11 13:50:35 -0800233 for i in range( int( main.scale[ 0 ] ) ):
234 output = main.CLIs[ i ].summary()
Jon Hall11845ed2016-02-11 11:25:31 -0800235 if not output:
236 ready = False
237 time.sleep( 30 )
238 utilities.assert_equals( expect=True, actual=ready,
239 onpass="ONOS summary command succeded",
240 onfail="ONOS summary command failed" )
241 if not ready:
242 main.cleanup()
243 main.exit()
244
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530245 main.step( "setup the ipv6NeighbourDiscovery" )
Jon Hall314b74a2017-05-24 16:25:52 -0700246 cfgResult1 = main.CLIs[ 0 ].setCfg( "org.onosproject.incubator.net.neighbour.impl.NeighbourResolutionManager", "ndpEnabled", "true" )
247 cfgResult2 = main.CLIs[ 0 ].setCfg( "org.onosproject.provider.host.impl.HostLocationProvider", "useIpv6ND", "true" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530248 cfgResult = cfgResult1 and cfgResult2
249 utilities.assert_equals( expect=main.TRUE, actual=cfgResult,
Jon Hall314b74a2017-05-24 16:25:52 -0700250 onpass="ipv6NeighborDiscovery cfg is set to true",
251 onfail="Failed to cfg set ipv6NeighborDiscovery" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530252
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800253 # Remove the first element in main.scale list
254 main.scale.remove( main.scale[ 0 ] )
255
256 main.intentFunction.report( main )
257
258 def CASE11( self, main ):
259 """
260 Start Mininet topology with OF 1.3 switches
261 """
262 main.OFProtocol = "1.3"
263 main.log.report( "Start Mininet topology with OF 1.3 switches" )
264 main.case( "Start Mininet topology with OF 1.3 switches" )
265 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
266 "switches to test intents, exits out if " +\
267 "topology did not start correctly"
268
269 main.step( "Starting Mininet topology with OF 1.3 switches" )
270 args = "--switch ovs,protocols=OpenFlow13"
271 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
272 main.topology,
273 args=args )
274 stepResult = topoResult
275 utilities.assert_equals( expect=main.TRUE,
276 actual=stepResult,
277 onpass="Successfully loaded topology",
278 onfail="Failed to load topology" )
279 # Exit if topology did not load properly
280 if not topoResult:
281 main.cleanup()
282 main.exit()
283
284 def CASE12( self, main ):
285 """
286 Assign mastership to controllers
287 """
288 import re
289
290 main.case( "Assign switches to controllers" )
291 main.step( "Assigning switches to controllers" )
292 main.caseExplanation = "Assign OF " + main.OFProtocol +\
293 " switches to ONOS nodes"
294
295 assignResult = main.TRUE
296 switchList = []
297
298 # Creates a list switch name, use getSwitch() function later...
299 for i in range( 1, ( main.numSwitch + 1 ) ):
300 switchList.append( 's' + str( i ) )
301
302 tempONOSip = []
303 for i in range( main.numCtrls ):
304 tempONOSip.append( main.ONOSip[ i ] )
305
306 assignResult = main.Mininet1.assignSwController( sw=switchList,
307 ip=tempONOSip,
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530308 port='6633' )
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800309 if not assignResult:
310 main.cleanup()
311 main.exit()
312
313 for i in range( 1, ( main.numSwitch + 1 ) ):
314 response = main.Mininet1.getSwController( "s" + str( i ) )
315 print( "Response is " + str( response ) )
316 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
317 assignResult = assignResult and main.TRUE
318 else:
319 assignResult = main.FALSE
320 stepResult = assignResult
321 utilities.assert_equals( expect=main.TRUE,
322 actual=stepResult,
323 onpass="Successfully assigned switches" +
324 "to controller",
325 onfail="Failed to assign switches to " +
326 "controller" )
327
sathishmad953462015-12-03 17:42:07 +0530328 def CASE13( self, main ):
329 """
330 Discover all hosts and store its data to a dictionary
331 """
332 main.case( "Discover all hosts" )
333
sathishmad953462015-12-03 17:42:07 +0530334 main.step( "Discover all hosts using pingall " )
335 stepResult = main.intentFunction.getHostsData( main )
336 utilities.assert_equals( expect=main.TRUE,
Jon Hall314b74a2017-05-24 16:25:52 -0700337 actual=stepResult,
338 onpass="Successfully discovered hosts",
339 onfail="Failed to discover hosts" )
sathishmad953462015-12-03 17:42:07 +0530340
sathishmc4362252016-04-20 18:29:48 +0530341 def CASE16( self, main ):
342 """
343 Balance Masters
344 """
345 main.case( "Balance mastership of switches" )
346 main.step( "Balancing mastership of switches" )
347
348 balanceResult = main.FALSE
349 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
350
351 utilities.assert_equals( expect=main.TRUE,
352 actual=balanceResult,
353 onpass="Successfully balanced mastership of switches",
354 onfail="Failed to balance mastership of switches" )
355
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800356 def CASE14( self, main ):
357 """
358 Stop mininet
359 """
360 main.log.report( "Stop Mininet topology" )
361 main.case( "Stop Mininet topology" )
362 main.caseExplanation = "Stopping the current mininet topology " +\
363 "to start up fresh"
364
365 main.step( "Stopping Mininet Topology" )
Jon Hall314b74a2017-05-24 16:25:52 -0700366 topoResult = main.Mininet1.stopNet()
Subhash Kumar Singhc73b3a72015-11-03 21:34:04 -0800367 stepResult = topoResult
368 utilities.assert_equals( expect=main.TRUE,
369 actual=stepResult,
370 onpass="Successfully stop mininet",
371 onfail="Failed to stop mininet" )
372 # Exit if topology did not load properly
373 if not topoResult:
374 main.cleanup()
375 main.exit()
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530376
sathishmc4362252016-04-20 18:29:48 +0530377 def CASE1000( self, main ):
378 """
379 Add host intents between 2 host:
380 - Discover hosts
381 - Add host intents
382 - Check intents
383 - Verify flows
384 - Ping hosts
385 - Reroute
386 - Link down
387 - Verify flows
388 - Check topology
389 - Ping hosts
390 - Link up
391 - Verify flows
392 - Check topology
393 - Ping hosts
394 - Remove intents
395 """
396 import time
397 import json
398 import re
399
400 # Assert variables - These variable's name|format must be followed
401 # if you want to use the wrapper function
402 assert main, "There is no main"
403 assert main.CLIs, "There is no main.CLIs"
404 assert main.Mininet1, "Mininet handle should be named Mininet1"
405 assert main.numSwitch, "Placed the total number of switch topology in \
406 main.numSwitch"
407
408 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
409
410 main.testName = "Host Intents"
411 main.case( main.testName + " Test - " + str( main.numCtrls ) +
412 " NODE(S) - OF " + main.OFProtocol )
413 main.caseExplanation = "This test case tests Host intents using " +\
414 str( main.numCtrls ) + " node(s) cluster;\n" +\
415 "Different type of hosts will be tested in " +\
416 "each step such as IPV6, Dual stack, VLAN " +\
417 "etc;\nThe test will use OF " + main.OFProtocol\
418 + " OVS running in Mininet"
419
420 main.step( "IPV6: Add host intents between h1 and h9" )
421 stepResult = main.TRUE
422 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700423 name='IPV6',
424 host1='h1',
425 host2='h9',
426 host1Id='00:00:00:00:00:01/-1',
427 host2Id='00:00:00:00:00:09/-1',
428 sw1='s5',
429 sw2='s2',
430 expectedLink=18 )
sathishmc4362252016-04-20 18:29:48 +0530431
432 utilities.assert_equals( expect=main.TRUE,
433 actual=stepResult,
434 onpass="IPV6: Host intent test successful " +
435 "between two IPV6 hosts",
436 onfail="IPV6: Host intent test failed " +
Jon Hall314b74a2017-05-24 16:25:52 -0700437 "between two IPV6 hosts" )
sathishmc4362252016-04-20 18:29:48 +0530438
439 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
440 stepResult = main.TRUE
441 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700442 name='DUALSTACK',
443 host1='h3',
444 host2='h11',
445 host1Id='00:00:00:00:00:03/-1',
446 host2Id='00:00:00:00:00:0B/-1',
447 sw1='s5',
448 sw2='s2',
449 expectedLink=18 )
sathishmc4362252016-04-20 18:29:48 +0530450
451 utilities.assert_equals( expect=main.TRUE,
452 actual=stepResult,
453 onpass="DUALSTACK: Host intent test " +
454 "successful between two " +
455 "dual stack host using IPV6",
456 onfail="DUALSTACK: Host intent test " +
457 "failed between two" +
458 "dual stack host using IPV6" )
459
460 main.step( "1HOP: Add host intents between h1 and h3" )
461 stepResult = main.TRUE
462 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700463 name='1HOP',
464 host1='h1',
465 host2='h9',
466 host1Id='00:00:00:00:00:01/-1',
467 host2Id='00:00:00:00:00:09/-1' )
sathishmc4362252016-04-20 18:29:48 +0530468
469 utilities.assert_equals( expect=main.TRUE,
470 actual=stepResult,
471 onpass="1HOP: Host intent test " +
472 "successful between two " +
473 "host using IPV6 in the same switch",
474 onfail="1HOP: Host intent test " +
475 "failed between two" +
476 "host using IPV6 in the same switch" )
477
478 main.step( "VLAN: Add vlan host intents between h5 and h24" )
479 stepResult = main.TRUE
480 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700481 name='VLAN1',
482 host1='h5',
483 host2='h24',
484 host1Id='00:00:00:00:00:05/100',
485 host2Id='00:00:00:00:00:18/100',
486 sw1='s5',
487 sw2='s2',
488 expectedLink=18 )
sathishmc4362252016-04-20 18:29:48 +0530489
490 utilities.assert_equals( expect=main.TRUE,
491 actual=stepResult,
492 onpass="VLAN: Host intent test " +
493 "successful between two " +
494 "host using IPV6 in the same VLAN",
495 onfail="VLAN1: Host intent test " +
496 "failed between two" +
497 "host using IPV6 in the same VLAN" )
498
499 main.intentFunction.report( main )
500
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530501 def CASE2000( self, main ):
502 """
503 add point intents between 2 hosts:
504 - Get device ids | ports
505 - Add point intents
506 - Check intents
507 - Verify flows
508 - Ping hosts
509 - Reroute
510 - Link down
511 - Verify flows
512 - Check topology
513 - Ping hosts
514 - Link up
515 - Verify flows
516 - Check topology
517 - Ping hosts
518 - Remove intents
519 """
520 import time
521 import json
522 import re
523
524 # Assert variables - These variable's name|format must be followed
525 # if you want to use the wrapper function
526 assert main, "There is no main"
527 assert main.CLIs, "There is no main.CLIs"
528 assert main.Mininet1, "Mininet handle should be named Mininet1"
529 assert main.numSwitch, "Placed the total number of switch topology in \
530 main.numSwitch"
531
532 main.testName = "Point Intents"
533 main.case( main.testName + " Test - " + str( main.numCtrls ) +
534 " NODE(S) - OF " + main.OFProtocol )
535 main.caseExplanation = "This test case will test point to point" +\
536 " intents using " + str( main.numCtrls ) +\
537 " node(s) cluster;\n" +\
538 "Different type of hosts will be tested in " +\
Jon Hall439c8912016-04-15 02:22:03 -0700539 "each step such as IPV6, Dual stack, VLAN etc" +\
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530540 ";\nThe test will use OF " + main.OFProtocol +\
541 " OVS running in Mininet"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530542 # No option point intents
543 main.step( "NOOPTION: Add point intents between h1 and h9, ipv6 hosts" )
544 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
545 stepResult = main.TRUE
546 stepResult = main.intentFunction.pointIntent(
547 main,
548 name="NOOPTION",
549 host1="h1",
550 host2="h9",
551 deviceId1="of:0000000000000005/1",
Jon Hall314b74a2017-05-24 16:25:52 -0700552 deviceId2="of:0000000000000006/1" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530553
554 utilities.assert_equals( expect=main.TRUE,
555 actual=stepResult,
556 onpass=main.assertReturnString,
557 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530558 stepResult = main.TRUE
559 main.step( "IPV6: Add point intents between h1 and h9" )
560 main.assertReturnString = "Assertion Result for IPV6 point intent\n"
561 stepResult = main.intentFunction.pointIntent(
562 main,
563 name="IPV6",
564 host1="h1",
565 host2="h9",
566 deviceId1="of:0000000000000005/1",
567 deviceId2="of:0000000000000006/1",
568 port1="",
569 port2="",
570 ethType="IPV6",
571 mac1="00:00:00:00:00:01",
572 mac2="00:00:00:00:00:09",
573 bandwidth="",
574 lambdaAlloc=False,
575 ipProto="",
576 ip1="",
577 ip2="",
578 tcp1="",
579 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700580 sw1="s5",
581 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530582 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530583 utilities.assert_equals( expect=main.TRUE,
584 actual=stepResult,
585 onpass=main.assertReturnString,
586 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530587 main.step( "IPV6_2: Add point intents between h1 and h9" )
588 main.assertReturnString = "Assertion Result for IPV6 no mac address point intents\n"
589 stepResult = main.intentFunction.pointIntent(
590 main,
591 name="IPV6_2",
592 host1="h1",
593 host2="h9",
594 deviceId1="of:0000000000000005/1",
595 deviceId2="of:0000000000000006/1",
596 ipProto="",
597 ip1="",
598 ip2="",
599 tcp1="",
600 tcp2="",
Jon Hall314b74a2017-05-24 16:25:52 -0700601 expectedLink="" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530602 utilities.assert_equals( expect=main.TRUE,
603 actual=stepResult,
604 onpass=main.assertReturnString,
605 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530606 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
sathishmad953462015-12-03 17:42:07 +0530607 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV6 using ICMP point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530608 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
609 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700610 main.log.debug( mac2 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530611 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
sathishmad953462015-12-03 17:42:07 +0530612 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
613 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530614 stepResult = main.intentFunction.pointIntent(
615 main,
616 name="SDNIP-ICMP",
617 host1="h1",
618 host2="h9",
619 deviceId1="of:0000000000000005/1",
620 deviceId2="of:0000000000000006/1",
621 mac1=mac1,
622 mac2=mac2,
623 ethType="IPV6",
624 ipProto=ipProto,
625 ip1=ip1,
626 ip2=ip2 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530627 utilities.assert_equals( expect=main.TRUE,
628 actual=stepResult,
629 onpass=main.assertReturnString,
630 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530631 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
sathishmad953462015-12-03 17:42:07 +0530632 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV6 using TCP point intents\n"
Jon Hall439c8912016-04-15 02:22:03 -0700633 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
634 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
635 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/128"
636 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/128"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530637 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
638 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
639 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530640 stepResult = main.intentFunction.pointIntentTcp(
641 main,
642 name="SDNIP-TCP",
Jon Hall439c8912016-04-15 02:22:03 -0700643 host1="h1",
644 host2="h9",
645 deviceId1="of:0000000000000005/1",
646 deviceId2="of:0000000000000006/1",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530647 mac1=mac1,
648 mac2=mac2,
Jon Hall439c8912016-04-15 02:22:03 -0700649 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530650 ipProto=ipProto,
651 ip1=ip1,
652 ip2=ip2,
653 tcp1=tcp1,
Jon Hall439c8912016-04-15 02:22:03 -0700654 tcp2=tcp2,
655 sw1="",
656 sw2="",
657 expectedLink="" )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530658 utilities.assert_equals( expect=main.TRUE,
sathishmad953462015-12-03 17:42:07 +0530659 actual=stepResult,
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530660 onpass=main.assertReturnString,
661 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530662 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
sathishmad953462015-12-03 17:42:07 +0530663 main.assertReturnString = "Assertion Result for Dualstack1 IPV6 with mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530664 stepResult = main.intentFunction.pointIntent(
665 main,
666 name="DUALSTACK1",
667 host1="h3",
668 host2="h11",
sathishmad953462015-12-03 17:42:07 +0530669 deviceId1="of:0000000000000005/3",
670 deviceId2="of:0000000000000006/3",
671 port1="",
672 port2="",
673 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530674 mac1="00:00:00:00:00:03",
675 mac2="00:00:00:00:00:0B",
676 bandwidth="",
677 lambdaAlloc=False,
678 ipProto="",
679 ip1="",
680 ip2="",
681 tcp1="",
682 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700683 sw1="s5",
684 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530685 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530686 utilities.assert_equals( expect=main.TRUE,
687 actual=stepResult,
688 onpass=main.assertReturnString,
689 onfail=main.assertReturnString )
sathishmad953462015-12-03 17:42:07 +0530690 main.step( "VLAN: Add point intents between h5 and h24" )
691 main.assertReturnString = "Assertion Result for VLAN IPV6 with mac address point intents\n"
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530692 stepResult = main.intentFunction.pointIntent(
693 main,
694 name="VLAN",
695 host1="h5",
sathishmad953462015-12-03 17:42:07 +0530696 host2="h24",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530697 deviceId1="of:0000000000000005/5",
sathishmad953462015-12-03 17:42:07 +0530698 deviceId2="of:0000000000000007/8",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530699 port1="",
700 port2="",
sathishmad953462015-12-03 17:42:07 +0530701 ethType="IPV6",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530702 mac1="00:00:00:00:00:05",
sathishmad953462015-12-03 17:42:07 +0530703 mac2="00:00:00:00:00:18",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530704 bandwidth="",
705 lambdaAlloc=False,
706 ipProto="",
707 ip1="",
708 ip2="",
709 tcp1="",
710 tcp2="",
Jon Hall439c8912016-04-15 02:22:03 -0700711 sw1="s5",
712 sw2="s2",
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530713 expectedLink=18 )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530714 utilities.assert_equals( expect=main.TRUE,
715 actual=stepResult,
716 onpass=main.assertReturnString,
717 onfail=main.assertReturnString )
sathishmad953462015-12-03 17:42:07 +0530718 main.step( "1HOP: Add point intents between h1 and h9" )
719 main.assertReturnString = "Assertion Result for 1HOP IPV6 with no mac address point intents\n"
sathishmc4362252016-04-20 18:29:48 +0530720 stepResult = main.intentFunction.pointIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700721 name='1HOP',
722 host1="h1",
723 host2="h9",
724 deviceId1="of:0000000000000005/1",
725 deviceId2="of:0000000000000006/1" )
Jon Hall439c8912016-04-15 02:22:03 -0700726 utilities.assert_equals( expect=main.TRUE,
727 actual=stepResult,
728 onpass=main.assertReturnString,
729 onfail=main.assertReturnString )
730 main.intentFunction.report( main )
731
732 def CASE3000( self, main ):
733 """
734 Add single point to multi point intents
735 - Get device ids
736 - Add single point to multi point intents
737 - Check intents
738 - Verify flows
739 - Ping hosts
740 - Reroute
741 - Link down
742 - Verify flows
743 - Check topology
744 - Ping hosts
745 - Link up
746 - Verify flows
747 - Check topology
748 - Ping hosts
749 - Remove intents
750 """
751 import time
752 import json
753 import re
754 assert main, "There is no main"
755 assert main.CLIs, "There is no main.CLIs"
756 assert main.Mininet1, "Mininet handle should be named Mininet1"
757 assert main.numSwitch, "Placed the total number of switch topology in \
758 main.numSwitch"
759 main.testName = "Single to Multi Point Intents"
760 main.case( main.testName + " Test - " + str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol )
761 main.caseExplanation = "This test case will test single point to" +\
762 " multi point intents using " +\
763 str( main.numCtrls ) + " node(s) cluster;\n" +\
764 "Different type of hosts will be tested in " +\
765 "each step such as IPV6, Dual stack, VLAN etc" +\
766 ";\nThe test will use OF " + main.OFProtocol +\
767 " OVS running in Mininet "
768 main.step( "NOOPTION: Add single point to multi point intents" )
769 hostNames = [ 'h1', 'h9', 'h17' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700770 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall439c8912016-04-15 02:22:03 -0700771 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with no options set\n"
772 stepResult = main.TRUE
773 stepResult = main.intentFunction.singleToMultiIntent(
774 main,
775 name="NOOPTION",
776 hostNames=hostNames,
777 devices=devices,
778 sw1="s5",
779 sw2="s2",
Jon Hall314b74a2017-05-24 16:25:52 -0700780 expectedLink=18 )
Jon Hall439c8912016-04-15 02:22:03 -0700781 utilities.assert_equals( expect=main.TRUE,
782 actual=stepResult,
783 onpass=main.assertReturnString,
784 onfail=main.assertReturnString )
785 main.step( "IPV6: Add single point to multi point intents" )
786 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses\n"
787 hostNames = [ 'h1', 'h9', 'h17' ]
788 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700789 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 -0700790 stepResult = main.TRUE
791 stepResult = main.intentFunction.singleToMultiIntent(
792 main,
793 name="IPV6",
794 hostNames=hostNames,
795 devices=devices,
796 macs=macs,
797 ethType="IPV6",
798 sw1="",
Jon Hall314b74a2017-05-24 16:25:52 -0700799 sw2="" )
Jon Hall439c8912016-04-15 02:22:03 -0700800 utilities.assert_equals( expect=main.TRUE,
801 actual=stepResult,
802 onpass=main.assertReturnString,
803 onfail=main.assertReturnString )
804 main.step( "IPV6_2: Add single point to multi point intents" )
805 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and no MAC addresses\n"
806 hostNames = [ 'h1', 'h9', 'h17' ]
807 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
808 stepResult = main.TRUE
809 stepResult = main.intentFunction.singleToMultiIntent(
810 main,
811 name="IPV6_2",
812 hostNames=hostNames,
813 devices=devices,
814 ethType="IPV6",
815 sw1="",
Jon Hall314b74a2017-05-24 16:25:52 -0700816 sw2="" )
Jon Hall439c8912016-04-15 02:22:03 -0700817 utilities.assert_equals( expect=main.TRUE,
818 actual=stepResult,
819 onpass=main.assertReturnString,
820 onfail=main.assertReturnString )
821 main.step( "VLAN: Add single point to multi point intents" )
822 main.assertReturnString = "Assertion results for IPV6 single to multi point intent with IPV6 type and MAC addresses in the same VLAN\n"
823 hostNames = [ 'h5', 'h24' ]
824 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700825 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
Jon Hall439c8912016-04-15 02:22:03 -0700826 stepResult = main.TRUE
827 stepResult = main.intentFunction.singleToMultiIntent(
828 main,
829 name="IPV6",
830 hostNames=hostNames,
831 devices=devices,
832 macs=macs,
833 ethType="IPV6",
834 sw1="",
Jon Hall314b74a2017-05-24 16:25:52 -0700835 sw2="" )
Jon Hall439c8912016-04-15 02:22:03 -0700836 utilities.assert_equals( expect=main.TRUE,
837 actual=stepResult,
838 onpass=main.assertReturnString,
839 onfail=main.assertReturnString )
840 main.intentFunction.report( main )
Jon Hall314b74a2017-05-24 16:25:52 -0700841
Jon Hall439c8912016-04-15 02:22:03 -0700842 def CASE4000( self, main ):
843 """
844 Add multi point to single point intents
845 - Get device ids
846 - Add multi point to single point intents
847 - Check intents
848 - Verify flows
849 - Ping hosts
850 - Reroute
851 - Link down
852 - Verify flows
853 - Check topology
854 - Ping hosts
855 - Link up
856 - Verify flows
857 - Check topology
858 - Ping hosts
859 - Remove intents
860 """
861 assert main, "There is no main"
862 assert main.CLIs, "There is no main.CLIs"
863 assert main.Mininet1, "Mininet handle should be named Mininet1"
864 assert main.numSwitch, "Placed the total number of switch topology in \
865 main.numSwitch"
866
867 main.testName = "Multi To Single Point Intents"
868 main.case( main.testName + " Test - " + str( main.numCtrls ) +
869 " NODE(S) - OF " + main.OFProtocol )
870 main.caseExplanation = "This test case will test single point to" +\
871 " multi point intents using " +\
872 str( main.numCtrls ) + " node(s) cluster;\n" +\
873 "Different type of hosts will be tested in " +\
874 "each step such as IPV6, Dual stack, VLAN etc" +\
875 ";\nThe test will use OF " + main.OFProtocol +\
876 " OVS running in Mininet"
877
878 main.step( "NOOPTION: Add multi point to single point intents" )
879 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
880 stepResult = main.TRUE
881 hostNames = [ 'h17', 'h9' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700882 devices = [ 'of:0000000000000007/1', 'of:0000000000000006/1' ]
Jon Hall439c8912016-04-15 02:22:03 -0700883 stepResult = main.intentFunction.multiToSingleIntent(
884 main,
885 name="NOOPTION",
886 hostNames=hostNames,
887 devices=devices,
888 sw1="s6",
889 sw2="s2",
890 expectedLink=18 )
891 utilities.assert_equals( expect=main.TRUE,
892 actual=stepResult,
893 onpass=main.assertReturnString,
894 onfail=main.assertReturnString )
895 main.step( "IPV6: Add multi point to single point intents" )
896 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and MAC addresses\n"
897 hostNames = [ 'h1', 'h9', 'h17' ]
898 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700899 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 -0700900 stepResult = main.TRUE
901 installResult = main.intentFunction.multiToSingleIntent(
902 main,
903 name="IPV6",
904 hostNames=hostNames,
905 devices=devices,
906 macs=macs,
907 ethType="IPV6",
908 sw1="",
909 sw2="",
910 expectedLink="" )
911 utilities.assert_equals( expect=main.TRUE,
912 actual=stepResult,
913 onpass=main.assertReturnString,
914 onfail=main.assertReturnString )
915 main.step( "IPV6_2: Add multi point to single point intents" )
916 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses\n"
917 hostNames = [ 'h1', 'h9' ]
918 devices = [ 'of:0000000000000005/1', 'of:0000000000000006/1' ]
919 stepResult = main.TRUE
920 stepResult = main.intentFunction.multiToSingleIntent(
921 main,
922 name="IPV6_2",
923 hostNames=hostNames,
924 devices=devices,
925 ethType="IPV6",
926 sw1="",
927 sw2="",
Jon Hall314b74a2017-05-24 16:25:52 -0700928 expectedLink="" )
Jon Hall439c8912016-04-15 02:22:03 -0700929 utilities.assert_equals( expect=main.TRUE,
930 actual=stepResult,
931 onpass=main.assertReturnString,
932 onfail=main.assertReturnString )
933
934 main.step( "VLAN: Add multi point to single point intents" )
935 main.assertReturnString = "Assertion results for IPV6 multi to single point intent with IPV6 type and no MAC addresses in the same VLAN\n"
936 hostNames = [ 'h5', 'h24' ]
937 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -0700938 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
Jon Hall439c8912016-04-15 02:22:03 -0700939 stepResult = main.TRUE
940 stepResult = main.intentFunction.multiToSingleIntent(
941 main,
942 name="VLAN",
943 hostNames=hostNames,
944 devices=devices,
945 macs=macs,
946 ethType="IPV6",
947 sw1="",
948 sw2="",
Jon Hall314b74a2017-05-24 16:25:52 -0700949 expectedLink="" )
Jon Hall439c8912016-04-15 02:22:03 -0700950 utilities.assert_equals( expect=main.TRUE,
951 actual=stepResult,
952 onpass=main.assertReturnString,
953 onfail=main.assertReturnString )
954 main.intentFunction.report( main )
955
956 def CASE5000( self, main ):
957 """
958 Tests Host Mobility
959 Modifies the topology location of h1
960 """
961 assert main, "There is no main"
962 assert main.CLIs, "There is no main.CLIs"
963 assert main.Mininet1, "Mininet handle should be named Mininet1"
964 assert main.numSwitch, "Placed the total number of switch topology in \
965 main.numSwitch"
966 main.case( "Test host mobility with host intents " )
967 main.step( "Testing host mobility by moving h1 from s5 to s6" )
968 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
969
Jon Hall314b74a2017-05-24 16:25:52 -0700970 main.log.info( "Moving h1 from s5 to s6" )
971 main.Mininet1.moveHostv6( "h1", "s5", "s6" )
Jon Hall439c8912016-04-15 02:22:03 -0700972 main.intentFunction.getHostsData( main )
973 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
974
975 utilities.assert_equals( expect="of:0000000000000006",
976 actual=h1PostMove,
977 onpass="Mobility: Successfully moved h1 to s6",
978 onfail="Mobility: Failed to move h1 to s6" +
979 " to single point intents" +
980 " with IPV6 type and MAC addresses" +
981 " in the same VLAN" )
982 main.step( "IPV6: Add host intents between h1 and h9" )
983 main.assertReturnString = "Assert result for IPV6 host intent between h1, moved, and h9\n"
984 stepResult = main.TRUE
985 stepResult = main.intentFunction.hostIntent( main,
Jon Hall314b74a2017-05-24 16:25:52 -0700986 name='IPV6 Mobility IPV6',
987 host1='h1',
988 host2='h9',
989 host1Id='00:00:00:00:00:01/-1',
990 host2Id='00:00:00:00:00:09/-1' )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530991
992 utilities.assert_equals( expect=main.TRUE,
993 actual=stepResult,
994 onpass=main.assertReturnString,
995 onfail=main.assertReturnString )
Subhash Kumar Singh5ea4d302015-11-05 14:36:52 +0530996 main.intentFunction.report( main )
sathishmc4362252016-04-20 18:29:48 +0530997
998 def CASE6000( self, main ):
999 """
1000 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1001 """
1002 assert main, "There is no main"
1003 assert main.CLIs, "There is no main.CLIs"
1004 assert main.Mininet1, "Mininet handle should be named Mininet1"
1005 assert main.numSwitch, "Placed the total number of switch topology in \
1006 main.numSwitch"
1007 main.case( "Test Multi to Single End Point Failure" )
1008 main.step( "NOOPTION: test end point failure for multi point to single point intents" )
1009 main.assertReturnString = "Assertion results for IPV6 multi to single \
1010 point intent end point failure with no options set\n"
1011 hostNames = [ 'h8', 'h17' ]
1012 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1013 testResult = main.TRUE
1014 testResult = main.intentFunction.testEndPointFail(
1015 main,
1016 name="NOOPTION",
1017 test="MultipletoSingle",
1018 hostNames=hostNames,
1019 devices=devices,
1020 sw1="s6",
1021 sw2="s2",
1022 sw3="s4",
1023 sw4="s1",
1024 sw5="s3",
1025 expectedLink1=16,
1026 expectedLink2=14 )
1027 utilities.assert_equals( expect=main.TRUE,
1028 actual=testResult,
1029 onpass=main.assertReturnString,
1030 onfail=main.assertReturnString )
1031
1032 main.step( "IPV6: test end point failure for multi point to single point intents" )
1033 main.assertReturnString = "Assertion results for IPV6 multi to single \
1034 point intent end point failure with IPV6 type and MAC addresses\n"
1035 hostNames = [ 'h8', 'h9', 'h17' ]
1036 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001037 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 +05301038 testResult = main.TRUE
1039 testResult = main.intentFunction.testEndPointFail(
1040 main,
1041 test="MultipletoSingle",
1042 name="IPV6",
1043 hostNames=hostNames,
1044 devices=devices,
1045 macs=macs,
1046 ethType="IPV6",
1047 sw1="s6",
1048 sw2="s2",
1049 sw3="s4",
1050 sw4="s1",
1051 sw5="s3",
1052 expectedLink1=16,
1053 expectedLink2=14 )
1054 utilities.assert_equals( expect=main.TRUE,
1055 actual=testResult,
1056 onpass=main.assertReturnString,
1057 onfail=main.assertReturnString )
1058
1059 main.step( "IPV6_2: test end point faliure for multi point to single point intents" )
1060 main.assertReturnString = "Assertion results for IPV6 multi to single \
1061 point intent end point failure with IPV6 type and no MAC addresses\n"
1062 hostNames = [ 'h8', 'h17' ]
1063 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1064 testResult = main.TRUE
1065 testResult = main.intentFunction.testEndPointFail(
1066 main,
1067 test="MultipletoSingle",
1068 name="IPV6_2",
1069 hostNames=hostNames,
1070 devices=devices,
1071 ethType="IPV6",
1072 sw1="s6",
1073 sw2="s2",
1074 sw3="s4",
1075 sw4="s1",
1076 sw5="s3",
1077 expectedLink1=16,
1078 expectedLink2=14 )
1079
1080 utilities.assert_equals( expect=main.TRUE,
1081 actual=testResult,
1082 onpass=main.assertReturnString,
1083 onfail=main.assertReturnString )
1084
1085 main.step( "VLAN: test end point failure for multi point to single point intents" )
1086 main.assertReturnString = "Assertion results for IPV6 multi to single \
1087 point intent end point failure with IPV6 type and no MAC addresses in the same VLAN\n"
1088 hostNames = [ 'h5', 'h24' ]
1089 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001090 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
sathishmc4362252016-04-20 18:29:48 +05301091 testResult = main.TRUE
1092 testResult = main.intentFunction.testEndPointFail(
1093 main,
1094 test="MultipletoSingle",
1095 name="VLAN",
1096 hostNames=hostNames,
1097 devices=devices,
1098 ethType="IPV6",
1099 sw1="s6",
1100 sw2="s2",
1101 sw3="s4",
1102 sw4="s1",
1103 sw5="s3",
1104 expectedLink1=16,
1105 expectedLink2=14 )
1106 utilities.assert_equals( expect=main.TRUE,
1107 actual=testResult,
1108 onpass=main.assertReturnString,
1109 onfail=main.assertReturnString )
1110
1111 main.case( "Test Single to Multiple End Point Failure" )
1112 main.step( "NOOPTION: test end point failure for single point to multi point intents" )
1113 main.assertReturnString = "Assertion results for IPV6 single to multi \
1114 point intent end point failure with no options set\n"
1115 hostNames = [ 'h8', 'h17' ]
1116 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1117 testResult = main.TRUE
1118 testResult = main.intentFunction.testEndPointFail(
1119 main,
1120 test="SingletoMultiple",
1121 name="NOOPTION",
1122 hostNames=hostNames,
1123 devices=devices,
1124 sw1="s6",
1125 sw2="s2",
1126 sw3="s4",
1127 sw4="s1",
1128 sw5="s3",
1129 expectedLink1=16,
1130 expectedLink2=14 )
1131 utilities.assert_equals( expect=main.TRUE,
1132 actual=testResult,
1133 onpass=main.assertReturnString,
1134 onfail=main.assertReturnString )
1135 main.step( "IPV6: test end point failure for single point to multi point intents" )
1136 main.assertReturnString = "Assertion results for IPV6 single to multi \
1137 point intent end point failure with IPV6 type and MAC addresses\n"
1138 hostNames = [ 'h8', 'h9', 'h17' ]
1139 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/1', 'of:0000000000000007/1' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001140 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 +05301141 testResult = main.TRUE
1142 testResult = main.intentFunction.testEndPointFail(
1143 main,
1144 test="SingletoMultiple",
1145 name="IPV6",
1146 hostNames=hostNames,
1147 devices=devices,
1148 ethType="IPV6",
1149 macs=macs,
1150 sw1="s6",
1151 sw2="s2",
1152 sw3="s4",
1153 sw4="s1",
1154 sw5="s3",
1155 expectedLink1=16,
1156 expectedLink2=14 )
1157 utilities.assert_equals( expect=main.TRUE,
1158 actual=testResult,
1159 onpass=main.assertReturnString,
1160 onfail=main.assertReturnString )
1161
1162 main.step( "IPV6_2: test end point failure for single point to multi point intents" )
1163 main.assertReturnString = "Assertion results for IPV6 single to multi\
1164 point intent endpoint failure with IPV6 type and no MAC addresses\n"
1165 hostNames = [ 'h8', 'h17' ]
1166 devices = [ 'of:0000000000000005/8', 'of:0000000000000007/1' ]
1167 testResult = main.TRUE
1168 testResult = main.intentFunction.testEndPointFail(
1169 main,
1170 test="SingletoMultiple",
1171 name="IPV6_2",
1172 hostNames=hostNames,
1173 devices=devices,
1174 ethType="IPV6",
1175 sw1="s6",
1176 sw2="s2",
1177 sw3="s4",
1178 sw4="s1",
1179 sw5="s3",
1180 expectedLink1=16,
1181 expectedLink2=14 )
1182 utilities.assert_equals( expect=main.TRUE,
1183 actual=testResult,
1184 onpass=main.assertReturnString,
1185 onfail=main.assertReturnString )
1186
1187 main.step( "VLAN: test end point failure for single point to multi point intents" )
1188 main.assertReturnString = "Assertion results for IPV6 single to multi point\
1189 intent endpoint failure with IPV6 type and MAC addresses in the same VLAN\n"
1190 hostNames = [ 'h5', 'h24' ]
1191 devices = [ 'of:0000000000000005/5', 'of:0000000000000007/8' ]
Jon Hall314b74a2017-05-24 16:25:52 -07001192 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:18' ]
sathishmc4362252016-04-20 18:29:48 +05301193 testResult = main.TRUE
1194 testResult = main.intentFunction.testEndPointFail(
1195 main,
1196 test="SingletoMultiple",
1197 name="IPV6",
1198 hostNames=hostNames,
1199 devices=devices,
1200 macs=macs,
1201 ethType="IPV6",
1202 sw1="s6",
1203 sw2="s2",
1204 sw3="s4",
1205 sw4="s1",
1206 sw5="s3",
1207 expectedLink1=16,
1208 expectedLink2=14 )
1209 utilities.assert_equals( expect=main.TRUE,
1210 actual=testResult,
1211 onpass=main.assertReturnString,
1212 onfail=main.assertReturnString )
1213
1214 main.intentFunction.report( main )