blob: 8adb52a5df39ba169f0f99a792b78465c5ff2daa [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
Jon Hall106be082015-07-22 09:53:00 -0700112 main.ONOSbench.getVersion( report=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700113
114 def CASE2( self, main ):
115 """
116 - Set up cell
117 - Create cell file
118 - Set cell file
119 - Verify cell file
120 - Kill ONOS process
121 - Uninstall ONOS cluster
122 - Verify ONOS start up
123 - Install ONOS cluster
124 - Connect to cli
125 """
alison52b25892016-09-19 10:53:48 -0700126 import time
Jeremy Songster17147f22016-05-31 18:30:52 -0700127 main.cycle += 1
128
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700129 # main.scale[ 0 ] determines the current number of ONOS controller
130 main.numCtrls = int( main.scale[ 0 ] )
Jeremycd872222016-03-29 10:08:34 -0700131 main.flowCompiler = "Flow Rules"
Jeremyd9e4eb12016-04-13 12:09:06 -0700132 main.initialized = main.TRUE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700133
134 main.case( "Starting up " + str( main.numCtrls ) +
135 " node(s) ONOS cluster" )
Jon Hall783bbf92015-07-23 14:33:19 -0700136 main.caseExplanation = "Set up ONOS with " + str( main.numCtrls ) +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700137 " node(s) ONOS cluster"
138
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700139 #kill off all onos processes
140 main.log.info( "Safety check, killing all ONOS processes" +
Jon Hall70b2ff42015-11-17 15:49:44 -0800141 " before initiating environment setup" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700142
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800143 main.step( "Uninstalling ONOS package" )
144 onosUninstallResult = main.TRUE
145 for ip in main.ONOSip:
146 onosUninstallResult = onosUninstallResult and \
147 main.ONOSbench.onosUninstall( nodeIp=ip )
148 stepResult = onosUninstallResult
149 utilities.assert_equals( expect=main.TRUE,
150 actual=stepResult,
151 onpass="Successfully uninstalled ONOS package",
152 onfail="Failed to uninstall ONOS package" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700153 for i in range( main.maxNodes ):
154 main.ONOSbench.onosDie( main.ONOSip[ i ] )
155
Jon Hall860b8152017-05-23 10:35:23 -0700156 main.log.debug( "NODE COUNT = " + str( main.numCtrls ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700157
158 tempOnosIp = []
159 for i in range( main.numCtrls ):
Jon Hall78be4962017-05-23 14:53:53 -0700160 tempOnosIp.append( main.ONOSip[ i ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700161
kelvin-onlabf34a58a2015-07-23 16:41:52 -0700162 main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
163 "temp", main.Mininet1.ip_address,
Devin Lim461f0872017-06-05 16:49:33 -0700164 main.apps, tempOnosIp, main.ONOScli1.user_name )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700165
166 main.step( "Apply cell to environment" )
167 cellResult = main.ONOSbench.setCell( "temp" )
168 verifyResult = main.ONOSbench.verifyCell()
169 stepResult = cellResult and verifyResult
170 utilities.assert_equals( expect=main.TRUE,
171 actual=stepResult,
Jon Hall78be4962017-05-23 14:53:53 -0700172 onpass="Successfully applied cell to " +
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700173 "environment",
174 onfail="Failed to apply cell to environment " )
175
176 main.step( "Creating ONOS package" )
Jon Hallbd60ea02016-08-23 10:03:59 -0700177 packageResult = main.ONOSbench.buckBuild()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700178 stepResult = packageResult
179 utilities.assert_equals( expect=main.TRUE,
180 actual=stepResult,
181 onpass="Successfully created ONOS package",
182 onfail="Failed to create ONOS package" )
183
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700184 main.step( "Installing ONOS package" )
185 onosInstallResult = main.TRUE
186 for i in range( main.numCtrls ):
187 onosInstallResult = onosInstallResult and \
188 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
189 stepResult = onosInstallResult
190 utilities.assert_equals( expect=main.TRUE,
191 actual=stepResult,
192 onpass="Successfully installed ONOS package",
193 onfail="Failed to install ONOS package" )
194
You Wangf5de25b2017-01-06 15:13:01 -0800195 main.step( "Set up ONOS secure SSH" )
196 secureSshResult = main.TRUE
197 for i in range( int( main.numCtrls ) ):
Jon Hall78be4962017-05-23 14:53:53 -0700198 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[ i ] )
You Wangf5de25b2017-01-06 15:13:01 -0800199 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
200 onpass="Test step PASS",
201 onfail="Test step FAIL" )
202
Jon Hallf539eb92017-05-22 17:18:42 -0700203 main.log.info( "Sleeping {} seconds".format( main.startUpSleep ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700204 time.sleep( main.startUpSleep )
Jon Hall860b8152017-05-23 10:35:23 -0700205 main.step( "Checking ONOS is running" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700206 stopResult = main.TRUE
207 startResult = main.TRUE
208 onosIsUp = main.TRUE
209
210 for i in range( main.numCtrls ):
Jeremy Songster7edb6632016-04-28 15:44:28 -0700211 isUp = main.ONOSbench.isup( main.ONOSip[ i ] )
212 onosIsUp = onosIsUp and isUp
213 if isUp == main.TRUE:
Jeremyd9e4eb12016-04-13 12:09:06 -0700214 main.log.report( "ONOS instance {0} is up and ready".format( i + 1 ) )
215 else:
216 main.log.report( "ONOS instance {0} may not be up, stop and ".format( i + 1 ) +
217 "start ONOS again " )
218 stopResult = stopResult and main.ONOSbench.onosStop( main.ONOSip[ i ] )
219 startResult = startResult and main.ONOSbench.onosStart( main.ONOSip[ i ] )
220 if not startResult or stopResult:
Jon Hall78be4962017-05-23 14:53:53 -0700221 main.log.report( "ONOS instance {0} did not start correctly.".format( i + 1 ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700222 stepResult = onosIsUp and stopResult and startResult
223 utilities.assert_equals( expect=main.TRUE,
224 actual=stepResult,
Jeremyd9e4eb12016-04-13 12:09:06 -0700225 onpass="ONOS service is ready on all nodes",
226 onfail="ONOS service did not start properly on all nodes" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700227
228 main.step( "Start ONOS cli" )
229 cliResult = main.TRUE
230 for i in range( main.numCtrls ):
231 cliResult = cliResult and \
232 main.CLIs[ i ].startOnosCli( main.ONOSip[ i ] )
233 stepResult = cliResult
234 utilities.assert_equals( expect=main.TRUE,
235 actual=stepResult,
236 onpass="Successfully start ONOS cli",
237 onfail="Failed to start ONOS cli" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700238 if not stepResult:
239 main.initialized = main.FALSE
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700240
241 # Remove the first element in main.scale list
242 main.scale.remove( main.scale[ 0 ] )
243
Jon Hall78be4962017-05-23 14:53:53 -0700244 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700245
Jon Halla3e02432015-07-24 15:55:42 -0700246 def CASE8( self, main ):
247 """
acsmars59a4c552015-09-10 18:11:19 -0700248 Compare ONOS Topology to Mininet Topology
Jon Halla3e02432015-07-24 15:55:42 -0700249 """
250 import json
251
252 main.case( "Compare ONOS Topology view to Mininet topology" )
253 main.caseExplanation = "Compare topology elements between Mininet" +\
254 " and ONOS"
255
acsmars59a4c552015-09-10 18:11:19 -0700256 main.log.info( "Gathering topology information from Mininet" )
257 devicesResults = main.FALSE # Overall Boolean for device correctness
258 linksResults = main.FALSE # Overall Boolean for link correctness
259 hostsResults = main.FALSE # Overall Boolean for host correctness
260 deviceFails = [] # Nodes where devices are incorrect
261 linkFails = [] # Nodes where links are incorrect
262 hostFails = [] # Nodes where hosts are incorrect
263 attempts = main.checkTopoAttempts # Remaining Attempts
Jon Halla3e02432015-07-24 15:55:42 -0700264
265 mnSwitches = main.Mininet1.getSwitches()
266 mnLinks = main.Mininet1.getLinks()
267 mnHosts = main.Mininet1.getHosts()
268
Jon Hall70b2ff42015-11-17 15:49:44 -0800269 main.step( "Comparing Mininet topology to ONOS topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700270
acsmars59a4c552015-09-10 18:11:19 -0700271 while ( attempts >= 0 ) and\
Jon Hall78be4962017-05-23 14:53:53 -0700272 ( not devicesResults or not linksResults or not hostsResults ):
Jon Hallf539eb92017-05-22 17:18:42 -0700273 main.log.info( "Sleeping {} seconds".format( 2 ) )
acsmars59a4c552015-09-10 18:11:19 -0700274 time.sleep( 2 )
275 if not devicesResults:
276 devices = main.topo.getAllDevices( main )
277 ports = main.topo.getAllPorts( main )
278 devicesResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800279 deviceFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700280 if not linksResults:
281 links = main.topo.getAllLinks( main )
282 linksResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800283 linkFails = [] # Reset for each failed attempt
acsmars59a4c552015-09-10 18:11:19 -0700284 if not hostsResults:
285 hosts = main.topo.getAllHosts( main )
286 hostsResults = main.TRUE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800287 hostFails = [] # Reset for each failed attempt
Jon Halla3e02432015-07-24 15:55:42 -0700288
acsmars59a4c552015-09-10 18:11:19 -0700289 # Check for matching topology on each node
290 for controller in range( main.numCtrls ):
291 controllerStr = str( controller + 1 ) # ONOS node number
292 # Compare Devices
293 if devices[ controller ] and ports[ controller ] and\
Jon Hall78be4962017-05-23 14:53:53 -0700294 "Error" not in devices[ controller ] and\
295 "Error" not in ports[ controller ]:
Jon Halla3e02432015-07-24 15:55:42 -0700296
acsmars2ec91d62015-09-16 11:15:48 -0700297 try:
298 deviceData = json.loads( devices[ controller ] )
299 portData = json.loads( ports[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700300 except( TypeError, ValueError ):
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800301 main.log.error( "Could not load json: {0} or {1}".format( str( devices[ controller ] ), str( ports[ controller ] ) ) )
acsmars2ec91d62015-09-16 11:15:48 -0700302 currentDevicesResult = main.FALSE
303 else:
304 currentDevicesResult = main.Mininet1.compareSwitches(
Jon Hall78be4962017-05-23 14:53:53 -0700305 mnSwitches, deviceData, portData )
acsmars59a4c552015-09-10 18:11:19 -0700306 else:
307 currentDevicesResult = main.FALSE
308 if not currentDevicesResult:
309 deviceFails.append( controllerStr )
310 devicesResults = devicesResults and currentDevicesResult
311 # Compare Links
312 if links[ controller ] and "Error" not in links[ controller ]:
acsmars2ec91d62015-09-16 11:15:48 -0700313 try:
314 linkData = json.loads( links[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700315 except( TypeError, ValueError ):
316 main.log.error( "Could not load json:" + str( links[ controller ] ) )
acsmars2ec91d62015-09-16 11:15:48 -0700317 currentLinksResult = main.FALSE
318 else:
319 currentLinksResult = main.Mininet1.compareLinks(
Jon Hall78be4962017-05-23 14:53:53 -0700320 mnSwitches, mnLinks, linkData )
acsmars59a4c552015-09-10 18:11:19 -0700321 else:
322 currentLinksResult = main.FALSE
323 if not currentLinksResult:
324 linkFails.append( controllerStr )
325 linksResults = linksResults and currentLinksResult
326 # Compare Hosts
acsmars2ec91d62015-09-16 11:15:48 -0700327 if hosts[ controller ] and "Error" not in hosts[ controller ]:
328 try:
329 hostData = json.loads( hosts[ controller ] )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700330 except( TypeError, ValueError ):
331 main.log.error( "Could not load json:" + str( hosts[ controller ] ) )
acsmars2ec91d62015-09-16 11:15:48 -0700332 currentHostsResult = main.FALSE
333 else:
334 currentHostsResult = main.Mininet1.compareHosts(
Jon Hall78be4962017-05-23 14:53:53 -0700335 mnHosts, hostData )
acsmars59a4c552015-09-10 18:11:19 -0700336 else:
337 currentHostsResult = main.FALSE
338 if not currentHostsResult:
339 hostFails.append( controllerStr )
340 hostsResults = hostsResults and currentHostsResult
341 # Decrement Attempts Remaining
342 attempts -= 1
343
acsmars59a4c552015-09-10 18:11:19 -0700344 utilities.assert_equals( expect=[],
345 actual=deviceFails,
346 onpass="ONOS correctly discovered all devices",
347 onfail="ONOS incorrectly discovered devices on nodes: " +
348 str( deviceFails ) )
349 utilities.assert_equals( expect=[],
350 actual=linkFails,
351 onpass="ONOS correctly discovered all links",
352 onfail="ONOS incorrectly discovered links on nodes: " +
353 str( linkFails ) )
354 utilities.assert_equals( expect=[],
355 actual=hostFails,
356 onpass="ONOS correctly discovered all hosts",
357 onfail="ONOS incorrectly discovered hosts on nodes: " +
358 str( hostFails ) )
Jon Hall46d48252015-08-03 11:41:16 -0700359 topoResults = hostsResults and linksResults and devicesResults
360 utilities.assert_equals( expect=main.TRUE,
361 actual=topoResults,
362 onpass="ONOS correctly discovered the topology",
363 onfail="ONOS incorrectly discovered the topology" )
Jon Halla3e02432015-07-24 15:55:42 -0700364
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700365 def CASE10( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700366 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700367 Start Mininet topology with OF 1.0 switches
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700368 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700369 if main.initialized == main.FALSE:
370 main.log.error( "Test components did not start correctly, skipping further tests" )
371 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700372 main.OFProtocol = "1.0"
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700373 main.log.report( "Start Mininet topology with OF 1.0 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700374 main.case( "Start Mininet topology with OF 1.0 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700375 main.caseExplanation = "Start mininet topology with OF 1.0 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700376 "switches to test intents, exits out if " +\
377 "topology did not start correctly"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700378
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700379 main.step( "Starting Mininet topology with OF 1.0 switches" )
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700380 args = "--switch ovs,protocols=OpenFlow10"
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700381 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700382 main.topology,
383 args=args )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700384 stepResult = topoResult
385 utilities.assert_equals( expect=main.TRUE,
386 actual=stepResult,
387 onpass="Successfully loaded topology",
388 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700389
390 # Set flag to test cases if topology did not load properly
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700391 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700392 main.initialized = main.FALSE
393 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700394
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700395 def CASE11( self, main ):
396 """
kelvin-onlabb0b0dcb2015-07-22 16:51:33 -0700397 Start Mininet topology with OF 1.3 switches
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700398 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700399 if main.initialized == main.FALSE:
400 main.log.error( "Test components did not start correctly, skipping further tests" )
401 main.skipCase()
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700402 main.OFProtocol = "1.3"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700403 main.log.report( "Start Mininet topology with OF 1.3 switches" )
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700404 main.case( "Start Mininet topology with OF 1.3 switches" )
Jon Hall783bbf92015-07-23 14:33:19 -0700405 main.caseExplanation = "Start mininet topology with OF 1.3 " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700406 "switches to test intents, exits out if " +\
407 "topology did not start correctly"
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700408
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700409 main.step( "Starting Mininet topology with OF 1.3 switches" )
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700410 args = "--switch ovs,protocols=OpenFlow13"
411 topoResult = main.Mininet1.startNet( topoFile=main.dependencyPath +
412 main.topology,
413 args=args )
414 stepResult = topoResult
415 utilities.assert_equals( expect=main.TRUE,
416 actual=stepResult,
417 onpass="Successfully loaded topology",
418 onfail="Failed to load topology" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700419 # Set flag to skip test cases if topology did not load properly
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700420 if not topoResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700421 main.initialized = main.FALSE
kelvin-onlabb5cfab32015-07-22 16:38:22 -0700422
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700423 def CASE12( self, main ):
424 """
425 Assign mastership to controllers
426 """
427 import re
428
Jeremyd9e4eb12016-04-13 12:09:06 -0700429 if main.initialized == main.FALSE:
430 main.log.error( "Test components did not start correctly, skipping further tests" )
431 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700432 main.case( "Assign switches to controllers" )
433 main.step( "Assigning switches to controllers" )
Jon Hall783bbf92015-07-23 14:33:19 -0700434 main.caseExplanation = "Assign OF " + main.OFProtocol +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700435 " switches to ONOS nodes"
436
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700437 switchList = []
438
439 # Creates a list switch name, use getSwitch() function later...
440 for i in range( 1, ( main.numSwitch + 1 ) ):
441 switchList.append( 's' + str( i ) )
442
443 tempONOSip = []
444 for i in range( main.numCtrls ):
445 tempONOSip.append( main.ONOSip[ i ] )
446
447 assignResult = main.Mininet1.assignSwController( sw=switchList,
448 ip=tempONOSip,
alison52b25892016-09-19 10:53:48 -0700449 port="6653" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700450 if not assignResult:
Jeremyd9e4eb12016-04-13 12:09:06 -0700451 main.log.error( "Problem assigning mastership of switches" )
452 main.initialized = main.FALSE
453 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700454
455 for i in range( 1, ( main.numSwitch + 1 ) ):
456 response = main.Mininet1.getSwController( "s" + str( i ) )
Jon Hall860b8152017-05-23 10:35:23 -0700457 main.log.debug( "Response is " + str( response ) )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700458 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
459 assignResult = assignResult and main.TRUE
460 else:
461 assignResult = main.FALSE
462 stepResult = assignResult
463 utilities.assert_equals( expect=main.TRUE,
464 actual=stepResult,
465 onpass="Successfully assigned switches" +
466 "to controller",
467 onfail="Failed to assign switches to " +
468 "controller" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700469 if not stepResult:
470 main.initialized = main.FALSE
acsmars5d8cc862015-09-25 09:44:50 -0700471
Jon Hall78be4962017-05-23 14:53:53 -0700472 def CASE13( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700473 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800474 Create Scapy components
475 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700476 if main.initialized == main.FALSE:
477 main.log.error( "Test components did not start correctly, skipping further tests" )
478 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800479 main.case( "Create scapy components" )
480 main.step( "Create scapy components" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800481 scapyResult = main.TRUE
482 for hostName in main.scapyHostNames:
483 main.Scapy1.createHostComponent( hostName )
484 main.scapyHosts.append( getattr( main, hostName ) )
485
486 main.step( "Start scapy components" )
487 for host in main.scapyHosts:
488 host.startHostCli()
489 host.startScapy()
490 host.updateSelf()
491 main.log.debug( host.name )
492 main.log.debug( host.hostIp )
493 main.log.debug( host.hostMac )
494
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800495 utilities.assert_equals( expect=main.TRUE,
496 actual=scapyResult,
497 onpass="Successfully created Scapy Components",
498 onfail="Failed to discover Scapy Components" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700499 if not scapyResult:
500 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800501
502 def CASE14( self, main ):
503 """
504 Discover all hosts with fwd and pingall and store its data in a dictionary
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700505 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700506 if main.initialized == main.FALSE:
507 main.log.error( "Test components did not start correctly, skipping further tests" )
508 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700509 main.case( "Discover all hosts" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800510 main.step( "Pingall hosts and confirm ONOS discovery" )
Jon Hall78be4962017-05-23 14:53:53 -0700511 utilities.retry( f=main.intents.fwdPingall, retValue=main.FALSE, args=[ main ] )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700512
Jon Hall78be4962017-05-23 14:53:53 -0700513 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery, retValue=main.FALSE,
514 args=[ main ], attempts=main.checkTopoAttempts, sleep=2 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700515 utilities.assert_equals( expect=main.TRUE,
516 actual=stepResult,
517 onpass="Successfully discovered hosts",
518 onfail="Failed to discover hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700519 if not stepResult:
520 main.initialized = main.FALSE
521 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700522
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800523 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700524 stepResult = main.intents.populateHostData( main )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700525 utilities.assert_equals( expect=main.TRUE,
526 actual=stepResult,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800527 onpass="Successfully populated hostsData",
528 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700529 if not stepResult:
530 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800531
532 def CASE15( self, main ):
533 """
534 Discover all hosts with scapy arp packets and store its data to a dictionary
535 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700536 if main.initialized == main.FALSE:
537 main.log.error( "Test components did not start correctly, skipping further tests" )
538 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800539 main.case( "Discover all hosts using scapy" )
540 main.step( "Send packets from each host to the first host and confirm onos discovery" )
541
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800542 if len( main.scapyHosts ) < 1:
543 main.log.error( "No scapy hosts have been created" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700544 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800545 main.skipCase()
546
547 # Send ARP packets from each scapy host component
Jon Hall78be4962017-05-23 14:53:53 -0700548 main.intents.sendDiscoveryArp( main, main.scapyHosts )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800549
Jon Hall78be4962017-05-23 14:53:53 -0700550 stepResult = utilities.retry( f=main.intents.confirmHostDiscovery,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800551 retValue=main.FALSE, args=[ main ],
552 attempts=main.checkTopoAttempts, sleep=2 )
553
554 utilities.assert_equals( expect=main.TRUE,
555 actual=stepResult,
556 onpass="ONOS correctly discovered all hosts",
557 onfail="ONOS incorrectly discovered hosts" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700558 if not stepResult:
559 main.initialized = main.FALSE
560 main.skipCase()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800561
562 main.step( "Populate hostsData" )
Jon Hall78be4962017-05-23 14:53:53 -0700563 stepResult = main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800564 utilities.assert_equals( expect=main.TRUE,
565 actual=stepResult,
566 onpass="Successfully populated hostsData",
567 onfail="Failed to populate hostsData" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700568 if not stepResult:
569 main.initialized = main.FALSE
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800570
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800571 def CASE16( self, main ):
572 """
Jeremy42df2e72016-02-23 16:37:46 -0800573 Balance Masters
574 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700575 if main.initialized == main.FALSE:
576 main.log.error( "Test components did not start correctly, skipping further tests" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700577 main.stop()
Jeremyd9e4eb12016-04-13 12:09:06 -0700578 main.skipCase()
Jeremy42df2e72016-02-23 16:37:46 -0800579 main.case( "Balance mastership of switches" )
580 main.step( "Balancing mastership of switches" )
581
Jeremy42df2e72016-02-23 16:37:46 -0800582 balanceResult = utilities.retry( f=main.CLIs[ 0 ].balanceMasters, retValue=main.FALSE, args=[] )
583
584 utilities.assert_equals( expect=main.TRUE,
Jeremy6e9748f2016-03-25 15:03:39 -0700585 actual=balanceResult,
Jeremy42df2e72016-02-23 16:37:46 -0800586 onpass="Successfully balanced mastership of switches",
587 onfail="Failed to balance mastership of switches" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700588 if not balanceResult:
589 main.initialized = main.FALSE
Jeremy42df2e72016-02-23 16:37:46 -0800590
591 def CASE17( self, main ):
592 """
Jeremy6e9748f2016-03-25 15:03:39 -0700593 Use Flow Objectives
594 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700595 if main.initialized == main.FALSE:
596 main.log.error( "Test components did not start correctly, skipping further tests" )
597 main.skipCase()
Jeremy6e9748f2016-03-25 15:03:39 -0700598 main.case( "Enable intent compilation using Flow Objectives" )
599 main.step( "Enabling Flow Objectives" )
600
601 main.flowCompiler = "Flow Objectives"
602
603 cmd = "org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator"
604
605 stepResult = main.CLIs[ 0 ].setCfg( component=cmd,
606 propName="useFlowObjectives", value="true" )
You Wang106d0fa2017-05-15 17:22:15 -0700607 stepResult &= main.CLIs[ 0 ].setCfg( component=cmd,
608 propName="defaultFlowObjectiveCompiler",
Jon Hall78be4962017-05-23 14:53:53 -0700609 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler' )
Jeremy6e9748f2016-03-25 15:03:39 -0700610
611 utilities.assert_equals( expect=main.TRUE,
612 actual=stepResult,
613 onpass="Successfully activated Flow Objectives",
614 onfail="Failed to activate Flow Objectives" )
Jeremyd9e4eb12016-04-13 12:09:06 -0700615 if not balanceResult:
616 main.initialized = main.FALSE
Jeremy6e9748f2016-03-25 15:03:39 -0700617
618 def CASE18( self, main ):
619 """
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800620 Stop mininet and remove scapy host
621 """
622 main.log.report( "Stop Mininet and Scapy" )
623 main.case( "Stop Mininet and Scapy" )
624 main.caseExplanation = "Stopping the current mininet topology " +\
625 "to start up fresh"
626 main.step( "Stopping and Removing Scapy Host Components" )
627 scapyResult = main.TRUE
628 for host in main.scapyHosts:
629 scapyResult = scapyResult and host.stopScapy()
630 main.log.info( "Stopped Scapy Host: {0}".format( host.name ) )
631
632 for host in main.scapyHosts:
633 scapyResult = scapyResult and main.Scapy1.removeHostComponent( host.name )
634 main.log.info( "Removed Scapy Host Component: {0}".format( host.name ) )
635
636 main.scapyHosts = []
637 main.scapyHostIPs = []
638
639 utilities.assert_equals( expect=main.TRUE,
640 actual=scapyResult,
641 onpass="Successfully stopped scapy and removed host components",
642 onfail="Failed to stop mininet and scapy" )
643
644 main.step( "Stopping Mininet Topology" )
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700645 mininetResult = main.Mininet1.stopNet()
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800646
647 utilities.assert_equals( expect=main.TRUE,
648 actual=mininetResult,
649 onpass="Successfully stopped mininet and scapy",
650 onfail="Failed to stop mininet and scapy" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700651 # Exit if topology did not load properly
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800652 if not ( mininetResult and scapyResult ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700653 main.cleanup()
654 main.exit()
655
Jeremy Songster17147f22016-05-31 18:30:52 -0700656 def CASE19( self, main ):
657 """
658 Copy the karaf.log files after each testcase cycle
659 """
660 main.log.report( "Copy karaf logs" )
661 main.case( "Copy karaf logs" )
662 main.caseExplanation = "Copying the karaf logs to preserve them through" +\
663 "reinstalling ONOS"
664 main.step( "Copying karaf logs" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700665 stepResult = main.TRUE
666 scpResult = main.TRUE
667 copyResult = main.TRUE
Jeremy Songstercc5414b2016-07-11 10:59:53 -0700668 for i in range( main.numCtrls ):
669 main.node = main.CLIs[ i ]
Jeremy Songster17147f22016-05-31 18:30:52 -0700670 ip = main.ONOSip[ i ]
671 main.node.ip_address = ip
Jon Hall78be4962017-05-23 14:53:53 -0700672 scpResult = scpResult and main.ONOSbench.scp( main.node,
673 "/opt/onos/log/karaf.log",
674 "/tmp/karaf.log",
675 direction="from" )
Jeremy Songster31aad312016-06-13 16:32:11 -0700676 copyResult = copyResult and main.ONOSbench.cpLogsToDir( "/tmp/karaf.log", main.logdir,
677 copyFileName=( "karaf.log.node{0}.cycle{1}".format( str( i + 1 ), str( main.cycle ) ) ) )
678 if scpResult and copyResult:
Jon Hall78be4962017-05-23 14:53:53 -0700679 stepResult = main.TRUE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700680 else:
681 stepResult = main.FALSE and stepResult
Jeremy Songster31aad312016-06-13 16:32:11 -0700682 utilities.assert_equals( expect=main.TRUE,
683 actual=stepResult,
684 onpass="Successfully copied remote ONOS logs",
685 onfail="Failed to copy remote ONOS logs" )
Jeremy Songster17147f22016-05-31 18:30:52 -0700686
kelvin-onlabb769f562015-07-15 17:05:10 -0700687 def CASE1000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700688 """
689 Add host intents between 2 host:
690 - Discover hosts
691 - Add host intents
692 - Check intents
693 - Verify flows
694 - Ping hosts
695 - Reroute
696 - Link down
697 - Verify flows
698 - Check topology
699 - Ping hosts
700 - Link up
701 - Verify flows
702 - Check topology
703 - Ping hosts
704 - Remove intents
705 """
Jeremyd9e4eb12016-04-13 12:09:06 -0700706 if main.initialized == main.FALSE:
707 main.log.error( "Test components did not start correctly, skipping further tests" )
708 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700709 # Assert variables - These variable's name|format must be followed
710 # if you want to use the wrapper function
711 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -0700712 try:
713 assert main.CLIs
714 except AssertionError:
715 main.log.error( "There is no main.CLIs, skipping test cases" )
716 main.initialized = main.FALSE
717 main.skipCase()
718 try:
719 assert main.Mininet1
720 except AssertionError:
721 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
722 main.initialized = main.FALSE
723 main.skipCase()
724 try:
725 assert main.numSwitch
726 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -0700727 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700728 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -0700729 main.initialized = main.FALSE
730 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700731
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800732 # Save leader candidates
acsmarse6b410f2015-07-17 14:39:34 -0700733 intentLeadersOld = main.CLIs[ 0 ].leaderCandidates()
734
kelvin-onlab7bb2d972015-08-05 10:56:16 -0700735 main.testName = "Host Intents"
736 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -0700737 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -0700738 main.caseExplanation = "This test case tests Host intents using " +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -0700739 str( main.numCtrls ) + " node(s) cluster;\n" +\
740 "Different type of hosts will be tested in " +\
741 "each step such as IPV4, Dual stack, VLAN " +\
Jeremyeb51cb12016-03-28 17:53:35 -0700742 "etc;\nThe test will use OF " + main.OFProtocol +\
743 " OVS running in Mininet and compile intents" +\
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700744 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700745
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700746 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -0700747 main.assertReturnString = "Assertion Result for IPV4 host intent with mac addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700748 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
749 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800750 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700751 installResult = main.intents.installHostIntent( main,
752 name="IPV4",
753 onosNode=0,
754 host1=host1,
755 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800756 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700757 testResult = main.intents.testHostIntent( main,
758 name="IPV4",
759 intentId=installResult,
760 onosNode=0,
761 host1=host1,
762 host2=host2,
763 sw1="s5",
764 sw2="s2",
765 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800766 else:
767 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800768
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700769 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800770 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700771 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700772 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700773
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700774 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700775 main.assertReturnString = "Assertion Result for dualstack IPV4 with MAC addresses\n"
Jon Hall9c888672017-05-15 18:03:54 -0700776 host1 = { "name": "h3", "id": "00:00:00:00:00:03/-1" }
Jon Hall78be4962017-05-23 14:53:53 -0700777 host2 = { "name": "h11", "id": "00:00:00:00:00:0B/-1 " }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800778 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700779 installResult = main.intents.installHostIntent( main,
780 name="DUALSTACK",
781 onosNode=0,
782 host1=host1,
783 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800784
785 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700786 testResult = main.intents.testHostIntent( main,
787 name="DUALSTACK",
788 intentId=installResult,
789 onosNode=0,
790 host1=host1,
791 host2=host2,
792 sw1="s5",
793 sw2="s2",
794 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700795
796 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800797 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700798 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700799 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700800
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700801 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
acsmars5d8cc862015-09-25 09:44:50 -0700802 main.assertReturnString = "Assertion Result for dualstack2 host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700803 host1 = { "name": "h1" }
804 host2 = { "name": "h11" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800805 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700806 installResult = main.intents.installHostIntent( main,
807 name="DUALSTACK2",
808 onosNode=0,
809 host1=host1,
810 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800811
812 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700813 testResult = main.intents.testHostIntent( main,
814 name="DUALSTACK2",
815 intentId=installResult,
816 onosNode=0,
817 host1=host1,
818 host2=host2,
819 sw1="s5",
820 sw2="s2",
821 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800822 else:
823 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700824
825 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800826 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700827 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700828 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700829
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700830 main.step( "1HOP: Add host intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -0700831 main.assertReturnString = "Assertion Result for 1HOP for IPV4 same switch\n"
Jon Hall9c888672017-05-15 18:03:54 -0700832 host1 = { "name": "h1" }
833 host2 = { "name": "h3" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800834 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700835 installResult = main.intents.installHostIntent( main,
836 name="1HOP",
837 onosNode=0,
838 host1=host1,
839 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800840
841 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700842 testResult = main.intents.testHostIntent( main,
843 name="1HOP",
844 intentId=installResult,
845 onosNode=0,
846 host1=host1,
847 host2=host2,
848 sw1="s5",
849 sw2="s2",
850 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800851 else:
852 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700853
854 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800855 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700856 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700857 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700858
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700859 main.step( "VLAN1: Add vlan host intents between h4 and h12" )
acsmars5d8cc862015-09-25 09:44:50 -0700860 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700861 host1 = { "name": "h4", "id": "00:00:00:00:00:04/100", "vlan": "100" }
862 host2 = { "name": "h12", "id": "00:00:00:00:00:0C/100", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800863 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700864 installResult = main.intents.installHostIntent( main,
865 name="VLAN1",
866 onosNode=0,
867 host1=host1,
868 host2=host2 )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800869 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700870 testResult = main.intents.testHostIntent( main,
871 name="VLAN1",
872 intentId=installResult,
873 onosNode=0,
874 host1=host1,
875 host2=host2,
876 sw1="s5",
877 sw2="s2",
878 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -0800879 else:
880 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700881
882 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800883 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -0700884 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700885 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700886
Jeremy Songsterff553672016-05-12 17:06:23 -0700887 main.step( "VLAN2: Add vlan host intents between h4 and h13" )
888 main.assertReturnString = "Assertion Result vlan IPV4\n"
Jon Hall9c888672017-05-15 18:03:54 -0700889 host1 = { "name": "h5", "vlan": "200" }
890 host2 = { "name": "h12", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -0700891 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700892 installResult = main.intents.installHostIntent( main,
893 name="VLAN2",
894 onosNode=0,
895 host1=host1,
896 host2=host2 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700897
898 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700899 testResult = main.intents.testHostIntent( main,
900 name="VLAN2",
901 intentId=installResult,
902 onosNode=0,
903 host1=host1,
904 host2=host2,
905 sw1="s5",
906 sw2="s2",
907 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -0700908 else:
909 main.CLIs[ 0 ].removeAllIntents( purge=True )
910
911 utilities.assert_equals( expect=main.TRUE,
912 actual=testResult,
913 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700914 onfail=main.assertReturnString )
Jeremy Songsterff553672016-05-12 17:06:23 -0700915
Jeremy Songsterc032f162016-08-04 17:14:49 -0700916 main.step( "Encapsulation: Add host intents between h1 and h9" )
917 main.assertReturnString = "Assertion Result for VLAN Encapsulated host intent\n"
Jon Hall9c888672017-05-15 18:03:54 -0700918 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
919 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -0700920 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700921 installResult = main.intents.installHostIntent( main,
922 name="ENCAPSULATION",
923 onosNode=0,
924 host1=host1,
925 host2=host2,
926 encap="VLAN" )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700927 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700928 testResult = main.intents.testHostIntent( main,
929 name="ENCAPSULATION",
930 intentId=installResult,
931 onosNode=0,
932 host1=host1,
933 host2=host2,
934 sw1="s5",
935 sw2="s2",
936 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700937 else:
938 main.CLIs[ 0 ].removeAllIntents( purge=True )
939
940 utilities.assert_equals( expect=main.TRUE,
941 actual=testResult,
942 onpass=main.assertReturnString,
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700943 onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -0700944
Jon Hall78be4962017-05-23 14:53:53 -0700945 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -0700946 # main.step( "Encapsulation: Add host intents between h1 and h9" )
947 # main.assertReturnString = "Assertion Result for MPLS Encapsulated host intent\n"
948 # host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
949 # host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
950 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -0700951 # installResult = main.intents.installHostIntent( main,
952 # name="ENCAPSULATION",
953 # onosNode=0,
954 # host1=host1,
955 # host2=host2,
956 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -0700957 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -0700958 # testResult = main.intents.testHostIntent( main,
959 # name="ENCAPSULATION",
960 # intentId=installResult,
961 # onosNode=0,
962 # host1=host1,
963 # host2=host2,
964 # sw1="s5",
965 # sw2="s2",
966 # expectedLink=18 )
alison52b25892016-09-19 10:53:48 -0700967 # else:
968 # main.CLIs[ 0 ].removeAllIntents( purge=True )
969 #
970 # utilities.assert_equals( expect=main.TRUE,
971 # actual=testResult,
972 # onpass=main.assertReturnString,
973 # onfail=main.assertReturnString )
974
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700975 main.step( "Confirm that ONOS leadership is unchanged" )
acsmarse6b410f2015-07-17 14:39:34 -0700976 intentLeadersNew = main.CLIs[ 0 ].leaderCandidates()
Jon Hall78be4962017-05-23 14:53:53 -0700977 testResult = main.intents.checkLeaderChange( intentLeadersOld,
978 intentLeadersNew )
acsmarse6b410f2015-07-17 14:39:34 -0700979
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800980 utilities.assert_equals( expect=main.TRUE,
981 actual=testResult,
982 onpass="ONOS Leaders Unchanged",
Jeremy Songstere7f3b342016-08-17 14:56:49 -0700983 onfail="ONOS Leader Mismatch" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -0800984
Jon Hall78be4962017-05-23 14:53:53 -0700985 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -0700986
kelvin-onlabb769f562015-07-15 17:05:10 -0700987 def CASE2000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -0700988 """
989 Add point intents between 2 hosts:
990 - Get device ids | ports
991 - Add point intents
992 - Check intents
993 - Verify flows
994 - Ping hosts
995 - Reroute
996 - Link down
997 - Verify flows
998 - Check topology
999 - Ping hosts
1000 - Link up
1001 - Verify flows
1002 - Check topology
1003 - Ping hosts
1004 - Remove intents
1005 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001006 if main.initialized == main.FALSE:
1007 main.log.error( "Test components did not start correctly, skipping further tests" )
1008 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001009 # Assert variables - These variable's name|format must be followed
1010 # if you want to use the wrapper function
1011 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001012 try:
1013 assert main.CLIs
1014 except AssertionError:
1015 main.log.error( "There is no main.CLIs, skipping test cases" )
1016 main.initialized = main.FALSE
1017 main.skipCase()
1018 try:
1019 assert main.Mininet1
1020 except AssertionError:
1021 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1022 main.initialized = main.FALSE
1023 main.skipCase()
1024 try:
1025 assert main.numSwitch
1026 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001027 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001028 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001029 main.initialized = main.FALSE
1030 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001031
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001032 main.testName = "Point Intents"
1033 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001034 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001035 main.caseExplanation = "This test case will test point to point" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001036 " intents using " + str( main.numCtrls ) +\
1037 " node(s) cluster;\n" +\
1038 "Different type of hosts will be tested in " +\
1039 "each step such as IPV4, Dual stack, VLAN etc" +\
1040 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001041 " OVS running in Mininet and compile intents" +\
1042 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001043
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001044 # No option point intents
1045 main.step( "NOOPTION: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001046 main.assertReturnString = "Assertion Result for NOOPTION point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001047 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001048 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001049 ]
1050 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001051 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001052 ]
Jeremy42df2e72016-02-23 16:37:46 -08001053 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001054 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001055 main,
1056 name="NOOPTION",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001057 senders=senders,
1058 recipients=recipients )
1059
1060 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001061 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001062 main,
1063 intentId=installResult,
1064 name="NOOPTION",
1065 senders=senders,
1066 recipients=recipients,
1067 sw1="s5",
1068 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001069 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001070 else:
1071 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001072
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001073 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001074 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001075 onpass=main.assertReturnString,
1076 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001077
kelvin-onlabb769f562015-07-15 17:05:10 -07001078 main.step( "IPV4: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001079 main.assertReturnString = "Assertion Result for IPV4 point intent\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001080 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001081 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001082 ]
1083 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001084 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001085 ]
Jeremy42df2e72016-02-23 16:37:46 -08001086 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001087 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001088 main,
1089 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001090 senders=senders,
1091 recipients=recipients,
1092 ethType="IPV4" )
1093
1094 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001095 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001096 main,
1097 intentId=installResult,
1098 name="IPV4",
1099 senders=senders,
1100 recipients=recipients,
1101 sw1="s5",
1102 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001103 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001104 else:
1105 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001106
1107 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001108 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001109 onpass=main.assertReturnString,
1110 onfail=main.assertReturnString )
alisonda157272016-12-22 01:13:21 -08001111
Jon Hall78be4962017-05-23 14:53:53 -07001112 main.step( "Protected: Add point intents between h1 and h9" )
alisonda157272016-12-22 01:13:21 -08001113 main.assertReturnString = "Assertion Result for protected point intent\n"
1114 senders = [
Jon Hall78be4962017-05-23 14:53:53 -07001115 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
alisonda157272016-12-22 01:13:21 -08001116 ]
1117 recipients = [
Jon Hall78be4962017-05-23 14:53:53 -07001118 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09" }
alisonda157272016-12-22 01:13:21 -08001119 ]
1120 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001121 installResult = main.intents.installPointIntent(
alisonda157272016-12-22 01:13:21 -08001122 main,
1123 name="Protected",
1124 senders=senders,
1125 recipients=recipients,
1126 protected=True )
1127
1128 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001129 testResult = main.intents.testPointIntent(
alisonda157272016-12-22 01:13:21 -08001130 main,
1131 name="Protected",
1132 intentId=installResult,
1133 senders=senders,
1134 recipients=recipients,
1135 sw1="s5",
1136 sw2="s2",
1137 protected=True,
1138 expectedLink=18 )
1139 else:
1140 main.CLIs[ 0 ].removeAllIntents( purge=True )
1141
1142 utilities.assert_equals( expect=main.TRUE,
1143 actual=testResult,
1144 onpass=main.assertReturnString,
1145 onfail=main.assertReturnString )
1146
kelvin-onlabb769f562015-07-15 17:05:10 -07001147 main.step( "IPV4_2: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001148 main.assertReturnString = "Assertion Result for IPV4 no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001149 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001150 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001151 ]
1152 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001153 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001154 ]
Jeremy42df2e72016-02-23 16:37:46 -08001155 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001156 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001157 main,
1158 name="IPV4_2",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001159 senders=senders,
1160 recipients=recipients,
1161 ethType="IPV4" )
1162
1163 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001164 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001165 main,
1166 intentId=installResult,
1167 name="IPV4_2",
1168 senders=senders,
1169 recipients=recipients,
1170 sw1="s5",
1171 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001172 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001173 else:
1174 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001175
1176 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001177 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001178 onpass=main.assertReturnString,
1179 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001180
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001181 main.step( "SDNIP-ICMP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001182 main.assertReturnString = "Assertion Result for SDNIP-ICMP IPV4 using TCP point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001183 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001184 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01",
Jeremy6f000c62016-02-25 17:02:28 -08001185 "ip":( main.h1.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001186 ]
1187 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001188 { "name": "h9", "device": "of:0000000000000006/1", "mac": "00:00:00:00:00:09",
Jeremy6f000c62016-02-25 17:02:28 -08001189 "ip":( main.h9.hostIp + "/24" ) }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001190 ]
Jeremy6f000c62016-02-25 17:02:28 -08001191 ipProto = main.params[ 'SDNIP' ][ 'ipPrototype' ]
kelvin-onlab79ce0492015-07-27 16:14:39 -07001192 # Uneccessary, not including this in the selectors
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001193 tcpSrc = main.params[ 'SDNIP' ][ 'srcPort' ]
1194 tcpDst = main.params[ 'SDNIP' ][ 'dstPort' ]
Jeremy42df2e72016-02-23 16:37:46 -08001195 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001196 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001197 main,
1198 name="SDNIP-ICMP",
1199 senders=senders,
1200 recipients=recipients,
1201 ethType="IPV4",
1202 ipProto=ipProto,
1203 tcpSrc=tcpSrc,
1204 tcpDst=tcpDst )
1205
1206 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001207 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001208 main,
1209 intentId=installResult,
1210 name="SDNIP_ICMP",
1211 senders=senders,
1212 recipients=recipients,
1213 sw1="s5",
1214 sw2="s2",
Jeremy Songstere405d3d2016-05-17 11:18:57 -07001215 expectedLink=18,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001216 useTCP=True )
Jeremy42df2e72016-02-23 16:37:46 -08001217 else:
1218 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabb769f562015-07-15 17:05:10 -07001219
1220 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001221 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001222 onpass=main.assertReturnString,
1223 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001224
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001225 main.step( "SDNIP-TCP: Add point intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07001226 main.assertReturnString = "Assertion Result for SDNIP-TCP IPV4 using ICMP point intents\n"
kelvin-onlabb769f562015-07-15 17:05:10 -07001227 mac1 = main.hostsData[ 'h1' ][ 'mac' ]
1228 mac2 = main.hostsData[ 'h9' ][ 'mac' ]
kelvin-onlab58dc39e2015-08-06 08:11:09 -07001229 ip1 = str( main.hostsData[ 'h1' ][ 'ipAddresses' ][ 0 ] ) + "/32"
1230 ip2 = str( main.hostsData[ 'h9' ][ 'ipAddresses' ][ 0 ] ) + "/32"
kelvin-onlabb769f562015-07-15 17:05:10 -07001231 ipProto = main.params[ 'SDNIP' ][ 'tcpProto' ]
1232 tcp1 = main.params[ 'SDNIP' ][ 'srcPort' ]
1233 tcp2 = main.params[ 'SDNIP' ][ 'dstPort' ]
1234
Jon Hall78be4962017-05-23 14:53:53 -07001235 stepResult = main.intents.pointIntentTcp(
kelvin-onlabb769f562015-07-15 17:05:10 -07001236 main,
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001237 name="SDNIP-TCP",
kelvin-onlabb769f562015-07-15 17:05:10 -07001238 host1="h1",
1239 host2="h9",
1240 deviceId1="of:0000000000000005/1",
1241 deviceId2="of:0000000000000006/1",
1242 mac1=mac1,
1243 mac2=mac2,
1244 ethType="IPV4",
kelvin-onlabb55e58e2015-08-04 00:13:48 -07001245 ipProto=ipProto,
1246 ip1=ip1,
1247 ip2=ip2,
1248 tcp1=tcp1,
1249 tcp2=tcp2 )
kelvin-onlabb769f562015-07-15 17:05:10 -07001250
1251 utilities.assert_equals( expect=main.TRUE,
Jeremy6f000c62016-02-25 17:02:28 -08001252 actual=stepResult,
acsmars5d8cc862015-09-25 09:44:50 -07001253 onpass=main.assertReturnString,
1254 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001255
acsmars5d8cc862015-09-25 09:44:50 -07001256 main.step( "DUALSTACK1: Add point intents between h3 and h11" )
1257 main.assertReturnString = "Assertion Result for Dualstack1 IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001258 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001259 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001260 ]
1261 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001262 { "name": "h11", "device": "of:0000000000000006/3", "mac": "00:00:00:00:00:0B" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001263 ]
Jeremy42df2e72016-02-23 16:37:46 -08001264 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001265 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001266 main,
1267 name="DUALSTACK1",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001268 senders=senders,
1269 recipients=recipients,
1270 ethType="IPV4" )
1271
1272 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001273 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001274 main,
1275 intentId=installResult,
1276 name="DUALSTACK1",
1277 senders=senders,
1278 recipients=recipients,
1279 sw1="s5",
1280 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001281 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001282 else:
1283 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001284
1285 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001286 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001287 onpass=main.assertReturnString,
1288 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001289
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001290 main.step( "VLAN: Add point intents between h5 and h21" )
acsmars5d8cc862015-09-25 09:44:50 -07001291 main.assertReturnString = "Assertion Result for VLAN IPV4 with mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001292 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001293 { "name": "h5", "device": "of:0000000000000005/5", "mac": "00:00:00:00:00:05", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001294 ]
1295 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001296 { "name": "h21", "device": "of:0000000000000007/5", "mac": "00:00:00:00:00:15", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001297 ]
Jeremy42df2e72016-02-23 16:37:46 -08001298 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001299 installResult = main.intents.installPointIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001300 main,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001301 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001302 senders=senders,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001303 recipients=recipients )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001304
1305 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001306 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001307 main,
1308 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001309 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001310 senders=senders,
1311 recipients=recipients,
1312 sw1="s5",
1313 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001314 expectedLink=18 )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001315
1316 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001317 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001318 onpass=main.assertReturnString,
1319 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001320
Jeremy Songsterff553672016-05-12 17:06:23 -07001321 main.step( "VLAN: Add point intents between h5 and h21" )
1322 main.assertReturnString = "Assertion Result for VLAN IPV4 point intents with VLAN treatment\n"
1323 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001324 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001325 ]
1326 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001327 { "name": "h21", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001328 ]
1329 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001330 installResult = main.intents.installPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001331 main,
1332 name="VLAN2",
1333 senders=senders,
1334 recipients=recipients,
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001335 setVlan=200 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001336
1337 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001338 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001339 main,
1340 intentId=installResult,
1341 name="VLAN2",
1342 senders=senders,
1343 recipients=recipients,
1344 sw1="s5",
1345 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001346 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001347
1348 utilities.assert_equals( expect=main.TRUE,
1349 actual=testResult,
1350 onpass=main.assertReturnString,
1351 onfail=main.assertReturnString )
1352
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001353 main.step( "1HOP: Add point intents between h1 and h3" )
acsmars5d8cc862015-09-25 09:44:50 -07001354 main.assertReturnString = "Assertion Result for 1HOP IPV4 with no mac address point intents\n"
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001355 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001356 { "name": "h1", "device": "of:0000000000000005/1", "mac": "00:00:00:00:00:01" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001357 ]
1358 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001359 { "name": "h3", "device": "of:0000000000000005/3", "mac": "00:00:00:00:00:03" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001360 ]
Jeremy42df2e72016-02-23 16:37:46 -08001361 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001362 installResult = main.intents.installPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001363 main,
1364 name="1HOP IPV4",
1365 senders=senders,
1366 recipients=recipients,
1367 ethType="IPV4" )
1368
1369 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001370 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001371 main,
1372 intentId=installResult,
1373 name="1HOP IPV4",
1374 senders=senders,
1375 recipients=recipients,
1376 sw1="s5",
1377 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001378 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001379 else:
1380 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001381
1382 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001383 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001384 onpass=main.assertReturnString,
1385 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001386
Jeremy Songsterc032f162016-08-04 17:14:49 -07001387 main.step( "Add point to point intents using VLAN Encapsulation" )
1388 main.assertReturnString = "Assertion Result for VLAN Encapsulation Point Intent"
1389 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001390 { "name": "h1", "device": "of:0000000000000005/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001391 ]
1392 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001393 { "name": "h9", "device": "of:0000000000000006/1" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07001394 ]
1395 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001396 installResult = main.intents.installPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001397 main,
1398 name="ENCAPSULATION",
1399 senders=senders,
1400 recipients=recipients,
1401 encap="VLAN" )
1402
1403 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001404 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07001405 main,
1406 intentId=installResult,
1407 name="ENCAPSULATION",
1408 senders=senders,
1409 recipients=recipients,
1410 sw1="s5",
1411 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001412 expectedLink=18 )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001413 else:
1414 main.CLIs[ 0 ].removeAllIntents( purge=True )
1415
1416 utilities.assert_equals( expect=main.TRUE,
1417 actual=testResult,
1418 onpass=main.assertReturnString,
1419 onfail=main.assertReturnString )
1420
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001421 main.step( "BANDWIDTH ALLOCATION: Checking bandwidth allocation for point intents between h1 and h9" )
1422 main.assertReturnString = "Assertion Result for BANDWIDTH ALLOCATION for point intent\n"
1423 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001424 { "name": "h1", "device": "of:0000000000000005/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001425 ]
1426 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001427 { "name": "h9", "device": "of:0000000000000006/1" }
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001428 ]
1429 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001430 installResult = main.intents.installPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001431 main,
1432 name="NOOPTION",
1433 senders=senders,
1434 recipients=recipients,
Jon Hallf539eb92017-05-22 17:18:42 -07001435 bandwidth=100 )
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001436
1437 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001438 testResult = main.intents.testPointIntent(
Shreya Chowdhary6fbb96c2017-05-02 16:20:19 -07001439 main,
1440 intentId=installResult,
1441 name="NOOPTION",
1442 senders=senders,
1443 recipients=recipients,
1444 sw1="s5",
1445 sw2="s2",
1446 expectedLink=18 )
1447 else:
1448 main.CLIs[ 0 ].removeAllIntents( purge=True )
1449
1450 utilities.assert_equals( expect=main.TRUE,
1451 actual=testResult,
1452 onpass=main.assertReturnString,
1453 onfail=main.assertReturnString )
1454
Jon Hall78be4962017-05-23 14:53:53 -07001455 # Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
alison52b25892016-09-19 10:53:48 -07001456 # main.step( "Add point to point intents using MPLS Encapsulation" )
1457 # main.assertReturnString = "Assertion Result for MPLS Encapsulation Point Intent"
1458 # senders = [
1459 # { "name": "h1", "device": "of:0000000000000005/1" }
1460 # ]
1461 # recipients = [
1462 # { "name": "h9", "device": "of:0000000000000006/1" }
1463 # ]
1464 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001465 # installResult = main.intents.installPointIntent(
alison52b25892016-09-19 10:53:48 -07001466 # main,
1467 # name="ENCAPSULATION",
1468 # senders=senders,
1469 # recipients=recipients,
1470 # encap="MPLS" )
1471 #
1472 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001473 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001474 # main,
1475 # intentId=installResult,
1476 # name="ENCAPSULATION",
1477 # senders=senders,
1478 # recipients=recipients,
1479 # sw1="s5",
1480 # sw2="s2",
1481 # expectedLink=18 )
1482 # else:
1483 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1484 #
1485 # utilities.assert_equals( expect=main.TRUE,
1486 # actual=testResult,
1487 # onpass=main.assertReturnString,
1488 # onfail=main.assertReturnString )
1489
Jon Hall78be4962017-05-23 14:53:53 -07001490 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001491
kelvin-onlabb769f562015-07-15 17:05:10 -07001492 def CASE3000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001493 """
1494 Add single point to multi point intents
1495 - Get device ids
1496 - Add single point to multi point intents
1497 - Check intents
1498 - Verify flows
1499 - Ping hosts
1500 - Reroute
1501 - Link down
1502 - Verify flows
1503 - Check topology
1504 - Ping hosts
1505 - Link up
1506 - Verify flows
1507 - Check topology
1508 - Ping hosts
1509 - Remove intents
1510 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001511 if main.initialized == main.FALSE:
1512 main.log.error( "Test components did not start correctly, skipping further tests" )
1513 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001514 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001515 try:
1516 assert main.CLIs
1517 except AssertionError:
1518 main.log.error( "There is no main.CLIs, skipping test cases" )
1519 main.initialized = main.FALSE
1520 main.skipCase()
1521 try:
1522 assert main.Mininet1
1523 except AssertionError:
1524 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1525 main.initialized = main.FALSE
1526 main.skipCase()
1527 try:
1528 assert main.numSwitch
1529 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001530 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001531 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001532 main.initialized = main.FALSE
1533 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001534
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001535 main.testName = "Single to Multi Point Intents"
1536 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001537 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001538 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001539 " multi point intents using " +\
1540 str( main.numCtrls ) + " node(s) cluster;\n" +\
1541 "Different type of hosts will be tested in " +\
1542 "each step such as IPV4, Dual stack, VLAN etc" +\
1543 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001544 " OVS running in Mininet and compile intents" +\
1545 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001546
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001547 main.step( "NOOPTION: Install and test single point to multi point intents" )
1548 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with no options set\n"
1549 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001550 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001551 ]
1552 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001553 { "name": "h16", "device": "of:0000000000000006/8" },
1554 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001555 ]
Jon Hall9c888672017-05-15 18:03:54 -07001556 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1557 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001558 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001559 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001560 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001561 name="NOOPTION",
1562 senders=senders,
1563 recipients=recipients,
1564 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001565 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001566
1567 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001568 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001569 main,
1570 intentId=installResult,
1571 name="NOOPTION",
1572 senders=senders,
1573 recipients=recipients,
1574 badSenders=badSenders,
1575 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001576 sw1="s5",
1577 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001578 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001579 else:
1580 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001581
1582 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001583 actual=testResult,
1584 onpass=main.assertReturnString,
1585 onfail=main.assertReturnString )
1586
1587 main.step( "IPV4: Install and test single point to multi point intents" )
1588 main.assertReturnString = "Assertion results for IPV4 single to multi point intent with IPV4 type and MAC addresses\n"
1589 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001590 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001591 ]
1592 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001593 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1594 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001595 ]
Jon Hall9c888672017-05-15 18:03:54 -07001596 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1597 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001598 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001599 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001600 main,
1601 name="IPV4",
1602 senders=senders,
1603 recipients=recipients,
1604 ethType="IPV4",
1605 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001606 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001607
1608 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001609 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001610 main,
1611 intentId=installResult,
1612 name="IPV4",
1613 senders=senders,
1614 recipients=recipients,
1615 badSenders=badSenders,
1616 badRecipients=badRecipients,
1617 sw1="s5",
1618 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001619 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001620 else:
1621 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001622
1623 utilities.assert_equals( expect=main.TRUE,
1624 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001625 onpass=main.assertReturnString,
1626 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001627
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001628 main.step( "IPV4_2: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001629 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 -08001630 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001631 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001632 ]
1633 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001634 { "name": "h16", "device": "of:0000000000000006/8" },
1635 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001636 ]
Jon Hall9c888672017-05-15 18:03:54 -07001637 badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1638 badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001639 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001640 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001641 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001642 name="IPV4_2",
1643 senders=senders,
1644 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001645 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001646 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001647 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001648
1649 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001650 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001651 main,
1652 intentId=installResult,
1653 name="IPV4_2",
1654 senders=senders,
1655 recipients=recipients,
1656 badSenders=badSenders,
1657 badRecipients=badRecipients,
1658 sw1="s5",
1659 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001660 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001661 else:
1662 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001663
1664 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001665 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001666 onpass=main.assertReturnString,
1667 onfail=main.assertReturnString )
kelvin-onlabb769f562015-07-15 17:05:10 -07001668
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001669 main.step( "VLAN: Add single point to multi point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001670 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 -08001671 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001672 { "name": "h4", "device": "of:0000000000000005/4", "mac": "00:00:00:00:00:04", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001673 ]
1674 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001675 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1676 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001677 ]
Jon Hall9c888672017-05-15 18:03:54 -07001678 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1679 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001680 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001681 installResult = main.intents.installSingleToMultiIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001682 main,
alison52b25892016-09-19 10:53:48 -07001683 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001684 senders=senders,
1685 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001686 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001687 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001688
1689 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001690 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001691 main,
1692 intentId=installResult,
Jeremy Songster832f9e92016-05-05 14:30:49 -07001693 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001694 senders=senders,
1695 recipients=recipients,
1696 badSenders=badSenders,
1697 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001698 sw1="s5",
1699 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001700 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001701 else:
1702 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001703
1704 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001705 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001706 onpass=main.assertReturnString,
1707 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001708
Jeremy Songsterff553672016-05-12 17:06:23 -07001709 main.step( "VLAN: Add single point to multi point intents" )
1710 main.assertReturnString = "Assertion results for single to multi point intent with VLAN treatment\n"
1711 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001712 { "name": "h5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001713 ]
1714 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001715 { "name": "h12", "device": "of:0000000000000006/4", "mac": "00:00:00:00:00:0C", "vlan": "100" },
1716 { "name": "h20", "device": "of:0000000000000007/4", "mac": "00:00:00:00:00:14", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07001717 ]
Jon Hall9c888672017-05-15 18:03:54 -07001718 badSenders = [ { "name": "h13" } ] # Senders that are not in the intent
1719 badRecipients = [ { "name": "h21" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07001720 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001721 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001722 main,
1723 name="VLAN2",
1724 senders=senders,
1725 recipients=recipients,
1726 sw1="s5",
1727 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001728 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001729
1730 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001731 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07001732 main,
1733 intentId=installResult,
1734 name="VLAN2",
1735 senders=senders,
1736 recipients=recipients,
1737 badSenders=badSenders,
1738 badRecipients=badRecipients,
1739 sw1="s5",
1740 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001741 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07001742 else:
1743 main.CLIs[ 0 ].removeAllIntents( purge=True )
1744
1745 utilities.assert_equals( expect=main.TRUE,
1746 actual=testResult,
1747 onpass=main.assertReturnString,
1748 onfail=main.assertReturnString )
1749
alison52b25892016-09-19 10:53:48 -07001750 # Does not support Single point to multi point encapsulation
1751 # main.step( "ENCAPSULATION: Install and test single point to multi point intents" )
1752 # main.assertReturnString = "Assertion results for VLAN Encapsulation single to multi point intent\n"
1753 # senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001754 # { "name": "h8", "device": "of:0000000000000005/8" }
alison52b25892016-09-19 10:53:48 -07001755 # ]
1756 # recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001757 # { "name": "h16", "device": "of:0000000000000006/8" },
1758 # { "name": "h24", "device": "of:0000000000000007/8" }
alison52b25892016-09-19 10:53:48 -07001759 # ]
Jon Hall9c888672017-05-15 18:03:54 -07001760 # badSenders = [ { "name": "h9" } ] # Senders that are not in the intent
1761 # badRecipients = [ { "name": "h17" } ] # Recipients that are not in the intent
alison52b25892016-09-19 10:53:48 -07001762 # testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001763 # installResult = main.intents.installSingleToMultiIntent(
alison52b25892016-09-19 10:53:48 -07001764 # main,
1765 # name="ENCAPSULATION",
1766 # senders=senders,
1767 # recipients=recipients,
1768 # sw1="s5",
1769 # sw2="s2",
1770 # encap="VLAN" )
1771 #
1772 # if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001773 # testResult = main.intents.testPointIntent(
alison52b25892016-09-19 10:53:48 -07001774 # main,
1775 # intentId=installResult,
1776 # name="ENCAPSULATION",
1777 # senders=senders,
1778 # recipients=recipients,
1779 # badSenders=badSenders,
1780 # badRecipients=badRecipients,
1781 # sw1="s5",
1782 # sw2="s2",
1783 # expectedLink=18 )
1784 # else:
1785 # main.CLIs[ 0 ].removeAllIntents( purge=True )
1786 #
1787 # utilities.assert_equals( expect=main.TRUE,
1788 # actual=testResult,
1789 # onpass=main.assertReturnString,
1790 # onfail=main.assertReturnString )
Jeremy Songsterc032f162016-08-04 17:14:49 -07001791
Jon Hall78be4962017-05-23 14:53:53 -07001792 main.intents.report( main )
kelvin-onlab016dce22015-08-10 09:54:11 -07001793
kelvin-onlabb769f562015-07-15 17:05:10 -07001794 def CASE4000( self, main ):
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001795 """
1796 Add multi point to single point intents
1797 - Get device ids
1798 - Add multi point to single point intents
1799 - Check intents
1800 - Verify flows
1801 - Ping hosts
1802 - Reroute
1803 - Link down
1804 - Verify flows
1805 - Check topology
1806 - Ping hosts
1807 - Link up
1808 - Verify flows
1809 - Check topology
1810 - Ping hosts
1811 - Remove intents
1812 """
Jeremyd9e4eb12016-04-13 12:09:06 -07001813 if main.initialized == main.FALSE:
1814 main.log.error( "Test components did not start correctly, skipping further tests" )
1815 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001816 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07001817 try:
1818 assert main.CLIs
1819 except AssertionError:
1820 main.log.error( "There is no main.CLIs, skipping test cases" )
1821 main.initialized = main.FALSE
1822 main.skipCase()
1823 try:
1824 assert main.Mininet1
1825 except AssertionError:
1826 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
1827 main.initialized = main.FALSE
1828 main.skipCase()
1829 try:
1830 assert main.numSwitch
1831 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07001832 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001833 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07001834 main.initialized = main.FALSE
1835 main.skipCase()
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001836
kelvin-onlab7bb2d972015-08-05 10:56:16 -07001837 main.testName = "Multi To Single Point Intents"
1838 main.case( main.testName + " Test - " + str( main.numCtrls ) +
Jeremy6e9748f2016-03-25 15:03:39 -07001839 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jon Hall783bbf92015-07-23 14:33:19 -07001840 main.caseExplanation = "This test case will test single point to" +\
kelvin-onlab6dea6e62015-07-23 13:07:26 -07001841 " multi point intents using " +\
1842 str( main.numCtrls ) + " node(s) cluster;\n" +\
1843 "Different type of hosts will be tested in " +\
1844 "each step such as IPV4, Dual stack, VLAN etc" +\
1845 ";\nThe test will use OF " + main.OFProtocol +\
Jeremy6e9748f2016-03-25 15:03:39 -07001846 " OVS running in Mininet and compile intents" +\
1847 " using " + main.flowCompiler
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001848
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001849 main.step( "NOOPTION: Add multi point to single point intents" )
1850 main.assertReturnString = "Assertion results for NOOPTION multi to single point intent\n"
1851 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001852 { "name": "h16", "device": "of:0000000000000006/8" },
1853 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001854 ]
1855 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001856 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001857 ]
Jon Hall9c888672017-05-15 18:03:54 -07001858 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1859 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001860 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001861 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001862 main,
1863 name="NOOPTION",
1864 senders=senders,
1865 recipients=recipients,
1866 sw1="s5",
Jeremye0cb5eb2016-01-27 17:39:09 -08001867 sw2="s2" )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001868
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001869 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001870 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001871 main,
1872 intentId=installResult,
1873 name="NOOPTION",
1874 senders=senders,
1875 recipients=recipients,
1876 badSenders=badSenders,
1877 badRecipients=badRecipients,
1878 sw1="s5",
1879 sw2="s2",
Jeremye0cb5eb2016-01-27 17:39:09 -08001880 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001881 else:
1882 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001883
1884 utilities.assert_equals( expect=main.TRUE,
1885 actual=testResult,
1886 onpass=main.assertReturnString,
1887 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001888
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001889 main.step( "IPV4: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001890 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 -08001891 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001892 { "name": "h16", "device": "of:0000000000000006/8", "mac": "00:00:00:00:00:10" },
1893 { "name": "h24", "device": "of:0000000000000007/8", "mac": "00:00:00:00:00:18" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001894 ]
1895 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001896 { "name": "h8", "device": "of:0000000000000005/8", "mac": "00:00:00:00:00:08" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001897 ]
Jon Hall9c888672017-05-15 18:03:54 -07001898 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1899 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001900 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001901 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001902 main,
1903 name="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001904 senders=senders,
1905 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001906 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001907 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001908 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001909
1910 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001911 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001912 main,
1913 intentId=installResult,
1914 name="IPV4",
1915 senders=senders,
1916 recipients=recipients,
1917 badSenders=badSenders,
1918 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001919 sw1="s5",
1920 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001921 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001922 else:
1923 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001924
1925 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001926 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001927 onpass=main.assertReturnString,
1928 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001929
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001930 main.step( "IPV4_2: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001931 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 -08001932 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001933 { "name": "h16", "device": "of:0000000000000006/8" },
1934 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001935 ]
1936 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001937 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001938 ]
Jon Hall9c888672017-05-15 18:03:54 -07001939 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
1940 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001941 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001942 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001943 main,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001944 name="IPV4_2",
1945 senders=senders,
1946 recipients=recipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001947 ethType="IPV4",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001948 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001949 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001950
1951 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001952 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001953 main,
1954 intentId=installResult,
1955 name="IPV4_2",
1956 senders=senders,
1957 recipients=recipients,
1958 badSenders=badSenders,
1959 badRecipients=badRecipients,
1960 sw1="s5",
1961 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001962 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08001963 else:
1964 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001965
1966 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001967 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07001968 onpass=main.assertReturnString,
1969 onfail=main.assertReturnString )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001970
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001971 main.step( "VLAN: Add multi point to single point intents" )
acsmars5d8cc862015-09-25 09:44:50 -07001972 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 -08001973 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07001974 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
1975 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001976 ]
1977 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07001978 { "name": "h5", "device": "of:0000000000000005/5", "vlan": "200" }
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001979 ]
Jon Hall9c888672017-05-15 18:03:54 -07001980 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
1981 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001982 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07001983 installResult = main.intents.installMultiToSingleIntent(
kelvin-onlabd48a68c2015-07-13 16:01:36 -07001984 main,
1985 name="VLAN",
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001986 senders=senders,
1987 recipients=recipients,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001988 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07001989 sw2="s2" )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001990
1991 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07001992 testResult = main.intents.testPointIntent(
Jeremy Songster1f39bf02016-01-20 17:17:25 -08001993 main,
1994 intentId=installResult,
1995 name="VLAN",
1996 senders=senders,
1997 recipients=recipients,
1998 badSenders=badSenders,
1999 badRecipients=badRecipients,
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002000 sw1="s5",
2001 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002002 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002003 else:
2004 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabd48a68c2015-07-13 16:01:36 -07002005
2006 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002007 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002008 onpass=main.assertReturnString,
2009 onfail=main.assertReturnString )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002010
Jeremy Songsterff553672016-05-12 17:06:23 -07002011 # Right now this fails because of this bug: https://jira.onosproject.org/browse/ONOS-4383
2012 main.step( "VLAN: Add multi point to single point intents" )
2013 main.assertReturnString = "Assertion results for multi to single point intent with VLAN ID treatment\n"
2014 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002015 { "name": "h13", "device": "of:0000000000000006/5", "vlan": "200" },
2016 { "name": "h21", "device": "of:0000000000000007/5", "vlan": "200" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002017 ]
2018 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002019 { "name": "h4", "vlan": "100" }
Jeremy Songsterff553672016-05-12 17:06:23 -07002020 ]
Jon Hall9c888672017-05-15 18:03:54 -07002021 badSenders = [ { "name": "h12" } ] # Senders that are not in the intent
2022 badRecipients = [ { "name": "h20" } ] # Recipients that are not in the intent
Jeremy Songsterff553672016-05-12 17:06:23 -07002023 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002024 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07002025 main,
2026 name="VLAN2",
2027 senders=senders,
2028 recipients=recipients,
2029 sw1="s5",
2030 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002031 setVlan=100 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002032
2033 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002034 testResult = main.intents.testPointIntent(
Jeremy Songsterff553672016-05-12 17:06:23 -07002035 main,
2036 intentId=installResult,
2037 name="VLAN2",
2038 senders=senders,
2039 recipients=recipients,
2040 badSenders=badSenders,
2041 badRecipients=badRecipients,
2042 sw1="s5",
2043 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002044 expectedLink=18 )
Jeremy Songsterff553672016-05-12 17:06:23 -07002045 else:
2046 main.CLIs[ 0 ].removeAllIntents( purge=True )
2047
2048 utilities.assert_equals( expect=main.TRUE,
2049 actual=testResult,
2050 onpass=main.assertReturnString,
2051 onfail=main.assertReturnString )
2052
Jeremy Songsterc032f162016-08-04 17:14:49 -07002053 main.step( "ENCAPSULATION: Add multi point to single point intents" )
2054 main.assertReturnString = "Assertion results for VLAN Encapsulation multi to single point intent\n"
2055 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002056 { "name": "h16", "device": "of:0000000000000006/8" },
2057 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002058 ]
2059 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002060 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songsterc032f162016-08-04 17:14:49 -07002061 ]
Jon Hall9c888672017-05-15 18:03:54 -07002062 badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
2063 badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Jeremy Songsterc032f162016-08-04 17:14:49 -07002064 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002065 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07002066 main,
2067 name="ENCAPSULATION",
2068 senders=senders,
2069 recipients=recipients,
2070 sw1="s5",
2071 sw2="s2",
2072 encap="VLAN" )
2073
2074 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002075 testResult = main.intents.testPointIntent(
Jeremy Songsterc032f162016-08-04 17:14:49 -07002076 main,
2077 intentId=installResult,
2078 name="ENCAPSULATION",
2079 senders=senders,
2080 recipients=recipients,
2081 badSenders=badSenders,
2082 badRecipients=badRecipients,
2083 sw1="s5",
2084 sw2="s2",
2085 expectedLink=18 )
2086 else:
2087 main.CLIs[ 0 ].removeAllIntents( purge=True )
2088
2089 utilities.assert_equals( expect=main.TRUE,
2090 actual=testResult,
2091 onpass=main.assertReturnString,
2092 onfail=main.assertReturnString )
2093
Jon Hall78be4962017-05-23 14:53:53 -07002094 #Testing MPLS would require kernel version of 4.1 or higher ( Current version is 3.13 )
Shreyaca8990f2017-03-16 11:43:11 -07002095 #main.step( "ENCAPSULATION: Add multi point to single point intents" )
2096 #main.assertReturnString = "Assertion results for MPLS Encapsulation multi to single point intent\n"
2097 #senders = [
2098 # { "name": "h16", "device": "of:0000000000000006/8" },
2099 # { "name": "h24", "device": "of:0000000000000007/8" }
Jon Hall78be4962017-05-23 14:53:53 -07002100 # ]
Shreyaca8990f2017-03-16 11:43:11 -07002101 #recipients = [
2102 # { "name": "h8", "device": "of:0000000000000005/8" }
Jon Hall78be4962017-05-23 14:53:53 -07002103 # ]
Shreyaca8990f2017-03-16 11:43:11 -07002104 #badSenders = [ { "name": "h17" } ] # Senders that are not in the intent
Jon Hall78be4962017-05-23 14:53:53 -07002105 #badRecipients = [ { "name": "h9" } ] # Recipients that are not in the intent
Shreyaca8990f2017-03-16 11:43:11 -07002106 #testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002107 #installResult = main.intents.installMultiToSingleIntent(
Shreyaca8990f2017-03-16 11:43:11 -07002108 # main,
2109 # name="ENCAPSULATION",
2110 # senders=senders,
2111 # recipients=recipients,
2112 # sw1="s5",
2113 # sw2="s2",
2114 # encap="MPLS" )
alison52b25892016-09-19 10:53:48 -07002115 #
Shreyaca8990f2017-03-16 11:43:11 -07002116 #if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002117 # testResult = main.intents.testPointIntent(
Shreyaca8990f2017-03-16 11:43:11 -07002118 # main,
2119 # intentId=installResult,
2120 # name="ENCAPSULATION",
2121 # senders=senders,
2122 # recipients=recipients,
2123 # badSenders=badSenders,
2124 # badRecipients=badRecipients,
2125 # sw1="s5",
2126 # sw2="s2",
2127 # expectedLink=18 )
2128 #else:
2129 # main.CLIs[ 0 ].removeAllIntents( purge=True )
alison52b25892016-09-19 10:53:48 -07002130 #
Shreyaca8990f2017-03-16 11:43:11 -07002131 #utilities.assert_equals( expect=main.TRUE,
2132 # actual=testResult,
2133 # onpass=main.assertReturnString,
2134 # onfail=main.assertReturnString )
alison52b25892016-09-19 10:53:48 -07002135
Jon Hall78be4962017-05-23 14:53:53 -07002136 main.intents.report( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002137
acsmars1ff5e052015-07-23 11:27:48 -07002138 def CASE5000( self, main ):
2139 """
acsmars5d8cc862015-09-25 09:44:50 -07002140 Tests Host Mobility
2141 Modifies the topology location of h1
acsmars1ff5e052015-07-23 11:27:48 -07002142 """
Jeremyd9e4eb12016-04-13 12:09:06 -07002143 if main.initialized == main.FALSE:
2144 main.log.error( "Test components did not start correctly, skipping further tests" )
2145 main.skipCase()
acsmars1ff5e052015-07-23 11:27:48 -07002146 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002147 try:
2148 assert main.CLIs
2149 except AssertionError:
2150 main.log.error( "There is no main.CLIs, skipping test cases" )
2151 main.initialized = main.FALSE
2152 main.skipCase()
2153 try:
2154 assert main.Mininet1
2155 except AssertionError:
2156 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2157 main.initialized = main.FALSE
2158 main.skipCase()
2159 try:
2160 assert main.numSwitch
2161 except AssertionError:
Jon Hall78be4962017-05-23 14:53:53 -07002162 main.log.error( "Place the total number of switch topology in " +
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002163 main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002164 main.initialized = main.FALSE
2165 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002166 main.case( "Test host mobility with host intents " + " - " + str( main.numCtrls ) +
2167 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002168 main.step( "Testing host mobility by moving h1 from s5 to s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002169
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002170 main.log.info( "Moving h1 from s5 to s6" )
Jon Hall9c888672017-05-15 18:03:54 -07002171 main.Mininet1.moveHost( "h1", "s5", "s6" )
acsmars1ff5e052015-07-23 11:27:48 -07002172
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002173 # Send discovery ping from moved host
2174 # Moving the host brings down the default interfaces and creates a new one.
2175 # Scapy is restarted on this host to detect the new interface
2176 main.h1.stopScapy()
2177 main.h1.startScapy()
2178
2179 # Discover new host location in ONOS and populate host data.
2180 # Host 1 IP and MAC should be unchanged
Jon Hall78be4962017-05-23 14:53:53 -07002181 main.intents.sendDiscoveryArp( main, [ main.h1 ] )
2182 main.intents.populateHostData( main )
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002183
acsmars1ff5e052015-07-23 11:27:48 -07002184 h1PostMove = main.hostsData[ "h1" ][ "location" ][ 0:19 ]
2185
2186 utilities.assert_equals( expect="of:0000000000000006",
2187 actual=h1PostMove,
2188 onpass="Mobility: Successfully moved h1 to s6",
acsmars5d8cc862015-09-25 09:44:50 -07002189 onfail="Mobility: Failed to move h1 to s6" +
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002190 " to single point intents" +
2191 " with IPV4 type and MAC addresses" +
2192 " in the same VLAN" )
2193
2194 main.step( "IPV4: Add host intents between h1 and h9" )
acsmars5d8cc862015-09-25 09:44:50 -07002195 main.assertReturnString = "Assert result for IPV4 host intent between h1, moved, and h9\n"
Jon Hall9c888672017-05-15 18:03:54 -07002196 host1 = { "name": "h1", "id": "00:00:00:00:00:01/-1" }
2197 host2 = { "name": "h9", "id": "00:00:00:00:00:09/-1" }
Jeremy42df2e72016-02-23 16:37:46 -08002198 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002199 installResult = main.intents.installHostIntent( main,
2200 name="IPV4 Mobility IPV4",
2201 onosNode=0,
2202 host1=host1,
2203 host2=host2 )
Jeremy2f190ca2016-01-29 15:23:57 -08002204 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002205 testResult = main.intents.testHostIntent( main,
2206 name="Host Mobility IPV4",
2207 intentId=installResult,
2208 onosNode=0,
2209 host1=host1,
2210 host2=host2,
2211 sw1="s6",
2212 sw2="s2",
2213 expectedLink=18 )
Jeremy42df2e72016-02-23 16:37:46 -08002214 else:
2215 main.CLIs[ 0 ].removeAllIntents( purge=True )
kelvin-onlabf34a58a2015-07-23 16:41:52 -07002216
2217 utilities.assert_equals( expect=main.TRUE,
Jeremy Songster1f39bf02016-01-20 17:17:25 -08002218 actual=testResult,
acsmars5d8cc862015-09-25 09:44:50 -07002219 onpass=main.assertReturnString,
2220 onfail=main.assertReturnString )
kelvin-onlab016dce22015-08-10 09:54:11 -07002221
Jon Hall78be4962017-05-23 14:53:53 -07002222 main.intents.report( main )
Jeremye0cb5eb2016-01-27 17:39:09 -08002223
2224 def CASE6000( self, main ):
2225 """
2226 Tests Multi to Single Point Intent and Single to Multi Point Intent End Point Failure
2227 """
Jeremy Songster9385d412016-06-02 17:57:36 -07002228 # At some later point discussion on this behavior in MPSP and SPMP intents
2229 # will be reoppened and this test case may need to be updated to reflect
2230 # the outcomes of that discussion
Jeremyd9e4eb12016-04-13 12:09:06 -07002231 if main.initialized == main.FALSE:
2232 main.log.error( "Test components did not start correctly, skipping further tests" )
2233 main.skipCase()
Jeremye0cb5eb2016-01-27 17:39:09 -08002234 assert main, "There is no main"
Jeremyd9e4eb12016-04-13 12:09:06 -07002235 try:
2236 assert main.CLIs
2237 except AssertionError:
2238 main.log.error( "There is no main.CLIs, skipping test cases" )
2239 main.initialized = main.FALSE
2240 main.skipCase()
2241 try:
2242 assert main.Mininet1
2243 except AssertionError:
2244 main.log.error( "Mininet handle should be named Mininet1, skipping test cases" )
2245 main.initialized = main.FALSE
2246 main.skipCase()
2247 try:
2248 assert main.numSwitch
2249 except AssertionError:
alison52b25892016-09-19 10:53:48 -07002250 main.log.error( "Place the total number of switch topology in " + main.numSwitch )
Jeremyd9e4eb12016-04-13 12:09:06 -07002251 main.initialized = main.FALSE
2252 main.skipCase()
alison52b25892016-09-19 10:53:48 -07002253 main.case( "Test Multi to Single End Point Failure" + " - " + str( main.numCtrls ) +
2254 " NODE(S) - OF " + main.OFProtocol + " - Using " + main.flowCompiler )
Jeremy Songster9385d412016-06-02 17:57:36 -07002255 main.step( "Installing Multi to Single Point intents with no options set" )
2256 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2257 "point intent end point failure with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002258 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002259 { "name": "h16", "device": "of:0000000000000006/8" },
2260 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002261 ]
2262 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002263 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002264 ]
2265 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002266 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002267 ]
2268 isolatedRecipients = []
2269 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002270 installResult = main.intents.installMultiToSingleIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002271 main,
2272 name="NOOPTION",
2273 senders=senders,
2274 recipients=recipients,
2275 sw1="s5",
2276 sw2="s2" )
2277
2278 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002279 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002280 main,
2281 intentId=installResult,
2282 name="NOOPTION",
2283 senders=senders,
2284 recipients=recipients,
2285 isolatedSenders=isolatedSenders,
2286 isolatedRecipients=isolatedRecipients,
2287 sw1="s6",
2288 sw2="s2",
2289 sw3="s4",
2290 sw4="s1",
2291 sw5="s3",
2292 expectedLink1=16,
2293 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002294 else:
2295 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002296
2297 utilities.assert_equals( expect=main.TRUE,
2298 actual=testResult,
2299 onpass=main.assertReturnString,
2300 onfail=main.assertReturnString )
2301
Jeremy Songster9385d412016-06-02 17:57:36 -07002302 main.step( "Installing Multi to Single Point intents with partial failure allowed" )
2303
2304 main.assertReturnString = "Assertion results for IPV4 multi to single " +\
2305 "with partial failures allowed\n"
2306 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002307 { "name": "h16", "device": "of:0000000000000006/8" },
2308 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002309 ]
2310 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002311 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002312 ]
2313 isolatedSenders = [
Jon Hall9c888672017-05-15 18:03:54 -07002314 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002315 ]
2316 isolatedRecipients = []
2317 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002318 installResult = main.intents.installMultiToSingleIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002319 main,
2320 name="NOOPTION",
2321 senders=senders,
2322 recipients=recipients,
2323 sw1="s5",
2324 sw2="s2",
2325 partial=True )
2326
2327 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002328 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002329 main,
2330 intentId=installResult,
2331 name="NOOPTION",
2332 senders=senders,
2333 recipients=recipients,
2334 isolatedSenders=isolatedSenders,
2335 isolatedRecipients=isolatedRecipients,
2336 sw1="s6",
2337 sw2="s2",
2338 sw3="s4",
2339 sw4="s1",
2340 sw5="s3",
2341 expectedLink1=16,
2342 expectedLink2=14,
2343 partial=True )
2344 else:
2345 main.CLIs[ 0 ].removeAllIntents( purge=True )
2346
2347 utilities.assert_equals( expect=main.TRUE,
2348 actual=testResult,
2349 onpass=main.assertReturnString,
2350 onfail=main.assertReturnString )
2351
Jeremye0cb5eb2016-01-27 17:39:09 -08002352 main.step( "NOOPTION: Install and test single point to multi point intents" )
Jeremy Songster9385d412016-06-02 17:57:36 -07002353 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2354 "point intent with no options set\n"
Jeremye0cb5eb2016-01-27 17:39:09 -08002355 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002356 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002357 ]
2358 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002359 { "name": "h16", "device": "of:0000000000000006/8" },
2360 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002361 ]
Jeremy Songster9385d412016-06-02 17:57:36 -07002362 isolatedSenders = []
2363 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002364 { "name": "h24" }
Jeremye0cb5eb2016-01-27 17:39:09 -08002365 ]
2366 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002367 installResult = main.intents.installSingleToMultiIntent(
Jeremye0cb5eb2016-01-27 17:39:09 -08002368 main,
2369 name="NOOPTION",
2370 senders=senders,
2371 recipients=recipients,
2372 sw1="s5",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002373 sw2="s2" )
Jeremye0cb5eb2016-01-27 17:39:09 -08002374
2375 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002376 testResult = main.intents.testEndPointFail(
Jeremye0cb5eb2016-01-27 17:39:09 -08002377 main,
2378 intentId=installResult,
2379 name="NOOPTION",
2380 senders=senders,
2381 recipients=recipients,
2382 isolatedSenders=isolatedSenders,
2383 isolatedRecipients=isolatedRecipients,
2384 sw1="s6",
2385 sw2="s2",
2386 sw3="s4",
2387 sw4="s1",
2388 sw5="s3",
2389 expectedLink1=16,
2390 expectedLink2=14 )
Jeremy42df2e72016-02-23 16:37:46 -08002391 else:
2392 main.CLIs[ 0 ].removeAllIntents( purge=True )
Jeremye0cb5eb2016-01-27 17:39:09 -08002393
2394 utilities.assert_equals( expect=main.TRUE,
2395 actual=testResult,
2396 onpass=main.assertReturnString,
2397 onfail=main.assertReturnString )
Jeremy Songster9385d412016-06-02 17:57:36 -07002398 # Right now this functionality doesn't work properly in SPMP intents
Jon Hall78be4962017-05-23 14:53:53 -07002399 main.step( "NOOPTION: Install and test single point to multi point " +
Jeremy Songster9385d412016-06-02 17:57:36 -07002400 "intents with partial failures allowed" )
2401 main.assertReturnString = "Assertion results for IPV4 single to multi " +\
2402 "point intent with partial failures allowed\n"
2403 senders = [
Jon Hall9c888672017-05-15 18:03:54 -07002404 { "name": "h8", "device": "of:0000000000000005/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002405 ]
2406 recipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002407 { "name": "h16", "device": "of:0000000000000006/8" },
2408 { "name": "h24", "device": "of:0000000000000007/8" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002409 ]
2410 isolatedSenders = []
2411 isolatedRecipients = [
Jon Hall9c888672017-05-15 18:03:54 -07002412 { "name": "h24" }
Jeremy Songster9385d412016-06-02 17:57:36 -07002413 ]
2414 testResult = main.FALSE
Jon Hall78be4962017-05-23 14:53:53 -07002415 installResult = main.intents.installSingleToMultiIntent(
Jeremy Songster9385d412016-06-02 17:57:36 -07002416 main,
2417 name="NOOPTION",
2418 senders=senders,
2419 recipients=recipients,
2420 sw1="s5",
2421 sw2="s2",
Jeremy Songstere7f3b342016-08-17 14:56:49 -07002422 partial=True )
Jeremy Songster9385d412016-06-02 17:57:36 -07002423
2424 if installResult:
Jon Hall78be4962017-05-23 14:53:53 -07002425 testResult = main.intents.testEndPointFail(
Jeremy Songster9385d412016-06-02 17:57:36 -07002426 main,
2427 intentId=installResult,
2428 name="NOOPTION",
2429 senders=senders,
2430 recipients=recipients,
2431 isolatedSenders=isolatedSenders,
2432 isolatedRecipients=isolatedRecipients,
2433 sw1="s6",
2434 sw2="s2",
2435 sw3="s4",
2436 sw4="s1",
2437 sw5="s3",
2438 expectedLink1=16,
2439 expectedLink2=14,
2440 partial=True )
2441 else:
2442 main.CLIs[ 0 ].removeAllIntents( purge=True )
2443
2444 utilities.assert_equals( expect=main.TRUE,
2445 actual=testResult,
2446 onpass=main.assertReturnString,
2447 onfail=main.assertReturnString )
Jeremye0cb5eb2016-01-27 17:39:09 -08002448
Jon Hall78be4962017-05-23 14:53:53 -07002449 main.intents.report( main )