blob: d1bd05382cbe279a647a8b595bae1aa3d8b9bcfa [file] [log] [blame]
kelvin-onlab4ff9cc12015-05-05 11:14:42 -07001
2# Testing the basic functionality of ONOS Next
3# For sanity and driver functionality excercises only.
4
5import time
6import json
7
kelvin-onlab05cf7732015-05-08 14:25:46 -07008class FuncIntent:
kelvin-onlab4ff9cc12015-05-05 11:14:42 -07009
10 def __init__( self ):
11 self.default = ''
12
13 def CASE10( self, main ):
14 import time
15 import os
kelvin-onlabe5239e52015-05-13 14:46:45 -070016 import imp
kelvin-onlab4ff9cc12015-05-05 11:14:42 -070017 """
18 Startup sequence:
19 cell <name>
20 onos-verify-cell
21 onos-remove-raft-log
22 git pull
23 mvn clean install
24 onos-package
25 onos-install -f
26 onos-wait-for-start
27 """
kelvin-onlabf70fd542015-05-07 18:41:40 -070028 global init
cameron@onlab.us59d29d92015-05-11 14:31:54 -070029 global globalONOSip
kelvin-onlabf70fd542015-05-07 18:41:40 -070030 try:
31 if type(init) is not bool:
32 init = False
33 except NameError:
34 init = False
kelvin-onlab132bd5b2015-05-18 18:15:26 -070035
36 main.wrapper = imp.load_source( 'FuncIntentFunction',
37 '/home/admin/ONLabTest/TestON/tests/' +
38 'FuncIntent/Dependency/' +
39 'FuncIntentFunction.py' )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -070040 #Local variables
41 cellName = main.params[ 'ENV' ][ 'cellName' ]
kelvin-onlabf70fd542015-05-07 18:41:40 -070042 apps = main.params[ 'ENV' ][ 'cellApps' ]
kelvin-onlabf70fd542015-05-07 18:41:40 -070043 gitBranch = main.params[ 'GIT' ][ 'branch' ]
cameron@onlab.us59d29d92015-05-11 14:31:54 -070044 benchIp = os.environ[ 'OCN' ]
kelvin-onlabf70fd542015-05-07 18:41:40 -070045 benchUser = main.params[ 'BENCH' ][ 'user' ]
kelvin-onlab05cf7732015-05-08 14:25:46 -070046 topology = main.params[ 'MININET' ][ 'topo' ]
kelvin-onlab4ff9cc12015-05-05 11:14:42 -070047 main.numSwitch = int( main.params[ 'MININET' ][ 'switch' ] )
kelvin-onlab65782a82015-05-07 14:12:13 -070048 main.numLinks = int( main.params[ 'MININET' ][ 'links' ] )
kelvin-onlabf70fd542015-05-07 18:41:40 -070049 main.numCtrls = main.params[ 'CTRL' ][ 'num' ]
kelvin-onlab132bd5b2015-05-18 18:15:26 -070050 main.ONOSport = []
51 main.hostsData = {}
kelvin-onlab4ff9cc12015-05-05 11:14:42 -070052 PULLCODE = False
53 if main.params[ 'GIT' ][ 'pull' ] == 'True':
54 PULLCODE = True
55 main.case( "Setting up test environment" )
kelvin-onlabf70fd542015-05-07 18:41:40 -070056 main.CLIs = []
57 for i in range( 1, int( main.numCtrls ) + 1 ):
58 main.CLIs.append( getattr( main, 'ONOScli' + str( i ) ) )
kelvin-onlab132bd5b2015-05-18 18:15:26 -070059 main.ONOSport.append( main.params[ 'CTRL' ][ 'port' + str( i ) ] )
cameron@onlab.us7fd2a522015-05-14 11:20:33 -070060
kelvin-onlabf70fd542015-05-07 18:41:40 -070061 # -- INIT SECTION, ONLY RUNS ONCE -- #
62 if init == False:
63 init = True
kelvin-onlabf70fd542015-05-07 18:41:40 -070064
kelvin-onlab05cf7732015-05-08 14:25:46 -070065 main.scale = ( main.params[ 'SCALE' ] ).split( "," )
66 main.numCtrls = int( main.scale[ 0 ] )
kelvin-onlabf70fd542015-05-07 18:41:40 -070067
68 if PULLCODE:
69 main.step( "Git checkout and pull " + gitBranch )
70 main.ONOSbench.gitCheckout( gitBranch )
71 gitPullResult = main.ONOSbench.gitPull()
72 if gitPullResult == main.ERROR:
73 main.log.error( "Error pulling git branch" )
74 main.step( "Using mvn clean & install" )
75 cleanInstallResult = main.ONOSbench.cleanInstall()
76 stepResult = cleanInstallResult
77 utilities.assert_equals( expect=main.TRUE,
78 actual=stepResult,
79 onpass="Successfully compiled " +
80 "latest ONOS",
81 onfail="Failed to compile " +
82 "latest ONOS" )
83 else:
84 main.log.warn( "Did not pull new code so skipping mvn " +
85 "clean install" )
kelvin-onlab132bd5b2015-05-18 18:15:26 -070086
cameron@onlab.us033cc0f2015-05-15 15:27:43 -070087 globalONOSip = main.ONOSbench.getOnosIps()
kelvin-onlab0a28a742015-05-18 16:03:13 -070088
cameron@onlab.us033cc0f2015-05-15 15:27:43 -070089 maxNodes = ( len(globalONOSip) - 2 )
kelvin-onlabf70fd542015-05-07 18:41:40 -070090
kelvin-onlab05cf7732015-05-08 14:25:46 -070091 main.numCtrls = int( main.scale[ 0 ] )
92 main.scale.remove( main.scale[ 0 ] )
cameron@onlab.us59d29d92015-05-11 14:31:54 -070093
cameron@onlab.us033cc0f2015-05-15 15:27:43 -070094 main.ONOSip = []
kelvin-onlab0a28a742015-05-18 16:03:13 -070095 for i in range( maxNodes ):
cameron@onlab.us59d29d92015-05-11 14:31:54 -070096 main.ONOSip.append( globalONOSip[i] )
97
kelvin-onlabf70fd542015-05-07 18:41:40 -070098 #kill off all onos processes
99 main.log.info( "Safety check, killing all ONOS processes" +
100 " before initiating enviornment setup" )
kelvin-onlab132bd5b2015-05-18 18:15:26 -0700101 for i in range(maxNodes):
102 main.ONOSbench.onosDie( globalONOSip[ i ] )
103
kelvin-onlab05cf7732015-05-08 14:25:46 -0700104 print "NODE COUNT = ", main.numCtrls
kelvin-onlabf70fd542015-05-07 18:41:40 -0700105 main.log.info( "Creating cell file" )
106 cellIp = []
kelvin-onlab05cf7732015-05-08 14:25:46 -0700107 for i in range( main.numCtrls ):
108 cellIp.append( str( main.ONOSip[ i ] ) )
kelvin-onlabf70fd542015-05-07 18:41:40 -0700109 print cellIp
110 main.ONOSbench.createCellFile( benchIp, cellName, "",
111 str( apps ), *cellIp )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700112
113 main.step( "Apply cell to environment" )
114 cellResult = main.ONOSbench.setCell( cellName )
115 verifyResult = main.ONOSbench.verifyCell()
116 stepResult = cellResult and verifyResult
117 utilities.assert_equals( expect=main.TRUE,
118 actual=stepResult,
119 onpass="Successfully applied cell to " + \
120 "environment",
121 onfail="Failed to apply cell to environment " )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700122
123 main.step( "Creating ONOS package" )
124 packageResult = main.ONOSbench.onosPackage()
125 stepResult = packageResult
126 utilities.assert_equals( expect=main.TRUE,
127 actual=stepResult,
128 onpass="Successfully created ONOS package",
129 onfail="Failed to create ONOS package" )
130
131 main.step( "Uninstalling ONOS package" )
kelvin-onlabf70fd542015-05-07 18:41:40 -0700132 onosUninstallResult = main.TRUE
cameron@onlab.us033cc0f2015-05-15 15:27:43 -0700133 for i in range( main.numCtrls ):
kelvin-onlabf70fd542015-05-07 18:41:40 -0700134 onosUninstallResult = onosUninstallResult and \
kelvin-onlab05cf7732015-05-08 14:25:46 -0700135 main.ONOSbench.onosUninstall( nodeIp=main.ONOSip[ i ] )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700136 stepResult = onosUninstallResult
137 utilities.assert_equals( expect=main.TRUE,
138 actual=stepResult,
139 onpass="Successfully uninstalled ONOS package",
140 onfail="Failed to uninstall ONOS package" )
141 time.sleep( 5 )
142 main.step( "Installing ONOS package" )
kelvin-onlabf70fd542015-05-07 18:41:40 -0700143 onosInstallResult = main.TRUE
cameron@onlab.us033cc0f2015-05-15 15:27:43 -0700144 for i in range( main.numCtrls ):
kelvin-onlabf70fd542015-05-07 18:41:40 -0700145 onosInstallResult = onosInstallResult and \
kelvin-onlab05cf7732015-05-08 14:25:46 -0700146 main.ONOSbench.onosInstall( node=main.ONOSip[ i ] )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700147 stepResult = onosInstallResult
148 utilities.assert_equals( expect=main.TRUE,
149 actual=stepResult,
150 onpass="Successfully installed ONOS package",
151 onfail="Failed to install ONOS package" )
152
cameron@onlab.us59d29d92015-05-11 14:31:54 -0700153 time.sleep( 20 )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700154 main.step( "Starting ONOS service" )
155 stopResult = main.TRUE
156 startResult = main.TRUE
kelvin-onlabf70fd542015-05-07 18:41:40 -0700157 onosIsUp = main.TRUE
kelvin-onlab05cf7732015-05-08 14:25:46 -0700158 for i in range( main.numCtrls ):
159 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700160 if onosIsUp == main.TRUE:
161 main.log.report( "ONOS instance is up and ready" )
162 else:
163 main.log.report( "ONOS instance may not be up, stop and " +
164 "start ONOS again " )
kelvin-onlab05cf7732015-05-08 14:25:46 -0700165 for i in range( main.numCtrls ):
kelvin-onlabf70fd542015-05-07 18:41:40 -0700166 stopResult = stopResult and \
kelvin-onlab05cf7732015-05-08 14:25:46 -0700167 main.ONOSbench.onosStop( main.ONOSip[ i ] )
168 for i in range( main.numCtrls ):
kelvin-onlabf70fd542015-05-07 18:41:40 -0700169 startResult = startResult and \
kelvin-onlab05cf7732015-05-08 14:25:46 -0700170 main.ONOSbench.onosStart( main.ONOSip[ i ] )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700171 stepResult = onosIsUp and stopResult and startResult
172 utilities.assert_equals( expect=main.TRUE,
173 actual=stepResult,
174 onpass="ONOS service is ready",
175 onfail="ONOS service did not start properly" )
kelvin-onlabe5239e52015-05-13 14:46:45 -0700176
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700177 main.step( "Start ONOS cli" )
kelvin-onlabf70fd542015-05-07 18:41:40 -0700178 cliResult = main.TRUE
kelvin-onlab05cf7732015-05-08 14:25:46 -0700179 for i in range( main.numCtrls ):
180 cliResult = cliResult and \
181 main.CLIs[i].startOnosCli( main.ONOSip[ i ] )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700182 stepResult = cliResult
183 utilities.assert_equals( expect=main.TRUE,
184 actual=stepResult,
185 onpass="Successfully start ONOS cli",
186 onfail="Failed to start ONOS cli" )
187
kelvin-onlab0a28a742015-05-18 16:03:13 -0700188 def CASE9( self, main ):
kelvin-onlab132bd5b2015-05-18 18:15:26 -0700189 '''
190 Report errors/warnings/exceptions
191 '''
192 main.log.info( "Error report: \n" )
193 main.ONOSbench.logReport( globalONOSip[0],
194 [ "INFO", "FOLLOWER", "WARN", "flow", "ERROR" , "Except" ],
195 "s" )
196 #main.ONOSbench.logReport( globalONOSip[1], [ "INFO" ], "d" )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700197
198 def CASE11( self, main ):
199 """
kelvin-onlab05cf7732015-05-08 14:25:46 -0700200 Start mininet
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700201 """
kelvin-onlab05cf7732015-05-08 14:25:46 -0700202 main.log.report( "Start Mininet topology" )
kelvin-onlab132bd5b2015-05-18 18:15:26 -0700203 main.log.case( "Start Mininet topology" )
204
kelvin-onlabf70fd542015-05-07 18:41:40 -0700205 main.step( "Starting Mininet Topology" )
206 topoResult = main.Mininet1.startNet( topoFile=topology )
207 stepResult = topoResult
208 utilities.assert_equals( expect=main.TRUE,
209 actual=stepResult,
210 onpass="Successfully loaded topology",
211 onfail="Failed to load topology" )
212 # Exit if topology did not load properly
213 if not topoResult:
214 main.cleanup()
215 main.exit()
216
kelvin-onlab05cf7732015-05-08 14:25:46 -0700217 def CASE12( self, main ):
218 """
219 Assign mastership to controllers
220 """
221 import re
222
kelvin-onlabe5239e52015-05-13 14:46:45 -0700223 main.case( "Assign switches to controllers" )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700224 main.step( "Assigning switches to controllers" )
225 assignResult = main.TRUE
kelvin-onlab5cbf9992015-05-05 14:34:07 -0700226 for i in range( 1, ( main.numSwitch + 1 ) ):
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700227 main.Mininet1.assignSwController( sw=str( i ),
228 count=1,
kelvin-onlab05cf7732015-05-08 14:25:46 -0700229 ip1=main.ONOSip[ 0 ],
230 port1=main.ONOSport[ 0 ] )
kelvin-onlab5cbf9992015-05-05 14:34:07 -0700231 for i in range( 1, ( main.numSwitch + 1 ) ):
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700232 response = main.Mininet1.getSwController( "s" + str( i ) )
233 print( "Response is " + str( response ) )
kelvin-onlab05cf7732015-05-08 14:25:46 -0700234 if re.search( "tcp:" + main.ONOSip[ 0 ], response ):
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700235 assignResult = assignResult and main.TRUE
236 else:
237 assignResult = main.FALSE
238 stepResult = assignResult
239 utilities.assert_equals( expect=main.TRUE,
240 actual=stepResult,
241 onpass="Successfully assigned switches" +
242 "to controller",
243 onfail="Failed to assign switches to " +
244 "controller" )
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700245 def CASE13( self, main ):
246 """
247 Discover all hosts and store its data to a dictionary
248 """
249 main.case( "Discover all hosts" )
250
251 stepResult = main.TRUE
kelvin-onlab132bd5b2015-05-18 18:15:26 -0700252 main.step( "Discover all hosts using pingall " )
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700253 stepResult = main.wrapper.getHostsData( main )
kelvin-onlab08900012015-05-20 14:30:44 -0700254 utilities.assert_equals( expect=main.TRUE,
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700255 actual=stepResult,
256 onpass="Successfully discovered hosts",
257 onfail="Failed to discover hosts" )
kelvin-onlab4ff9cc12015-05-05 11:14:42 -0700258
kelvin-onlabf70fd542015-05-07 18:41:40 -0700259 def CASE1001( self, main ):
kelvin-onlab7c577e82015-05-07 10:45:16 -0700260 """
kelvin-onlab65782a82015-05-07 14:12:13 -0700261 Add host intents between 2 host:
262 - Discover hosts
263 - Add host intents
264 - Check intents
kelvin-onlabe5239e52015-05-13 14:46:45 -0700265 - Verify flows
kelvin-onlab65782a82015-05-07 14:12:13 -0700266 - Ping hosts
267 - Reroute
268 - Link down
kelvin-onlabe5239e52015-05-13 14:46:45 -0700269 - Verify flows
270 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700271 - Ping hosts
272 - Link up
kelvin-onlabe5239e52015-05-13 14:46:45 -0700273 - Verify flows
274 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700275 - Ping hosts
276 - Remove intents
kelvin-onlab7c577e82015-05-07 10:45:16 -0700277 """
278 import time
279 import json
kelvin-onlab65782a82015-05-07 14:12:13 -0700280 import re
kelvin-onlabe5239e52015-05-13 14:46:45 -0700281
282 # Assert variables - These variable's name|format must be followed
283 # if you want to use the wrapper function
284 assert main, "There is no main"
285 assert main.CLIs, "There is no main.CLIs"
286 assert main.Mininet1, "Mininet handle should be named Mininet1"
287 assert main.numSwitch, "Placed the total number of switch topology in \
288 main.numSwitch"
289
kelvin-onlabe5239e52015-05-13 14:46:45 -0700290 main.case( "Add host intents between 2 host" )
kelvin-onlab05cf7732015-05-08 14:25:46 -0700291
kelvin-onlabe5239e52015-05-13 14:46:45 -0700292 stepResult = main.TRUE
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700293 main.step( "IPV4: Add host intents between h1 and h9" )
294 stepResult = main.wrapper.hostIntent( main,
295 name='IPV4',
296 host1='h1',
297 host2='h9',
298 host1Id='00:00:00:00:00:01/-1',
299 host2Id='00:00:00:00:00:09/-1',
300 sw1='s5',
301 sw2='s2',
302 expectedLink=18 )
kelvin-onlab7c577e82015-05-07 10:45:16 -0700303
kelvin-onlabe5239e52015-05-13 14:46:45 -0700304 utilities.assert_equals( expect=main.TRUE,
305 actual=stepResult,
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700306 onpass="IPV4: Add host intent successful",
307 onfail="IPV4: Add host intent failed" )
308 stepResult = main.TRUE
309
kelvin-onlab381b34c2015-05-21 09:21:06 -0700310 main.step( "DUALSTACK1: Add host intents between h3 and h11" )
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700311 stepResult = main.wrapper.hostIntent( main,
312 name='DUALSTACK',
313 host1='h3',
314 host2='h11',
315 host1Id='00:00:00:00:00:03/-1',
kelvin-onlab132bd5b2015-05-18 18:15:26 -0700316 host2Id='00:00:00:00:00:0B/-1',
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700317 sw1='s5',
318 sw2='s2',
319 expectedLink=18 )
320
321 utilities.assert_equals( expect=main.TRUE,
322 actual=stepResult,
kelvin-onlab381b34c2015-05-21 09:21:06 -0700323 onpass="DUALSTACK1: Add host intent" +
324 " successful",
325 onfail="DUALSTACK1: Add host intent failed" )
326
327 stepResult = main.TRUE
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700328 main.step( "DUALSTACK2: Add host intents between h1 and h11" )
kelvin-onlab381b34c2015-05-21 09:21:06 -0700329 stepResult = main.wrapper.hostIntent( main,
330 name='DUALSTACK2',
331 host1='h1',
332 host2='h11',
333 sw1='s5',
334 sw2='s2',
335 expectedLink=18 )
336
337 utilities.assert_equals( expect=main.TRUE,
338 actual=stepResult,
339 onpass="DUALSTACK2: Add host intent" +
340 " successful",
341 onfail="DUALSTACK2: Add host intent failed" )
kelvin-onlab7c577e82015-05-07 10:45:16 -0700342
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700343 stepResult = main.TRUE
344 main.step( "1HOP: Add host intents between h1 and h3" )
345 stepResult = main.wrapper.hostIntent( main,
346 name='1HOP',
347 host1='h1',
348 host2='h3' )
349
350 utilities.assert_equals( expect=main.TRUE,
351 actual=stepResult,
352 onpass="1HOP: Add host intent" +
353 " successful",
354 onfail="1HOP: Add host intent failed" )
355
356
kelvin-onlabf70fd542015-05-07 18:41:40 -0700357 def CASE1002( self, main ):
kelvin-onlab65782a82015-05-07 14:12:13 -0700358 """
359 Add point intents between 2 hosts:
kelvin-onlabe5239e52015-05-13 14:46:45 -0700360 - Get device ids | ports
kelvin-onlab65782a82015-05-07 14:12:13 -0700361 - Add point intents
362 - Check intents
kelvin-onlabe5239e52015-05-13 14:46:45 -0700363 - Verify flows
kelvin-onlab65782a82015-05-07 14:12:13 -0700364 - Ping hosts
365 - Reroute
366 - Link down
kelvin-onlabe5239e52015-05-13 14:46:45 -0700367 - Verify flows
368 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700369 - Ping hosts
370 - Link up
kelvin-onlabe5239e52015-05-13 14:46:45 -0700371 - Verify flows
372 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700373 - Ping hosts
374 - Remove intents
375 """
kelvin-onlabe5239e52015-05-13 14:46:45 -0700376 import time
377 import json
378 import re
kelvin-onlabe5239e52015-05-13 14:46:45 -0700379
380 # Assert variables - These variable's name|format must be followed
381 # if you want to use the wrapper function
382 assert main, "There is no main"
383 assert main.CLIs, "There is no main.CLIs"
384 assert main.Mininet1, "Mininet handle should be named Mininet1"
385 assert main.numSwitch, "Placed the total number of switch topology in \
386 main.numSwitch"
387
kelvin-onlabb2235602015-05-13 17:51:06 -0700388 main.case( "Add point intents between 2 devices" )
389
390 stepResult = main.TRUE
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700391 # No option point intents
392 main.step( "NOOPTION: Add point intents between h1 and h9" )
393 stepResult = main.wrapper.pointIntent(
394 main,
395 name="NOOPTION",
396 host1="h1",
397 host2="h9",
398 deviceId1="of:0000000000000005/1",
399 deviceId2="of:0000000000000006/1",
400 sw1="s5",
401 sw2="s2",
402 expectedLink=18 )
403
404 stepResult = main.TRUE
405 main.step( "NOOPTION: Add point intents between h1 and h9" )
406 utilities.assert_equals( expect=main.TRUE,
407 actual=stepResult,
408 onpass="NOOPTION: Add point intent successful",
409 onfail="NOOPTION: Add point intent failed" )
410
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700411 stepResult = main.wrapper.pointIntent(
412 main,
413 name="IPV4",
414 host1="h1",
415 host2="h9",
416 deviceId1="of:0000000000000005/1",
417 deviceId2="of:0000000000000006/1",
418 port1="",
419 port2="",
420 ethType="IPV4",
421 mac1="00:00:00:00:00:01",
422 mac2="00:00:00:00:00:09",
423 bandwidth="",
424 lambdaAlloc=False,
425 ipProto="",
426 ip1="",
427 ip2="",
428 tcp1="",
429 tcp2="",
430 sw1="s5",
431 sw2="s2",
432 expectedLink=18 )
433
kelvin-onlabb2235602015-05-13 17:51:06 -0700434 utilities.assert_equals( expect=main.TRUE,
435 actual=stepResult,
kelvin-onlab2ccad6e2015-05-18 10:36:54 -0700436 onpass="IPV4: Add point intent successful",
437 onfail="IPV4: Add point intent failed" )
kelvin-onlab65782a82015-05-07 14:12:13 -0700438
kelvin-onlab381b34c2015-05-21 09:21:06 -0700439 stepResult = main.TRUE
440 main.step( "DUALSTACK1: Add point intents between h1 and h9" )
441 stepResult = main.wrapper.pointIntent(
442 main,
443 name="DUALSTACK1",
444 host1="h3",
445 host2="h11",
446 deviceId1="of:0000000000000005",
447 deviceId2="of:0000000000000006",
448 port1="3",
449 port2="3",
450 ethType="IPV4",
451 mac1="00:00:00:00:00:03",
452 mac2="00:00:00:00:00:0B",
453 bandwidth="",
454 lambdaAlloc=False,
455 ipProto="",
456 ip1="",
457 ip2="",
458 tcp1="",
459 tcp2="",
460 sw1="s5",
461 sw2="s2",
462 expectedLink=18 )
463
464 utilities.assert_equals( expect=main.TRUE,
465 actual=stepResult,
466 onpass="DUALSTACK1: Add point intent" +
467 " successful",
468 onfail="DUALSTACK1: Add point intent failed" )
kelvin-onlabc751ab42015-05-21 14:09:39 -0700469
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700470 stepResult = main.TRUE
471 main.step( "1HOP: Add point intents between h1 and h3" )
472 stepResult = main.wrapper.hostIntent( main,
473 name='1HOP',
474 host1='h1',
475 host2='h3' )
476
477 utilities.assert_equals( expect=main.TRUE,
478 actual=stepResult,
479 onpass="1HOP: Add point intent" +
480 " successful",
481 onfail="1HOP: Add point intent failed" )
482
kelvin-onlabf70fd542015-05-07 18:41:40 -0700483 def CASE1003( self, main ):
kelvin-onlab65782a82015-05-07 14:12:13 -0700484 """
485 Add single point to multi point intents
486 - Get device ids
487 - Add single point to multi point intents
488 - Check intents
kelvin-onlabe5239e52015-05-13 14:46:45 -0700489 - Verify flows
kelvin-onlab65782a82015-05-07 14:12:13 -0700490 - Ping hosts
491 - Reroute
492 - Link down
kelvin-onlabe5239e52015-05-13 14:46:45 -0700493 - Verify flows
494 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700495 - Ping hosts
496 - Link up
kelvin-onlabe5239e52015-05-13 14:46:45 -0700497 - Verify flows
498 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700499 - Ping hosts
500 - Remove intents
501 """
kelvin-onlabf0594d72015-05-19 17:25:12 -0700502 assert main, "There is no main"
503 assert main.CLIs, "There is no main.CLIs"
504 assert main.Mininet1, "Mininet handle should be named Mininet1"
505 assert main.numSwitch, "Placed the total number of switch topology in \
506 main.numSwitch"
kelvin-onlab65782a82015-05-07 14:12:13 -0700507
kelvin-onlabf0594d72015-05-19 17:25:12 -0700508 main.case( "Add single point to multi point intents between devices" )
509
510 stepResult = main.TRUE
kelvin-onlabf0594d72015-05-19 17:25:12 -0700511 hostNames = [ 'h8', 'h16', 'h24' ]
512 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
513 'of:0000000000000007/8' ]
514 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700515
516 main.step( "NOOPTION: Add single point to multi point intents" )
517 stepResult = main.wrapper.singleToMultiIntent(
518 main,
519 name="NOOPTION",
520 hostNames=hostNames,
521 devices=devices,
522 sw1="s5",
523 sw2="s2",
524 expectedLink=18 )
525
526 utilities.assert_equals( expect=main.TRUE,
527 actual=stepResult,
528 onpass="NOOPTION: Successfully added single "
529 + " point to multi point intents",
530 onfail="NOOPTION: Failed to add single point" +
531 " to multi point intents" )
532
533
534
535 main.step( "IPV4: Add single point to multi point intents" )
kelvin-onlabf0594d72015-05-19 17:25:12 -0700536 stepResult = main.wrapper.singleToMultiIntent(
537 main,
kelvin-onlab08900012015-05-20 14:30:44 -0700538 name="IPV4",
kelvin-onlabf0594d72015-05-19 17:25:12 -0700539 hostNames=hostNames,
540 devices=devices,
541 ports=None,
542 ethType="IPV4",
543 macs=macs,
544 bandwidth="",
545 lambdaAlloc=False,
546 ipProto="",
547 ipAddresses="",
548 tcp="",
kelvin-onlab08900012015-05-20 14:30:44 -0700549 sw1="s5",
550 sw2="s2",
551 expectedLink=18 )
kelvin-onlabf0594d72015-05-19 17:25:12 -0700552
553 utilities.assert_equals( expect=main.TRUE,
554 actual=stepResult,
555 onpass="IPV4: Successfully added single point"
556 + " to multi point intents",
557 onfail="IPV4: Failed to add single point" +
558 " to multi point intents" )
kelvin-onlab08900012015-05-20 14:30:44 -0700559
560 main.step( "IPV4_2: Add single point to multi point intents" )
561 hostNames = [ 'h8', 'h16', 'h24' ]
kelvin-onlab08900012015-05-20 14:30:44 -0700562 stepResult = main.wrapper.singleToMultiIntent(
563 main,
564 name="IPV4",
565 hostNames=hostNames,
566 ethType="IPV4",
567 lambdaAlloc=False )
568
569 utilities.assert_equals( expect=main.TRUE,
570 actual=stepResult,
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700571 onpass="IPV4_2: Successfully added single "
572 + " point to multi point intents",
kelvin-onlab08900012015-05-20 14:30:44 -0700573 onfail="IPV4_2: Failed to add single point" +
574 " to multi point intents" )
kelvin-onlabf70fd542015-05-07 18:41:40 -0700575 def CASE1004( self, main ):
kelvin-onlab65782a82015-05-07 14:12:13 -0700576 """
577 Add multi point to single point intents
578 - Get device ids
579 - Add multi point to single point intents
580 - Check intents
kelvin-onlabe5239e52015-05-13 14:46:45 -0700581 - Verify flows
kelvin-onlab65782a82015-05-07 14:12:13 -0700582 - Ping hosts
583 - Reroute
584 - Link down
kelvin-onlabe5239e52015-05-13 14:46:45 -0700585 - Verify flows
586 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700587 - Ping hosts
588 - Link up
kelvin-onlabe5239e52015-05-13 14:46:45 -0700589 - Verify flows
590 - Check topology
kelvin-onlab65782a82015-05-07 14:12:13 -0700591 - Ping hosts
592 - Remove intents
593 """
kelvin-onlabc751ab42015-05-21 14:09:39 -0700594 assert main, "There is no main"
595 assert main.CLIs, "There is no main.CLIs"
596 assert main.Mininet1, "Mininet handle should be named Mininet1"
597 assert main.numSwitch, "Placed the total number of switch topology in \
598 main.numSwitch"
599
600 main.case( "Add multi point to single point intents between devices" )
601
602 stepResult = main.TRUE
kelvin-onlabc751ab42015-05-21 14:09:39 -0700603 hostNames = [ 'h8', 'h16', 'h24' ]
604 devices = [ 'of:0000000000000005/8', 'of:0000000000000006/8', \
605 'of:0000000000000007/8' ]
606 macs = [ '00:00:00:00:00:08', '00:00:00:00:00:10', '00:00:00:00:00:18' ]
kelvin-onlabf2ec6e02015-05-27 14:15:28 -0700607
608 main.step( "NOOPTION: Add multi point to single point intents" )
609 stepResult = main.wrapper.multiToSingleIntent(
610 main,
611 name="NOOPTION",
612 hostNames=hostNames,
613 devices=devices,
614 sw1="s5",
615 sw2="s2",
616 expectedLink=18 )
617
618 utilities.assert_equals( expect=main.TRUE,
619 actual=stepResult,
620 onpass="NOOPTION: Successfully added multi "
621 + " point to single point intents",
622 onfail="NOOPTION: Failed to add multi point" +
623 " to single point intents" )
624
625
626 main.step( "IPV4: Add multi point to single point intents" )
kelvin-onlabc751ab42015-05-21 14:09:39 -0700627 stepResult = main.wrapper.multiToSingleIntent(
628 main,
629 name="IPV4",
630 hostNames=hostNames,
631 devices=devices,
632 ports=None,
633 ethType="IPV4",
634 macs=macs,
635 bandwidth="",
636 lambdaAlloc=False,
637 ipProto="",
638 ipAddresses="",
639 tcp="",
640 sw1="s5",
641 sw2="s2",
642 expectedLink=18 )
643
644 utilities.assert_equals( expect=main.TRUE,
645 actual=stepResult,
646 onpass="IPV4: Successfully added multi point"
647 + " to single point intents",
648 onfail="IPV4: Failed to add multi point" +
649 " to single point intents" )
650
651 main.step( "IPV4_2: Add multi point to single point intents" )
652 hostNames = [ 'h8', 'h16', 'h24' ]
653 stepResult = main.wrapper.multiToSingleIntent(
654 main,
655 name="IPV4",
656 hostNames=hostNames,
657 ethType="IPV4",
658 lambdaAlloc=False )
659
660 utilities.assert_equals( expect=main.TRUE,
661 actual=stepResult,
662 onpass="IPV4_2: Successfully added multi point"
663 + " to single point intents",
664 onfail="IPV4_2: Failed to add multi point" +
665 " to single point intents" )