blob: 5b88b25f7982929cd9b959c6394b1ad7112e0401 [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 ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07009 import imp
Jon Hallf632d202015-07-30 15:45:11 -070010 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070011
12 """
13 - Construct tests variables
14 - GIT ( optional )
15 - Checkout ONOS master branch
16 - Pull latest ONOS code
17 - Building ONOS ( optional )
18 - Install ONOS package
19 - Build ONOS package
20 """
21
22 main.case( "Constructing test variables and building ONOS package" )
23 main.step( "Constructing test variables" )
Jon Hall783bbf92015-07-23 14:33:19 -070024 main.caseExplanation = "This test case is mainly for loading " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -070025 "from params file, and pull and build the " +\
26 " latest ONOS package"
kelvin-onlabd48a68c2015-07-13 16:01:36 -070027 stepResult = main.FALSE
28
29 # Test variables
Jon Halla3e02432015-07-24 15:55:42 -070030 try:
Jon Hallf632d202015-07-30 15:45:11 -070031 main.testOnDirectory = re.sub( "(/tests)$", "", main.testDir )
Jon Halla3e02432015-07-24 15:55:42 -070032 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
33 gitBranch = main.params[ 'GIT' ][ 'branch' ]
34 main.dependencyPath = main.testOnDirectory + \
35 main.params[ 'DEPENDENCY' ][ 'path' ]
36 main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
37 main.scale = ( main.params[ 'SCALE' ][ 'size' ] ).split( "," )
38 if main.ONOSbench.maxNodes:
39 main.maxNodes = int( main.ONOSbench.maxNodes )
40 else:
41 main.maxNodes = 0
42 wrapperFile1 = main.params[ 'DEPENDENCY' ][ 'wrapper1' ]
43 wrapperFile2 = main.params[ 'DEPENDENCY' ][ 'wrapper2' ]
44 wrapperFile3 = main.params[ 'DEPENDENCY' ][ 'wrapper3' ]
45 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
46 main.checkIntentSleep = int( main.params[ 'SLEEP' ][ 'checkintent' ] )
acsmarscfa52272015-08-06 15:21:45 -070047 main.removeIntentSleep = int( main.params[ 'SLEEP' ][ 'removeintent' ] )
Jon Halla3e02432015-07-24 15:55:42 -070048 main.rerouteSleep = int( main.params[ 'SLEEP' ][ 'reroute' ] )
49 main.fwdSleep = int( main.params[ 'SLEEP' ][ 'fwd' ] )
Shreyaca8990f2017-03-16 11:43:11 -070050 main.checkConnectionSleep = int( main.params[ 'SLEEP' ][ 'checkConnection' ] )
51 main.checkFlowCountSleep = int( main.params[ 'SLEEP' ][ 'checkFlowCount' ] )
52 main.checkIntentHostSleep = int( main.params[ 'SLEEP' ][ 'checkIntentHost' ] )
53 main.checkIntentPointSleep = int( main.params[ 'SLEEP' ][ 'checkIntentPoint' ] )
acsmars59a4c552015-09-10 18:11:19 -070054 main.checkTopoAttempts = int( main.params[ 'SLEEP' ][ 'topoAttempts' ] )
Jeremy Songster306ed7a2016-07-19 10:59:07 -070055 main.flowDurationSleep = int( main.params[ 'SLEEP' ][ 'flowDuration' ] )
Jon Halla3e02432015-07-24 15:55:42 -070056 gitPull = main.params[ 'GIT' ][ 'pull' ]
57 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
58 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
59 main.cellData = {} # for creating cell file
60 main.hostsData = {}
61 main.CLIs = []
62 main.ONOSip = []
Jeremy Songster1f39bf02016-01-20 17:17:25 -080063 main.scapyHostNames = main.params[ 'SCAPY' ][ 'HOSTNAMES' ].split( ',' )
64 main.scapyHosts = [] # List of scapy hosts for iterating
acsmars5d8cc862015-09-25 09:44:50 -070065 main.assertReturnString = '' # Assembled assert return string
Jeremy Songster17147f22016-05-31 18:30:52 -070066 main.cycle = 0 # How many times FUNCintent has run through its tests
kelvin-onlabd48a68c2015-07-13 16:01:36 -070067
Jon Halla3e02432015-07-24 15:55:42 -070068 main.ONOSip = main.ONOSbench.getOnosIps()
69 print main.ONOSip
kelvin-onlabd48a68c2015-07-13 16:01:36 -070070
Jon Halla3e02432015-07-24 15:55:42 -070071 # Assigning ONOS cli handles to a list
72 for i in range( 1, main.maxNodes + 1 ):
73 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070074
Jon Halla3e02432015-07-24 15:55:42 -070075 # -- INIT SECTION, ONLY RUNS ONCE -- #
76 main.startUp = imp.load_source( wrapperFile1,
77 main.dependencyPath +
78 wrapperFile1 +
79 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070080
Jon Halla3e02432015-07-24 15:55:42 -070081 main.intentFunction = imp.load_source( wrapperFile2,
82 main.dependencyPath +
83 wrapperFile2 +
84 ".py" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -070085
Jon Halla3e02432015-07-24 15:55:42 -070086 main.topo = imp.load_source( wrapperFile3,
87 main.dependencyPath +
88 wrapperFile3 +
89 ".py" )
90
kelvin-onlabd9e23de2015-08-06 10:34:44 -070091 copyResult1 = main.ONOSbench.scp( main.Mininet1,
92 main.dependencyPath +
93 main.topology,
Jeremy Songster1f39bf02016-01-20 17:17:25 -080094 main.Mininet1.home + "custom/",
kelvin-onlabd9e23de2015-08-06 10:34:44 -070095 direction="to" )
Jon Halla3e02432015-07-24 15:55:42 -070096 if main.CLIs:
97 stepResult = main.TRUE
98 else:
99 main.log.error( "Did not properly created list of ONOS CLI handle" )
100 stepResult = main.FALSE
101 except Exception as e:
102 main.log.exception(e)
103 main.cleanup()
104 main.exit()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700105
106 utilities.assert_equals( expect=main.TRUE,
107 actual=stepResult,
108 onpass="Successfully construct " +
109 "test variables ",
110 onfail="Failed to construct test variables" )
111
112 if gitPull == 'True':
113 main.step( "Building ONOS in " + gitBranch + " branch" )
114 onosBuildResult = main.startUp.onosBuild( main, gitBranch )
115 stepResult = onosBuildResult
116 utilities.assert_equals( expect=main.TRUE,
117 actual=stepResult,
118 onpass="Successfully compiled " +
119 "latest ONOS",
120 onfail="Failed to compile " +
121 "latest ONOS" )
122 else:
123 main.log.warn( "Did not pull new code so skipping mvn " +
124 "clean install" )
Jon Hall106be082015-07-22 09:53:00 -0700125 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700126
127 def CASE2( self, main ):
128 """
129 - Set up cell
130 - Create cell file
131 - Set cell file
132 - Verify cell file
133 - Kill ONOS process
134 - Uninstall ONOS cluster
135 - Verify ONOS start up
136 - Install ONOS cluster
137 - Connect to cli
138 """
alison52b25892016-09-19 10:53:48 -0700139 import time
Jeremy Songster17147f22016-05-31 18:30:52 -0700140 main.cycle += 1
141
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700142 # main.scale[ 0 ] determines the current number of ONOS controller
143 main.numCtrls = int( main.scale[ 0 ] )
Jeremycd872222016-03-29 10:08:34 -0700144 main.flowCompiler = "Flow Rules"
Jeremyd9e4eb12016-04-13 12:09:06 -0700145 main.initialized = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700146
147 main.case( "Starting up " + str( main.numCtrls ) +
148 " node(s) ONOS cluster" )
Jon Hall783bbf92015-07-23 14:33:19 -0700149 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700150 " node(s) ONOS cluster"
151
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700152 #kill off all onos processes
153 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800154 " before initiating environment setup" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700155
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800156 main.step( "Uninstalling ONOS package" )
157 onosUninstallResult = main.TRUE
158 for ip in main.ONOSip:
159 onosUninstallResult = onosUninstallResult and \
160 main.ONOSbench.onosUninstall( nodeIp=ip )
161 stepResult = onosUninstallResult
162 utilities.assert_equals( expect=main.TRUE,
163 actual=stepResult,
164 onpass="Successfully uninstalled ONOS package",
165 onfail="Failed to uninstall ONOS package" )
Jon Hallf539eb92017-05-22 17:18:42 -0700166 main.log.info( "Sleeping {} seconds".format( main.startUpSleep ) )
Jeremy42df2e72016-02-23 16:37:46 -0800167 time.sleep( main.startUpSleep )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800168
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700169 for i in range( main.maxNodes ):
170 main.ONOSbench.onosDie( main.ONOSip[ i ] )
171
172 print "NODE COUNT = ", main.numCtrls
173
174 tempOnosIp = []
175 for i in range( main.numCtrls ):
176 tempOnosIp.append( main.ONOSip[i] )
177
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700178 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
179 "temp", main.Mininet1.ip_address,
180 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700181
182 main.step( "Apply cell to environment" )
183 cellResult = main.ONOSbench.setCell( "temp" )
184 verifyResult = main.ONOSbench.verifyCell()
185 stepResult = cellResult and verifyResult
186 utilities.assert_equals( expect=main.TRUE,
187 actual=stepResult,
188 onpass="Successfully applied cell to " + \
189 "environment",
190 onfail="Failed to apply cell to environment " )
191
192 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700193 packageResult = main.ONOSbench.buckBuild()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700194 stepResult = packageResult
195 utilities.assert_equals( expect=main.TRUE,
196 actual=stepResult,
197 onpass="Successfully created ONOS package",
198 onfail="Failed to create ONOS package" )
199
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700200 main.step( "Installing ONOS package" )
201 onosInstallResult = main.TRUE
202 for i in range( main.numCtrls ):
203 onosInstallResult = onosInstallResult and \
204 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
205 stepResult = onosInstallResult
206 utilities.assert_equals( expect=main.TRUE,
207 actual=stepResult,
208 onpass="Successfully installed ONOS package",
209 onfail="Failed to install ONOS package" )
210
You Wangf5de25b2017-01-06 15:13:01 -0800211 main.step( "Set up ONOS secure SSH" )
212 secureSshResult = main.TRUE
213 for i in range( int( main.numCtrls ) ):
214 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
215 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
216 onpass="Test step PASS",
217 onfail="Test step FAIL" )
218
Jon Hallf539eb92017-05-22 17:18:42 -0700219 main.log.info( "Sleeping {} seconds".format( main.startUpSleep ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700220 time.sleep( main.startUpSleep )
221 main.step( "Starting ONOS service" )
222 stopResult = main.TRUE
223 startResult = main.TRUE
224 onosIsUp = main.TRUE
225
226 for i in range( main.numCtrls ):
Jeremy Songster7edb6632016-04-28 15:44:28 -0700227 isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
228 onosIsUp = onosIsUp and isUp
229 if isUp == main.TRUE:
Jeremyd9e4eb12016-04-13 12:09:06 -0700230 main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
231 else:
232 main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
233 "start ONOS again " )
234 stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
235 startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
236 if not startResult or stopResult:
237 main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700238 stepResult = onosIsUp and stopResult and startResult
239 utilities.assert_equals( expect=main.TRUE,
240 actual=stepResult,
Jeremyd9e4eb12016-04-13 12:09:06 -0700241 onpass="ONOS service is ready on all nodes",
242 onfail="ONOS service did not start properly on all nodes" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700243
244 main.step( "Start ONOS cli" )
245 cliResult = main.TRUE
246 for i in range( main.numCtrls ):
247 cliResult = cliResult and \
248 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
249 stepResult = cliResult
250 utilities.assert_equals( expect=main.TRUE,
251 actual=stepResult,
252 onpass="Successfully start ONOS cli",
253 onfail="Failed to start ONOS cli" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700254 if not stepResult:
255 main.initialized = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700256
257 # Remove the first element in main.scale list
258 main.scale.remove( main.scale[ 0 ] )
259
kelvin-onlab016dce22015-08-10 09:54:11 -0700260 main.intentFunction.report( main )
261
Jon Halla3e02432015-07-24 15:55:42 -0700262 def CASE8( self, main ):
263 """
acsmars59a4c552015-09-10 18:11:19 -0700264 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700265 """
266 import json
267
268 main.case( "Compare ONOS Topology view to Mininet topology" )
269 main.caseExplanation = "Compare topology elements between Mininet" +\
270 " and ONOS"
271
acsmars59a4c552015-09-10 18:11:19 -0700272 main.log.info( "Gathering topology information from Mininet" )
273 devicesResults = main.FALSE # Overall Boolean for device correctness
274 linksResults = main.FALSE # Overall Boolean for link correctness
275 hostsResults = main.FALSE # Overall Boolean for host correctness
276 deviceFails = [] # Nodes where devices are incorrect
277 linkFails = [] # Nodes where links are incorrect
278 hostFails = [] # Nodes where hosts are incorrect
279 attempts = main.checkTopoAttempts # Remaining Attempts
Jon Halla3e02432015-07-24 15:55:42 -0700280
281 mnSwitches = main.Mininet1.getSwitches()
282 mnLinks = main.Mininet1.getLinks()
283 mnHosts = main.Mininet1.getHosts()
284
Jon Hall70b2ff42015-11-17 15:49:44 -0800285 main.step( "Comparing Mininet topology to ONOS topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700286
acsmars59a4c552015-09-10 18:11:19 -0700287 while ( attempts >= 0 ) and\
288 ( not devicesResults or not linksResults or not hostsResults ):
Jon Hallf539eb92017-05-22 17:18:42 -0700289 main.log.info( "Sleeping {} seconds".format( 2 ) )
acsmars59a4c552015-09-10 18:11:19 -0700290 time.sleep( 2 )
291 if not devicesResults:
292 devices = main.topo.getAllDevices( main )
293 ports = main.topo.getAllPorts( main )
294 devicesResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800295 deviceFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700296 if not linksResults:
297 links = main.topo.getAllLinks( main )
298 linksResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800299 linkFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700300 if not hostsResults:
301 hosts = main.topo.getAllHosts( main )
302 hostsResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800303 hostFails = [] # Reset for each failed attempt
Jon Halla3e02432015-07-24 15:55:42 -0700304
acsmars59a4c552015-09-10 18:11:19 -0700305 # Check for matching topology on each node
306 for controller in range( main.numCtrls ):
307 controllerStr = str( controller + 1 ) # ONOS node number
308 # Compare Devices
309 if devices[ controller ] and ports[ controller ] and\
310 "Error" not in devices[ controller ] and\
311 "Error" not in ports[ controller ]:
Jon Halla3e02432015-07-24 15:55:42 -0700312
acsmars2ec91d62015-09-16 11:15:48 -0700313 try:
314 deviceData = json.loads( devices[ controller ] )
315 portData = json.loads( ports[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700316 except( TypeError, ValueError ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800317 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
acsmars2ec91d62015-09-16 11:15:48 -0700318 currentDevicesResult = main.FALSE
319 else:
320 currentDevicesResult = main.Mininet1.compareSwitches(
321 mnSwitches,deviceData,portData )
acsmars59a4c552015-09-10 18:11:19 -0700322 else:
323 currentDevicesResult = main.FALSE
324 if not currentDevicesResult:
325 deviceFails.append( controllerStr )
326 devicesResults = devicesResults and currentDevicesResult
327 # Compare Links
328 if links[ controller ] and "Error" not in links[ controller ]:
acsmars2ec91d62015-09-16 11:15:48 -0700329 try:
330 linkData = json.loads( links[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700331 except( TypeError, ValueError ):
332 main.log.error( "Could not load json:" + str( links[ controller ] ) )
acsmars2ec91d62015-09-16 11:15:48 -0700333 currentLinksResult = main.FALSE
334 else:
335 currentLinksResult = main.Mininet1.compareLinks(
336 mnSwitches, mnLinks,linkData )
acsmars59a4c552015-09-10 18:11:19 -0700337 else:
338 currentLinksResult = main.FALSE
339 if not currentLinksResult:
340 linkFails.append( controllerStr )
341 linksResults = linksResults and currentLinksResult
342 # Compare Hosts
acsmars2ec91d62015-09-16 11:15:48 -0700343 if hosts[ controller ] and "Error" not in hosts[ controller ]:
344 try:
345 hostData = json.loads( hosts[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700346 except( TypeError, ValueError ):
347 main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
acsmars2ec91d62015-09-16 11:15:48 -0700348 currentHostsResult = main.FALSE
349 else:
350 currentHostsResult = main.Mininet1.compareHosts(
351 mnHosts,hostData )
acsmars59a4c552015-09-10 18:11:19 -0700352 else:
353 currentHostsResult = main.FALSE
354 if not currentHostsResult:
355 hostFails.append( controllerStr )
356 hostsResults = hostsResults and currentHostsResult
357 # Decrement Attempts Remaining
358 attempts -= 1
359
360
361 utilities.assert_equals( expect=[],
362 actual=deviceFails,
363 onpass="ONOS correctly discovered all devices",
364 onfail="ONOS incorrectly discovered devices on nodes: " +
365 str( deviceFails ) )
366 utilities.assert_equals( expect=[],
367 actual=linkFails,
368 onpass="ONOS correctly discovered all links",
369 onfail="ONOS incorrectly discovered links on nodes: " +
370 str( linkFails ) )
371 utilities.assert_equals( expect=[],
372 actual=hostFails,
373 onpass="ONOS correctly discovered all hosts",
374 onfail="ONOS incorrectly discovered hosts on nodes: " +
375 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700376 topoResults = hostsResults and linksResults and devicesResults
377 utilities.assert_equals( expect=main.TRUE,
378 actual=topoResults,
379 onpass="ONOS correctly discovered the topology",
380 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700381
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700382 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700383 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700384 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700385 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700386 if main.initialized == main.FALSE:
387 main.log.error( "Test components did not start correctly, skipping further tests" )
388 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700389 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700390 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700391 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700392 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700393 "switches to test intents, exits out if " +\
394 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700395
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700396 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700397 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700398 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700399 main.topology,
400 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700401 stepResult = topoResult
402 utilities.assert_equals( expect=main.TRUE,
403 actual=stepResult,
404 onpass="Successfully loaded topology",
405 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700406
407 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700408 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700409 main.initialized = main.FALSE
410 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700411
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700412 def CASE11( self, main ):
413 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700414 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700415 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700416 if main.initialized == main.FALSE:
417 main.log.error( "Test components did not start correctly, skipping further tests" )
418 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700419 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700420 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700421 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700422 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700423 "switches to test intents, exits out if " +\
424 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700425
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700426 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700427 args = "--switch ovs,protocols=OpenFlow13"
428 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
429 main.topology,
430 args=args )
431 stepResult = topoResult
432 utilities.assert_equals( expect=main.TRUE,
433 actual=stepResult,
434 onpass="Successfully loaded topology",
435 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700436 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700437 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700438 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700439
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700440 def CASE12( self, main ):
441 """
442 Assign mastership to controllers
443 """
444 import re
445
Jeremyd9e4eb12016-04-13 12:09:06 -0700446 if main.initialized == main.FALSE:
447 main.log.error( "Test components did not start correctly, skipping further tests" )
448 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700449 main.case( "Assign switches to controllers" )
450 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700451 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700452 " switches to ONOS nodes"
453
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700454 switchList = []
455
456 # Creates a list switch name, use getSwitch() function later...
457 for i in range( 1, ( main.numSwitch + 1 ) ):
458 switchList.append( 's' + str( i ) )
459
460 tempONOSip = []
461 for i in range( main.numCtrls ):
462 tempONOSip.append( main.ONOSip[ i ] )
463
464 assignResult = main.Mininet1.assignSwController( sw=switchList,
465 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700466 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700467 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700468 main.log.error( "Problem assigning mastership of switches" )
469 main.initialized = main.FALSE
470 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700471
472 for i in range( 1, ( main.numSwitch + 1 ) ):
473 response = main.Mininet1.getSwController( "s" + str( i ) )
474 print( "Response is " + str( response ) )
475 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
476 assignResult = assignResult and main.TRUE
477 else:
478 assignResult = main.FALSE
479 stepResult = assignResult
480 utilities.assert_equals( expect=main.TRUE,
481 actual=stepResult,
482 onpass="Successfully assigned switches" +
483 "to controller",
484 onfail="Failed to assign switches to " +
485 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700486 if not stepResult:
487 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700488
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800489 def CASE13( self,main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700490 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800491 Create Scapy components
492 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700493 if main.initialized == main.FALSE:
494 main.log.error( "Test components did not start correctly, skipping further tests" )
495 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800496 main.case( "Create scapy components" )
497 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800498 scapyResult = main.TRUE
499 for hostName in main.scapyHostNames:
500 main.Scapy1.createHostComponent( hostName )
501 main.scapyHosts.append( getattr( main, hostName ) )
502
503 main.step( "Start scapy components" )
504 for host in main.scapyHosts:
505 host.startHostCli()
506 host.startScapy()
507 host.updateSelf()
508 main.log.debug( host.name )
509 main.log.debug( host.hostIp )
510 main.log.debug( host.hostMac )
511
512
513 utilities.assert_equals( expect=main.TRUE,
514 actual=scapyResult,
515 onpass="Successfully created Scapy Components",
516 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700517 if not scapyResult:
518 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800519
520 def CASE14( self, main ):
521 """
522 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700523 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700524 if main.initialized == main.FALSE:
525 main.log.error( "Test components did not start correctly, skipping further tests" )
526 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700527 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800528 main.step( "Pingall hosts and confirm ONOS discovery" )
529 utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700530
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800531 utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE,
532 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700533 utilities.assert_equals( expect=main.TRUE,
534 actual=stepResult,
535 onpass="Successfully discovered hosts",
536 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700537 if not stepResult:
538 main.initialized = main.FALSE
539 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700540
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800541 main.step( "Populate hostsData" )
542 stepResult = main.intentFunction.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700543 utilities.assert_equals( expect=main.TRUE,
544 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800545 onpass="Successfully populated hostsData",
546 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700547 if not stepResult:
548 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800549
550 def CASE15( self, main ):
551 """
552 Discover all hosts with scapy arp packets and store its data to a dictionary
553 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700554 if main.initialized == main.FALSE:
555 main.log.error( "Test components did not start correctly, skipping further tests" )
556 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800557 main.case( "Discover all hosts using scapy" )
558 main.step( "Send packets from each host to the first host and confirm onos discovery" )
559
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800560 if len( main.scapyHosts ) < 1:
561 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700562 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800563 main.skipCase()
564
565 # Send ARP packets from each scapy host component
566 main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
567
568 stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
569 retValue=main.FALSE, args=[ main ],
570 attempts=main.checkTopoAttempts, sleep=2 )
571
572 utilities.assert_equals( expect=main.TRUE,
573 actual=stepResult,
574 onpass="ONOS correctly discovered all hosts",
575 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700576 if not stepResult:
577 main.initialized = main.FALSE
578 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800579
580 main.step( "Populate hostsData" )
581 stepResult = main.intentFunction.populateHostData( main )
582 utilities.assert_equals( expect=main.TRUE,
583 actual=stepResult,
584 onpass="Successfully populated hostsData",
585 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700586 if not stepResult:
587 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800588
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800589 def CASE16( self, main ):
590 """
Jeremy42df2e72016-02-23 16:37:46 -0800591 Balance Masters
592 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700593 if main.initialized == main.FALSE:
594 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700595 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700596 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800597 main.case( "Balance mastership of switches" )
598 main.step( "Balancing mastership of switches" )
599
Jeremy42df2e72016-02-23 16:37:46 -0800600 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
601
602 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700603 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800604 onpass="Successfully balanced mastership of switches",
605 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700606 if not balanceResult:
607 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800608
609 def CASE17( self, main ):
610 """
Jeremy6e9748f2016-03-25 15:03:39 -0700611 Use Flow Objectives
612 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700613 if main.initialized == main.FALSE:
614 main.log.error( "Test components did not start correctly, skipping further tests" )
615 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700616 main.case( "Enable intent compilation using Flow Objectives" )
617 main.step( "Enabling Flow Objectives" )
618
619 main.flowCompiler = "Flow Objectives"
620
621 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
622
623 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
624 propName="useFlowObjectives", value="true" )
You Wang106d0fa2017-05-15 17:22:15 -0700625 stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
626 propName="defaultFlowObjectiveCompiler",
627 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
Jeremy6e9748f2016-03-25 15:03:39 -0700628
629 utilities.assert_equals( expect=main.TRUE,
630 actual=stepResult,
631 onpass="Successfully activated Flow Objectives",
632 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700633 if not balanceResult:
634 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700635
636 def CASE18( self, main ):
637 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800638 Stop mininet and remove scapy host
639 """
640 main.log.report( "Stop Mininet and Scapy" )
641 main.case( "Stop Mininet and Scapy" )
642 main.caseExplanation = "Stopping the current mininet topology " +\
643 "to start up fresh"
644 main.step( "Stopping and Removing Scapy Host Components" )
645 scapyResult = main.TRUE
646 for host in main.scapyHosts:
647 scapyResult = scapyResult and host.stopScapy()
648 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
649
650 for host in main.scapyHosts:
651 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
652 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
653
654 main.scapyHosts = []
655 main.scapyHostIPs = []
656
657 utilities.assert_equals( expect=main.TRUE,
658 actual=scapyResult,
659 onpass="Successfully stopped scapy and removed host components",
660 onfail="Failed to stop mininet and scapy" )
661
662 main.step( "Stopping Mininet Topology" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700663 mininetResult = main.Mininet1.stopNet()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800664
665 utilities.assert_equals( expect=main.TRUE,
666 actual=mininetResult,
667 onpass="Successfully stopped mininet and scapy",
668 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700669 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800670 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700671 main.cleanup()
672 main.exit()
673
Jeremy Songster17147f22016-05-31 18:30:52 -0700674 def CASE19( self, main ):
675 """
676 Copy the karaf.log files after each testcase cycle
677 """
678 main.log.report( "Copy karaf logs" )
679 main.case( "Copy karaf logs" )
680 main.caseExplanation = "Copying the karaf logs to preserve them through" +\
681 "reinstalling ONOS"
682 main.step( "Copying karaf logs" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700683 stepResult = main.TRUE
684 scpResult = main.TRUE
685 copyResult = main.TRUE
Jeremy Songstercc5414b2016-07-11 10:59:53 -0700686 for i in range( main.numCtrls ):
687 main.node = main.CLIs[ i ]
Jeremy Songster17147f22016-05-31 18:30:52 -0700688 ip = main.ONOSip[ i ]
689 main.node.ip_address = ip
Jeremy Songster31aad312016-06-13 16:32:11 -0700690 scpResult = scpResult and main.ONOSbench.scp( main.node ,
691 "/opt/onos/log/karaf.log",
692 "/tmp/karaf.log",
693 direction="from" )
694 copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
695 copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
696 if scpResult and copyResult:
697 stepResult = main.TRUE and stepResult
698 else:
699 stepResult = main.FALSE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700700 utilities.assert_equals( expect=main.TRUE,
701 actual=stepResult,
702 onpass="Successfully copied remote ONOS logs",
703 onfail="Failed to copy remote ONOS logs" )
Jeremy Songster17147f22016-05-31 18:30:52 -0700704
kelvin-onlabb769f562015-07-15 17:05:10 -0700705 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700706 """
707 Add host intents between 2 host:
708 - Discover hosts
709 - Add host intents
710 - Check intents
711 - Verify flows
712 - Ping hosts
713 - Reroute
714 - Link down
715 - Verify flows
716 - Check topology
717 - Ping hosts
718 - Link up
719 - Verify flows
720 - Check topology
721 - Ping hosts
722 - Remove intents
723 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700724 if main.initialized == main.FALSE:
725 main.log.error( "Test components did not start correctly, skipping further tests" )
726 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700727 # Assert variables - These variable's name|format must be followed
728 # if you want to use the wrapper function
729 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700730 try:
731 assert main.CLIs
732 except AssertionError:
733 main.log.error( "There is no main.CLIs, skipping test cases" )
734 main.initialized = main.FALSE
735 main.skipCase()
736 try:
737 assert main.Mininet1
738 except AssertionError:
739 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
740 main.initialized = main.FALSE
741 main.skipCase()
742 try:
743 assert main.numSwitch
744 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700745 main.log.error( "Place the total number of switch topology in " +\
746 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700747 main.initialized = main.FALSE
748 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700749
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800750 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700751 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
752
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700753 main.testName = "Host Intents"
754 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700755 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700756 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700757 str( main.numCtrls ) + " node(s) cluster;\n" +\
758 "Different type of hosts will be tested in " +\
759 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700760 "etc;\nThe test will use OF " + main.OFProtocol +\
761 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700762 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700763
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700764 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700765 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700766 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
767 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800768 testResult = main.FALSE
769 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700770 name="IPV4",
771 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800772 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700773 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800774 if installResult:
775 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700776 name="IPV4",
Jon Hall9c888672017-05-15 18:03:54 -0700777 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700778 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800779 host1=host1,
780 host2=host2,
alison52b25892016-09-19 10:53:48 -0700781 sw1="s5",
782 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700783 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800784 else:
785 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800786
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700787 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800788 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700789 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700790 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700791
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700792 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700793 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700794 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
795 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 "}
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800796 testResult = main.FALSE
797 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700798 name="DUALSTACK",
799 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800800 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700801 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800802
803 if installResult:
804 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700805 name="DUALSTACK",
Jon Hall9c888672017-05-15 18:03:54 -0700806 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700807 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800808 host1=host1,
809 host2=host2,
alison52b25892016-09-19 10:53:48 -0700810 sw1="s5",
811 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700812 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700813
814 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800815 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700816 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700817 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700818
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700819 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700820 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700821 host1 = { "name": "h1" }
822 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800823 testResult = main.FALSE
824 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700825 name="DUALSTACK2",
826 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800827 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700828 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800829
830 if installResult:
831 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700832 name="DUALSTACK2",
Jon Hall9c888672017-05-15 18:03:54 -0700833 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700834 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800835 host1=host1,
836 host2=host2,
alison52b25892016-09-19 10:53:48 -0700837 sw1="s5",
838 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700839 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800840 else:
841 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700842
843 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800844 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700845 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700846 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700847
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700848 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700849 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700850 host1 = { "name": "h1" }
851 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800852 testResult = main.FALSE
853 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700854 name="1HOP",
855 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800856 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700857 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800858
859 if installResult:
860 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700861 name="1HOP",
Jon Hall9c888672017-05-15 18:03:54 -0700862 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700863 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800864 host1=host1,
865 host2=host2,
alison52b25892016-09-19 10:53:48 -0700866 sw1="s5",
867 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700868 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800869 else:
870 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700871
872 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800873 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700874 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700875 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700876
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700877 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700878 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700879 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
880 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800881 testResult = main.FALSE
882 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700883 name="VLAN1",
884 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800885 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700886 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800887
888 if installResult:
889 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700890 name="VLAN1",
Jon Hall9c888672017-05-15 18:03:54 -0700891 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700892 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800893 host1=host1,
894 host2=host2,
alison52b25892016-09-19 10:53:48 -0700895 sw1="s5",
896 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700897 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800898 else:
899 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700900
901 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800902 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700903 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700904 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700905
Jeremy Songsterff553672016-05-12 17:06:23 -0700906 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
907 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700908 host1 = { "name": "h5", "vlan": "200" }
909 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700910 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -0700911 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700912 name="VLAN2",
913 onosNode=0,
Jeremy Songsterff553672016-05-12 17:06:23 -0700914 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700915 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700916
917 if installResult:
918 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700919 name="VLAN2",
Jon Hall9c888672017-05-15 18:03:54 -0700920 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700921 onosNode=0,
Jeremy Songsterff553672016-05-12 17:06:23 -0700922 host1=host1,
923 host2=host2,
alison52b25892016-09-19 10:53:48 -0700924 sw1="s5",
925 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700926 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700927 else:
928 main.CLIs[ 0 ].removeAllIntents( purge=True )
929
930 utilities.assert_equals( expect=main.TRUE,
931 actual=testResult,
932 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700933 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700934
Jeremy Songsterc032f162016-08-04 17:14:49 -0700935 main.step( "Encapsulation: Add host intents between h1 and h9" )
936 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700937 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
938 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700939 testResult = main.FALSE
Jeremy Songsterc032f162016-08-04 17:14:49 -0700940 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700941 name="ENCAPSULATION",
942 onosNode=0,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700943 host1=host1,
944 host2=host2,
945 encap="VLAN" )
946 if installResult:
947 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700948 name="ENCAPSULATION",
Jon Hall9c888672017-05-15 18:03:54 -0700949 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700950 onosNode=0,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700951 host1=host1,
952 host2=host2,
alison52b25892016-09-19 10:53:48 -0700953 sw1="s5",
954 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700955 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700956 else:
957 main.CLIs[ 0 ].removeAllIntents( purge=True )
958
959 utilities.assert_equals( expect=main.TRUE,
960 actual=testResult,
961 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700962 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700963
Shreyaca8990f2017-03-16 11:43:11 -0700964 # Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
alison52b25892016-09-19 10:53:48 -0700965 # main.step( "Encapsulation: Add host intents between h1 and h9" )
966 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
967 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
968 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
969 # testResult = main.FALSE
970 # installResult = main.intentFunction.installHostIntent( main,
971 # name="ENCAPSULATION",
972 # onosNode=0,
973 # host1=host1,
974 # host2=host2,
975 # encap="MPLS" )
976 # if installResult:
977 # testResult = main.intentFunction.testHostIntent( main,
978 # name="ENCAPSULATION",
979 # intentId=installResult,
980 # onosNode=0,
981 # host1=host1,
982 # host2=host2,
983 # sw1="s5",
984 # sw2="s2",
985 # expectedLink=18 )
986 # else:
987 # main.CLIs[ 0 ].removeAllIntents( purge=True )
988 #
989 # utilities.assert_equals( expect=main.TRUE,
990 # actual=testResult,
991 # onpass=main.assertReturnString,
992 # onfail=main.assertReturnString )
993
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700994 main.step( "Confirm that ONOS leadership is unchanged" )
acsmarse6b410f2015-07-17 14:39:34 -0700995 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
alison52b25892016-09-19 10:53:48 -0700996 testResult = main.intentFunction.checkLeaderChange( intentLeadersOld,
acsmarse6b410f2015-07-17 14:39:34 -0700997 intentLeadersNew )
998
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800999 utilities.assert_equals( expect=main.TRUE,
1000 actual=testResult,
1001 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001002 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001003
kelvin-onlab016dce22015-08-10 09:54:11 -07001004 main.intentFunction.report( main )
1005
kelvin-onlabb769f562015-07-15 17:05:10 -07001006 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001007 """
1008 Add point intents between 2 hosts:
1009 - Get device ids | ports
1010 - Add point intents
1011 - Check intents
1012 - Verify flows
1013 - Ping hosts
1014 - Reroute
1015 - Link down
1016 - Verify flows
1017 - Check topology
1018 - Ping hosts
1019 - Link up
1020 - Verify flows
1021 - Check topology
1022 - Ping hosts
1023 - Remove intents
1024 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001025 if main.initialized == main.FALSE:
1026 main.log.error( "Test components did not start correctly, skipping further tests" )
1027 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001028 # Assert variables - These variable's name|format must be followed
1029 # if you want to use the wrapper function
1030 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001031 try:
1032 assert main.CLIs
1033 except AssertionError:
1034 main.log.error( "There is no main.CLIs, skipping test cases" )
1035 main.initialized = main.FALSE
1036 main.skipCase()
1037 try:
1038 assert main.Mininet1
1039 except AssertionError:
1040 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1041 main.initialized = main.FALSE
1042 main.skipCase()
1043 try:
1044 assert main.numSwitch
1045 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001046 main.log.error( "Place the total number of switch topology in " +\
1047 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001048 main.initialized = main.FALSE
1049 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001050
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001051 main.testName = "Point Intents"
1052 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001053 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001054 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001055 " intents using " + str( main.numCtrls ) +\
1056 " node(s) cluster;\n" +\
1057 "Different type of hosts will be tested in " +\
1058 "each step such as IPV4, Dual stack, VLAN etc" +\
1059 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001060 " OVS running in Mininet and compile intents" +\
1061 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001062
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001063 # No option point intents
1064 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001065 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001066 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001067 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001068 ]
1069 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001070 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001071 ]
Jeremy42df2e72016-02-23 16:37:46 -08001072 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001073 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001074 main,
1075 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001076 senders=senders,
1077 recipients=recipients )
1078
1079 if installResult:
1080 testResult = main.intentFunction.testPointIntent(
1081 main,
1082 intentId=installResult,
1083 name="NOOPTION",
1084 senders=senders,
1085 recipients=recipients,
1086 sw1="s5",
1087 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001088 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001089 else:
1090 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001091
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001092 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001093 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001094 onpass=main.assertReturnString,
1095 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001096
kelvin-onlabb769f562015-07-15 17:05:10 -07001097 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001098 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001099 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001100 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001101 ]
1102 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001103 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001104 ]
Jeremy42df2e72016-02-23 16:37:46 -08001105 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001106 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001107 main,
1108 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001109 senders=senders,
1110 recipients=recipients,
1111 ethType="IPV4" )
1112
1113 if installResult:
1114 testResult = main.intentFunction.testPointIntent(
1115 main,
1116 intentId=installResult,
1117 name="IPV4",
1118 senders=senders,
1119 recipients=recipients,
1120 sw1="s5",
1121 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001122 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001123 else:
1124 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001125
1126 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001127 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001128 onpass=main.assertReturnString,
1129 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -08001130
1131 main.step("Protected: Add point intents between h1 and h9")
1132 main.assertReturnString = "Assertion Result for protected point intent\n"
1133 senders = [
1134 {"name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01"}
1135 ]
1136 recipients = [
1137 {"name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09"}
1138 ]
1139 testResult = main.FALSE
1140 installResult = main.intentFunction.installPointIntent(
1141 main,
1142 name="Protected",
1143 senders=senders,
1144 recipients=recipients,
1145 protected=True )
1146
1147 if installResult:
1148 testResult = main.intentFunction.testPointIntent(
1149 main,
1150 name="Protected",
1151 intentId=installResult,
1152 senders=senders,
1153 recipients=recipients,
1154 sw1="s5",
1155 sw2="s2",
1156 protected=True,
1157 expectedLink=18 )
1158 else:
1159 main.CLIs[ 0 ].removeAllIntents( purge=True )
1160
1161 utilities.assert_equals( expect=main.TRUE,
1162 actual=testResult,
1163 onpass=main.assertReturnString,
1164 onfail=main.assertReturnString )
1165
kelvin-onlabb769f562015-07-15 17:05:10 -07001166 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001167 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001168 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001169 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001170 ]
1171 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001172 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001173 ]
Jeremy42df2e72016-02-23 16:37:46 -08001174 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001175 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001176 main,
1177 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001178 senders=senders,
1179 recipients=recipients,
1180 ethType="IPV4" )
1181
1182 if installResult:
1183 testResult = main.intentFunction.testPointIntent(
1184 main,
1185 intentId=installResult,
1186 name="IPV4_2",
1187 senders=senders,
1188 recipients=recipients,
1189 sw1="s5",
1190 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001191 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001192 else:
1193 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001194
1195 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001196 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001197 onpass=main.assertReturnString,
1198 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001199
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001200 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001201 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001202 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001203 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001204 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001205 ]
1206 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001207 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001208 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001209 ]
Jeremy6f000c62016-02-25 17:02:28 -08001210 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001211 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001212 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1213 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001214 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001215 installResult = main.intentFunction.installPointIntent(
1216 main,
1217 name="SDNIP-ICMP",
1218 senders=senders,
1219 recipients=recipients,
1220 ethType="IPV4",
1221 ipProto=ipProto,
1222 tcpSrc=tcpSrc,
1223 tcpDst=tcpDst )
1224
1225 if installResult:
1226 testResult = main.intentFunction.testPointIntent(
1227 main,
1228 intentId=installResult,
1229 name="SDNIP_ICMP",
1230 senders=senders,
1231 recipients=recipients,
1232 sw1="s5",
1233 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001234 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001235 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -08001236 else:
1237 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001238
1239 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001240 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001241 onpass=main.assertReturnString,
1242 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001243
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001244 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001245 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001246 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1247 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001248 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1249 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001250 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1251 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1252 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1253
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001254 stepResult = main.intentFunction.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001255 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001256 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001257 host1="h1",
1258 host2="h9",
1259 deviceId1="of:0000000000000005/1",
1260 deviceId2="of:0000000000000006/1",
1261 mac1=mac1,
1262 mac2=mac2,
1263 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001264 ipProto=ipProto,
1265 ip1=ip1,
1266 ip2=ip2,
1267 tcp1=tcp1,
1268 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001269
1270 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001271 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001272 onpass=main.assertReturnString,
1273 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001274
acsmars5d8cc862015-09-25 09:44:50 -07001275 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1276 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001277 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001278 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001279 ]
1280 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001281 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001282 ]
Jeremy42df2e72016-02-23 16:37:46 -08001283 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001284 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001285 main,
1286 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001287 senders=senders,
1288 recipients=recipients,
1289 ethType="IPV4" )
1290
1291 if installResult:
1292 testResult = main.intentFunction.testPointIntent(
1293 main,
1294 intentId=installResult,
1295 name="DUALSTACK1",
1296 senders=senders,
1297 recipients=recipients,
1298 sw1="s5",
1299 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001300 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001301 else:
1302 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001303
1304 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001305 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001306 onpass=main.assertReturnString,
1307 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001308
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001309 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001310 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001311 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001312 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001313 ]
1314 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001315 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001316 ]
Jeremy42df2e72016-02-23 16:37:46 -08001317 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001318 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001319 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001320 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001321 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001322 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001323
1324 if installResult:
1325 testResult = main.intentFunction.testPointIntent(
1326 main,
1327 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001328 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001329 senders=senders,
1330 recipients=recipients,
1331 sw1="s5",
1332 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001333 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001334
1335 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001336 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001337 onpass=main.assertReturnString,
1338 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001339
Jeremy Songsterff553672016-05-12 17:06:23 -07001340 main.step( "VLAN: Add point intents between h5 and h21" )
1341 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1342 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001343 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001344 ]
1345 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001346 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001347 ]
1348 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -07001349 installResult = main.intentFunction.installPointIntent(
1350 main,
1351 name="VLAN2",
1352 senders=senders,
1353 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001354 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001355
1356 if installResult:
1357 testResult = main.intentFunction.testPointIntent(
1358 main,
1359 intentId=installResult,
1360 name="VLAN2",
1361 senders=senders,
1362 recipients=recipients,
1363 sw1="s5",
1364 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001365 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001366
1367 utilities.assert_equals( expect=main.TRUE,
1368 actual=testResult,
1369 onpass=main.assertReturnString,
1370 onfail=main.assertReturnString )
1371
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001372 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001373 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001374 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001375 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001376 ]
1377 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001378 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001379 ]
Jeremy42df2e72016-02-23 16:37:46 -08001380 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001381 installResult = main.intentFunction.installPointIntent(
1382 main,
1383 name="1HOP IPV4",
1384 senders=senders,
1385 recipients=recipients,
1386 ethType="IPV4" )
1387
1388 if installResult:
1389 testResult = main.intentFunction.testPointIntent(
1390 main,
1391 intentId=installResult,
1392 name="1HOP IPV4",
1393 senders=senders,
1394 recipients=recipients,
1395 sw1="s5",
1396 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001397 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001398 else:
1399 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001400
1401 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001402 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001403 onpass=main.assertReturnString,
1404 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001405
Jeremy Songsterc032f162016-08-04 17:14:49 -07001406 main.step( "Add point to point intents using VLAN Encapsulation" )
1407 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1408 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001409 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001410 ]
1411 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001412 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001413 ]
1414 testResult = main.FALSE
Jeremy Songsterc032f162016-08-04 17:14:49 -07001415 installResult = main.intentFunction.installPointIntent(
1416 main,
1417 name="ENCAPSULATION",
1418 senders=senders,
1419 recipients=recipients,
1420 encap="VLAN" )
1421
1422 if installResult:
1423 testResult = main.intentFunction.testPointIntent(
1424 main,
1425 intentId=installResult,
1426 name="ENCAPSULATION",
1427 senders=senders,
1428 recipients=recipients,
1429 sw1="s5",
1430 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001431 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001432 else:
1433 main.CLIs[ 0 ].removeAllIntents( purge=True )
1434
1435 utilities.assert_equals( expect=main.TRUE,
1436 actual=testResult,
1437 onpass=main.assertReturnString,
1438 onfail=main.assertReturnString )
1439
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001440 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1441 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1442 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001443 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001444 ]
1445 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001446 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001447 ]
1448 testResult = main.FALSE
1449 installResult = main.intentFunction.installPointIntent(
1450 main,
1451 name="NOOPTION",
1452 senders=senders,
1453 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001454 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001455
1456 if installResult:
1457 testResult = main.intentFunction.testPointIntent(
1458 main,
1459 intentId=installResult,
1460 name="NOOPTION",
1461 senders=senders,
1462 recipients=recipients,
1463 sw1="s5",
1464 sw2="s2",
1465 expectedLink=18 )
1466 else:
1467 main.CLIs[ 0 ].removeAllIntents( purge=True )
1468
1469 utilities.assert_equals( expect=main.TRUE,
1470 actual=testResult,
1471 onpass=main.assertReturnString,
1472 onfail=main.assertReturnString )
1473
Shreyaca8990f2017-03-16 11:43:11 -07001474 # Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
alison52b25892016-09-19 10:53:48 -07001475 # main.step( "Add point to point intents using MPLS Encapsulation" )
1476 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1477 # senders = [
1478 # { "name": "h1", "device": "of:0000000000000005/1" }
1479 # ]
1480 # recipients = [
1481 # { "name": "h9", "device": "of:0000000000000006/1" }
1482 # ]
1483 # testResult = main.FALSE
1484 # installResult = main.intentFunction.installPointIntent(
1485 # main,
1486 # name="ENCAPSULATION",
1487 # senders=senders,
1488 # recipients=recipients,
1489 # encap="MPLS" )
1490 #
1491 # if installResult:
1492 # testResult = main.intentFunction.testPointIntent(
1493 # main,
1494 # intentId=installResult,
1495 # name="ENCAPSULATION",
1496 # senders=senders,
1497 # recipients=recipients,
1498 # sw1="s5",
1499 # sw2="s2",
1500 # expectedLink=18 )
1501 # else:
1502 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1503 #
1504 # utilities.assert_equals( expect=main.TRUE,
1505 # actual=testResult,
1506 # onpass=main.assertReturnString,
1507 # onfail=main.assertReturnString )
1508
kelvin-onlab016dce22015-08-10 09:54:11 -07001509 main.intentFunction.report( main )
1510
kelvin-onlabb769f562015-07-15 17:05:10 -07001511 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001512 """
1513 Add single point to multi point intents
1514 - Get device ids
1515 - Add single point to multi point intents
1516 - Check intents
1517 - Verify flows
1518 - Ping hosts
1519 - Reroute
1520 - Link down
1521 - Verify flows
1522 - Check topology
1523 - Ping hosts
1524 - Link up
1525 - Verify flows
1526 - Check topology
1527 - Ping hosts
1528 - Remove intents
1529 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001530 if main.initialized == main.FALSE:
1531 main.log.error( "Test components did not start correctly, skipping further tests" )
1532 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001533 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001534 try:
1535 assert main.CLIs
1536 except AssertionError:
1537 main.log.error( "There is no main.CLIs, skipping test cases" )
1538 main.initialized = main.FALSE
1539 main.skipCase()
1540 try:
1541 assert main.Mininet1
1542 except AssertionError:
1543 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1544 main.initialized = main.FALSE
1545 main.skipCase()
1546 try:
1547 assert main.numSwitch
1548 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001549 main.log.error( "Place the total number of switch topology in "+ \
1550 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001551 main.initialized = main.FALSE
1552 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001553
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001554 main.testName = "Single to Multi Point Intents"
1555 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001556 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001557 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001558 " multi point intents using " +\
1559 str( main.numCtrls ) + " node(s) cluster;\n" +\
1560 "Different type of hosts will be tested in " +\
1561 "each step such as IPV4, Dual stack, VLAN etc" +\
1562 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001563 " OVS running in Mininet and compile intents" +\
1564 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001565
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001566 main.step( "NOOPTION: Install and test single point to multi point intents" )
1567 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1568 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001569 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001570 ]
1571 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001572 { "name": "h16", "device": "of:0000000000000006/8" },
1573 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001574 ]
Jon Hall9c888672017-05-15 18:03:54 -07001575 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1576 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001577 testResult = main.FALSE
1578 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001579 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001580 name="NOOPTION",
1581 senders=senders,
1582 recipients=recipients,
1583 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001584 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001585
1586 if installResult:
1587 testResult = main.intentFunction.testPointIntent(
1588 main,
1589 intentId=installResult,
1590 name="NOOPTION",
1591 senders=senders,
1592 recipients=recipients,
1593 badSenders=badSenders,
1594 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001595 sw1="s5",
1596 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001597 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001598 else:
1599 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001600
1601 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001602 actual=testResult,
1603 onpass=main.assertReturnString,
1604 onfail=main.assertReturnString )
1605
1606 main.step( "IPV4: Install and test single point to multi point intents" )
1607 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1608 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001609 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001610 ]
1611 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001612 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1613 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001614 ]
Jon Hall9c888672017-05-15 18:03:54 -07001615 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1616 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001617 testResult = main.FALSE
1618 installResult = main.intentFunction.installSingleToMultiIntent(
1619 main,
1620 name="IPV4",
1621 senders=senders,
1622 recipients=recipients,
1623 ethType="IPV4",
1624 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001625 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001626
1627 if installResult:
1628 testResult = main.intentFunction.testPointIntent(
1629 main,
1630 intentId=installResult,
1631 name="IPV4",
1632 senders=senders,
1633 recipients=recipients,
1634 badSenders=badSenders,
1635 badRecipients=badRecipients,
1636 sw1="s5",
1637 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001638 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001639 else:
1640 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001641
1642 utilities.assert_equals( expect=main.TRUE,
1643 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001644 onpass=main.assertReturnString,
1645 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001646
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001647 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001648 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 -08001649 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001650 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001651 ]
1652 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001653 { "name": "h16", "device": "of:0000000000000006/8" },
1654 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001655 ]
Jon Hall9c888672017-05-15 18:03:54 -07001656 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1657 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001658 testResult = main.FALSE
1659 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001660 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001661 name="IPV4_2",
1662 senders=senders,
1663 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001664 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001665 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001666 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001667
1668 if installResult:
1669 testResult = main.intentFunction.testPointIntent(
1670 main,
1671 intentId=installResult,
1672 name="IPV4_2",
1673 senders=senders,
1674 recipients=recipients,
1675 badSenders=badSenders,
1676 badRecipients=badRecipients,
1677 sw1="s5",
1678 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001679 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001680 else:
1681 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001682
1683 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001684 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001685 onpass=main.assertReturnString,
1686 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001687
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001688 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001689 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 -08001690 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001691 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001692 ]
1693 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001694 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1695 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001696 ]
Jon Hall9c888672017-05-15 18:03:54 -07001697 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1698 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001699 testResult = main.FALSE
1700 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001701 main,
alison52b25892016-09-19 10:53:48 -07001702 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001703 senders=senders,
1704 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001705 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001706 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001707
1708 if installResult:
1709 testResult = main.intentFunction.testPointIntent(
1710 main,
1711 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001712 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001713 senders=senders,
1714 recipients=recipients,
1715 badSenders=badSenders,
1716 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001717 sw1="s5",
1718 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001719 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001720 else:
1721 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001722
1723 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001724 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001725 onpass=main.assertReturnString,
1726 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001727
Jeremy Songsterff553672016-05-12 17:06:23 -07001728 main.step( "VLAN: Add single point to multi point intents" )
1729 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1730 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001731 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001732 ]
1733 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001734 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1735 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001736 ]
Jon Hall9c888672017-05-15 18:03:54 -07001737 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1738 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001739 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -07001740 installResult = main.intentFunction.installSingleToMultiIntent(
1741 main,
1742 name="VLAN2",
1743 senders=senders,
1744 recipients=recipients,
1745 sw1="s5",
1746 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001747 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001748
1749 if installResult:
1750 testResult = main.intentFunction.testPointIntent(
1751 main,
1752 intentId=installResult,
1753 name="VLAN2",
1754 senders=senders,
1755 recipients=recipients,
1756 badSenders=badSenders,
1757 badRecipients=badRecipients,
1758 sw1="s5",
1759 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001760 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001761 else:
1762 main.CLIs[ 0 ].removeAllIntents( purge=True )
1763
1764 utilities.assert_equals( expect=main.TRUE,
1765 actual=testResult,
1766 onpass=main.assertReturnString,
1767 onfail=main.assertReturnString )
1768
alison52b25892016-09-19 10:53:48 -07001769 # Does not support Single point to multi point encapsulation
1770 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1771 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1772 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001773 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001774 # ]
1775 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001776 # { "name": "h16", "device": "of:0000000000000006/8" },
1777 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001778 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001779 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1780 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001781 # testResult = main.FALSE
1782 # installResult = main.intentFunction.installSingleToMultiIntent(
1783 # main,
1784 # name="ENCAPSULATION",
1785 # senders=senders,
1786 # recipients=recipients,
1787 # sw1="s5",
1788 # sw2="s2",
1789 # encap="VLAN" )
1790 #
1791 # if installResult:
1792 # testResult = main.intentFunction.testPointIntent(
1793 # main,
1794 # intentId=installResult,
1795 # name="ENCAPSULATION",
1796 # senders=senders,
1797 # recipients=recipients,
1798 # badSenders=badSenders,
1799 # badRecipients=badRecipients,
1800 # sw1="s5",
1801 # sw2="s2",
1802 # expectedLink=18 )
1803 # else:
1804 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1805 #
1806 # utilities.assert_equals( expect=main.TRUE,
1807 # actual=testResult,
1808 # onpass=main.assertReturnString,
1809 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001810
kelvin-onlab016dce22015-08-10 09:54:11 -07001811 main.intentFunction.report( main )
1812
kelvin-onlabb769f562015-07-15 17:05:10 -07001813 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001814 """
1815 Add multi point to single point intents
1816 - Get device ids
1817 - Add multi point to single point intents
1818 - Check intents
1819 - Verify flows
1820 - Ping hosts
1821 - Reroute
1822 - Link down
1823 - Verify flows
1824 - Check topology
1825 - Ping hosts
1826 - Link up
1827 - Verify flows
1828 - Check topology
1829 - Ping hosts
1830 - Remove intents
1831 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001832 if main.initialized == main.FALSE:
1833 main.log.error( "Test components did not start correctly, skipping further tests" )
1834 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001835 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001836 try:
1837 assert main.CLIs
1838 except AssertionError:
1839 main.log.error( "There is no main.CLIs, skipping test cases" )
1840 main.initialized = main.FALSE
1841 main.skipCase()
1842 try:
1843 assert main.Mininet1
1844 except AssertionError:
1845 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1846 main.initialized = main.FALSE
1847 main.skipCase()
1848 try:
1849 assert main.numSwitch
1850 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001851 main.log.error( "Place the total number of switch topology in "+\
1852 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001853 main.initialized = main.FALSE
1854 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001855
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001856 main.testName = "Multi To Single Point Intents"
1857 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001858 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001859 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001860 " multi point intents using " +\
1861 str( main.numCtrls ) + " node(s) cluster;\n" +\
1862 "Different type of hosts will be tested in " +\
1863 "each step such as IPV4, Dual stack, VLAN etc" +\
1864 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001865 " OVS running in Mininet and compile intents" +\
1866 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001867
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001868 main.step( "NOOPTION: Add multi point to single point intents" )
1869 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1870 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001871 { "name": "h16", "device": "of:0000000000000006/8" },
1872 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001873 ]
1874 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001875 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001876 ]
Jon Hall9c888672017-05-15 18:03:54 -07001877 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1878 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001879 testResult = main.FALSE
1880 installResult = main.intentFunction.installMultiToSingleIntent(
1881 main,
1882 name="NOOPTION",
1883 senders=senders,
1884 recipients=recipients,
1885 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001886 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001887
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001888 if installResult:
1889 testResult = main.intentFunction.testPointIntent(
1890 main,
1891 intentId=installResult,
1892 name="NOOPTION",
1893 senders=senders,
1894 recipients=recipients,
1895 badSenders=badSenders,
1896 badRecipients=badRecipients,
1897 sw1="s5",
1898 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001899 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001900 else:
1901 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001902
1903 utilities.assert_equals( expect=main.TRUE,
1904 actual=testResult,
1905 onpass=main.assertReturnString,
1906 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001907
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001908 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001909 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 -08001910 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001911 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1912 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001913 ]
1914 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001915 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001916 ]
Jon Hall9c888672017-05-15 18:03:54 -07001917 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1918 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001919 testResult = main.FALSE
1920 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001921 main,
1922 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001923 senders=senders,
1924 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001925 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001926 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001927 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001928
1929 if installResult:
1930 testResult = main.intentFunction.testPointIntent(
1931 main,
1932 intentId=installResult,
1933 name="IPV4",
1934 senders=senders,
1935 recipients=recipients,
1936 badSenders=badSenders,
1937 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001938 sw1="s5",
1939 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001940 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001941 else:
1942 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001943
1944 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001945 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001946 onpass=main.assertReturnString,
1947 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001948
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001949 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001950 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 -08001951 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001952 { "name": "h16", "device": "of:0000000000000006/8" },
1953 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001954 ]
1955 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001956 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001957 ]
Jon Hall9c888672017-05-15 18:03:54 -07001958 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1959 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001960 testResult = main.FALSE
1961 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001962 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001963 name="IPV4_2",
1964 senders=senders,
1965 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001966 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001967 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001968 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001969
1970 if installResult:
1971 testResult = main.intentFunction.testPointIntent(
1972 main,
1973 intentId=installResult,
1974 name="IPV4_2",
1975 senders=senders,
1976 recipients=recipients,
1977 badSenders=badSenders,
1978 badRecipients=badRecipients,
1979 sw1="s5",
1980 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001981 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001982 else:
1983 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001984
1985 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001986 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001987 onpass=main.assertReturnString,
1988 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001989
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001990 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001991 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 -08001992 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001993 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1994 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001995 ]
1996 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001997 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001998 ]
Jon Hall9c888672017-05-15 18:03:54 -07001999 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
2000 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002001 testResult = main.FALSE
2002 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002003 main,
2004 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002005 senders=senders,
2006 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002007 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002008 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002009
2010 if installResult:
2011 testResult = main.intentFunction.testPointIntent(
2012 main,
2013 intentId=installResult,
2014 name="VLAN",
2015 senders=senders,
2016 recipients=recipients,
2017 badSenders=badSenders,
2018 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002019 sw1="s5",
2020 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002021 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002022 else:
2023 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002024
2025 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002026 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002027 onpass=main.assertReturnString,
2028 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002029
Jeremy Songsterff553672016-05-12 17:06:23 -07002030 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
2031 main.step( "VLAN: Add multi point to single point intents" )
2032 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
2033 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002034 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
2035 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002036 ]
2037 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002038 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002039 ]
Jon Hall9c888672017-05-15 18:03:54 -07002040 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
2041 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07002042 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -07002043 installResult = main.intentFunction.installMultiToSingleIntent(
2044 main,
2045 name="VLAN2",
2046 senders=senders,
2047 recipients=recipients,
2048 sw1="s5",
2049 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002050 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002051
2052 if installResult:
2053 testResult = main.intentFunction.testPointIntent(
2054 main,
2055 intentId=installResult,
2056 name="VLAN2",
2057 senders=senders,
2058 recipients=recipients,
2059 badSenders=badSenders,
2060 badRecipients=badRecipients,
2061 sw1="s5",
2062 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002063 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002064 else:
2065 main.CLIs[ 0 ].removeAllIntents( purge=True )
2066
2067 utilities.assert_equals( expect=main.TRUE,
2068 actual=testResult,
2069 onpass=main.assertReturnString,
2070 onfail=main.assertReturnString )
2071
Jeremy Songsterc032f162016-08-04 17:14:49 -07002072 main.step( "ENCAPSULATION: Add multi point to single point intents" )
2073 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
2074 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002075 { "name": "h16", "device": "of:0000000000000006/8" },
2076 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002077 ]
2078 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002079 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002080 ]
Jon Hall9c888672017-05-15 18:03:54 -07002081 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2082 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07002083 testResult = main.FALSE
Jeremy Songsterc032f162016-08-04 17:14:49 -07002084 installResult = main.intentFunction.installMultiToSingleIntent(
2085 main,
2086 name="ENCAPSULATION",
2087 senders=senders,
2088 recipients=recipients,
2089 sw1="s5",
2090 sw2="s2",
2091 encap="VLAN" )
2092
2093 if installResult:
2094 testResult = main.intentFunction.testPointIntent(
2095 main,
2096 intentId=installResult,
2097 name="ENCAPSULATION",
2098 senders=senders,
2099 recipients=recipients,
2100 badSenders=badSenders,
2101 badRecipients=badRecipients,
2102 sw1="s5",
2103 sw2="s2",
2104 expectedLink=18 )
2105 else:
2106 main.CLIs[ 0 ].removeAllIntents( purge=True )
2107
2108 utilities.assert_equals( expect=main.TRUE,
2109 actual=testResult,
2110 onpass=main.assertReturnString,
2111 onfail=main.assertReturnString )
2112
Shreyaca8990f2017-03-16 11:43:11 -07002113 #Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
2114 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
2115 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
2116 #senders = [
2117 # { "name": "h16", "device": "of:0000000000000006/8" },
2118 # { "name": "h24", "device": "of:0000000000000007/8" }
2119 #]
2120 #recipients = [
2121 # { "name": "h8", "device": "of:0000000000000005/8" }
2122 #]
2123 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2124 #badRecipients = [ {"name": "h9" } ] # Recipients that are not in the intent
2125 #testResult = main.FALSE
2126 #installResult = main.intentFunction.installMultiToSingleIntent(
2127 # main,
2128 # name="ENCAPSULATION",
2129 # senders=senders,
2130 # recipients=recipients,
2131 # sw1="s5",
2132 # sw2="s2",
2133 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07002134 #
Shreyaca8990f2017-03-16 11:43:11 -07002135 #if installResult:
2136 # testResult = main.intentFunction.testPointIntent(
2137 # main,
2138 # intentId=installResult,
2139 # name="ENCAPSULATION",
2140 # senders=senders,
2141 # recipients=recipients,
2142 # badSenders=badSenders,
2143 # badRecipients=badRecipients,
2144 # sw1="s5",
2145 # sw2="s2",
2146 # expectedLink=18 )
2147 #else:
2148 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07002149 #
Shreyaca8990f2017-03-16 11:43:11 -07002150 #utilities.assert_equals( expect=main.TRUE,
2151 # actual=testResult,
2152 # onpass=main.assertReturnString,
2153 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07002154
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002155 main.intentFunction.report( main )
2156
acsmars1ff5e052015-07-23 11:27:48 -07002157 def CASE5000( self, main ):
2158 """
acsmars5d8cc862015-09-25 09:44:50 -07002159 Tests Host Mobility
2160 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002161 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002162 if main.initialized == main.FALSE:
2163 main.log.error( "Test components did not start correctly, skipping further tests" )
2164 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002165 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002166 try:
2167 assert main.CLIs
2168 except AssertionError:
2169 main.log.error( "There is no main.CLIs, skipping test cases" )
2170 main.initialized = main.FALSE
2171 main.skipCase()
2172 try:
2173 assert main.Mininet1
2174 except AssertionError:
2175 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2176 main.initialized = main.FALSE
2177 main.skipCase()
2178 try:
2179 assert main.numSwitch
2180 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002181 main.log.error( "Place the total number of switch topology in "+\
2182 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002183 main.initialized = main.FALSE
2184 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002185 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
2186 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002187 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002188
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002189 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07002190 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002191
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002192 # Send discovery ping from moved host
2193 # Moving the host brings down the default interfaces and creates a new one.
2194 # Scapy is restarted on this host to detect the new interface
2195 main.h1.stopScapy()
2196 main.h1.startScapy()
2197
2198 # Discover new host location in ONOS and populate host data.
2199 # Host 1 IP and MAC should be unchanged
2200 main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
2201 main.intentFunction.populateHostData( main )
2202
acsmars1ff5e052015-07-23 11:27:48 -07002203 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2204
2205 utilities.assert_equals( expect="of:0000000000000006",
2206 actual=h1PostMove,
2207 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002208 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002209 " to single point intents" +
2210 " with IPV4 type and MAC addresses" +
2211 " in the same VLAN" )
2212
2213 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002214 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07002215 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
2216 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002217 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002218 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -07002219 name="IPV4 Mobility IPV4",
2220 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002221 host1=host1,
Jeremye0cb5eb2016-01-27 17:39:09 -08002222 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002223 if installResult:
2224 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -07002225 name="Host Mobility IPV4",
Jon Hall9c888672017-05-15 18:03:54 -07002226 intentId=installResult,
alison52b25892016-09-19 10:53:48 -07002227 onosNode=0,
Jeremy2f190ca2016-01-29 15:23:57 -08002228 host1=host1,
2229 host2=host2,
2230 sw1="s6",
2231 sw2="s2",
2232 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002233 else:
2234 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002235
2236 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002237 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002238 onpass=main.assertReturnString,
2239 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002240
2241 main.intentFunction.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002242
2243 def CASE6000( self, main ):
2244 """
2245 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2246 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002247 # At some later point discussion on this behavior in MPSP and SPMP intents
2248 # will be reoppened and this test case may need to be updated to reflect
2249 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002250 if main.initialized == main.FALSE:
2251 main.log.error( "Test components did not start correctly, skipping further tests" )
2252 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002253 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002254 try:
2255 assert main.CLIs
2256 except AssertionError:
2257 main.log.error( "There is no main.CLIs, skipping test cases" )
2258 main.initialized = main.FALSE
2259 main.skipCase()
2260 try:
2261 assert main.Mininet1
2262 except AssertionError:
2263 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2264 main.initialized = main.FALSE
2265 main.skipCase()
2266 try:
2267 assert main.numSwitch
2268 except AssertionError:
alison52b25892016-09-19 10:53:48 -07002269 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002270 main.initialized = main.FALSE
2271 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002272 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
2273 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07002274 main.step( "Installing Multi to Single Point intents with no options set" )
2275 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2276 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002277 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002278 { "name": "h16", "device": "of:0000000000000006/8" },
2279 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002280 ]
2281 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002282 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002283 ]
2284 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002285 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002286 ]
2287 isolatedRecipients = []
2288 testResult = main.FALSE
2289 installResult = main.intentFunction.installMultiToSingleIntent(
2290 main,
2291 name="NOOPTION",
2292 senders=senders,
2293 recipients=recipients,
2294 sw1="s5",
2295 sw2="s2" )
2296
2297 if installResult:
2298 testResult = main.intentFunction.testEndPointFail(
2299 main,
2300 intentId=installResult,
2301 name="NOOPTION",
2302 senders=senders,
2303 recipients=recipients,
2304 isolatedSenders=isolatedSenders,
2305 isolatedRecipients=isolatedRecipients,
2306 sw1="s6",
2307 sw2="s2",
2308 sw3="s4",
2309 sw4="s1",
2310 sw5="s3",
2311 expectedLink1=16,
2312 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002313 else:
2314 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002315
2316 utilities.assert_equals( expect=main.TRUE,
2317 actual=testResult,
2318 onpass=main.assertReturnString,
2319 onfail=main.assertReturnString )
2320
Jeremy Songster9385d412016-06-02 17:57:36 -07002321 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2322
2323 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2324 "with partial failures allowed\n"
2325 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002326 { "name": "h16", "device": "of:0000000000000006/8" },
2327 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002328 ]
2329 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002330 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002331 ]
2332 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002333 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002334 ]
2335 isolatedRecipients = []
2336 testResult = main.FALSE
Jeremy Songster9385d412016-06-02 17:57:36 -07002337 installResult = main.intentFunction.installMultiToSingleIntent(
2338 main,
2339 name="NOOPTION",
2340 senders=senders,
2341 recipients=recipients,
2342 sw1="s5",
2343 sw2="s2",
2344 partial=True )
2345
2346 if installResult:
2347 testResult = main.intentFunction.testEndPointFail(
2348 main,
2349 intentId=installResult,
2350 name="NOOPTION",
2351 senders=senders,
2352 recipients=recipients,
2353 isolatedSenders=isolatedSenders,
2354 isolatedRecipients=isolatedRecipients,
2355 sw1="s6",
2356 sw2="s2",
2357 sw3="s4",
2358 sw4="s1",
2359 sw5="s3",
2360 expectedLink1=16,
2361 expectedLink2=14,
2362 partial=True )
2363 else:
2364 main.CLIs[ 0 ].removeAllIntents( purge=True )
2365
2366 utilities.assert_equals( expect=main.TRUE,
2367 actual=testResult,
2368 onpass=main.assertReturnString,
2369 onfail=main.assertReturnString )
2370
Jeremye0cb5eb2016-01-27 17:39:09 -08002371 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002372 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2373 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002374 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002375 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002376 ]
2377 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002378 { "name": "h16", "device": "of:0000000000000006/8" },
2379 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002380 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002381 isolatedSenders = []
2382 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002383 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002384 ]
2385 testResult = main.FALSE
2386 installResult = main.intentFunction.installSingleToMultiIntent(
2387 main,
2388 name="NOOPTION",
2389 senders=senders,
2390 recipients=recipients,
2391 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002392 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002393
2394 if installResult:
2395 testResult = main.intentFunction.testEndPointFail(
2396 main,
2397 intentId=installResult,
2398 name="NOOPTION",
2399 senders=senders,
2400 recipients=recipients,
2401 isolatedSenders=isolatedSenders,
2402 isolatedRecipients=isolatedRecipients,
2403 sw1="s6",
2404 sw2="s2",
2405 sw3="s4",
2406 sw4="s1",
2407 sw5="s3",
2408 expectedLink1=16,
2409 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002410 else:
2411 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002412
2413 utilities.assert_equals( expect=main.TRUE,
2414 actual=testResult,
2415 onpass=main.assertReturnString,
2416 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002417 # Right now this functionality doesn't work properly in SPMP intents
2418 main.step( "NOOPTION: Install and test single point to multi point " +\
2419 "intents with partial failures allowed" )
2420 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2421 "point intent with partial failures allowed\n"
2422 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002423 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002424 ]
2425 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002426 { "name": "h16", "device": "of:0000000000000006/8" },
2427 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002428 ]
2429 isolatedSenders = []
2430 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002431 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002432 ]
2433 testResult = main.FALSE
Jeremy Songster9385d412016-06-02 17:57:36 -07002434 installResult = main.intentFunction.installSingleToMultiIntent(
2435 main,
2436 name="NOOPTION",
2437 senders=senders,
2438 recipients=recipients,
2439 sw1="s5",
2440 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002441 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002442
2443 if installResult:
2444 testResult = main.intentFunction.testEndPointFail(
2445 main,
2446 intentId=installResult,
2447 name="NOOPTION",
2448 senders=senders,
2449 recipients=recipients,
2450 isolatedSenders=isolatedSenders,
2451 isolatedRecipients=isolatedRecipients,
2452 sw1="s6",
2453 sw2="s2",
2454 sw3="s4",
2455 sw4="s1",
2456 sw5="s3",
2457 expectedLink1=16,
2458 expectedLink2=14,
2459 partial=True )
2460 else:
2461 main.CLIs[ 0 ].removeAllIntents( purge=True )
2462
2463 utilities.assert_equals( expect=main.TRUE,
2464 actual=testResult,
2465 onpass=main.assertReturnString,
2466 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002467
Chiyu Chengef109502016-11-21 15:51:38 -08002468 main.intentFunction.report( main )