blob: 228f9f95a64c01fed4171a3052faf1cb5656d5d4 [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()
Jon Hall860b8152017-05-23 10:35:23 -070069 main.log.debug( "Found ONOS ips: {}".format( 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" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700166 for i in range( main.maxNodes ):
167 main.ONOSbench.onosDie( main.ONOSip[ i ] )
168
Jon Hall860b8152017-05-23 10:35:23 -0700169 main.log.debug( "NODE COUNT = " + str( main.numCtrls ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700170
171 tempOnosIp = []
172 for i in range( main.numCtrls ):
173 tempOnosIp.append( main.ONOSip[i] )
174
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700175 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
176 "temp", main.Mininet1.ip_address,
177 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700178
179 main.step( "Apply cell to environment" )
180 cellResult = main.ONOSbench.setCell( "temp" )
181 verifyResult = main.ONOSbench.verifyCell()
182 stepResult = cellResult and verifyResult
183 utilities.assert_equals( expect=main.TRUE,
184 actual=stepResult,
185 onpass="Successfully applied cell to " + \
186 "environment",
187 onfail="Failed to apply cell to environment " )
188
189 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700190 packageResult = main.ONOSbench.buckBuild()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700191 stepResult = packageResult
192 utilities.assert_equals( expect=main.TRUE,
193 actual=stepResult,
194 onpass="Successfully created ONOS package",
195 onfail="Failed to create ONOS package" )
196
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700197 main.step( "Installing ONOS package" )
198 onosInstallResult = main.TRUE
199 for i in range( main.numCtrls ):
200 onosInstallResult = onosInstallResult and \
201 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
202 stepResult = onosInstallResult
203 utilities.assert_equals( expect=main.TRUE,
204 actual=stepResult,
205 onpass="Successfully installed ONOS package",
206 onfail="Failed to install ONOS package" )
207
You Wangf5de25b2017-01-06 15:13:01 -0800208 main.step( "Set up ONOS secure SSH" )
209 secureSshResult = main.TRUE
210 for i in range( int( main.numCtrls ) ):
211 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
212 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
213 onpass="Test step PASS",
214 onfail="Test step FAIL" )
215
Jon Hallf539eb92017-05-22 17:18:42 -0700216 main.log.info( "Sleeping {} seconds".format( main.startUpSleep ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700217 time.sleep( main.startUpSleep )
Jon Hall860b8152017-05-23 10:35:23 -0700218 main.step( "Checking ONOS is running" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700219 stopResult = main.TRUE
220 startResult = main.TRUE
221 onosIsUp = main.TRUE
222
223 for i in range( main.numCtrls ):
Jeremy Songster7edb6632016-04-28 15:44:28 -0700224 isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
225 onosIsUp = onosIsUp and isUp
226 if isUp == main.TRUE:
Jeremyd9e4eb12016-04-13 12:09:06 -0700227 main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
228 else:
229 main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
230 "start ONOS again " )
231 stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
232 startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
233 if not startResult or stopResult:
234 main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700235 stepResult = onosIsUp and stopResult and startResult
236 utilities.assert_equals( expect=main.TRUE,
237 actual=stepResult,
Jeremyd9e4eb12016-04-13 12:09:06 -0700238 onpass="ONOS service is ready on all nodes",
239 onfail="ONOS service did not start properly on all nodes" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700240
241 main.step( "Start ONOS cli" )
242 cliResult = main.TRUE
243 for i in range( main.numCtrls ):
244 cliResult = cliResult and \
245 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
246 stepResult = cliResult
247 utilities.assert_equals( expect=main.TRUE,
248 actual=stepResult,
249 onpass="Successfully start ONOS cli",
250 onfail="Failed to start ONOS cli" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700251 if not stepResult:
252 main.initialized = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700253
254 # Remove the first element in main.scale list
255 main.scale.remove( main.scale[ 0 ] )
256
kelvin-onlab016dce22015-08-10 09:54:11 -0700257 main.intentFunction.report( main )
258
Jon Halla3e02432015-07-24 15:55:42 -0700259 def CASE8( self, main ):
260 """
acsmars59a4c552015-09-10 18:11:19 -0700261 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700262 """
263 import json
264
265 main.case( "Compare ONOS Topology view to Mininet topology" )
266 main.caseExplanation = "Compare topology elements between Mininet" +\
267 " and ONOS"
268
acsmars59a4c552015-09-10 18:11:19 -0700269 main.log.info( "Gathering topology information from Mininet" )
270 devicesResults = main.FALSE # Overall Boolean for device correctness
271 linksResults = main.FALSE # Overall Boolean for link correctness
272 hostsResults = main.FALSE # Overall Boolean for host correctness
273 deviceFails = [] # Nodes where devices are incorrect
274 linkFails = [] # Nodes where links are incorrect
275 hostFails = [] # Nodes where hosts are incorrect
276 attempts = main.checkTopoAttempts # Remaining Attempts
Jon Halla3e02432015-07-24 15:55:42 -0700277
278 mnSwitches = main.Mininet1.getSwitches()
279 mnLinks = main.Mininet1.getLinks()
280 mnHosts = main.Mininet1.getHosts()
281
Jon Hall70b2ff42015-11-17 15:49:44 -0800282 main.step( "Comparing Mininet topology to ONOS topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700283
acsmars59a4c552015-09-10 18:11:19 -0700284 while ( attempts >= 0 ) and\
285 ( not devicesResults or not linksResults or not hostsResults ):
Jon Hallf539eb92017-05-22 17:18:42 -0700286 main.log.info( "Sleeping {} seconds".format( 2 ) )
acsmars59a4c552015-09-10 18:11:19 -0700287 time.sleep( 2 )
288 if not devicesResults:
289 devices = main.topo.getAllDevices( main )
290 ports = main.topo.getAllPorts( main )
291 devicesResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800292 deviceFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700293 if not linksResults:
294 links = main.topo.getAllLinks( main )
295 linksResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800296 linkFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700297 if not hostsResults:
298 hosts = main.topo.getAllHosts( main )
299 hostsResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800300 hostFails = [] # Reset for each failed attempt
Jon Halla3e02432015-07-24 15:55:42 -0700301
acsmars59a4c552015-09-10 18:11:19 -0700302 # Check for matching topology on each node
303 for controller in range( main.numCtrls ):
304 controllerStr = str( controller + 1 ) # ONOS node number
305 # Compare Devices
306 if devices[ controller ] and ports[ controller ] and\
307 "Error" not in devices[ controller ] and\
308 "Error" not in ports[ controller ]:
Jon Halla3e02432015-07-24 15:55:42 -0700309
acsmars2ec91d62015-09-16 11:15:48 -0700310 try:
311 deviceData = json.loads( devices[ controller ] )
312 portData = json.loads( ports[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700313 except( TypeError, ValueError ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800314 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
acsmars2ec91d62015-09-16 11:15:48 -0700315 currentDevicesResult = main.FALSE
316 else:
317 currentDevicesResult = main.Mininet1.compareSwitches(
318 mnSwitches,deviceData,portData )
acsmars59a4c552015-09-10 18:11:19 -0700319 else:
320 currentDevicesResult = main.FALSE
321 if not currentDevicesResult:
322 deviceFails.append( controllerStr )
323 devicesResults = devicesResults and currentDevicesResult
324 # Compare Links
325 if links[ controller ] and "Error" not in links[ controller ]:
acsmars2ec91d62015-09-16 11:15:48 -0700326 try:
327 linkData = json.loads( links[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700328 except( TypeError, ValueError ):
329 main.log.error( "Could not load json:" + str( links[ controller ] ) )
acsmars2ec91d62015-09-16 11:15:48 -0700330 currentLinksResult = main.FALSE
331 else:
332 currentLinksResult = main.Mininet1.compareLinks(
333 mnSwitches, mnLinks,linkData )
acsmars59a4c552015-09-10 18:11:19 -0700334 else:
335 currentLinksResult = main.FALSE
336 if not currentLinksResult:
337 linkFails.append( controllerStr )
338 linksResults = linksResults and currentLinksResult
339 # Compare Hosts
acsmars2ec91d62015-09-16 11:15:48 -0700340 if hosts[ controller ] and "Error" not in hosts[ controller ]:
341 try:
342 hostData = json.loads( hosts[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700343 except( TypeError, ValueError ):
344 main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
acsmars2ec91d62015-09-16 11:15:48 -0700345 currentHostsResult = main.FALSE
346 else:
347 currentHostsResult = main.Mininet1.compareHosts(
348 mnHosts,hostData )
acsmars59a4c552015-09-10 18:11:19 -0700349 else:
350 currentHostsResult = main.FALSE
351 if not currentHostsResult:
352 hostFails.append( controllerStr )
353 hostsResults = hostsResults and currentHostsResult
354 # Decrement Attempts Remaining
355 attempts -= 1
356
357
358 utilities.assert_equals( expect=[],
359 actual=deviceFails,
360 onpass="ONOS correctly discovered all devices",
361 onfail="ONOS incorrectly discovered devices on nodes: " +
362 str( deviceFails ) )
363 utilities.assert_equals( expect=[],
364 actual=linkFails,
365 onpass="ONOS correctly discovered all links",
366 onfail="ONOS incorrectly discovered links on nodes: " +
367 str( linkFails ) )
368 utilities.assert_equals( expect=[],
369 actual=hostFails,
370 onpass="ONOS correctly discovered all hosts",
371 onfail="ONOS incorrectly discovered hosts on nodes: " +
372 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700373 topoResults = hostsResults and linksResults and devicesResults
374 utilities.assert_equals( expect=main.TRUE,
375 actual=topoResults,
376 onpass="ONOS correctly discovered the topology",
377 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700378
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700379 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700380 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700381 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700382 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700383 if main.initialized == main.FALSE:
384 main.log.error( "Test components did not start correctly, skipping further tests" )
385 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700386 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700387 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700388 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700389 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700390 "switches to test intents, exits out if " +\
391 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700392
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700393 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700394 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700395 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700396 main.topology,
397 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700398 stepResult = topoResult
399 utilities.assert_equals( expect=main.TRUE,
400 actual=stepResult,
401 onpass="Successfully loaded topology",
402 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700403
404 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700405 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700406 main.initialized = main.FALSE
407 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700408
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700409 def CASE11( self, main ):
410 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700411 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700412 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700413 if main.initialized == main.FALSE:
414 main.log.error( "Test components did not start correctly, skipping further tests" )
415 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700416 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700417 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700418 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700419 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700420 "switches to test intents, exits out if " +\
421 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700422
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700423 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700424 args = "--switch ovs,protocols=OpenFlow13"
425 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
426 main.topology,
427 args=args )
428 stepResult = topoResult
429 utilities.assert_equals( expect=main.TRUE,
430 actual=stepResult,
431 onpass="Successfully loaded topology",
432 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700433 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700434 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700435 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700436
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700437 def CASE12( self, main ):
438 """
439 Assign mastership to controllers
440 """
441 import re
442
Jeremyd9e4eb12016-04-13 12:09:06 -0700443 if main.initialized == main.FALSE:
444 main.log.error( "Test components did not start correctly, skipping further tests" )
445 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700446 main.case( "Assign switches to controllers" )
447 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700448 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700449 " switches to ONOS nodes"
450
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700451 switchList = []
452
453 # Creates a list switch name, use getSwitch() function later...
454 for i in range( 1, ( main.numSwitch + 1 ) ):
455 switchList.append( 's' + str( i ) )
456
457 tempONOSip = []
458 for i in range( main.numCtrls ):
459 tempONOSip.append( main.ONOSip[ i ] )
460
461 assignResult = main.Mininet1.assignSwController( sw=switchList,
462 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700463 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700464 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700465 main.log.error( "Problem assigning mastership of switches" )
466 main.initialized = main.FALSE
467 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700468
469 for i in range( 1, ( main.numSwitch + 1 ) ):
470 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700471 main.log.debug( "Response is " + str( response ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700472 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
473 assignResult = assignResult and main.TRUE
474 else:
475 assignResult = main.FALSE
476 stepResult = assignResult
477 utilities.assert_equals( expect=main.TRUE,
478 actual=stepResult,
479 onpass="Successfully assigned switches" +
480 "to controller",
481 onfail="Failed to assign switches to " +
482 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700483 if not stepResult:
484 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700485
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800486 def CASE13( self,main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700487 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800488 Create Scapy components
489 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700490 if main.initialized == main.FALSE:
491 main.log.error( "Test components did not start correctly, skipping further tests" )
492 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800493 main.case( "Create scapy components" )
494 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800495 scapyResult = main.TRUE
496 for hostName in main.scapyHostNames:
497 main.Scapy1.createHostComponent( hostName )
498 main.scapyHosts.append( getattr( main, hostName ) )
499
500 main.step( "Start scapy components" )
501 for host in main.scapyHosts:
502 host.startHostCli()
503 host.startScapy()
504 host.updateSelf()
505 main.log.debug( host.name )
506 main.log.debug( host.hostIp )
507 main.log.debug( host.hostMac )
508
509
510 utilities.assert_equals( expect=main.TRUE,
511 actual=scapyResult,
512 onpass="Successfully created Scapy Components",
513 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700514 if not scapyResult:
515 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800516
517 def CASE14( self, main ):
518 """
519 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700520 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700521 if main.initialized == main.FALSE:
522 main.log.error( "Test components did not start correctly, skipping further tests" )
523 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700524 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800525 main.step( "Pingall hosts and confirm ONOS discovery" )
526 utilities.retry( f=main.intentFunction.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700527
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800528 utilities.retry( f=main.intentFunction.confirmHostDiscovery, retValue=main.FALSE,
529 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700530 utilities.assert_equals( expect=main.TRUE,
531 actual=stepResult,
532 onpass="Successfully discovered hosts",
533 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700534 if not stepResult:
535 main.initialized = main.FALSE
536 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700537
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800538 main.step( "Populate hostsData" )
539 stepResult = main.intentFunction.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700540 utilities.assert_equals( expect=main.TRUE,
541 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800542 onpass="Successfully populated hostsData",
543 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700544 if not stepResult:
545 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800546
547 def CASE15( self, main ):
548 """
549 Discover all hosts with scapy arp packets and store its data to a dictionary
550 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700551 if main.initialized == main.FALSE:
552 main.log.error( "Test components did not start correctly, skipping further tests" )
553 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800554 main.case( "Discover all hosts using scapy" )
555 main.step( "Send packets from each host to the first host and confirm onos discovery" )
556
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800557 if len( main.scapyHosts ) < 1:
558 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700559 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800560 main.skipCase()
561
562 # Send ARP packets from each scapy host component
563 main.intentFunction.sendDiscoveryArp( main, main.scapyHosts )
564
565 stepResult = utilities.retry( f=main.intentFunction.confirmHostDiscovery,
566 retValue=main.FALSE, args=[ main ],
567 attempts=main.checkTopoAttempts, sleep=2 )
568
569 utilities.assert_equals( expect=main.TRUE,
570 actual=stepResult,
571 onpass="ONOS correctly discovered all hosts",
572 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700573 if not stepResult:
574 main.initialized = main.FALSE
575 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800576
577 main.step( "Populate hostsData" )
578 stepResult = main.intentFunction.populateHostData( main )
579 utilities.assert_equals( expect=main.TRUE,
580 actual=stepResult,
581 onpass="Successfully populated hostsData",
582 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700583 if not stepResult:
584 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800585
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800586 def CASE16( self, main ):
587 """
Jeremy42df2e72016-02-23 16:37:46 -0800588 Balance Masters
589 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700590 if main.initialized == main.FALSE:
591 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700592 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700593 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800594 main.case( "Balance mastership of switches" )
595 main.step( "Balancing mastership of switches" )
596
Jeremy42df2e72016-02-23 16:37:46 -0800597 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
598
599 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700600 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800601 onpass="Successfully balanced mastership of switches",
602 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700603 if not balanceResult:
604 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800605
606 def CASE17( self, main ):
607 """
Jeremy6e9748f2016-03-25 15:03:39 -0700608 Use Flow Objectives
609 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700610 if main.initialized == main.FALSE:
611 main.log.error( "Test components did not start correctly, skipping further tests" )
612 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700613 main.case( "Enable intent compilation using Flow Objectives" )
614 main.step( "Enabling Flow Objectives" )
615
616 main.flowCompiler = "Flow Objectives"
617
618 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
619
620 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
621 propName="useFlowObjectives", value="true" )
You Wang106d0fa2017-05-15 17:22:15 -0700622 stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
623 propName="defaultFlowObjectiveCompiler",
624 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
Jeremy6e9748f2016-03-25 15:03:39 -0700625
626 utilities.assert_equals( expect=main.TRUE,
627 actual=stepResult,
628 onpass="Successfully activated Flow Objectives",
629 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700630 if not balanceResult:
631 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700632
633 def CASE18( self, main ):
634 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800635 Stop mininet and remove scapy host
636 """
637 main.log.report( "Stop Mininet and Scapy" )
638 main.case( "Stop Mininet and Scapy" )
639 main.caseExplanation = "Stopping the current mininet topology " +\
640 "to start up fresh"
641 main.step( "Stopping and Removing Scapy Host Components" )
642 scapyResult = main.TRUE
643 for host in main.scapyHosts:
644 scapyResult = scapyResult and host.stopScapy()
645 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
646
647 for host in main.scapyHosts:
648 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
649 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
650
651 main.scapyHosts = []
652 main.scapyHostIPs = []
653
654 utilities.assert_equals( expect=main.TRUE,
655 actual=scapyResult,
656 onpass="Successfully stopped scapy and removed host components",
657 onfail="Failed to stop mininet and scapy" )
658
659 main.step( "Stopping Mininet Topology" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700660 mininetResult = main.Mininet1.stopNet()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800661
662 utilities.assert_equals( expect=main.TRUE,
663 actual=mininetResult,
664 onpass="Successfully stopped mininet and scapy",
665 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700666 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800667 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700668 main.cleanup()
669 main.exit()
670
Jeremy Songster17147f22016-05-31 18:30:52 -0700671 def CASE19( self, main ):
672 """
673 Copy the karaf.log files after each testcase cycle
674 """
675 main.log.report( "Copy karaf logs" )
676 main.case( "Copy karaf logs" )
677 main.caseExplanation = "Copying the karaf logs to preserve them through" +\
678 "reinstalling ONOS"
679 main.step( "Copying karaf logs" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700680 stepResult = main.TRUE
681 scpResult = main.TRUE
682 copyResult = main.TRUE
Jeremy Songstercc5414b2016-07-11 10:59:53 -0700683 for i in range( main.numCtrls ):
684 main.node = main.CLIs[ i ]
Jeremy Songster17147f22016-05-31 18:30:52 -0700685 ip = main.ONOSip[ i ]
686 main.node.ip_address = ip
Jeremy Songster31aad312016-06-13 16:32:11 -0700687 scpResult = scpResult and main.ONOSbench.scp( main.node ,
688 "/opt/onos/log/karaf.log",
689 "/tmp/karaf.log",
690 direction="from" )
691 copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
692 copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
693 if scpResult and copyResult:
694 stepResult = main.TRUE and stepResult
695 else:
696 stepResult = main.FALSE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700697 utilities.assert_equals( expect=main.TRUE,
698 actual=stepResult,
699 onpass="Successfully copied remote ONOS logs",
700 onfail="Failed to copy remote ONOS logs" )
Jeremy Songster17147f22016-05-31 18:30:52 -0700701
kelvin-onlabb769f562015-07-15 17:05:10 -0700702 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700703 """
704 Add host intents between 2 host:
705 - Discover hosts
706 - Add host intents
707 - Check intents
708 - Verify flows
709 - Ping hosts
710 - Reroute
711 - Link down
712 - Verify flows
713 - Check topology
714 - Ping hosts
715 - Link up
716 - Verify flows
717 - Check topology
718 - Ping hosts
719 - Remove intents
720 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700721 if main.initialized == main.FALSE:
722 main.log.error( "Test components did not start correctly, skipping further tests" )
723 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700724 # Assert variables - These variable's name|format must be followed
725 # if you want to use the wrapper function
726 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700727 try:
728 assert main.CLIs
729 except AssertionError:
730 main.log.error( "There is no main.CLIs, skipping test cases" )
731 main.initialized = main.FALSE
732 main.skipCase()
733 try:
734 assert main.Mininet1
735 except AssertionError:
736 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
737 main.initialized = main.FALSE
738 main.skipCase()
739 try:
740 assert main.numSwitch
741 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700742 main.log.error( "Place the total number of switch topology in " +\
743 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700744 main.initialized = main.FALSE
745 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700746
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800747 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700748 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
749
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700750 main.testName = "Host Intents"
751 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700752 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700753 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700754 str( main.numCtrls ) + " node(s) cluster;\n" +\
755 "Different type of hosts will be tested in " +\
756 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700757 "etc;\nThe test will use OF " + main.OFProtocol +\
758 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700759 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700760
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700761 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700762 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700763 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
764 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800765 testResult = main.FALSE
766 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700767 name="IPV4",
768 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800769 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700770 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800771 if installResult:
772 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700773 name="IPV4",
Jon Hall9c888672017-05-15 18:03:54 -0700774 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700775 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800776 host1=host1,
777 host2=host2,
alison52b25892016-09-19 10:53:48 -0700778 sw1="s5",
779 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700780 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800781 else:
782 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800783
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700784 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800785 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700786 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700787 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700788
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700789 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700790 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700791 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
792 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 "}
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800793 testResult = main.FALSE
794 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700795 name="DUALSTACK",
796 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800797 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700798 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800799
800 if installResult:
801 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700802 name="DUALSTACK",
Jon Hall9c888672017-05-15 18:03:54 -0700803 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700804 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800805 host1=host1,
806 host2=host2,
alison52b25892016-09-19 10:53:48 -0700807 sw1="s5",
808 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700809 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700810
811 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800812 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700813 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700814 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700815
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700816 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700817 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700818 host1 = { "name": "h1" }
819 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800820 testResult = main.FALSE
821 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700822 name="DUALSTACK2",
823 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800824 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700825 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800826
827 if installResult:
828 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700829 name="DUALSTACK2",
Jon Hall9c888672017-05-15 18:03:54 -0700830 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700831 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800832 host1=host1,
833 host2=host2,
alison52b25892016-09-19 10:53:48 -0700834 sw1="s5",
835 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700836 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800837 else:
838 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700839
840 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800841 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700842 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700843 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700844
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700845 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700846 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700847 host1 = { "name": "h1" }
848 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800849 testResult = main.FALSE
850 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700851 name="1HOP",
852 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800853 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700854 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800855
856 if installResult:
857 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700858 name="1HOP",
Jon Hall9c888672017-05-15 18:03:54 -0700859 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700860 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800861 host1=host1,
862 host2=host2,
alison52b25892016-09-19 10:53:48 -0700863 sw1="s5",
864 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700865 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800866 else:
867 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700868
869 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800870 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700871 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700872 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700873
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700874 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700875 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700876 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
877 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800878 testResult = main.FALSE
879 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700880 name="VLAN1",
881 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800882 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700883 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800884
885 if installResult:
886 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700887 name="VLAN1",
Jon Hall9c888672017-05-15 18:03:54 -0700888 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700889 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800890 host1=host1,
891 host2=host2,
alison52b25892016-09-19 10:53:48 -0700892 sw1="s5",
893 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700894 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800895 else:
896 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700897
898 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800899 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700900 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700901 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700902
Jeremy Songsterff553672016-05-12 17:06:23 -0700903 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
904 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700905 host1 = { "name": "h5", "vlan": "200" }
906 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700907 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -0700908 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700909 name="VLAN2",
910 onosNode=0,
Jeremy Songsterff553672016-05-12 17:06:23 -0700911 host1=host1,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700912 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700913
914 if installResult:
915 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700916 name="VLAN2",
Jon Hall9c888672017-05-15 18:03:54 -0700917 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700918 onosNode=0,
Jeremy Songsterff553672016-05-12 17:06:23 -0700919 host1=host1,
920 host2=host2,
alison52b25892016-09-19 10:53:48 -0700921 sw1="s5",
922 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700923 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700924 else:
925 main.CLIs[ 0 ].removeAllIntents( purge=True )
926
927 utilities.assert_equals( expect=main.TRUE,
928 actual=testResult,
929 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700930 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700931
Jeremy Songsterc032f162016-08-04 17:14:49 -0700932 main.step( "Encapsulation: Add host intents between h1 and h9" )
933 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700934 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
935 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700936 testResult = main.FALSE
Jeremy Songsterc032f162016-08-04 17:14:49 -0700937 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700938 name="ENCAPSULATION",
939 onosNode=0,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700940 host1=host1,
941 host2=host2,
942 encap="VLAN" )
943 if installResult:
944 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -0700945 name="ENCAPSULATION",
Jon Hall9c888672017-05-15 18:03:54 -0700946 intentId=installResult,
alison52b25892016-09-19 10:53:48 -0700947 onosNode=0,
Jeremy Songsterc032f162016-08-04 17:14:49 -0700948 host1=host1,
949 host2=host2,
alison52b25892016-09-19 10:53:48 -0700950 sw1="s5",
951 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700952 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700953 else:
954 main.CLIs[ 0 ].removeAllIntents( purge=True )
955
956 utilities.assert_equals( expect=main.TRUE,
957 actual=testResult,
958 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700959 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700960
Shreyaca8990f2017-03-16 11:43:11 -0700961 # Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
alison52b25892016-09-19 10:53:48 -0700962 # main.step( "Encapsulation: Add host intents between h1 and h9" )
963 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
964 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
965 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
966 # testResult = main.FALSE
967 # installResult = main.intentFunction.installHostIntent( main,
968 # name="ENCAPSULATION",
969 # onosNode=0,
970 # host1=host1,
971 # host2=host2,
972 # encap="MPLS" )
973 # if installResult:
974 # testResult = main.intentFunction.testHostIntent( main,
975 # name="ENCAPSULATION",
976 # intentId=installResult,
977 # onosNode=0,
978 # host1=host1,
979 # host2=host2,
980 # sw1="s5",
981 # sw2="s2",
982 # expectedLink=18 )
983 # else:
984 # main.CLIs[ 0 ].removeAllIntents( purge=True )
985 #
986 # utilities.assert_equals( expect=main.TRUE,
987 # actual=testResult,
988 # onpass=main.assertReturnString,
989 # onfail=main.assertReturnString )
990
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700991 main.step( "Confirm that ONOS leadership is unchanged" )
acsmarse6b410f2015-07-17 14:39:34 -0700992 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
alison52b25892016-09-19 10:53:48 -0700993 testResult = main.intentFunction.checkLeaderChange( intentLeadersOld,
acsmarse6b410f2015-07-17 14:39:34 -0700994 intentLeadersNew )
995
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800996 utilities.assert_equals( expect=main.TRUE,
997 actual=testResult,
998 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700999 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001000
kelvin-onlab016dce22015-08-10 09:54:11 -07001001 main.intentFunction.report( main )
1002
kelvin-onlabb769f562015-07-15 17:05:10 -07001003 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001004 """
1005 Add point intents between 2 hosts:
1006 - Get device ids | ports
1007 - Add point intents
1008 - Check intents
1009 - Verify flows
1010 - Ping hosts
1011 - Reroute
1012 - Link down
1013 - Verify flows
1014 - Check topology
1015 - Ping hosts
1016 - Link up
1017 - Verify flows
1018 - Check topology
1019 - Ping hosts
1020 - Remove intents
1021 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001022 if main.initialized == main.FALSE:
1023 main.log.error( "Test components did not start correctly, skipping further tests" )
1024 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001025 # Assert variables - These variable's name|format must be followed
1026 # if you want to use the wrapper function
1027 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001028 try:
1029 assert main.CLIs
1030 except AssertionError:
1031 main.log.error( "There is no main.CLIs, skipping test cases" )
1032 main.initialized = main.FALSE
1033 main.skipCase()
1034 try:
1035 assert main.Mininet1
1036 except AssertionError:
1037 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1038 main.initialized = main.FALSE
1039 main.skipCase()
1040 try:
1041 assert main.numSwitch
1042 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001043 main.log.error( "Place the total number of switch topology in " +\
1044 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001045 main.initialized = main.FALSE
1046 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001047
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001048 main.testName = "Point Intents"
1049 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001050 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001051 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001052 " intents using " + str( main.numCtrls ) +\
1053 " node(s) cluster;\n" +\
1054 "Different type of hosts will be tested in " +\
1055 "each step such as IPV4, Dual stack, VLAN etc" +\
1056 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001057 " OVS running in Mininet and compile intents" +\
1058 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001059
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001060 # No option point intents
1061 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001062 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001063 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001064 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001065 ]
1066 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001067 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001068 ]
Jeremy42df2e72016-02-23 16:37:46 -08001069 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001070 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001071 main,
1072 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001073 senders=senders,
1074 recipients=recipients )
1075
1076 if installResult:
1077 testResult = main.intentFunction.testPointIntent(
1078 main,
1079 intentId=installResult,
1080 name="NOOPTION",
1081 senders=senders,
1082 recipients=recipients,
1083 sw1="s5",
1084 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001085 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001086 else:
1087 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001088
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001089 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001090 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001091 onpass=main.assertReturnString,
1092 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001093
kelvin-onlabb769f562015-07-15 17:05:10 -07001094 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001095 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001096 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001097 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001098 ]
1099 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001100 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001101 ]
Jeremy42df2e72016-02-23 16:37:46 -08001102 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001103 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001104 main,
1105 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001106 senders=senders,
1107 recipients=recipients,
1108 ethType="IPV4" )
1109
1110 if installResult:
1111 testResult = main.intentFunction.testPointIntent(
1112 main,
1113 intentId=installResult,
1114 name="IPV4",
1115 senders=senders,
1116 recipients=recipients,
1117 sw1="s5",
1118 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001119 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001120 else:
1121 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001122
1123 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001124 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001125 onpass=main.assertReturnString,
1126 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -08001127
1128 main.step("Protected: Add point intents between h1 and h9")
1129 main.assertReturnString = "Assertion Result for protected point intent\n"
1130 senders = [
1131 {"name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01"}
1132 ]
1133 recipients = [
1134 {"name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09"}
1135 ]
1136 testResult = main.FALSE
1137 installResult = main.intentFunction.installPointIntent(
1138 main,
1139 name="Protected",
1140 senders=senders,
1141 recipients=recipients,
1142 protected=True )
1143
1144 if installResult:
1145 testResult = main.intentFunction.testPointIntent(
1146 main,
1147 name="Protected",
1148 intentId=installResult,
1149 senders=senders,
1150 recipients=recipients,
1151 sw1="s5",
1152 sw2="s2",
1153 protected=True,
1154 expectedLink=18 )
1155 else:
1156 main.CLIs[ 0 ].removeAllIntents( purge=True )
1157
1158 utilities.assert_equals( expect=main.TRUE,
1159 actual=testResult,
1160 onpass=main.assertReturnString,
1161 onfail=main.assertReturnString )
1162
kelvin-onlabb769f562015-07-15 17:05:10 -07001163 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001164 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001165 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001166 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001167 ]
1168 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001169 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001170 ]
Jeremy42df2e72016-02-23 16:37:46 -08001171 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001172 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001173 main,
1174 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001175 senders=senders,
1176 recipients=recipients,
1177 ethType="IPV4" )
1178
1179 if installResult:
1180 testResult = main.intentFunction.testPointIntent(
1181 main,
1182 intentId=installResult,
1183 name="IPV4_2",
1184 senders=senders,
1185 recipients=recipients,
1186 sw1="s5",
1187 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001188 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001189 else:
1190 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001191
1192 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001193 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001194 onpass=main.assertReturnString,
1195 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001196
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001197 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001198 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001199 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001200 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001201 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001202 ]
1203 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001204 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001205 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001206 ]
Jeremy6f000c62016-02-25 17:02:28 -08001207 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001208 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001209 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1210 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001211 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001212 installResult = main.intentFunction.installPointIntent(
1213 main,
1214 name="SDNIP-ICMP",
1215 senders=senders,
1216 recipients=recipients,
1217 ethType="IPV4",
1218 ipProto=ipProto,
1219 tcpSrc=tcpSrc,
1220 tcpDst=tcpDst )
1221
1222 if installResult:
1223 testResult = main.intentFunction.testPointIntent(
1224 main,
1225 intentId=installResult,
1226 name="SDNIP_ICMP",
1227 senders=senders,
1228 recipients=recipients,
1229 sw1="s5",
1230 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001231 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001232 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -08001233 else:
1234 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001235
1236 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001237 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001238 onpass=main.assertReturnString,
1239 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001240
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001241 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001242 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001243 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1244 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001245 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1246 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001247 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1248 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1249 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1250
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001251 stepResult = main.intentFunction.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001252 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001253 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001254 host1="h1",
1255 host2="h9",
1256 deviceId1="of:0000000000000005/1",
1257 deviceId2="of:0000000000000006/1",
1258 mac1=mac1,
1259 mac2=mac2,
1260 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001261 ipProto=ipProto,
1262 ip1=ip1,
1263 ip2=ip2,
1264 tcp1=tcp1,
1265 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001266
1267 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001268 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001269 onpass=main.assertReturnString,
1270 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001271
acsmars5d8cc862015-09-25 09:44:50 -07001272 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1273 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001274 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001275 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001276 ]
1277 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001278 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001279 ]
Jeremy42df2e72016-02-23 16:37:46 -08001280 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001281 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001282 main,
1283 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001284 senders=senders,
1285 recipients=recipients,
1286 ethType="IPV4" )
1287
1288 if installResult:
1289 testResult = main.intentFunction.testPointIntent(
1290 main,
1291 intentId=installResult,
1292 name="DUALSTACK1",
1293 senders=senders,
1294 recipients=recipients,
1295 sw1="s5",
1296 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001297 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001298 else:
1299 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001300
1301 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001302 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001303 onpass=main.assertReturnString,
1304 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001305
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001306 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001307 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001308 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001309 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001310 ]
1311 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001312 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001313 ]
Jeremy42df2e72016-02-23 16:37:46 -08001314 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001315 installResult = main.intentFunction.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001316 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001317 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001318 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001319 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001320
1321 if installResult:
1322 testResult = main.intentFunction.testPointIntent(
1323 main,
1324 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001325 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001326 senders=senders,
1327 recipients=recipients,
1328 sw1="s5",
1329 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001330 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001331
1332 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001333 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001334 onpass=main.assertReturnString,
1335 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001336
Jeremy Songsterff553672016-05-12 17:06:23 -07001337 main.step( "VLAN: Add point intents between h5 and h21" )
1338 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1339 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001340 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001341 ]
1342 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001343 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001344 ]
1345 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -07001346 installResult = main.intentFunction.installPointIntent(
1347 main,
1348 name="VLAN2",
1349 senders=senders,
1350 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001351 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001352
1353 if installResult:
1354 testResult = main.intentFunction.testPointIntent(
1355 main,
1356 intentId=installResult,
1357 name="VLAN2",
1358 senders=senders,
1359 recipients=recipients,
1360 sw1="s5",
1361 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001362 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001363
1364 utilities.assert_equals( expect=main.TRUE,
1365 actual=testResult,
1366 onpass=main.assertReturnString,
1367 onfail=main.assertReturnString )
1368
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001369 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001370 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001371 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001372 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001373 ]
1374 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001375 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001376 ]
Jeremy42df2e72016-02-23 16:37:46 -08001377 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001378 installResult = main.intentFunction.installPointIntent(
1379 main,
1380 name="1HOP IPV4",
1381 senders=senders,
1382 recipients=recipients,
1383 ethType="IPV4" )
1384
1385 if installResult:
1386 testResult = main.intentFunction.testPointIntent(
1387 main,
1388 intentId=installResult,
1389 name="1HOP IPV4",
1390 senders=senders,
1391 recipients=recipients,
1392 sw1="s5",
1393 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001394 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001395 else:
1396 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001397
1398 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001399 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001400 onpass=main.assertReturnString,
1401 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001402
Jeremy Songsterc032f162016-08-04 17:14:49 -07001403 main.step( "Add point to point intents using VLAN Encapsulation" )
1404 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1405 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001406 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001407 ]
1408 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001409 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001410 ]
1411 testResult = main.FALSE
Jeremy Songsterc032f162016-08-04 17:14:49 -07001412 installResult = main.intentFunction.installPointIntent(
1413 main,
1414 name="ENCAPSULATION",
1415 senders=senders,
1416 recipients=recipients,
1417 encap="VLAN" )
1418
1419 if installResult:
1420 testResult = main.intentFunction.testPointIntent(
1421 main,
1422 intentId=installResult,
1423 name="ENCAPSULATION",
1424 senders=senders,
1425 recipients=recipients,
1426 sw1="s5",
1427 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001428 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001429 else:
1430 main.CLIs[ 0 ].removeAllIntents( purge=True )
1431
1432 utilities.assert_equals( expect=main.TRUE,
1433 actual=testResult,
1434 onpass=main.assertReturnString,
1435 onfail=main.assertReturnString )
1436
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001437 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1438 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1439 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001440 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001441 ]
1442 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001443 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001444 ]
1445 testResult = main.FALSE
1446 installResult = main.intentFunction.installPointIntent(
1447 main,
1448 name="NOOPTION",
1449 senders=senders,
1450 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001451 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001452
1453 if installResult:
1454 testResult = main.intentFunction.testPointIntent(
1455 main,
1456 intentId=installResult,
1457 name="NOOPTION",
1458 senders=senders,
1459 recipients=recipients,
1460 sw1="s5",
1461 sw2="s2",
1462 expectedLink=18 )
1463 else:
1464 main.CLIs[ 0 ].removeAllIntents( purge=True )
1465
1466 utilities.assert_equals( expect=main.TRUE,
1467 actual=testResult,
1468 onpass=main.assertReturnString,
1469 onfail=main.assertReturnString )
1470
Shreyaca8990f2017-03-16 11:43:11 -07001471 # Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
alison52b25892016-09-19 10:53:48 -07001472 # main.step( "Add point to point intents using MPLS Encapsulation" )
1473 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1474 # senders = [
1475 # { "name": "h1", "device": "of:0000000000000005/1" }
1476 # ]
1477 # recipients = [
1478 # { "name": "h9", "device": "of:0000000000000006/1" }
1479 # ]
1480 # testResult = main.FALSE
1481 # installResult = main.intentFunction.installPointIntent(
1482 # main,
1483 # name="ENCAPSULATION",
1484 # senders=senders,
1485 # recipients=recipients,
1486 # encap="MPLS" )
1487 #
1488 # if installResult:
1489 # testResult = main.intentFunction.testPointIntent(
1490 # main,
1491 # intentId=installResult,
1492 # name="ENCAPSULATION",
1493 # senders=senders,
1494 # recipients=recipients,
1495 # sw1="s5",
1496 # sw2="s2",
1497 # expectedLink=18 )
1498 # else:
1499 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1500 #
1501 # utilities.assert_equals( expect=main.TRUE,
1502 # actual=testResult,
1503 # onpass=main.assertReturnString,
1504 # onfail=main.assertReturnString )
1505
kelvin-onlab016dce22015-08-10 09:54:11 -07001506 main.intentFunction.report( main )
1507
kelvin-onlabb769f562015-07-15 17:05:10 -07001508 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001509 """
1510 Add single point to multi point intents
1511 - Get device ids
1512 - Add single point to multi point intents
1513 - Check intents
1514 - Verify flows
1515 - Ping hosts
1516 - Reroute
1517 - Link down
1518 - Verify flows
1519 - Check topology
1520 - Ping hosts
1521 - Link up
1522 - Verify flows
1523 - Check topology
1524 - Ping hosts
1525 - Remove intents
1526 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001527 if main.initialized == main.FALSE:
1528 main.log.error( "Test components did not start correctly, skipping further tests" )
1529 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001530 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001531 try:
1532 assert main.CLIs
1533 except AssertionError:
1534 main.log.error( "There is no main.CLIs, skipping test cases" )
1535 main.initialized = main.FALSE
1536 main.skipCase()
1537 try:
1538 assert main.Mininet1
1539 except AssertionError:
1540 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1541 main.initialized = main.FALSE
1542 main.skipCase()
1543 try:
1544 assert main.numSwitch
1545 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001546 main.log.error( "Place the total number of switch topology in "+ \
1547 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001548 main.initialized = main.FALSE
1549 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001550
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001551 main.testName = "Single to Multi Point Intents"
1552 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001553 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001554 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001555 " multi point intents using " +\
1556 str( main.numCtrls ) + " node(s) cluster;\n" +\
1557 "Different type of hosts will be tested in " +\
1558 "each step such as IPV4, Dual stack, VLAN etc" +\
1559 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001560 " OVS running in Mininet and compile intents" +\
1561 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001562
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001563 main.step( "NOOPTION: Install and test single point to multi point intents" )
1564 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1565 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001566 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001567 ]
1568 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001569 { "name": "h16", "device": "of:0000000000000006/8" },
1570 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001571 ]
Jon Hall9c888672017-05-15 18:03:54 -07001572 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1573 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001574 testResult = main.FALSE
1575 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001576 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001577 name="NOOPTION",
1578 senders=senders,
1579 recipients=recipients,
1580 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001581 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001582
1583 if installResult:
1584 testResult = main.intentFunction.testPointIntent(
1585 main,
1586 intentId=installResult,
1587 name="NOOPTION",
1588 senders=senders,
1589 recipients=recipients,
1590 badSenders=badSenders,
1591 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001592 sw1="s5",
1593 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001594 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001595 else:
1596 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001597
1598 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001599 actual=testResult,
1600 onpass=main.assertReturnString,
1601 onfail=main.assertReturnString )
1602
1603 main.step( "IPV4: Install and test single point to multi point intents" )
1604 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1605 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001606 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001607 ]
1608 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001609 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1610 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001611 ]
Jon Hall9c888672017-05-15 18:03:54 -07001612 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1613 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001614 testResult = main.FALSE
1615 installResult = main.intentFunction.installSingleToMultiIntent(
1616 main,
1617 name="IPV4",
1618 senders=senders,
1619 recipients=recipients,
1620 ethType="IPV4",
1621 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001622 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001623
1624 if installResult:
1625 testResult = main.intentFunction.testPointIntent(
1626 main,
1627 intentId=installResult,
1628 name="IPV4",
1629 senders=senders,
1630 recipients=recipients,
1631 badSenders=badSenders,
1632 badRecipients=badRecipients,
1633 sw1="s5",
1634 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001635 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001636 else:
1637 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001638
1639 utilities.assert_equals( expect=main.TRUE,
1640 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001641 onpass=main.assertReturnString,
1642 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001643
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001644 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001645 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 -08001646 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001647 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001648 ]
1649 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001650 { "name": "h16", "device": "of:0000000000000006/8" },
1651 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001652 ]
Jon Hall9c888672017-05-15 18:03:54 -07001653 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1654 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001655 testResult = main.FALSE
1656 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001657 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001658 name="IPV4_2",
1659 senders=senders,
1660 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001661 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001662 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001663 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001664
1665 if installResult:
1666 testResult = main.intentFunction.testPointIntent(
1667 main,
1668 intentId=installResult,
1669 name="IPV4_2",
1670 senders=senders,
1671 recipients=recipients,
1672 badSenders=badSenders,
1673 badRecipients=badRecipients,
1674 sw1="s5",
1675 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001676 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001677 else:
1678 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001679
1680 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001681 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001682 onpass=main.assertReturnString,
1683 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001684
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001685 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001686 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 -08001687 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001688 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001689 ]
1690 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001691 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1692 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001693 ]
Jon Hall9c888672017-05-15 18:03:54 -07001694 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1695 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001696 testResult = main.FALSE
1697 installResult = main.intentFunction.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001698 main,
alison52b25892016-09-19 10:53:48 -07001699 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001700 senders=senders,
1701 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001702 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001703 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001704
1705 if installResult:
1706 testResult = main.intentFunction.testPointIntent(
1707 main,
1708 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001709 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001710 senders=senders,
1711 recipients=recipients,
1712 badSenders=badSenders,
1713 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001714 sw1="s5",
1715 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001716 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001717 else:
1718 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001719
1720 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001721 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001722 onpass=main.assertReturnString,
1723 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001724
Jeremy Songsterff553672016-05-12 17:06:23 -07001725 main.step( "VLAN: Add single point to multi point intents" )
1726 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1727 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001728 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001729 ]
1730 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001731 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1732 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001733 ]
Jon Hall9c888672017-05-15 18:03:54 -07001734 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1735 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001736 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -07001737 installResult = main.intentFunction.installSingleToMultiIntent(
1738 main,
1739 name="VLAN2",
1740 senders=senders,
1741 recipients=recipients,
1742 sw1="s5",
1743 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001744 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001745
1746 if installResult:
1747 testResult = main.intentFunction.testPointIntent(
1748 main,
1749 intentId=installResult,
1750 name="VLAN2",
1751 senders=senders,
1752 recipients=recipients,
1753 badSenders=badSenders,
1754 badRecipients=badRecipients,
1755 sw1="s5",
1756 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001757 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001758 else:
1759 main.CLIs[ 0 ].removeAllIntents( purge=True )
1760
1761 utilities.assert_equals( expect=main.TRUE,
1762 actual=testResult,
1763 onpass=main.assertReturnString,
1764 onfail=main.assertReturnString )
1765
alison52b25892016-09-19 10:53:48 -07001766 # Does not support Single point to multi point encapsulation
1767 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1768 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1769 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001770 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001771 # ]
1772 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001773 # { "name": "h16", "device": "of:0000000000000006/8" },
1774 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001775 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001776 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1777 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001778 # testResult = main.FALSE
1779 # installResult = main.intentFunction.installSingleToMultiIntent(
1780 # main,
1781 # name="ENCAPSULATION",
1782 # senders=senders,
1783 # recipients=recipients,
1784 # sw1="s5",
1785 # sw2="s2",
1786 # encap="VLAN" )
1787 #
1788 # if installResult:
1789 # testResult = main.intentFunction.testPointIntent(
1790 # main,
1791 # intentId=installResult,
1792 # name="ENCAPSULATION",
1793 # senders=senders,
1794 # recipients=recipients,
1795 # badSenders=badSenders,
1796 # badRecipients=badRecipients,
1797 # sw1="s5",
1798 # sw2="s2",
1799 # expectedLink=18 )
1800 # else:
1801 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1802 #
1803 # utilities.assert_equals( expect=main.TRUE,
1804 # actual=testResult,
1805 # onpass=main.assertReturnString,
1806 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001807
kelvin-onlab016dce22015-08-10 09:54:11 -07001808 main.intentFunction.report( main )
1809
kelvin-onlabb769f562015-07-15 17:05:10 -07001810 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001811 """
1812 Add multi point to single point intents
1813 - Get device ids
1814 - Add multi point to single point intents
1815 - Check intents
1816 - Verify flows
1817 - Ping hosts
1818 - Reroute
1819 - Link down
1820 - Verify flows
1821 - Check topology
1822 - Ping hosts
1823 - Link up
1824 - Verify flows
1825 - Check topology
1826 - Ping hosts
1827 - Remove intents
1828 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001829 if main.initialized == main.FALSE:
1830 main.log.error( "Test components did not start correctly, skipping further tests" )
1831 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001832 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001833 try:
1834 assert main.CLIs
1835 except AssertionError:
1836 main.log.error( "There is no main.CLIs, skipping test cases" )
1837 main.initialized = main.FALSE
1838 main.skipCase()
1839 try:
1840 assert main.Mininet1
1841 except AssertionError:
1842 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1843 main.initialized = main.FALSE
1844 main.skipCase()
1845 try:
1846 assert main.numSwitch
1847 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001848 main.log.error( "Place the total number of switch topology in "+\
1849 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001850 main.initialized = main.FALSE
1851 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001852
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001853 main.testName = "Multi To Single Point Intents"
1854 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001855 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001856 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001857 " multi point intents using " +\
1858 str( main.numCtrls ) + " node(s) cluster;\n" +\
1859 "Different type of hosts will be tested in " +\
1860 "each step such as IPV4, Dual stack, VLAN etc" +\
1861 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001862 " OVS running in Mininet and compile intents" +\
1863 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001864
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001865 main.step( "NOOPTION: Add multi point to single point intents" )
1866 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1867 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001868 { "name": "h16", "device": "of:0000000000000006/8" },
1869 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001870 ]
1871 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001872 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001873 ]
Jon Hall9c888672017-05-15 18:03:54 -07001874 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1875 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001876 testResult = main.FALSE
1877 installResult = main.intentFunction.installMultiToSingleIntent(
1878 main,
1879 name="NOOPTION",
1880 senders=senders,
1881 recipients=recipients,
1882 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001883 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001884
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001885 if installResult:
1886 testResult = main.intentFunction.testPointIntent(
1887 main,
1888 intentId=installResult,
1889 name="NOOPTION",
1890 senders=senders,
1891 recipients=recipients,
1892 badSenders=badSenders,
1893 badRecipients=badRecipients,
1894 sw1="s5",
1895 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001896 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001897 else:
1898 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001899
1900 utilities.assert_equals( expect=main.TRUE,
1901 actual=testResult,
1902 onpass=main.assertReturnString,
1903 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001904
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001905 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001906 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 -08001907 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001908 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1909 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001910 ]
1911 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001912 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001913 ]
Jon Hall9c888672017-05-15 18:03:54 -07001914 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1915 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001916 testResult = main.FALSE
1917 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001918 main,
1919 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001920 senders=senders,
1921 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001922 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001923 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001924 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001925
1926 if installResult:
1927 testResult = main.intentFunction.testPointIntent(
1928 main,
1929 intentId=installResult,
1930 name="IPV4",
1931 senders=senders,
1932 recipients=recipients,
1933 badSenders=badSenders,
1934 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001935 sw1="s5",
1936 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001937 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001938 else:
1939 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001940
1941 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001942 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001943 onpass=main.assertReturnString,
1944 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001945
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001946 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001947 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 -08001948 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001949 { "name": "h16", "device": "of:0000000000000006/8" },
1950 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001951 ]
1952 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001953 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001954 ]
Jon Hall9c888672017-05-15 18:03:54 -07001955 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1956 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001957 testResult = main.FALSE
1958 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001959 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001960 name="IPV4_2",
1961 senders=senders,
1962 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001963 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001964 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001965 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001966
1967 if installResult:
1968 testResult = main.intentFunction.testPointIntent(
1969 main,
1970 intentId=installResult,
1971 name="IPV4_2",
1972 senders=senders,
1973 recipients=recipients,
1974 badSenders=badSenders,
1975 badRecipients=badRecipients,
1976 sw1="s5",
1977 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001978 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001979 else:
1980 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001981
1982 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001983 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001984 onpass=main.assertReturnString,
1985 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001986
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001987 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001988 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 -08001989 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001990 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1991 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001992 ]
1993 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001994 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001995 ]
Jon Hall9c888672017-05-15 18:03:54 -07001996 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1997 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001998 testResult = main.FALSE
1999 installResult = main.intentFunction.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002000 main,
2001 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002002 senders=senders,
2003 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002004 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002005 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002006
2007 if installResult:
2008 testResult = main.intentFunction.testPointIntent(
2009 main,
2010 intentId=installResult,
2011 name="VLAN",
2012 senders=senders,
2013 recipients=recipients,
2014 badSenders=badSenders,
2015 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002016 sw1="s5",
2017 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002018 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002019 else:
2020 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002021
2022 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002023 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002024 onpass=main.assertReturnString,
2025 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002026
Jeremy Songsterff553672016-05-12 17:06:23 -07002027 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
2028 main.step( "VLAN: Add multi point to single point intents" )
2029 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
2030 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002031 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
2032 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002033 ]
2034 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002035 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002036 ]
Jon Hall9c888672017-05-15 18:03:54 -07002037 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
2038 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07002039 testResult = main.FALSE
Jeremy Songsterff553672016-05-12 17:06:23 -07002040 installResult = main.intentFunction.installMultiToSingleIntent(
2041 main,
2042 name="VLAN2",
2043 senders=senders,
2044 recipients=recipients,
2045 sw1="s5",
2046 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002047 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002048
2049 if installResult:
2050 testResult = main.intentFunction.testPointIntent(
2051 main,
2052 intentId=installResult,
2053 name="VLAN2",
2054 senders=senders,
2055 recipients=recipients,
2056 badSenders=badSenders,
2057 badRecipients=badRecipients,
2058 sw1="s5",
2059 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002060 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002061 else:
2062 main.CLIs[ 0 ].removeAllIntents( purge=True )
2063
2064 utilities.assert_equals( expect=main.TRUE,
2065 actual=testResult,
2066 onpass=main.assertReturnString,
2067 onfail=main.assertReturnString )
2068
Jeremy Songsterc032f162016-08-04 17:14:49 -07002069 main.step( "ENCAPSULATION: Add multi point to single point intents" )
2070 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
2071 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002072 { "name": "h16", "device": "of:0000000000000006/8" },
2073 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002074 ]
2075 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002076 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002077 ]
Jon Hall9c888672017-05-15 18:03:54 -07002078 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2079 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07002080 testResult = main.FALSE
Jeremy Songsterc032f162016-08-04 17:14:49 -07002081 installResult = main.intentFunction.installMultiToSingleIntent(
2082 main,
2083 name="ENCAPSULATION",
2084 senders=senders,
2085 recipients=recipients,
2086 sw1="s5",
2087 sw2="s2",
2088 encap="VLAN" )
2089
2090 if installResult:
2091 testResult = main.intentFunction.testPointIntent(
2092 main,
2093 intentId=installResult,
2094 name="ENCAPSULATION",
2095 senders=senders,
2096 recipients=recipients,
2097 badSenders=badSenders,
2098 badRecipients=badRecipients,
2099 sw1="s5",
2100 sw2="s2",
2101 expectedLink=18 )
2102 else:
2103 main.CLIs[ 0 ].removeAllIntents( purge=True )
2104
2105 utilities.assert_equals( expect=main.TRUE,
2106 actual=testResult,
2107 onpass=main.assertReturnString,
2108 onfail=main.assertReturnString )
2109
Shreyaca8990f2017-03-16 11:43:11 -07002110 #Testing MPLS would require kernel version of 4.1 or higher (Current version is 3.13)
2111 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
2112 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
2113 #senders = [
2114 # { "name": "h16", "device": "of:0000000000000006/8" },
2115 # { "name": "h24", "device": "of:0000000000000007/8" }
2116 #]
2117 #recipients = [
2118 # { "name": "h8", "device": "of:0000000000000005/8" }
2119 #]
2120 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2121 #badRecipients = [ {"name": "h9" } ] # Recipients that are not in the intent
2122 #testResult = main.FALSE
2123 #installResult = main.intentFunction.installMultiToSingleIntent(
2124 # main,
2125 # name="ENCAPSULATION",
2126 # senders=senders,
2127 # recipients=recipients,
2128 # sw1="s5",
2129 # sw2="s2",
2130 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07002131 #
Shreyaca8990f2017-03-16 11:43:11 -07002132 #if installResult:
2133 # testResult = main.intentFunction.testPointIntent(
2134 # main,
2135 # intentId=installResult,
2136 # name="ENCAPSULATION",
2137 # senders=senders,
2138 # recipients=recipients,
2139 # badSenders=badSenders,
2140 # badRecipients=badRecipients,
2141 # sw1="s5",
2142 # sw2="s2",
2143 # expectedLink=18 )
2144 #else:
2145 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07002146 #
Shreyaca8990f2017-03-16 11:43:11 -07002147 #utilities.assert_equals( expect=main.TRUE,
2148 # actual=testResult,
2149 # onpass=main.assertReturnString,
2150 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07002151
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002152 main.intentFunction.report( main )
2153
acsmars1ff5e052015-07-23 11:27:48 -07002154 def CASE5000( self, main ):
2155 """
acsmars5d8cc862015-09-25 09:44:50 -07002156 Tests Host Mobility
2157 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002158 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002159 if main.initialized == main.FALSE:
2160 main.log.error( "Test components did not start correctly, skipping further tests" )
2161 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002162 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002163 try:
2164 assert main.CLIs
2165 except AssertionError:
2166 main.log.error( "There is no main.CLIs, skipping test cases" )
2167 main.initialized = main.FALSE
2168 main.skipCase()
2169 try:
2170 assert main.Mininet1
2171 except AssertionError:
2172 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2173 main.initialized = main.FALSE
2174 main.skipCase()
2175 try:
2176 assert main.numSwitch
2177 except AssertionError:
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002178 main.log.error( "Place the total number of switch topology in "+\
2179 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002180 main.initialized = main.FALSE
2181 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002182 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
2183 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002184 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002185
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002186 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07002187 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002188
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002189 # Send discovery ping from moved host
2190 # Moving the host brings down the default interfaces and creates a new one.
2191 # Scapy is restarted on this host to detect the new interface
2192 main.h1.stopScapy()
2193 main.h1.startScapy()
2194
2195 # Discover new host location in ONOS and populate host data.
2196 # Host 1 IP and MAC should be unchanged
2197 main.intentFunction.sendDiscoveryArp( main, [ main.h1 ] )
2198 main.intentFunction.populateHostData( main )
2199
acsmars1ff5e052015-07-23 11:27:48 -07002200 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2201
2202 utilities.assert_equals( expect="of:0000000000000006",
2203 actual=h1PostMove,
2204 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002205 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002206 " to single point intents" +
2207 " with IPV4 type and MAC addresses" +
2208 " in the same VLAN" )
2209
2210 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002211 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07002212 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
2213 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002214 testResult = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002215 installResult = main.intentFunction.installHostIntent( main,
alison52b25892016-09-19 10:53:48 -07002216 name="IPV4 Mobility IPV4",
2217 onosNode=0,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002218 host1=host1,
Jeremye0cb5eb2016-01-27 17:39:09 -08002219 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002220 if installResult:
2221 testResult = main.intentFunction.testHostIntent( main,
alison52b25892016-09-19 10:53:48 -07002222 name="Host Mobility IPV4",
Jon Hall9c888672017-05-15 18:03:54 -07002223 intentId=installResult,
alison52b25892016-09-19 10:53:48 -07002224 onosNode=0,
Jeremy2f190ca2016-01-29 15:23:57 -08002225 host1=host1,
2226 host2=host2,
2227 sw1="s6",
2228 sw2="s2",
2229 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002230 else:
2231 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002232
2233 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002234 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002235 onpass=main.assertReturnString,
2236 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002237
2238 main.intentFunction.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002239
2240 def CASE6000( self, main ):
2241 """
2242 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2243 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002244 # At some later point discussion on this behavior in MPSP and SPMP intents
2245 # will be reoppened and this test case may need to be updated to reflect
2246 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002247 if main.initialized == main.FALSE:
2248 main.log.error( "Test components did not start correctly, skipping further tests" )
2249 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002250 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002251 try:
2252 assert main.CLIs
2253 except AssertionError:
2254 main.log.error( "There is no main.CLIs, skipping test cases" )
2255 main.initialized = main.FALSE
2256 main.skipCase()
2257 try:
2258 assert main.Mininet1
2259 except AssertionError:
2260 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2261 main.initialized = main.FALSE
2262 main.skipCase()
2263 try:
2264 assert main.numSwitch
2265 except AssertionError:
alison52b25892016-09-19 10:53:48 -07002266 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002267 main.initialized = main.FALSE
2268 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002269 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
2270 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07002271 main.step( "Installing Multi to Single Point intents with no options set" )
2272 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2273 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002274 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002275 { "name": "h16", "device": "of:0000000000000006/8" },
2276 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002277 ]
2278 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002279 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002280 ]
2281 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002282 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002283 ]
2284 isolatedRecipients = []
2285 testResult = main.FALSE
2286 installResult = main.intentFunction.installMultiToSingleIntent(
2287 main,
2288 name="NOOPTION",
2289 senders=senders,
2290 recipients=recipients,
2291 sw1="s5",
2292 sw2="s2" )
2293
2294 if installResult:
2295 testResult = main.intentFunction.testEndPointFail(
2296 main,
2297 intentId=installResult,
2298 name="NOOPTION",
2299 senders=senders,
2300 recipients=recipients,
2301 isolatedSenders=isolatedSenders,
2302 isolatedRecipients=isolatedRecipients,
2303 sw1="s6",
2304 sw2="s2",
2305 sw3="s4",
2306 sw4="s1",
2307 sw5="s3",
2308 expectedLink1=16,
2309 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002310 else:
2311 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002312
2313 utilities.assert_equals( expect=main.TRUE,
2314 actual=testResult,
2315 onpass=main.assertReturnString,
2316 onfail=main.assertReturnString )
2317
Jeremy Songster9385d412016-06-02 17:57:36 -07002318 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2319
2320 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2321 "with partial failures allowed\n"
2322 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002323 { "name": "h16", "device": "of:0000000000000006/8" },
2324 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002325 ]
2326 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002327 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002328 ]
2329 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002330 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002331 ]
2332 isolatedRecipients = []
2333 testResult = main.FALSE
Jeremy Songster9385d412016-06-02 17:57:36 -07002334 installResult = main.intentFunction.installMultiToSingleIntent(
2335 main,
2336 name="NOOPTION",
2337 senders=senders,
2338 recipients=recipients,
2339 sw1="s5",
2340 sw2="s2",
2341 partial=True )
2342
2343 if installResult:
2344 testResult = main.intentFunction.testEndPointFail(
2345 main,
2346 intentId=installResult,
2347 name="NOOPTION",
2348 senders=senders,
2349 recipients=recipients,
2350 isolatedSenders=isolatedSenders,
2351 isolatedRecipients=isolatedRecipients,
2352 sw1="s6",
2353 sw2="s2",
2354 sw3="s4",
2355 sw4="s1",
2356 sw5="s3",
2357 expectedLink1=16,
2358 expectedLink2=14,
2359 partial=True )
2360 else:
2361 main.CLIs[ 0 ].removeAllIntents( purge=True )
2362
2363 utilities.assert_equals( expect=main.TRUE,
2364 actual=testResult,
2365 onpass=main.assertReturnString,
2366 onfail=main.assertReturnString )
2367
Jeremye0cb5eb2016-01-27 17:39:09 -08002368 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002369 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2370 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002371 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002372 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002373 ]
2374 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002375 { "name": "h16", "device": "of:0000000000000006/8" },
2376 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002377 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002378 isolatedSenders = []
2379 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002380 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002381 ]
2382 testResult = main.FALSE
2383 installResult = main.intentFunction.installSingleToMultiIntent(
2384 main,
2385 name="NOOPTION",
2386 senders=senders,
2387 recipients=recipients,
2388 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002389 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002390
2391 if installResult:
2392 testResult = main.intentFunction.testEndPointFail(
2393 main,
2394 intentId=installResult,
2395 name="NOOPTION",
2396 senders=senders,
2397 recipients=recipients,
2398 isolatedSenders=isolatedSenders,
2399 isolatedRecipients=isolatedRecipients,
2400 sw1="s6",
2401 sw2="s2",
2402 sw3="s4",
2403 sw4="s1",
2404 sw5="s3",
2405 expectedLink1=16,
2406 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002407 else:
2408 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002409
2410 utilities.assert_equals( expect=main.TRUE,
2411 actual=testResult,
2412 onpass=main.assertReturnString,
2413 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002414 # Right now this functionality doesn't work properly in SPMP intents
2415 main.step( "NOOPTION: Install and test single point to multi point " +\
2416 "intents with partial failures allowed" )
2417 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2418 "point intent with partial failures allowed\n"
2419 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002420 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002421 ]
2422 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002423 { "name": "h16", "device": "of:0000000000000006/8" },
2424 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002425 ]
2426 isolatedSenders = []
2427 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002428 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002429 ]
2430 testResult = main.FALSE
Jeremy Songster9385d412016-06-02 17:57:36 -07002431 installResult = main.intentFunction.installSingleToMultiIntent(
2432 main,
2433 name="NOOPTION",
2434 senders=senders,
2435 recipients=recipients,
2436 sw1="s5",
2437 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002438 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002439
2440 if installResult:
2441 testResult = main.intentFunction.testEndPointFail(
2442 main,
2443 intentId=installResult,
2444 name="NOOPTION",
2445 senders=senders,
2446 recipients=recipients,
2447 isolatedSenders=isolatedSenders,
2448 isolatedRecipients=isolatedRecipients,
2449 sw1="s6",
2450 sw2="s2",
2451 sw3="s4",
2452 sw4="s1",
2453 sw5="s3",
2454 expectedLink1=16,
2455 expectedLink2=14,
2456 partial=True )
2457 else:
2458 main.CLIs[ 0 ].removeAllIntents( purge=True )
2459
2460 utilities.assert_equals( expect=main.TRUE,
2461 actual=testResult,
2462 onpass=main.assertReturnString,
2463 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002464
Chiyu Chengef109502016-11-21 15:51:38 -08002465 main.intentFunction.report( main )