blob: 260e66ce64a968a7afb5246ba0514b1f8405fac5 [file] [log] [blame]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001
2# Testing the basic intent functionality of ONOS
3
4import time
5import json
6
7class FUNCintent:
8
9 def __init__( self ):
10 self.default = ''
11
12 def CASE1( self, main ):
13 import time
14 import os
15 import imp
16
17 """
18 - Construct tests variables
19 - GIT ( optional )
20 - Checkout ONOS master branch
21 - Pull latest ONOS code
22 - Building ONOS ( optional )
23 - Install ONOS package
24 - Build ONOS package
25 """
26
27 main.case( "Constructing test variables and building ONOS package" )
28 main.step( "Constructing test variables" )
Jon Hall783bbf92015-07-23 14:33:19 -070029 main.caseExplanation = "This test case is mainly for loading " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -070030 "from params file, and pull and build the " +\
31 " latest ONOS package"
kelvin-onlabd48a68c2015-07-13 16:01:36 -070032 stepResult = main.FALSE
33
34 # Test variables
35 main.testOnDirectory = os.path.dirname( os.getcwd ( ) )
36 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
37 gitBranch = main.params[ 'GIT' ][ 'branch' ]
38 main.dependencyPath = main.testOnDirectory + \
39 main.params[ 'DEPENDENCY' ][ 'path' ]
40 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
41 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
42 main.maxNodes = int( main.ONOSbench.maxNodes )
43 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
44 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
45 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
46 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
47 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
kelvin-onlab0ad05d12015-07-23 14:21:15 -070048 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070049 gitPull = main.params[ 'GIT' ][ 'pull' ]
50 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
51 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
52 main.cellData = {} # for creating cell file
53 main.hostsData = {}
54 main.CLIs = []
55 main.ONOSip = []
56
57 main.ONOSip = main.ONOSbench.getOnosIps()
58 print main.ONOSip
59
60 # Assigning ONOS cli handles to a list
61 for i in range( 1, main.maxNodes + 1 ):
62 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
63
64 # -- INIT SECTION, ONLY RUNS ONCE -- #
65 main.startUp = imp.load_source( wrapperFile1,
66 main.dependencyPath +
67 wrapperFile1 +
68 ".py" )
69
70 main.intentFunction = imp.load_source( wrapperFile2,
71 main.dependencyPath +
72 wrapperFile2 +
73 ".py" )
74
75 copyResult = main.ONOSbench.copyMininetFile( main.topology,
76 main.dependencyPath,
77 main.Mininet1.user_name,
78 main.Mininet1.ip_address )
79 if main.CLIs:
80 stepResult = main.TRUE
81 else:
82 main.log.error( "Did not properly created list of ONOS CLI handle" )
83 stepResult = main.FALSE
84
85 utilities.assert_equals( expect=main.TRUE,
86 actual=stepResult,
87 onpass="Successfully construct " +
88 "test variables ",
89 onfail="Failed to construct test variables" )
90
91 if gitPull == 'True':
92 main.step( "Building ONOS in " + gitBranch + " branch" )
93 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
94 stepResult = onosBuildResult
95 utilities.assert_equals( expect=main.TRUE,
96 actual=stepResult,
97 onpass="Successfully compiled " +
98 "latest ONOS",
99 onfail="Failed to compile " +
100 "latest ONOS" )
101 else:
102 main.log.warn( "Did not pull new code so skipping mvn " +
103 "clean install" )
Jon Hall106be082015-07-22 09:53:00 -0700104 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700105
106 def CASE2( self, main ):
107 """
108 - Set up cell
109 - Create cell file
110 - Set cell file
111 - Verify cell file
112 - Kill ONOS process
113 - Uninstall ONOS cluster
114 - Verify ONOS start up
115 - Install ONOS cluster
116 - Connect to cli
117 """
118
119 # main.scale[ 0 ] determines the current number of ONOS controller
120 main.numCtrls = int( main.scale[ 0 ] )
121
122 main.case( "Starting up " + str( main.numCtrls ) +
123 " node(s) ONOS cluster" )
Jon Hall783bbf92015-07-23 14:33:19 -0700124 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700125 " node(s) ONOS cluster"
126
127
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700128
129 #kill off all onos processes
130 main.log.info( "Safety check, killing all ONOS processes" +
131 " before initiating enviornment setup" )
132
133 for i in range( main.maxNodes ):
134 main.ONOSbench.onosDie( main.ONOSip[ i ] )
135
136 print "NODE COUNT = ", main.numCtrls
137
138 tempOnosIp = []
139 for i in range( main.numCtrls ):
140 tempOnosIp.append( main.ONOSip[i] )
141
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700142 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
143 "temp", main.Mininet1.ip_address,
144 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700145
146 main.step( "Apply cell to environment" )
147 cellResult = main.ONOSbench.setCell( "temp" )
148 verifyResult = main.ONOSbench.verifyCell()
149 stepResult = cellResult and verifyResult
150 utilities.assert_equals( expect=main.TRUE,
151 actual=stepResult,
152 onpass="Successfully applied cell to " + \
153 "environment",
154 onfail="Failed to apply cell to environment " )
155
156 main.step( "Creating ONOS package" )
157 packageResult = main.ONOSbench.onosPackage()
158 stepResult = packageResult
159 utilities.assert_equals( expect=main.TRUE,
160 actual=stepResult,
161 onpass="Successfully created ONOS package",
162 onfail="Failed to create ONOS package" )
163
164 time.sleep( main.startUpSleep )
165 main.step( "Uninstalling ONOS package" )
166 onosUninstallResult = main.TRUE
167 for i in range( main.numCtrls ):
168 onosUninstallResult = onosUninstallResult and \
169 main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
170 stepResult = onosUninstallResult
171 utilities.assert_equals( expect=main.TRUE,
172 actual=stepResult,
173 onpass="Successfully uninstalled ONOS package",
174 onfail="Failed to uninstall ONOS package" )
175
176 time.sleep( main.startUpSleep )
177 main.step( "Installing ONOS package" )
178 onosInstallResult = main.TRUE
179 for i in range( main.numCtrls ):
180 onosInstallResult = onosInstallResult and \
181 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
182 stepResult = onosInstallResult
183 utilities.assert_equals( expect=main.TRUE,
184 actual=stepResult,
185 onpass="Successfully installed ONOS package",
186 onfail="Failed to install ONOS package" )
187
188 time.sleep( main.startUpSleep )
189 main.step( "Starting ONOS service" )
190 stopResult = main.TRUE
191 startResult = main.TRUE
192 onosIsUp = main.TRUE
193
194 for i in range( main.numCtrls ):
195 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
196 if onosIsUp == main.TRUE:
197 main.log.report( "ONOS instance is up and ready" )
198 else:
199 main.log.report( "ONOS instance may not be up, stop and " +
200 "start ONOS again " )
201 for i in range( main.numCtrls ):
202 stopResult = stopResult and \
203 main.ONOSbench.onosStop( main.ONOSip[ i ] )
204 for i in range( main.numCtrls ):
205 startResult = startResult and \
206 main.ONOSbench.onosStart( main.ONOSip[ i ] )
207 stepResult = onosIsUp and stopResult and startResult
208 utilities.assert_equals( expect=main.TRUE,
209 actual=stepResult,
210 onpass="ONOS service is ready",
211 onfail="ONOS service did not start properly" )
212
213 main.step( "Start ONOS cli" )
214 cliResult = main.TRUE
215 for i in range( main.numCtrls ):
216 cliResult = cliResult and \
217 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
218 stepResult = cliResult
219 utilities.assert_equals( expect=main.TRUE,
220 actual=stepResult,
221 onpass="Successfully start ONOS cli",
222 onfail="Failed to start ONOS cli" )
223
224 # Remove the first element in main.scale list
225 main.scale.remove( main.scale[ 0 ] )
226
227 def CASE9( self, main ):
228 '''
229 Report errors/warnings/exceptions
230 '''
231 main.log.info( "Error report: \n" )
232 main.ONOSbench.logReport( globalONOSip[0],
233 [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
234 "s" )
235 #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
236
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700237 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700238 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700239 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700240 """
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700241 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700242 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700243 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700244 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700245 "switches to test intents, exits out if " +\
246 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700247
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700248 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700249 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700250 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700251 main.topology,
252 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700253 stepResult = topoResult
254 utilities.assert_equals( expect=main.TRUE,
255 actual=stepResult,
256 onpass="Successfully loaded topology",
257 onfail="Failed to load topology" )
258 # Exit if topology did not load properly
259 if not topoResult:
260 main.cleanup()
261 main.exit()
262
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700263 def CASE11( self, main ):
264 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700265 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700266 """
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700267 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700268 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700269 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700270 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700271 "switches to test intents, exits out if " +\
272 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700273
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700274 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700275 args = "--switch ovs,protocols=OpenFlow13"
276 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
277 main.topology,
278 args=args )
279 stepResult = topoResult
280 utilities.assert_equals( expect=main.TRUE,
281 actual=stepResult,
282 onpass="Successfully loaded topology",
283 onfail="Failed to load topology" )
284 # Exit if topology did not load properly
285 if not topoResult:
286 main.cleanup()
287 main.exit()
288
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700289 def CASE12( self, main ):
290 """
291 Assign mastership to controllers
292 """
293 import re
294
295 main.case( "Assign switches to controllers" )
296 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700297 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700298 " switches to ONOS nodes"
299
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700300 assignResult = main.TRUE
301 switchList = []
302
303 # Creates a list switch name, use getSwitch() function later...
304 for i in range( 1, ( main.numSwitch + 1 ) ):
305 switchList.append( 's' + str( i ) )
306
307 tempONOSip = []
308 for i in range( main.numCtrls ):
309 tempONOSip.append( main.ONOSip[ i ] )
310
311 assignResult = main.Mininet1.assignSwController( sw=switchList,
312 ip=tempONOSip,
313 port='6633' )
314 if not assignResult:
315 main.cleanup()
316 main.exit()
317
318 for i in range( 1, ( main.numSwitch + 1 ) ):
319 response = main.Mininet1.getSwController( "s" + str( i ) )
320 print( "Response is " + str( response ) )
321 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
322 assignResult = assignResult and main.TRUE
323 else:
324 assignResult = main.FALSE
325 stepResult = assignResult
326 utilities.assert_equals( expect=main.TRUE,
327 actual=stepResult,
328 onpass="Successfully assigned switches" +
329 "to controller",
330 onfail="Failed to assign switches to " +
331 "controller" )
332 def CASE13( self, main ):
333 """
334 Discover all hosts and store its data to a dictionary
335 """
336 main.case( "Discover all hosts" )
337
338 stepResult = main.TRUE
339 main.step( "Discover all hosts using pingall " )
340 stepResult = main.intentFunction.getHostsData( main )
341 utilities.assert_equals( expect=main.TRUE,
342 actual=stepResult,
343 onpass="Successfully discovered hosts",
344 onfail="Failed to discover hosts" )
345
346 def CASE14( self, main ):
347 """
348 Stop mininet
349 """
350 main.log.report( "Stop Mininet topology" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700351 main.case( "Stop Mininet topology" )
Jon Hall783bbf92015-07-23 14:33:19 -0700352 main.caseExplanation = "Stopping the current mininet topology " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700353 "to start up fresh"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700354
355 main.step( "Stopping Mininet Topology" )
356 topoResult = main.Mininet1.stopNet( )
357 stepResult = topoResult
358 utilities.assert_equals( expect=main.TRUE,
359 actual=stepResult,
360 onpass="Successfully stop mininet",
361 onfail="Failed to stop mininet" )
362 # Exit if topology did not load properly
363 if not topoResult:
364 main.cleanup()
365 main.exit()
366
kelvin-onlabb769f562015-07-15 17:05:10 -0700367 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700368 """
369 Add host intents between 2 host:
370 - Discover hosts
371 - Add host intents
372 - Check intents
373 - Verify flows
374 - Ping hosts
375 - Reroute
376 - Link down
377 - Verify flows
378 - Check topology
379 - Ping hosts
380 - Link up
381 - Verify flows
382 - Check topology
383 - Ping hosts
384 - Remove intents
385 """
386 import time
387 import json
388 import re
389
390 # Assert variables - These variable's name|format must be followed
391 # if you want to use the wrapper function
392 assert main, "There is no main"
393 assert main.CLIs, "There is no main.CLIs"
394 assert main.Mininet1, "Mininet handle should be named Mininet1"
395 assert main.numSwitch, "Placed the total number of switch topology in \
396 main.numSwitch"
397
acsmarse6b410f2015-07-17 14:39:34 -0700398 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
399
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700400 main.case( "TESTING HOST INTENTS" )
Jon Hall783bbf92015-07-23 14:33:19 -0700401 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700402 str( main.numCtrls ) + " node(s) cluster;\n" +\
403 "Different type of hosts will be tested in " +\
404 "each step such as IPV4, Dual stack, VLAN " +\
405 "etc;\nThe test will use OF " + main.OFProtocol\
406 + "OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700407
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700408 main.step( "IPV4: Add host intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700409 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700410 stepResult = main.intentFunction.hostIntent( main,
411 onosNode='0',
412 name='IPV4',
413 host1='h1',
414 host2='h9',
415 host1Id='00:00:00:00:00:01/-1',
416 host2Id='00:00:00:00:00:09/-1',
417 sw1='s5',
418 sw2='s2',
419 expectedLink=18 )
420
421 utilities.assert_equals( expect=main.TRUE,
422 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700423 onpass="IPV4: Host intent test successful " +
424 "between two IPV4 hosts",
425 onfail="IPV4: Host intent test failed " +
426 "between two IPV4 hosts")
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700427
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700428 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700429 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700430 stepResult = main.intentFunction.hostIntent( main,
431 name='DUALSTACK',
432 host1='h3',
433 host2='h11',
434 host1Id='00:00:00:00:00:03/-1',
435 host2Id='00:00:00:00:00:0B/-1',
436 sw1='s5',
437 sw2='s2',
438 expectedLink=18 )
439
440 utilities.assert_equals( expect=main.TRUE,
441 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700442 onpass="DUALSTACK: Host intent test " +
443 "successful between two " +
444 "dual stack host using IPV4",
445 onfail="DUALSTACK: Host intent test " +
446 "failed between two" +
447 "dual stack host using IPV4" )
448
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700449
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700450 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700451 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700452 stepResult = main.intentFunction.hostIntent( main,
453 name='DUALSTACK2',
454 host1='h1',
455 host2='h11',
456 sw1='s5',
457 sw2='s2',
458 expectedLink=18 )
459
460 utilities.assert_equals( expect=main.TRUE,
461 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700462 onpass="DUALSTACK2: Host intent test " +
463 "successful between two " +
464 "dual stack host using IPV4",
465 onfail="DUALSTACK2: Host intent test " +
466 "failed between two" +
467 "dual stack host using IPV4" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700468
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700469 main.step( "1HOP: Add host intents between h1 and h3" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700470 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700471 stepResult = main.intentFunction.hostIntent( main,
472 name='1HOP',
473 host1='h1',
474 host2='h3' )
475
476 utilities.assert_equals( expect=main.TRUE,
477 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700478 onpass="1HOP: Host intent test " +
479 "successful between two " +
480 "host using IPV4 in the same switch",
481 onfail="1HOP: Host intent test " +
482 "failed between two" +
483 "host using IPV4 in the same switch" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700484
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700485 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700486 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700487 stepResult = main.intentFunction.hostIntent( main,
488 name='VLAN1',
489 host1='h4',
490 host2='h12',
491 host1Id='00:00:00:00:00:04/100',
492 host2Id='00:00:00:00:00:0C/100',
493 sw1='s5',
494 sw2='s2',
495 expectedLink=18 )
496
497 utilities.assert_equals( expect=main.TRUE,
498 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700499 onpass="VLAN1: Host intent test " +
500 "successful between two " +
501 "host using IPV4 in the same VLAN",
502 onfail="VLAN1: Host intent test " +
503 "failed between two" +
504 "host using IPV4 in the same VLAN" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700505
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700506 main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700507 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700508 stepResult = main.intentFunction.hostIntent( main,
509 name='VLAN2',
510 host1='h13',
511 host2='h20' )
512
513 utilities.assert_equals( expect=main.FALSE,
514 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700515 onpass="VLAN2: Host intent negative test " +
516 "successful between two " +
517 "host using IPV4 in different VLAN",
518 onfail="VLAN2: Host intent negative test " +
519 "failed between two" +
520 "host using IPV4 in different VLAN" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700521
acsmarse6b410f2015-07-17 14:39:34 -0700522
523 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
524 main.intentFunction.checkLeaderChange( intentLeadersOld,
525 intentLeadersNew )
526
kelvin-onlabb769f562015-07-15 17:05:10 -0700527 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700528 """
529 Add point intents between 2 hosts:
530 - Get device ids | ports
531 - Add point intents
532 - Check intents
533 - Verify flows
534 - Ping hosts
535 - Reroute
536 - Link down
537 - Verify flows
538 - Check topology
539 - Ping hosts
540 - Link up
541 - Verify flows
542 - Check topology
543 - Ping hosts
544 - Remove intents
545 """
546 import time
547 import json
548 import re
549
550 # Assert variables - These variable's name|format must be followed
551 # if you want to use the wrapper function
552 assert main, "There is no main"
553 assert main.CLIs, "There is no main.CLIs"
554 assert main.Mininet1, "Mininet handle should be named Mininet1"
555 assert main.numSwitch, "Placed the total number of switch topology in \
556 main.numSwitch"
557
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700558 main.case( "TESTING POINT INTENTS" )
Jon Hall783bbf92015-07-23 14:33:19 -0700559 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700560 " intents using " + str( main.numCtrls ) +\
561 " node(s) cluster;\n" +\
562 "Different type of hosts will be tested in " +\
563 "each step such as IPV4, Dual stack, VLAN etc" +\
564 ";\nThe test will use OF " + main.OFProtocol +\
565 "OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700566
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700567 # No option point intents
568 main.step( "NOOPTION: Add point intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700569 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700570 stepResult = main.intentFunction.pointIntent(
571 main,
572 name="NOOPTION",
573 host1="h1",
574 host2="h9",
575 deviceId1="of:0000000000000005/1",
576 deviceId2="of:0000000000000006/1",
577 sw1="s5",
578 sw2="s2",
579 expectedLink=18 )
580
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700581 utilities.assert_equals( expect=main.TRUE,
582 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700583 onpass="NOOPTION: Point intent test " +
584 "successful using no match action",
585 onfail="NOOPTION: Point intent test " +
586 "failed using no match action" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700587
588 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700589 main.step( "IPV4: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700590 stepResult = main.intentFunction.pointIntent(
591 main,
592 name="IPV4",
593 host1="h1",
594 host2="h9",
595 deviceId1="of:0000000000000005/1",
596 deviceId2="of:0000000000000006/1",
597 port1="",
598 port2="",
599 ethType="IPV4",
600 mac1="00:00:00:00:00:01",
601 mac2="00:00:00:00:00:09",
602 bandwidth="",
603 lambdaAlloc=False,
604 ipProto="",
605 ip1="",
606 ip2="",
607 tcp1="",
608 tcp2="",
609 sw1="s5",
610 sw2="s2",
611 expectedLink=18 )
612
613 utilities.assert_equals( expect=main.TRUE,
614 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700615 onpass="IPV4: Point intent test " +
616 "successful using IPV4 type with " +
617 "MAC addresses",
618 onfail="IPV4: Point intent test " +
619 "failed using IPV4 type with " +
620 "MAC addresses" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700621 main.step( "IPV4_2: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700622 stepResult = main.TRUE
623 stepResult = main.intentFunction.pointIntent(
624 main,
625 name="IPV4_2",
626 host1="h1",
627 host2="h9",
628 deviceId1="of:0000000000000005/1",
629 deviceId2="of:0000000000000006/1",
kelvin-onlabb769f562015-07-15 17:05:10 -0700630 ipProto="",
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700631 ip1="",
632 ip2="",
633 tcp1="",
634 tcp2="",
635 sw1="s5",
636 sw2="s2",
637 expectedLink=18 )
638
639 utilities.assert_equals( expect=main.TRUE,
640 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700641 onpass="IPV4_2: Point intent test " +
642 "successful using IPV4 type with " +
643 "no MAC addresses",
644 onfail="IPV4_2: Point intent test " +
645 "failed using IPV4 type with " +
646 "no MAC addresses" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700647
kelvin-onlabb769f562015-07-15 17:05:10 -0700648 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700649 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700650 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
651 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab0ad05d12015-07-23 14:21:15 -0700652 try:
653 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
654 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
655 except KeyError:
656 main.log.debug( "Key Error getting IP addresses of h1 | h9 in" +
657 "main.hostsData" )
658 ip1 = main.Mininet1.getIPAddress( 'h1')
659 ip2 = main.Mininet1.getIPAddress( 'h9')
660
kelvin-onlabb769f562015-07-15 17:05:10 -0700661 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
662 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
663 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
664
665 stepResult = main.intentFunction.pointIntent(
666 main,
667 name="SDNIP-TCP",
668 host1="h1",
669 host2="h9",
670 deviceId1="of:0000000000000005/1",
671 deviceId2="of:0000000000000006/1",
672 mac1=mac1,
673 mac2=mac2,
674 ethType="IPV4",
675 ipProto=ipProto,
676 ip1=ip1,
677 ip2=ip2,
678 tcp1=tcp1,
679 tcp2=tcp2 )
680
681 utilities.assert_equals( expect=main.TRUE,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700682 actual=stepResult,
683 onpass="SDNIP-TCP: Point intent test " +
684 "successful using IPV4 type with " +
685 "IP protocol TCP enabled",
686 onfail="SDNIP-TCP: Point intent test " +
687 "failed using IPV4 type with " +
688 "IP protocol TCP enabled" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700689
690 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
691 stepResult = main.TRUE
692 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
693 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
694 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/24"
695 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/24"
696 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
697 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
698 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
699
700 stepResult = main.intentFunction.pointIntent(
701 main,
702 name="SDNIP-ICMP",
703 host1="h1",
704 host2="h9",
705 deviceId1="of:0000000000000005/1",
706 deviceId2="of:0000000000000006/1",
707 mac1=mac1,
708 mac2=mac2,
709 ethType="IPV4",
710 ipProto=ipProto )
711
712 utilities.assert_equals( expect=main.TRUE,
713 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700714 onpass="SDNIP-ICMP: Point intent test " +
715 "successful using IPV4 type with " +
716 "IP protocol ICMP enabled",
717 onfail="SDNIP-ICMP: Point intent test " +
718 "failed using IPV4 type with " +
719 "IP protocol ICMP enabled" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700720
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700721 main.step( "DUALSTACK1: Add point intents between h1 and h9" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700722 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700723 stepResult = main.intentFunction.pointIntent(
724 main,
725 name="DUALSTACK1",
726 host1="h3",
727 host2="h11",
728 deviceId1="of:0000000000000005",
729 deviceId2="of:0000000000000006",
730 port1="3",
731 port2="3",
732 ethType="IPV4",
733 mac1="00:00:00:00:00:03",
734 mac2="00:00:00:00:00:0B",
735 bandwidth="",
736 lambdaAlloc=False,
737 ipProto="",
738 ip1="",
739 ip2="",
740 tcp1="",
741 tcp2="",
742 sw1="s5",
743 sw2="s2",
744 expectedLink=18 )
745
746 utilities.assert_equals( expect=main.TRUE,
747 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700748 onpass="DUALSTACK1: Point intent test " +
749 "successful using IPV4 type with " +
750 "MAC addresses",
751 onfail="DUALSTACK1: Point intent test " +
752 "failed using IPV4 type with " +
753 "MAC addresses" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700754
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700755 main.step( "VLAN: Add point intents between h5 and h21" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700756 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700757 stepResult = main.intentFunction.pointIntent(
758 main,
759 name="VLAN",
760 host1="h5",
761 host2="h21",
762 deviceId1="of:0000000000000005/5",
763 deviceId2="of:0000000000000007/5",
764 port1="",
765 port2="",
766 ethType="IPV4",
767 mac1="00:00:00:00:00:05",
768 mac2="00:00:00:00:00:15",
769 bandwidth="",
770 lambdaAlloc=False,
771 ipProto="",
772 ip1="",
773 ip2="",
774 tcp1="",
775 tcp2="",
776 sw1="s5",
777 sw2="s2",
778 expectedLink=18 )
779
780 utilities.assert_equals( expect=main.TRUE,
781 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700782 onpass="VLAN1: Point intent test " +
783 "successful using IPV4 type with " +
784 "MAC addresses",
785 onfail="VLAN1: Point intent test " +
786 "failed using IPV4 type with " +
787 "MAC addresses" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700788
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700789 main.step( "1HOP: Add point intents between h1 and h3" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700790 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700791 stepResult = main.intentFunction.hostIntent( main,
792 name='1HOP',
793 host1='h1',
794 host2='h3' )
795
796 utilities.assert_equals( expect=main.TRUE,
797 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700798 onpass="1HOP: Point intent test " +
799 "successful using IPV4 type with " +
800 "no MAC addresses",
801 onfail="1HOP: Point intent test " +
802 "failed using IPV4 type with " +
803 "no MAC addresses" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700804
kelvin-onlabb769f562015-07-15 17:05:10 -0700805 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700806 """
807 Add single point to multi point intents
808 - Get device ids
809 - Add single point to multi point intents
810 - Check intents
811 - Verify flows
812 - Ping hosts
813 - Reroute
814 - Link down
815 - Verify flows
816 - Check topology
817 - Ping hosts
818 - Link up
819 - Verify flows
820 - Check topology
821 - Ping hosts
822 - Remove intents
823 """
824 assert main, "There is no main"
825 assert main.CLIs, "There is no main.CLIs"
826 assert main.Mininet1, "Mininet handle should be named Mininet1"
827 assert main.numSwitch, "Placed the total number of switch topology in \
828 main.numSwitch"
829
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700830 main.case( "TESTING SINGLE TO MULTI POINT INTENTS" )
Jon Hall783bbf92015-07-23 14:33:19 -0700831 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700832 " multi point intents using " +\
833 str( main.numCtrls ) + " node(s) cluster;\n" +\
834 "Different type of hosts will be tested in " +\
835 "each step such as IPV4, Dual stack, VLAN etc" +\
836 ";\nThe test will use OF " + main.OFProtocol +\
837 "OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700838
kelvin-onlabb769f562015-07-15 17:05:10 -0700839 main.step( "NOOPTION: Add single point to multi point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700840 stepResult = main.TRUE
841 hostNames = [ 'h8', 'h16', 'h24' ]
842 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
843 'of:0000000000000007/8' ]
844 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700845 stepResult = main.intentFunction.singleToMultiIntent(
846 main,
847 name="NOOPTION",
848 hostNames=hostNames,
849 devices=devices,
850 sw1="s5",
851 sw2="s2",
852 expectedLink=18 )
853
854 utilities.assert_equals( expect=main.TRUE,
855 actual=stepResult,
856 onpass="NOOPTION: Successfully added single "
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700857 + " point to multi point intents" +
858 " with no match action",
859 onfail="NOOPTION: Failed to add single point"
860 + " point to multi point intents" +
861 " with no match action" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700862
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700863 main.step( "IPV4: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700864 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700865 stepResult = main.intentFunction.singleToMultiIntent(
866 main,
867 name="IPV4",
868 hostNames=hostNames,
869 devices=devices,
870 ports=None,
871 ethType="IPV4",
872 macs=macs,
873 bandwidth="",
874 lambdaAlloc=False,
875 ipProto="",
876 ipAddresses="",
877 tcp="",
878 sw1="s5",
879 sw2="s2",
880 expectedLink=18 )
881
882 utilities.assert_equals( expect=main.TRUE,
883 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700884 onpass="IPV4: Successfully added single "
885 + " point to multi point intents" +
886 " with IPV4 type and MAC addresses",
887 onfail="IPV4: Failed to add single point"
888 + " point to multi point intents" +
889 " with IPV4 type and MAC addresses" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700890
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700891 main.step( "IPV4_2: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700892 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700893 hostNames = [ 'h8', 'h16', 'h24' ]
894 stepResult = main.intentFunction.singleToMultiIntent(
895 main,
896 name="IPV4",
897 hostNames=hostNames,
898 ethType="IPV4",
899 lambdaAlloc=False )
900
901 utilities.assert_equals( expect=main.TRUE,
902 actual=stepResult,
903 onpass="IPV4_2: Successfully added single "
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700904 + " point to multi point intents" +
905 " with IPV4 type and no MAC addresses",
906 onfail="IPV4_2: Failed to add single point"
907 + " point to multi point intents" +
908 " with IPV4 type and no MAC addresses" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700909
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700910 main.step( "VLAN: Add single point to multi point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -0700911 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700912 hostNames = [ 'h4', 'h12', 'h20' ]
913 devices = [ 'of:0000000000000005/4', 'of:0000000000000006/4', \
914 'of:0000000000000007/4' ]
915 macs = [ '00:00:00:00:00:04', '00:00:00:00:00:0C', '00:00:00:00:00:14' ]
916 stepResult = main.intentFunction.singleToMultiIntent(
917 main,
918 name="VLAN",
919 hostNames=hostNames,
920 devices=devices,
921 ports=None,
922 ethType="IPV4",
923 macs=macs,
924 bandwidth="",
925 lambdaAlloc=False,
926 ipProto="",
927 ipAddresses="",
928 tcp="",
929 sw1="s5",
930 sw2="s2",
931 expectedLink=18 )
932
933 utilities.assert_equals( expect=main.TRUE,
934 actual=stepResult,
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700935 onpass="VLAN: Successfully added single "
936 + " point to multi point intents" +
937 " with IPV4 type and MAC addresses" +
938 " in the same VLAN",
939 onfail="VLAN: Failed to add single point"
940 + " point to multi point intents" +
941 " with IPV4 type and MAC addresses" +
942 " in the same VLAN")
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700943
kelvin-onlabb769f562015-07-15 17:05:10 -0700944 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700945 """
946 Add multi point to single point intents
947 - Get device ids
948 - Add multi point to single point intents
949 - Check intents
950 - Verify flows
951 - Ping hosts
952 - Reroute
953 - Link down
954 - Verify flows
955 - Check topology
956 - Ping hosts
957 - Link up
958 - Verify flows
959 - Check topology
960 - Ping hosts
961 - Remove intents
962 """
963 assert main, "There is no main"
964 assert main.CLIs, "There is no main.CLIs"
965 assert main.Mininet1, "Mininet handle should be named Mininet1"
966 assert main.numSwitch, "Placed the total number of switch topology in \
967 main.numSwitch"
968
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700969 main.case( "TESTING MULTI TO SINGLE POINT INTENTS" )
Jon Hall783bbf92015-07-23 14:33:19 -0700970 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700971 " multi point intents using " +\
972 str( main.numCtrls ) + " node(s) cluster;\n" +\
973 "Different type of hosts will be tested in " +\
974 "each step such as IPV4, Dual stack, VLAN etc" +\
975 ";\nThe test will use OF " + main.OFProtocol +\
976 "OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700977
kelvin-onlabb769f562015-07-15 17:05:10 -0700978 main.step( "NOOPTION: Add multi point to single point intents" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700979 stepResult = main.TRUE
980 hostNames = [ 'h8', 'h16', 'h24' ]
981 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
982 'of:0000000000000007/8' ]
983 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700984 stepResult = main.intentFunction.multiToSingleIntent(
985 main,
986 name="NOOPTION",
987 hostNames=hostNames,
988 devices=devices,
989 sw1="s5",
990 sw2="s2",
991 expectedLink=18 )
992
993 utilities.assert_equals( expect=main.TRUE,
994 actual=stepResult,
995 onpass="NOOPTION: Successfully added multi "
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700996 + " point to single point intents" +
997 " with no match action",
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700998 onfail="NOOPTION: Failed to add multi point" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700999 " to single point intents" +
1000 " with no match action" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001001
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001002 main.step( "IPV4: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -07001003 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001004 stepResult = main.intentFunction.multiToSingleIntent(
1005 main,
1006 name="IPV4",
1007 hostNames=hostNames,
1008 devices=devices,
1009 ports=None,
1010 ethType="IPV4",
1011 macs=macs,
1012 bandwidth="",
1013 lambdaAlloc=False,
1014 ipProto="",
1015 ipAddresses="",
1016 tcp="",
1017 sw1="s5",
1018 sw2="s2",
1019 expectedLink=18 )
1020
1021 utilities.assert_equals( expect=main.TRUE,
1022 actual=stepResult,
1023 onpass="IPV4: Successfully added multi point"
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001024 + " to single point intents" +
1025 " with IPV4 type and MAC addresses",
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001026 onfail="IPV4: Failed to add multi point" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001027 " to single point intents" +
1028 " with IPV4 type and MAC addresses" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001029
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001030 main.step( "IPV4_2: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -07001031 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001032 hostNames = [ 'h8', 'h16', 'h24' ]
1033 stepResult = main.intentFunction.multiToSingleIntent(
1034 main,
1035 name="IPV4",
1036 hostNames=hostNames,
1037 ethType="IPV4",
1038 lambdaAlloc=False )
1039
1040 utilities.assert_equals( expect=main.TRUE,
1041 actual=stepResult,
1042 onpass="IPV4_2: Successfully added multi point"
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001043 + " to single point intents" +
1044 " with IPV4 type and no MAC addresses",
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001045 onfail="IPV4_2: Failed to add multi point" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001046 " to single point intents" +
1047 " with IPV4 type and no MAC addresses" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001048
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001049 main.step( "VLAN: Add multi point to single point intents" )
kelvin-onlabb769f562015-07-15 17:05:10 -07001050 stepResult = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001051 hostNames = [ 'h5', 'h13', 'h21' ]
1052 devices = [ 'of:0000000000000005/5', 'of:0000000000000006/5', \
1053 'of:0000000000000007/5' ]
1054 macs = [ '00:00:00:00:00:05', '00:00:00:00:00:0D', '00:00:00:00:00:15' ]
1055 stepResult = main.intentFunction.multiToSingleIntent(
1056 main,
1057 name="VLAN",
1058 hostNames=hostNames,
1059 devices=devices,
1060 ports=None,
1061 ethType="IPV4",
1062 macs=macs,
1063 bandwidth="",
1064 lambdaAlloc=False,
1065 ipProto="",
1066 ipAddresses="",
1067 tcp="",
1068 sw1="s5",
1069 sw2="s2",
1070 expectedLink=18 )
1071
1072 utilities.assert_equals( expect=main.TRUE,
1073 actual=stepResult,
1074 onpass="VLAN: Successfully added multi point"
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001075 + " to single point intents" +
1076 " with IPV4 type and MAC addresses" +
1077 " in the same VLAN",
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001078 onfail="VLAN: Failed to add multi point" +
1079 " to single point intents" )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001080
acsmars1ff5e052015-07-23 11:27:48 -07001081 def CASE5000( self, main ):
1082 """
1083 Will add description in next patch set
1084
1085 """
1086 assert main, "There is no main"
1087 assert main.CLIs, "There is no main.CLIs"
1088 assert main.Mininet1, "Mininet handle should be named Mininet1"
1089 assert main.numSwitch, "Placed the total number of switch topology in \
1090 main.numSwitch"
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001091 main.case( "Test host mobility with host intents " )
1092 main.step( " Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001093 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1094
1095 main.log.info( "Moving h1 from s5 to s6")
1096
1097 main.Mininet1.moveHost( "h1","s5","s6" )
1098
1099 main.intentFunction.getHostsData( main )
1100 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1101
1102 utilities.assert_equals( expect="of:0000000000000006",
1103 actual=h1PostMove,
1104 onpass="Mobility: Successfully moved h1 to s6",
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001105 onfail="Mobility: Failed to moved h1 to s6" +
1106 " to single point intents" +
1107 " with IPV4 type and MAC addresses" +
1108 " in the same VLAN" )
1109
1110 main.step( "IPV4: Add host intents between h1 and h9" )
1111 stepResult = main.TRUE
1112 stepResult = main.intentFunction.hostIntent( main,
1113 onosNode='0',
1114 name='IPV4',
1115 host1='h1',
1116 host2='h9',
1117 host1Id='00:00:00:00:00:01/-1',
1118 host2Id='00:00:00:00:00:09/-1' )
1119
1120 utilities.assert_equals( expect=main.TRUE,
1121 actual=stepResult,
1122 onpass="IPV4: Host intent test successful " +
1123 "between two IPV4 hosts",
1124 onfail="IPV4: Host intent test failed " +
1125 "between two IPV4 hosts")