blob: 9d76b240052d8f484249244b75205369949eb948 [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,
177 main.apps, tempOnosIp )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700178
179 main.step( "Apply cell to environment" )
180 cellResult = main.ONOSbench.setCell( "temp" )
181 verifyResult = main.ONOSbench.verifyCell()
182 stepResult = cellResult and verifyResult
183 utilities.assert_equals( expect=main.TRUE,
184 actual=stepResult,
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
Jon Hall78be4962017-05-23 14:53:53 -07001057 """
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001058 # No option point intents
1059 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001060 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001061 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001062 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001063 ]
1064 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001065 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001066 ]
Jeremy42df2e72016-02-23 16:37:46 -08001067 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001068 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001069 main,
1070 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001071 senders=senders,
1072 recipients=recipients )
1073
1074 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001075 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001076 main,
1077 intentId=installResult,
1078 name="NOOPTION",
1079 senders=senders,
1080 recipients=recipients,
1081 sw1="s5",
1082 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001083 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001084 else:
1085 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001086
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001087 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001088 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001089 onpass=main.assertReturnString,
1090 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001091
kelvin-onlabb769f562015-07-15 17:05:10 -07001092 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001093 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001094 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001095 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001096 ]
1097 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001098 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001099 ]
Jeremy42df2e72016-02-23 16:37:46 -08001100 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001101 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001102 main,
1103 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001104 senders=senders,
1105 recipients=recipients,
1106 ethType="IPV4" )
1107
1108 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001109 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001110 main,
1111 intentId=installResult,
1112 name="IPV4",
1113 senders=senders,
1114 recipients=recipients,
1115 sw1="s5",
1116 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001117 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001118 else:
1119 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001120
1121 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001122 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001123 onpass=main.assertReturnString,
1124 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -08001125
Jon Hall78be4962017-05-23 14:53:53 -07001126 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -08001127 main.assertReturnString = "Assertion Result for protected point intent\n"
1128 senders = [
Jon Hall78be4962017-05-23 14:53:53 -07001129 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -08001130 ]
1131 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -07001132 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -08001133 ]
1134 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001135 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -08001136 main,
1137 name="Protected",
1138 senders=senders,
1139 recipients=recipients,
1140 protected=True )
1141
1142 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001143 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -08001144 main,
1145 name="Protected",
1146 intentId=installResult,
1147 senders=senders,
1148 recipients=recipients,
1149 sw1="s5",
1150 sw2="s2",
1151 protected=True,
1152 expectedLink=18 )
1153 else:
1154 main.CLIs[ 0 ].removeAllIntents( purge=True )
1155
1156 utilities.assert_equals( expect=main.TRUE,
1157 actual=testResult,
1158 onpass=main.assertReturnString,
1159 onfail=main.assertReturnString )
1160
kelvin-onlabb769f562015-07-15 17:05:10 -07001161 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001162 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001163 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001164 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001165 ]
1166 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001167 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001168 ]
Jeremy42df2e72016-02-23 16:37:46 -08001169 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001170 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001171 main,
1172 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001173 senders=senders,
1174 recipients=recipients,
1175 ethType="IPV4" )
1176
1177 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001178 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001179 main,
1180 intentId=installResult,
1181 name="IPV4_2",
1182 senders=senders,
1183 recipients=recipients,
1184 sw1="s5",
1185 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001186 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001187 else:
1188 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001189
1190 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001191 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001192 onpass=main.assertReturnString,
1193 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001194
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001195 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001196 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001197 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001198 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001199 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001200 ]
1201 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001202 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001203 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001204 ]
Jeremy6f000c62016-02-25 17:02:28 -08001205 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001206 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001207 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1208 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001209 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001210 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001211 main,
1212 name="SDNIP-ICMP",
1213 senders=senders,
1214 recipients=recipients,
1215 ethType="IPV4",
1216 ipProto=ipProto,
1217 tcpSrc=tcpSrc,
1218 tcpDst=tcpDst )
1219
1220 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001221 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001222 main,
1223 intentId=installResult,
1224 name="SDNIP_ICMP",
1225 senders=senders,
1226 recipients=recipients,
1227 sw1="s5",
1228 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001229 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001230 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -08001231 else:
1232 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001233
1234 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001235 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001236 onpass=main.assertReturnString,
1237 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001238
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001239 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001240 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001241 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1242 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001243 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1244 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001245 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1246 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1247 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1248
Jon Hall78be4962017-05-23 14:53:53 -07001249 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001250 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001251 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001252 host1="h1",
1253 host2="h9",
1254 deviceId1="of:0000000000000005/1",
1255 deviceId2="of:0000000000000006/1",
1256 mac1=mac1,
1257 mac2=mac2,
1258 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001259 ipProto=ipProto,
1260 ip1=ip1,
1261 ip2=ip2,
1262 tcp1=tcp1,
1263 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001264
1265 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001266 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001267 onpass=main.assertReturnString,
1268 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001269
acsmars5d8cc862015-09-25 09:44:50 -07001270 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1271 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001272 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001273 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001274 ]
1275 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001276 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001277 ]
Jeremy42df2e72016-02-23 16:37:46 -08001278 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001279 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001280 main,
1281 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001282 senders=senders,
1283 recipients=recipients,
1284 ethType="IPV4" )
1285
1286 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001287 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001288 main,
1289 intentId=installResult,
1290 name="DUALSTACK1",
1291 senders=senders,
1292 recipients=recipients,
1293 sw1="s5",
1294 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001295 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001296 else:
1297 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001298
1299 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001300 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001301 onpass=main.assertReturnString,
1302 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001303
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001304 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001305 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001306 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001307 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001308 ]
1309 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001310 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001311 ]
Jeremy42df2e72016-02-23 16:37:46 -08001312 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001313 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001314 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001315 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001316 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001317 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001318
1319 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001320 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001321 main,
1322 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001323 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001324 senders=senders,
1325 recipients=recipients,
1326 sw1="s5",
1327 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001328 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001329
1330 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001331 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001332 onpass=main.assertReturnString,
1333 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001334
Jeremy Songsterff553672016-05-12 17:06:23 -07001335 main.step( "VLAN: Add point intents between h5 and h21" )
1336 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1337 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001338 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001339 ]
1340 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001341 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001342 ]
1343 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001344 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001345 main,
1346 name="VLAN2",
1347 senders=senders,
1348 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001349 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001350
1351 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001352 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001353 main,
1354 intentId=installResult,
1355 name="VLAN2",
1356 senders=senders,
1357 recipients=recipients,
1358 sw1="s5",
1359 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001360 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001361
1362 utilities.assert_equals( expect=main.TRUE,
1363 actual=testResult,
1364 onpass=main.assertReturnString,
1365 onfail=main.assertReturnString )
1366
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001367 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001368 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001369 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001370 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001371 ]
1372 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001373 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001374 ]
Jeremy42df2e72016-02-23 16:37:46 -08001375 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001376 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001377 main,
1378 name="1HOP IPV4",
1379 senders=senders,
1380 recipients=recipients,
1381 ethType="IPV4" )
1382
1383 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001384 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001385 main,
1386 intentId=installResult,
1387 name="1HOP IPV4",
1388 senders=senders,
1389 recipients=recipients,
1390 sw1="s5",
1391 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001392 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001393 else:
1394 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001395
1396 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001397 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001398 onpass=main.assertReturnString,
1399 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001400
Jeremy Songsterc032f162016-08-04 17:14:49 -07001401 main.step( "Add point to point intents using VLAN Encapsulation" )
1402 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1403 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001404 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001405 ]
1406 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001407 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001408 ]
1409 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001410 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001411 main,
1412 name="ENCAPSULATION",
1413 senders=senders,
1414 recipients=recipients,
1415 encap="VLAN" )
1416
1417 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001418 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001419 main,
1420 intentId=installResult,
1421 name="ENCAPSULATION",
1422 senders=senders,
1423 recipients=recipients,
1424 sw1="s5",
1425 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001426 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001427 else:
1428 main.CLIs[ 0 ].removeAllIntents( purge=True )
1429
1430 utilities.assert_equals( expect=main.TRUE,
1431 actual=testResult,
1432 onpass=main.assertReturnString,
1433 onfail=main.assertReturnString )
1434
Jon Hall78be4962017-05-23 14:53:53 -07001435 """
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001436 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1437 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1438 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001439 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001440 ]
1441 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001442 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001443 ]
1444 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001445 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001446 main,
1447 name="NOOPTION",
1448 senders=senders,
1449 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001450 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001451
1452 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001453 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001454 main,
1455 intentId=installResult,
1456 name="NOOPTION",
1457 senders=senders,
1458 recipients=recipients,
1459 sw1="s5",
1460 sw2="s2",
1461 expectedLink=18 )
1462 else:
1463 main.CLIs[ 0 ].removeAllIntents( purge=True )
1464
1465 utilities.assert_equals( expect=main.TRUE,
1466 actual=testResult,
1467 onpass=main.assertReturnString,
1468 onfail=main.assertReturnString )
1469
Jon Hall78be4962017-05-23 14:53:53 -07001470 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001471 # main.step( "Add point to point intents using MPLS Encapsulation" )
1472 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1473 # senders = [
1474 # { "name": "h1", "device": "of:0000000000000005/1" }
1475 # ]
1476 # recipients = [
1477 # { "name": "h9", "device": "of:0000000000000006/1" }
1478 # ]
1479 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001480 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001481 # main,
1482 # name="ENCAPSULATION",
1483 # senders=senders,
1484 # recipients=recipients,
1485 # encap="MPLS" )
1486 #
1487 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001488 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001489 # main,
1490 # intentId=installResult,
1491 # name="ENCAPSULATION",
1492 # senders=senders,
1493 # recipients=recipients,
1494 # sw1="s5",
1495 # sw2="s2",
1496 # expectedLink=18 )
1497 # else:
1498 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1499 #
1500 # utilities.assert_equals( expect=main.TRUE,
1501 # actual=testResult,
1502 # onpass=main.assertReturnString,
1503 # onfail=main.assertReturnString )
1504
Jon Hall78be4962017-05-23 14:53:53 -07001505 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001506
kelvin-onlabb769f562015-07-15 17:05:10 -07001507 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001508 """
1509 Add single point to multi point intents
1510 - Get device ids
1511 - Add single point to multi point intents
1512 - Check intents
1513 - Verify flows
1514 - Ping hosts
1515 - Reroute
1516 - Link down
1517 - Verify flows
1518 - Check topology
1519 - Ping hosts
1520 - Link up
1521 - Verify flows
1522 - Check topology
1523 - Ping hosts
1524 - Remove intents
1525 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001526 if main.initialized == main.FALSE:
1527 main.log.error( "Test components did not start correctly, skipping further tests" )
1528 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001529 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001530 try:
1531 assert main.CLIs
1532 except AssertionError:
1533 main.log.error( "There is no main.CLIs, skipping test cases" )
1534 main.initialized = main.FALSE
1535 main.skipCase()
1536 try:
1537 assert main.Mininet1
1538 except AssertionError:
1539 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1540 main.initialized = main.FALSE
1541 main.skipCase()
1542 try:
1543 assert main.numSwitch
1544 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001545 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001546 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001547 main.initialized = main.FALSE
1548 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001549
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001550 main.testName = "Single to Multi Point Intents"
1551 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001552 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001553 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001554 " multi point intents using " +\
1555 str( main.numCtrls ) + " node(s) cluster;\n" +\
1556 "Different type of hosts will be tested in " +\
1557 "each step such as IPV4, Dual stack, VLAN etc" +\
1558 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001559 " OVS running in Mininet and compile intents" +\
1560 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001561
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001562 main.step( "NOOPTION: Install and test single point to multi point intents" )
1563 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1564 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001565 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001566 ]
1567 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001568 { "name": "h16", "device": "of:0000000000000006/8" },
1569 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001570 ]
Jon Hall9c888672017-05-15 18:03:54 -07001571 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1572 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001573 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001574 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001575 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001576 name="NOOPTION",
1577 senders=senders,
1578 recipients=recipients,
1579 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001580 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001581
1582 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001583 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001584 main,
1585 intentId=installResult,
1586 name="NOOPTION",
1587 senders=senders,
1588 recipients=recipients,
1589 badSenders=badSenders,
1590 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001591 sw1="s5",
1592 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001593 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001594 else:
1595 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001596
1597 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001598 actual=testResult,
1599 onpass=main.assertReturnString,
1600 onfail=main.assertReturnString )
1601
1602 main.step( "IPV4: Install and test single point to multi point intents" )
1603 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1604 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001605 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001606 ]
1607 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001608 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1609 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001610 ]
Jon Hall9c888672017-05-15 18:03:54 -07001611 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1612 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001613 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001614 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001615 main,
1616 name="IPV4",
1617 senders=senders,
1618 recipients=recipients,
1619 ethType="IPV4",
1620 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001621 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001622
1623 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001624 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001625 main,
1626 intentId=installResult,
1627 name="IPV4",
1628 senders=senders,
1629 recipients=recipients,
1630 badSenders=badSenders,
1631 badRecipients=badRecipients,
1632 sw1="s5",
1633 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001634 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001635 else:
1636 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001637
1638 utilities.assert_equals( expect=main.TRUE,
1639 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001640 onpass=main.assertReturnString,
1641 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001642
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001643 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001644 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 -08001645 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001646 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001647 ]
1648 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001649 { "name": "h16", "device": "of:0000000000000006/8" },
1650 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001651 ]
Jon Hall9c888672017-05-15 18:03:54 -07001652 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1653 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001654 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001655 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001656 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001657 name="IPV4_2",
1658 senders=senders,
1659 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001660 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001661 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001662 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001663
1664 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001665 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001666 main,
1667 intentId=installResult,
1668 name="IPV4_2",
1669 senders=senders,
1670 recipients=recipients,
1671 badSenders=badSenders,
1672 badRecipients=badRecipients,
1673 sw1="s5",
1674 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001675 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001676 else:
1677 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001678
1679 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001680 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001681 onpass=main.assertReturnString,
1682 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001683
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001684 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001685 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 -08001686 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001687 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001688 ]
1689 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001690 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1691 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001692 ]
Jon Hall9c888672017-05-15 18:03:54 -07001693 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1694 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001695 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001696 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001697 main,
alison52b25892016-09-19 10:53:48 -07001698 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001699 senders=senders,
1700 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001701 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001702 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001703
1704 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001705 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001706 main,
1707 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001708 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001709 senders=senders,
1710 recipients=recipients,
1711 badSenders=badSenders,
1712 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001713 sw1="s5",
1714 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001715 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001716 else:
1717 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001718
1719 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001720 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001721 onpass=main.assertReturnString,
1722 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001723
Jeremy Songsterff553672016-05-12 17:06:23 -07001724 main.step( "VLAN: Add single point to multi point intents" )
1725 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1726 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001727 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001728 ]
1729 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001730 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1731 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001732 ]
Jon Hall9c888672017-05-15 18:03:54 -07001733 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1734 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001735 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001736 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001737 main,
1738 name="VLAN2",
1739 senders=senders,
1740 recipients=recipients,
1741 sw1="s5",
1742 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001743 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001744
1745 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001746 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001747 main,
1748 intentId=installResult,
1749 name="VLAN2",
1750 senders=senders,
1751 recipients=recipients,
1752 badSenders=badSenders,
1753 badRecipients=badRecipients,
1754 sw1="s5",
1755 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001756 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001757 else:
1758 main.CLIs[ 0 ].removeAllIntents( purge=True )
1759
1760 utilities.assert_equals( expect=main.TRUE,
1761 actual=testResult,
1762 onpass=main.assertReturnString,
1763 onfail=main.assertReturnString )
1764
alison52b25892016-09-19 10:53:48 -07001765 # Does not support Single point to multi point encapsulation
1766 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1767 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1768 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001769 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001770 # ]
1771 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001772 # { "name": "h16", "device": "of:0000000000000006/8" },
1773 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001774 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001775 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1776 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001777 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001778 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001779 # main,
1780 # name="ENCAPSULATION",
1781 # senders=senders,
1782 # recipients=recipients,
1783 # sw1="s5",
1784 # sw2="s2",
1785 # encap="VLAN" )
1786 #
1787 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001788 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001789 # main,
1790 # intentId=installResult,
1791 # name="ENCAPSULATION",
1792 # senders=senders,
1793 # recipients=recipients,
1794 # badSenders=badSenders,
1795 # badRecipients=badRecipients,
1796 # sw1="s5",
1797 # sw2="s2",
1798 # expectedLink=18 )
1799 # else:
1800 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1801 #
1802 # utilities.assert_equals( expect=main.TRUE,
1803 # actual=testResult,
1804 # onpass=main.assertReturnString,
1805 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001806
Jon Hall78be4962017-05-23 14:53:53 -07001807 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001808
kelvin-onlabb769f562015-07-15 17:05:10 -07001809 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001810 """
1811 Add multi point to single point intents
1812 - Get device ids
1813 - Add multi point to single point intents
1814 - Check intents
1815 - Verify flows
1816 - Ping hosts
1817 - Reroute
1818 - Link down
1819 - Verify flows
1820 - Check topology
1821 - Ping hosts
1822 - Link up
1823 - Verify flows
1824 - Check topology
1825 - Ping hosts
1826 - Remove intents
1827 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001828 if main.initialized == main.FALSE:
1829 main.log.error( "Test components did not start correctly, skipping further tests" )
1830 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001831 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001832 try:
1833 assert main.CLIs
1834 except AssertionError:
1835 main.log.error( "There is no main.CLIs, skipping test cases" )
1836 main.initialized = main.FALSE
1837 main.skipCase()
1838 try:
1839 assert main.Mininet1
1840 except AssertionError:
1841 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1842 main.initialized = main.FALSE
1843 main.skipCase()
1844 try:
1845 assert main.numSwitch
1846 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001847 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001848 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001849 main.initialized = main.FALSE
1850 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001851
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001852 main.testName = "Multi To Single Point Intents"
1853 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001854 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001855 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001856 " multi point intents using " +\
1857 str( main.numCtrls ) + " node(s) cluster;\n" +\
1858 "Different type of hosts will be tested in " +\
1859 "each step such as IPV4, Dual stack, VLAN etc" +\
1860 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001861 " OVS running in Mininet and compile intents" +\
1862 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001863
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001864 main.step( "NOOPTION: Add multi point to single point intents" )
1865 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1866 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001867 { "name": "h16", "device": "of:0000000000000006/8" },
1868 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001869 ]
1870 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001871 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001872 ]
Jon Hall9c888672017-05-15 18:03:54 -07001873 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1874 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001875 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001876 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001877 main,
1878 name="NOOPTION",
1879 senders=senders,
1880 recipients=recipients,
1881 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001882 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001883
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001884 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001885 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001886 main,
1887 intentId=installResult,
1888 name="NOOPTION",
1889 senders=senders,
1890 recipients=recipients,
1891 badSenders=badSenders,
1892 badRecipients=badRecipients,
1893 sw1="s5",
1894 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001895 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001896 else:
1897 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001898
1899 utilities.assert_equals( expect=main.TRUE,
1900 actual=testResult,
1901 onpass=main.assertReturnString,
1902 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001903
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001904 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001905 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 -08001906 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001907 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1908 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001909 ]
1910 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001911 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001912 ]
Jon Hall9c888672017-05-15 18:03:54 -07001913 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1914 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001915 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001916 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001917 main,
1918 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001919 senders=senders,
1920 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001921 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001922 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001923 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001924
1925 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001926 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001927 main,
1928 intentId=installResult,
1929 name="IPV4",
1930 senders=senders,
1931 recipients=recipients,
1932 badSenders=badSenders,
1933 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001934 sw1="s5",
1935 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001936 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001937 else:
1938 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001939
1940 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001941 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001942 onpass=main.assertReturnString,
1943 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001944
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001945 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001946 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 -08001947 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001948 { "name": "h16", "device": "of:0000000000000006/8" },
1949 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001950 ]
1951 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001952 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001953 ]
Jon Hall9c888672017-05-15 18:03:54 -07001954 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1955 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001956 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001957 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001958 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001959 name="IPV4_2",
1960 senders=senders,
1961 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001962 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001963 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001964 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001965
1966 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001967 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001968 main,
1969 intentId=installResult,
1970 name="IPV4_2",
1971 senders=senders,
1972 recipients=recipients,
1973 badSenders=badSenders,
1974 badRecipients=badRecipients,
1975 sw1="s5",
1976 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001977 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001978 else:
1979 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001980
1981 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001982 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001983 onpass=main.assertReturnString,
1984 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001985
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001986 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001987 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 -08001988 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001989 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1990 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001991 ]
1992 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001993 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001994 ]
Jon Hall9c888672017-05-15 18:03:54 -07001995 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1996 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001997 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001998 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001999 main,
2000 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002001 senders=senders,
2002 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002003 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002004 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002005
2006 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002007 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002008 main,
2009 intentId=installResult,
2010 name="VLAN",
2011 senders=senders,
2012 recipients=recipients,
2013 badSenders=badSenders,
2014 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002015 sw1="s5",
2016 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002017 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002018 else:
2019 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002020
2021 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002022 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002023 onpass=main.assertReturnString,
2024 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002025
Jeremy Songsterff553672016-05-12 17:06:23 -07002026 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
2027 main.step( "VLAN: Add multi point to single point intents" )
2028 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
2029 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002030 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
2031 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002032 ]
2033 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002034 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002035 ]
Jon Hall9c888672017-05-15 18:03:54 -07002036 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
2037 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07002038 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002039 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07002040 main,
2041 name="VLAN2",
2042 senders=senders,
2043 recipients=recipients,
2044 sw1="s5",
2045 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002046 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002047
2048 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002049 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07002050 main,
2051 intentId=installResult,
2052 name="VLAN2",
2053 senders=senders,
2054 recipients=recipients,
2055 badSenders=badSenders,
2056 badRecipients=badRecipients,
2057 sw1="s5",
2058 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002059 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002060 else:
2061 main.CLIs[ 0 ].removeAllIntents( purge=True )
2062
2063 utilities.assert_equals( expect=main.TRUE,
2064 actual=testResult,
2065 onpass=main.assertReturnString,
2066 onfail=main.assertReturnString )
2067
Jeremy Songsterc032f162016-08-04 17:14:49 -07002068 main.step( "ENCAPSULATION: Add multi point to single point intents" )
2069 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
2070 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002071 { "name": "h16", "device": "of:0000000000000006/8" },
2072 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002073 ]
2074 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002075 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002076 ]
Jon Hall9c888672017-05-15 18:03:54 -07002077 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2078 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07002079 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002080 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07002081 main,
2082 name="ENCAPSULATION",
2083 senders=senders,
2084 recipients=recipients,
2085 sw1="s5",
2086 sw2="s2",
2087 encap="VLAN" )
2088
2089 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002090 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07002091 main,
2092 intentId=installResult,
2093 name="ENCAPSULATION",
2094 senders=senders,
2095 recipients=recipients,
2096 badSenders=badSenders,
2097 badRecipients=badRecipients,
2098 sw1="s5",
2099 sw2="s2",
2100 expectedLink=18 )
2101 else:
2102 main.CLIs[ 0 ].removeAllIntents( purge=True )
2103
2104 utilities.assert_equals( expect=main.TRUE,
2105 actual=testResult,
2106 onpass=main.assertReturnString,
2107 onfail=main.assertReturnString )
2108
Jon Hall78be4962017-05-23 14:53:53 -07002109 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07002110 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
2111 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
2112 #senders = [
2113 # { "name": "h16", "device": "of:0000000000000006/8" },
2114 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07002115 # ]
Shreyaca8990f2017-03-16 11:43:11 -07002116 #recipients = [
2117 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07002118 # ]
Shreyaca8990f2017-03-16 11:43:11 -07002119 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07002120 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07002121 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002122 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07002123 # main,
2124 # name="ENCAPSULATION",
2125 # senders=senders,
2126 # recipients=recipients,
2127 # sw1="s5",
2128 # sw2="s2",
2129 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07002130 #
Shreyaca8990f2017-03-16 11:43:11 -07002131 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002132 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07002133 # main,
2134 # intentId=installResult,
2135 # name="ENCAPSULATION",
2136 # senders=senders,
2137 # recipients=recipients,
2138 # badSenders=badSenders,
2139 # badRecipients=badRecipients,
2140 # sw1="s5",
2141 # sw2="s2",
2142 # expectedLink=18 )
2143 #else:
2144 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07002145 #
Shreyaca8990f2017-03-16 11:43:11 -07002146 #utilities.assert_equals( expect=main.TRUE,
2147 # actual=testResult,
2148 # onpass=main.assertReturnString,
2149 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07002150
Jon Hall78be4962017-05-23 14:53:53 -07002151 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002152
acsmars1ff5e052015-07-23 11:27:48 -07002153 def CASE5000( self, main ):
2154 """
acsmars5d8cc862015-09-25 09:44:50 -07002155 Tests Host Mobility
2156 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002157 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002158 if main.initialized == main.FALSE:
2159 main.log.error( "Test components did not start correctly, skipping further tests" )
2160 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002161 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002162 try:
2163 assert main.CLIs
2164 except AssertionError:
2165 main.log.error( "There is no main.CLIs, skipping test cases" )
2166 main.initialized = main.FALSE
2167 main.skipCase()
2168 try:
2169 assert main.Mininet1
2170 except AssertionError:
2171 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2172 main.initialized = main.FALSE
2173 main.skipCase()
2174 try:
2175 assert main.numSwitch
2176 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07002177 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002178 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002179 main.initialized = main.FALSE
2180 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002181 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
2182 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002183 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002184
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002185 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07002186 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002187
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002188 # Send discovery ping from moved host
2189 # Moving the host brings down the default interfaces and creates a new one.
2190 # Scapy is restarted on this host to detect the new interface
2191 main.h1.stopScapy()
2192 main.h1.startScapy()
2193
2194 # Discover new host location in ONOS and populate host data.
2195 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07002196 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
2197 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002198
acsmars1ff5e052015-07-23 11:27:48 -07002199 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2200
2201 utilities.assert_equals( expect="of:0000000000000006",
2202 actual=h1PostMove,
2203 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002204 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002205 " to single point intents" +
2206 " with IPV4 type and MAC addresses" +
2207 " in the same VLAN" )
2208
2209 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002210 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07002211 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
2212 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002213 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002214 installResult = main.intents.installHostIntent( main,
2215 name="IPV4 Mobility IPV4",
2216 onosNode=0,
2217 host1=host1,
2218 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002219 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002220 testResult = main.intents.testHostIntent( main,
2221 name="Host Mobility IPV4",
2222 intentId=installResult,
2223 onosNode=0,
2224 host1=host1,
2225 host2=host2,
2226 sw1="s6",
2227 sw2="s2",
2228 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002229 else:
2230 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002231
2232 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002233 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002234 onpass=main.assertReturnString,
2235 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002236
Jon Hall78be4962017-05-23 14:53:53 -07002237 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002238
2239 def CASE6000( self, main ):
2240 """
2241 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2242 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002243 # At some later point discussion on this behavior in MPSP and SPMP intents
2244 # will be reoppened and this test case may need to be updated to reflect
2245 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002246 if main.initialized == main.FALSE:
2247 main.log.error( "Test components did not start correctly, skipping further tests" )
2248 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002249 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002250 try:
2251 assert main.CLIs
2252 except AssertionError:
2253 main.log.error( "There is no main.CLIs, skipping test cases" )
2254 main.initialized = main.FALSE
2255 main.skipCase()
2256 try:
2257 assert main.Mininet1
2258 except AssertionError:
2259 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2260 main.initialized = main.FALSE
2261 main.skipCase()
2262 try:
2263 assert main.numSwitch
2264 except AssertionError:
alison52b25892016-09-19 10:53:48 -07002265 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002266 main.initialized = main.FALSE
2267 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002268 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
2269 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07002270 main.step( "Installing Multi to Single Point intents with no options set" )
2271 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2272 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002273 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002274 { "name": "h16", "device": "of:0000000000000006/8" },
2275 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002276 ]
2277 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002278 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002279 ]
2280 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002281 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002282 ]
2283 isolatedRecipients = []
2284 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002285 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002286 main,
2287 name="NOOPTION",
2288 senders=senders,
2289 recipients=recipients,
2290 sw1="s5",
2291 sw2="s2" )
2292
2293 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002294 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002295 main,
2296 intentId=installResult,
2297 name="NOOPTION",
2298 senders=senders,
2299 recipients=recipients,
2300 isolatedSenders=isolatedSenders,
2301 isolatedRecipients=isolatedRecipients,
2302 sw1="s6",
2303 sw2="s2",
2304 sw3="s4",
2305 sw4="s1",
2306 sw5="s3",
2307 expectedLink1=16,
2308 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002309 else:
2310 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002311
2312 utilities.assert_equals( expect=main.TRUE,
2313 actual=testResult,
2314 onpass=main.assertReturnString,
2315 onfail=main.assertReturnString )
2316
Jeremy Songster9385d412016-06-02 17:57:36 -07002317 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2318
2319 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2320 "with partial failures allowed\n"
2321 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002322 { "name": "h16", "device": "of:0000000000000006/8" },
2323 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002324 ]
2325 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002326 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002327 ]
2328 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002329 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002330 ]
2331 isolatedRecipients = []
2332 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002333 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002334 main,
2335 name="NOOPTION",
2336 senders=senders,
2337 recipients=recipients,
2338 sw1="s5",
2339 sw2="s2",
2340 partial=True )
2341
2342 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002343 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002344 main,
2345 intentId=installResult,
2346 name="NOOPTION",
2347 senders=senders,
2348 recipients=recipients,
2349 isolatedSenders=isolatedSenders,
2350 isolatedRecipients=isolatedRecipients,
2351 sw1="s6",
2352 sw2="s2",
2353 sw3="s4",
2354 sw4="s1",
2355 sw5="s3",
2356 expectedLink1=16,
2357 expectedLink2=14,
2358 partial=True )
2359 else:
2360 main.CLIs[ 0 ].removeAllIntents( purge=True )
2361
2362 utilities.assert_equals( expect=main.TRUE,
2363 actual=testResult,
2364 onpass=main.assertReturnString,
2365 onfail=main.assertReturnString )
2366
Jeremye0cb5eb2016-01-27 17:39:09 -08002367 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002368 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2369 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002370 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002371 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002372 ]
2373 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002374 { "name": "h16", "device": "of:0000000000000006/8" },
2375 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002376 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002377 isolatedSenders = []
2378 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002379 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002380 ]
2381 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002382 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002383 main,
2384 name="NOOPTION",
2385 senders=senders,
2386 recipients=recipients,
2387 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002388 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002389
2390 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002391 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002392 main,
2393 intentId=installResult,
2394 name="NOOPTION",
2395 senders=senders,
2396 recipients=recipients,
2397 isolatedSenders=isolatedSenders,
2398 isolatedRecipients=isolatedRecipients,
2399 sw1="s6",
2400 sw2="s2",
2401 sw3="s4",
2402 sw4="s1",
2403 sw5="s3",
2404 expectedLink1=16,
2405 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002406 else:
2407 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002408
2409 utilities.assert_equals( expect=main.TRUE,
2410 actual=testResult,
2411 onpass=main.assertReturnString,
2412 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002413 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002414 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002415 "intents with partial failures allowed" )
2416 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2417 "point intent with partial failures allowed\n"
2418 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002419 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002420 ]
2421 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002422 { "name": "h16", "device": "of:0000000000000006/8" },
2423 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002424 ]
2425 isolatedSenders = []
2426 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002427 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002428 ]
2429 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002430 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002431 main,
2432 name="NOOPTION",
2433 senders=senders,
2434 recipients=recipients,
2435 sw1="s5",
2436 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002437 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002438
2439 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002440 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002441 main,
2442 intentId=installResult,
2443 name="NOOPTION",
2444 senders=senders,
2445 recipients=recipients,
2446 isolatedSenders=isolatedSenders,
2447 isolatedRecipients=isolatedRecipients,
2448 sw1="s6",
2449 sw2="s2",
2450 sw3="s4",
2451 sw4="s1",
2452 sw5="s3",
2453 expectedLink1=16,
2454 expectedLink2=14,
2455 partial=True )
2456 else:
2457 main.CLIs[ 0 ].removeAllIntents( purge=True )
2458
2459 utilities.assert_equals( expect=main.TRUE,
2460 actual=testResult,
2461 onpass=main.assertReturnString,
2462 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002463
Jon Hall78be4962017-05-23 14:53:53 -07002464 main.intents.report( main )