blob: ba4e8dd3feb0a550d9797c144228ae78d78e922c [file] [log] [blame]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001# Testing the basic intent functionality of ONOS
2
kelvin-onlabd48a68c2015-07-13 16:01:36 -07003class FUNCintent:
4
5 def __init__( self ):
6 self.default = ''
7
8 def CASE1( self, main ):
9 import time
kelvin-onlabd48a68c2015-07-13 16:01:36 -070010 import imp
Jon Hallf632d202015-07-30 15:45:11 -070011 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070012
13 """
14 - Construct tests variables
15 - GIT ( optional )
16 - Checkout ONOS master branch
17 - Pull latest ONOS code
18 - Building ONOS ( optional )
19 - Install ONOS package
20 - Build ONOS package
21 """
22
23 main.case( "Constructing test variables and building ONOS package" )
24 main.step( "Constructing test variables" )
Jon Hall783bbf92015-07-23 14:33:19 -070025 main.caseExplanation = "This test case is mainly for loading " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -070026 "from params file, and pull and build the " +\
27 " latest ONOS package"
kelvin-onlabd48a68c2015-07-13 16:01:36 -070028 stepResult = main.FALSE
29
30 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070031 try:
Jon Hallf632d202015-07-30 15:45:11 -070032 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
Jon Halla3e02432015-07-24 15:55:42 -070033 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
34 gitBranch = main.params[ 'GIT' ][ 'branch' ]
35 main.dependencyPath = main.testOnDirectory + \
36 main.params[ 'DEPENDENCY' ][ 'path' ]
37 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
38 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
39 if main.ONOSbench.maxNodes:
40 main.maxNodes = int( main.ONOSbench.maxNodes )
41 else:
42 main.maxNodes = 0
43 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
44 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
45 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
46 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
47 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070048 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070049 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
50 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
acsmars59a4c552015-09-10 18:11:19 -070051 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jon Halla3e02432015-07-24 15:55:42 -070052 gitPull = main.params[ 'GIT' ][ 'pull' ]
53 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
54 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
55 main.cellData = {} # for creating cell file
56 main.hostsData = {}
57 main.CLIs = []
58 main.ONOSip = []
Jeremy Songster1f39bf02016-01-20 17:17:25 -080059 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
60 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070061 main.assertReturnString = '' # Assembled assert return string
kelvin-onlabd48a68c2015-07-13 16:01:36 -070062
Jon Halla3e02432015-07-24 15:55:42 -070063 main.ONOSip = main.ONOSbench.getOnosIps()
64 print main.ONOSip
kelvin-onlabd48a68c2015-07-13 16:01:36 -070065
Jon Halla3e02432015-07-24 15:55:42 -070066 # Assigning ONOS cli handles to a list
67 for i in range( 1, main.maxNodes + 1 ):
68 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070069
Jon Halla3e02432015-07-24 15:55:42 -070070 # -- INIT SECTION, ONLY RUNS ONCE -- #
71 main.startUp = imp.load_source( wrapperFile1,
72 main.dependencyPath +
73 wrapperFile1 +
74 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070075
Jon Halla3e02432015-07-24 15:55:42 -070076 main.intentFunction = imp.load_source( wrapperFile2,
77 main.dependencyPath +
78 wrapperFile2 +
79 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070080
Jon Halla3e02432015-07-24 15:55:42 -070081 main.topo = imp.load_source( wrapperFile3,
82 main.dependencyPath +
83 wrapperFile3 +
84 ".py" )
85
kelvin-onlabd9e23de2015-08-06 10:34:44 -070086 copyResult1 = main.ONOSbench.scp( main.Mininet1,
87 main.dependencyPath +
88 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080089 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070090 direction="to" )
Jon Halla3e02432015-07-24 15:55:42 -070091 if main.CLIs:
92 stepResult = main.TRUE
93 else:
94 main.log.error( "Did not properly created list of ONOS CLI handle" )
95 stepResult = main.FALSE
96 except Exception as e:
97 main.log.exception(e)
98 main.cleanup()
99 main.exit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700100
101 utilities.assert_equals( expect=main.TRUE,
102 actual=stepResult,
103 onpass="Successfully construct " +
104 "test variables ",
105 onfail="Failed to construct test variables" )
106
107 if gitPull == 'True':
108 main.step( "Building ONOS in " + gitBranch + " branch" )
109 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
110 stepResult = onosBuildResult
111 utilities.assert_equals( expect=main.TRUE,
112 actual=stepResult,
113 onpass="Successfully compiled " +
114 "latest ONOS",
115 onfail="Failed to compile " +
116 "latest ONOS" )
117 else:
118 main.log.warn( "Did not pull new code so skipping mvn " +
119 "clean install" )
Jon Hall106be082015-07-22 09:53:00 -0700120 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700121
122 def CASE2( self, main ):
123 """
124 - Set up cell
125 - Create cell file
126 - Set cell file
127 - Verify cell file
128 - Kill ONOS process
129 - Uninstall ONOS cluster
130 - Verify ONOS start up
131 - Install ONOS cluster
132 - Connect to cli
133 """
134
135 # main.scale[ 0 ] determines the current number of ONOS controller
136 main.numCtrls = int( main.scale[ 0 ] )
137
138 main.case( "Starting up " + str( main.numCtrls ) +
139 " node(s) ONOS cluster" )
Jon Hall783bbf92015-07-23 14:33:19 -0700140 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700141 " node(s) ONOS cluster"
142
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700143 #kill off all onos processes
144 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800145 " before initiating environment setup" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700146
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800147 time.sleep( main.startUpSleep )
148 main.step( "Uninstalling ONOS package" )
149 onosUninstallResult = main.TRUE
150 for ip in main.ONOSip:
151 onosUninstallResult = onosUninstallResult and \
152 main.ONOSbench.onosUninstall( nodeIp=ip )
153 stepResult = onosUninstallResult
154 utilities.assert_equals( expect=main.TRUE,
155 actual=stepResult,
156 onpass="Successfully uninstalled ONOS package",
157 onfail="Failed to uninstall ONOS package" )
Jeremy42df2e72016-02-23 16:37:46 -0800158 time.sleep( main.startUpSleep )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800159
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700160 for i in range( main.maxNodes ):
161 main.ONOSbench.onosDie( main.ONOSip[ i ] )
162
163 print "NODE COUNT = ", main.numCtrls
164
165 tempOnosIp = []
166 for i in range( main.numCtrls ):
167 tempOnosIp.append( main.ONOSip[i] )
168
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700169 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
170 "temp", main.Mininet1.ip_address,
171 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700172
173 main.step( "Apply cell to environment" )
174 cellResult = main.ONOSbench.setCell( "temp" )
175 verifyResult = main.ONOSbench.verifyCell()
176 stepResult = cellResult and verifyResult
177 utilities.assert_equals( expect=main.TRUE,
178 actual=stepResult,
179 onpass="Successfully applied cell to " + \
180 "environment",
181 onfail="Failed to apply cell to environment " )
182
183 main.step( "Creating ONOS package" )
184 packageResult = main.ONOSbench.onosPackage()
185 stepResult = packageResult
186 utilities.assert_equals( expect=main.TRUE,
187 actual=stepResult,
188 onpass="Successfully created ONOS package",
189 onfail="Failed to create ONOS package" )
190
191 time.sleep( main.startUpSleep )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700192 main.step( "Installing ONOS package" )
193 onosInstallResult = main.TRUE
194 for i in range( main.numCtrls ):
195 onosInstallResult = onosInstallResult and \
196 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
197 stepResult = onosInstallResult
198 utilities.assert_equals( expect=main.TRUE,
199 actual=stepResult,
200 onpass="Successfully installed ONOS package",
201 onfail="Failed to install ONOS package" )
202
203 time.sleep( main.startUpSleep )
204 main.step( "Starting ONOS service" )
205 stopResult = main.TRUE
206 startResult = main.TRUE
207 onosIsUp = main.TRUE
208
209 for i in range( main.numCtrls ):
210 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
211 if onosIsUp == main.TRUE:
212 main.log.report( "ONOS instance is up and ready" )
213 else:
214 main.log.report( "ONOS instance may not be up, stop and " +
215 "start ONOS again " )
acsmars2ec91d62015-09-16 11:15:48 -0700216
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700217 for i in range( main.numCtrls ):
218 stopResult = stopResult and \
219 main.ONOSbench.onosStop( main.ONOSip[ i ] )
220 for i in range( main.numCtrls ):
221 startResult = startResult and \
222 main.ONOSbench.onosStart( main.ONOSip[ i ] )
223 stepResult = onosIsUp and stopResult and startResult
224 utilities.assert_equals( expect=main.TRUE,
225 actual=stepResult,
226 onpass="ONOS service is ready",
227 onfail="ONOS service did not start properly" )
228
229 main.step( "Start ONOS cli" )
230 cliResult = main.TRUE
231 for i in range( main.numCtrls ):
232 cliResult = cliResult and \
233 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
234 stepResult = cliResult
235 utilities.assert_equals( expect=main.TRUE,
236 actual=stepResult,
237 onpass="Successfully start ONOS cli",
238 onfail="Failed to start ONOS cli" )
239
240 # Remove the first element in main.scale list
241 main.scale.remove( main.scale[ 0 ] )
242
kelvin-onlab016dce22015-08-10 09:54:11 -0700243 main.intentFunction.report( main )
244
Jon Halla3e02432015-07-24 15:55:42 -0700245 def CASE8( self, main ):
246 """
acsmars59a4c552015-09-10 18:11:19 -0700247 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700248 """
249 import json
250
251 main.case( "Compare ONOS Topology view to Mininet topology" )
252 main.caseExplanation = "Compare topology elements between Mininet" +\
253 " and ONOS"
254
acsmars59a4c552015-09-10 18:11:19 -0700255 main.log.info( "Gathering topology information from Mininet" )
256 devicesResults = main.FALSE # Overall Boolean for device correctness
257 linksResults = main.FALSE # Overall Boolean for link correctness
258 hostsResults = main.FALSE # Overall Boolean for host correctness
259 deviceFails = [] # Nodes where devices are incorrect
260 linkFails = [] # Nodes where links are incorrect
261 hostFails = [] # Nodes where hosts are incorrect
262 attempts = main.checkTopoAttempts # Remaining Attempts
Jon Halla3e02432015-07-24 15:55:42 -0700263
264 mnSwitches = main.Mininet1.getSwitches()
265 mnLinks = main.Mininet1.getLinks()
266 mnHosts = main.Mininet1.getHosts()
267
Jon Hall70b2ff42015-11-17 15:49:44 -0800268 main.step( "Comparing Mininet topology to ONOS topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700269
acsmars59a4c552015-09-10 18:11:19 -0700270 while ( attempts >= 0 ) and\
271 ( not devicesResults or not linksResults or not hostsResults ):
272 time.sleep( 2 )
273 if not devicesResults:
274 devices = main.topo.getAllDevices( main )
275 ports = main.topo.getAllPorts( main )
276 devicesResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800277 deviceFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700278 if not linksResults:
279 links = main.topo.getAllLinks( main )
280 linksResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800281 linkFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700282 if not hostsResults:
283 hosts = main.topo.getAllHosts( main )
284 hostsResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800285 hostFails = [] # Reset for each failed attempt
Jon Halla3e02432015-07-24 15:55:42 -0700286
acsmars59a4c552015-09-10 18:11:19 -0700287 # Check for matching topology on each node
288 for controller in range( main.numCtrls ):
289 controllerStr = str( controller + 1 ) # ONOS node number
290 # Compare Devices
291 if devices[ controller ] and ports[ controller ] and\
292 "Error" not in devices[ controller ] and\
293 "Error" not in ports[ controller ]:
Jon Halla3e02432015-07-24 15:55:42 -0700294
acsmars2ec91d62015-09-16 11:15:48 -0700295 try:
296 deviceData = json.loads( devices[ controller ] )
297 portData = json.loads( ports[ controller ] )
298 except (TypeError,ValueError):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800299 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
acsmars2ec91d62015-09-16 11:15:48 -0700300 currentDevicesResult = main.FALSE
301 else:
302 currentDevicesResult = main.Mininet1.compareSwitches(
303 mnSwitches,deviceData,portData )
acsmars59a4c552015-09-10 18:11:19 -0700304 else:
305 currentDevicesResult = main.FALSE
306 if not currentDevicesResult:
307 deviceFails.append( controllerStr )
308 devicesResults = devicesResults and currentDevicesResult
309 # Compare Links
310 if links[ controller ] and "Error" not in links[ controller ]:
acsmars2ec91d62015-09-16 11:15:48 -0700311 try:
312 linkData = json.loads( links[ controller ] )
313 except (TypeError,ValueError):
314 main.log.error("Could not load json:" + str( links[ controller ] ) )
315 currentLinksResult = main.FALSE
316 else:
317 currentLinksResult = main.Mininet1.compareLinks(
318 mnSwitches, mnLinks,linkData )
acsmars59a4c552015-09-10 18:11:19 -0700319 else:
320 currentLinksResult = main.FALSE
321 if not currentLinksResult:
322 linkFails.append( controllerStr )
323 linksResults = linksResults and currentLinksResult
324 # Compare Hosts
acsmars2ec91d62015-09-16 11:15:48 -0700325 if hosts[ controller ] and "Error" not in hosts[ controller ]:
326 try:
327 hostData = json.loads( hosts[ controller ] )
328 except (TypeError,ValueError):
329 main.log.error("Could not load json:" + str( hosts[ controller ] ) )
330 currentHostsResult = main.FALSE
331 else:
332 currentHostsResult = main.Mininet1.compareHosts(
333 mnHosts,hostData )
acsmars59a4c552015-09-10 18:11:19 -0700334 else:
335 currentHostsResult = main.FALSE
336 if not currentHostsResult:
337 hostFails.append( controllerStr )
338 hostsResults = hostsResults and currentHostsResult
339 # Decrement Attempts Remaining
340 attempts -= 1
341
342
343 utilities.assert_equals( expect=[],
344 actual=deviceFails,
345 onpass="ONOS correctly discovered all devices",
346 onfail="ONOS incorrectly discovered devices on nodes: " +
347 str( deviceFails ) )
348 utilities.assert_equals( expect=[],
349 actual=linkFails,
350 onpass="ONOS correctly discovered all links",
351 onfail="ONOS incorrectly discovered links on nodes: " +
352 str( linkFails ) )
353 utilities.assert_equals( expect=[],
354 actual=hostFails,
355 onpass="ONOS correctly discovered all hosts",
356 onfail="ONOS incorrectly discovered hosts on nodes: " +
357 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700358 topoResults = hostsResults and linksResults and devicesResults
359 utilities.assert_equals( expect=main.TRUE,
360 actual=topoResults,
361 onpass="ONOS correctly discovered the topology",
362 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700363
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700364 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700365 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700366 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700367 """
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700368 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700369 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700370 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700371 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700372 "switches to test intents, exits out if " +\
373 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700374
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700375 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700376 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700377 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700378 main.topology,
379 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700380 stepResult = topoResult
381 utilities.assert_equals( expect=main.TRUE,
382 actual=stepResult,
383 onpass="Successfully loaded topology",
384 onfail="Failed to load topology" )
385 # Exit if topology did not load properly
386 if not topoResult:
387 main.cleanup()
388 main.exit()
389
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700390 def CASE11( self, main ):
391 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700392 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700393 """
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700394 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700395 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700396 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700397 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700398 "switches to test intents, exits out if " +\
399 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700400
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700401 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700402 args = "--switch ovs,protocols=OpenFlow13"
403 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
404 main.topology,
405 args=args )
406 stepResult = topoResult
407 utilities.assert_equals( expect=main.TRUE,
408 actual=stepResult,
409 onpass="Successfully loaded topology",
410 onfail="Failed to load topology" )
411 # Exit if topology did not load properly
412 if not topoResult:
413 main.cleanup()
414 main.exit()
415
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700416 def CASE12( self, main ):
417 """
418 Assign mastership to controllers
419 """
420 import re
421
422 main.case( "Assign switches to controllers" )
423 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700424 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700425 " switches to ONOS nodes"
426
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700427 assignResult = main.TRUE
428 switchList = []
429
430 # Creates a list switch name, use getSwitch() function later...
431 for i in range( 1, ( main.numSwitch + 1 ) ):
432 switchList.append( 's' + str( i ) )
433
434 tempONOSip = []
435 for i in range( main.numCtrls ):
436 tempONOSip.append( main.ONOSip[ i ] )
437
438 assignResult = main.Mininet1.assignSwController( sw=switchList,
439 ip=tempONOSip,
Charles Chan029be652015-08-24 01:46:10 +0800440 port='6653' )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700441 if not assignResult:
442 main.cleanup()
443 main.exit()
444
445 for i in range( 1, ( main.numSwitch + 1 ) ):
446 response = main.Mininet1.getSwController( "s" + str( i ) )
447 print( "Response is " + str( response ) )
448 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
449 assignResult = assignResult and main.TRUE
450 else:
451 assignResult = main.FALSE
452 stepResult = assignResult
453 utilities.assert_equals( expect=main.TRUE,
454 actual=stepResult,
455 onpass="Successfully assigned switches" +
456 "to controller",
457 onfail="Failed to assign switches to " +
458 "controller" )
acsmars5d8cc862015-09-25 09:44:50 -0700459
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800460 def CASE13( self,main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700461 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800462 Create Scapy components
463 """
464 main.case( "Create scapy components" )
465 main.step( "Create scapy components" )
466 import json
467 scapyResult = main.TRUE
468 for hostName in main.scapyHostNames:
469 main.Scapy1.createHostComponent( hostName )
470 main.scapyHosts.append( getattr( main, hostName ) )
471
472 main.step( "Start scapy components" )
473 for host in main.scapyHosts:
474 host.startHostCli()
475 host.startScapy()
476 host.updateSelf()
477 main.log.debug( host.name )
478 main.log.debug( host.hostIp )
479 main.log.debug( host.hostMac )
480
481
482 utilities.assert_equals( expect=main.TRUE,
483 actual=scapyResult,
484 onpass="Successfully created Scapy Components",
485 onfail="Failed to discover Scapy Components" )
486
487 def CASE14( self, main ):
488 """
489 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490 """
491 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800492 main.step( "Pingall hosts and confirm ONOS discovery" )
493 utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700494
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800495 utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE,
496 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700497 utilities.assert_equals( expect=main.TRUE,
498 actual=stepResult,
499 onpass="Successfully discovered hosts",
500 onfail="Failed to discover hosts" )
501
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800502 main.step( "Populate hostsData" )
503 stepResult = main.intentFunction.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700504 utilities.assert_equals( expect=main.TRUE,
505 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800506 onpass="Successfully populated hostsData",
507 onfail="Failed to populate hostsData" )
508
509 def CASE15( self, main ):
510 """
511 Discover all hosts with scapy arp packets and store its data to a dictionary
512 """
513 main.case( "Discover all hosts using scapy" )
514 main.step( "Send packets from each host to the first host and confirm onos discovery" )
515
516 import collections
517 if len( main.scapyHosts ) < 1:
518 main.log.error( "No scapy hosts have been created" )
519 main.skipCase()
520
521 # Send ARP packets from each scapy host component
522 main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
523
524 stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
525 retValue=main.FALSE, args=[ main ],
526 attempts=main.checkTopoAttempts, sleep=2 )
527
528 utilities.assert_equals( expect=main.TRUE,
529 actual=stepResult,
530 onpass="ONOS correctly discovered all hosts",
531 onfail="ONOS incorrectly discovered hosts" )
532
533 main.step( "Populate hostsData" )
534 stepResult = main.intentFunction.populateHostData( main )
535 utilities.assert_equals( expect=main.TRUE,
536 actual=stepResult,
537 onpass="Successfully populated hostsData",
538 onfail="Failed to populate hostsData" )
539
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800540 def CASE16( self, main ):
541 """
Jeremy42df2e72016-02-23 16:37:46 -0800542 Balance Masters
543 """
544 main.case( "Balance mastership of switches" )
545 main.step( "Balancing mastership of switches" )
546
547 balanceResult = main.FALSE
548 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
549
550 utilities.assert_equals( expect=main.TRUE,
551 actual=stepResult,
552 onpass="Successfully balanced mastership of switches",
553 onfail="Failed to balance mastership of switches" )
554
555 def CASE17( self, main ):
556 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800557 Stop mininet and remove scapy host
558 """
559 main.log.report( "Stop Mininet and Scapy" )
560 main.case( "Stop Mininet and Scapy" )
561 main.caseExplanation = "Stopping the current mininet topology " +\
562 "to start up fresh"
563 main.step( "Stopping and Removing Scapy Host Components" )
564 scapyResult = main.TRUE
565 for host in main.scapyHosts:
566 scapyResult = scapyResult and host.stopScapy()
567 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
568
569 for host in main.scapyHosts:
570 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
571 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
572
573 main.scapyHosts = []
574 main.scapyHostIPs = []
575
576 utilities.assert_equals( expect=main.TRUE,
577 actual=scapyResult,
578 onpass="Successfully stopped scapy and removed host components",
579 onfail="Failed to stop mininet and scapy" )
580
581 main.step( "Stopping Mininet Topology" )
582 mininetResult = main.Mininet1.stopNet( )
583
584 utilities.assert_equals( expect=main.TRUE,
585 actual=mininetResult,
586 onpass="Successfully stopped mininet and scapy",
587 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700588 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800589 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700590 main.cleanup()
591 main.exit()
592
kelvin-onlabb769f562015-07-15 17:05:10 -0700593 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700594 """
595 Add host intents between 2 host:
596 - Discover hosts
597 - Add host intents
598 - Check intents
599 - Verify flows
600 - Ping hosts
601 - Reroute
602 - Link down
603 - Verify flows
604 - Check topology
605 - Ping hosts
606 - Link up
607 - Verify flows
608 - Check topology
609 - Ping hosts
610 - Remove intents
611 """
612 import time
613 import json
614 import re
615
616 # Assert variables - These variable's name|format must be followed
617 # if you want to use the wrapper function
618 assert main, "There is no main"
619 assert main.CLIs, "There is no main.CLIs"
620 assert main.Mininet1, "Mininet handle should be named Mininet1"
621 assert main.numSwitch, "Placed the total number of switch topology in \
622 main.numSwitch"
623
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800624 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700625 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
626
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700627 main.testName = "Host Intents"
628 main.case( main.testName + " Test - " + str( main.numCtrls ) +
kelvin-onlab4cfa81c2015-07-24 11:36:23 -0700629 " NODE(S) - OF " + main.OFProtocol )
Jon Hall783bbf92015-07-23 14:33:19 -0700630 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700631 str( main.numCtrls ) + " node(s) cluster;\n" +\
632 "Different type of hosts will be tested in " +\
633 "each step such as IPV4, Dual stack, VLAN " +\
634 "etc;\nThe test will use OF " + main.OFProtocol\
kelvin-onlab4cfa81c2015-07-24 11:36:23 -0700635 + " OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700636
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700637 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700638 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800639 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
640 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
641 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800642 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800643 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700644 name='IPV4',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800645 onosNode='0',
646 host1=host1,
647 host2=host2)
648 if installResult:
649 testResult = main.intentFunction.testHostIntent( main,
650 name='IPV4',
651 intentId = installResult,
652 onosNode='0',
653 host1=host1,
654 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700655 sw1='s5',
656 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800657 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800658 else:
659 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800660
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700661 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800662 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700663 onpass=main.assertReturnString,
664 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700665
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700666 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700667 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800668 host1 = { "name":"h3","id":"00:00:00:00:00:03/-1" }
669 host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1 "}
670 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800671 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800672 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700673 name='DUALSTACK',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800674 onosNode='0',
675 host1=host1,
676 host2=host2)
677
678 if installResult:
679 testResult = main.intentFunction.testHostIntent( main,
680 name='DUALSTACK',
681 intentId = installResult,
682 onosNode='0',
683 host1=host1,
684 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700685 sw1='s5',
686 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800687 expectedLink = 18)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700688
689 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800690 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700691 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800692 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700693
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700694 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700695 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800696 host1 = { "name":"h1" }
697 host2 = { "name":"h11" }
698 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800699 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800700 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700701 name='DUALSTACK2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800702 onosNode='0',
703 host1=host1,
704 host2=host2)
705
706 if installResult:
707 testResult = main.intentFunction.testHostIntent( main,
708 name='DUALSTACK2',
709 intentId = installResult,
710 onosNode='0',
711 host1=host1,
712 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700713 sw1='s5',
714 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800715 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800716 else:
717 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700718
719 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800720 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700721 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800722 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700723
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700724 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700725 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800726 host1 = { "name":"h1" }
727 host2 = { "name":"h3" }
728 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800729 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800730 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700731 name='1HOP',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800732 onosNode='0',
733 host1=host1,
734 host2=host2)
735
736 if installResult:
737 testResult = main.intentFunction.testHostIntent( main,
738 name='1HOP',
739 intentId = installResult,
740 onosNode='0',
741 host1=host1,
742 host2=host2,
743 sw1='s5',
744 sw2='s2',
745 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800746 else:
747 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700748
749 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800750 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700751 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800752 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700753
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700754 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700755 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800756 host1 = { "name":"h4","id":"00:00:00:00:00:04/100" }
757 host2 = { "name":"h12","id":"00:00:00:00:00:0C/100 "}
758 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800759 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800760 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700761 name='VLAN1',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800762 onosNode='0',
763 host1=host1,
764 host2=host2)
765
766 if installResult:
767 testResult = main.intentFunction.testHostIntent( main,
768 name='VLAN1',
769 intentId = installResult,
770 onosNode='0',
771 host1=host1,
772 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700773 sw1='s5',
774 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800775 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800776 else:
777 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700778
779 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800780 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700781 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800782 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700783
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700784 main.step( "VLAN2: Add inter vlan host intents between h13 and h20" )
acsmars5d8cc862015-09-25 09:44:50 -0700785 main.assertReturnString = "Assertion Result different VLAN negative test\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800786 host1 = { "name":"h13" }
787 host2 = { "name":"h20" }
788 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800789 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800790 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700791 name='VLAN2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800792 onosNode='0',
793 host1=host1,
794 host2=host2)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700795
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800796 if installResult:
797 testResult = main.intentFunction.testHostIntent( main,
798 name='VLAN2',
799 intentId = installResult,
800 onosNode='0',
801 host1=host1,
802 host2=host2,
803 sw1='s5',
804 sw2='s2',
805 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800806 else:
807 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800808
809 utilities.assert_equals( expect=main.TRUE,
810 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700811 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800812 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700813
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800814 main.step( "Confirm that ONOS leadership is unchanged")
acsmarse6b410f2015-07-17 14:39:34 -0700815 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
816 main.intentFunction.checkLeaderChange( intentLeadersOld,
817 intentLeadersNew )
818
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800819 utilities.assert_equals( expect=main.TRUE,
820 actual=testResult,
821 onpass="ONOS Leaders Unchanged",
822 onfail="ONOS Leader Mismatch")
823
kelvin-onlab016dce22015-08-10 09:54:11 -0700824 main.intentFunction.report( main )
825
kelvin-onlabb769f562015-07-15 17:05:10 -0700826 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700827 """
828 Add point intents between 2 hosts:
829 - Get device ids | ports
830 - Add point intents
831 - Check intents
832 - Verify flows
833 - Ping hosts
834 - Reroute
835 - Link down
836 - Verify flows
837 - Check topology
838 - Ping hosts
839 - Link up
840 - Verify flows
841 - Check topology
842 - Ping hosts
843 - Remove intents
844 """
845 import time
846 import json
847 import re
848
849 # Assert variables - These variable's name|format must be followed
850 # if you want to use the wrapper function
851 assert main, "There is no main"
852 assert main.CLIs, "There is no main.CLIs"
853 assert main.Mininet1, "Mininet handle should be named Mininet1"
854 assert main.numSwitch, "Placed the total number of switch topology in \
855 main.numSwitch"
856
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700857 main.testName = "Point Intents"
858 main.case( main.testName + " Test - " + str( main.numCtrls ) +
kelvin-onlab4cfa81c2015-07-24 11:36:23 -0700859 " NODE(S) - OF " + main.OFProtocol )
Jon Hall783bbf92015-07-23 14:33:19 -0700860 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700861 " intents using " + str( main.numCtrls ) +\
862 " node(s) cluster;\n" +\
863 "Different type of hosts will be tested in " +\
864 "each step such as IPV4, Dual stack, VLAN etc" +\
865 ";\nThe test will use OF " + main.OFProtocol +\
kelvin-onlab4cfa81c2015-07-24 11:36:23 -0700866 " OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700867
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700868 # No option point intents
869 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700870 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800871 senders = [
872 { "name":"h1","device":"of:0000000000000005/1" }
873 ]
874 recipients = [
875 { "name":"h9","device":"of:0000000000000006/1" }
876 ]
Jeremy42df2e72016-02-23 16:37:46 -0800877 testResult = main.FALSE
878 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800879 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700880 main,
881 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800882 senders=senders,
883 recipients=recipients )
884
885 if installResult:
886 testResult = main.intentFunction.testPointIntent(
887 main,
888 intentId=installResult,
889 name="NOOPTION",
890 senders=senders,
891 recipients=recipients,
892 sw1="s5",
893 sw2="s2",
894 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -0800895 else:
896 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700897
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700898 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800899 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700900 onpass=main.assertReturnString,
901 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700902
903 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -0700904 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700905 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800906 senders = [
907 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
908 ]
909 recipients = [
910 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
911 ]
Jeremy42df2e72016-02-23 16:37:46 -0800912 testResult = main.FALSE
913 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800914 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700915 main,
916 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800917 senders=senders,
918 recipients=recipients,
919 ethType="IPV4" )
920
921 if installResult:
922 testResult = main.intentFunction.testPointIntent(
923 main,
924 intentId=installResult,
925 name="IPV4",
926 senders=senders,
927 recipients=recipients,
928 sw1="s5",
929 sw2="s2",
930 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -0800931 else:
932 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700933
934 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800935 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700936 onpass=main.assertReturnString,
937 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -0700938 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700939 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800940 senders = [
941 { "name":"h1","device":"of:0000000000000005/1" }
942 ]
943 recipients = [
944 { "name":"h9","device":"of:0000000000000006/1" }
945 ]
Jeremy42df2e72016-02-23 16:37:46 -0800946 testResult = main.FALSE
947 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800948 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700949 main,
950 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800951 senders=senders,
952 recipients=recipients,
953 ethType="IPV4" )
954
955 if installResult:
956 testResult = main.intentFunction.testPointIntent(
957 main,
958 intentId=installResult,
959 name="IPV4_2",
960 senders=senders,
961 recipients=recipients,
962 sw1="s5",
963 sw2="s2",
964 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -0800965 else:
966 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700967
968 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800969 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700970 onpass=main.assertReturnString,
971 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700972
kelvin-onlabb55e58e2015-08-04 00:13:48 -0700973 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700974 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800975 senders = [
976 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01",
977 "ip":main.h1.hostIp }
978 ]
979 recipients = [
980 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
981 "ip":main.h9.hostIp }
982 ]
kelvin-onlabb769f562015-07-15 17:05:10 -0700983 ipProto = main.params[ 'SDNIP' ][ 'icmpProto' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -0700984 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800985 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
986 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -0800987 testResult = main.FALSE
988 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800989 installResult = main.intentFunction.installPointIntent(
990 main,
991 name="SDNIP-ICMP",
992 senders=senders,
993 recipients=recipients,
994 ethType="IPV4",
995 ipProto=ipProto,
996 tcpSrc=tcpSrc,
997 tcpDst=tcpDst )
998
999 if installResult:
1000 testResult = main.intentFunction.testPointIntent(
1001 main,
1002 intentId=installResult,
1003 name="SDNIP_ICMP",
1004 senders=senders,
1005 recipients=recipients,
1006 sw1="s5",
1007 sw2="s2",
1008 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001009 else:
1010 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001011
1012 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001013 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001014 onpass=main.assertReturnString,
1015 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001016
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001017 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001018 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001019 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1020 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001021 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1022 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001023 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1024 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1025 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1026
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001027 stepResult = main.intentFunction.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001028 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001029 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001030 host1="h1",
1031 host2="h9",
1032 deviceId1="of:0000000000000005/1",
1033 deviceId2="of:0000000000000006/1",
1034 mac1=mac1,
1035 mac2=mac2,
1036 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001037 ipProto=ipProto,
1038 ip1=ip1,
1039 ip2=ip2,
1040 tcp1=tcp1,
1041 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001042
1043 utilities.assert_equals( expect=main.TRUE,
1044 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001045 onpass=main.assertReturnString,
1046 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001047
acsmars5d8cc862015-09-25 09:44:50 -07001048 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1049 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001050 senders = [
1051 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1052 ]
1053 recipients = [
1054 { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
1055 ]
Jeremy42df2e72016-02-23 16:37:46 -08001056 testResult = main.FALSE
1057 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001058 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001059 main,
1060 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001061 senders=senders,
1062 recipients=recipients,
1063 ethType="IPV4" )
1064
1065 if installResult:
1066 testResult = main.intentFunction.testPointIntent(
1067 main,
1068 intentId=installResult,
1069 name="DUALSTACK1",
1070 senders=senders,
1071 recipients=recipients,
1072 sw1="s5",
1073 sw2="s2",
1074 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001075 else:
1076 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001077
1078 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001079 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001080 onpass=main.assertReturnString,
1081 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001082
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001083 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001084 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001085 senders = [
1086 { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05" }
1087 ]
1088 recipients = [
1089 { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15" }
1090 ]
Jeremy42df2e72016-02-23 16:37:46 -08001091 testResult = main.FALSE
1092 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001093 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001094 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001095 name="DUALSTACK1",
1096 senders=senders,
1097 recipients=recipients,
1098 ethType="IPV4" )
1099
1100 if installResult:
1101 testResult = main.intentFunction.testPointIntent(
1102 main,
1103 intentId=installResult,
1104 name="DUALSTACK1",
1105 senders=senders,
1106 recipients=recipients,
1107 sw1="s5",
1108 sw2="s2",
1109 expectedLink=18)
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001110
1111 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001112 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001113 onpass=main.assertReturnString,
1114 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001115
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001116 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001117 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001118 senders = [
1119 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1120 ]
1121 recipients = [
1122 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1123 ]
Jeremy42df2e72016-02-23 16:37:46 -08001124 testResult = main.FALSE
1125 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001126 installResult = main.intentFunction.installPointIntent(
1127 main,
1128 name="1HOP IPV4",
1129 senders=senders,
1130 recipients=recipients,
1131 ethType="IPV4" )
1132
1133 if installResult:
1134 testResult = main.intentFunction.testPointIntent(
1135 main,
1136 intentId=installResult,
1137 name="1HOP IPV4",
1138 senders=senders,
1139 recipients=recipients,
1140 sw1="s5",
1141 sw2="s2",
1142 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001143 else:
1144 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001145
1146 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001147 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001148 onpass=main.assertReturnString,
1149 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001150
kelvin-onlab016dce22015-08-10 09:54:11 -07001151 main.intentFunction.report( main )
1152
kelvin-onlabb769f562015-07-15 17:05:10 -07001153 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001154 """
1155 Add single point to multi point intents
1156 - Get device ids
1157 - Add single point to multi point intents
1158 - Check intents
1159 - Verify flows
1160 - Ping hosts
1161 - Reroute
1162 - Link down
1163 - Verify flows
1164 - Check topology
1165 - Ping hosts
1166 - Link up
1167 - Verify flows
1168 - Check topology
1169 - Ping hosts
1170 - Remove intents
1171 """
1172 assert main, "There is no main"
1173 assert main.CLIs, "There is no main.CLIs"
1174 assert main.Mininet1, "Mininet handle should be named Mininet1"
1175 assert main.numSwitch, "Placed the total number of switch topology in \
1176 main.numSwitch"
1177
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001178 main.testName = "Single to Multi Point Intents"
1179 main.case( main.testName + " Test - " + str( main.numCtrls ) +
1180 " NODE(S) - OF " + main.OFProtocol )
Jon Hall783bbf92015-07-23 14:33:19 -07001181 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001182 " multi point intents using " +\
1183 str( main.numCtrls ) + " node(s) cluster;\n" +\
1184 "Different type of hosts will be tested in " +\
1185 "each step such as IPV4, Dual stack, VLAN etc" +\
1186 ";\nThe test will use OF " + main.OFProtocol +\
kelvin-onlab4cfa81c2015-07-24 11:36:23 -07001187 " OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001188
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001189 main.step( "NOOPTION: Install and test single point to multi point intents" )
1190 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1191 senders = [
1192 { "name":"h8", "device":"of:0000000000000005/8" }
1193 ]
1194 recipients = [
1195 { "name":"h16", "device":"of:0000000000000006/8" },
1196 { "name":"h24", "device":"of:0000000000000007/8" }
1197 ]
1198 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1199 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1200 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001201 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001202 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001203 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001204 name="NOOPTION",
1205 senders=senders,
1206 recipients=recipients,
1207 sw1="s5",
1208 sw2="s2")
1209
1210 if installResult:
1211 testResult = main.intentFunction.testPointIntent(
1212 main,
1213 intentId=installResult,
1214 name="NOOPTION",
1215 senders=senders,
1216 recipients=recipients,
1217 badSenders=badSenders,
1218 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001219 sw1="s5",
1220 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001221 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001222 else:
1223 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001224
1225 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001226 actual=testResult,
1227 onpass=main.assertReturnString,
1228 onfail=main.assertReturnString )
1229
1230 main.step( "IPV4: Install and test single point to multi point intents" )
1231 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1232 senders = [
1233 { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
1234 ]
1235 recipients = [
1236 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1237 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1238 ]
1239 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1240 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1241 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001242 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001243 installResult = main.intentFunction.installSingleToMultiIntent(
1244 main,
1245 name="IPV4",
1246 senders=senders,
1247 recipients=recipients,
1248 ethType="IPV4",
1249 sw1="s5",
1250 sw2="s2")
1251
1252 if installResult:
1253 testResult = main.intentFunction.testPointIntent(
1254 main,
1255 intentId=installResult,
1256 name="IPV4",
1257 senders=senders,
1258 recipients=recipients,
1259 badSenders=badSenders,
1260 badRecipients=badRecipients,
1261 sw1="s5",
1262 sw2="s2",
1263 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001264 else:
1265 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001266
1267 utilities.assert_equals( expect=main.TRUE,
1268 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001269 onpass=main.assertReturnString,
1270 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001271
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001272 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001273 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and no MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001274 senders = [
1275 { "name":"h8", "device":"of:0000000000000005/8" }
1276 ]
1277 recipients = [
1278 { "name":"h16", "device":"of:0000000000000006/8" },
1279 { "name":"h24", "device":"of:0000000000000007/8" }
1280 ]
1281 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1282 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1283 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001284 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001285 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001286 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001287 name="IPV4_2",
1288 senders=senders,
1289 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001290 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001291 sw1="s5",
1292 sw2="s2")
1293
1294 if installResult:
1295 testResult = main.intentFunction.testPointIntent(
1296 main,
1297 intentId=installResult,
1298 name="IPV4_2",
1299 senders=senders,
1300 recipients=recipients,
1301 badSenders=badSenders,
1302 badRecipients=badRecipients,
1303 sw1="s5",
1304 sw2="s2",
1305 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001306 else:
1307 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001308
1309 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001310 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001311 onpass=main.assertReturnString,
1312 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001313
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001314 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001315 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses in the same VLAN\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001316 senders = [
1317 { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" }
1318 ]
1319 recipients = [
1320 { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" },
1321 { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" }
1322 ]
1323 badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
1324 badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
1325 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001326 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001327 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001328 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001329 name="IPV4",
1330 senders=senders,
1331 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001332 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001333 sw1="s5",
1334 sw2="s2")
1335
1336 if installResult:
1337 testResult = main.intentFunction.testPointIntent(
1338 main,
1339 intentId=installResult,
1340 name="IPV4",
1341 senders=senders,
1342 recipients=recipients,
1343 badSenders=badSenders,
1344 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001345 sw1="s5",
1346 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001347 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001348 else:
1349 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001350
1351 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001352 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001353 onpass=main.assertReturnString,
1354 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001355
kelvin-onlab016dce22015-08-10 09:54:11 -07001356 main.intentFunction.report( main )
1357
kelvin-onlabb769f562015-07-15 17:05:10 -07001358 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001359 """
1360 Add multi point to single point intents
1361 - Get device ids
1362 - Add multi point to single point intents
1363 - Check intents
1364 - Verify flows
1365 - Ping hosts
1366 - Reroute
1367 - Link down
1368 - Verify flows
1369 - Check topology
1370 - Ping hosts
1371 - Link up
1372 - Verify flows
1373 - Check topology
1374 - Ping hosts
1375 - Remove intents
1376 """
1377 assert main, "There is no main"
1378 assert main.CLIs, "There is no main.CLIs"
1379 assert main.Mininet1, "Mininet handle should be named Mininet1"
1380 assert main.numSwitch, "Placed the total number of switch topology in \
1381 main.numSwitch"
1382
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001383 main.testName = "Multi To Single Point Intents"
1384 main.case( main.testName + " Test - " + str( main.numCtrls ) +
1385 " NODE(S) - OF " + main.OFProtocol )
Jon Hall783bbf92015-07-23 14:33:19 -07001386 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001387 " multi point intents using " +\
1388 str( main.numCtrls ) + " node(s) cluster;\n" +\
1389 "Different type of hosts will be tested in " +\
1390 "each step such as IPV4, Dual stack, VLAN etc" +\
1391 ";\nThe test will use OF " + main.OFProtocol +\
kelvin-onlab4cfa81c2015-07-24 11:36:23 -07001392 " OVS running in Mininet"
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001393
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001394 main.step( "NOOPTION: Add multi point to single point intents" )
1395 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1396 senders = [
1397 { "name":"h16", "device":"of:0000000000000006/8" },
1398 { "name":"h24", "device":"of:0000000000000007/8" }
1399 ]
1400 recipients = [
1401 { "name":"h8", "device":"of:0000000000000005/8" }
1402 ]
1403 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1404 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1405 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001406 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001407 installResult = main.intentFunction.installMultiToSingleIntent(
1408 main,
1409 name="NOOPTION",
1410 senders=senders,
1411 recipients=recipients,
1412 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001413 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001414
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001415 if installResult:
1416 testResult = main.intentFunction.testPointIntent(
1417 main,
1418 intentId=installResult,
1419 name="NOOPTION",
1420 senders=senders,
1421 recipients=recipients,
1422 badSenders=badSenders,
1423 badRecipients=badRecipients,
1424 sw1="s5",
1425 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001426 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001427 else:
1428 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001429
1430 utilities.assert_equals( expect=main.TRUE,
1431 actual=testResult,
1432 onpass=main.assertReturnString,
1433 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001434
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001435 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001436 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001437 senders = [
1438 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1439 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1440 ]
1441 recipients = [
1442 { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" }
1443 ]
1444 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1445 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1446 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001447 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001448 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001449 main,
1450 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001451 senders=senders,
1452 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001453 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001454 sw1="s5",
1455 sw2="s2")
1456
1457 if installResult:
1458 testResult = main.intentFunction.testPointIntent(
1459 main,
1460 intentId=installResult,
1461 name="IPV4",
1462 senders=senders,
1463 recipients=recipients,
1464 badSenders=badSenders,
1465 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001466 sw1="s5",
1467 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001468 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001469 else:
1470 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001471
1472 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001473 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001474 onpass=main.assertReturnString,
1475 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001476
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001477 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001478 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001479 senders = [
1480 { "name":"h16", "device":"of:0000000000000006/8" },
1481 { "name":"h24", "device":"of:0000000000000007/8" }
1482 ]
1483 recipients = [
1484 { "name":"h8", "device":"of:0000000000000005/8" }
1485 ]
1486 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1487 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1488 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001489 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001490 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001491 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001492 name="IPV4_2",
1493 senders=senders,
1494 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001495 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001496 sw1="s5",
1497 sw2="s2")
1498
1499 if installResult:
1500 testResult = main.intentFunction.testPointIntent(
1501 main,
1502 intentId=installResult,
1503 name="IPV4_2",
1504 senders=senders,
1505 recipients=recipients,
1506 badSenders=badSenders,
1507 badRecipients=badRecipients,
1508 sw1="s5",
1509 sw2="s2",
1510 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001511 else:
1512 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001513
1514 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001515 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001516 onpass=main.assertReturnString,
1517 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001518
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001519 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001520 main.assertReturnString = "Assertion results for IPV4 multi to single point intent with IPV4 type and no MAC addresses in the same VLAN\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001521 senders = [
1522 { "name":"h13", "device":"of:0000000000000006/5" },
1523 { "name":"h21", "device":"of:0000000000000007/5" }
1524 ]
1525 recipients = [
1526 { "name":"h5", "device":"of:0000000000000005/5" }
1527 ]
1528 badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
1529 badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
1530 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001531 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001532 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001533 main,
1534 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001535 senders=senders,
1536 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001537 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001538 sw1="s5",
1539 sw2="s2")
1540
1541 if installResult:
1542 testResult = main.intentFunction.testPointIntent(
1543 main,
1544 intentId=installResult,
1545 name="VLAN",
1546 senders=senders,
1547 recipients=recipients,
1548 badSenders=badSenders,
1549 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001550 sw1="s5",
1551 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001552 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001553 else:
1554 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001555
1556 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001557 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001558 onpass=main.assertReturnString,
1559 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001560
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001561 main.intentFunction.report( main )
1562
acsmars1ff5e052015-07-23 11:27:48 -07001563 def CASE5000( self, main ):
1564 """
acsmars5d8cc862015-09-25 09:44:50 -07001565 Tests Host Mobility
1566 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07001567 """
1568 assert main, "There is no main"
1569 assert main.CLIs, "There is no main.CLIs"
1570 assert main.Mininet1, "Mininet handle should be named Mininet1"
1571 assert main.numSwitch, "Placed the total number of switch topology in \
1572 main.numSwitch"
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001573 main.case( "Test host mobility with host intents " )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001574 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07001575 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1576
Jeremy2f190ca2016-01-29 15:23:57 -08001577 main.log.info( "Moving h1 from s5 to s6")
acsmars1ff5e052015-07-23 11:27:48 -07001578 main.Mininet1.moveHost( "h1","s5","s6" )
1579
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001580 # Send discovery ping from moved host
1581 # Moving the host brings down the default interfaces and creates a new one.
1582 # Scapy is restarted on this host to detect the new interface
1583 main.h1.stopScapy()
1584 main.h1.startScapy()
1585
1586 # Discover new host location in ONOS and populate host data.
1587 # Host 1 IP and MAC should be unchanged
1588 main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
1589 main.intentFunction.populateHostData( main )
1590
acsmars1ff5e052015-07-23 11:27:48 -07001591 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
1592
1593 utilities.assert_equals( expect="of:0000000000000006",
1594 actual=h1PostMove,
1595 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07001596 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001597 " to single point intents" +
1598 " with IPV4 type and MAC addresses" +
1599 " in the same VLAN" )
1600
1601 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001602 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001603 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
1604 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08001605 testResult = main.FALSE
1606 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001607 installResult = main.intentFunction.installHostIntent( main,
1608 name='IPV4 Mobility IPV4',
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001609 onosNode='0',
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001610 host1=host1,
Jeremye0cb5eb2016-01-27 17:39:09 -08001611 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08001612 if installResult:
1613 testResult = main.intentFunction.testHostIntent( main,
1614 name='Host Mobility IPV4',
1615 intentId = installResult,
1616 onosNode='0',
1617 host1=host1,
1618 host2=host2,
1619 sw1="s6",
1620 sw2="s2",
1621 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001622 else:
1623 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001624
1625 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001626 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001627 onpass=main.assertReturnString,
1628 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07001629
1630 main.intentFunction.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08001631
1632 def CASE6000( self, main ):
1633 """
1634 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
1635 """
1636 assert main, "There is no main"
1637 assert main.CLIs, "There is no main.CLIs"
1638 assert main.Mininet1, "Mininet handle should be named Mininet1"
1639 assert main.numSwitch, "Placed the total number of switch topology in \
1640 main.numSwitch"
1641 main.case( "Test Multi to Single End Point Failure" )
1642 main.step( "Installing Multi to Single Point intents" )
1643
1644 main.assertReturnString = "Assertion results for IPV4 multi to single \
1645 point intent end point failure with no options set\n"
1646 senders = [
1647 { "name":"h16", "device":"of:0000000000000006/8" },
1648 { "name":"h24", "device":"of:0000000000000007/8" }
1649 ]
1650 recipients = [
1651 { "name":"h8", "device":"of:0000000000000005/8" }
1652 ]
1653 isolatedSenders = [
1654 { "name":"h24"}
1655 ]
1656 isolatedRecipients = []
1657 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001658 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001659 installResult = main.intentFunction.installMultiToSingleIntent(
1660 main,
1661 name="NOOPTION",
1662 senders=senders,
1663 recipients=recipients,
1664 sw1="s5",
1665 sw2="s2" )
1666
1667 if installResult:
1668 testResult = main.intentFunction.testEndPointFail(
1669 main,
1670 intentId=installResult,
1671 name="NOOPTION",
1672 senders=senders,
1673 recipients=recipients,
1674 isolatedSenders=isolatedSenders,
1675 isolatedRecipients=isolatedRecipients,
1676 sw1="s6",
1677 sw2="s2",
1678 sw3="s4",
1679 sw4="s1",
1680 sw5="s3",
1681 expectedLink1=16,
1682 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001683 else:
1684 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001685
1686 utilities.assert_equals( expect=main.TRUE,
1687 actual=testResult,
1688 onpass=main.assertReturnString,
1689 onfail=main.assertReturnString )
1690
1691 main.step( "IPV4: Add multi point to single point intents" )
1692 main.assertReturnString = "Assertion results for IPV4 multi to single \
1693 point intent end point failure with IPV4 type and MAC addresses\n"
1694 senders = [
1695 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1696 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1697 ]
1698 recipients = [
1699 { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" }
1700 ]
1701 isolatedSenders = [
1702 { "name":"h24"}
1703 ]
1704 isolatedRecipients = []
1705 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001706 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001707 installResult = main.intentFunction.installMultiToSingleIntent(
1708 main,
1709 name="IPV4",
1710 senders=senders,
1711 recipients=recipients,
1712 ethType="IPV4",
1713 sw1="s5",
1714 sw2="s2")
1715
1716 if installResult:
1717 testResult = main.intentFunction.testEndPointFail(
1718 main,
1719 intentId=installResult,
1720 name="IPV4",
1721 senders=senders,
1722 recipients=recipients,
1723 isolatedSenders=isolatedSenders,
1724 isolatedRecipients=isolatedRecipients,
1725 sw1="s6",
1726 sw2="s2",
1727 sw3="s4",
1728 sw4="s1",
1729 sw5="s3",
1730 expectedLink1=16,
1731 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001732 else:
1733 main.CLIs[ 0 ].removeAllIntents( purge=True )
1734
Jeremye0cb5eb2016-01-27 17:39:09 -08001735 utilities.assert_equals( expect=main.TRUE,
1736 actual=testResult,
1737 onpass=main.assertReturnString,
1738 onfail=main.assertReturnString )
1739
1740 main.step( "IPV4_2: Add multi point to single point intents" )
1741 main.assertReturnString = "Assertion results for IPV4 multi to single \
1742 point intent end point failure with IPV4 type and no MAC addresses\n"
1743 senders = [
1744 { "name":"h16", "device":"of:0000000000000006/8" },
1745 { "name":"h24", "device":"of:0000000000000007/8" }
1746 ]
1747 recipients = [
1748 { "name":"h8", "device":"of:0000000000000005/8" }
1749 ]
1750 isolatedSenders = [
1751 { "name":"h24"}
1752 ]
1753 isolatedRecipients = []
1754 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001755 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001756 installResult = main.intentFunction.installMultiToSingleIntent(
1757 main,
1758 name="IPV4_2",
1759 senders=senders,
1760 recipients=recipients,
1761 ethType="IPV4",
1762 sw1="s5",
1763 sw2="s2")
1764
1765 if installResult:
1766 testResult = main.intentFunction.testEndPointFail(
1767 main,
1768 intentId=installResult,
1769 name="IPV4_2",
1770 senders=senders,
1771 recipients=recipients,
1772 isolatedSenders=isolatedSenders,
1773 isolatedRecipients=isolatedRecipients,
1774 sw1="s6",
1775 sw2="s2",
1776 sw3="s4",
1777 sw4="s1",
1778 sw5="s3",
1779 expectedLink1=16,
1780 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001781 else:
1782 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001783
1784 utilities.assert_equals( expect=main.TRUE,
1785 actual=testResult,
1786 onpass=main.assertReturnString,
1787 onfail=main.assertReturnString )
1788
1789 main.step( "VLAN: Add multi point to single point intents" )
1790 main.assertReturnString = "Assertion results for IPV4 multi to single \
1791 point intent end point failure with IPV4 type and no MAC addresses in the same VLAN\n"
1792 senders = [
1793 { "name":"h13", "device":"of:0000000000000006/5" },
1794 { "name":"h21", "device":"of:0000000000000007/5" }
1795 ]
1796 recipients = [
1797 { "name":"h5", "device":"of:0000000000000005/5" }
1798 ]
1799 isolatedSenders = [
1800 { "name":"h21"}
1801 ]
1802 isolatedRecipients = []
1803 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001804 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001805 installResult = main.intentFunction.installMultiToSingleIntent(
1806 main,
1807 name="VLAN",
1808 senders=senders,
1809 recipients=recipients,
1810 ethType="IPV4",
1811 sw1="s5",
1812 sw2="s2")
1813
1814 if installResult:
1815 testResult = main.intentFunction.testEndPointFail(
1816 main,
1817 intentId=installResult,
1818 name="VLAN",
1819 senders=senders,
1820 recipients=recipients,
1821 isolatedSenders=isolatedSenders,
1822 isolatedRecipients=isolatedRecipients,
1823 sw1="s6",
1824 sw2="s2",
1825 sw3="s4",
1826 sw4="s1",
1827 sw5="s3",
1828 expectedLink1=16,
1829 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001830 else:
1831 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001832
1833 utilities.assert_equals( expect=main.TRUE,
1834 actual=testResult,
1835 onpass=main.assertReturnString,
1836 onfail=main.assertReturnString )
1837
1838 main.step( "NOOPTION: Install and test single point to multi point intents" )
1839 main.assertReturnString = "Assertion results for IPV4 single to multi \
1840 point intent end point failure with no options set\n"
1841 senders = [
1842 { "name":"h8", "device":"of:0000000000000005/8" }
1843 ]
1844 recipients = [
1845 { "name":"h16", "device":"of:0000000000000006/8" },
1846 { "name":"h24", "device":"of:0000000000000007/8" }
1847 ]
1848 isolatedSenders = []
1849 isolatedRecipients = [
1850 { "name":"h24" }
1851 ]
1852 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001853 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001854 installResult = main.intentFunction.installSingleToMultiIntent(
1855 main,
1856 name="NOOPTION",
1857 senders=senders,
1858 recipients=recipients,
1859 sw1="s5",
1860 sw2="s2")
1861
1862 if installResult:
1863 testResult = main.intentFunction.testEndPointFail(
1864 main,
1865 intentId=installResult,
1866 name="NOOPTION",
1867 senders=senders,
1868 recipients=recipients,
1869 isolatedSenders=isolatedSenders,
1870 isolatedRecipients=isolatedRecipients,
1871 sw1="s6",
1872 sw2="s2",
1873 sw3="s4",
1874 sw4="s1",
1875 sw5="s3",
1876 expectedLink1=16,
1877 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001878 else:
1879 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001880
1881 utilities.assert_equals( expect=main.TRUE,
1882 actual=testResult,
1883 onpass=main.assertReturnString,
1884 onfail=main.assertReturnString )
1885
1886 main.step( "IPV4: Install and test single point to multi point intents" )
1887 main.assertReturnString = "Assertion results for IPV4 single to multi \
1888 point intent end point failure with IPV4 type and no MAC addresses\n"
1889 senders = [
1890 { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
1891 ]
1892 recipients = [
1893 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1894 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1895 ]
1896 isolatedSenders = []
1897 isolatedRecipients = [
1898 { "name":"h24" }
1899 ]
1900 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001901 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001902 installResult = main.intentFunction.installSingleToMultiIntent(
1903 main,
1904 name="IPV4",
1905 senders=senders,
1906 recipients=recipients,
1907 ethType="IPV4",
1908 sw1="s5",
1909 sw2="s2")
1910
1911 if installResult:
1912 testResult = main.intentFunction.testEndPointFail(
1913 main,
1914 intentId=installResult,
1915 name="IPV4",
1916 senders=senders,
1917 recipients=recipients,
1918 isolatedSenders=isolatedSenders,
1919 isolatedRecipients=isolatedRecipients,
1920 sw1="s6",
1921 sw2="s2",
1922 sw3="s4",
1923 sw4="s1",
1924 sw5="s3",
1925 expectedLink1=16,
1926 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001927 else:
1928 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001929
1930 utilities.assert_equals( expect=main.TRUE,
1931 actual=testResult,
1932 onpass=main.assertReturnString,
1933 onfail=main.assertReturnString )
1934
1935 main.step( "IPV4_2: Add single point to multi point intents" )
1936 main.assertReturnString = "Assertion results for IPV4 single to multi\
1937 point intent endpoint failure with IPV4 type and no MAC addresses\n"
1938 senders = [
1939 { "name":"h8", "device":"of:0000000000000005/8" }
1940 ]
1941 recipients = [
1942 { "name":"h16", "device":"of:0000000000000006/8" },
1943 { "name":"h24", "device":"of:0000000000000007/8" }
1944 ]
1945 isolatedSenders = []
1946 isolatedRecipients = [
1947 { "name":"h24" }
1948 ]
1949 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001950 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08001951 installResult = main.intentFunction.installSingleToMultiIntent(
1952 main,
1953 name="IPV4_2",
1954 senders=senders,
1955 recipients=recipients,
1956 ethType="IPV4",
1957 sw1="s5",
1958 sw2="s2")
1959
1960 if installResult:
1961 testResult = main.intentFunction.testEndPointFail(
1962 main,
1963 intentId=installResult,
1964 name="IPV4_2",
1965 senders=senders,
1966 recipients=recipients,
1967 isolatedSenders=isolatedSenders,
1968 isolatedRecipients=isolatedRecipients,
1969 sw1="s6",
1970 sw2="s2",
1971 sw3="s4",
1972 sw4="s1",
1973 sw5="s3",
1974 expectedLink1=16,
1975 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08001976 else:
1977 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08001978
1979 utilities.assert_equals( expect=main.TRUE,
1980 actual=testResult,
1981 onpass=main.assertReturnString,
1982 onfail=main.assertReturnString )
1983
1984 main.step( "VLAN: Add single point to multi point intents" )
1985 main.assertReturnString = "Assertion results for IPV4 single to multi point\
1986 intent endpoint failure with IPV4 type and MAC addresses in the same VLAN\n"
1987 senders = [
1988 { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04" }
1989 ]
1990 recipients = [
1991 { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C" },
1992 { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14" }
1993 ]
1994 isolatedSenders = []
1995 isolatedRecipients = [
1996 { "name":"h20" }
1997 ]
1998 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001999 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08002000 installResult = main.intentFunction.installSingleToMultiIntent(
2001 main,
2002 name="IPV4",
2003 senders=senders,
2004 recipients=recipients,
2005 ethType="IPV4",
2006 sw1="s5",
2007 sw2="s2")
2008
2009 if installResult:
2010 testResult = main.intentFunction.testEndPointFail(
2011 main,
2012 intentId=installResult,
2013 name="IPV4",
2014 senders=senders,
2015 recipients=recipients,
2016 isolatedSenders=isolatedSenders,
2017 isolatedRecipients=isolatedRecipients,
2018 sw1="s6",
2019 sw2="s2",
2020 sw3="s4",
2021 sw4="s1",
2022 sw5="s3",
2023 expectedLink1=16,
2024 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002025 else:
2026 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002027
2028 utilities.assert_equals( expect=main.TRUE,
2029 actual=testResult,
2030 onpass=main.assertReturnString,
2031 onfail=main.assertReturnString )
2032
Jeremy2f190ca2016-01-29 15:23:57 -08002033 main.intentFunction.report( main )