blob: 22fcf3cc9301f3bf12cbfefda9701a63eb0afbde [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
Jeremy Songster17147f22016-05-31 18:30:52 -070062 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070063
Jon Halla3e02432015-07-24 15:55:42 -070064 main.ONOSip = main.ONOSbench.getOnosIps()
65 print main.ONOSip
kelvin-onlabd48a68c2015-07-13 16:01:36 -070066
Jon Halla3e02432015-07-24 15:55:42 -070067 # Assigning ONOS cli handles to a list
68 for i in range( 1, main.maxNodes + 1 ):
69 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070070
Jon Halla3e02432015-07-24 15:55:42 -070071 # -- INIT SECTION, ONLY RUNS ONCE -- #
72 main.startUp = imp.load_source( wrapperFile1,
73 main.dependencyPath +
74 wrapperFile1 +
75 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070076
Jon Halla3e02432015-07-24 15:55:42 -070077 main.intentFunction = imp.load_source( wrapperFile2,
78 main.dependencyPath +
79 wrapperFile2 +
80 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070081
Jon Halla3e02432015-07-24 15:55:42 -070082 main.topo = imp.load_source( wrapperFile3,
83 main.dependencyPath +
84 wrapperFile3 +
85 ".py" )
86
kelvin-onlabd9e23de2015-08-06 10:34:44 -070087 copyResult1 = main.ONOSbench.scp( main.Mininet1,
88 main.dependencyPath +
89 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080090 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070091 direction="to" )
Jon Halla3e02432015-07-24 15:55:42 -070092 if main.CLIs:
93 stepResult = main.TRUE
94 else:
95 main.log.error( "Did not properly created list of ONOS CLI handle" )
96 stepResult = main.FALSE
97 except Exception as e:
98 main.log.exception(e)
99 main.cleanup()
100 main.exit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700101
102 utilities.assert_equals( expect=main.TRUE,
103 actual=stepResult,
104 onpass="Successfully construct " +
105 "test variables ",
106 onfail="Failed to construct test variables" )
107
108 if gitPull == 'True':
109 main.step( "Building ONOS in " + gitBranch + " branch" )
110 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
111 stepResult = onosBuildResult
112 utilities.assert_equals( expect=main.TRUE,
113 actual=stepResult,
114 onpass="Successfully compiled " +
115 "latest ONOS",
116 onfail="Failed to compile " +
117 "latest ONOS" )
118 else:
119 main.log.warn( "Did not pull new code so skipping mvn " +
120 "clean install" )
Jon Hall106be082015-07-22 09:53:00 -0700121 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700122
123 def CASE2( self, main ):
124 """
125 - Set up cell
126 - Create cell file
127 - Set cell file
128 - Verify cell file
129 - Kill ONOS process
130 - Uninstall ONOS cluster
131 - Verify ONOS start up
132 - Install ONOS cluster
133 - Connect to cli
134 """
135
Jeremy Songster17147f22016-05-31 18:30:52 -0700136 main.cycle += 1
137
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700138 # main.scale[ 0 ] determines the current number of ONOS controller
139 main.numCtrls = int( main.scale[ 0 ] )
Jeremycd872222016-03-29 10:08:34 -0700140 main.flowCompiler = "Flow Rules"
Jeremyd9e4eb12016-04-13 12:09:06 -0700141 main.initialized = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700142
143 main.case( "Starting up " + str( main.numCtrls ) +
144 " node(s) ONOS cluster" )
Jon Hall783bbf92015-07-23 14:33:19 -0700145 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700146 " node(s) ONOS cluster"
147
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700148 #kill off all onos processes
149 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800150 " before initiating environment setup" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700151
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800152 time.sleep( main.startUpSleep )
153 main.step( "Uninstalling ONOS package" )
154 onosUninstallResult = main.TRUE
155 for ip in main.ONOSip:
156 onosUninstallResult = onosUninstallResult and \
157 main.ONOSbench.onosUninstall( nodeIp=ip )
158 stepResult = onosUninstallResult
159 utilities.assert_equals( expect=main.TRUE,
160 actual=stepResult,
161 onpass="Successfully uninstalled ONOS package",
162 onfail="Failed to uninstall ONOS package" )
Jeremy42df2e72016-02-23 16:37:46 -0800163 time.sleep( main.startUpSleep )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800164
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700165 for i in range( main.maxNodes ):
166 main.ONOSbench.onosDie( main.ONOSip[ i ] )
167
168 print "NODE COUNT = ", main.numCtrls
169
170 tempOnosIp = []
171 for i in range( main.numCtrls ):
172 tempOnosIp.append( main.ONOSip[i] )
173
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700174 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
175 "temp", main.Mininet1.ip_address,
176 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700177
178 main.step( "Apply cell to environment" )
179 cellResult = main.ONOSbench.setCell( "temp" )
180 verifyResult = main.ONOSbench.verifyCell()
181 stepResult = cellResult and verifyResult
182 utilities.assert_equals( expect=main.TRUE,
183 actual=stepResult,
184 onpass="Successfully applied cell to " + \
185 "environment",
186 onfail="Failed to apply cell to environment " )
187
188 main.step( "Creating ONOS package" )
189 packageResult = main.ONOSbench.onosPackage()
190 stepResult = packageResult
191 utilities.assert_equals( expect=main.TRUE,
192 actual=stepResult,
193 onpass="Successfully created ONOS package",
194 onfail="Failed to create ONOS package" )
195
196 time.sleep( main.startUpSleep )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700197 main.step( "Installing ONOS package" )
198 onosInstallResult = main.TRUE
199 for i in range( main.numCtrls ):
200 onosInstallResult = onosInstallResult and \
201 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
202 stepResult = onosInstallResult
203 utilities.assert_equals( expect=main.TRUE,
204 actual=stepResult,
205 onpass="Successfully installed ONOS package",
206 onfail="Failed to install ONOS package" )
207
208 time.sleep( main.startUpSleep )
209 main.step( "Starting ONOS service" )
210 stopResult = main.TRUE
211 startResult = main.TRUE
212 onosIsUp = main.TRUE
213
214 for i in range( main.numCtrls ):
Jeremy Songster7edb6632016-04-28 15:44:28 -0700215 isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
216 onosIsUp = onosIsUp and isUp
217 if isUp == main.TRUE:
Jeremyd9e4eb12016-04-13 12:09:06 -0700218 main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
219 else:
220 main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
221 "start ONOS again " )
222 stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
223 startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
224 if not startResult or stopResult:
225 main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700226 stepResult = onosIsUp and stopResult and startResult
227 utilities.assert_equals( expect=main.TRUE,
228 actual=stepResult,
Jeremyd9e4eb12016-04-13 12:09:06 -0700229 onpass="ONOS service is ready on all nodes",
230 onfail="ONOS service did not start properly on all nodes" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700231
232 main.step( "Start ONOS cli" )
233 cliResult = main.TRUE
234 for i in range( main.numCtrls ):
235 cliResult = cliResult and \
236 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
237 stepResult = cliResult
238 utilities.assert_equals( expect=main.TRUE,
239 actual=stepResult,
240 onpass="Successfully start ONOS cli",
241 onfail="Failed to start ONOS cli" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700242 if not stepResult:
243 main.initialized = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700244
245 # Remove the first element in main.scale list
246 main.scale.remove( main.scale[ 0 ] )
247
kelvin-onlab016dce22015-08-10 09:54:11 -0700248 main.intentFunction.report( main )
249
Jon Halla3e02432015-07-24 15:55:42 -0700250 def CASE8( self, main ):
251 """
acsmars59a4c552015-09-10 18:11:19 -0700252 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700253 """
254 import json
255
256 main.case( "Compare ONOS Topology view to Mininet topology" )
257 main.caseExplanation = "Compare topology elements between Mininet" +\
258 " and ONOS"
259
acsmars59a4c552015-09-10 18:11:19 -0700260 main.log.info( "Gathering topology information from Mininet" )
261 devicesResults = main.FALSE # Overall Boolean for device correctness
262 linksResults = main.FALSE # Overall Boolean for link correctness
263 hostsResults = main.FALSE # Overall Boolean for host correctness
264 deviceFails = [] # Nodes where devices are incorrect
265 linkFails = [] # Nodes where links are incorrect
266 hostFails = [] # Nodes where hosts are incorrect
267 attempts = main.checkTopoAttempts # Remaining Attempts
Jon Halla3e02432015-07-24 15:55:42 -0700268
269 mnSwitches = main.Mininet1.getSwitches()
270 mnLinks = main.Mininet1.getLinks()
271 mnHosts = main.Mininet1.getHosts()
272
Jon Hall70b2ff42015-11-17 15:49:44 -0800273 main.step( "Comparing Mininet topology to ONOS topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700274
acsmars59a4c552015-09-10 18:11:19 -0700275 while ( attempts >= 0 ) and\
276 ( not devicesResults or not linksResults or not hostsResults ):
277 time.sleep( 2 )
278 if not devicesResults:
279 devices = main.topo.getAllDevices( main )
280 ports = main.topo.getAllPorts( main )
281 devicesResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800282 deviceFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700283 if not linksResults:
284 links = main.topo.getAllLinks( main )
285 linksResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800286 linkFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700287 if not hostsResults:
288 hosts = main.topo.getAllHosts( main )
289 hostsResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800290 hostFails = [] # Reset for each failed attempt
Jon Halla3e02432015-07-24 15:55:42 -0700291
acsmars59a4c552015-09-10 18:11:19 -0700292 # Check for matching topology on each node
293 for controller in range( main.numCtrls ):
294 controllerStr = str( controller + 1 ) # ONOS node number
295 # Compare Devices
296 if devices[ controller ] and ports[ controller ] and\
297 "Error" not in devices[ controller ] and\
298 "Error" not in ports[ controller ]:
Jon Halla3e02432015-07-24 15:55:42 -0700299
acsmars2ec91d62015-09-16 11:15:48 -0700300 try:
301 deviceData = json.loads( devices[ controller ] )
302 portData = json.loads( ports[ controller ] )
303 except (TypeError,ValueError):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800304 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
acsmars2ec91d62015-09-16 11:15:48 -0700305 currentDevicesResult = main.FALSE
306 else:
307 currentDevicesResult = main.Mininet1.compareSwitches(
308 mnSwitches,deviceData,portData )
acsmars59a4c552015-09-10 18:11:19 -0700309 else:
310 currentDevicesResult = main.FALSE
311 if not currentDevicesResult:
312 deviceFails.append( controllerStr )
313 devicesResults = devicesResults and currentDevicesResult
314 # Compare Links
315 if links[ controller ] and "Error" not in links[ controller ]:
acsmars2ec91d62015-09-16 11:15:48 -0700316 try:
317 linkData = json.loads( links[ controller ] )
318 except (TypeError,ValueError):
319 main.log.error("Could not load json:" + str( links[ controller ] ) )
320 currentLinksResult = main.FALSE
321 else:
322 currentLinksResult = main.Mininet1.compareLinks(
323 mnSwitches, mnLinks,linkData )
acsmars59a4c552015-09-10 18:11:19 -0700324 else:
325 currentLinksResult = main.FALSE
326 if not currentLinksResult:
327 linkFails.append( controllerStr )
328 linksResults = linksResults and currentLinksResult
329 # Compare Hosts
acsmars2ec91d62015-09-16 11:15:48 -0700330 if hosts[ controller ] and "Error" not in hosts[ controller ]:
331 try:
332 hostData = json.loads( hosts[ controller ] )
333 except (TypeError,ValueError):
334 main.log.error("Could not load json:" + str( hosts[ controller ] ) )
335 currentHostsResult = main.FALSE
336 else:
337 currentHostsResult = main.Mininet1.compareHosts(
338 mnHosts,hostData )
acsmars59a4c552015-09-10 18:11:19 -0700339 else:
340 currentHostsResult = main.FALSE
341 if not currentHostsResult:
342 hostFails.append( controllerStr )
343 hostsResults = hostsResults and currentHostsResult
344 # Decrement Attempts Remaining
345 attempts -= 1
346
347
348 utilities.assert_equals( expect=[],
349 actual=deviceFails,
350 onpass="ONOS correctly discovered all devices",
351 onfail="ONOS incorrectly discovered devices on nodes: " +
352 str( deviceFails ) )
353 utilities.assert_equals( expect=[],
354 actual=linkFails,
355 onpass="ONOS correctly discovered all links",
356 onfail="ONOS incorrectly discovered links on nodes: " +
357 str( linkFails ) )
358 utilities.assert_equals( expect=[],
359 actual=hostFails,
360 onpass="ONOS correctly discovered all hosts",
361 onfail="ONOS incorrectly discovered hosts on nodes: " +
362 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700363 topoResults = hostsResults and linksResults and devicesResults
364 utilities.assert_equals( expect=main.TRUE,
365 actual=topoResults,
366 onpass="ONOS correctly discovered the topology",
367 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700368
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700369 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700370 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700371 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700372 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700373 if main.initialized == main.FALSE:
374 main.log.error( "Test components did not start correctly, skipping further tests" )
375 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700376 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700377 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700378 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700379 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700380 "switches to test intents, exits out if " +\
381 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700382
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700383 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700384 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700385 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700386 main.topology,
387 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700388 stepResult = topoResult
389 utilities.assert_equals( expect=main.TRUE,
390 actual=stepResult,
391 onpass="Successfully loaded topology",
392 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700393
394 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700395 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700396 main.initialized = main.FALSE
397 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700398
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700399 def CASE11( self, main ):
400 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700401 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700402 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700403 if main.initialized == main.FALSE:
404 main.log.error( "Test components did not start correctly, skipping further tests" )
405 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700406 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700407 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700408 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700409 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700410 "switches to test intents, exits out if " +\
411 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700412
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700413 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700414 args = "--switch ovs,protocols=OpenFlow13"
415 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
416 main.topology,
417 args=args )
418 stepResult = topoResult
419 utilities.assert_equals( expect=main.TRUE,
420 actual=stepResult,
421 onpass="Successfully loaded topology",
422 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700423 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700424 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700425 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700426
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700427 def CASE12( self, main ):
428 """
429 Assign mastership to controllers
430 """
431 import re
432
Jeremyd9e4eb12016-04-13 12:09:06 -0700433 if main.initialized == main.FALSE:
434 main.log.error( "Test components did not start correctly, skipping further tests" )
435 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700436 main.case( "Assign switches to controllers" )
437 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700438 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700439 " switches to ONOS nodes"
440
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700441 assignResult = main.TRUE
442 switchList = []
443
444 # Creates a list switch name, use getSwitch() function later...
445 for i in range( 1, ( main.numSwitch + 1 ) ):
446 switchList.append( 's' + str( i ) )
447
448 tempONOSip = []
449 for i in range( main.numCtrls ):
450 tempONOSip.append( main.ONOSip[ i ] )
451
452 assignResult = main.Mininet1.assignSwController( sw=switchList,
453 ip=tempONOSip,
Charles Chan029be652015-08-24 01:46:10 +0800454 port='6653' )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700455 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700456 main.log.error( "Problem assigning mastership of switches" )
457 main.initialized = main.FALSE
458 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700459
460 for i in range( 1, ( main.numSwitch + 1 ) ):
461 response = main.Mininet1.getSwController( "s" + str( i ) )
462 print( "Response is " + str( response ) )
463 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
464 assignResult = assignResult and main.TRUE
465 else:
466 assignResult = main.FALSE
467 stepResult = assignResult
468 utilities.assert_equals( expect=main.TRUE,
469 actual=stepResult,
470 onpass="Successfully assigned switches" +
471 "to controller",
472 onfail="Failed to assign switches to " +
473 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700474 if not stepResult:
475 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700476
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800477 def CASE13( self,main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700478 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800479 Create Scapy components
480 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700481 if main.initialized == main.FALSE:
482 main.log.error( "Test components did not start correctly, skipping further tests" )
483 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800484 main.case( "Create scapy components" )
485 main.step( "Create scapy components" )
486 import json
487 scapyResult = main.TRUE
488 for hostName in main.scapyHostNames:
489 main.Scapy1.createHostComponent( hostName )
490 main.scapyHosts.append( getattr( main, hostName ) )
491
492 main.step( "Start scapy components" )
493 for host in main.scapyHosts:
494 host.startHostCli()
495 host.startScapy()
496 host.updateSelf()
497 main.log.debug( host.name )
498 main.log.debug( host.hostIp )
499 main.log.debug( host.hostMac )
500
501
502 utilities.assert_equals( expect=main.TRUE,
503 actual=scapyResult,
504 onpass="Successfully created Scapy Components",
505 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700506 if not scapyResult:
507 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800508
509 def CASE14( self, main ):
510 """
511 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700512 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700513 if main.initialized == main.FALSE:
514 main.log.error( "Test components did not start correctly, skipping further tests" )
515 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700516 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800517 main.step( "Pingall hosts and confirm ONOS discovery" )
518 utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700519
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800520 utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE,
521 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700522 utilities.assert_equals( expect=main.TRUE,
523 actual=stepResult,
524 onpass="Successfully discovered hosts",
525 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700526 if not stepResult:
527 main.initialized = main.FALSE
528 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700529
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800530 main.step( "Populate hostsData" )
531 stepResult = main.intentFunction.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700532 utilities.assert_equals( expect=main.TRUE,
533 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800534 onpass="Successfully populated hostsData",
535 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700536 if not stepResult:
537 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800538
539 def CASE15( self, main ):
540 """
541 Discover all hosts with scapy arp packets and store its data to a dictionary
542 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700543 if main.initialized == main.FALSE:
544 main.log.error( "Test components did not start correctly, skipping further tests" )
545 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800546 main.case( "Discover all hosts using scapy" )
547 main.step( "Send packets from each host to the first host and confirm onos discovery" )
548
549 import collections
550 if len( main.scapyHosts ) < 1:
551 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700552 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800553 main.skipCase()
554
555 # Send ARP packets from each scapy host component
556 main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
557
558 stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
559 retValue=main.FALSE, args=[ main ],
560 attempts=main.checkTopoAttempts, sleep=2 )
561
562 utilities.assert_equals( expect=main.TRUE,
563 actual=stepResult,
564 onpass="ONOS correctly discovered all hosts",
565 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700566 if not stepResult:
567 main.initialized = main.FALSE
568 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800569
570 main.step( "Populate hostsData" )
571 stepResult = main.intentFunction.populateHostData( main )
572 utilities.assert_equals( expect=main.TRUE,
573 actual=stepResult,
574 onpass="Successfully populated hostsData",
575 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700576 if not stepResult:
577 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800578
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800579 def CASE16( self, main ):
580 """
Jeremy42df2e72016-02-23 16:37:46 -0800581 Balance Masters
582 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700583 if main.initialized == main.FALSE:
584 main.log.error( "Test components did not start correctly, skipping further tests" )
585 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800586 main.case( "Balance mastership of switches" )
587 main.step( "Balancing mastership of switches" )
588
589 balanceResult = main.FALSE
590 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
591
592 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700593 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800594 onpass="Successfully balanced mastership of switches",
595 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700596 if not balanceResult:
597 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800598
599 def CASE17( self, main ):
600 """
Jeremy6e9748f2016-03-25 15:03:39 -0700601 Use Flow Objectives
602 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700603 if main.initialized == main.FALSE:
604 main.log.error( "Test components did not start correctly, skipping further tests" )
605 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700606 main.case( "Enable intent compilation using Flow Objectives" )
607 main.step( "Enabling Flow Objectives" )
608
609 main.flowCompiler = "Flow Objectives"
610
611 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
612
613 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
614 propName="useFlowObjectives", value="true" )
615
616 utilities.assert_equals( expect=main.TRUE,
617 actual=stepResult,
618 onpass="Successfully activated Flow Objectives",
619 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700620 if not balanceResult:
621 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700622
623 def CASE18( self, main ):
624 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800625 Stop mininet and remove scapy host
626 """
627 main.log.report( "Stop Mininet and Scapy" )
628 main.case( "Stop Mininet and Scapy" )
629 main.caseExplanation = "Stopping the current mininet topology " +\
630 "to start up fresh"
631 main.step( "Stopping and Removing Scapy Host Components" )
632 scapyResult = main.TRUE
633 for host in main.scapyHosts:
634 scapyResult = scapyResult and host.stopScapy()
635 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
636
637 for host in main.scapyHosts:
638 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
639 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
640
641 main.scapyHosts = []
642 main.scapyHostIPs = []
643
644 utilities.assert_equals( expect=main.TRUE,
645 actual=scapyResult,
646 onpass="Successfully stopped scapy and removed host components",
647 onfail="Failed to stop mininet and scapy" )
648
649 main.step( "Stopping Mininet Topology" )
650 mininetResult = main.Mininet1.stopNet( )
651
652 utilities.assert_equals( expect=main.TRUE,
653 actual=mininetResult,
654 onpass="Successfully stopped mininet and scapy",
655 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700656 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800657 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700658 main.cleanup()
659 main.exit()
660
Jeremy Songster17147f22016-05-31 18:30:52 -0700661 def CASE19( self, main ):
662 """
663 Copy the karaf.log files after each testcase cycle
664 """
665 main.log.report( "Copy karaf logs" )
666 main.case( "Copy karaf logs" )
667 main.caseExplanation = "Copying the karaf logs to preserve them through" +\
668 "reinstalling ONOS"
669 main.step( "Copying karaf logs" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700670 stepResult = main.TRUE
671 scpResult = main.TRUE
672 copyResult = main.TRUE
Jeremy Songstercc5414b2016-07-11 10:59:53 -0700673 for i in range( main.numCtrls ):
674 main.node = main.CLIs[ i ]
Jeremy Songster17147f22016-05-31 18:30:52 -0700675 ip = main.ONOSip[ i ]
676 main.node.ip_address = ip
Jeremy Songster31aad312016-06-13 16:32:11 -0700677 scpResult = scpResult and main.ONOSbench.scp( main.node ,
678 "/opt/onos/log/karaf.log",
679 "/tmp/karaf.log",
680 direction="from" )
681 copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
682 copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
683 if scpResult and copyResult:
684 stepResult = main.TRUE and stepResult
685 else:
686 stepResult = main.FALSE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700687 utilities.assert_equals( expect=main.TRUE,
688 actual=stepResult,
689 onpass="Successfully copied remote ONOS logs",
690 onfail="Failed to copy remote ONOS logs" )
Jeremy Songster17147f22016-05-31 18:30:52 -0700691
kelvin-onlabb769f562015-07-15 17:05:10 -0700692 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700693 """
694 Add host intents between 2 host:
695 - Discover hosts
696 - Add host intents
697 - Check intents
698 - Verify flows
699 - Ping hosts
700 - Reroute
701 - Link down
702 - Verify flows
703 - Check topology
704 - Ping hosts
705 - Link up
706 - Verify flows
707 - Check topology
708 - Ping hosts
709 - Remove intents
710 """
711 import time
712 import json
713 import re
Jeremyd9e4eb12016-04-13 12:09:06 -0700714 if main.initialized == main.FALSE:
715 main.log.error( "Test components did not start correctly, skipping further tests" )
716 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700717 # Assert variables - These variable's name|format must be followed
718 # if you want to use the wrapper function
719 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700720 try:
721 assert main.CLIs
722 except AssertionError:
723 main.log.error( "There is no main.CLIs, skipping test cases" )
724 main.initialized = main.FALSE
725 main.skipCase()
726 try:
727 assert main.Mininet1
728 except AssertionError:
729 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
730 main.initialized = main.FALSE
731 main.skipCase()
732 try:
733 assert main.numSwitch
734 except AssertionError:
735 main.log.error( "Place the total number of switch topology in \
736 main.numSwitch" )
737 main.initialized = main.FALSE
738 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700739
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800740 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700741 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
742
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700743 main.testName = "Host Intents"
744 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700745 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700746 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700747 str( main.numCtrls ) + " node(s) cluster;\n" +\
748 "Different type of hosts will be tested in " +\
749 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700750 "etc;\nThe test will use OF " + main.OFProtocol +\
751 " OVS running in Mininet and compile intents" +\
Jeremy6e9748f2016-03-25 15:03:39 -0700752 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700753
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700754 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700755 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800756 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
757 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
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='IPV4',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800762 onosNode='0',
763 host1=host1,
764 host2=host2)
765 if installResult:
766 testResult = main.intentFunction.testHostIntent( main,
767 name='IPV4',
768 intentId = installResult,
769 onosNode='0',
770 host1=host1,
771 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700772 sw1='s5',
773 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800774 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800775 else:
776 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800777
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700778 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800779 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700780 onpass=main.assertReturnString,
781 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700782
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700783 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700784 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800785 host1 = { "name":"h3","id":"00:00:00:00:00:03/-1" }
786 host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1 "}
787 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800788 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800789 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700790 name='DUALSTACK',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800791 onosNode='0',
792 host1=host1,
793 host2=host2)
794
795 if installResult:
796 testResult = main.intentFunction.testHostIntent( main,
797 name='DUALSTACK',
798 intentId = installResult,
799 onosNode='0',
800 host1=host1,
801 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700802 sw1='s5',
803 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800804 expectedLink = 18)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700805
806 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800807 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700808 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800809 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700810
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700811 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700812 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800813 host1 = { "name":"h1" }
814 host2 = { "name":"h11" }
815 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800816 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800817 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700818 name='DUALSTACK2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800819 onosNode='0',
820 host1=host1,
821 host2=host2)
822
823 if installResult:
824 testResult = main.intentFunction.testHostIntent( main,
825 name='DUALSTACK2',
826 intentId = installResult,
827 onosNode='0',
828 host1=host1,
829 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700830 sw1='s5',
831 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800832 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800833 else:
834 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700835
836 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800837 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700838 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800839 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700840
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700841 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700842 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800843 host1 = { "name":"h1" }
844 host2 = { "name":"h3" }
845 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800846 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800847 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700848 name='1HOP',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800849 onosNode='0',
850 host1=host1,
851 host2=host2)
852
853 if installResult:
854 testResult = main.intentFunction.testHostIntent( main,
855 name='1HOP',
856 intentId = installResult,
857 onosNode='0',
858 host1=host1,
859 host2=host2,
860 sw1='s5',
861 sw2='s2',
862 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800863 else:
864 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700865
866 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800867 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700868 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800869 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700870
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700871 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700872 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jeremy Songster832f9e92016-05-05 14:30:49 -0700873 host1 = { "name":"h4","id":"00:00:00:00:00:04/100", "vlan":"100" }
874 host2 = { "name":"h12","id":"00:00:00:00:00:0C/100", "vlan":"100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800875 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800876 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800877 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700878 name='VLAN1',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800879 onosNode='0',
880 host1=host1,
881 host2=host2)
882
883 if installResult:
884 testResult = main.intentFunction.testHostIntent( main,
885 name='VLAN1',
886 intentId = installResult,
887 onosNode='0',
888 host1=host1,
889 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700890 sw1='s5',
891 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800892 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800893 else:
894 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700895
896 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800897 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700898 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800899 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700900
Jeremy Songsterff553672016-05-12 17:06:23 -0700901 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
902 main.assertReturnString = "Assertion Result vlan IPV4\n"
903 host1 = { "name":"h5", "vlan":"200" }
904 host2 = { "name":"h12", "vlan":"100" }
905 testResult = main.FALSE
906 installResult = main.FALSE
907 installResult = main.intentFunction.installHostIntent( main,
908 name='VLAN2',
909 onosNode='0',
910 host1=host1,
911 host2=host2)
912
913 if installResult:
914 testResult = main.intentFunction.testHostIntent( main,
915 name='VLAN2',
916 intentId = installResult,
917 onosNode='0',
918 host1=host1,
919 host2=host2,
920 sw1='s5',
921 sw2='s2',
922 expectedLink = 18)
923 else:
924 main.CLIs[ 0 ].removeAllIntents( purge=True )
925
926 utilities.assert_equals( expect=main.TRUE,
927 actual=testResult,
928 onpass=main.assertReturnString,
929 onfail=main.assertReturnString)
930
Jeremy Songsterc032f162016-08-04 17:14:49 -0700931 main.step( "Encapsulation: Add host intents between h1 and h9" )
932 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
933 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
934 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
935 testResult = main.FALSE
936 installResult = main.FALSE
937 installResult = main.intentFunction.installHostIntent( main,
938 name='ENCAPSULATION',
939 onosNode='0',
940 host1=host1,
941 host2=host2,
942 encap="VLAN" )
943 if installResult:
944 testResult = main.intentFunction.testHostIntent( main,
945 name='ENCAPSULATION',
946 intentId = installResult,
947 onosNode='0',
948 host1=host1,
949 host2=host2,
950 sw1='s5',
951 sw2='s2',
952 expectedLink = 18)
953 else:
954 main.CLIs[ 0 ].removeAllIntents( purge=True )
955
956 utilities.assert_equals( expect=main.TRUE,
957 actual=testResult,
958 onpass=main.assertReturnString,
959 onfail=main.assertReturnString)
960
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800961 main.step( "Confirm that ONOS leadership is unchanged")
acsmarse6b410f2015-07-17 14:39:34 -0700962 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
963 main.intentFunction.checkLeaderChange( intentLeadersOld,
964 intentLeadersNew )
965
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800966 utilities.assert_equals( expect=main.TRUE,
967 actual=testResult,
968 onpass="ONOS Leaders Unchanged",
969 onfail="ONOS Leader Mismatch")
970
kelvin-onlab016dce22015-08-10 09:54:11 -0700971 main.intentFunction.report( main )
972
kelvin-onlabb769f562015-07-15 17:05:10 -0700973 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700974 """
975 Add point intents between 2 hosts:
976 - Get device ids | ports
977 - Add point intents
978 - Check intents
979 - Verify flows
980 - Ping hosts
981 - Reroute
982 - Link down
983 - Verify flows
984 - Check topology
985 - Ping hosts
986 - Link up
987 - Verify flows
988 - Check topology
989 - Ping hosts
990 - Remove intents
991 """
992 import time
993 import json
994 import re
Jeremyd9e4eb12016-04-13 12:09:06 -0700995 if main.initialized == main.FALSE:
996 main.log.error( "Test components did not start correctly, skipping further tests" )
997 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700998 # Assert variables - These variable's name|format must be followed
999 # if you want to use the wrapper function
1000 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001001 try:
1002 assert main.CLIs
1003 except AssertionError:
1004 main.log.error( "There is no main.CLIs, skipping test cases" )
1005 main.initialized = main.FALSE
1006 main.skipCase()
1007 try:
1008 assert main.Mininet1
1009 except AssertionError:
1010 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1011 main.initialized = main.FALSE
1012 main.skipCase()
1013 try:
1014 assert main.numSwitch
1015 except AssertionError:
1016 main.log.error( "Place the total number of switch topology in \
1017 main.numSwitch" )
1018 main.initialized = main.FALSE
1019 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001020
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001021 main.testName = "Point Intents"
1022 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001023 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001024 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001025 " intents using " + str( main.numCtrls ) +\
1026 " node(s) cluster;\n" +\
1027 "Different type of hosts will be tested in " +\
1028 "each step such as IPV4, Dual stack, VLAN etc" +\
1029 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001030 " OVS running in Mininet and compile intents" +\
1031 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001032
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001033 # No option point intents
1034 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001035 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001036 senders = [
1037 { "name":"h1","device":"of:0000000000000005/1" }
1038 ]
1039 recipients = [
1040 { "name":"h9","device":"of:0000000000000006/1" }
1041 ]
Jeremy42df2e72016-02-23 16:37:46 -08001042 testResult = main.FALSE
1043 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001044 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001045 main,
1046 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001047 senders=senders,
1048 recipients=recipients )
1049
1050 if installResult:
1051 testResult = main.intentFunction.testPointIntent(
1052 main,
1053 intentId=installResult,
1054 name="NOOPTION",
1055 senders=senders,
1056 recipients=recipients,
1057 sw1="s5",
1058 sw2="s2",
1059 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001060 else:
1061 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001062
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001063 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001064 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001065 onpass=main.assertReturnString,
1066 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001067
1068 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -07001069 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001070 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001071 senders = [
1072 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1073 ]
1074 recipients = [
1075 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
1076 ]
Jeremy42df2e72016-02-23 16:37:46 -08001077 testResult = main.FALSE
1078 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001079 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001080 main,
1081 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001082 senders=senders,
1083 recipients=recipients,
1084 ethType="IPV4" )
1085
1086 if installResult:
1087 testResult = main.intentFunction.testPointIntent(
1088 main,
1089 intentId=installResult,
1090 name="IPV4",
1091 senders=senders,
1092 recipients=recipients,
1093 sw1="s5",
1094 sw2="s2",
1095 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001096 else:
1097 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001098
1099 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001100 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001101 onpass=main.assertReturnString,
1102 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001103 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001104 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001105 senders = [
1106 { "name":"h1","device":"of:0000000000000005/1" }
1107 ]
1108 recipients = [
1109 { "name":"h9","device":"of:0000000000000006/1" }
1110 ]
Jeremy42df2e72016-02-23 16:37:46 -08001111 testResult = main.FALSE
1112 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001113 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001114 main,
1115 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001116 senders=senders,
1117 recipients=recipients,
1118 ethType="IPV4" )
1119
1120 if installResult:
1121 testResult = main.intentFunction.testPointIntent(
1122 main,
1123 intentId=installResult,
1124 name="IPV4_2",
1125 senders=senders,
1126 recipients=recipients,
1127 sw1="s5",
1128 sw2="s2",
1129 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001130 else:
1131 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001132
1133 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001134 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001135 onpass=main.assertReturnString,
1136 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001137
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001138 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001139 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001140 senders = [
1141 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001142 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001143 ]
1144 recipients = [
1145 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001146 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001147 ]
Jeremy6f000c62016-02-25 17:02:28 -08001148 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001149 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001150 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1151 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001152 testResult = main.FALSE
1153 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001154 installResult = main.intentFunction.installPointIntent(
1155 main,
1156 name="SDNIP-ICMP",
1157 senders=senders,
1158 recipients=recipients,
1159 ethType="IPV4",
1160 ipProto=ipProto,
1161 tcpSrc=tcpSrc,
1162 tcpDst=tcpDst )
1163
1164 if installResult:
1165 testResult = main.intentFunction.testPointIntent(
1166 main,
1167 intentId=installResult,
1168 name="SDNIP_ICMP",
1169 senders=senders,
1170 recipients=recipients,
1171 sw1="s5",
1172 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001173 expectedLink=18,
1174 useTCP=True)
Jeremy42df2e72016-02-23 16:37:46 -08001175 else:
1176 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001177
1178 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001179 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001180 onpass=main.assertReturnString,
1181 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001182
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001183 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001184 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001185 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1186 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001187 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1188 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001189 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1190 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1191 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1192
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001193 stepResult = main.intentFunction.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001194 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001195 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001196 host1="h1",
1197 host2="h9",
1198 deviceId1="of:0000000000000005/1",
1199 deviceId2="of:0000000000000006/1",
1200 mac1=mac1,
1201 mac2=mac2,
1202 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001203 ipProto=ipProto,
1204 ip1=ip1,
1205 ip2=ip2,
1206 tcp1=tcp1,
1207 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001208
1209 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001210 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001211 onpass=main.assertReturnString,
1212 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001213
acsmars5d8cc862015-09-25 09:44:50 -07001214 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1215 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001216 senders = [
1217 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1218 ]
1219 recipients = [
1220 { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
1221 ]
Jeremy42df2e72016-02-23 16:37:46 -08001222 testResult = main.FALSE
1223 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001224 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001225 main,
1226 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001227 senders=senders,
1228 recipients=recipients,
1229 ethType="IPV4" )
1230
1231 if installResult:
1232 testResult = main.intentFunction.testPointIntent(
1233 main,
1234 intentId=installResult,
1235 name="DUALSTACK1",
1236 senders=senders,
1237 recipients=recipients,
1238 sw1="s5",
1239 sw2="s2",
1240 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001241 else:
1242 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001243
1244 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001245 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001246 onpass=main.assertReturnString,
1247 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001248
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001249 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001250 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001251 senders = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001252 { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001253 ]
1254 recipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001255 { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001256 ]
Jeremy42df2e72016-02-23 16:37:46 -08001257 testResult = main.FALSE
1258 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001259 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001260 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001261 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001262 senders=senders,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001263 recipients=recipients)
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001264
1265 if installResult:
1266 testResult = main.intentFunction.testPointIntent(
1267 main,
1268 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001269 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001270 senders=senders,
1271 recipients=recipients,
1272 sw1="s5",
1273 sw2="s2",
1274 expectedLink=18)
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001275
1276 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001277 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001278 onpass=main.assertReturnString,
1279 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001280
Jeremy Songsterff553672016-05-12 17:06:23 -07001281 main.step( "VLAN: Add point intents between h5 and h21" )
1282 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1283 senders = [
1284 { "name":"h4", "vlan":"100" }
1285 ]
1286 recipients = [
1287 { "name":"h21", "vlan":"200" }
1288 ]
1289 testResult = main.FALSE
1290 installResult = main.FALSE
1291 installResult = main.intentFunction.installPointIntent(
1292 main,
1293 name="VLAN2",
1294 senders=senders,
1295 recipients=recipients,
1296 setVlan=200)
1297
1298 if installResult:
1299 testResult = main.intentFunction.testPointIntent(
1300 main,
1301 intentId=installResult,
1302 name="VLAN2",
1303 senders=senders,
1304 recipients=recipients,
1305 sw1="s5",
1306 sw2="s2",
1307 expectedLink=18)
1308
1309 utilities.assert_equals( expect=main.TRUE,
1310 actual=testResult,
1311 onpass=main.assertReturnString,
1312 onfail=main.assertReturnString )
1313
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001314 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001315 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001316 senders = [
1317 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1318 ]
1319 recipients = [
1320 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1321 ]
Jeremy42df2e72016-02-23 16:37:46 -08001322 testResult = main.FALSE
1323 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001324 installResult = main.intentFunction.installPointIntent(
1325 main,
1326 name="1HOP IPV4",
1327 senders=senders,
1328 recipients=recipients,
1329 ethType="IPV4" )
1330
1331 if installResult:
1332 testResult = main.intentFunction.testPointIntent(
1333 main,
1334 intentId=installResult,
1335 name="1HOP IPV4",
1336 senders=senders,
1337 recipients=recipients,
1338 sw1="s5",
1339 sw2="s2",
1340 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001341 else:
1342 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001343
1344 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001345 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001346 onpass=main.assertReturnString,
1347 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001348
Jeremy Songsterc032f162016-08-04 17:14:49 -07001349 main.step( "Add point to point intents using VLAN Encapsulation" )
1350 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1351 senders = [
1352 { "name":"h1","device":"of:0000000000000005/1" }
1353 ]
1354 recipients = [
1355 { "name":"h9","device":"of:0000000000000006/1" }
1356 ]
1357 testResult = main.FALSE
1358 installResult = main.FALSE
1359 installResult = main.intentFunction.installPointIntent(
1360 main,
1361 name="ENCAPSULATION",
1362 senders=senders,
1363 recipients=recipients,
1364 encap="VLAN" )
1365
1366 if installResult:
1367 testResult = main.intentFunction.testPointIntent(
1368 main,
1369 intentId=installResult,
1370 name="ENCAPSULATION",
1371 senders=senders,
1372 recipients=recipients,
1373 sw1="s5",
1374 sw2="s2",
1375 expectedLink=18)
1376 else:
1377 main.CLIs[ 0 ].removeAllIntents( purge=True )
1378
1379 utilities.assert_equals( expect=main.TRUE,
1380 actual=testResult,
1381 onpass=main.assertReturnString,
1382 onfail=main.assertReturnString )
1383
kelvin-onlab016dce22015-08-10 09:54:11 -07001384 main.intentFunction.report( main )
1385
kelvin-onlabb769f562015-07-15 17:05:10 -07001386 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001387 """
1388 Add single point to multi point intents
1389 - Get device ids
1390 - Add single point to multi point intents
1391 - Check intents
1392 - Verify flows
1393 - Ping hosts
1394 - Reroute
1395 - Link down
1396 - Verify flows
1397 - Check topology
1398 - Ping hosts
1399 - Link up
1400 - Verify flows
1401 - Check topology
1402 - Ping hosts
1403 - Remove intents
1404 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001405 if main.initialized == main.FALSE:
1406 main.log.error( "Test components did not start correctly, skipping further tests" )
1407 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001408 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001409 try:
1410 assert main.CLIs
1411 except AssertionError:
1412 main.log.error( "There is no main.CLIs, skipping test cases" )
1413 main.initialized = main.FALSE
1414 main.skipCase()
1415 try:
1416 assert main.Mininet1
1417 except AssertionError:
1418 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1419 main.initialized = main.FALSE
1420 main.skipCase()
1421 try:
1422 assert main.numSwitch
1423 except AssertionError:
1424 main.log.error( "Place the total number of switch topology in \
1425 main.numSwitch" )
1426 main.initialized = main.FALSE
1427 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001428
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001429 main.testName = "Single to Multi Point Intents"
1430 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001431 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001432 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001433 " multi point intents using " +\
1434 str( main.numCtrls ) + " node(s) cluster;\n" +\
1435 "Different type of hosts will be tested in " +\
1436 "each step such as IPV4, Dual stack, VLAN etc" +\
1437 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001438 " OVS running in Mininet and compile intents" +\
1439 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001440
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001441 main.step( "NOOPTION: Install and test single point to multi point intents" )
1442 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1443 senders = [
1444 { "name":"h8", "device":"of:0000000000000005/8" }
1445 ]
1446 recipients = [
1447 { "name":"h16", "device":"of:0000000000000006/8" },
1448 { "name":"h24", "device":"of:0000000000000007/8" }
1449 ]
1450 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1451 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1452 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001453 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001454 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001455 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001456 name="NOOPTION",
1457 senders=senders,
1458 recipients=recipients,
1459 sw1="s5",
1460 sw2="s2")
1461
1462 if installResult:
1463 testResult = main.intentFunction.testPointIntent(
1464 main,
1465 intentId=installResult,
1466 name="NOOPTION",
1467 senders=senders,
1468 recipients=recipients,
1469 badSenders=badSenders,
1470 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001471 sw1="s5",
1472 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001473 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001474 else:
1475 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001476
1477 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001478 actual=testResult,
1479 onpass=main.assertReturnString,
1480 onfail=main.assertReturnString )
1481
1482 main.step( "IPV4: Install and test single point to multi point intents" )
1483 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1484 senders = [
1485 { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
1486 ]
1487 recipients = [
1488 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1489 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1490 ]
1491 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1492 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1493 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001494 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001495 installResult = main.intentFunction.installSingleToMultiIntent(
1496 main,
1497 name="IPV4",
1498 senders=senders,
1499 recipients=recipients,
1500 ethType="IPV4",
1501 sw1="s5",
1502 sw2="s2")
1503
1504 if installResult:
1505 testResult = main.intentFunction.testPointIntent(
1506 main,
1507 intentId=installResult,
1508 name="IPV4",
1509 senders=senders,
1510 recipients=recipients,
1511 badSenders=badSenders,
1512 badRecipients=badRecipients,
1513 sw1="s5",
1514 sw2="s2",
1515 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001516 else:
1517 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001518
1519 utilities.assert_equals( expect=main.TRUE,
1520 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001521 onpass=main.assertReturnString,
1522 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001523
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001524 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001525 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 -08001526 senders = [
1527 { "name":"h8", "device":"of:0000000000000005/8" }
1528 ]
1529 recipients = [
1530 { "name":"h16", "device":"of:0000000000000006/8" },
1531 { "name":"h24", "device":"of:0000000000000007/8" }
1532 ]
1533 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1534 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1535 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001536 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001537 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001538 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001539 name="IPV4_2",
1540 senders=senders,
1541 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001542 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001543 sw1="s5",
1544 sw2="s2")
1545
1546 if installResult:
1547 testResult = main.intentFunction.testPointIntent(
1548 main,
1549 intentId=installResult,
1550 name="IPV4_2",
1551 senders=senders,
1552 recipients=recipients,
1553 badSenders=badSenders,
1554 badRecipients=badRecipients,
1555 sw1="s5",
1556 sw2="s2",
1557 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001558 else:
1559 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001560
1561 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001562 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001563 onpass=main.assertReturnString,
1564 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001565
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001566 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001567 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 -08001568 senders = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001569 { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04", "vlan":"100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001570 ]
1571 recipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001572 { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" },
1573 { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14", "vlan":"100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001574 ]
1575 badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
1576 badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
1577 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001578 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001579 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001580 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001581 name="VLAN`",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001582 senders=senders,
1583 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001584 sw1="s5",
1585 sw2="s2")
1586
1587 if installResult:
1588 testResult = main.intentFunction.testPointIntent(
1589 main,
1590 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001591 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001592 senders=senders,
1593 recipients=recipients,
1594 badSenders=badSenders,
1595 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001596 sw1="s5",
1597 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001598 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001599 else:
1600 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001601
1602 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001603 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001604 onpass=main.assertReturnString,
1605 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001606
Jeremy Songsterff553672016-05-12 17:06:23 -07001607 main.step( "VLAN: Add single point to multi point intents" )
1608 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1609 senders = [
1610 { "name":"h5", "vlan":"200" }
1611 ]
1612 recipients = [
1613 { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" },
1614 { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14", "vlan":"100" }
1615 ]
1616 badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
1617 badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
1618 testResult = main.FALSE
1619 installResult = main.FALSE
1620 installResult = main.intentFunction.installSingleToMultiIntent(
1621 main,
1622 name="VLAN2",
1623 senders=senders,
1624 recipients=recipients,
1625 sw1="s5",
1626 sw2="s2",
1627 setVlan=100)
1628
1629 if installResult:
1630 testResult = main.intentFunction.testPointIntent(
1631 main,
1632 intentId=installResult,
1633 name="VLAN2",
1634 senders=senders,
1635 recipients=recipients,
1636 badSenders=badSenders,
1637 badRecipients=badRecipients,
1638 sw1="s5",
1639 sw2="s2",
1640 expectedLink=18)
1641 else:
1642 main.CLIs[ 0 ].removeAllIntents( purge=True )
1643
1644 utilities.assert_equals( expect=main.TRUE,
1645 actual=testResult,
1646 onpass=main.assertReturnString,
1647 onfail=main.assertReturnString )
1648
Jeremy Songsterc032f162016-08-04 17:14:49 -07001649 main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1650 main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1651 senders = [
1652 { "name":"h8", "device":"of:0000000000000005/8" }
1653 ]
1654 recipients = [
1655 { "name":"h16", "device":"of:0000000000000006/8" },
1656 { "name":"h24", "device":"of:0000000000000007/8" }
1657 ]
1658 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1659 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1660 testResult = main.FALSE
1661 installResult = main.FALSE
1662 installResult = main.intentFunction.installSingleToMultiIntent(
1663 main,
1664 name="ENCAPSULATION",
1665 senders=senders,
1666 recipients=recipients,
1667 sw1="s5",
1668 sw2="s2",
1669 encap="VLAN" )
1670
1671 if installResult:
1672 testResult = main.intentFunction.testPointIntent(
1673 main,
1674 intentId=installResult,
1675 name="ENCAPSULATION",
1676 senders=senders,
1677 recipients=recipients,
1678 badSenders=badSenders,
1679 badRecipients=badRecipients,
1680 sw1="s5",
1681 sw2="s2",
1682 expectedLink=18)
1683 else:
1684 main.CLIs[ 0 ].removeAllIntents( purge=True )
1685
1686 utilities.assert_equals( expect=main.TRUE,
1687 actual=testResult,
1688 onpass=main.assertReturnString,
1689 onfail=main.assertReturnString )
1690
kelvin-onlab016dce22015-08-10 09:54:11 -07001691 main.intentFunction.report( main )
1692
kelvin-onlabb769f562015-07-15 17:05:10 -07001693 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001694 """
1695 Add multi point to single point intents
1696 - Get device ids
1697 - Add multi point to single point intents
1698 - Check intents
1699 - Verify flows
1700 - Ping hosts
1701 - Reroute
1702 - Link down
1703 - Verify flows
1704 - Check topology
1705 - Ping hosts
1706 - Link up
1707 - Verify flows
1708 - Check topology
1709 - Ping hosts
1710 - Remove intents
1711 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001712 if main.initialized == main.FALSE:
1713 main.log.error( "Test components did not start correctly, skipping further tests" )
1714 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001715 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001716 try:
1717 assert main.CLIs
1718 except AssertionError:
1719 main.log.error( "There is no main.CLIs, skipping test cases" )
1720 main.initialized = main.FALSE
1721 main.skipCase()
1722 try:
1723 assert main.Mininet1
1724 except AssertionError:
1725 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1726 main.initialized = main.FALSE
1727 main.skipCase()
1728 try:
1729 assert main.numSwitch
1730 except AssertionError:
1731 main.log.error( "Place the total number of switch topology in \
1732 main.numSwitch" )
1733 main.initialized = main.FALSE
1734 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001735
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001736 main.testName = "Multi To Single Point Intents"
1737 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001738 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001739 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001740 " multi point intents using " +\
1741 str( main.numCtrls ) + " node(s) cluster;\n" +\
1742 "Different type of hosts will be tested in " +\
1743 "each step such as IPV4, Dual stack, VLAN etc" +\
1744 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001745 " OVS running in Mininet and compile intents" +\
1746 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001747
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001748 main.step( "NOOPTION: Add multi point to single point intents" )
1749 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1750 senders = [
1751 { "name":"h16", "device":"of:0000000000000006/8" },
1752 { "name":"h24", "device":"of:0000000000000007/8" }
1753 ]
1754 recipients = [
1755 { "name":"h8", "device":"of:0000000000000005/8" }
1756 ]
1757 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1758 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1759 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001760 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001761 installResult = main.intentFunction.installMultiToSingleIntent(
1762 main,
1763 name="NOOPTION",
1764 senders=senders,
1765 recipients=recipients,
1766 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001767 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001768
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001769 if installResult:
1770 testResult = main.intentFunction.testPointIntent(
1771 main,
1772 intentId=installResult,
1773 name="NOOPTION",
1774 senders=senders,
1775 recipients=recipients,
1776 badSenders=badSenders,
1777 badRecipients=badRecipients,
1778 sw1="s5",
1779 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001780 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001781 else:
1782 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001783
1784 utilities.assert_equals( expect=main.TRUE,
1785 actual=testResult,
1786 onpass=main.assertReturnString,
1787 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001788
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001789 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001790 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 -08001791 senders = [
1792 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1793 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1794 ]
1795 recipients = [
1796 { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" }
1797 ]
1798 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1799 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1800 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001801 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001802 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001803 main,
1804 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001805 senders=senders,
1806 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001807 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001808 sw1="s5",
1809 sw2="s2")
1810
1811 if installResult:
1812 testResult = main.intentFunction.testPointIntent(
1813 main,
1814 intentId=installResult,
1815 name="IPV4",
1816 senders=senders,
1817 recipients=recipients,
1818 badSenders=badSenders,
1819 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001820 sw1="s5",
1821 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001822 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001823 else:
1824 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001825
1826 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001827 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001828 onpass=main.assertReturnString,
1829 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001830
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001831 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001832 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 -08001833 senders = [
1834 { "name":"h16", "device":"of:0000000000000006/8" },
1835 { "name":"h24", "device":"of:0000000000000007/8" }
1836 ]
1837 recipients = [
1838 { "name":"h8", "device":"of:0000000000000005/8" }
1839 ]
1840 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1841 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1842 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001843 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001844 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001845 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001846 name="IPV4_2",
1847 senders=senders,
1848 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001849 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001850 sw1="s5",
1851 sw2="s2")
1852
1853 if installResult:
1854 testResult = main.intentFunction.testPointIntent(
1855 main,
1856 intentId=installResult,
1857 name="IPV4_2",
1858 senders=senders,
1859 recipients=recipients,
1860 badSenders=badSenders,
1861 badRecipients=badRecipients,
1862 sw1="s5",
1863 sw2="s2",
1864 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001865 else:
1866 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001867
1868 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001869 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001870 onpass=main.assertReturnString,
1871 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001872
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001873 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001874 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 -08001875 senders = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001876 { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" },
1877 { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001878 ]
1879 recipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001880 { "name":"h5", "device":"of:0000000000000005/5", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001881 ]
1882 badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
1883 badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
1884 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001885 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001886 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001887 main,
1888 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001889 senders=senders,
1890 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001891 sw1="s5",
1892 sw2="s2")
1893
1894 if installResult:
1895 testResult = main.intentFunction.testPointIntent(
1896 main,
1897 intentId=installResult,
1898 name="VLAN",
1899 senders=senders,
1900 recipients=recipients,
1901 badSenders=badSenders,
1902 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001903 sw1="s5",
1904 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001905 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001906 else:
1907 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001908
1909 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001910 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001911 onpass=main.assertReturnString,
1912 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001913
Jeremy Songsterff553672016-05-12 17:06:23 -07001914 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1915 main.step( "VLAN: Add multi point to single point intents" )
1916 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1917 senders = [
1918 { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" },
1919 { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" }
1920 ]
1921 recipients = [
1922 { "name":"h4", "vlan":"100" }
1923 ]
1924 badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
1925 badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
1926 testResult = main.FALSE
1927 installResult = main.FALSE
1928 installResult = main.intentFunction.installMultiToSingleIntent(
1929 main,
1930 name="VLAN2",
1931 senders=senders,
1932 recipients=recipients,
1933 sw1="s5",
1934 sw2="s2",
1935 setVlan=100)
1936
1937 if installResult:
1938 testResult = main.intentFunction.testPointIntent(
1939 main,
1940 intentId=installResult,
1941 name="VLAN2",
1942 senders=senders,
1943 recipients=recipients,
1944 badSenders=badSenders,
1945 badRecipients=badRecipients,
1946 sw1="s5",
1947 sw2="s2",
1948 expectedLink=18)
1949 else:
1950 main.CLIs[ 0 ].removeAllIntents( purge=True )
1951
1952 utilities.assert_equals( expect=main.TRUE,
1953 actual=testResult,
1954 onpass=main.assertReturnString,
1955 onfail=main.assertReturnString )
1956
Jeremy Songsterc032f162016-08-04 17:14:49 -07001957 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1958 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1959 senders = [
1960 { "name":"h16", "device":"of:0000000000000006/8" },
1961 { "name":"h24", "device":"of:0000000000000007/8" }
1962 ]
1963 recipients = [
1964 { "name":"h8", "device":"of:0000000000000005/8" }
1965 ]
1966 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1967 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1968 testResult = main.FALSE
1969 installResult = main.FALSE
1970 installResult = main.intentFunction.installMultiToSingleIntent(
1971 main,
1972 name="ENCAPSULATION",
1973 senders=senders,
1974 recipients=recipients,
1975 sw1="s5",
1976 sw2="s2",
1977 encap="VLAN" )
1978
1979 if installResult:
1980 testResult = main.intentFunction.testPointIntent(
1981 main,
1982 intentId=installResult,
1983 name="ENCAPSULATION",
1984 senders=senders,
1985 recipients=recipients,
1986 badSenders=badSenders,
1987 badRecipients=badRecipients,
1988 sw1="s5",
1989 sw2="s2",
1990 expectedLink=18 )
1991 else:
1992 main.CLIs[ 0 ].removeAllIntents( purge=True )
1993
1994 utilities.assert_equals( expect=main.TRUE,
1995 actual=testResult,
1996 onpass=main.assertReturnString,
1997 onfail=main.assertReturnString )
1998
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001999 main.intentFunction.report( main )
2000
acsmars1ff5e052015-07-23 11:27:48 -07002001 def CASE5000( self, main ):
2002 """
acsmars5d8cc862015-09-25 09:44:50 -07002003 Tests Host Mobility
2004 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002005 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002006 if main.initialized == main.FALSE:
2007 main.log.error( "Test components did not start correctly, skipping further tests" )
2008 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002009 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002010 try:
2011 assert main.CLIs
2012 except AssertionError:
2013 main.log.error( "There is no main.CLIs, skipping test cases" )
2014 main.initialized = main.FALSE
2015 main.skipCase()
2016 try:
2017 assert main.Mininet1
2018 except AssertionError:
2019 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2020 main.initialized = main.FALSE
2021 main.skipCase()
2022 try:
2023 assert main.numSwitch
2024 except AssertionError:
2025 main.log.error( "Place the total number of switch topology in \
2026 main.numSwitch" )
2027 main.initialized = main.FALSE
2028 main.skipCase()
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002029 main.case( "Test host mobility with host intents " )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002030 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002031 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2032
Jeremy2f190ca2016-01-29 15:23:57 -08002033 main.log.info( "Moving h1 from s5 to s6")
acsmars1ff5e052015-07-23 11:27:48 -07002034 main.Mininet1.moveHost( "h1","s5","s6" )
2035
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002036 # Send discovery ping from moved host
2037 # Moving the host brings down the default interfaces and creates a new one.
2038 # Scapy is restarted on this host to detect the new interface
2039 main.h1.stopScapy()
2040 main.h1.startScapy()
2041
2042 # Discover new host location in ONOS and populate host data.
2043 # Host 1 IP and MAC should be unchanged
2044 main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
2045 main.intentFunction.populateHostData( main )
2046
acsmars1ff5e052015-07-23 11:27:48 -07002047 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2048
2049 utilities.assert_equals( expect="of:0000000000000006",
2050 actual=h1PostMove,
2051 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002052 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002053 " to single point intents" +
2054 " with IPV4 type and MAC addresses" +
2055 " in the same VLAN" )
2056
2057 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002058 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002059 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
2060 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002061 testResult = main.FALSE
2062 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002063 installResult = main.intentFunction.installHostIntent( main,
2064 name='IPV4 Mobility IPV4',
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002065 onosNode='0',
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002066 host1=host1,
Jeremye0cb5eb2016-01-27 17:39:09 -08002067 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002068 if installResult:
2069 testResult = main.intentFunction.testHostIntent( main,
2070 name='Host Mobility IPV4',
2071 intentId = installResult,
2072 onosNode='0',
2073 host1=host1,
2074 host2=host2,
2075 sw1="s6",
2076 sw2="s2",
2077 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002078 else:
2079 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002080
2081 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002082 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002083 onpass=main.assertReturnString,
2084 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002085
2086 main.intentFunction.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002087
2088 def CASE6000( self, main ):
2089 """
2090 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2091 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002092 # At some later point discussion on this behavior in MPSP and SPMP intents
2093 # will be reoppened and this test case may need to be updated to reflect
2094 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002095 if main.initialized == main.FALSE:
2096 main.log.error( "Test components did not start correctly, skipping further tests" )
2097 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002098 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002099 try:
2100 assert main.CLIs
2101 except AssertionError:
2102 main.log.error( "There is no main.CLIs, skipping test cases" )
2103 main.initialized = main.FALSE
2104 main.skipCase()
2105 try:
2106 assert main.Mininet1
2107 except AssertionError:
2108 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2109 main.initialized = main.FALSE
2110 main.skipCase()
2111 try:
2112 assert main.numSwitch
2113 except AssertionError:
2114 main.log.error( "Place the total number of switch topology in \
2115 main.numSwitch" )
2116 main.initialized = main.FALSE
2117 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002118 main.case( "Test Multi to Single End Point Failure" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002119 main.step( "Installing Multi to Single Point intents with no options set" )
2120 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2121 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002122 senders = [
2123 { "name":"h16", "device":"of:0000000000000006/8" },
2124 { "name":"h24", "device":"of:0000000000000007/8" }
2125 ]
2126 recipients = [
2127 { "name":"h8", "device":"of:0000000000000005/8" }
2128 ]
2129 isolatedSenders = [
2130 { "name":"h24"}
2131 ]
2132 isolatedRecipients = []
2133 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08002134 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08002135 installResult = main.intentFunction.installMultiToSingleIntent(
2136 main,
2137 name="NOOPTION",
2138 senders=senders,
2139 recipients=recipients,
2140 sw1="s5",
2141 sw2="s2" )
2142
2143 if installResult:
2144 testResult = main.intentFunction.testEndPointFail(
2145 main,
2146 intentId=installResult,
2147 name="NOOPTION",
2148 senders=senders,
2149 recipients=recipients,
2150 isolatedSenders=isolatedSenders,
2151 isolatedRecipients=isolatedRecipients,
2152 sw1="s6",
2153 sw2="s2",
2154 sw3="s4",
2155 sw4="s1",
2156 sw5="s3",
2157 expectedLink1=16,
2158 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002159 else:
2160 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002161
2162 utilities.assert_equals( expect=main.TRUE,
2163 actual=testResult,
2164 onpass=main.assertReturnString,
2165 onfail=main.assertReturnString )
2166
Jeremy Songster9385d412016-06-02 17:57:36 -07002167 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2168
2169 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2170 "with partial failures allowed\n"
2171 senders = [
2172 { "name":"h16", "device":"of:0000000000000006/8" },
2173 { "name":"h24", "device":"of:0000000000000007/8" }
2174 ]
2175 recipients = [
2176 { "name":"h8", "device":"of:0000000000000005/8" }
2177 ]
2178 isolatedSenders = [
2179 { "name":"h24"}
2180 ]
2181 isolatedRecipients = []
2182 testResult = main.FALSE
2183 installResult = main.FALSE
2184 installResult = main.intentFunction.installMultiToSingleIntent(
2185 main,
2186 name="NOOPTION",
2187 senders=senders,
2188 recipients=recipients,
2189 sw1="s5",
2190 sw2="s2",
2191 partial=True )
2192
2193 if installResult:
2194 testResult = main.intentFunction.testEndPointFail(
2195 main,
2196 intentId=installResult,
2197 name="NOOPTION",
2198 senders=senders,
2199 recipients=recipients,
2200 isolatedSenders=isolatedSenders,
2201 isolatedRecipients=isolatedRecipients,
2202 sw1="s6",
2203 sw2="s2",
2204 sw3="s4",
2205 sw4="s1",
2206 sw5="s3",
2207 expectedLink1=16,
2208 expectedLink2=14,
2209 partial=True )
2210 else:
2211 main.CLIs[ 0 ].removeAllIntents( purge=True )
2212
2213 utilities.assert_equals( expect=main.TRUE,
2214 actual=testResult,
2215 onpass=main.assertReturnString,
2216 onfail=main.assertReturnString )
2217
Jeremye0cb5eb2016-01-27 17:39:09 -08002218 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002219 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2220 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002221 senders = [
2222 { "name":"h8", "device":"of:0000000000000005/8" }
2223 ]
2224 recipients = [
2225 { "name":"h16", "device":"of:0000000000000006/8" },
2226 { "name":"h24", "device":"of:0000000000000007/8" }
2227 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002228 isolatedSenders = []
2229 isolatedRecipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07002230 { "name":"h24"}
Jeremye0cb5eb2016-01-27 17:39:09 -08002231 ]
2232 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08002233 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08002234 installResult = main.intentFunction.installSingleToMultiIntent(
2235 main,
2236 name="NOOPTION",
2237 senders=senders,
2238 recipients=recipients,
2239 sw1="s5",
2240 sw2="s2")
2241
2242 if installResult:
2243 testResult = main.intentFunction.testEndPointFail(
2244 main,
2245 intentId=installResult,
2246 name="NOOPTION",
2247 senders=senders,
2248 recipients=recipients,
2249 isolatedSenders=isolatedSenders,
2250 isolatedRecipients=isolatedRecipients,
2251 sw1="s6",
2252 sw2="s2",
2253 sw3="s4",
2254 sw4="s1",
2255 sw5="s3",
2256 expectedLink1=16,
2257 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002258 else:
2259 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002260
2261 utilities.assert_equals( expect=main.TRUE,
2262 actual=testResult,
2263 onpass=main.assertReturnString,
2264 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002265 # Right now this functionality doesn't work properly in SPMP intents
2266 main.step( "NOOPTION: Install and test single point to multi point " +\
2267 "intents with partial failures allowed" )
2268 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2269 "point intent with partial failures allowed\n"
2270 senders = [
2271 { "name":"h8", "device":"of:0000000000000005/8" }
2272 ]
2273 recipients = [
2274 { "name":"h16", "device":"of:0000000000000006/8" },
2275 { "name":"h24", "device":"of:0000000000000007/8" }
2276 ]
2277 isolatedSenders = []
2278 isolatedRecipients = [
2279 { "name":"h24"}
2280 ]
2281 testResult = main.FALSE
2282 installResult = main.FALSE
2283 installResult = main.intentFunction.installSingleToMultiIntent(
2284 main,
2285 name="NOOPTION",
2286 senders=senders,
2287 recipients=recipients,
2288 sw1="s5",
2289 sw2="s2",
2290 partial=True)
2291
2292 if installResult:
2293 testResult = main.intentFunction.testEndPointFail(
2294 main,
2295 intentId=installResult,
2296 name="NOOPTION",
2297 senders=senders,
2298 recipients=recipients,
2299 isolatedSenders=isolatedSenders,
2300 isolatedRecipients=isolatedRecipients,
2301 sw1="s6",
2302 sw2="s2",
2303 sw3="s4",
2304 sw4="s1",
2305 sw5="s3",
2306 expectedLink1=16,
2307 expectedLink2=14,
2308 partial=True )
2309 else:
2310 main.CLIs[ 0 ].removeAllIntents( purge=True )
2311
2312 utilities.assert_equals( expect=main.TRUE,
2313 actual=testResult,
2314 onpass=main.assertReturnString,
2315 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002316
Jeremy2f190ca2016-01-29 15:23:57 -08002317 main.intentFunction.report( main )