blob: 5ee3f7074332a15ab7a8e5dba51d234ed35a715e [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' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070052 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Jon Halla3e02432015-07-24 15:55:42 -070053 gitPull = main.params[ 'GIT' ][ 'pull' ]
54 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
55 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
56 main.cellData = {} # for creating cell file
57 main.hostsData = {}
58 main.CLIs = []
59 main.ONOSip = []
Jeremy Songster1f39bf02016-01-20 17:17:25 -080060 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
61 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070062 main.assertReturnString = '' # Assembled assert return string
Jeremy Songster17147f22016-05-31 18:30:52 -070063 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070064
Jon Halla3e02432015-07-24 15:55:42 -070065 main.ONOSip = main.ONOSbench.getOnosIps()
66 print main.ONOSip
kelvin-onlabd48a68c2015-07-13 16:01:36 -070067
Jon Halla3e02432015-07-24 15:55:42 -070068 # Assigning ONOS cli handles to a list
69 for i in range( 1, main.maxNodes + 1 ):
70 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070071
Jon Halla3e02432015-07-24 15:55:42 -070072 # -- INIT SECTION, ONLY RUNS ONCE -- #
73 main.startUp = imp.load_source( wrapperFile1,
74 main.dependencyPath +
75 wrapperFile1 +
76 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070077
Jon Halla3e02432015-07-24 15:55:42 -070078 main.intentFunction = imp.load_source( wrapperFile2,
79 main.dependencyPath +
80 wrapperFile2 +
81 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070082
Jon Halla3e02432015-07-24 15:55:42 -070083 main.topo = imp.load_source( wrapperFile3,
84 main.dependencyPath +
85 wrapperFile3 +
86 ".py" )
87
kelvin-onlabd9e23de2015-08-06 10:34:44 -070088 copyResult1 = main.ONOSbench.scp( main.Mininet1,
89 main.dependencyPath +
90 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080091 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070092 direction="to" )
Jon Halla3e02432015-07-24 15:55:42 -070093 if main.CLIs:
94 stepResult = main.TRUE
95 else:
96 main.log.error( "Did not properly created list of ONOS CLI handle" )
97 stepResult = main.FALSE
98 except Exception as e:
99 main.log.exception(e)
100 main.cleanup()
101 main.exit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700102
103 utilities.assert_equals( expect=main.TRUE,
104 actual=stepResult,
105 onpass="Successfully construct " +
106 "test variables ",
107 onfail="Failed to construct test variables" )
108
109 if gitPull == 'True':
110 main.step( "Building ONOS in " + gitBranch + " branch" )
111 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
112 stepResult = onosBuildResult
113 utilities.assert_equals( expect=main.TRUE,
114 actual=stepResult,
115 onpass="Successfully compiled " +
116 "latest ONOS",
117 onfail="Failed to compile " +
118 "latest ONOS" )
119 else:
120 main.log.warn( "Did not pull new code so skipping mvn " +
121 "clean install" )
Jon Hall106be082015-07-22 09:53:00 -0700122 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700123
124 def CASE2( self, main ):
125 """
126 - Set up cell
127 - Create cell file
128 - Set cell file
129 - Verify cell file
130 - Kill ONOS process
131 - Uninstall ONOS cluster
132 - Verify ONOS start up
133 - Install ONOS cluster
134 - Connect to cli
135 """
136
Jeremy Songster17147f22016-05-31 18:30:52 -0700137 main.cycle += 1
138
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700139 # main.scale[ 0 ] determines the current number of ONOS controller
140 main.numCtrls = int( main.scale[ 0 ] )
Jeremycd872222016-03-29 10:08:34 -0700141 main.flowCompiler = "Flow Rules"
Jeremyd9e4eb12016-04-13 12:09:06 -0700142 main.initialized = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700143
144 main.case( "Starting up " + str( main.numCtrls ) +
145 " node(s) ONOS cluster" )
Jon Hall783bbf92015-07-23 14:33:19 -0700146 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700147 " node(s) ONOS cluster"
148
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700149 #kill off all onos processes
150 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800151 " before initiating environment setup" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700152
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800153 time.sleep( main.startUpSleep )
154 main.step( "Uninstalling ONOS package" )
155 onosUninstallResult = main.TRUE
156 for ip in main.ONOSip:
157 onosUninstallResult = onosUninstallResult and \
158 main.ONOSbench.onosUninstall( nodeIp=ip )
159 stepResult = onosUninstallResult
160 utilities.assert_equals( expect=main.TRUE,
161 actual=stepResult,
162 onpass="Successfully uninstalled ONOS package",
163 onfail="Failed to uninstall ONOS package" )
Jeremy42df2e72016-02-23 16:37:46 -0800164 time.sleep( main.startUpSleep )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800165
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700166 for i in range( main.maxNodes ):
167 main.ONOSbench.onosDie( main.ONOSip[ i ] )
168
169 print "NODE COUNT = ", main.numCtrls
170
171 tempOnosIp = []
172 for i in range( main.numCtrls ):
173 tempOnosIp.append( main.ONOSip[i] )
174
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700175 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
176 "temp", main.Mininet1.ip_address,
177 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700178
179 main.step( "Apply cell to environment" )
180 cellResult = main.ONOSbench.setCell( "temp" )
181 verifyResult = main.ONOSbench.verifyCell()
182 stepResult = cellResult and verifyResult
183 utilities.assert_equals( expect=main.TRUE,
184 actual=stepResult,
185 onpass="Successfully applied cell to " + \
186 "environment",
187 onfail="Failed to apply cell to environment " )
188
189 main.step( "Creating ONOS package" )
190 packageResult = main.ONOSbench.onosPackage()
191 stepResult = packageResult
192 utilities.assert_equals( expect=main.TRUE,
193 actual=stepResult,
194 onpass="Successfully created ONOS package",
195 onfail="Failed to create ONOS package" )
196
197 time.sleep( main.startUpSleep )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700198 main.step( "Installing ONOS package" )
199 onosInstallResult = main.TRUE
200 for i in range( main.numCtrls ):
201 onosInstallResult = onosInstallResult and \
202 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
203 stepResult = onosInstallResult
204 utilities.assert_equals( expect=main.TRUE,
205 actual=stepResult,
206 onpass="Successfully installed ONOS package",
207 onfail="Failed to install ONOS package" )
208
209 time.sleep( main.startUpSleep )
210 main.step( "Starting ONOS service" )
211 stopResult = main.TRUE
212 startResult = main.TRUE
213 onosIsUp = main.TRUE
214
215 for i in range( main.numCtrls ):
Jeremy Songster7edb6632016-04-28 15:44:28 -0700216 isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
217 onosIsUp = onosIsUp and isUp
218 if isUp == main.TRUE:
Jeremyd9e4eb12016-04-13 12:09:06 -0700219 main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
220 else:
221 main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
222 "start ONOS again " )
223 stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
224 startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
225 if not startResult or stopResult:
226 main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700227 stepResult = onosIsUp and stopResult and startResult
228 utilities.assert_equals( expect=main.TRUE,
229 actual=stepResult,
Jeremyd9e4eb12016-04-13 12:09:06 -0700230 onpass="ONOS service is ready on all nodes",
231 onfail="ONOS service did not start properly on all nodes" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700232
233 main.step( "Start ONOS cli" )
234 cliResult = main.TRUE
235 for i in range( main.numCtrls ):
236 cliResult = cliResult and \
237 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
238 stepResult = cliResult
239 utilities.assert_equals( expect=main.TRUE,
240 actual=stepResult,
241 onpass="Successfully start ONOS cli",
242 onfail="Failed to start ONOS cli" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700243 if not stepResult:
244 main.initialized = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700245
246 # Remove the first element in main.scale list
247 main.scale.remove( main.scale[ 0 ] )
248
kelvin-onlab016dce22015-08-10 09:54:11 -0700249 main.intentFunction.report( main )
250
Jon Halla3e02432015-07-24 15:55:42 -0700251 def CASE8( self, main ):
252 """
acsmars59a4c552015-09-10 18:11:19 -0700253 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700254 """
255 import json
256
257 main.case( "Compare ONOS Topology view to Mininet topology" )
258 main.caseExplanation = "Compare topology elements between Mininet" +\
259 " and ONOS"
260
acsmars59a4c552015-09-10 18:11:19 -0700261 main.log.info( "Gathering topology information from Mininet" )
262 devicesResults = main.FALSE # Overall Boolean for device correctness
263 linksResults = main.FALSE # Overall Boolean for link correctness
264 hostsResults = main.FALSE # Overall Boolean for host correctness
265 deviceFails = [] # Nodes where devices are incorrect
266 linkFails = [] # Nodes where links are incorrect
267 hostFails = [] # Nodes where hosts are incorrect
268 attempts = main.checkTopoAttempts # Remaining Attempts
Jon Halla3e02432015-07-24 15:55:42 -0700269
270 mnSwitches = main.Mininet1.getSwitches()
271 mnLinks = main.Mininet1.getLinks()
272 mnHosts = main.Mininet1.getHosts()
273
Jon Hall70b2ff42015-11-17 15:49:44 -0800274 main.step( "Comparing Mininet topology to ONOS topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700275
acsmars59a4c552015-09-10 18:11:19 -0700276 while ( attempts >= 0 ) and\
277 ( not devicesResults or not linksResults or not hostsResults ):
278 time.sleep( 2 )
279 if not devicesResults:
280 devices = main.topo.getAllDevices( main )
281 ports = main.topo.getAllPorts( main )
282 devicesResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800283 deviceFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700284 if not linksResults:
285 links = main.topo.getAllLinks( main )
286 linksResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800287 linkFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700288 if not hostsResults:
289 hosts = main.topo.getAllHosts( main )
290 hostsResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800291 hostFails = [] # Reset for each failed attempt
Jon Halla3e02432015-07-24 15:55:42 -0700292
acsmars59a4c552015-09-10 18:11:19 -0700293 # Check for matching topology on each node
294 for controller in range( main.numCtrls ):
295 controllerStr = str( controller + 1 ) # ONOS node number
296 # Compare Devices
297 if devices[ controller ] and ports[ controller ] and\
298 "Error" not in devices[ controller ] and\
299 "Error" not in ports[ controller ]:
Jon Halla3e02432015-07-24 15:55:42 -0700300
acsmars2ec91d62015-09-16 11:15:48 -0700301 try:
302 deviceData = json.loads( devices[ controller ] )
303 portData = json.loads( ports[ controller ] )
304 except (TypeError,ValueError):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800305 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
acsmars2ec91d62015-09-16 11:15:48 -0700306 currentDevicesResult = main.FALSE
307 else:
308 currentDevicesResult = main.Mininet1.compareSwitches(
309 mnSwitches,deviceData,portData )
acsmars59a4c552015-09-10 18:11:19 -0700310 else:
311 currentDevicesResult = main.FALSE
312 if not currentDevicesResult:
313 deviceFails.append( controllerStr )
314 devicesResults = devicesResults and currentDevicesResult
315 # Compare Links
316 if links[ controller ] and "Error" not in links[ controller ]:
acsmars2ec91d62015-09-16 11:15:48 -0700317 try:
318 linkData = json.loads( links[ controller ] )
319 except (TypeError,ValueError):
320 main.log.error("Could not load json:" + str( links[ controller ] ) )
321 currentLinksResult = main.FALSE
322 else:
323 currentLinksResult = main.Mininet1.compareLinks(
324 mnSwitches, mnLinks,linkData )
acsmars59a4c552015-09-10 18:11:19 -0700325 else:
326 currentLinksResult = main.FALSE
327 if not currentLinksResult:
328 linkFails.append( controllerStr )
329 linksResults = linksResults and currentLinksResult
330 # Compare Hosts
acsmars2ec91d62015-09-16 11:15:48 -0700331 if hosts[ controller ] and "Error" not in hosts[ controller ]:
332 try:
333 hostData = json.loads( hosts[ controller ] )
334 except (TypeError,ValueError):
335 main.log.error("Could not load json:" + str( hosts[ controller ] ) )
336 currentHostsResult = main.FALSE
337 else:
338 currentHostsResult = main.Mininet1.compareHosts(
339 mnHosts,hostData )
acsmars59a4c552015-09-10 18:11:19 -0700340 else:
341 currentHostsResult = main.FALSE
342 if not currentHostsResult:
343 hostFails.append( controllerStr )
344 hostsResults = hostsResults and currentHostsResult
345 # Decrement Attempts Remaining
346 attempts -= 1
347
348
349 utilities.assert_equals( expect=[],
350 actual=deviceFails,
351 onpass="ONOS correctly discovered all devices",
352 onfail="ONOS incorrectly discovered devices on nodes: " +
353 str( deviceFails ) )
354 utilities.assert_equals( expect=[],
355 actual=linkFails,
356 onpass="ONOS correctly discovered all links",
357 onfail="ONOS incorrectly discovered links on nodes: " +
358 str( linkFails ) )
359 utilities.assert_equals( expect=[],
360 actual=hostFails,
361 onpass="ONOS correctly discovered all hosts",
362 onfail="ONOS incorrectly discovered hosts on nodes: " +
363 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700364 topoResults = hostsResults and linksResults and devicesResults
365 utilities.assert_equals( expect=main.TRUE,
366 actual=topoResults,
367 onpass="ONOS correctly discovered the topology",
368 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700369
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700370 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700371 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700372 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700373 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700374 if main.initialized == main.FALSE:
375 main.log.error( "Test components did not start correctly, skipping further tests" )
376 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700377 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700378 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700379 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700380 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700381 "switches to test intents, exits out if " +\
382 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700383
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700384 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700385 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700386 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700387 main.topology,
388 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700389 stepResult = topoResult
390 utilities.assert_equals( expect=main.TRUE,
391 actual=stepResult,
392 onpass="Successfully loaded topology",
393 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700394
395 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700396 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700397 main.initialized = main.FALSE
398 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700399
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700400 def CASE11( self, main ):
401 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700402 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700403 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700404 if main.initialized == main.FALSE:
405 main.log.error( "Test components did not start correctly, skipping further tests" )
406 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700407 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700408 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700409 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700410 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700411 "switches to test intents, exits out if " +\
412 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700413
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700414 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700415 args = "--switch ovs,protocols=OpenFlow13"
416 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
417 main.topology,
418 args=args )
419 stepResult = topoResult
420 utilities.assert_equals( expect=main.TRUE,
421 actual=stepResult,
422 onpass="Successfully loaded topology",
423 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700424 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700425 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700426 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700427
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700428 def CASE12( self, main ):
429 """
430 Assign mastership to controllers
431 """
432 import re
433
Jeremyd9e4eb12016-04-13 12:09:06 -0700434 if main.initialized == main.FALSE:
435 main.log.error( "Test components did not start correctly, skipping further tests" )
436 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700437 main.case( "Assign switches to controllers" )
438 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700439 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700440 " switches to ONOS nodes"
441
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700442 assignResult = main.TRUE
443 switchList = []
444
445 # Creates a list switch name, use getSwitch() function later...
446 for i in range( 1, ( main.numSwitch + 1 ) ):
447 switchList.append( 's' + str( i ) )
448
449 tempONOSip = []
450 for i in range( main.numCtrls ):
451 tempONOSip.append( main.ONOSip[ i ] )
452
453 assignResult = main.Mininet1.assignSwController( sw=switchList,
454 ip=tempONOSip,
Charles Chan029be652015-08-24 01:46:10 +0800455 port='6653' )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700456 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700457 main.log.error( "Problem assigning mastership of switches" )
458 main.initialized = main.FALSE
459 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700460
461 for i in range( 1, ( main.numSwitch + 1 ) ):
462 response = main.Mininet1.getSwController( "s" + str( i ) )
463 print( "Response is " + str( response ) )
464 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
465 assignResult = assignResult and main.TRUE
466 else:
467 assignResult = main.FALSE
468 stepResult = assignResult
469 utilities.assert_equals( expect=main.TRUE,
470 actual=stepResult,
471 onpass="Successfully assigned switches" +
472 "to controller",
473 onfail="Failed to assign switches to " +
474 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700475 if not stepResult:
476 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700477
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800478 def CASE13( self,main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700479 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800480 Create Scapy components
481 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700482 if main.initialized == main.FALSE:
483 main.log.error( "Test components did not start correctly, skipping further tests" )
484 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800485 main.case( "Create scapy components" )
486 main.step( "Create scapy components" )
487 import json
488 scapyResult = main.TRUE
489 for hostName in main.scapyHostNames:
490 main.Scapy1.createHostComponent( hostName )
491 main.scapyHosts.append( getattr( main, hostName ) )
492
493 main.step( "Start scapy components" )
494 for host in main.scapyHosts:
495 host.startHostCli()
496 host.startScapy()
497 host.updateSelf()
498 main.log.debug( host.name )
499 main.log.debug( host.hostIp )
500 main.log.debug( host.hostMac )
501
502
503 utilities.assert_equals( expect=main.TRUE,
504 actual=scapyResult,
505 onpass="Successfully created Scapy Components",
506 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700507 if not scapyResult:
508 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800509
510 def CASE14( self, main ):
511 """
512 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700513 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700514 if main.initialized == main.FALSE:
515 main.log.error( "Test components did not start correctly, skipping further tests" )
516 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700517 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800518 main.step( "Pingall hosts and confirm ONOS discovery" )
519 utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700520
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800521 utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE,
522 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700523 utilities.assert_equals( expect=main.TRUE,
524 actual=stepResult,
525 onpass="Successfully discovered hosts",
526 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700527 if not stepResult:
528 main.initialized = main.FALSE
529 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700530
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800531 main.step( "Populate hostsData" )
532 stepResult = main.intentFunction.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700533 utilities.assert_equals( expect=main.TRUE,
534 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800535 onpass="Successfully populated hostsData",
536 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700537 if not stepResult:
538 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800539
540 def CASE15( self, main ):
541 """
542 Discover all hosts with scapy arp packets and store its data to a dictionary
543 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700544 if main.initialized == main.FALSE:
545 main.log.error( "Test components did not start correctly, skipping further tests" )
546 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800547 main.case( "Discover all hosts using scapy" )
548 main.step( "Send packets from each host to the first host and confirm onos discovery" )
549
550 import collections
551 if len( main.scapyHosts ) < 1:
552 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700553 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800554 main.skipCase()
555
556 # Send ARP packets from each scapy host component
557 main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
558
559 stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
560 retValue=main.FALSE, args=[ main ],
561 attempts=main.checkTopoAttempts, sleep=2 )
562
563 utilities.assert_equals( expect=main.TRUE,
564 actual=stepResult,
565 onpass="ONOS correctly discovered all hosts",
566 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700567 if not stepResult:
568 main.initialized = main.FALSE
569 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800570
571 main.step( "Populate hostsData" )
572 stepResult = main.intentFunction.populateHostData( main )
573 utilities.assert_equals( expect=main.TRUE,
574 actual=stepResult,
575 onpass="Successfully populated hostsData",
576 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700577 if not stepResult:
578 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800579
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800580 def CASE16( self, main ):
581 """
Jeremy42df2e72016-02-23 16:37:46 -0800582 Balance Masters
583 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700584 if main.initialized == main.FALSE:
585 main.log.error( "Test components did not start correctly, skipping further tests" )
586 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800587 main.case( "Balance mastership of switches" )
588 main.step( "Balancing mastership of switches" )
589
590 balanceResult = main.FALSE
591 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
592
593 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700594 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800595 onpass="Successfully balanced mastership of switches",
596 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700597 if not balanceResult:
598 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800599
600 def CASE17( self, main ):
601 """
Jeremy6e9748f2016-03-25 15:03:39 -0700602 Use Flow Objectives
603 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700604 if main.initialized == main.FALSE:
605 main.log.error( "Test components did not start correctly, skipping further tests" )
606 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700607 main.case( "Enable intent compilation using Flow Objectives" )
608 main.step( "Enabling Flow Objectives" )
609
610 main.flowCompiler = "Flow Objectives"
611
612 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
613
614 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
615 propName="useFlowObjectives", value="true" )
616
617 utilities.assert_equals( expect=main.TRUE,
618 actual=stepResult,
619 onpass="Successfully activated Flow Objectives",
620 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700621 if not balanceResult:
622 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700623
624 def CASE18( self, main ):
625 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800626 Stop mininet and remove scapy host
627 """
628 main.log.report( "Stop Mininet and Scapy" )
629 main.case( "Stop Mininet and Scapy" )
630 main.caseExplanation = "Stopping the current mininet topology " +\
631 "to start up fresh"
632 main.step( "Stopping and Removing Scapy Host Components" )
633 scapyResult = main.TRUE
634 for host in main.scapyHosts:
635 scapyResult = scapyResult and host.stopScapy()
636 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
637
638 for host in main.scapyHosts:
639 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
640 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
641
642 main.scapyHosts = []
643 main.scapyHostIPs = []
644
645 utilities.assert_equals( expect=main.TRUE,
646 actual=scapyResult,
647 onpass="Successfully stopped scapy and removed host components",
648 onfail="Failed to stop mininet and scapy" )
649
650 main.step( "Stopping Mininet Topology" )
651 mininetResult = main.Mininet1.stopNet( )
652
653 utilities.assert_equals( expect=main.TRUE,
654 actual=mininetResult,
655 onpass="Successfully stopped mininet and scapy",
656 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700657 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800658 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700659 main.cleanup()
660 main.exit()
661
Jeremy Songster17147f22016-05-31 18:30:52 -0700662 def CASE19( self, main ):
663 """
664 Copy the karaf.log files after each testcase cycle
665 """
666 main.log.report( "Copy karaf logs" )
667 main.case( "Copy karaf logs" )
668 main.caseExplanation = "Copying the karaf logs to preserve them through" +\
669 "reinstalling ONOS"
670 main.step( "Copying karaf logs" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700671 stepResult = main.TRUE
672 scpResult = main.TRUE
673 copyResult = main.TRUE
Jeremy Songstercc5414b2016-07-11 10:59:53 -0700674 for i in range( main.numCtrls ):
675 main.node = main.CLIs[ i ]
Jeremy Songster17147f22016-05-31 18:30:52 -0700676 ip = main.ONOSip[ i ]
677 main.node.ip_address = ip
Jeremy Songster31aad312016-06-13 16:32:11 -0700678 scpResult = scpResult and main.ONOSbench.scp( main.node ,
679 "/opt/onos/log/karaf.log",
680 "/tmp/karaf.log",
681 direction="from" )
682 copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
683 copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
684 if scpResult and copyResult:
685 stepResult = main.TRUE and stepResult
686 else:
687 stepResult = main.FALSE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700688 utilities.assert_equals( expect=main.TRUE,
689 actual=stepResult,
690 onpass="Successfully copied remote ONOS logs",
691 onfail="Failed to copy remote ONOS logs" )
Jeremy Songster17147f22016-05-31 18:30:52 -0700692
kelvin-onlabb769f562015-07-15 17:05:10 -0700693 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700694 """
695 Add host intents between 2 host:
696 - Discover hosts
697 - Add host intents
698 - Check intents
699 - Verify flows
700 - Ping hosts
701 - Reroute
702 - Link down
703 - Verify flows
704 - Check topology
705 - Ping hosts
706 - Link up
707 - Verify flows
708 - Check topology
709 - Ping hosts
710 - Remove intents
711 """
712 import time
713 import json
714 import re
Jeremyd9e4eb12016-04-13 12:09:06 -0700715 if main.initialized == main.FALSE:
716 main.log.error( "Test components did not start correctly, skipping further tests" )
717 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700718 # Assert variables - These variable's name|format must be followed
719 # if you want to use the wrapper function
720 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700721 try:
722 assert main.CLIs
723 except AssertionError:
724 main.log.error( "There is no main.CLIs, skipping test cases" )
725 main.initialized = main.FALSE
726 main.skipCase()
727 try:
728 assert main.Mininet1
729 except AssertionError:
730 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
731 main.initialized = main.FALSE
732 main.skipCase()
733 try:
734 assert main.numSwitch
735 except AssertionError:
736 main.log.error( "Place the total number of switch topology in \
737 main.numSwitch" )
738 main.initialized = main.FALSE
739 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700740
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800741 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700742 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
743
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700744 main.testName = "Host Intents"
745 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700746 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700747 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700748 str( main.numCtrls ) + " node(s) cluster;\n" +\
749 "Different type of hosts will be tested in " +\
750 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700751 "etc;\nThe test will use OF " + main.OFProtocol +\
752 " OVS running in Mininet and compile intents" +\
Jeremy6e9748f2016-03-25 15:03:39 -0700753 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700754
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700755 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700756 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800757 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
758 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
759 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800760 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800761 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700762 name='IPV4',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800763 onosNode='0',
764 host1=host1,
765 host2=host2)
766 if installResult:
767 testResult = main.intentFunction.testHostIntent( main,
768 name='IPV4',
769 intentId = installResult,
770 onosNode='0',
771 host1=host1,
772 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700773 sw1='s5',
774 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800775 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800776 else:
777 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800778
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700779 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800780 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700781 onpass=main.assertReturnString,
782 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700783
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700784 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700785 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800786 host1 = { "name":"h3","id":"00:00:00:00:00:03/-1" }
787 host2 = { "name":"h11","id":"00:00:00:00:00:0B/-1 "}
788 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800789 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800790 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700791 name='DUALSTACK',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800792 onosNode='0',
793 host1=host1,
794 host2=host2)
795
796 if installResult:
797 testResult = main.intentFunction.testHostIntent( main,
798 name='DUALSTACK',
799 intentId = installResult,
800 onosNode='0',
801 host1=host1,
802 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700803 sw1='s5',
804 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800805 expectedLink = 18)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700806
807 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800808 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700809 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800810 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700811
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700812 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700813 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800814 host1 = { "name":"h1" }
815 host2 = { "name":"h11" }
816 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800817 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800818 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700819 name='DUALSTACK2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800820 onosNode='0',
821 host1=host1,
822 host2=host2)
823
824 if installResult:
825 testResult = main.intentFunction.testHostIntent( main,
826 name='DUALSTACK2',
827 intentId = installResult,
828 onosNode='0',
829 host1=host1,
830 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700831 sw1='s5',
832 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800833 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800834 else:
835 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700836
837 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800838 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700839 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800840 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700841
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700842 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700843 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800844 host1 = { "name":"h1" }
845 host2 = { "name":"h3" }
846 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800847 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800848 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700849 name='1HOP',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800850 onosNode='0',
851 host1=host1,
852 host2=host2)
853
854 if installResult:
855 testResult = main.intentFunction.testHostIntent( main,
856 name='1HOP',
857 intentId = installResult,
858 onosNode='0',
859 host1=host1,
860 host2=host2,
861 sw1='s5',
862 sw2='s2',
863 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800864 else:
865 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700866
867 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800868 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700869 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800870 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700871
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700872 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700873 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jeremy Songster832f9e92016-05-05 14:30:49 -0700874 host1 = { "name":"h4","id":"00:00:00:00:00:04/100", "vlan":"100" }
875 host2 = { "name":"h12","id":"00:00:00:00:00:0C/100", "vlan":"100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800876 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800877 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800878 installResult = main.intentFunction.installHostIntent( main,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700879 name='VLAN1',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800880 onosNode='0',
881 host1=host1,
882 host2=host2)
883
884 if installResult:
885 testResult = main.intentFunction.testHostIntent( main,
886 name='VLAN1',
887 intentId = installResult,
888 onosNode='0',
889 host1=host1,
890 host2=host2,
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700891 sw1='s5',
892 sw2='s2',
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800893 expectedLink = 18)
Jeremy42df2e72016-02-23 16:37:46 -0800894 else:
895 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700896
897 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800898 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700899 onpass=main.assertReturnString,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800900 onfail=main.assertReturnString)
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700901
Jeremy Songsterff553672016-05-12 17:06:23 -0700902 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
903 main.assertReturnString = "Assertion Result vlan IPV4\n"
904 host1 = { "name":"h5", "vlan":"200" }
905 host2 = { "name":"h12", "vlan":"100" }
906 testResult = main.FALSE
907 installResult = main.FALSE
908 installResult = main.intentFunction.installHostIntent( main,
909 name='VLAN2',
910 onosNode='0',
911 host1=host1,
912 host2=host2)
913
914 if installResult:
915 testResult = main.intentFunction.testHostIntent( main,
916 name='VLAN2',
917 intentId = installResult,
918 onosNode='0',
919 host1=host1,
920 host2=host2,
921 sw1='s5',
922 sw2='s2',
923 expectedLink = 18)
924 else:
925 main.CLIs[ 0 ].removeAllIntents( purge=True )
926
927 utilities.assert_equals( expect=main.TRUE,
928 actual=testResult,
929 onpass=main.assertReturnString,
930 onfail=main.assertReturnString)
931
Jeremy Songsterc032f162016-08-04 17:14:49 -0700932 main.step( "Encapsulation: Add host intents between h1 and h9" )
933 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
934 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
935 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
936 testResult = main.FALSE
937 installResult = main.FALSE
938 installResult = main.intentFunction.installHostIntent( main,
939 name='ENCAPSULATION',
940 onosNode='0',
941 host1=host1,
942 host2=host2,
943 encap="VLAN" )
944 if installResult:
945 testResult = main.intentFunction.testHostIntent( main,
946 name='ENCAPSULATION',
947 intentId = installResult,
948 onosNode='0',
949 host1=host1,
950 host2=host2,
951 sw1='s5',
952 sw2='s2',
953 expectedLink = 18)
954 else:
955 main.CLIs[ 0 ].removeAllIntents( purge=True )
956
957 utilities.assert_equals( expect=main.TRUE,
958 actual=testResult,
959 onpass=main.assertReturnString,
960 onfail=main.assertReturnString)
961
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800962 main.step( "Confirm that ONOS leadership is unchanged")
acsmarse6b410f2015-07-17 14:39:34 -0700963 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
964 main.intentFunction.checkLeaderChange( intentLeadersOld,
965 intentLeadersNew )
966
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800967 utilities.assert_equals( expect=main.TRUE,
968 actual=testResult,
969 onpass="ONOS Leaders Unchanged",
970 onfail="ONOS Leader Mismatch")
971
kelvin-onlab016dce22015-08-10 09:54:11 -0700972 main.intentFunction.report( main )
973
kelvin-onlabb769f562015-07-15 17:05:10 -0700974 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700975 """
976 Add point intents between 2 hosts:
977 - Get device ids | ports
978 - Add point intents
979 - Check intents
980 - Verify flows
981 - Ping hosts
982 - Reroute
983 - Link down
984 - Verify flows
985 - Check topology
986 - Ping hosts
987 - Link up
988 - Verify flows
989 - Check topology
990 - Ping hosts
991 - Remove intents
992 """
993 import time
994 import json
995 import re
Jeremyd9e4eb12016-04-13 12:09:06 -0700996 if main.initialized == main.FALSE:
997 main.log.error( "Test components did not start correctly, skipping further tests" )
998 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700999 # Assert variables - These variable's name|format must be followed
1000 # if you want to use the wrapper function
1001 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001002 try:
1003 assert main.CLIs
1004 except AssertionError:
1005 main.log.error( "There is no main.CLIs, skipping test cases" )
1006 main.initialized = main.FALSE
1007 main.skipCase()
1008 try:
1009 assert main.Mininet1
1010 except AssertionError:
1011 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1012 main.initialized = main.FALSE
1013 main.skipCase()
1014 try:
1015 assert main.numSwitch
1016 except AssertionError:
1017 main.log.error( "Place the total number of switch topology in \
1018 main.numSwitch" )
1019 main.initialized = main.FALSE
1020 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001021
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001022 main.testName = "Point Intents"
1023 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001024 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001025 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001026 " intents using " + str( main.numCtrls ) +\
1027 " node(s) cluster;\n" +\
1028 "Different type of hosts will be tested in " +\
1029 "each step such as IPV4, Dual stack, VLAN etc" +\
1030 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001031 " OVS running in Mininet and compile intents" +\
1032 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001033
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001034 # No option point intents
1035 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001036 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001037 senders = [
1038 { "name":"h1","device":"of:0000000000000005/1" }
1039 ]
1040 recipients = [
1041 { "name":"h9","device":"of:0000000000000006/1" }
1042 ]
Jeremy42df2e72016-02-23 16:37:46 -08001043 testResult = main.FALSE
1044 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001045 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001046 main,
1047 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001048 senders=senders,
1049 recipients=recipients )
1050
1051 if installResult:
1052 testResult = main.intentFunction.testPointIntent(
1053 main,
1054 intentId=installResult,
1055 name="NOOPTION",
1056 senders=senders,
1057 recipients=recipients,
1058 sw1="s5",
1059 sw2="s2",
1060 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001061 else:
1062 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001063
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001064 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001065 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001066 onpass=main.assertReturnString,
1067 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001068
1069 stepResult = main.TRUE
kelvin-onlabb769f562015-07-15 17:05:10 -07001070 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001071 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001072 senders = [
1073 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1074 ]
1075 recipients = [
1076 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09" }
1077 ]
Jeremy42df2e72016-02-23 16:37:46 -08001078 testResult = main.FALSE
1079 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001080 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001081 main,
1082 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001083 senders=senders,
1084 recipients=recipients,
1085 ethType="IPV4" )
1086
1087 if installResult:
1088 testResult = main.intentFunction.testPointIntent(
1089 main,
1090 intentId=installResult,
1091 name="IPV4",
1092 senders=senders,
1093 recipients=recipients,
1094 sw1="s5",
1095 sw2="s2",
1096 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001097 else:
1098 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001099
1100 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001101 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001102 onpass=main.assertReturnString,
1103 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001104 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001105 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001106 senders = [
1107 { "name":"h1","device":"of:0000000000000005/1" }
1108 ]
1109 recipients = [
1110 { "name":"h9","device":"of:0000000000000006/1" }
1111 ]
Jeremy42df2e72016-02-23 16:37:46 -08001112 testResult = main.FALSE
1113 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001114 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001115 main,
1116 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001117 senders=senders,
1118 recipients=recipients,
1119 ethType="IPV4" )
1120
1121 if installResult:
1122 testResult = main.intentFunction.testPointIntent(
1123 main,
1124 intentId=installResult,
1125 name="IPV4_2",
1126 senders=senders,
1127 recipients=recipients,
1128 sw1="s5",
1129 sw2="s2",
1130 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001131 else:
1132 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001133
1134 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001135 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001136 onpass=main.assertReturnString,
1137 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001138
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001139 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001140 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001141 senders = [
1142 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001143 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001144 ]
1145 recipients = [
1146 { "name":"h9","device":"of:0000000000000006/1","mac":"00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001147 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001148 ]
Jeremy6f000c62016-02-25 17:02:28 -08001149 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001150 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001151 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1152 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001153 testResult = main.FALSE
1154 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001155 installResult = main.intentFunction.installPointIntent(
1156 main,
1157 name="SDNIP-ICMP",
1158 senders=senders,
1159 recipients=recipients,
1160 ethType="IPV4",
1161 ipProto=ipProto,
1162 tcpSrc=tcpSrc,
1163 tcpDst=tcpDst )
1164
1165 if installResult:
1166 testResult = main.intentFunction.testPointIntent(
1167 main,
1168 intentId=installResult,
1169 name="SDNIP_ICMP",
1170 senders=senders,
1171 recipients=recipients,
1172 sw1="s5",
1173 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001174 expectedLink=18,
1175 useTCP=True)
Jeremy42df2e72016-02-23 16:37:46 -08001176 else:
1177 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001178
1179 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001180 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001181 onpass=main.assertReturnString,
1182 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001183
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001184 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001185 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001186 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1187 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001188 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1189 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001190 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1191 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1192 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1193
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001194 stepResult = main.intentFunction.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001195 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001196 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001197 host1="h1",
1198 host2="h9",
1199 deviceId1="of:0000000000000005/1",
1200 deviceId2="of:0000000000000006/1",
1201 mac1=mac1,
1202 mac2=mac2,
1203 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001204 ipProto=ipProto,
1205 ip1=ip1,
1206 ip2=ip2,
1207 tcp1=tcp1,
1208 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001209
1210 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001211 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001212 onpass=main.assertReturnString,
1213 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001214
acsmars5d8cc862015-09-25 09:44:50 -07001215 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1216 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001217 senders = [
1218 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1219 ]
1220 recipients = [
1221 { "name":"h11","device":"of:0000000000000006/3","mac":"00:00:00:00:00:0B" }
1222 ]
Jeremy42df2e72016-02-23 16:37:46 -08001223 testResult = main.FALSE
1224 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001225 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001226 main,
1227 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001228 senders=senders,
1229 recipients=recipients,
1230 ethType="IPV4" )
1231
1232 if installResult:
1233 testResult = main.intentFunction.testPointIntent(
1234 main,
1235 intentId=installResult,
1236 name="DUALSTACK1",
1237 senders=senders,
1238 recipients=recipients,
1239 sw1="s5",
1240 sw2="s2",
1241 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001242 else:
1243 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001244
1245 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001246 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001247 onpass=main.assertReturnString,
1248 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001249
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001250 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001251 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001252 senders = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001253 { "name":"h5","device":"of:0000000000000005/5","mac":"00:00:00:00:00:05", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001254 ]
1255 recipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001256 { "name":"h21","device":"of:0000000000000007/5","mac":"00:00:00:00:00:15", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001257 ]
Jeremy42df2e72016-02-23 16:37:46 -08001258 testResult = main.FALSE
1259 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001260 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001261 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001262 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001263 senders=senders,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001264 recipients=recipients)
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001265
1266 if installResult:
1267 testResult = main.intentFunction.testPointIntent(
1268 main,
1269 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001270 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001271 senders=senders,
1272 recipients=recipients,
1273 sw1="s5",
1274 sw2="s2",
1275 expectedLink=18)
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001276
1277 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001278 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001279 onpass=main.assertReturnString,
1280 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001281
Jeremy Songsterff553672016-05-12 17:06:23 -07001282 main.step( "VLAN: Add point intents between h5 and h21" )
1283 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1284 senders = [
1285 { "name":"h4", "vlan":"100" }
1286 ]
1287 recipients = [
1288 { "name":"h21", "vlan":"200" }
1289 ]
1290 testResult = main.FALSE
1291 installResult = main.FALSE
1292 installResult = main.intentFunction.installPointIntent(
1293 main,
1294 name="VLAN2",
1295 senders=senders,
1296 recipients=recipients,
1297 setVlan=200)
1298
1299 if installResult:
1300 testResult = main.intentFunction.testPointIntent(
1301 main,
1302 intentId=installResult,
1303 name="VLAN2",
1304 senders=senders,
1305 recipients=recipients,
1306 sw1="s5",
1307 sw2="s2",
1308 expectedLink=18)
1309
1310 utilities.assert_equals( expect=main.TRUE,
1311 actual=testResult,
1312 onpass=main.assertReturnString,
1313 onfail=main.assertReturnString )
1314
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001315 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001316 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001317 senders = [
1318 { "name":"h1","device":"of:0000000000000005/1","mac":"00:00:00:00:00:01" }
1319 ]
1320 recipients = [
1321 { "name":"h3","device":"of:0000000000000005/3","mac":"00:00:00:00:00:03" }
1322 ]
Jeremy42df2e72016-02-23 16:37:46 -08001323 testResult = main.FALSE
1324 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001325 installResult = main.intentFunction.installPointIntent(
1326 main,
1327 name="1HOP IPV4",
1328 senders=senders,
1329 recipients=recipients,
1330 ethType="IPV4" )
1331
1332 if installResult:
1333 testResult = main.intentFunction.testPointIntent(
1334 main,
1335 intentId=installResult,
1336 name="1HOP IPV4",
1337 senders=senders,
1338 recipients=recipients,
1339 sw1="s5",
1340 sw2="s2",
1341 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001342 else:
1343 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001344
1345 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001346 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001347 onpass=main.assertReturnString,
1348 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001349
Jeremy Songsterc032f162016-08-04 17:14:49 -07001350 main.step( "Add point to point intents using VLAN Encapsulation" )
1351 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1352 senders = [
1353 { "name":"h1","device":"of:0000000000000005/1" }
1354 ]
1355 recipients = [
1356 { "name":"h9","device":"of:0000000000000006/1" }
1357 ]
1358 testResult = main.FALSE
1359 installResult = main.FALSE
1360 installResult = main.intentFunction.installPointIntent(
1361 main,
1362 name="ENCAPSULATION",
1363 senders=senders,
1364 recipients=recipients,
1365 encap="VLAN" )
1366
1367 if installResult:
1368 testResult = main.intentFunction.testPointIntent(
1369 main,
1370 intentId=installResult,
1371 name="ENCAPSULATION",
1372 senders=senders,
1373 recipients=recipients,
1374 sw1="s5",
1375 sw2="s2",
1376 expectedLink=18)
1377 else:
1378 main.CLIs[ 0 ].removeAllIntents( purge=True )
1379
1380 utilities.assert_equals( expect=main.TRUE,
1381 actual=testResult,
1382 onpass=main.assertReturnString,
1383 onfail=main.assertReturnString )
1384
kelvin-onlab016dce22015-08-10 09:54:11 -07001385 main.intentFunction.report( main )
1386
kelvin-onlabb769f562015-07-15 17:05:10 -07001387 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001388 """
1389 Add single point to multi point intents
1390 - Get device ids
1391 - Add single point to multi point intents
1392 - Check intents
1393 - Verify flows
1394 - Ping hosts
1395 - Reroute
1396 - Link down
1397 - Verify flows
1398 - Check topology
1399 - Ping hosts
1400 - Link up
1401 - Verify flows
1402 - Check topology
1403 - Ping hosts
1404 - Remove intents
1405 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001406 if main.initialized == main.FALSE:
1407 main.log.error( "Test components did not start correctly, skipping further tests" )
1408 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001409 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001410 try:
1411 assert main.CLIs
1412 except AssertionError:
1413 main.log.error( "There is no main.CLIs, skipping test cases" )
1414 main.initialized = main.FALSE
1415 main.skipCase()
1416 try:
1417 assert main.Mininet1
1418 except AssertionError:
1419 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1420 main.initialized = main.FALSE
1421 main.skipCase()
1422 try:
1423 assert main.numSwitch
1424 except AssertionError:
1425 main.log.error( "Place the total number of switch topology in \
1426 main.numSwitch" )
1427 main.initialized = main.FALSE
1428 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001429
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001430 main.testName = "Single to Multi Point Intents"
1431 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001432 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001433 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001434 " multi point intents using " +\
1435 str( main.numCtrls ) + " node(s) cluster;\n" +\
1436 "Different type of hosts will be tested in " +\
1437 "each step such as IPV4, Dual stack, VLAN etc" +\
1438 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001439 " OVS running in Mininet and compile intents" +\
1440 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001441
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001442 main.step( "NOOPTION: Install and test single point to multi point intents" )
1443 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1444 senders = [
1445 { "name":"h8", "device":"of:0000000000000005/8" }
1446 ]
1447 recipients = [
1448 { "name":"h16", "device":"of:0000000000000006/8" },
1449 { "name":"h24", "device":"of:0000000000000007/8" }
1450 ]
1451 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1452 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1453 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001454 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001455 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001456 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001457 name="NOOPTION",
1458 senders=senders,
1459 recipients=recipients,
1460 sw1="s5",
1461 sw2="s2")
1462
1463 if installResult:
1464 testResult = main.intentFunction.testPointIntent(
1465 main,
1466 intentId=installResult,
1467 name="NOOPTION",
1468 senders=senders,
1469 recipients=recipients,
1470 badSenders=badSenders,
1471 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001472 sw1="s5",
1473 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001474 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001475 else:
1476 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001477
1478 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001479 actual=testResult,
1480 onpass=main.assertReturnString,
1481 onfail=main.assertReturnString )
1482
1483 main.step( "IPV4: Install and test single point to multi point intents" )
1484 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1485 senders = [
1486 { "name":"h8", "device":"of:0000000000000005/8","mac":"00:00:00:00:00:08" }
1487 ]
1488 recipients = [
1489 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1490 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1491 ]
1492 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1493 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1494 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001495 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001496 installResult = main.intentFunction.installSingleToMultiIntent(
1497 main,
1498 name="IPV4",
1499 senders=senders,
1500 recipients=recipients,
1501 ethType="IPV4",
1502 sw1="s5",
1503 sw2="s2")
1504
1505 if installResult:
1506 testResult = main.intentFunction.testPointIntent(
1507 main,
1508 intentId=installResult,
1509 name="IPV4",
1510 senders=senders,
1511 recipients=recipients,
1512 badSenders=badSenders,
1513 badRecipients=badRecipients,
1514 sw1="s5",
1515 sw2="s2",
1516 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001517 else:
1518 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001519
1520 utilities.assert_equals( expect=main.TRUE,
1521 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001522 onpass=main.assertReturnString,
1523 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001524
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001525 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001526 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 -08001527 senders = [
1528 { "name":"h8", "device":"of:0000000000000005/8" }
1529 ]
1530 recipients = [
1531 { "name":"h16", "device":"of:0000000000000006/8" },
1532 { "name":"h24", "device":"of:0000000000000007/8" }
1533 ]
1534 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1535 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1536 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001537 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001538 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001539 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001540 name="IPV4_2",
1541 senders=senders,
1542 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001543 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001544 sw1="s5",
1545 sw2="s2")
1546
1547 if installResult:
1548 testResult = main.intentFunction.testPointIntent(
1549 main,
1550 intentId=installResult,
1551 name="IPV4_2",
1552 senders=senders,
1553 recipients=recipients,
1554 badSenders=badSenders,
1555 badRecipients=badRecipients,
1556 sw1="s5",
1557 sw2="s2",
1558 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001559 else:
1560 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001561
1562 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001563 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001564 onpass=main.assertReturnString,
1565 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001566
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001567 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001568 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 -08001569 senders = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001570 { "name":"h4", "device":"of:0000000000000005/4", "mac":"00:00:00:00:00:04", "vlan":"100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001571 ]
1572 recipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001573 { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" },
1574 { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14", "vlan":"100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001575 ]
1576 badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
1577 badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
1578 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001579 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001580 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001581 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001582 name="VLAN`",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001583 senders=senders,
1584 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001585 sw1="s5",
1586 sw2="s2")
1587
1588 if installResult:
1589 testResult = main.intentFunction.testPointIntent(
1590 main,
1591 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001592 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001593 senders=senders,
1594 recipients=recipients,
1595 badSenders=badSenders,
1596 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001597 sw1="s5",
1598 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001599 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001600 else:
1601 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001602
1603 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001604 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001605 onpass=main.assertReturnString,
1606 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001607
Jeremy Songsterff553672016-05-12 17:06:23 -07001608 main.step( "VLAN: Add single point to multi point intents" )
1609 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1610 senders = [
1611 { "name":"h5", "vlan":"200" }
1612 ]
1613 recipients = [
1614 { "name":"h12", "device":"of:0000000000000006/4", "mac":"00:00:00:00:00:0C", "vlan":"100" },
1615 { "name":"h20", "device":"of:0000000000000007/4", "mac":"00:00:00:00:00:14", "vlan":"100" }
1616 ]
1617 badSenders=[ { "name":"h13" } ] # Senders that are not in the intent
1618 badRecipients=[ { "name":"h21" } ] # Recipients that are not in the intent
1619 testResult = main.FALSE
1620 installResult = main.FALSE
1621 installResult = main.intentFunction.installSingleToMultiIntent(
1622 main,
1623 name="VLAN2",
1624 senders=senders,
1625 recipients=recipients,
1626 sw1="s5",
1627 sw2="s2",
1628 setVlan=100)
1629
1630 if installResult:
1631 testResult = main.intentFunction.testPointIntent(
1632 main,
1633 intentId=installResult,
1634 name="VLAN2",
1635 senders=senders,
1636 recipients=recipients,
1637 badSenders=badSenders,
1638 badRecipients=badRecipients,
1639 sw1="s5",
1640 sw2="s2",
1641 expectedLink=18)
1642 else:
1643 main.CLIs[ 0 ].removeAllIntents( purge=True )
1644
1645 utilities.assert_equals( expect=main.TRUE,
1646 actual=testResult,
1647 onpass=main.assertReturnString,
1648 onfail=main.assertReturnString )
1649
Jeremy Songsterc032f162016-08-04 17:14:49 -07001650 main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1651 main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1652 senders = [
1653 { "name":"h8", "device":"of:0000000000000005/8" }
1654 ]
1655 recipients = [
1656 { "name":"h16", "device":"of:0000000000000006/8" },
1657 { "name":"h24", "device":"of:0000000000000007/8" }
1658 ]
1659 badSenders=[ { "name":"h9" } ] # Senders that are not in the intent
1660 badRecipients=[ { "name":"h17" } ] # Recipients that are not in the intent
1661 testResult = main.FALSE
1662 installResult = main.FALSE
1663 installResult = main.intentFunction.installSingleToMultiIntent(
1664 main,
1665 name="ENCAPSULATION",
1666 senders=senders,
1667 recipients=recipients,
1668 sw1="s5",
1669 sw2="s2",
1670 encap="VLAN" )
1671
1672 if installResult:
1673 testResult = main.intentFunction.testPointIntent(
1674 main,
1675 intentId=installResult,
1676 name="ENCAPSULATION",
1677 senders=senders,
1678 recipients=recipients,
1679 badSenders=badSenders,
1680 badRecipients=badRecipients,
1681 sw1="s5",
1682 sw2="s2",
1683 expectedLink=18)
1684 else:
1685 main.CLIs[ 0 ].removeAllIntents( purge=True )
1686
1687 utilities.assert_equals( expect=main.TRUE,
1688 actual=testResult,
1689 onpass=main.assertReturnString,
1690 onfail=main.assertReturnString )
1691
kelvin-onlab016dce22015-08-10 09:54:11 -07001692 main.intentFunction.report( main )
1693
kelvin-onlabb769f562015-07-15 17:05:10 -07001694 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001695 """
1696 Add multi point to single point intents
1697 - Get device ids
1698 - Add multi point to single point intents
1699 - Check intents
1700 - Verify flows
1701 - Ping hosts
1702 - Reroute
1703 - Link down
1704 - Verify flows
1705 - Check topology
1706 - Ping hosts
1707 - Link up
1708 - Verify flows
1709 - Check topology
1710 - Ping hosts
1711 - Remove intents
1712 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001713 if main.initialized == main.FALSE:
1714 main.log.error( "Test components did not start correctly, skipping further tests" )
1715 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001716 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001717 try:
1718 assert main.CLIs
1719 except AssertionError:
1720 main.log.error( "There is no main.CLIs, skipping test cases" )
1721 main.initialized = main.FALSE
1722 main.skipCase()
1723 try:
1724 assert main.Mininet1
1725 except AssertionError:
1726 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1727 main.initialized = main.FALSE
1728 main.skipCase()
1729 try:
1730 assert main.numSwitch
1731 except AssertionError:
1732 main.log.error( "Place the total number of switch topology in \
1733 main.numSwitch" )
1734 main.initialized = main.FALSE
1735 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001736
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001737 main.testName = "Multi To Single Point Intents"
1738 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001739 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001740 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001741 " multi point intents using " +\
1742 str( main.numCtrls ) + " node(s) cluster;\n" +\
1743 "Different type of hosts will be tested in " +\
1744 "each step such as IPV4, Dual stack, VLAN etc" +\
1745 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001746 " OVS running in Mininet and compile intents" +\
1747 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001748
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001749 main.step( "NOOPTION: Add multi point to single point intents" )
1750 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1751 senders = [
1752 { "name":"h16", "device":"of:0000000000000006/8" },
1753 { "name":"h24", "device":"of:0000000000000007/8" }
1754 ]
1755 recipients = [
1756 { "name":"h8", "device":"of:0000000000000005/8" }
1757 ]
1758 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1759 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1760 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001761 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001762 installResult = main.intentFunction.installMultiToSingleIntent(
1763 main,
1764 name="NOOPTION",
1765 senders=senders,
1766 recipients=recipients,
1767 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001768 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001769
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001770 if installResult:
1771 testResult = main.intentFunction.testPointIntent(
1772 main,
1773 intentId=installResult,
1774 name="NOOPTION",
1775 senders=senders,
1776 recipients=recipients,
1777 badSenders=badSenders,
1778 badRecipients=badRecipients,
1779 sw1="s5",
1780 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001781 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001782 else:
1783 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001784
1785 utilities.assert_equals( expect=main.TRUE,
1786 actual=testResult,
1787 onpass=main.assertReturnString,
1788 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001789
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001790 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001791 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 -08001792 senders = [
1793 { "name":"h16", "device":"of:0000000000000006/8", "mac":"00:00:00:00:00:10" },
1794 { "name":"h24", "device":"of:0000000000000007/8", "mac":"00:00:00:00:00:18" }
1795 ]
1796 recipients = [
1797 { "name":"h8", "device":"of:0000000000000005/8", "mac":"00:00:00:00:00:08" }
1798 ]
1799 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1800 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1801 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001802 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001803 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001804 main,
1805 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001806 senders=senders,
1807 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001808 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001809 sw1="s5",
1810 sw2="s2")
1811
1812 if installResult:
1813 testResult = main.intentFunction.testPointIntent(
1814 main,
1815 intentId=installResult,
1816 name="IPV4",
1817 senders=senders,
1818 recipients=recipients,
1819 badSenders=badSenders,
1820 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001821 sw1="s5",
1822 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001823 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001824 else:
1825 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001826
1827 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001828 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001829 onpass=main.assertReturnString,
1830 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001831
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001832 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001833 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 -08001834 senders = [
1835 { "name":"h16", "device":"of:0000000000000006/8" },
1836 { "name":"h24", "device":"of:0000000000000007/8" }
1837 ]
1838 recipients = [
1839 { "name":"h8", "device":"of:0000000000000005/8" }
1840 ]
1841 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1842 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1843 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001844 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001845 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001846 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001847 name="IPV4_2",
1848 senders=senders,
1849 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001850 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001851 sw1="s5",
1852 sw2="s2")
1853
1854 if installResult:
1855 testResult = main.intentFunction.testPointIntent(
1856 main,
1857 intentId=installResult,
1858 name="IPV4_2",
1859 senders=senders,
1860 recipients=recipients,
1861 badSenders=badSenders,
1862 badRecipients=badRecipients,
1863 sw1="s5",
1864 sw2="s2",
1865 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001866 else:
1867 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001868
1869 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001870 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001871 onpass=main.assertReturnString,
1872 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001873
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001874 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001875 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 -08001876 senders = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001877 { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" },
1878 { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001879 ]
1880 recipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07001881 { "name":"h5", "device":"of:0000000000000005/5", "vlan":"200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001882 ]
1883 badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
1884 badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
1885 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08001886 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001887 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001888 main,
1889 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001890 senders=senders,
1891 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001892 sw1="s5",
1893 sw2="s2")
1894
1895 if installResult:
1896 testResult = main.intentFunction.testPointIntent(
1897 main,
1898 intentId=installResult,
1899 name="VLAN",
1900 senders=senders,
1901 recipients=recipients,
1902 badSenders=badSenders,
1903 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001904 sw1="s5",
1905 sw2="s2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001906 expectedLink=18)
Jeremy42df2e72016-02-23 16:37:46 -08001907 else:
1908 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001909
1910 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001911 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001912 onpass=main.assertReturnString,
1913 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07001914
Jeremy Songsterff553672016-05-12 17:06:23 -07001915 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
1916 main.step( "VLAN: Add multi point to single point intents" )
1917 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
1918 senders = [
1919 { "name":"h13", "device":"of:0000000000000006/5", "vlan":"200" },
1920 { "name":"h21", "device":"of:0000000000000007/5", "vlan":"200" }
1921 ]
1922 recipients = [
1923 { "name":"h4", "vlan":"100" }
1924 ]
1925 badSenders=[ { "name":"h12" } ] # Senders that are not in the intent
1926 badRecipients=[ { "name":"h20" } ] # Recipients that are not in the intent
1927 testResult = main.FALSE
1928 installResult = main.FALSE
1929 installResult = main.intentFunction.installMultiToSingleIntent(
1930 main,
1931 name="VLAN2",
1932 senders=senders,
1933 recipients=recipients,
1934 sw1="s5",
1935 sw2="s2",
1936 setVlan=100)
1937
1938 if installResult:
1939 testResult = main.intentFunction.testPointIntent(
1940 main,
1941 intentId=installResult,
1942 name="VLAN2",
1943 senders=senders,
1944 recipients=recipients,
1945 badSenders=badSenders,
1946 badRecipients=badRecipients,
1947 sw1="s5",
1948 sw2="s2",
1949 expectedLink=18)
1950 else:
1951 main.CLIs[ 0 ].removeAllIntents( purge=True )
1952
1953 utilities.assert_equals( expect=main.TRUE,
1954 actual=testResult,
1955 onpass=main.assertReturnString,
1956 onfail=main.assertReturnString )
1957
Jeremy Songsterc032f162016-08-04 17:14:49 -07001958 main.step( "ENCAPSULATION: Add multi point to single point intents" )
1959 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
1960 senders = [
1961 { "name":"h16", "device":"of:0000000000000006/8" },
1962 { "name":"h24", "device":"of:0000000000000007/8" }
1963 ]
1964 recipients = [
1965 { "name":"h8", "device":"of:0000000000000005/8" }
1966 ]
1967 badSenders=[ { "name":"h17" } ] # Senders that are not in the intent
1968 badRecipients=[ { "name":"h9" } ] # Recipients that are not in the intent
1969 testResult = main.FALSE
1970 installResult = main.FALSE
1971 installResult = main.intentFunction.installMultiToSingleIntent(
1972 main,
1973 name="ENCAPSULATION",
1974 senders=senders,
1975 recipients=recipients,
1976 sw1="s5",
1977 sw2="s2",
1978 encap="VLAN" )
1979
1980 if installResult:
1981 testResult = main.intentFunction.testPointIntent(
1982 main,
1983 intentId=installResult,
1984 name="ENCAPSULATION",
1985 senders=senders,
1986 recipients=recipients,
1987 badSenders=badSenders,
1988 badRecipients=badRecipients,
1989 sw1="s5",
1990 sw2="s2",
1991 expectedLink=18 )
1992 else:
1993 main.CLIs[ 0 ].removeAllIntents( purge=True )
1994
1995 utilities.assert_equals( expect=main.TRUE,
1996 actual=testResult,
1997 onpass=main.assertReturnString,
1998 onfail=main.assertReturnString )
1999
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002000 main.intentFunction.report( main )
2001
acsmars1ff5e052015-07-23 11:27:48 -07002002 def CASE5000( self, main ):
2003 """
acsmars5d8cc862015-09-25 09:44:50 -07002004 Tests Host Mobility
2005 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002006 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002007 if main.initialized == main.FALSE:
2008 main.log.error( "Test components did not start correctly, skipping further tests" )
2009 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002010 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002011 try:
2012 assert main.CLIs
2013 except AssertionError:
2014 main.log.error( "There is no main.CLIs, skipping test cases" )
2015 main.initialized = main.FALSE
2016 main.skipCase()
2017 try:
2018 assert main.Mininet1
2019 except AssertionError:
2020 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2021 main.initialized = main.FALSE
2022 main.skipCase()
2023 try:
2024 assert main.numSwitch
2025 except AssertionError:
2026 main.log.error( "Place the total number of switch topology in \
2027 main.numSwitch" )
2028 main.initialized = main.FALSE
2029 main.skipCase()
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002030 main.case( "Test host mobility with host intents " )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002031 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002032 h1PreMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2033
Jeremy2f190ca2016-01-29 15:23:57 -08002034 main.log.info( "Moving h1 from s5 to s6")
acsmars1ff5e052015-07-23 11:27:48 -07002035 main.Mininet1.moveHost( "h1","s5","s6" )
2036
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002037 # Send discovery ping from moved host
2038 # Moving the host brings down the default interfaces and creates a new one.
2039 # Scapy is restarted on this host to detect the new interface
2040 main.h1.stopScapy()
2041 main.h1.startScapy()
2042
2043 # Discover new host location in ONOS and populate host data.
2044 # Host 1 IP and MAC should be unchanged
2045 main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
2046 main.intentFunction.populateHostData( main )
2047
acsmars1ff5e052015-07-23 11:27:48 -07002048 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2049
2050 utilities.assert_equals( expect="of:0000000000000006",
2051 actual=h1PostMove,
2052 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002053 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002054 " to single point intents" +
2055 " with IPV4 type and MAC addresses" +
2056 " in the same VLAN" )
2057
2058 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002059 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002060 host1 = { "name":"h1","id":"00:00:00:00:00:01/-1" }
2061 host2 = { "name":"h9","id":"00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002062 testResult = main.FALSE
2063 installResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002064 installResult = main.intentFunction.installHostIntent( main,
2065 name='IPV4 Mobility IPV4',
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002066 onosNode='0',
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002067 host1=host1,
Jeremye0cb5eb2016-01-27 17:39:09 -08002068 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002069 if installResult:
2070 testResult = main.intentFunction.testHostIntent( main,
2071 name='Host Mobility IPV4',
2072 intentId = installResult,
2073 onosNode='0',
2074 host1=host1,
2075 host2=host2,
2076 sw1="s6",
2077 sw2="s2",
2078 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002079 else:
2080 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002081
2082 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002083 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002084 onpass=main.assertReturnString,
2085 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002086
2087 main.intentFunction.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002088
2089 def CASE6000( self, main ):
2090 """
2091 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2092 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002093 # At some later point discussion on this behavior in MPSP and SPMP intents
2094 # will be reoppened and this test case may need to be updated to reflect
2095 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002096 if main.initialized == main.FALSE:
2097 main.log.error( "Test components did not start correctly, skipping further tests" )
2098 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002099 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002100 try:
2101 assert main.CLIs
2102 except AssertionError:
2103 main.log.error( "There is no main.CLIs, skipping test cases" )
2104 main.initialized = main.FALSE
2105 main.skipCase()
2106 try:
2107 assert main.Mininet1
2108 except AssertionError:
2109 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2110 main.initialized = main.FALSE
2111 main.skipCase()
2112 try:
2113 assert main.numSwitch
2114 except AssertionError:
2115 main.log.error( "Place the total number of switch topology in \
2116 main.numSwitch" )
2117 main.initialized = main.FALSE
2118 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002119 main.case( "Test Multi to Single End Point Failure" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002120 main.step( "Installing Multi to Single Point intents with no options set" )
2121 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2122 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002123 senders = [
2124 { "name":"h16", "device":"of:0000000000000006/8" },
2125 { "name":"h24", "device":"of:0000000000000007/8" }
2126 ]
2127 recipients = [
2128 { "name":"h8", "device":"of:0000000000000005/8" }
2129 ]
2130 isolatedSenders = [
2131 { "name":"h24"}
2132 ]
2133 isolatedRecipients = []
2134 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08002135 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08002136 installResult = main.intentFunction.installMultiToSingleIntent(
2137 main,
2138 name="NOOPTION",
2139 senders=senders,
2140 recipients=recipients,
2141 sw1="s5",
2142 sw2="s2" )
2143
2144 if installResult:
2145 testResult = main.intentFunction.testEndPointFail(
2146 main,
2147 intentId=installResult,
2148 name="NOOPTION",
2149 senders=senders,
2150 recipients=recipients,
2151 isolatedSenders=isolatedSenders,
2152 isolatedRecipients=isolatedRecipients,
2153 sw1="s6",
2154 sw2="s2",
2155 sw3="s4",
2156 sw4="s1",
2157 sw5="s3",
2158 expectedLink1=16,
2159 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002160 else:
2161 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002162
2163 utilities.assert_equals( expect=main.TRUE,
2164 actual=testResult,
2165 onpass=main.assertReturnString,
2166 onfail=main.assertReturnString )
2167
Jeremy Songster9385d412016-06-02 17:57:36 -07002168 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2169
2170 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2171 "with partial failures allowed\n"
2172 senders = [
2173 { "name":"h16", "device":"of:0000000000000006/8" },
2174 { "name":"h24", "device":"of:0000000000000007/8" }
2175 ]
2176 recipients = [
2177 { "name":"h8", "device":"of:0000000000000005/8" }
2178 ]
2179 isolatedSenders = [
2180 { "name":"h24"}
2181 ]
2182 isolatedRecipients = []
2183 testResult = main.FALSE
2184 installResult = main.FALSE
2185 installResult = main.intentFunction.installMultiToSingleIntent(
2186 main,
2187 name="NOOPTION",
2188 senders=senders,
2189 recipients=recipients,
2190 sw1="s5",
2191 sw2="s2",
2192 partial=True )
2193
2194 if installResult:
2195 testResult = main.intentFunction.testEndPointFail(
2196 main,
2197 intentId=installResult,
2198 name="NOOPTION",
2199 senders=senders,
2200 recipients=recipients,
2201 isolatedSenders=isolatedSenders,
2202 isolatedRecipients=isolatedRecipients,
2203 sw1="s6",
2204 sw2="s2",
2205 sw3="s4",
2206 sw4="s1",
2207 sw5="s3",
2208 expectedLink1=16,
2209 expectedLink2=14,
2210 partial=True )
2211 else:
2212 main.CLIs[ 0 ].removeAllIntents( purge=True )
2213
2214 utilities.assert_equals( expect=main.TRUE,
2215 actual=testResult,
2216 onpass=main.assertReturnString,
2217 onfail=main.assertReturnString )
2218
Jeremye0cb5eb2016-01-27 17:39:09 -08002219 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002220 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2221 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002222 senders = [
2223 { "name":"h8", "device":"of:0000000000000005/8" }
2224 ]
2225 recipients = [
2226 { "name":"h16", "device":"of:0000000000000006/8" },
2227 { "name":"h24", "device":"of:0000000000000007/8" }
2228 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002229 isolatedSenders = []
2230 isolatedRecipients = [
Jeremy Songster832f9e92016-05-05 14:30:49 -07002231 { "name":"h24"}
Jeremye0cb5eb2016-01-27 17:39:09 -08002232 ]
2233 testResult = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -08002234 installResult = main.FALSE
Jeremye0cb5eb2016-01-27 17:39:09 -08002235 installResult = main.intentFunction.installSingleToMultiIntent(
2236 main,
2237 name="NOOPTION",
2238 senders=senders,
2239 recipients=recipients,
2240 sw1="s5",
2241 sw2="s2")
2242
2243 if installResult:
2244 testResult = main.intentFunction.testEndPointFail(
2245 main,
2246 intentId=installResult,
2247 name="NOOPTION",
2248 senders=senders,
2249 recipients=recipients,
2250 isolatedSenders=isolatedSenders,
2251 isolatedRecipients=isolatedRecipients,
2252 sw1="s6",
2253 sw2="s2",
2254 sw3="s4",
2255 sw4="s1",
2256 sw5="s3",
2257 expectedLink1=16,
2258 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002259 else:
2260 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002261
2262 utilities.assert_equals( expect=main.TRUE,
2263 actual=testResult,
2264 onpass=main.assertReturnString,
2265 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002266 # Right now this functionality doesn't work properly in SPMP intents
2267 main.step( "NOOPTION: Install and test single point to multi point " +\
2268 "intents with partial failures allowed" )
2269 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2270 "point intent with partial failures allowed\n"
2271 senders = [
2272 { "name":"h8", "device":"of:0000000000000005/8" }
2273 ]
2274 recipients = [
2275 { "name":"h16", "device":"of:0000000000000006/8" },
2276 { "name":"h24", "device":"of:0000000000000007/8" }
2277 ]
2278 isolatedSenders = []
2279 isolatedRecipients = [
2280 { "name":"h24"}
2281 ]
2282 testResult = main.FALSE
2283 installResult = main.FALSE
2284 installResult = main.intentFunction.installSingleToMultiIntent(
2285 main,
2286 name="NOOPTION",
2287 senders=senders,
2288 recipients=recipients,
2289 sw1="s5",
2290 sw2="s2",
2291 partial=True)
2292
2293 if installResult:
2294 testResult = main.intentFunction.testEndPointFail(
2295 main,
2296 intentId=installResult,
2297 name="NOOPTION",
2298 senders=senders,
2299 recipients=recipients,
2300 isolatedSenders=isolatedSenders,
2301 isolatedRecipients=isolatedRecipients,
2302 sw1="s6",
2303 sw2="s2",
2304 sw3="s4",
2305 sw4="s1",
2306 sw5="s3",
2307 expectedLink1=16,
2308 expectedLink2=14,
2309 partial=True )
2310 else:
2311 main.CLIs[ 0 ].removeAllIntents( purge=True )
2312
2313 utilities.assert_equals( expect=main.TRUE,
2314 actual=testResult,
2315 onpass=main.assertReturnString,
2316 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002317
Jeremy2f190ca2016-01-29 15:23:57 -08002318 main.intentFunction.report( main )