blob: 8c6c8d51ff1f5e06932571fb5fe9e21a835db97b [file] [log] [blame]
kelvin-onlab44147802015-07-27 17:57:31 -07001
2# Testing the basic intent functionality of ONOS
Jeremy2f190ca2016-01-29 15:23:57 -08003# TODO: Replace the CLI calls with REST API equivalents as they become available.
4# - May need to write functions in the onosrestdriver.py file to do this
5# TODO: Complete implementation of case 3000, 4000, and 6000 as REST API allows
6# -Currently there is no support in the REST API for Multi to Single and Single to Multi point intents
7# As such, these cases are incomplete and should not be enabled in the .params file
kelvin-onlab44147802015-07-27 17:57:31 -07008
9import time
10import json
11
12class FUNCintentRest:
13
14 def __init__( self ):
15 self.default = ''
16
17 def CASE1( self, main ):
18 import time
kelvin-onlab44147802015-07-27 17:57:31 -070019 import imp
Jon Hallf7234882015-08-28 13:16:31 -070020 import re
kelvin-onlab44147802015-07-27 17:57:31 -070021
22 """
23 - Construct tests variables
24 - GIT ( optional )
25 - Checkout ONOS master branch
26 - Pull latest ONOS code
27 - Building ONOS ( optional )
28 - Install ONOS package
29 - Build ONOS package
30 """
31
32 main.case( "Constructing test variables and building ONOS package" )
33 main.step( "Constructing test variables" )
34 main.caseExplanation = "This test case is mainly for loading " +\
35 "from params file, and pull and build the " +\
36 " latest ONOS package"
37 stepResult = main.FALSE
38
39 # Test variables
40 try:
Jon Hallf7234882015-08-28 13:16:31 -070041 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
kelvin-onlab44147802015-07-27 17:57:31 -070042 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
43 gitBranch = main.params[ 'GIT' ][ 'branch' ]
44 main.dependencyPath = main.testOnDirectory + \
45 main.params[ 'DEPENDENCY' ][ 'path' ]
46 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
47 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
48 if main.ONOSbench.maxNodes:
49 main.maxNodes = int( main.ONOSbench.maxNodes )
50 else:
51 main.maxNodes = 0
52 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
53 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
54 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
55 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
Jeremy2f190ca2016-01-29 15:23:57 -080056 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
57 main.removeIntentsleeo = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
kelvin-onlab44147802015-07-27 17:57:31 -070058 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
59 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
kelvin-onlab0e684682015-08-11 18:51:41 -070060 main.addIntentSleep = int( main.params[ 'SLEEP' ][ 'addIntent' ] )
Jeremy2f190ca2016-01-29 15:23:57 -080061 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
kelvin-onlab44147802015-07-27 17:57:31 -070062 gitPull = main.params[ 'GIT' ][ 'pull' ]
63 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
64 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
65 main.cellData = {} # for creating cell file
66 main.hostsData = {}
67 main.CLIs = []
Jeremye1ea0602016-02-08 16:35:05 -080068 main.CLIs2 = []
kelvin-onlab44147802015-07-27 17:57:31 -070069 main.ONOSip = []
Jeremy2f190ca2016-01-29 15:23:57 -080070 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
71 main.scapyHosts = [] # List of scapy hosts for iterating
72 main.assertReturnString = '' # Assembled assert return string
kelvin-onlab44147802015-07-27 17:57:31 -070073
74 main.ONOSip = main.ONOSbench.getOnosIps()
Jeremy2f190ca2016-01-29 15:23:57 -080075 print main.ONOSip
kelvin-onlab44147802015-07-27 17:57:31 -070076
77 # Assigning ONOS cli handles to a list
Jon Hallf7234882015-08-28 13:16:31 -070078 try:
79 for i in range( 1, main.maxNodes + 1 ):
80 main.CLIs.append( getattr( main, 'ONOSrest' + str( i ) ) )
Jeremye1ea0602016-02-08 16:35:05 -080081 main.CLIs2.append( getattr( main, 'ONOScli' + str( i ) ) )
Jon Hallf7234882015-08-28 13:16:31 -070082 except AttributeError:
83 main.log.warn( "A " + str( main.maxNodes ) + " node cluster " +
84 "was defined in env variables, but only " +
85 str( len( main.CLIs ) ) +
86 " nodes were defined in the .topo file. " +
87 "Using " + str( len( main.CLIs ) ) +
88 " nodes for the test." )
kelvin-onlab44147802015-07-27 17:57:31 -070089
90 # -- INIT SECTION, ONLY RUNS ONCE -- #
91 main.startUp = imp.load_source( wrapperFile1,
92 main.dependencyPath +
93 wrapperFile1 +
94 ".py" )
95
96 main.intentFunction = imp.load_source( wrapperFile2,
97 main.dependencyPath +
98 wrapperFile2 +
99 ".py" )
100
101 main.topo = imp.load_source( wrapperFile3,
102 main.dependencyPath +
103 wrapperFile3 +
104 ".py" )
105
Jon Hallf7234882015-08-28 13:16:31 -0700106 copyResult1 = main.ONOSbench.scp( main.Mininet1,
107 main.dependencyPath +
108 main.topology,
Jeremy2f190ca2016-01-29 15:23:57 -0800109 main.Mininet1.home + "custom/",
Jon Hallf7234882015-08-28 13:16:31 -0700110 direction="to" )
Jeremye1ea0602016-02-08 16:35:05 -0800111 if main.CLIs and main.CLIs2:
kelvin-onlab44147802015-07-27 17:57:31 -0700112 stepResult = main.TRUE
113 else:
114 main.log.error( "Did not properly created list of ONOS CLI handle" )
115 stepResult = main.FALSE
116 except Exception as e:
117 main.log.exception(e)
118 main.cleanup()
119 main.exit()
120
121 utilities.assert_equals( expect=main.TRUE,
122 actual=stepResult,
123 onpass="Successfully construct " +
124 "test variables ",
125 onfail="Failed to construct test variables" )
126
127 if gitPull == 'True':
128 main.step( "Building ONOS in " + gitBranch + " branch" )
129 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
130 stepResult = onosBuildResult
131 utilities.assert_equals( expect=main.TRUE,
132 actual=stepResult,
133 onpass="Successfully compiled " +
134 "latest ONOS",
135 onfail="Failed to compile " +
136 "latest ONOS" )
137 else:
138 main.log.warn( "Did not pull new code so skipping mvn " +
139 "clean install" )
140 main.ONOSbench.getVersion( report=True )
141
142 def CASE2( self, main ):
143 """
144 - Set up cell
145 - Create cell file
146 - Set cell file
147 - Verify cell file
148 - Kill ONOS process
149 - Uninstall ONOS cluster
150 - Verify ONOS start up
151 - Install ONOS cluster
152 - Connect to cli
153 """
154
155 # main.scale[ 0 ] determines the current number of ONOS controller
156 main.numCtrls = int( main.scale[ 0 ] )
Jeremyeb51cb12016-03-28 17:53:35 -0700157 main.flowCompiler = "Flow Rules"
kelvin-onlab44147802015-07-27 17:57:31 -0700158
159 main.case( "Starting up " + str( main.numCtrls ) +
160 " node(s) ONOS cluster" )
161 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
162 " node(s) ONOS cluster"
163
164
165
166 #kill off all onos processes
167 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800168 " before initiating environment setup" )
kelvin-onlab44147802015-07-27 17:57:31 -0700169
Jeremy2f190ca2016-01-29 15:23:57 -0800170 time.sleep( main.startUpSleep )
Jeremy42df2e72016-02-23 16:37:46 -0800171
Jeremy2f190ca2016-01-29 15:23:57 -0800172 main.step( "Uninstalling ONOS package" )
173 onosUninstallResult = main.TRUE
174 for ip in main.ONOSip:
175 onosUninstallResult = onosUninstallResult and \
176 main.ONOSbench.onosUninstall( nodeIp=ip )
177 stepResult = onosUninstallResult
178 utilities.assert_equals( expect=main.TRUE,
179 actual=stepResult,
180 onpass="Successfully uninstalled ONOS package",
181 onfail="Failed to uninstall ONOS package" )
182
Jeremy42df2e72016-02-23 16:37:46 -0800183 time.sleep( main.startUpSleep )
184
kelvin-onlab44147802015-07-27 17:57:31 -0700185 for i in range( main.maxNodes ):
186 main.ONOSbench.onosDie( main.ONOSip[ i ] )
187
188 print "NODE COUNT = ", main.numCtrls
189
190 tempOnosIp = []
191 for i in range( main.numCtrls ):
192 tempOnosIp.append( main.ONOSip[i] )
193
194 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
195 "temp", main.Mininet1.ip_address,
196 main.apps, tempOnosIp )
197
198 main.step( "Apply cell to environment" )
199 cellResult = main.ONOSbench.setCell( "temp" )
200 verifyResult = main.ONOSbench.verifyCell()
201 stepResult = cellResult and verifyResult
202 utilities.assert_equals( expect=main.TRUE,
203 actual=stepResult,
204 onpass="Successfully applied cell to " + \
205 "environment",
206 onfail="Failed to apply cell to environment " )
207
208 main.step( "Creating ONOS package" )
209 packageResult = main.ONOSbench.onosPackage()
210 stepResult = packageResult
211 utilities.assert_equals( expect=main.TRUE,
212 actual=stepResult,
213 onpass="Successfully created ONOS package",
214 onfail="Failed to create ONOS package" )
215
216 time.sleep( main.startUpSleep )
kelvin-onlab44147802015-07-27 17:57:31 -0700217 main.step( "Installing ONOS package" )
218 onosInstallResult = main.TRUE
219 for i in range( main.numCtrls ):
220 onosInstallResult = onosInstallResult and \
221 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
222 stepResult = onosInstallResult
223 utilities.assert_equals( expect=main.TRUE,
224 actual=stepResult,
225 onpass="Successfully installed ONOS package",
226 onfail="Failed to install ONOS package" )
227
228 time.sleep( main.startUpSleep )
229 main.step( "Starting ONOS service" )
230 stopResult = main.TRUE
231 startResult = main.TRUE
232 onosIsUp = main.TRUE
233
234 for i in range( main.numCtrls ):
235 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
236 if onosIsUp == main.TRUE:
237 main.log.report( "ONOS instance is up and ready" )
238 else:
239 main.log.report( "ONOS instance may not be up, stop and " +
240 "start ONOS again " )
241 for i in range( main.numCtrls ):
242 stopResult = stopResult and \
243 main.ONOSbench.onosStop( main.ONOSip[ i ] )
244 for i in range( main.numCtrls ):
245 startResult = startResult and \
246 main.ONOSbench.onosStart( main.ONOSip[ i ] )
247 stepResult = onosIsUp and stopResult and startResult
248 utilities.assert_equals( expect=main.TRUE,
249 actual=stepResult,
250 onpass="ONOS service is ready",
251 onfail="ONOS service did not start properly" )
252
Jeremy2f190ca2016-01-29 15:23:57 -0800253 # Start an ONOS cli to provide functionality that is not currently
Jeremye1ea0602016-02-08 16:35:05 -0800254 # supported by the Rest API remove this when Leader Checking is supported
255 # by the REST API
Jeremy2f190ca2016-01-29 15:23:57 -0800256
Jeremye1ea0602016-02-08 16:35:05 -0800257 main.step( "Start ONOS cli" )
258 cliResult = main.TRUE
259 for i in range( main.numCtrls ):
260 cliResult = cliResult and \
261 main.CLIs2[ i ].startOnosCli( main.ONOSip[ i ] )
262 stepResult = cliResult
263 utilities.assert_equals( expect=main.TRUE,
264 actual=stepResult,
265 onpass="Successfully start ONOS cli",
266 onfail="Failed to start ONOS cli" )
Jeremy2f190ca2016-01-29 15:23:57 -0800267
kelvin-onlab44147802015-07-27 17:57:31 -0700268 # Remove the first element in main.scale list
269 main.scale.remove( main.scale[ 0 ] )
270
Jeremy2f190ca2016-01-29 15:23:57 -0800271 main.intentFunction.report( main )
272
kelvin-onlab44147802015-07-27 17:57:31 -0700273 def CASE8( self, main ):
Jeremy2f190ca2016-01-29 15:23:57 -0800274 # OLD FUNCintentRest CASE 8
275 # This remains here for archiving and reference purposes and will be
276 # removed when the new FUNCintentRest is verified to work.
277 # """
278 # Compare Topo
279 # """
280 # import json
281
282 # main.case( "Compare ONOS Topology view to Mininet topology" )
283 # main.caseExplanation = "Compare topology elements between Mininet" +\
284 # " and ONOS"
285
286 # main.step( "Gathering topology information" )
287 # # TODO: add a paramaterized sleep here
288 # devicesResults = main.TRUE # Overall Boolean for device correctness
289 # linksResults = main.TRUE # Overall Boolean for link correctness
290 # hostsResults = main.TRUE # Overall Boolean for host correctness
291 # devices = main.topo.getAllDevices( main )
292 # hosts = main.topo.getAllHosts( main )
293 # ports = main.topo.getAllPorts( main )
294 # links = main.topo.getAllLinks( main )
295 # clusters = main.topo.getAllClusters( main )
296
297 # mnSwitches = main.Mininet1.getSwitches()
298 # mnLinks = main.Mininet1.getLinks()
299 # mnHosts = main.Mininet1.getHosts()
300
301 # main.step( "Comparing MN topology to ONOS topology" )
302 # for controller in range( main.numCtrls ):
303 # controllerStr = str( controller + 1 )
304 # if devices[ controller ] and ports[ controller ] and\
305 # "Error" not in devices[ controller ] and\
306 # "Error" not in ports[ controller ]:
307
308 # currentDevicesResult = main.Mininet1.compareSwitches(
309 # mnSwitches,
310 # json.loads( devices[ controller ] ),
311 # json.loads( ports[ controller ] ) )
312 # else:
313 # currentDevicesResult = main.FALSE
314 # utilities.assert_equals( expect=main.TRUE,
315 # actual=currentDevicesResult,
316 # onpass="ONOS" + controllerStr +
317 # " Switches view is correct",
318 # onfail="ONOS" + controllerStr +
319 # " Switches view is incorrect" )
320
321 # if links[ controller ] and "Error" not in links[ controller ]:
322 # currentLinksResult = main.Mininet1.compareLinks(
323 # mnSwitches, mnLinks,
324 # json.loads( links[ controller ] ) )
325 # else:
326 # currentLinksResult = main.FALSE
327 # utilities.assert_equals( expect=main.TRUE,
328 # actual=currentLinksResult,
329 # onpass="ONOS" + controllerStr +
330 # " links view is correct",
331 # onfail="ONOS" + controllerStr +
332 # " links view is incorrect" )
333
334 # if hosts[ controller ] or "Error" not in hosts[ controller ]:
335 # currentHostsResult = main.Mininet1.compareHosts(
336 # mnHosts,
337 # json.loads( hosts[ controller ] ) )
338 # else:
339 # currentHostsResult = main.FALSE
340 # utilities.assert_equals( expect=main.TRUE,
341 # actual=currentHostsResult,
342 # onpass="ONOS" + controllerStr +
343 # " hosts exist in Mininet",
344 # onfail="ONOS" + controllerStr +
345 # " hosts don't match Mininet" )
346
347 # NEW FUNCintentRest Case 8 as based off of the CASE 8 from FUNCintent
kelvin-onlab44147802015-07-27 17:57:31 -0700348 """
Jeremy2f190ca2016-01-29 15:23:57 -0800349 Compare ONOS Topology to Mininet Topology
kelvin-onlab44147802015-07-27 17:57:31 -0700350 """
351 import json
352
353 main.case( "Compare ONOS Topology view to Mininet topology" )
354 main.caseExplanation = "Compare topology elements between Mininet" +\
355 " and ONOS"
356
Jeremy2f190ca2016-01-29 15:23:57 -0800357 main.log.info( "Gathering topology information from Mininet" )
358 devicesResults = main.FALSE # Overall Boolean for device correctness
359 linksResults = main.FALSE # Overall Boolean for link correctness
360 hostsResults = main.FALSE # Overall Boolean for host correctness
361 deviceFails = [] # Nodes where devices are incorrect
362 linkFails = [] # Nodes where links are incorrect
363 hostFails = [] # Nodes where hosts are incorrect
364 attempts = main.checkTopoAttempts # Remaining Attempts
kelvin-onlab44147802015-07-27 17:57:31 -0700365
366 mnSwitches = main.Mininet1.getSwitches()
367 mnLinks = main.Mininet1.getLinks()
368 mnHosts = main.Mininet1.getHosts()
369
Jeremy2f190ca2016-01-29 15:23:57 -0800370 main.step( "Comparing Mininet topology to ONOS topology" )
kelvin-onlab44147802015-07-27 17:57:31 -0700371
Jeremy2f190ca2016-01-29 15:23:57 -0800372 while ( attempts >= 0 ) and\
373 ( not devicesResults or not linksResults or not hostsResults ):
374 time.sleep( 2 )
375 if not devicesResults:
376 devices = main.topo.getAllDevices( main )
377 ports = main.topo.getAllPorts( main )
378 devicesResults = main.TRUE
379 deviceFails = [] # Reset for each failed attempt
380 if not linksResults:
381 links = main.topo.getAllLinks( main )
382 linksResults = main.TRUE
383 linkFails = [] # Reset for each failed attempt
384 if not hostsResults:
385 hosts = main.topo.getAllHosts( main )
386 hostsResults = main.TRUE
387 hostFails = [] # Reset for each failed attempt
kelvin-onlab44147802015-07-27 17:57:31 -0700388
Jeremy2f190ca2016-01-29 15:23:57 -0800389 # Check for matching topology on each node
390 for controller in range( main.numCtrls ):
391 controllerStr = str( controller + 1 ) # ONOS node number
392 # Compare Devices
393 if devices[ controller ] and ports[ controller ] and\
394 "Error" not in devices[ controller ] and\
395 "Error" not in ports[ controller ]:
kelvin-onlab44147802015-07-27 17:57:31 -0700396
Jeremy2f190ca2016-01-29 15:23:57 -0800397 try:
398 deviceData = json.loads( devices[ controller ] )
399 portData = json.loads( ports[ controller ] )
400 except (TypeError,ValueError):
401 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
402 currentDevicesResult = main.FALSE
403 else:
404 currentDevicesResult = main.Mininet1.compareSwitches(
405 mnSwitches,deviceData,portData )
406 else:
407 currentDevicesResult = main.FALSE
408 if not currentDevicesResult:
409 deviceFails.append( controllerStr )
410 devicesResults = devicesResults and currentDevicesResult
411 # Compare Links
412 if links[ controller ] and "Error" not in links[ controller ]:
413 try:
414 linkData = json.loads( links[ controller ] )
415 except (TypeError,ValueError):
416 main.log.error("Could not load json:" + str( links[ controller ] ) )
417 currentLinksResult = main.FALSE
418 else:
419 currentLinksResult = main.Mininet1.compareLinks(
420 mnSwitches, mnLinks,linkData )
421 else:
422 currentLinksResult = main.FALSE
423 if not currentLinksResult:
424 linkFails.append( controllerStr )
425 linksResults = linksResults and currentLinksResult
426 # Compare Hosts
427 if hosts[ controller ] and "Error" not in hosts[ controller ]:
428 try:
429 hostData = json.loads( hosts[ controller ] )
430 except (TypeError,ValueError):
431 main.log.error("Could not load json:" + str( hosts[ controller ] ) )
432 currentHostsResult = main.FALSE
433 else:
434 currentHostsResult = main.Mininet1.compareHosts(
435 mnHosts,hostData )
436 else:
437 currentHostsResult = main.FALSE
438 if not currentHostsResult:
439 hostFails.append( controllerStr )
440 hostsResults = hostsResults and currentHostsResult
441 # Decrement Attempts Remaining
442 attempts -= 1
443
444
445 utilities.assert_equals( expect=[],
446 actual=deviceFails,
447 onpass="ONOS correctly discovered all devices",
448 onfail="ONOS incorrectly discovered devices on nodes: " +
449 str( deviceFails ) )
450 utilities.assert_equals( expect=[],
451 actual=linkFails,
452 onpass="ONOS correctly discovered all links",
453 onfail="ONOS incorrectly discovered links on nodes: " +
454 str( linkFails ) )
455 utilities.assert_equals( expect=[],
456 actual=hostFails,
457 onpass="ONOS correctly discovered all hosts",
458 onfail="ONOS incorrectly discovered hosts on nodes: " +
459 str( hostFails ) )
460 topoResults = hostsResults and linksResults and devicesResults
461 utilities.assert_equals( expect=main.TRUE,
462 actual=topoResults,
463 onpass="ONOS correctly discovered the topology",
464 onfail="ONOS incorrectly discovered the topology" )
kelvin-onlab44147802015-07-27 17:57:31 -0700465
466 def CASE9( self, main ):
467 '''
468 Report errors/warnings/exceptions
469 '''
470 main.log.info( "Error report: \n" )
471 main.ONOSbench.logReport( globalONOSip[0],
472 [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
473 "s" )
474 #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
475
476 def CASE10( self, main ):
477 """
478 Start Mininet topology with OF 1.0 switches
479 """
480 main.OFProtocol = "1.0"
481 main.log.report( "Start Mininet topology with OF 1.0 switches" )
482 main.case( "Start Mininet topology with OF 1.0 switches" )
483 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
484 "switches to test intents, exits out if " +\
485 "topology did not start correctly"
486
487 main.step( "Starting Mininet topology with OF 1.0 switches" )
488 args = "--switch ovs,protocols=OpenFlow10"
489 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
490 main.topology,
491 args=args )
492 stepResult = topoResult
493 utilities.assert_equals( expect=main.TRUE,
494 actual=stepResult,
495 onpass="Successfully loaded topology",
496 onfail="Failed to load topology" )
497 # Exit if topology did not load properly
498 if not topoResult:
499 main.cleanup()
500 main.exit()
501
502 def CASE11( self, main ):
503 """
504 Start Mininet topology with OF 1.3 switches
505 """
506 main.OFProtocol = "1.3"
507 main.log.report( "Start Mininet topology with OF 1.3 switches" )
508 main.case( "Start Mininet topology with OF 1.3 switches" )
509 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
510 "switches to test intents, exits out if " +\
511 "topology did not start correctly"
512
513 main.step( "Starting Mininet topology with OF 1.3 switches" )
514 args = "--switch ovs,protocols=OpenFlow13"
515 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
516 main.topology,
517 args=args )
518 stepResult = topoResult
519 utilities.assert_equals( expect=main.TRUE,
520 actual=stepResult,
521 onpass="Successfully loaded topology",
522 onfail="Failed to load topology" )
523 # Exit if topology did not load properly
524 if not topoResult:
525 main.cleanup()
526 main.exit()
527
528 def CASE12( self, main ):
529 """
530 Assign mastership to controllers
531 """
532 import re
533
534 main.case( "Assign switches to controllers" )
535 main.step( "Assigning switches to controllers" )
536 main.caseExplanation = "Assign OF " + main.OFProtocol +\
537 " switches to ONOS nodes"
538
539 assignResult = main.TRUE
540 switchList = []
541
542 # Creates a list switch name, use getSwitch() function later...
543 for i in range( 1, ( main.numSwitch + 1 ) ):
544 switchList.append( 's' + str( i ) )
545
546 tempONOSip = []
547 for i in range( main.numCtrls ):
548 tempONOSip.append( main.ONOSip[ i ] )
549
550 assignResult = main.Mininet1.assignSwController( sw=switchList,
551 ip=tempONOSip,
Charles Chan029be652015-08-24 01:46:10 +0800552 port='6653' )
kelvin-onlab44147802015-07-27 17:57:31 -0700553 if not assignResult:
554 main.cleanup()
555 main.exit()
556
557 for i in range( 1, ( main.numSwitch + 1 ) ):
558 response = main.Mininet1.getSwController( "s" + str( i ) )
559 print( "Response is " + str( response ) )
560 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
561 assignResult = assignResult and main.TRUE
562 else:
563 assignResult = main.FALSE
564 stepResult = assignResult
565 utilities.assert_equals( expect=main.TRUE,
566 actual=stepResult,
567 onpass="Successfully assigned switches" +
568 "to controller",
569 onfail="Failed to assign switches to " +
570 "controller" )
Jeremy2f190ca2016-01-29 15:23:57 -0800571
572 def CASE13( self,main ):
573 """
574 Create Scapy components
575 """
576 main.case( "Create scapy components" )
577 main.step( "Create scapy components" )
578 import json
579 scapyResult = main.TRUE
580 for hostName in main.scapyHostNames:
581 main.Scapy1.createHostComponent( hostName )
582 main.scapyHosts.append( getattr( main, hostName ) )
583
584 main.step( "Start scapy components" )
585 for host in main.scapyHosts:
586 host.startHostCli()
587 host.startScapy()
588 host.updateSelf()
589 main.log.debug( host.name )
590 main.log.debug( host.hostIp )
591 main.log.debug( host.hostMac )
592
593
594 utilities.assert_equals( expect=main.TRUE,
595 actual=scapyResult,
596 onpass="Successfully created Scapy Components",
597 onfail="Failed to discover Scapy Components" )
598
599 def CASE14( self, main ):
kelvin-onlab44147802015-07-27 17:57:31 -0700600 """
601 Discover all hosts and store its data to a dictionary
602 """
603 main.case( "Discover all hosts" )
604
605 stepResult = main.TRUE
kelvin-onlab0e684682015-08-11 18:51:41 -0700606 main.step( "Discover all ipv4 host hosts " )
607 hostList = []
608 # List of host with default vlan
609 defaultHosts = [ "h1", "h3", "h8", "h9", "h11", "h16", "h17", "h19", "h24" ]
610 # Lists of host with unique vlan
611 vlanHosts1 = [ "h4", "h12", "h20" ]
612 vlanHosts2 = [ "h5", "h13", "h21" ]
613 vlanHosts3 = [ "h6", "h14", "h22" ]
614 vlanHosts4 = [ "h7", "h15", "h23" ]
615 hostList.append( defaultHosts )
616 hostList.append( vlanHosts1 )
617 hostList.append( vlanHosts2 )
618 hostList.append( vlanHosts3 )
619 hostList.append( vlanHosts4 )
620
621 stepResult = main.intentFunction.getHostsData( main, hostList )
kelvin-onlab44147802015-07-27 17:57:31 -0700622 utilities.assert_equals( expect=main.TRUE,
623 actual=stepResult,
624 onpass="Successfully discovered hosts",
625 onfail="Failed to discover hosts" )
626
Jeremy2f190ca2016-01-29 15:23:57 -0800627 def CASE15( self, main ):
kelvin-onlab44147802015-07-27 17:57:31 -0700628 """
Jeremy2f190ca2016-01-29 15:23:57 -0800629 Discover all hosts with scapy arp packets and store its data to a dictionary
kelvin-onlab44147802015-07-27 17:57:31 -0700630 """
Jeremy2f190ca2016-01-29 15:23:57 -0800631 main.case( "Discover all hosts using scapy" )
632 main.step( "Send packets from each host to the first host and confirm onos discovery" )
633
634 import collections
635 if len( main.scapyHosts ) < 1:
636 main.log.error( "No scapy hosts have been created" )
637 main.skipCase()
638
639 # Send ARP packets from each scapy host component
640 main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
641
642 stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
643 retValue=main.FALSE, args=[ main ],
644 attempts=main.checkTopoAttempts, sleep=2 )
645
646 utilities.assert_equals( expect=main.TRUE,
647 actual=stepResult,
648 onpass="ONOS correctly discovered all hosts",
649 onfail="ONOS incorrectly discovered hosts" )
650
651 main.step( "Populate hostsData" )
652 stepResult = main.intentFunction.populateHostData( main )
653 utilities.assert_equals( expect=main.TRUE,
654 actual=stepResult,
655 onpass="Successfully populated hostsData",
656 onfail="Failed to populate hostsData" )
657
658 def CASE16( self, main ):
659 """
Jeremy42df2e72016-02-23 16:37:46 -0800660 Balance Masters
661 """
662 main.case( "Balance mastership of switches" )
663 main.step( "Balancing mastership of switches" )
664
665 balanceResult = main.FALSE
666 balanceResult = utilities.retry( f=main.CLIs2[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
667
668 utilities.assert_equals( expect=main.TRUE,
669 actual=stepResult,
670 onpass="Successfully balanced mastership of switches",
671 onfail="Failed to balance mastership of switches" )
672
673 def CASE17( self, main ):
674 """
Jeremyeb51cb12016-03-28 17:53:35 -0700675 Use Flow Objectives
676 """
677 main.case( "Enable intent compilation using Flow Objectives" )
678 main.step( "Enabling Flow Objectives" )
679
680 main.flowCompiler = "Flow Objectives"
681
682 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
683
684 stepResult = main.CLIs2[ 0 ].setCfg( component=cmd,
685 propName="useFlowObjectives", value="true" )
686
687 utilities.assert_equals( expect=main.TRUE,
688 actual=stepResult,
689 onpass="Successfully activated Flow Objectives",
690 onfail="Failed to activate Flow Objectives" )
691
692 def CASE18( self, main ):
693 """
Jeremy2f190ca2016-01-29 15:23:57 -0800694 Stop mininet and remove scapy hosts
695 """
696 main.log.report( "Stop Mininet and Scapy" )
697 main.case( "Stop Mininet and Scapy" )
kelvin-onlab44147802015-07-27 17:57:31 -0700698 main.caseExplanation = "Stopping the current mininet topology " +\
699 "to start up fresh"
700
Jeremy2f190ca2016-01-29 15:23:57 -0800701 main.step( "Stopping and Removing Scapy Host Components" )
702 scapyResult = main.TRUE
703 for host in main.scapyHosts:
704 scapyResult = scapyResult and host.stopScapy()
705 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
706
707 for host in main.scapyHosts:
708 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
709 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
710
711 main.scapyHosts = []
712 main.scapyHostIPs = []
713
714 utilities.assert_equals( expect=main.TRUE,
715 actual=scapyResult,
716 onpass="Successfully stopped scapy and removed host components",
717 onfail="Failed to stop mininet and scapy" )
718
kelvin-onlab44147802015-07-27 17:57:31 -0700719 main.step( "Stopping Mininet Topology" )
Jeremy2f190ca2016-01-29 15:23:57 -0800720 mininetResult = main.Mininet1.stopNet( )
721
kelvin-onlab44147802015-07-27 17:57:31 -0700722 utilities.assert_equals( expect=main.TRUE,
723 actual=stepResult,
724 onpass="Successfully stop mininet",
725 onfail="Failed to stop mininet" )
726 # Exit if topology did not load properly
Jeremy2f190ca2016-01-29 15:23:57 -0800727 if not (mininetResult and scapyResult ):
kelvin-onlab44147802015-07-27 17:57:31 -0700728 main.cleanup()
729 main.exit()
730
731 def CASE1000( self, main ):
732 """
733 Add host intents between 2 host:
734 - Discover hosts
735 - Add host intents
736 - Check intents
737 - Verify flows
738 - Ping hosts
739 - Reroute
740 - Link down
741 - Verify flows
742 - Check topology
743 - Ping hosts
744 - Link up
745 - Verify flows
746 - Check topology
747 - Ping hosts
748 - Remove intents
749 """
750 import time
751 import json
752 import re
753
754 # Assert variables - These variable's name|format must be followed
755 # if you want to use the wrapper function
756 assert main, "There is no main"
757 assert main.CLIs, "There is no main.CLIs"
758 assert main.Mininet1, "Mininet handle should be named Mininet1"
759 assert main.numSwitch, "Placed the total number of switch topology in \
760 main.numSwitch"
761
Jeremye1ea0602016-02-08 16:35:05 -0800762 # Save leader candidates
763 intentLeadersOld = main.CLIs2[ 0 ].leaderCandidates()
764
kelvin-onlab44147802015-07-27 17:57:31 -0700765 main.case( "Host Intents Test - " + str( main.numCtrls ) +
Jeremyeb51cb12016-03-28 17:53:35 -0700766 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
kelvin-onlab44147802015-07-27 17:57:31 -0700767 main.caseExplanation = "This test case tests Host intents using " +\
768 str( main.numCtrls ) + " node(s) cluster;\n" +\
769 "Different type of hosts will be tested in " +\
770 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700771 "etc;\nThe test will use OF " + main.OFProtocol +\
772 " OVS running in Mininet and compile intents" +\
773 " using " + main.flowCompiler
kelvin-onlab44147802015-07-27 17:57:31 -0700774
Jeremy2f190ca2016-01-29 15:23:57 -0800775 main.step( "IPV4: Add and test host intents between h1 and h9" )
776 main.assertReturnString = "Assertion result for IPV4 host intent with mac addresses\n"
777 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
778 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
779 testResult = main.FALSE
780 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlab44147802015-07-27 17:57:31 -0700781 name='IPV4',
Jeremy2f190ca2016-01-29 15:23:57 -0800782 onosNode='0',
783 host1=host1,
784 host2=host2 )
785
786 if installResult:
787 testResult = main.intentFunction.testHostIntent( main,
788 name='IPV4',
789 intentId = installResult,
790 onosNode='0',
791 host1=host1,
792 host2=host2,
kelvin-onlab44147802015-07-27 17:57:31 -0700793 sw1='s5',
794 sw2='s2',
Jeremy2f190ca2016-01-29 15:23:57 -0800795 expectedLink = 18 )
kelvin-onlab44147802015-07-27 17:57:31 -0700796
797 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -0800798 actual=testResult,
799 onpass=main.assertReturnString,
800 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -0700801
802 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
Jeremy2f190ca2016-01-29 15:23:57 -0800803 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
804 host1 = { "name":"h3", "id":"00:00:00:00:00:03/-1" }
805 host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1"}
806 testResult = main.FALSE
807 installResult = main.intentFunction.installHostIntent( main,
808 name='DUALSTACK1',
809 onosNode='0',
810 host1=host1,
811 host2=host2 )
812
813 if installResult:
814 testResult = main.intentFunction.testHostIntent( main,
815 name='DUALSTACK1',
816 intentId = installResult,
817 onosNode='0',
818 host1=host1,
819 host2=host2,
kelvin-onlab44147802015-07-27 17:57:31 -0700820 sw1='s5',
821 sw2='s2',
Jeremy2f190ca2016-01-29 15:23:57 -0800822 expectedLink = 18 )
kelvin-onlab44147802015-07-27 17:57:31 -0700823
824 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -0800825 actual=testResult,
826 onpass=main.assertReturnString,
827 onfail=main.assertReturnString)
kelvin-onlab44147802015-07-27 17:57:31 -0700828
829 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
Jeremy2f190ca2016-01-29 15:23:57 -0800830 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
831 host1 = { "name":"h1" }
832 host2 = { "name":"h11" }
833 testResult = main.FALSE
834 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlab44147802015-07-27 17:57:31 -0700835 name='DUALSTACK2',
Jeremy2f190ca2016-01-29 15:23:57 -0800836 onosNode='0',
837 host1=host1,
838 host2=host2 )
839
840 if installResult:
841 testResult = main.intentFunction.testHostIntent( main,
842 name='DUALSTACK2',
843 intentId = installResult,
844 onosNode='0',
845 host1=host1,
846 host2=host2,
kelvin-onlab44147802015-07-27 17:57:31 -0700847 sw1='s5',
848 sw2='s2',
Jeremy2f190ca2016-01-29 15:23:57 -0800849 expectedLink = 18 )
kelvin-onlab44147802015-07-27 17:57:31 -0700850
851 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -0800852 actual=testResult,
853 onpass=main.assertReturnString,
854 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -0700855
856 main.step( "1HOP: Add host intents between h1 and h3" )
Jeremy2f190ca2016-01-29 15:23:57 -0800857 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
858 host1 = { "name":"h1" }
859 host2 = { "name":"h3" }
860 testResult = main.FALSE
861 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlab44147802015-07-27 17:57:31 -0700862 name='1HOP',
Jeremy2f190ca2016-01-29 15:23:57 -0800863 onosNode='0',
864 host1=host1,
865 host2=host2 )
kelvin-onlab44147802015-07-27 17:57:31 -0700866
Jeremy2f190ca2016-01-29 15:23:57 -0800867 if installResult:
868 testResult = main.intentFunction.testHostIntent( main,
869 name='1HOP',
870 intentId = installResult,
871 onosNode='0',
872 host1=host1,
873 host2=host2,
kelvin-onlab44147802015-07-27 17:57:31 -0700874 sw1='s5',
875 sw2='s2',
Jeremy2f190ca2016-01-29 15:23:57 -0800876 expectedLink = 18 )
kelvin-onlab44147802015-07-27 17:57:31 -0700877
878 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -0800879 actual=testResult,
880 onpass=main.assertReturnString,
881 onfail=main.assertReturnString )
882
883 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
884 main.assertReturnString = "Assertion Result vlan IPV4\n"
885 host1 = { "name":"h4","id":"00:00:00:00:00:04/100" }
886 host2 = { "name":"h12","id":"00:00:00:00:00:0C/100" }
887 testResult = main.FALSE
888 installResult = main.intentFunction.installHostIntent( main,
889 name='VLAN1',
890 onosNode='0',
891 host1=host1,
892 host2=host2 )
893
894 if installResult:
895 testResult = main.intentFunction.testHostIntent( main,
896 name='VLAN1',
897 intentId = installResult,
898 onosNode='0',
899 host1=host1,
900 host2=host2,
901 sw1='s5',
902 sw2='s2',
903 expectedLink = 18 )
904
905 utilities.assert_equals( expect=main.TRUE,
906 actual=testResult,
907 onpass=main.assertReturnString,
908 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -0700909
910 main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
Jeremy2f190ca2016-01-29 15:23:57 -0800911 main.assertReturnString = "Assertion Result different VLAN negative test\n"
912 host1 = { "name":"h13" }
913 host2 = { "name":"h20" }
914 testResult = main.FALSE
915 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlab44147802015-07-27 17:57:31 -0700916 name='VLAN2',
Jeremy2f190ca2016-01-29 15:23:57 -0800917 onosNode='0',
918 host1=host1,
919 host2=host2 )
kelvin-onlab44147802015-07-27 17:57:31 -0700920
Jeremy2f190ca2016-01-29 15:23:57 -0800921 if installResult:
922 testResult = main.intentFunction.testHostIntent( main,
923 name='VLAN2',
924 intentId = installResult,
925 onosNode='0',
926 host1=host1,
927 host2=host2,
928 sw1='s5',
929 sw2='s2',
930 expectedLink = 18 )
kelvin-onlab44147802015-07-27 17:57:31 -0700931
Jeremy2f190ca2016-01-29 15:23:57 -0800932 utilities.assert_equals( expect=main.TRUE,
933 actual=testResult,
934 onpass=main.assertReturnString,
935 onfail=main.assertReturnString )
936
Jeremye1ea0602016-02-08 16:35:05 -0800937 # Change the following to use the REST API when leader checking is
938 # supported by it
Jeremy2f190ca2016-01-29 15:23:57 -0800939
Jeremye1ea0602016-02-08 16:35:05 -0800940 main.step( "Confirm that ONOS leadership is unchanged")
941 intentLeadersNew = main.CLIs2[ 0 ].leaderCandidates()
942 main.intentFunction.checkLeaderChange( intentLeadersOld,
943 intentLeadersNew )
Jeremy2f190ca2016-01-29 15:23:57 -0800944
Jeremye1ea0602016-02-08 16:35:05 -0800945 utilities.assert_equals( expect=main.TRUE,
946 actual=testResult,
947 onpass="ONOS Leaders Unchanged",
948 onfail="ONOS Leader Mismatch")
Jeremy2f190ca2016-01-29 15:23:57 -0800949
950 main.intentFunction.report( main )
kelvin-onlab44147802015-07-27 17:57:31 -0700951
952 def CASE2000( self, main ):
953 """
954 Add point intents between 2 hosts:
955 - Get device ids | ports
956 - Add point intents
957 - Check intents
958 - Verify flows
959 - Ping hosts
960 - Reroute
961 - Link down
962 - Verify flows
963 - Check topology
964 - Ping hosts
965 - Link up
966 - Verify flows
967 - Check topology
968 - Ping hosts
969 - Remove intents
970 """
971 import time
972 import json
973 import re
974
975 # Assert variables - These variable's name|format must be followed
976 # if you want to use the wrapper function
977 assert main, "There is no main"
978 assert main.CLIs, "There is no main.CLIs"
979 assert main.Mininet1, "Mininet handle should be named Mininet1"
980 assert main.numSwitch, "Placed the total number of switch topology in \
981 main.numSwitch"
982
983 main.case( "Point Intents Test - " + str( main.numCtrls ) +
Jeremyeb51cb12016-03-28 17:53:35 -0700984 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
kelvin-onlab44147802015-07-27 17:57:31 -0700985 main.caseExplanation = "This test case will test point to point" +\
986 " intents using " + str( main.numCtrls ) +\
987 " node(s) cluster;\n" +\
988 "Different type of hosts will be tested in " +\
989 "each step such as IPV4, Dual stack, VLAN etc" +\
990 ";\nThe test will use OF " + main.OFProtocol +\
Jeremyeb51cb12016-03-28 17:53:35 -0700991 " OVS running in Mininet and compile intents" +\
992 " using " + main.flowCompiler
kelvin-onlab44147802015-07-27 17:57:31 -0700993
994 # No option point intents
995 main.step( "NOOPTION: Add point intents between h1 and h9" )
Jeremy2f190ca2016-01-29 15:23:57 -0800996 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
997 senders = [
998 { "name":"h1","device":"of:0000000000000005/1" }
999 ]
1000 recipients = [
1001 { "name":"h9","device":"of:0000000000000006/1" }
1002 ]
1003 testResult = main.FALSE
1004 installResult = main.intentFunction.installPointIntent(
kelvin-onlab44147802015-07-27 17:57:31 -07001005 main,
1006 name="NOOPTION",
Jeremy2f190ca2016-01-29 15:23:57 -08001007 senders=senders,
1008 recipients=recipients )
1009
1010 if installResult:
1011 testResult = main.intentFunction.testPointIntent(
1012 main,
1013 intentId=installResult,
1014 name="NOOPTION",
1015 senders=senders,
1016 recipients=recipients,
1017 sw1="s5",
1018 sw2="s2",
1019 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001020
1021 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001022 actual=testResult,
1023 onpass=main.assertReturnString,
1024 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001025
kelvin-onlab44147802015-07-27 17:57:31 -07001026 main.step( "IPV4: Add point intents between h1 and h9" )
Jeremy2f190ca2016-01-29 15:23:57 -08001027 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
1028 senders = [
1029 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1030 ]
1031 recipients = [
1032 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
1033 ]
1034 installResult = main.intentFunction.installPointIntent(
kelvin-onlab44147802015-07-27 17:57:31 -07001035 main,
1036 name="IPV4",
Jeremy2f190ca2016-01-29 15:23:57 -08001037 senders=senders,
1038 recipients=recipients,
1039 ethType="IPV4" )
1040
1041 if installResult:
1042 testResult = main.intentFunction.testPointIntent(
1043 main,
1044 intentId=installResult,
1045 name="IPV4",
1046 senders=senders,
1047 recipients=recipients,
1048 sw1="s5",
1049 sw2="s2",
1050 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001051
1052 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001053 actual=testResult,
1054 onpass=main.assertReturnString,
1055 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001056 main.step( "IPV4_2: Add point intents between h1 and h9" )
Jeremy2f190ca2016-01-29 15:23:57 -08001057 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
1058 senders = [
1059 { "name":"h1","device":"of:0000000000000005/1" }
1060 ]
1061 recipients = [
1062 { "name":"h9","device":"of:0000000000000006/1" }
1063 ]
1064 installResult = main.intentFunction.installPointIntent(
kelvin-onlab44147802015-07-27 17:57:31 -07001065 main,
1066 name="IPV4_2",
Jeremy2f190ca2016-01-29 15:23:57 -08001067 senders=senders,
1068 recipients=recipients,
1069 ethType="IPV4" )
1070
1071 if installResult:
1072 testResult = main.intentFunction.testPointIntent(
1073 main,
1074 intentId=installResult,
1075 name="IPV4_2",
1076 senders=senders,
1077 recipients=recipients,
1078 sw1="s5",
1079 sw2="s2",
1080 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001081
1082 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001083 actual=testResult,
1084 onpass=main.assertReturnString,
1085 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001086
kelvin-onlab0e684682015-08-11 18:51:41 -07001087 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
Jeremy2f190ca2016-01-29 15:23:57 -08001088 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
1089 senders = [
1090 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01",
1091 "ip":main.h1.hostIp }
1092 ]
1093 recipients = [
1094 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
1095 "ip":main.h9.hostIp }
1096 ]
kelvin-onlab44147802015-07-27 17:57:31 -07001097 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
1098 # Uneccessary, not including this in the selectors
Jeremy2f190ca2016-01-29 15:23:57 -08001099 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1100 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
kelvin-onlab44147802015-07-27 17:57:31 -07001101
Jeremy2f190ca2016-01-29 15:23:57 -08001102 installResult = main.intentFunction.installPointIntent(
1103 main,
1104 name="SDNIP-ICMP",
1105 senders=senders,
1106 recipients=recipients,
1107 ethType="IPV4",
1108 ipProto=ipProto,
1109 tcpSrc=tcpSrc,
1110 tcpDst=tcpDst )
1111
1112 if installResult:
1113 testResult = main.intentFunction.testPointIntent(
1114 main,
1115 intentId=installResult,
1116 name="SDNIP_ICMP",
1117 senders=senders,
1118 recipients=recipients,
1119 sw1="s5",
1120 sw2="s2",
1121 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001122
1123 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001124 actual=testResult,
1125 onpass=main.assertReturnString,
1126 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001127
kelvin-onlab0e684682015-08-11 18:51:41 -07001128 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
Jeremy2f190ca2016-01-29 15:23:57 -08001129 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlab44147802015-07-27 17:57:31 -07001130 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1131 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab0e684682015-08-11 18:51:41 -07001132 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1133 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlab44147802015-07-27 17:57:31 -07001134 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1135 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1136 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1137
kelvin-onlab0e684682015-08-11 18:51:41 -07001138 stepResult = main.intentFunction.pointIntentTcp(
kelvin-onlab44147802015-07-27 17:57:31 -07001139 main,
kelvin-onlab0e684682015-08-11 18:51:41 -07001140 name="SDNIP-TCP",
kelvin-onlab44147802015-07-27 17:57:31 -07001141 host1="h1",
1142 host2="h9",
1143 deviceId1="of:0000000000000005/1",
1144 deviceId2="of:0000000000000006/1",
1145 mac1=mac1,
1146 mac2=mac2,
1147 ethType="IPV4",
kelvin-onlab0e684682015-08-11 18:51:41 -07001148 ipProto=ipProto,
1149 ip1=ip1,
1150 ip2=ip2,
1151 tcp1=tcp1,
1152 tcp2=tcp2 )
kelvin-onlab44147802015-07-27 17:57:31 -07001153
1154 utilities.assert_equals( expect=main.TRUE,
1155 actual=stepResult,
Jeremy2f190ca2016-01-29 15:23:57 -08001156 onpass=main.assertReturnString,
1157 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001158
Jeremy2f190ca2016-01-29 15:23:57 -08001159 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1160 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
1161 senders = [
1162 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1163 ]
1164 recipients = [
1165 { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
1166 ]
1167 installResult = main.intentFunction.installPointIntent(
kelvin-onlab44147802015-07-27 17:57:31 -07001168 main,
1169 name="DUALSTACK1",
Jeremy2f190ca2016-01-29 15:23:57 -08001170 senders=senders,
1171 recipients=recipients,
1172 ethType="IPV4" )
1173
1174 if installResult:
1175 testResult = main.intentFunction.testPointIntent(
1176 main,
1177 intentId=installResult,
1178 name="DUALSTACK1",
1179 senders=senders,
1180 recipients=recipients,
1181 sw1="s5",
1182 sw2="s2",
1183 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001184
1185 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001186 actual=testResult,
1187 onpass=main.assertReturnString,
1188 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001189
1190 main.step( "VLAN: Add point intents between h5 and h21" )
Jeremy2f190ca2016-01-29 15:23:57 -08001191 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
1192 senders = [
1193 { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" }
1194 ]
1195 recipients = [
1196 { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" }
1197 ]
1198 installResult = main.intentFunction.installPointIntent(
kelvin-onlab44147802015-07-27 17:57:31 -07001199 main,
Jeremy2f190ca2016-01-29 15:23:57 -08001200 name="DUALSTACK1",
1201 senders=senders,
1202 recipients=recipients,
1203 ethType="IPV4" )
1204
1205 if installResult:
1206 testResult = main.intentFunction.testPointIntent(
1207 main,
1208 intentId=installResult,
1209 name="DUALSTACK1",
1210 senders=senders,
1211 recipients=recipients,
1212 sw1="s5",
1213 sw2="s2",
1214 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001215
1216 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001217 actual=testResult,
1218 onpass=main.assertReturnString,
1219 onfail=main.assertReturnString )
kelvin-onlab44147802015-07-27 17:57:31 -07001220
1221 main.step( "1HOP: Add point intents between h1 and h3" )
Jeremy2f190ca2016-01-29 15:23:57 -08001222 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
1223 senders = [
1224 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1225 ]
1226 recipients = [
1227 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1228 ]
1229 installResult = main.intentFunction.installPointIntent(
1230 main,
1231 name="1HOP IPV4",
1232 senders=senders,
1233 recipients=recipients,
1234 ethType="IPV4" )
1235
1236 if installResult:
1237 testResult = main.intentFunction.testPointIntent(
1238 main,
1239 intentId=installResult,
1240 name="1HOP IPV4",
1241 senders=senders,
1242 recipients=recipients,
1243 sw1="s5",
1244 sw2="s2",
1245 expectedLink=18)
kelvin-onlab44147802015-07-27 17:57:31 -07001246
1247 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001248 actual=testResult,
1249 onpass=main.assertReturnString,
1250 onfail=main.assertReturnString )
1251
1252 main.intentFunction.report( main )
kelvin-onlab44147802015-07-27 17:57:31 -07001253
1254 def CASE3000( self, main ):
1255 """
1256 Add single point to multi point intents
1257 - Get device ids
1258 - Add single point to multi point intents
1259 - Check intents
1260 - Verify flows
1261 - Ping hosts
1262 - Reroute
1263 - Link down
1264 - Verify flows
1265 - Check topology
1266 - Ping hosts
1267 - Link up
1268 - Verify flows
1269 - Check topology
1270 - Ping hosts
1271 - Remove intents
1272 """
1273 assert main, "There is no main"
1274 assert main.CLIs, "There is no main.CLIs"
1275 assert main.Mininet1, "Mininet handle should be named Mininet1"
1276 assert main.numSwitch, "Placed the total number of switch topology in \
1277 main.numSwitch"
1278
1279 main.case( "Single To Multi Point Intents Test - " +
Jeremyeb51cb12016-03-28 17:53:35 -07001280 str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
kelvin-onlab44147802015-07-27 17:57:31 -07001281 main.caseExplanation = "This test case will test single point to" +\
1282 " multi point intents using " +\
1283 str( main.numCtrls ) + " node(s) cluster;\n" +\
1284 "Different type of hosts will be tested in " +\
1285 "each step such as IPV4, Dual stack, VLAN etc" +\
1286 ";\nThe test will use OF " + main.OFProtocol +\
Jeremyeb51cb12016-03-28 17:53:35 -07001287 " OVS running in Mininet and compile intents" +\
1288 " using " + main.flowCompiler
kelvin-onlab44147802015-07-27 17:57:31 -07001289
1290 main.step( "NOOPTION: Add single point to multi point intents" )
1291 stepResult = main.TRUE
1292 hostNames = [ 'h8', 'h16', 'h24' ]
1293 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
1294 'of:0000000000000007/8' ]
1295 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
1296 stepResult = main.intentFunction.singleToMultiIntent(
1297 main,
1298 name="NOOPTION",
1299 hostNames=hostNames,
1300 devices=devices,
1301 sw1="s5",
1302 sw2="s2",
1303 expectedLink=18 )
1304
1305 utilities.assert_equals( expect=main.TRUE,
1306 actual=stepResult,
1307 onpass="NOOPTION: Successfully added single "
1308 + " point to multi point intents" +
1309 " with no match action",
1310 onfail="NOOPTION: Failed to add single point"
1311 + " point to multi point intents" +
1312 " with no match action" )
1313
1314 main.step( "IPV4: Add single point to multi point intents" )
1315 stepResult = main.TRUE
1316 stepResult = main.intentFunction.singleToMultiIntent(
1317 main,
1318 name="IPV4",
1319 hostNames=hostNames,
1320 devices=devices,
1321 ports=None,
1322 ethType="IPV4",
1323 macs=macs,
1324 bandwidth="",
1325 lambdaAlloc=False,
1326 ipProto="",
1327 ipAddresses="",
1328 tcp="",
1329 sw1="s5",
1330 sw2="s2",
1331 expectedLink=18 )
1332
1333 utilities.assert_equals( expect=main.TRUE,
1334 actual=stepResult,
1335 onpass="IPV4: Successfully added single "
1336 + " point to multi point intents" +
1337 " with IPV4 type and MAC addresses",
1338 onfail="IPV4: Failed to add single point"
1339 + " point to multi point intents" +
1340 " with IPV4 type and MAC addresses" )
1341
1342 main.step( "IPV4_2: Add single point to multi point intents" )
1343 stepResult = main.TRUE
1344 hostNames = [ 'h8', 'h16', 'h24' ]
1345 stepResult = main.intentFunction.singleToMultiIntent(
1346 main,
1347 name="IPV4",
1348 hostNames=hostNames,
1349 ethType="IPV4",
1350 lambdaAlloc=False )
1351
1352 utilities.assert_equals( expect=main.TRUE,
1353 actual=stepResult,
1354 onpass="IPV4_2: Successfully added single "
1355 + " point to multi point intents" +
1356 " with IPV4 type and no MAC addresses",
1357 onfail="IPV4_2: Failed to add single point"
1358 + " point to multi point intents" +
1359 " with IPV4 type and no MAC addresses" )
1360
1361 main.step( "VLAN: Add single point to multi point intents" )
1362 stepResult = main.TRUE
1363 hostNames = [ 'h4', 'h12', 'h20' ]
1364 devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
1365 'of:0000000000000007/4' ]
1366 macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
1367 stepResult = main.intentFunction.singleToMultiIntent(
1368 main,
1369 name="VLAN",
1370 hostNames=hostNames,
1371 devices=devices,
1372 ports=None,
1373 ethType="IPV4",
1374 macs=macs,
1375 bandwidth="",
1376 lambdaAlloc=False,
1377 ipProto="",
1378 ipAddresses="",
1379 tcp="",
1380 sw1="s5",
1381 sw2="s2",
1382 expectedLink=18 )
1383
1384 utilities.assert_equals( expect=main.TRUE,
1385 actual=stepResult,
1386 onpass="VLAN: Successfully added single "
1387 + " point to multi point intents" +
1388 " with IPV4 type and MAC addresses" +
1389 " in the same VLAN",
1390 onfail="VLAN: Failed to add single point"
1391 + " point to multi point intents" +
1392 " with IPV4 type and MAC addresses" +
1393 " in the same VLAN")
1394
1395 def CASE4000( self, main ):
1396 """
1397 Add multi point to single point intents
1398 - Get device ids
1399 - Add multi point to single point intents
1400 - Check intents
1401 - Verify flows
1402 - Ping hosts
1403 - Reroute
1404 - Link down
1405 - Verify flows
1406 - Check topology
1407 - Ping hosts
1408 - Link up
1409 - Verify flows
1410 - Check topology
1411 - Ping hosts
1412 - Remove intents
1413 """
1414 assert main, "There is no main"
1415 assert main.CLIs, "There is no main.CLIs"
1416 assert main.Mininet1, "Mininet handle should be named Mininet1"
1417 assert main.numSwitch, "Placed the total number of switch topology in \
1418 main.numSwitch"
1419
1420 main.case( "Multi To Single Point Intents Test - " +
Jeremyeb51cb12016-03-28 17:53:35 -07001421 str( main.numCtrls ) + " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
kelvin-onlab44147802015-07-27 17:57:31 -07001422 main.caseExplanation = "This test case will test single point to" +\
1423 " multi point intents using " +\
1424 str( main.numCtrls ) + " node(s) cluster;\n" +\
1425 "Different type of hosts will be tested in " +\
1426 "each step such as IPV4, Dual stack, VLAN etc" +\
1427 ";\nThe test will use OF " + main.OFProtocol +\
Jeremyeb51cb12016-03-28 17:53:35 -07001428 " OVS running in Mininet and compile intents" +\
1429 " using " + main.flowCompiler
kelvin-onlab44147802015-07-27 17:57:31 -07001430
1431 main.step( "NOOPTION: Add multi point to single point intents" )
1432 stepResult = main.TRUE
1433 hostNames = [ 'h8', 'h16', 'h24' ]
1434 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
1435 'of:0000000000000007/8' ]
1436 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
1437 stepResult = main.intentFunction.multiToSingleIntent(
1438 main,
1439 name="NOOPTION",
1440 hostNames=hostNames,
1441 devices=devices,
1442 sw1="s5",
1443 sw2="s2",
1444 expectedLink=18 )
1445
1446 utilities.assert_equals( expect=main.TRUE,
1447 actual=stepResult,
1448 onpass="NOOPTION: Successfully added multi "
1449 + " point to single point intents" +
1450 " with no match action",
1451 onfail="NOOPTION: Failed to add multi point" +
1452 " to single point intents" +
1453 " with no match action" )
1454
1455 main.step( "IPV4: Add multi point to single point intents" )
1456 stepResult = main.TRUE
1457 stepResult = main.intentFunction.multiToSingleIntent(
1458 main,
1459 name="IPV4",
1460 hostNames=hostNames,
1461 devices=devices,
1462 ports=None,
1463 ethType="IPV4",
1464 macs=macs,
1465 bandwidth="",
1466 lambdaAlloc=False,
1467 ipProto="",
1468 ipAddresses="",
1469 tcp="",
1470 sw1="s5",
1471 sw2="s2",
1472 expectedLink=18 )
1473
1474 utilities.assert_equals( expect=main.TRUE,
1475 actual=stepResult,
1476 onpass="IPV4: Successfully added multi point"
1477 + " to single point intents" +
1478 " with IPV4 type and MAC addresses",
1479 onfail="IPV4: Failed to add multi point" +
1480 " to single point intents" +
1481 " with IPV4 type and MAC addresses" )
1482
1483 main.step( "IPV4_2: Add multi point to single point intents" )
1484 stepResult = main.TRUE
1485 hostNames = [ 'h8', 'h16', 'h24' ]
1486 stepResult = main.intentFunction.multiToSingleIntent(
1487 main,
1488 name="IPV4",
1489 hostNames=hostNames,
1490 ethType="IPV4",
1491 lambdaAlloc=False )
1492
1493 utilities.assert_equals( expect=main.TRUE,
1494 actual=stepResult,
1495 onpass="IPV4_2: Successfully added multi point"
1496 + " to single point intents" +
1497 " with IPV4 type and no MAC addresses",
1498 onfail="IPV4_2: Failed to add multi point" +
1499 " to single point intents" +
1500 " with IPV4 type and no MAC addresses" )
1501
1502 main.step( "VLAN: Add multi point to single point intents" )
1503 stepResult = main.TRUE
1504 hostNames = [ 'h5', 'h13', 'h21' ]
1505 devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
1506 'of:0000000000000007/5' ]
1507 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
1508 stepResult = main.intentFunction.multiToSingleIntent(
1509 main,
1510 name="VLAN",
1511 hostNames=hostNames,
1512 devices=devices,
1513 ports=None,
1514 ethType="IPV4",
1515 macs=macs,
1516 bandwidth="",
1517 lambdaAlloc=False,
1518 ipProto="",
1519 ipAddresses="",
1520 tcp="",
1521 sw1="s5",
1522 sw2="s2",
1523 expectedLink=18 )
1524
1525 utilities.assert_equals( expect=main.TRUE,
1526 actual=stepResult,
1527 onpass="VLAN: Successfully added multi point"
1528 + " to single point intents" +
1529 " with IPV4 type and MAC addresses" +
1530 " in the same VLAN",
1531 onfail="VLAN: Failed to add multi point" +
1532 " to single point intents" )
1533
1534 def CASE5000( self, main ):
Jeremy2f190ca2016-01-29 15:23:57 -08001535 # """
1536 # Will add description in next patch set
1537 # """
1538 # assert main, "There is no main"
1539 # assert main.CLIs, "There is no main.CLIs"
1540 # assert main.Mininet1, "Mininet handle should be named Mininet1"
1541 # assert main.numSwitch, "Placed the total number of switch topology in \
1542 # main.numSwitch"
1543 # main.case( "Test host mobility with host intents " )
1544 # main.step( " Testing host mobility by moving h1 from s5 to s6" )
1545 # h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1546
1547 # main.log.info( "Moving h1 from s5 to s6")
1548
1549 # main.Mininet1.moveHost( "h1","s5","s6" )
1550
1551 # main.intentFunction.getHostsData( main )
1552 # h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1553
1554 # utilities.assert_equals( expect="of:0000000000000006",
1555 # actual=h1PostMove,
1556 # onpass="Mobility: Successfully moved h1 to s6",
1557 # onfail="Mobility: Failed to moved h1 to s6" +
1558 # " to single point intents" +
1559 # " with IPV4 type and MAC addresses" +
1560 # " in the same VLAN" )
1561
1562 # main.step( "IPV4: Add host intents between h1 and h9" )
1563 # stepResult = main.TRUE
1564 # stepResult = main.intentFunction.hostIntent( main,
1565 # onosNode='0',
1566 # name='IPV4',
1567 # host1='h1',
1568 # host2='h9',
1569 # host1Id='00:00:00:00:00:01/-1',
1570 # host2Id='00:00:00:00:00:09/-1' )
1571
1572 # utilities.assert_equals( expect=main.TRUE,
1573 # actual=stepResult,
1574 # onpass="IPV4: Host intent test successful " +
1575 # "between two IPV4 hosts",
1576 # onfail="IPV4: Host intent test failed " +
1577 # "between two IPV4 hosts")
kelvin-onlab44147802015-07-27 17:57:31 -07001578 """
Jeremy2f190ca2016-01-29 15:23:57 -08001579 Tests Host Mobility
1580 Modifies the topology location of h1
kelvin-onlab44147802015-07-27 17:57:31 -07001581 """
1582 assert main, "There is no main"
1583 assert main.CLIs, "There is no main.CLIs"
1584 assert main.Mininet1, "Mininet handle should be named Mininet1"
1585 assert main.numSwitch, "Placed the total number of switch topology in \
1586 main.numSwitch"
1587 main.case( "Test host mobility with host intents " )
Jeremy2f190ca2016-01-29 15:23:57 -08001588 main.step( "Testing host mobility by moving h1 from s5 to s6" )
kelvin-onlab44147802015-07-27 17:57:31 -07001589 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1590
1591 main.log.info( "Moving h1 from s5 to s6")
kelvin-onlab44147802015-07-27 17:57:31 -07001592 main.Mininet1.moveHost( "h1","s5","s6" )
1593
Jeremy2f190ca2016-01-29 15:23:57 -08001594 # Send discovery ping from moved host
1595 # Moving the host brings down the default interfaces and creates a new one.
1596 # Scapy is restarted on this host to detect the new interface
1597 main.h1.stopScapy()
1598 main.h1.startScapy()
1599
1600 # Discover new host location in ONOS and populate host data.
1601 # Host 1 IP and MAC should be unchanged
1602 main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
1603 main.intentFunction.populateHostData( main )
1604
kelvin-onlab44147802015-07-27 17:57:31 -07001605 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1606
1607 utilities.assert_equals( expect="of:0000000000000006",
1608 actual=h1PostMove,
1609 onpass="Mobility: Successfully moved h1 to s6",
Jeremy2f190ca2016-01-29 15:23:57 -08001610 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlab44147802015-07-27 17:57:31 -07001611 " to single point intents" +
1612 " with IPV4 type and MAC addresses" +
1613 " in the same VLAN" )
1614
1615 main.step( "IPV4: Add host intents between h1 and h9" )
Jeremy2f190ca2016-01-29 15:23:57 -08001616 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
1617 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
1618 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
1619
1620 installResult = main.intentFunction.installHostIntent( main,
1621 name='IPV4 Mobility IPV4',
kelvin-onlab44147802015-07-27 17:57:31 -07001622 onosNode='0',
Jeremy2f190ca2016-01-29 15:23:57 -08001623 host1=host1,
1624 host2=host2)
1625 if installResult:
1626 testResult = main.intentFunction.testHostIntent( main,
1627 name='Host Mobility IPV4',
1628 intentId = installResult,
1629 onosNode='0',
1630 host1=host1,
1631 host2=host2,
1632 sw1="s6",
1633 sw2="s2",
1634 expectedLink=18 )
kelvin-onlab44147802015-07-27 17:57:31 -07001635
1636 utilities.assert_equals( expect=main.TRUE,
Jeremy2f190ca2016-01-29 15:23:57 -08001637 actual=testResult,
1638 onpass=main.assertReturnString,
1639 onfail=main.assertReturnString )
1640
1641 main.intentFunction.report( main )
1642