blob: ee426692581ea6dd284738f1ad328915d57bf327 [file] [log] [blame]
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001# Testing the basic intent functionality of ONOS
2
Jon Hall78be4962017-05-23 14:53:53 -07003
kelvin-onlabd48a68c2015-07-13 16:01:36 -07004class FUNCintent:
5
6 def __init__( self ):
7 self.default = ''
8
9 def CASE1( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -070010 import imp
Jon Hallf632d202015-07-30 15:45:11 -070011 import re
kelvin-onlabd48a68c2015-07-13 16:01:36 -070012
13 """
14 - Construct tests variables
15 - GIT ( optional )
16 - Checkout ONOS master branch
17 - Pull latest ONOS code
18 - Building ONOS ( optional )
19 - Install ONOS package
20 - Build ONOS package
21 """
kelvin-onlabd48a68c2015-07-13 16:01:36 -070022 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' ] )
Jon Hall78be4962017-05-23 14:53:53 -070059 main.cellData = {} # for creating cell file
Jon Halla3e02432015-07-24 15:55:42 -070060 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
Jon Hall78be4962017-05-23 14:53:53 -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
Jon Hall78be4962017-05-23 14:53:53 -070072 for i in range( 1, main.maxNodes + 1 ):
Jon Halla3e02432015-07-24 15:55:42 -070073 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 Hall78be4962017-05-23 14:53:53 -070081 main.intents = imp.load_source( wrapperFile2,
Jon Halla3e02432015-07-24 15:55:42 -070082 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:
Jon Hall78be4962017-05-23 14:53:53 -0700102 main.log.exception( e )
Jon Halla3e02432015-07-24 15:55:42 -0700103 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 ):
Jon Hall78be4962017-05-23 14:53:53 -0700173 tempOnosIp.append( main.ONOSip[ i ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700174
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700175 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
176 "temp", main.Mininet1.ip_address,
Devin Lim461f0872017-06-05 16:49:33 -0700177 main.apps, tempOnosIp, main.ONOScli1.user_name )
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,
Jon Hall78be4962017-05-23 14:53:53 -0700185 onpass="Successfully applied cell to " +
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700186 "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 ) ):
Jon Hall78be4962017-05-23 14:53:53 -0700211 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
You Wangf5de25b2017-01-06 15:13:01 -0800212 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:
Jon Hall78be4962017-05-23 14:53:53 -0700234 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
Jon Hall78be4962017-05-23 14:53:53 -0700257 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700258
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\
Jon Hall78be4962017-05-23 14:53:53 -0700285 ( 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\
Jon Hall78be4962017-05-23 14:53:53 -0700307 "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(
Jon Hall78be4962017-05-23 14:53:53 -0700318 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(
Jon Hall78be4962017-05-23 14:53:53 -0700333 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(
Jon Hall78be4962017-05-23 14:53:53 -0700348 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
acsmars59a4c552015-09-10 18:11:19 -0700357 utilities.assert_equals( expect=[],
358 actual=deviceFails,
359 onpass="ONOS correctly discovered all devices",
360 onfail="ONOS incorrectly discovered devices on nodes: " +
361 str( deviceFails ) )
362 utilities.assert_equals( expect=[],
363 actual=linkFails,
364 onpass="ONOS correctly discovered all links",
365 onfail="ONOS incorrectly discovered links on nodes: " +
366 str( linkFails ) )
367 utilities.assert_equals( expect=[],
368 actual=hostFails,
369 onpass="ONOS correctly discovered all hosts",
370 onfail="ONOS incorrectly discovered hosts on nodes: " +
371 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700372 topoResults = hostsResults and linksResults and devicesResults
373 utilities.assert_equals( expect=main.TRUE,
374 actual=topoResults,
375 onpass="ONOS correctly discovered the topology",
376 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700377
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700378 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700379 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700380 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700381 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700382 if main.initialized == main.FALSE:
383 main.log.error( "Test components did not start correctly, skipping further tests" )
384 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700385 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700386 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700387 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700388 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700389 "switches to test intents, exits out if " +\
390 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700391
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700392 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700393 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700394 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700395 main.topology,
396 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700397 stepResult = topoResult
398 utilities.assert_equals( expect=main.TRUE,
399 actual=stepResult,
400 onpass="Successfully loaded topology",
401 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700402
403 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700404 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700405 main.initialized = main.FALSE
406 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700407
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700408 def CASE11( self, main ):
409 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700410 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700411 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700412 if main.initialized == main.FALSE:
413 main.log.error( "Test components did not start correctly, skipping further tests" )
414 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700415 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700416 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700417 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700418 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700419 "switches to test intents, exits out if " +\
420 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700421
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700422 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700423 args = "--switch ovs,protocols=OpenFlow13"
424 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
425 main.topology,
426 args=args )
427 stepResult = topoResult
428 utilities.assert_equals( expect=main.TRUE,
429 actual=stepResult,
430 onpass="Successfully loaded topology",
431 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700432 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700433 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700434 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700435
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700436 def CASE12( self, main ):
437 """
438 Assign mastership to controllers
439 """
440 import re
441
Jeremyd9e4eb12016-04-13 12:09:06 -0700442 if main.initialized == main.FALSE:
443 main.log.error( "Test components did not start correctly, skipping further tests" )
444 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700445 main.case( "Assign switches to controllers" )
446 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700447 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700448 " switches to ONOS nodes"
449
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700450 switchList = []
451
452 # Creates a list switch name, use getSwitch() function later...
453 for i in range( 1, ( main.numSwitch + 1 ) ):
454 switchList.append( 's' + str( i ) )
455
456 tempONOSip = []
457 for i in range( main.numCtrls ):
458 tempONOSip.append( main.ONOSip[ i ] )
459
460 assignResult = main.Mininet1.assignSwController( sw=switchList,
461 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700462 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700463 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700464 main.log.error( "Problem assigning mastership of switches" )
465 main.initialized = main.FALSE
466 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700467
468 for i in range( 1, ( main.numSwitch + 1 ) ):
469 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700470 main.log.debug( "Response is " + str( response ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700471 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
472 assignResult = assignResult and main.TRUE
473 else:
474 assignResult = main.FALSE
475 stepResult = assignResult
476 utilities.assert_equals( expect=main.TRUE,
477 actual=stepResult,
478 onpass="Successfully assigned switches" +
479 "to controller",
480 onfail="Failed to assign switches to " +
481 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700482 if not stepResult:
483 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700484
Jon Hall78be4962017-05-23 14:53:53 -0700485 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700486 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800487 Create Scapy components
488 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700489 if main.initialized == main.FALSE:
490 main.log.error( "Test components did not start correctly, skipping further tests" )
491 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800492 main.case( "Create scapy components" )
493 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800494 scapyResult = main.TRUE
495 for hostName in main.scapyHostNames:
496 main.Scapy1.createHostComponent( hostName )
497 main.scapyHosts.append( getattr( main, hostName ) )
498
499 main.step( "Start scapy components" )
500 for host in main.scapyHosts:
501 host.startHostCli()
502 host.startScapy()
503 host.updateSelf()
504 main.log.debug( host.name )
505 main.log.debug( host.hostIp )
506 main.log.debug( host.hostMac )
507
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800508 utilities.assert_equals( expect=main.TRUE,
509 actual=scapyResult,
510 onpass="Successfully created Scapy Components",
511 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700512 if not scapyResult:
513 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800514
515 def CASE14( self, main ):
516 """
517 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700518 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700519 if main.initialized == main.FALSE:
520 main.log.error( "Test components did not start correctly, skipping further tests" )
521 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700522 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800523 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700524 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700525
Jon Hall78be4962017-05-23 14:53:53 -0700526 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
527 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700528 utilities.assert_equals( expect=main.TRUE,
529 actual=stepResult,
530 onpass="Successfully discovered hosts",
531 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700532 if not stepResult:
533 main.initialized = main.FALSE
534 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700535
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800536 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700537 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700538 utilities.assert_equals( expect=main.TRUE,
539 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800540 onpass="Successfully populated hostsData",
541 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700542 if not stepResult:
543 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800544
545 def CASE15( self, main ):
546 """
547 Discover all hosts with scapy arp packets and store its data to a dictionary
548 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700549 if main.initialized == main.FALSE:
550 main.log.error( "Test components did not start correctly, skipping further tests" )
551 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800552 main.case( "Discover all hosts using scapy" )
553 main.step( "Send packets from each host to the first host and confirm onos discovery" )
554
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800555 if len( main.scapyHosts ) < 1:
556 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700557 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800558 main.skipCase()
559
560 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700561 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800562
Jon Hall78be4962017-05-23 14:53:53 -0700563 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800564 retValue=main.FALSE, args=[ main ],
565 attempts=main.checkTopoAttempts, sleep=2 )
566
567 utilities.assert_equals( expect=main.TRUE,
568 actual=stepResult,
569 onpass="ONOS correctly discovered all hosts",
570 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700571 if not stepResult:
572 main.initialized = main.FALSE
573 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800574
575 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700576 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800577 utilities.assert_equals( expect=main.TRUE,
578 actual=stepResult,
579 onpass="Successfully populated hostsData",
580 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700581 if not stepResult:
582 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800583
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800584 def CASE16( self, main ):
585 """
Jeremy42df2e72016-02-23 16:37:46 -0800586 Balance Masters
587 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700588 if main.initialized == main.FALSE:
589 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700590 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700591 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800592 main.case( "Balance mastership of switches" )
593 main.step( "Balancing mastership of switches" )
594
Jeremy42df2e72016-02-23 16:37:46 -0800595 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
596
597 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700598 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800599 onpass="Successfully balanced mastership of switches",
600 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700601 if not balanceResult:
602 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800603
604 def CASE17( self, main ):
605 """
Jeremy6e9748f2016-03-25 15:03:39 -0700606 Use Flow Objectives
607 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700608 if main.initialized == main.FALSE:
609 main.log.error( "Test components did not start correctly, skipping further tests" )
610 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700611 main.case( "Enable intent compilation using Flow Objectives" )
612 main.step( "Enabling Flow Objectives" )
613
614 main.flowCompiler = "Flow Objectives"
615
616 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
617
618 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
619 propName="useFlowObjectives", value="true" )
You Wang106d0fa2017-05-15 17:22:15 -0700620 stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
621 propName="defaultFlowObjectiveCompiler",
Jon Hall78be4962017-05-23 14:53:53 -0700622 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700623
624 utilities.assert_equals( expect=main.TRUE,
625 actual=stepResult,
626 onpass="Successfully activated Flow Objectives",
627 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700628 if not balanceResult:
629 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700630
631 def CASE18( self, main ):
632 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800633 Stop mininet and remove scapy host
634 """
635 main.log.report( "Stop Mininet and Scapy" )
636 main.case( "Stop Mininet and Scapy" )
637 main.caseExplanation = "Stopping the current mininet topology " +\
638 "to start up fresh"
639 main.step( "Stopping and Removing Scapy Host Components" )
640 scapyResult = main.TRUE
641 for host in main.scapyHosts:
642 scapyResult = scapyResult and host.stopScapy()
643 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
644
645 for host in main.scapyHosts:
646 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
647 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
648
649 main.scapyHosts = []
650 main.scapyHostIPs = []
651
652 utilities.assert_equals( expect=main.TRUE,
653 actual=scapyResult,
654 onpass="Successfully stopped scapy and removed host components",
655 onfail="Failed to stop mininet and scapy" )
656
657 main.step( "Stopping Mininet Topology" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700658 mininetResult = main.Mininet1.stopNet()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800659
660 utilities.assert_equals( expect=main.TRUE,
661 actual=mininetResult,
662 onpass="Successfully stopped mininet and scapy",
663 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700664 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800665 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700666 main.cleanup()
667 main.exit()
668
Jeremy Songster17147f22016-05-31 18:30:52 -0700669 def CASE19( self, main ):
670 """
671 Copy the karaf.log files after each testcase cycle
672 """
673 main.log.report( "Copy karaf logs" )
674 main.case( "Copy karaf logs" )
675 main.caseExplanation = "Copying the karaf logs to preserve them through" +\
676 "reinstalling ONOS"
677 main.step( "Copying karaf logs" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700678 stepResult = main.TRUE
679 scpResult = main.TRUE
680 copyResult = main.TRUE
Jeremy Songstercc5414b2016-07-11 10:59:53 -0700681 for i in range( main.numCtrls ):
682 main.node = main.CLIs[ i ]
Jeremy Songster17147f22016-05-31 18:30:52 -0700683 ip = main.ONOSip[ i ]
684 main.node.ip_address = ip
Jon Hall78be4962017-05-23 14:53:53 -0700685 scpResult = scpResult and main.ONOSbench.scp( main.node,
686 "/opt/onos/log/karaf.log",
687 "/tmp/karaf.log",
688 direction="from" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700689 copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
690 copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
691 if scpResult and copyResult:
Jon Hall78be4962017-05-23 14:53:53 -0700692 stepResult = main.TRUE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700693 else:
694 stepResult = main.FALSE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700695 utilities.assert_equals( expect=main.TRUE,
696 actual=stepResult,
697 onpass="Successfully copied remote ONOS logs",
698 onfail="Failed to copy remote ONOS logs" )
Jeremy Songster17147f22016-05-31 18:30:52 -0700699
kelvin-onlabb769f562015-07-15 17:05:10 -0700700 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700701 """
702 Add host intents between 2 host:
703 - Discover hosts
704 - Add host intents
705 - Check intents
706 - Verify flows
707 - Ping hosts
708 - Reroute
709 - Link down
710 - Verify flows
711 - Check topology
712 - Ping hosts
713 - Link up
714 - Verify flows
715 - Check topology
716 - Ping hosts
717 - Remove intents
718 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700719 if main.initialized == main.FALSE:
720 main.log.error( "Test components did not start correctly, skipping further tests" )
721 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700722 # Assert variables - These variable's name|format must be followed
723 # if you want to use the wrapper function
724 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700725 try:
726 assert main.CLIs
727 except AssertionError:
728 main.log.error( "There is no main.CLIs, skipping test cases" )
729 main.initialized = main.FALSE
730 main.skipCase()
731 try:
732 assert main.Mininet1
733 except AssertionError:
734 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
735 main.initialized = main.FALSE
736 main.skipCase()
737 try:
738 assert main.numSwitch
739 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700740 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700741 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700742 main.initialized = main.FALSE
743 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700744
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800745 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700746 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
747
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700748 main.testName = "Host Intents"
749 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700750 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700751 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700752 str( main.numCtrls ) + " node(s) cluster;\n" +\
753 "Different type of hosts will be tested in " +\
754 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700755 "etc;\nThe test will use OF " + main.OFProtocol +\
756 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700757 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700758
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700759 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700760 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700761 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
762 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800763 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700764 installResult = main.intents.installHostIntent( main,
765 name="IPV4",
766 onosNode=0,
767 host1=host1,
768 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800769 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700770 testResult = main.intents.testHostIntent( main,
771 name="IPV4",
772 intentId=installResult,
773 onosNode=0,
774 host1=host1,
775 host2=host2,
776 sw1="s5",
777 sw2="s2",
778 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800779 else:
780 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800781
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700782 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800783 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700784 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700785 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700786
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700787 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700788 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700789 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700790 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800791 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700792 installResult = main.intents.installHostIntent( main,
793 name="DUALSTACK",
794 onosNode=0,
795 host1=host1,
796 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800797
798 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700799 testResult = main.intents.testHostIntent( main,
800 name="DUALSTACK",
801 intentId=installResult,
802 onosNode=0,
803 host1=host1,
804 host2=host2,
805 sw1="s5",
806 sw2="s2",
807 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700808
809 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800810 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700811 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700812 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700813
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700814 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700815 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700816 host1 = { "name": "h1" }
817 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800818 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700819 installResult = main.intents.installHostIntent( main,
820 name="DUALSTACK2",
821 onosNode=0,
822 host1=host1,
823 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800824
825 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700826 testResult = main.intents.testHostIntent( main,
827 name="DUALSTACK2",
828 intentId=installResult,
829 onosNode=0,
830 host1=host1,
831 host2=host2,
832 sw1="s5",
833 sw2="s2",
834 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800835 else:
836 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700837
838 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800839 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700840 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700841 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700842
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700843 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700844 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700845 host1 = { "name": "h1" }
846 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800847 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700848 installResult = main.intents.installHostIntent( main,
849 name="1HOP",
850 onosNode=0,
851 host1=host1,
852 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800853
854 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700855 testResult = main.intents.testHostIntent( main,
856 name="1HOP",
857 intentId=installResult,
858 onosNode=0,
859 host1=host1,
860 host2=host2,
861 sw1="s5",
862 sw2="s2",
863 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800864 else:
865 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700866
867 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800868 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700869 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700870 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700871
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700872 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700873 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700874 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
875 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800876 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700877 installResult = main.intents.installHostIntent( main,
878 name="VLAN1",
879 onosNode=0,
880 host1=host1,
881 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800882 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700883 testResult = main.intents.testHostIntent( main,
884 name="VLAN1",
885 intentId=installResult,
886 onosNode=0,
887 host1=host1,
888 host2=host2,
889 sw1="s5",
890 sw2="s2",
891 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800892 else:
893 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700894
895 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800896 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700897 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700898 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700899
Jeremy Songsterff553672016-05-12 17:06:23 -0700900 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
901 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700902 host1 = { "name": "h5", "vlan": "200" }
903 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700904 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700905 installResult = main.intents.installHostIntent( main,
906 name="VLAN2",
907 onosNode=0,
908 host1=host1,
909 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700910
911 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700912 testResult = main.intents.testHostIntent( main,
913 name="VLAN2",
914 intentId=installResult,
915 onosNode=0,
916 host1=host1,
917 host2=host2,
918 sw1="s5",
919 sw2="s2",
920 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700921 else:
922 main.CLIs[ 0 ].removeAllIntents( purge=True )
923
924 utilities.assert_equals( expect=main.TRUE,
925 actual=testResult,
926 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700927 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700928
Jeremy Songsterc032f162016-08-04 17:14:49 -0700929 main.step( "Encapsulation: Add host intents between h1 and h9" )
930 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700931 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
932 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700933 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700934 installResult = main.intents.installHostIntent( main,
935 name="ENCAPSULATION",
936 onosNode=0,
937 host1=host1,
938 host2=host2,
939 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700940 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700941 testResult = main.intents.testHostIntent( main,
942 name="ENCAPSULATION",
943 intentId=installResult,
944 onosNode=0,
945 host1=host1,
946 host2=host2,
947 sw1="s5",
948 sw2="s2",
949 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700950 else:
951 main.CLIs[ 0 ].removeAllIntents( purge=True )
952
953 utilities.assert_equals( expect=main.TRUE,
954 actual=testResult,
955 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700956 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700957
Jon Hall78be4962017-05-23 14:53:53 -0700958 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700959 # main.step( "Encapsulation: Add host intents between h1 and h9" )
960 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
961 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
962 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
963 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700964 # installResult = main.intents.installHostIntent( main,
965 # name="ENCAPSULATION",
966 # onosNode=0,
967 # host1=host1,
968 # host2=host2,
969 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700970 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700971 # testResult = main.intents.testHostIntent( main,
972 # name="ENCAPSULATION",
973 # intentId=installResult,
974 # onosNode=0,
975 # host1=host1,
976 # host2=host2,
977 # sw1="s5",
978 # sw2="s2",
979 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700980 # else:
981 # main.CLIs[ 0 ].removeAllIntents( purge=True )
982 #
983 # utilities.assert_equals( expect=main.TRUE,
984 # actual=testResult,
985 # onpass=main.assertReturnString,
986 # onfail=main.assertReturnString )
987
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700988 main.step( "Confirm that ONOS leadership is unchanged" )
acsmarse6b410f2015-07-17 14:39:34 -0700989 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700990 testResult = main.intents.checkLeaderChange( intentLeadersOld,
991 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700992
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800993 utilities.assert_equals( expect=main.TRUE,
994 actual=testResult,
995 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700996 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800997
Jon Hall78be4962017-05-23 14:53:53 -0700998 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700999
kelvin-onlabb769f562015-07-15 17:05:10 -07001000 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001001 """
1002 Add point intents between 2 hosts:
1003 - Get device ids | ports
1004 - Add point intents
1005 - Check intents
1006 - Verify flows
1007 - Ping hosts
1008 - Reroute
1009 - Link down
1010 - Verify flows
1011 - Check topology
1012 - Ping hosts
1013 - Link up
1014 - Verify flows
1015 - Check topology
1016 - Ping hosts
1017 - Remove intents
1018 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001019 if main.initialized == main.FALSE:
1020 main.log.error( "Test components did not start correctly, skipping further tests" )
1021 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001022 # Assert variables - These variable's name|format must be followed
1023 # if you want to use the wrapper function
1024 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001025 try:
1026 assert main.CLIs
1027 except AssertionError:
1028 main.log.error( "There is no main.CLIs, skipping test cases" )
1029 main.initialized = main.FALSE
1030 main.skipCase()
1031 try:
1032 assert main.Mininet1
1033 except AssertionError:
1034 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1035 main.initialized = main.FALSE
1036 main.skipCase()
1037 try:
1038 assert main.numSwitch
1039 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001040 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001041 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001042 main.initialized = main.FALSE
1043 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001044
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001045 main.testName = "Point Intents"
1046 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001047 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001048 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001049 " intents using " + str( main.numCtrls ) +\
1050 " node(s) cluster;\n" +\
1051 "Different type of hosts will be tested in " +\
1052 "each step such as IPV4, Dual stack, VLAN etc" +\
1053 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001054 " OVS running in Mininet and compile intents" +\
1055 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001056
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001057 # No option point intents
1058 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001059 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001060 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001061 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001062 ]
1063 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001064 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001065 ]
Jeremy42df2e72016-02-23 16:37:46 -08001066 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001067 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001068 main,
1069 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001070 senders=senders,
1071 recipients=recipients )
1072
1073 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001074 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001075 main,
1076 intentId=installResult,
1077 name="NOOPTION",
1078 senders=senders,
1079 recipients=recipients,
1080 sw1="s5",
1081 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001082 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001083 else:
1084 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001085
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001086 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001087 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001088 onpass=main.assertReturnString,
1089 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001090
kelvin-onlabb769f562015-07-15 17:05:10 -07001091 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001092 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001093 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001094 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001095 ]
1096 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001097 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001098 ]
Jeremy42df2e72016-02-23 16:37:46 -08001099 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001100 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001101 main,
1102 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001103 senders=senders,
1104 recipients=recipients,
1105 ethType="IPV4" )
1106
1107 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001108 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001109 main,
1110 intentId=installResult,
1111 name="IPV4",
1112 senders=senders,
1113 recipients=recipients,
1114 sw1="s5",
1115 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001116 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001117 else:
1118 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001119
1120 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001121 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001122 onpass=main.assertReturnString,
1123 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -08001124
Jon Hall78be4962017-05-23 14:53:53 -07001125 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -08001126 main.assertReturnString = "Assertion Result for protected point intent\n"
1127 senders = [
Jon Hall78be4962017-05-23 14:53:53 -07001128 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -08001129 ]
1130 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -07001131 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -08001132 ]
1133 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001134 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -08001135 main,
1136 name="Protected",
1137 senders=senders,
1138 recipients=recipients,
1139 protected=True )
1140
1141 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001142 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -08001143 main,
1144 name="Protected",
1145 intentId=installResult,
1146 senders=senders,
1147 recipients=recipients,
1148 sw1="s5",
1149 sw2="s2",
1150 protected=True,
1151 expectedLink=18 )
1152 else:
1153 main.CLIs[ 0 ].removeAllIntents( purge=True )
1154
1155 utilities.assert_equals( expect=main.TRUE,
1156 actual=testResult,
1157 onpass=main.assertReturnString,
1158 onfail=main.assertReturnString )
1159
kelvin-onlabb769f562015-07-15 17:05:10 -07001160 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001161 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001162 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001163 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001164 ]
1165 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001166 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001167 ]
Jeremy42df2e72016-02-23 16:37:46 -08001168 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001169 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001170 main,
1171 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001172 senders=senders,
1173 recipients=recipients,
1174 ethType="IPV4" )
1175
1176 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001177 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001178 main,
1179 intentId=installResult,
1180 name="IPV4_2",
1181 senders=senders,
1182 recipients=recipients,
1183 sw1="s5",
1184 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001185 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001186 else:
1187 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001188
1189 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001190 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001191 onpass=main.assertReturnString,
1192 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001193
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001194 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001195 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001196 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001197 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001198 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001199 ]
1200 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001201 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001202 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001203 ]
Jeremy6f000c62016-02-25 17:02:28 -08001204 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001205 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001206 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1207 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001208 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001209 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001210 main,
1211 name="SDNIP-ICMP",
1212 senders=senders,
1213 recipients=recipients,
1214 ethType="IPV4",
1215 ipProto=ipProto,
1216 tcpSrc=tcpSrc,
1217 tcpDst=tcpDst )
1218
1219 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001220 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001221 main,
1222 intentId=installResult,
1223 name="SDNIP_ICMP",
1224 senders=senders,
1225 recipients=recipients,
1226 sw1="s5",
1227 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001228 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001229 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -08001230 else:
1231 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001232
1233 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001234 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001235 onpass=main.assertReturnString,
1236 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001237
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001238 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001239 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001240 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1241 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001242 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1243 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001244 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1245 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1246 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1247
Jon Hall78be4962017-05-23 14:53:53 -07001248 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001249 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001250 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001251 host1="h1",
1252 host2="h9",
1253 deviceId1="of:0000000000000005/1",
1254 deviceId2="of:0000000000000006/1",
1255 mac1=mac1,
1256 mac2=mac2,
1257 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001258 ipProto=ipProto,
1259 ip1=ip1,
1260 ip2=ip2,
1261 tcp1=tcp1,
1262 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001263
1264 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001265 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001266 onpass=main.assertReturnString,
1267 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001268
acsmars5d8cc862015-09-25 09:44:50 -07001269 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1270 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001271 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001272 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001273 ]
1274 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001275 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001276 ]
Jeremy42df2e72016-02-23 16:37:46 -08001277 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001278 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001279 main,
1280 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001281 senders=senders,
1282 recipients=recipients,
1283 ethType="IPV4" )
1284
1285 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001286 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001287 main,
1288 intentId=installResult,
1289 name="DUALSTACK1",
1290 senders=senders,
1291 recipients=recipients,
1292 sw1="s5",
1293 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001294 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001295 else:
1296 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001297
1298 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001299 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001300 onpass=main.assertReturnString,
1301 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001302
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001303 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001304 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001305 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001306 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001307 ]
1308 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001309 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001310 ]
Jeremy42df2e72016-02-23 16:37:46 -08001311 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001312 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001313 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001314 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001315 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001316 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001317
1318 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001319 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001320 main,
1321 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001322 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001323 senders=senders,
1324 recipients=recipients,
1325 sw1="s5",
1326 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001327 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001328
1329 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001330 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001331 onpass=main.assertReturnString,
1332 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001333
Jeremy Songsterff553672016-05-12 17:06:23 -07001334 main.step( "VLAN: Add point intents between h5 and h21" )
1335 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1336 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001337 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001338 ]
1339 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001340 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001341 ]
1342 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001343 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001344 main,
1345 name="VLAN2",
1346 senders=senders,
1347 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001348 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001349
1350 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001351 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001352 main,
1353 intentId=installResult,
1354 name="VLAN2",
1355 senders=senders,
1356 recipients=recipients,
1357 sw1="s5",
1358 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001359 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001360
1361 utilities.assert_equals( expect=main.TRUE,
1362 actual=testResult,
1363 onpass=main.assertReturnString,
1364 onfail=main.assertReturnString )
1365
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001366 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001367 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001368 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001369 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001370 ]
1371 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001372 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001373 ]
Jeremy42df2e72016-02-23 16:37:46 -08001374 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001375 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001376 main,
1377 name="1HOP IPV4",
1378 senders=senders,
1379 recipients=recipients,
1380 ethType="IPV4" )
1381
1382 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001383 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001384 main,
1385 intentId=installResult,
1386 name="1HOP IPV4",
1387 senders=senders,
1388 recipients=recipients,
1389 sw1="s5",
1390 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001391 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001392 else:
1393 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001394
1395 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001396 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001397 onpass=main.assertReturnString,
1398 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001399
Jeremy Songsterc032f162016-08-04 17:14:49 -07001400 main.step( "Add point to point intents using VLAN Encapsulation" )
1401 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1402 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001403 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001404 ]
1405 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001406 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001407 ]
1408 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001409 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001410 main,
1411 name="ENCAPSULATION",
1412 senders=senders,
1413 recipients=recipients,
1414 encap="VLAN" )
1415
1416 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001417 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001418 main,
1419 intentId=installResult,
1420 name="ENCAPSULATION",
1421 senders=senders,
1422 recipients=recipients,
1423 sw1="s5",
1424 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001425 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001426 else:
1427 main.CLIs[ 0 ].removeAllIntents( purge=True )
1428
1429 utilities.assert_equals( expect=main.TRUE,
1430 actual=testResult,
1431 onpass=main.assertReturnString,
1432 onfail=main.assertReturnString )
1433
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001434 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1435 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1436 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001437 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001438 ]
1439 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001440 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001441 ]
1442 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001443 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001444 main,
1445 name="NOOPTION",
1446 senders=senders,
1447 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001448 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001449
1450 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001451 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001452 main,
1453 intentId=installResult,
1454 name="NOOPTION",
1455 senders=senders,
1456 recipients=recipients,
1457 sw1="s5",
1458 sw2="s2",
1459 expectedLink=18 )
1460 else:
1461 main.CLIs[ 0 ].removeAllIntents( purge=True )
1462
1463 utilities.assert_equals( expect=main.TRUE,
1464 actual=testResult,
1465 onpass=main.assertReturnString,
1466 onfail=main.assertReturnString )
1467
Jon Hall78be4962017-05-23 14:53:53 -07001468 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001469 # main.step( "Add point to point intents using MPLS Encapsulation" )
1470 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1471 # senders = [
1472 # { "name": "h1", "device": "of:0000000000000005/1" }
1473 # ]
1474 # recipients = [
1475 # { "name": "h9", "device": "of:0000000000000006/1" }
1476 # ]
1477 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001478 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001479 # main,
1480 # name="ENCAPSULATION",
1481 # senders=senders,
1482 # recipients=recipients,
1483 # encap="MPLS" )
1484 #
1485 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001486 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001487 # main,
1488 # intentId=installResult,
1489 # name="ENCAPSULATION",
1490 # senders=senders,
1491 # recipients=recipients,
1492 # sw1="s5",
1493 # sw2="s2",
1494 # expectedLink=18 )
1495 # else:
1496 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1497 #
1498 # utilities.assert_equals( expect=main.TRUE,
1499 # actual=testResult,
1500 # onpass=main.assertReturnString,
1501 # onfail=main.assertReturnString )
1502
Jon Hall78be4962017-05-23 14:53:53 -07001503 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001504
kelvin-onlabb769f562015-07-15 17:05:10 -07001505 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001506 """
1507 Add single point to multi point intents
1508 - Get device ids
1509 - Add single point to multi point intents
1510 - Check intents
1511 - Verify flows
1512 - Ping hosts
1513 - Reroute
1514 - Link down
1515 - Verify flows
1516 - Check topology
1517 - Ping hosts
1518 - Link up
1519 - Verify flows
1520 - Check topology
1521 - Ping hosts
1522 - Remove intents
1523 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001524 if main.initialized == main.FALSE:
1525 main.log.error( "Test components did not start correctly, skipping further tests" )
1526 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001527 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001528 try:
1529 assert main.CLIs
1530 except AssertionError:
1531 main.log.error( "There is no main.CLIs, skipping test cases" )
1532 main.initialized = main.FALSE
1533 main.skipCase()
1534 try:
1535 assert main.Mininet1
1536 except AssertionError:
1537 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1538 main.initialized = main.FALSE
1539 main.skipCase()
1540 try:
1541 assert main.numSwitch
1542 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001543 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001544 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001545 main.initialized = main.FALSE
1546 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001547
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001548 main.testName = "Single to Multi Point Intents"
1549 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001550 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001551 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001552 " multi point intents using " +\
1553 str( main.numCtrls ) + " node(s) cluster;\n" +\
1554 "Different type of hosts will be tested in " +\
1555 "each step such as IPV4, Dual stack, VLAN etc" +\
1556 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001557 " OVS running in Mininet and compile intents" +\
1558 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001559
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001560 main.step( "NOOPTION: Install and test single point to multi point intents" )
1561 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1562 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001563 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001564 ]
1565 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001566 { "name": "h16", "device": "of:0000000000000006/8" },
1567 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001568 ]
Jon Hall9c888672017-05-15 18:03:54 -07001569 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1570 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001571 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001572 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001573 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001574 name="NOOPTION",
1575 senders=senders,
1576 recipients=recipients,
1577 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001578 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001579
1580 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001581 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001582 main,
1583 intentId=installResult,
1584 name="NOOPTION",
1585 senders=senders,
1586 recipients=recipients,
1587 badSenders=badSenders,
1588 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001589 sw1="s5",
1590 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001591 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001592 else:
1593 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001594
1595 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001596 actual=testResult,
1597 onpass=main.assertReturnString,
1598 onfail=main.assertReturnString )
1599
1600 main.step( "IPV4: Install and test single point to multi point intents" )
1601 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1602 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001603 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001604 ]
1605 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001606 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1607 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001608 ]
Jon Hall9c888672017-05-15 18:03:54 -07001609 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1610 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001611 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001612 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001613 main,
1614 name="IPV4",
1615 senders=senders,
1616 recipients=recipients,
1617 ethType="IPV4",
1618 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001619 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001620
1621 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001622 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001623 main,
1624 intentId=installResult,
1625 name="IPV4",
1626 senders=senders,
1627 recipients=recipients,
1628 badSenders=badSenders,
1629 badRecipients=badRecipients,
1630 sw1="s5",
1631 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001632 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001633 else:
1634 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001635
1636 utilities.assert_equals( expect=main.TRUE,
1637 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001638 onpass=main.assertReturnString,
1639 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001640
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001641 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001642 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 -08001643 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001644 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001645 ]
1646 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001647 { "name": "h16", "device": "of:0000000000000006/8" },
1648 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001649 ]
Jon Hall9c888672017-05-15 18:03:54 -07001650 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1651 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001652 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001653 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001654 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001655 name="IPV4_2",
1656 senders=senders,
1657 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001658 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001659 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001660 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001661
1662 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001663 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001664 main,
1665 intentId=installResult,
1666 name="IPV4_2",
1667 senders=senders,
1668 recipients=recipients,
1669 badSenders=badSenders,
1670 badRecipients=badRecipients,
1671 sw1="s5",
1672 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001673 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001674 else:
1675 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001676
1677 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001678 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001679 onpass=main.assertReturnString,
1680 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001681
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001682 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001683 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 -08001684 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001685 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001686 ]
1687 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001688 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1689 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001690 ]
Jon Hall9c888672017-05-15 18:03:54 -07001691 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1692 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001693 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001694 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001695 main,
alison52b25892016-09-19 10:53:48 -07001696 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001697 senders=senders,
1698 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001699 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001700 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001701
1702 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001703 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001704 main,
1705 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001706 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001707 senders=senders,
1708 recipients=recipients,
1709 badSenders=badSenders,
1710 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001711 sw1="s5",
1712 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001713 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001714 else:
1715 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001716
1717 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001718 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001719 onpass=main.assertReturnString,
1720 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001721
Jeremy Songsterff553672016-05-12 17:06:23 -07001722 main.step( "VLAN: Add single point to multi point intents" )
1723 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1724 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001725 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001726 ]
1727 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001728 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1729 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001730 ]
Jon Hall9c888672017-05-15 18:03:54 -07001731 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1732 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001733 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001734 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001735 main,
1736 name="VLAN2",
1737 senders=senders,
1738 recipients=recipients,
1739 sw1="s5",
1740 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001741 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001742
1743 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001744 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001745 main,
1746 intentId=installResult,
1747 name="VLAN2",
1748 senders=senders,
1749 recipients=recipients,
1750 badSenders=badSenders,
1751 badRecipients=badRecipients,
1752 sw1="s5",
1753 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001754 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001755 else:
1756 main.CLIs[ 0 ].removeAllIntents( purge=True )
1757
1758 utilities.assert_equals( expect=main.TRUE,
1759 actual=testResult,
1760 onpass=main.assertReturnString,
1761 onfail=main.assertReturnString )
1762
alison52b25892016-09-19 10:53:48 -07001763 # Does not support Single point to multi point encapsulation
1764 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1765 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1766 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001767 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001768 # ]
1769 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001770 # { "name": "h16", "device": "of:0000000000000006/8" },
1771 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001772 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001773 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1774 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001775 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001776 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001777 # main,
1778 # name="ENCAPSULATION",
1779 # senders=senders,
1780 # recipients=recipients,
1781 # sw1="s5",
1782 # sw2="s2",
1783 # encap="VLAN" )
1784 #
1785 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001786 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001787 # main,
1788 # intentId=installResult,
1789 # name="ENCAPSULATION",
1790 # senders=senders,
1791 # recipients=recipients,
1792 # badSenders=badSenders,
1793 # badRecipients=badRecipients,
1794 # sw1="s5",
1795 # sw2="s2",
1796 # expectedLink=18 )
1797 # else:
1798 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1799 #
1800 # utilities.assert_equals( expect=main.TRUE,
1801 # actual=testResult,
1802 # onpass=main.assertReturnString,
1803 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001804
Jon Hall78be4962017-05-23 14:53:53 -07001805 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001806
kelvin-onlabb769f562015-07-15 17:05:10 -07001807 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001808 """
1809 Add multi point to single point intents
1810 - Get device ids
1811 - Add multi point to single point intents
1812 - Check intents
1813 - Verify flows
1814 - Ping hosts
1815 - Reroute
1816 - Link down
1817 - Verify flows
1818 - Check topology
1819 - Ping hosts
1820 - Link up
1821 - Verify flows
1822 - Check topology
1823 - Ping hosts
1824 - Remove intents
1825 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001826 if main.initialized == main.FALSE:
1827 main.log.error( "Test components did not start correctly, skipping further tests" )
1828 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001829 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001830 try:
1831 assert main.CLIs
1832 except AssertionError:
1833 main.log.error( "There is no main.CLIs, skipping test cases" )
1834 main.initialized = main.FALSE
1835 main.skipCase()
1836 try:
1837 assert main.Mininet1
1838 except AssertionError:
1839 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1840 main.initialized = main.FALSE
1841 main.skipCase()
1842 try:
1843 assert main.numSwitch
1844 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001845 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001846 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001847 main.initialized = main.FALSE
1848 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001849
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001850 main.testName = "Multi To Single Point Intents"
1851 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001852 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001853 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001854 " multi point intents using " +\
1855 str( main.numCtrls ) + " node(s) cluster;\n" +\
1856 "Different type of hosts will be tested in " +\
1857 "each step such as IPV4, Dual stack, VLAN etc" +\
1858 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001859 " OVS running in Mininet and compile intents" +\
1860 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001861
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001862 main.step( "NOOPTION: Add multi point to single point intents" )
1863 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1864 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001865 { "name": "h16", "device": "of:0000000000000006/8" },
1866 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001867 ]
1868 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001869 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001870 ]
Jon Hall9c888672017-05-15 18:03:54 -07001871 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1872 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001873 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001874 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001875 main,
1876 name="NOOPTION",
1877 senders=senders,
1878 recipients=recipients,
1879 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001880 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001881
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001882 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001883 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001884 main,
1885 intentId=installResult,
1886 name="NOOPTION",
1887 senders=senders,
1888 recipients=recipients,
1889 badSenders=badSenders,
1890 badRecipients=badRecipients,
1891 sw1="s5",
1892 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001893 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001894 else:
1895 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001896
1897 utilities.assert_equals( expect=main.TRUE,
1898 actual=testResult,
1899 onpass=main.assertReturnString,
1900 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001901
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001902 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001903 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 -08001904 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001905 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1906 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001907 ]
1908 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001909 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001910 ]
Jon Hall9c888672017-05-15 18:03:54 -07001911 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1912 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001913 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001914 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001915 main,
1916 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001917 senders=senders,
1918 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001919 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001920 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001921 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001922
1923 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001924 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001925 main,
1926 intentId=installResult,
1927 name="IPV4",
1928 senders=senders,
1929 recipients=recipients,
1930 badSenders=badSenders,
1931 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001932 sw1="s5",
1933 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001934 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001935 else:
1936 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001937
1938 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001939 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001940 onpass=main.assertReturnString,
1941 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001942
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001943 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001944 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 -08001945 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001946 { "name": "h16", "device": "of:0000000000000006/8" },
1947 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001948 ]
1949 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001950 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001951 ]
Jon Hall9c888672017-05-15 18:03:54 -07001952 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1953 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001954 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001955 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001956 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001957 name="IPV4_2",
1958 senders=senders,
1959 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001960 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001961 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001962 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001963
1964 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001965 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001966 main,
1967 intentId=installResult,
1968 name="IPV4_2",
1969 senders=senders,
1970 recipients=recipients,
1971 badSenders=badSenders,
1972 badRecipients=badRecipients,
1973 sw1="s5",
1974 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001975 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001976 else:
1977 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001978
1979 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001980 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001981 onpass=main.assertReturnString,
1982 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001983
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001984 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001985 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 -08001986 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001987 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1988 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001989 ]
1990 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001991 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001992 ]
Jon Hall9c888672017-05-15 18:03:54 -07001993 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1994 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001995 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001996 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001997 main,
1998 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001999 senders=senders,
2000 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002001 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002002 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002003
2004 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002005 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002006 main,
2007 intentId=installResult,
2008 name="VLAN",
2009 senders=senders,
2010 recipients=recipients,
2011 badSenders=badSenders,
2012 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002013 sw1="s5",
2014 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002015 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002016 else:
2017 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002018
2019 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002020 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002021 onpass=main.assertReturnString,
2022 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002023
Jeremy Songsterff553672016-05-12 17:06:23 -07002024 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
2025 main.step( "VLAN: Add multi point to single point intents" )
2026 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
2027 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002028 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
2029 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002030 ]
2031 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002032 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002033 ]
Jon Hall9c888672017-05-15 18:03:54 -07002034 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
2035 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07002036 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002037 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07002038 main,
2039 name="VLAN2",
2040 senders=senders,
2041 recipients=recipients,
2042 sw1="s5",
2043 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002044 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002045
2046 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002047 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07002048 main,
2049 intentId=installResult,
2050 name="VLAN2",
2051 senders=senders,
2052 recipients=recipients,
2053 badSenders=badSenders,
2054 badRecipients=badRecipients,
2055 sw1="s5",
2056 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002057 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002058 else:
2059 main.CLIs[ 0 ].removeAllIntents( purge=True )
2060
2061 utilities.assert_equals( expect=main.TRUE,
2062 actual=testResult,
2063 onpass=main.assertReturnString,
2064 onfail=main.assertReturnString )
2065
Jeremy Songsterc032f162016-08-04 17:14:49 -07002066 main.step( "ENCAPSULATION: Add multi point to single point intents" )
2067 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
2068 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002069 { "name": "h16", "device": "of:0000000000000006/8" },
2070 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002071 ]
2072 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002073 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002074 ]
Jon Hall9c888672017-05-15 18:03:54 -07002075 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2076 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07002077 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002078 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07002079 main,
2080 name="ENCAPSULATION",
2081 senders=senders,
2082 recipients=recipients,
2083 sw1="s5",
2084 sw2="s2",
2085 encap="VLAN" )
2086
2087 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002088 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07002089 main,
2090 intentId=installResult,
2091 name="ENCAPSULATION",
2092 senders=senders,
2093 recipients=recipients,
2094 badSenders=badSenders,
2095 badRecipients=badRecipients,
2096 sw1="s5",
2097 sw2="s2",
2098 expectedLink=18 )
2099 else:
2100 main.CLIs[ 0 ].removeAllIntents( purge=True )
2101
2102 utilities.assert_equals( expect=main.TRUE,
2103 actual=testResult,
2104 onpass=main.assertReturnString,
2105 onfail=main.assertReturnString )
2106
Jon Hall78be4962017-05-23 14:53:53 -07002107 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07002108 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
2109 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
2110 #senders = [
2111 # { "name": "h16", "device": "of:0000000000000006/8" },
2112 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07002113 # ]
Shreyaca8990f2017-03-16 11:43:11 -07002114 #recipients = [
2115 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07002116 # ]
Shreyaca8990f2017-03-16 11:43:11 -07002117 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07002118 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07002119 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002120 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07002121 # main,
2122 # name="ENCAPSULATION",
2123 # senders=senders,
2124 # recipients=recipients,
2125 # sw1="s5",
2126 # sw2="s2",
2127 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07002128 #
Shreyaca8990f2017-03-16 11:43:11 -07002129 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002130 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07002131 # main,
2132 # intentId=installResult,
2133 # name="ENCAPSULATION",
2134 # senders=senders,
2135 # recipients=recipients,
2136 # badSenders=badSenders,
2137 # badRecipients=badRecipients,
2138 # sw1="s5",
2139 # sw2="s2",
2140 # expectedLink=18 )
2141 #else:
2142 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07002143 #
Shreyaca8990f2017-03-16 11:43:11 -07002144 #utilities.assert_equals( expect=main.TRUE,
2145 # actual=testResult,
2146 # onpass=main.assertReturnString,
2147 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07002148
Jon Hall78be4962017-05-23 14:53:53 -07002149 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002150
acsmars1ff5e052015-07-23 11:27:48 -07002151 def CASE5000( self, main ):
2152 """
acsmars5d8cc862015-09-25 09:44:50 -07002153 Tests Host Mobility
2154 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002155 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002156 if main.initialized == main.FALSE:
2157 main.log.error( "Test components did not start correctly, skipping further tests" )
2158 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002159 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002160 try:
2161 assert main.CLIs
2162 except AssertionError:
2163 main.log.error( "There is no main.CLIs, skipping test cases" )
2164 main.initialized = main.FALSE
2165 main.skipCase()
2166 try:
2167 assert main.Mininet1
2168 except AssertionError:
2169 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2170 main.initialized = main.FALSE
2171 main.skipCase()
2172 try:
2173 assert main.numSwitch
2174 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07002175 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002176 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002177 main.initialized = main.FALSE
2178 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002179 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
2180 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002181 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002182
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002183 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07002184 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002185
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002186 # Send discovery ping from moved host
2187 # Moving the host brings down the default interfaces and creates a new one.
2188 # Scapy is restarted on this host to detect the new interface
2189 main.h1.stopScapy()
2190 main.h1.startScapy()
2191
2192 # Discover new host location in ONOS and populate host data.
2193 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07002194 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
2195 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002196
acsmars1ff5e052015-07-23 11:27:48 -07002197 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2198
2199 utilities.assert_equals( expect="of:0000000000000006",
2200 actual=h1PostMove,
2201 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002202 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002203 " to single point intents" +
2204 " with IPV4 type and MAC addresses" +
2205 " in the same VLAN" )
2206
2207 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002208 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07002209 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
2210 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002211 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002212 installResult = main.intents.installHostIntent( main,
2213 name="IPV4 Mobility IPV4",
2214 onosNode=0,
2215 host1=host1,
2216 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002217 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002218 testResult = main.intents.testHostIntent( main,
2219 name="Host Mobility IPV4",
2220 intentId=installResult,
2221 onosNode=0,
2222 host1=host1,
2223 host2=host2,
2224 sw1="s6",
2225 sw2="s2",
2226 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002227 else:
2228 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002229
2230 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002231 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002232 onpass=main.assertReturnString,
2233 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002234
Jon Hall78be4962017-05-23 14:53:53 -07002235 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002236
2237 def CASE6000( self, main ):
2238 """
2239 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2240 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002241 # At some later point discussion on this behavior in MPSP and SPMP intents
2242 # will be reoppened and this test case may need to be updated to reflect
2243 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002244 if main.initialized == main.FALSE:
2245 main.log.error( "Test components did not start correctly, skipping further tests" )
2246 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002247 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002248 try:
2249 assert main.CLIs
2250 except AssertionError:
2251 main.log.error( "There is no main.CLIs, skipping test cases" )
2252 main.initialized = main.FALSE
2253 main.skipCase()
2254 try:
2255 assert main.Mininet1
2256 except AssertionError:
2257 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2258 main.initialized = main.FALSE
2259 main.skipCase()
2260 try:
2261 assert main.numSwitch
2262 except AssertionError:
alison52b25892016-09-19 10:53:48 -07002263 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002264 main.initialized = main.FALSE
2265 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002266 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
2267 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07002268 main.step( "Installing Multi to Single Point intents with no options set" )
2269 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2270 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002271 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002272 { "name": "h16", "device": "of:0000000000000006/8" },
2273 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002274 ]
2275 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002276 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002277 ]
2278 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002279 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002280 ]
2281 isolatedRecipients = []
2282 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002283 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002284 main,
2285 name="NOOPTION",
2286 senders=senders,
2287 recipients=recipients,
2288 sw1="s5",
2289 sw2="s2" )
2290
2291 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002292 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002293 main,
2294 intentId=installResult,
2295 name="NOOPTION",
2296 senders=senders,
2297 recipients=recipients,
2298 isolatedSenders=isolatedSenders,
2299 isolatedRecipients=isolatedRecipients,
2300 sw1="s6",
2301 sw2="s2",
2302 sw3="s4",
2303 sw4="s1",
2304 sw5="s3",
2305 expectedLink1=16,
2306 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002307 else:
2308 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002309
2310 utilities.assert_equals( expect=main.TRUE,
2311 actual=testResult,
2312 onpass=main.assertReturnString,
2313 onfail=main.assertReturnString )
2314
Jeremy Songster9385d412016-06-02 17:57:36 -07002315 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2316
2317 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2318 "with partial failures allowed\n"
2319 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002320 { "name": "h16", "device": "of:0000000000000006/8" },
2321 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002322 ]
2323 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002324 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002325 ]
2326 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002327 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002328 ]
2329 isolatedRecipients = []
2330 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002331 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002332 main,
2333 name="NOOPTION",
2334 senders=senders,
2335 recipients=recipients,
2336 sw1="s5",
2337 sw2="s2",
2338 partial=True )
2339
2340 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002341 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002342 main,
2343 intentId=installResult,
2344 name="NOOPTION",
2345 senders=senders,
2346 recipients=recipients,
2347 isolatedSenders=isolatedSenders,
2348 isolatedRecipients=isolatedRecipients,
2349 sw1="s6",
2350 sw2="s2",
2351 sw3="s4",
2352 sw4="s1",
2353 sw5="s3",
2354 expectedLink1=16,
2355 expectedLink2=14,
2356 partial=True )
2357 else:
2358 main.CLIs[ 0 ].removeAllIntents( purge=True )
2359
2360 utilities.assert_equals( expect=main.TRUE,
2361 actual=testResult,
2362 onpass=main.assertReturnString,
2363 onfail=main.assertReturnString )
2364
Jeremye0cb5eb2016-01-27 17:39:09 -08002365 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002366 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2367 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002368 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002369 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002370 ]
2371 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002372 { "name": "h16", "device": "of:0000000000000006/8" },
2373 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002374 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002375 isolatedSenders = []
2376 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002377 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002378 ]
2379 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002380 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002381 main,
2382 name="NOOPTION",
2383 senders=senders,
2384 recipients=recipients,
2385 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002386 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002387
2388 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002389 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002390 main,
2391 intentId=installResult,
2392 name="NOOPTION",
2393 senders=senders,
2394 recipients=recipients,
2395 isolatedSenders=isolatedSenders,
2396 isolatedRecipients=isolatedRecipients,
2397 sw1="s6",
2398 sw2="s2",
2399 sw3="s4",
2400 sw4="s1",
2401 sw5="s3",
2402 expectedLink1=16,
2403 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002404 else:
2405 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002406
2407 utilities.assert_equals( expect=main.TRUE,
2408 actual=testResult,
2409 onpass=main.assertReturnString,
2410 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002411 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002412 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002413 "intents with partial failures allowed" )
2414 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2415 "point intent with partial failures allowed\n"
2416 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002417 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002418 ]
2419 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002420 { "name": "h16", "device": "of:0000000000000006/8" },
2421 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002422 ]
2423 isolatedSenders = []
2424 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002425 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002426 ]
2427 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002428 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002429 main,
2430 name="NOOPTION",
2431 senders=senders,
2432 recipients=recipients,
2433 sw1="s5",
2434 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002435 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002436
2437 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002438 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002439 main,
2440 intentId=installResult,
2441 name="NOOPTION",
2442 senders=senders,
2443 recipients=recipients,
2444 isolatedSenders=isolatedSenders,
2445 isolatedRecipients=isolatedRecipients,
2446 sw1="s6",
2447 sw2="s2",
2448 sw3="s4",
2449 sw4="s1",
2450 sw5="s3",
2451 expectedLink1=16,
2452 expectedLink2=14,
2453 partial=True )
2454 else:
2455 main.CLIs[ 0 ].removeAllIntents( purge=True )
2456
2457 utilities.assert_equals( expect=main.TRUE,
2458 actual=testResult,
2459 onpass=main.assertReturnString,
2460 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002461
Jon Hall78be4962017-05-23 14:53:53 -07002462 main.intents.report( main )