blob: cb226e780f5d3b930994eed3a22dd9579fd845a8 [file] [log] [blame]
andrewonlab79244cc2015-01-26 01:11:49 -05001# Intent Performance Test for ONOS-next
andrewonlab92ea3672014-11-04 20:22:14 -05002#
andrewonlab79244cc2015-01-26 01:11:49 -05003# andrew@onlab.us
andrewonlab8790abb2014-11-06 13:51:54 -05004#
andrewonlab79244cc2015-01-26 01:11:49 -05005# November 5, 2014
6
andrewonlab92ea3672014-11-04 20:22:14 -05007
8class IntentPerfNext:
andrewonlab79244cc2015-01-26 01:11:49 -05009
10 def __init__( self ):
andrewonlab92ea3672014-11-04 20:22:14 -050011 self.default = ""
12
andrewonlab79244cc2015-01-26 01:11:49 -050013 def CASE1( self, main ):
14 """
andrewonlab92ea3672014-11-04 20:22:14 -050015 ONOS startup sequence
andrewonlab79244cc2015-01-26 01:11:49 -050016 """
andrewonlab92ea3672014-11-04 20:22:14 -050017 import time
andrewonlab79244cc2015-01-26 01:11:49 -050018 global clusterCount
andrewonlab302cd532015-02-20 13:59:50 -050019 global timeToPost
20 global runNum
21
andrewonlab79244cc2015-01-26 01:11:49 -050022 clusterCount = 1
andrewonlab302cd532015-02-20 13:59:50 -050023 timeToPost = time.strftime("%Y-%m-%d %H:%M:%S")
24 runNum = time.strftime("%d%H%M%S")
andrewonlab92ea3672014-11-04 20:22:14 -050025
andrewonlab79244cc2015-01-26 01:11:49 -050026 cellName = main.params[ 'ENV' ][ 'cellName' ]
andrewonlab92ea3672014-11-04 20:22:14 -050027
andrewonlab79244cc2015-01-26 01:11:49 -050028 gitPull = main.params[ 'GIT' ][ 'autoPull' ]
29 checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
andrewonlab302cd532015-02-20 13:59:50 -050030 intentFilePath = main.params[ 'DB' ][ 'intentFilePath' ]
andrewonlab92ea3672014-11-04 20:22:14 -050031
andrewonlab082dfc32015-02-06 13:59:51 -050032 ONOSIp = []
33 for i in range(1, 8):
34 ONOSIp.append(main.params[ 'CTRL' ][ 'ip'+str(i) ])
35 main.ONOSbench.onosUninstall( nodeIp = ONOSIp[i-1] )
andrewonlab4293dcb2014-12-02 15:48:05 -050036
andrewonlab79244cc2015-01-26 01:11:49 -050037 MN1Ip = main.params[ 'MN' ][ 'ip1' ]
38 BENCHIp = main.params[ 'BENCH' ][ 'ip' ]
andrewonlab92ea3672014-11-04 20:22:14 -050039
andrewonlab79244cc2015-01-26 01:11:49 -050040 main.case( "Setting up test environment" )
andrewonlab92ea3672014-11-04 20:22:14 -050041
andrewonlab302cd532015-02-20 13:59:50 -050042 main.step( "Clearing previous DB log file" )
43 fIntentLog = open(intentFilePath, 'w')
44 # Overwrite with empty line and close
45 fIntentLog.write('')
46 fIntentLog.close()
47
andrewonlab5b954b02015-02-05 13:03:46 -050048 main.step( "Starting mininet topology" )
49 main.Mininet1.startNet()
50
andrewonlab79244cc2015-01-26 01:11:49 -050051 main.step( "Creating cell file" )
52 cellFileResult = main.ONOSbench.createCellFile(
53 BENCHIp, cellName, MN1Ip,
andrewonlabe07f8562015-02-20 12:23:07 -050054 ("onos-core,webconsole,onos-api,onos-app-metrics,onos-gui,"
55 "onos-cli,onos-openflow"),
andrewonlab082dfc32015-02-06 13:59:51 -050056 ONOSIp[0] )
andrewonlab92ea3672014-11-04 20:22:14 -050057
andrewonlab79244cc2015-01-26 01:11:49 -050058 main.step( "Applying cell file to environment" )
59 cellApplyResult = main.ONOSbench.setCell( cellName )
60 verifyCellResult = main.ONOSbench.verifyCell()
andrewonlab4293dcb2014-12-02 15:48:05 -050061
andrewonlab79244cc2015-01-26 01:11:49 -050062 main.step( "Removing raft logs" )
63 main.ONOSbench.onosRemoveRaftLogs()
64
65 main.step( "Git checkout and pull " + checkoutBranch )
66 if gitPull == 'on':
67 checkoutResult = \
68 main.ONOSbench.gitCheckout( checkoutBranch )
69 pullResult = main.ONOSbench.gitPull()
70
71 # If you used git pull, auto compile
72 main.step( "Using onos-build to compile ONOS" )
73 buildResult = main.ONOSbench.onosBuild()
andrewonlab92ea3672014-11-04 20:22:14 -050074 else:
andrewonlab79244cc2015-01-26 01:11:49 -050075 checkoutResult = main.TRUE
76 pullResult = main.TRUE
77 buildResult = main.TRUE
78 main.log.info( "Git pull skipped by configuration" )
andrewonlab92ea3672014-11-04 20:22:14 -050079
andrewonlab79244cc2015-01-26 01:11:49 -050080 main.log.report( "Commit information - " )
81 main.ONOSbench.getVersion( report=True )
andrewonlab4cf9dd22014-11-18 21:28:38 -050082
andrewonlab79244cc2015-01-26 01:11:49 -050083 main.step( "Creating ONOS package" )
84 packageResult = main.ONOSbench.onosPackage()
andrewonlab92ea3672014-11-04 20:22:14 -050085
andrewonlab79244cc2015-01-26 01:11:49 -050086 main.step( "Installing ONOS package" )
andrewonlab082dfc32015-02-06 13:59:51 -050087 install1Result = main.ONOSbench.onosInstall( node=ONOSIp[0] )
andrewonlab92ea3672014-11-04 20:22:14 -050088
andrewonlab79244cc2015-01-26 01:11:49 -050089 main.step( "Set cell for ONOScli env" )
90 main.ONOS1cli.setCell( cellName )
andrewonlab92ea3672014-11-04 20:22:14 -050091
andrewonlab79244cc2015-01-26 01:11:49 -050092 time.sleep( 5 )
andrewonlab92ea3672014-11-04 20:22:14 -050093
andrewonlab79244cc2015-01-26 01:11:49 -050094 main.step( "Start onos cli" )
andrewonlab082dfc32015-02-06 13:59:51 -050095 cli1 = main.ONOS1cli.startOnosCli( ONOSIp[0] )
andrewonlab92ea3672014-11-04 20:22:14 -050096
andrewonlab79244cc2015-01-26 01:11:49 -050097 utilities.assert_equals( expect=main.TRUE,
98 actual=cellFileResult and cellApplyResult and
99 verifyCellResult and checkoutResult and
100 pullResult and buildResult and
101 install1Result, # and install2Result and
102 # install3Result,
103 onpass="ONOS started successfully",
104 onfail="Failed to start ONOS" )
andrewonlab92ea3672014-11-04 20:22:14 -0500105
andrewonlab79244cc2015-01-26 01:11:49 -0500106 def CASE2( self, main ):
107 """
andrewonlab92ea3672014-11-04 20:22:14 -0500108 Single intent add latency
109
andrewonlab79244cc2015-01-26 01:11:49 -0500110 """
andrewonlab92ea3672014-11-04 20:22:14 -0500111 import time
112 import json
113 import requests
114 import os
andrewonlabeb1d0542014-12-03 20:12:01 -0500115 import numpy
andrewonlab79244cc2015-01-26 01:11:49 -0500116 global clusterCount
andrewonlab92ea3672014-11-04 20:22:14 -0500117
andrewonlab79244cc2015-01-26 01:11:49 -0500118 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
119 ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
120 ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
121 ONOSIpList = []
122 for i in range( 1, 8 ):
123 ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
andrewonlab92ea3672014-11-04 20:22:14 -0500124
andrewonlab79244cc2015-01-26 01:11:49 -0500125 ONOSUser = main.params[ 'CTRL' ][ 'user' ]
andrewonlab92ea3672014-11-04 20:22:14 -0500126
andrewonlab79244cc2015-01-26 01:11:49 -0500127 defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
andrewonlab92ea3672014-11-04 20:22:14 -0500128
andrewonlab79244cc2015-01-26 01:11:49 -0500129 # number of iterations of case
130 numIter = main.params[ 'TEST' ][ 'numIter' ]
131 numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
132
133 # Timestamp keys for json metrics output
134 submitTime = main.params[ 'JSON' ][ 'submittedTime' ]
135 installTime = main.params[ 'JSON' ][ 'installedTime' ]
136 wdRequestTime = main.params[ 'JSON' ][ 'wdRequestTime' ]
137 withdrawnTime = main.params[ 'JSON' ][ 'withdrawnTime' ]
138
andrewonlaba57a3042015-01-23 13:53:05 -0500139 assertion = main.TRUE
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800140
andrewonlab79244cc2015-01-26 01:11:49 -0500141 intentAddLatList = []
142
143 # Distribute switches according to cluster count
144 for i in range( 1, 9 ):
145 if clusterCount == 1:
146 main.Mininet1.assignSwController(
147 sw=str( i ), ip1=ONOSIpList[ 0 ],
148 port1=defaultSwPort
149 )
150 elif clusterCount == 3:
andrewonlaba57a3042015-01-23 13:53:05 -0500151 if i < 3:
152 index = 0
153 elif i < 6 and i >= 3:
154 index = 1
155 else:
156 index = 2
andrewonlab79244cc2015-01-26 01:11:49 -0500157 main.Mininet1.assignSwController(
158 sw=str( i ), ip1=ONOSIpList[ index ],
159 port1=defaultSwPort
160 )
161 elif clusterCount == 5:
andrewonlaba57a3042015-01-23 13:53:05 -0500162 if i < 3:
163 index = 0
164 elif i < 5 and i >= 3:
165 index = 1
166 elif i < 7 and i >= 5:
167 index = 2
168 elif i == 7:
169 index = 3
170 else:
171 index = 4
andrewonlab79244cc2015-01-26 01:11:49 -0500172 main.Mininet1.assignSwController(
173 sw=str( i ), ip1=ONOSIpList[ index ],
174 port1=defaultSwPort
175 )
176 elif clusterCount == 7:
andrewonlaba57a3042015-01-23 13:53:05 -0500177 if i < 6:
178 index = i
179 else:
180 index = 6
andrewonlab79244cc2015-01-26 01:11:49 -0500181 main.Mininet1.assignSwController(
182 sw=str( i ), ip1=ONOSIpList[ index ],
183 port1=defaultSwPort
184 )
andrewonlab70decc02014-11-19 18:50:23 -0500185
andrewonlab79244cc2015-01-26 01:11:49 -0500186 time.sleep( 10 )
andrewonlab70decc02014-11-19 18:50:23 -0500187
andrewonlab79244cc2015-01-26 01:11:49 -0500188 main.log.report( "Single intent add latency test" )
andrewonlabeb1d0542014-12-03 20:12:01 -0500189
andrewonlab79244cc2015-01-26 01:11:49 -0500190 devicesJsonStr = main.ONOS1cli.devices()
191 devicesJsonObj = json.loads( devicesJsonStr )
192
193 if not devicesJsonObj:
194 main.log.report( "Devices not discovered" )
195 main.log.report( "Aborting test" )
andrewonlaba57a3042015-01-23 13:53:05 -0500196 main.exit()
197 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500198 main.log.info( "Devices discovered successfully" )
andrewonlaba57a3042015-01-23 13:53:05 -0500199
andrewonlab79244cc2015-01-26 01:11:49 -0500200 deviceIdList = []
andrewonlab92ea3672014-11-04 20:22:14 -0500201
andrewonlab79244cc2015-01-26 01:11:49 -0500202 # Obtain device id list in ONOS format.
203 # They should already be in order ( 1,2,3,10,11,12,13, etc )
204 for device in devicesJsonObj:
205 deviceIdList.append( device[ 'id' ] )
andrewonlab92ea3672014-11-04 20:22:14 -0500206
andrewonlab79244cc2015-01-26 01:11:49 -0500207 for i in range( 0, int( numIter ) ):
208 # addPointIntent( ingrDevice, egrDevice,
209 # ingrPort, egrPort )
210 main.ONOS1cli.addPointIntent(
211 deviceIdList[ 0 ] + "/2", deviceIdList[ 7 ] + "/2" )
212
213 # Allow some time for intents to propagate
214 time.sleep( 5 )
215
216 intentsStr = main.ONOS1cli.intents( jsonFormat=True )
217 intentsObj = json.loads( intentsStr )
218 for intent in intentsObj:
219 if intent[ 'state' ] == "INSTALLED":
220 main.log.info( "Intent installed successfully" )
221 intentId = intent[ 'id' ]
222 main.log.info( "Intent id: " + str( intentId ) )
andrewonlaba57a3042015-01-23 13:53:05 -0500223 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500224 # TODO: Add error handling
225 main.log.info( "Intent installation failed" )
226 intentId = ""
andrewonlab92ea3672014-11-04 20:22:14 -0500227
andrewonlab79244cc2015-01-26 01:11:49 -0500228 # Obtain metrics from ONOS 1, 2, 3
229 intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
230 intentsJsonObj1 = json.loads( intentsJsonStr1 )
231 # Parse values from the json object
232 intentSubmit1 = \
233 intentsJsonObj1[ submitTime ][ 'value' ]
234 intentInstall1 = \
235 intentsJsonObj1[ installTime ][ 'value' ]
236 intentInstallLat1 = \
237 int( intentInstall1 ) - int( intentSubmit1 )
238
239 if clusterCount == 3:
240 intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
241 intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
242 intentsJsonObj2 = json.loads( intentsJsonStr2 )
243 intentsJsonObj3 = json.loads( intentsJsonStr3 )
244 intentSubmit2 = \
245 intentsJsonObj2[ submitTime ][ 'value' ]
246 intentSubmit3 = \
247 intentsJsonObj3[ submitTime ][ 'value' ]
248 intentInstall2 = \
249 intentsJsonObj2[ installTime ][ 'value' ]
250 intentInstall3 = \
251 intentsJsonObj3[ installTime ][ 'value' ]
252 intentInstallLat2 = \
253 int( intentInstall2 ) - int( intentSubmit2 )
254 intentInstallLat3 = \
255 int( intentInstall3 ) - int( intentSubmit3 )
andrewonlaba57a3042015-01-23 13:53:05 -0500256 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500257 intentInstallLat2 = 0
258 intentInstallLat3 = 0
andrewonlaba57a3042015-01-23 13:53:05 -0500259
andrewonlab79244cc2015-01-26 01:11:49 -0500260 if clusterCount == 5:
261 intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
262 intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
263 intentsJsonObj4 = json.loads( intentsJsonStr4 )
264 intentsJsonObj5 = json.loads( intentsJsonStr5 )
265 intentSubmit4 = \
266 intentsJsonObj4[ submitTime ][ 'value' ]
267 intentSubmit5 = \
268 intentsJsonObj5[ submitTime ][ 'value' ]
269 intentInstall4 = \
270 intentsJsonObj5[ installTime ][ 'value' ]
271 intentInstall5 = \
272 intentsJsonObj5[ installTime ][ 'value' ]
273 intentInstallLat4 = \
274 int( intentInstall4 ) - int( intentSubmit4 )
275 intentInstallLat5 = \
276 int( intentInstall5 ) - int( intentSubmit5 )
andrewonlaba57a3042015-01-23 13:53:05 -0500277 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500278 intentInstallLat4 = 0
279 intentInstallLat5 = 0
andrewonlaba57a3042015-01-23 13:53:05 -0500280
andrewonlab79244cc2015-01-26 01:11:49 -0500281 if clusterCount == 7:
282 intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
283 intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
284 intentsJsonObj6 = json.loads( intentsJsonStr6 )
285 intentsJsonObj7 = json.loads( intentsJsonStr7 )
286 intentSubmit6 = \
287 intentsJsonObj6[ submitTime ][ 'value' ]
288 intentSubmit7 = \
289 intentsJsonObj6[ submitTime ][ 'value' ]
290 intentInstall6 = \
291 intentsJsonObj6[ installTime ][ 'value' ]
292 intentInstall7 = \
293 intentsJsonObj7[ installTime ][ 'value' ]
294 intentInstallLat6 = \
295 int( intentInstall6 ) - int( intentSubmit6 )
296 intentInstallLat7 = \
297 int( intentInstall7 ) - int( intentSubmit7 )
andrewonlaba57a3042015-01-23 13:53:05 -0500298 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500299 intentInstallLat6 = 0
300 intentInstallLat7 = 0
andrewonlab8790abb2014-11-06 13:51:54 -0500301
andrewonlab79244cc2015-01-26 01:11:49 -0500302 intentInstallLatAvg = \
303 ( intentInstallLat1 +
304 intentInstallLat2 +
305 intentInstallLat3 +
306 intentInstallLat4 +
307 intentInstallLat5 +
308 intentInstallLat6 +
309 intentInstallLat7 ) / clusterCount
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800310
andrewonlab79244cc2015-01-26 01:11:49 -0500311 main.log.info( "Intent add latency avg for iteration " + str( i ) +
312 ": " + str( intentInstallLatAvg ) + " ms" )
andrewonlab8790abb2014-11-06 13:51:54 -0500313
andrewonlab79244cc2015-01-26 01:11:49 -0500314 if intentInstallLatAvg > 0.0 and \
315 intentInstallLatAvg < 1000 and i > numIgnore:
316 intentAddLatList.append( intentInstallLatAvg )
andrewonlab8790abb2014-11-06 13:51:54 -0500317 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500318 main.log.info( "Intent add latency exceeded " +
319 "threshold. Skipping iteration " + str( i ) )
andrewonlab8790abb2014-11-06 13:51:54 -0500320
andrewonlab79244cc2015-01-26 01:11:49 -0500321 time.sleep( 3 )
322
323 # TODO: Only remove intents that were installed
andrewonlaba57a3042015-01-23 13:53:05 -0500324 # in this case... Otherwise many other intents
325 # may show up distorting the results
andrewonlab79244cc2015-01-26 01:11:49 -0500326 main.log.info( "Removing intents for next iteration" )
327 jsonTemp = \
328 main.ONOS1cli.intents( jsonFormat=True )
329 jsonObjIntents = json.loads( jsonTemp )
330 if jsonObjIntents:
331 for intents in jsonObjIntents:
332 tempId = intents[ 'id' ]
333 # main.ONOS1cli.removeIntent( tempId )
334 main.log.info( "Removing intent id: " +
335 str( tempId ) )
336 main.ONOS1cli.removeIntent( tempId )
andrewonlab8790abb2014-11-06 13:51:54 -0500337 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500338 main.log.info( "Intents were not installed correctly" )
andrewonlab8790abb2014-11-06 13:51:54 -0500339
andrewonlab79244cc2015-01-26 01:11:49 -0500340 time.sleep( 5 )
andrewonlab8790abb2014-11-06 13:51:54 -0500341
andrewonlab79244cc2015-01-26 01:11:49 -0500342 if intentAddLatList:
343 intentAddLatAvg = sum( intentAddLatList ) /\
344 len( intentAddLatList )
andrewonlaba57a3042015-01-23 13:53:05 -0500345 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500346 main.log.report( "Intent installation latency test failed" )
347 intentAddLatAvg = "NA"
andrewonlaba57a3042015-01-23 13:53:05 -0500348 assertion = main.FALSE
349
andrewonlab79244cc2015-01-26 01:11:49 -0500350 intentAddLatStd = \
351 round( numpy.std( intentAddLatList ), 1 )
352 # END ITERATION FOR LOOP
353 main.log.report( "Single intent add latency - " )
354 main.log.report( "Avg: " + str( intentAddLatAvg ) + " ms" )
355 main.log.report( "Std Deviation: " + str( intentAddLatStd ) + " ms" )
356
357 utilities.assert_equals(
358 expect=main.TRUE,
359 actual=assertion,
andrewonlaba57a3042015-01-23 13:53:05 -0500360 onpass="Single intent install latency test successful",
andrewonlab79244cc2015-01-26 01:11:49 -0500361 onfail="Single intent install latency test failed" )
andrewonlab92ea3672014-11-04 20:22:14 -0500362
andrewonlab79244cc2015-01-26 01:11:49 -0500363 def CASE3( self, main ):
364 """
andrewonlab4cf9dd22014-11-18 21:28:38 -0500365 Intent Reroute latency
andrewonlab79244cc2015-01-26 01:11:49 -0500366 """
andrewonlab4cf9dd22014-11-18 21:28:38 -0500367 import time
368 import json
369 import requests
370 import os
andrewonlabeb1d0542014-12-03 20:12:01 -0500371 import numpy
andrewonlab79244cc2015-01-26 01:11:49 -0500372 global clusterCount
andrewonlab4cf9dd22014-11-18 21:28:38 -0500373
andrewonlab79244cc2015-01-26 01:11:49 -0500374 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
375 ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
376 ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
377 ONOSUser = main.params[ 'CTRL' ][ 'user' ]
andrewonlabc3336d52015-02-26 18:54:56 -0500378
379 ONOSIpList = []
380 for i in range( 1, 8 ):
381 ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500382
andrewonlab79244cc2015-01-26 01:11:49 -0500383 defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
andrewonlab4cf9dd22014-11-18 21:28:38 -0500384
andrewonlab79244cc2015-01-26 01:11:49 -0500385 # number of iterations of case
386 numIter = main.params[ 'TEST' ][ 'numIter' ]
387 numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
andrewonlaba57a3042015-01-23 13:53:05 -0500388 assertion = main.TRUE
andrewonlab4cf9dd22014-11-18 21:28:38 -0500389
andrewonlab79244cc2015-01-26 01:11:49 -0500390 # Timestamp keys for json metrics output
391 submitTime = main.params[ 'JSON' ][ 'submittedTime' ]
392 installTime = main.params[ 'JSON' ][ 'installedTime' ]
393 wdRequestTime = main.params[ 'JSON' ][ 'wdRequestTime' ]
394 withdrawnTime = main.params[ 'JSON' ][ 'withdrawnTime' ]
andrewonlaba57a3042015-01-23 13:53:05 -0500395
andrewonlab79244cc2015-01-26 01:11:49 -0500396 # NOTE: May need to configure interface depending on topology
397 intfs = main.params[ 'TEST' ][ 'intfs' ]
andrewonlabc3336d52015-02-26 18:54:56 -0500398
399 # Distribute switches according to cluster count
400 for i in range( 1, 9 ):
401 if clusterCount == 1:
402 main.Mininet1.assignSwController(
403 sw=str( i ), ip1=ONOSIpList[ 0 ],
404 port1=defaultSwPort
405 )
406 elif clusterCount == 3:
407 if i < 3:
408 index = 0
409 elif i < 6 and i >= 3:
410 index = 1
411 else:
412 index = 2
413 main.Mininet1.assignSwController(
414 sw=str( i ), ip1=ONOSIpList[ index ],
415 port1=defaultSwPort
416 )
417 elif clusterCount == 5:
418 if i < 3:
419 index = 0
420 elif i < 5 and i >= 3:
421 index = 1
422 elif i < 7 and i >= 5:
423 index = 2
424 elif i == 7:
425 index = 3
426 else:
427 index = 4
428 main.Mininet1.assignSwController(
429 sw=str( i ), ip1=ONOSIpList[ index ],
430 port1=defaultSwPort
431 )
432 elif clusterCount == 7:
433 if i < 6:
434 index = i
435 else:
436 index = 6
437 main.Mininet1.assignSwController(
438 sw=str( i ), ip1=ONOSIpList[ index ],
439 port1=defaultSwPort
440 )
441
442 time.sleep(10)
andrewonlab70decc02014-11-19 18:50:23 -0500443
andrewonlab79244cc2015-01-26 01:11:49 -0500444 devicesJsonStr = main.ONOS1cli.devices()
445 devicesJsonObj = json.loads( devicesJsonStr )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500446
andrewonlab79244cc2015-01-26 01:11:49 -0500447 deviceIdList = []
andrewonlab4cf9dd22014-11-18 21:28:38 -0500448
andrewonlab79244cc2015-01-26 01:11:49 -0500449 # Obtain device id list in ONOS format.
450 # They should already be in order ( 1,2,3,10,11,12,13, etc )
451 for device in devicesJsonObj:
452 deviceIdList.append( device[ 'id' ] )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500453
andrewonlab79244cc2015-01-26 01:11:49 -0500454 intentRerouteLatList = []
andrewonlab4cf9dd22014-11-18 21:28:38 -0500455
andrewonlab79244cc2015-01-26 01:11:49 -0500456 for i in range( 0, int( numIter ) ):
457 # addPointIntent( ingrDevice, ingrPort,
458 # egrDevice, egrPort )
459 if len( deviceIdList ) > 0:
460 main.ONOS1cli.addPointIntent(
461 deviceIdList[ 0 ] + "/2", deviceIdList[ 7 ] + "/2" )
andrewonlabeb1d0542014-12-03 20:12:01 -0500462 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500463 main.log.info( "Failed to fetch devices from ONOS" )
andrewonlabeb1d0542014-12-03 20:12:01 -0500464
andrewonlab79244cc2015-01-26 01:11:49 -0500465 time.sleep( 5 )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500466
andrewonlab79244cc2015-01-26 01:11:49 -0500467 intentsStr = main.ONOS1cli.intents( jsonFormat=True )
468 intentsObj = json.loads( intentsStr )
469 for intent in intentsObj:
andrewonlabc3336d52015-02-26 18:54:56 -0500470 main.log.info(intent)
andrewonlab79244cc2015-01-26 01:11:49 -0500471 if intent[ 'state' ] == "INSTALLED":
472 main.log.info( "Intent installed successfully" )
473 intentId = intent[ 'id' ]
474 main.log.info( "Intent id: " + str( intentId ) )
andrewonlabc3336d52015-02-26 18:54:56 -0500475 #else:
476 #TODO: Add error handling
477 #main.log.info( "Intent installation failed" )
478 #intentId = ""
andrewonlab79244cc2015-01-26 01:11:49 -0500479
480 main.log.info( "Disabling interface " + intfs )
481 t0System = time.time() * 1000
andrewonlab4cf9dd22014-11-18 21:28:38 -0500482 main.Mininet1.handle.sendline(
andrewonlab79244cc2015-01-26 01:11:49 -0500483 "sh ifconfig " + intfs + " down" )
484 main.Mininet1.handle.expect( "mininet>" )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500485
andrewonlab79244cc2015-01-26 01:11:49 -0500486 # TODO: Check for correct intent reroute
487 time.sleep( 1 )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800488
andrewonlab79244cc2015-01-26 01:11:49 -0500489 # Obtain metrics from ONOS 1, 2, 3
490 intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
491 intentsJsonObj1 = json.loads( intentsJsonStr1 )
492 # Parse values from the json object
493 intentInstall1 = \
494 intentsJsonObj1[ installTime ][ 'value' ]
495 intentRerouteLat1 = \
496 int( intentInstall1 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -0500497
andrewonlab79244cc2015-01-26 01:11:49 -0500498 if clusterCount == 3:
499 intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
500 intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
501
502 intentsJsonObj2 = json.loads( intentsJsonStr2 )
503 intentsJsonObj3 = json.loads( intentsJsonStr3 )
504 intentInstall2 = \
505 intentsJsonObj2[ installTime ][ 'value' ]
506 intentInstall3 = \
507 intentsJsonObj3[ installTime ][ 'value' ]
508 intentRerouteLat2 = \
509 int( intentInstall2 ) - int( t0System )
510 intentRerouteLat3 = \
511 int( intentInstall3 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -0500512 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500513 intentRerouteLat2 = 0
514 intentRerouteLat3 = 0
andrewonlaba57a3042015-01-23 13:53:05 -0500515
andrewonlab79244cc2015-01-26 01:11:49 -0500516 if clusterCount == 5:
517 intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
518 intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
andrewonlaba57a3042015-01-23 13:53:05 -0500519
andrewonlab79244cc2015-01-26 01:11:49 -0500520 intentsJsonObj4 = json.loads( intentsJsonStr4 )
521 intentsJsonObj5 = json.loads( intentsJsonStr5 )
522 intentInstall4 = \
523 intentsJsonObj4[ installTime ][ 'value' ]
524 intentInstall5 = \
525 intentsJsonObj5[ installTime ][ 'value' ]
526 intentRerouteLat4 = \
527 int( intentInstall4 ) - int( t0System )
528 intentRerouteLat5 = \
529 int( intentInstall5 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -0500530 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500531 intentRerouteLat4 = 0
532 intentRerouteLat5 = 0
andrewonlaba57a3042015-01-23 13:53:05 -0500533
andrewonlab79244cc2015-01-26 01:11:49 -0500534 if clusterCount == 7:
535 intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
536 intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
andrewonlaba57a3042015-01-23 13:53:05 -0500537
andrewonlab79244cc2015-01-26 01:11:49 -0500538 intentsJsonObj6 = json.loads( intentsJsonStr6 )
539 intentsJsonObj7 = json.loads( intentsJsonStr7 )
540 intentInstall6 = \
541 intentsJsonObj6[ installTime ][ 'value' ]
542 intentInstall7 = \
543 intentsJsonObj7[ installTime ][ 'value' ]
544 intentRerouteLat6 = \
545 int( intentInstall6 ) - int( t0System )
546 intentRerouteLat7 = \
547 int( intentInstall7 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -0500548 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500549 intentRerouteLat6 = 0
550 intentRerouteLat7 = 0
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800551
andrewonlab79244cc2015-01-26 01:11:49 -0500552 intentRerouteLatAvg = \
553 ( intentRerouteLat1 +
554 intentRerouteLat2 +
555 intentRerouteLat3 +
556 intentRerouteLat4 +
557 intentRerouteLat5 +
558 intentRerouteLat6 +
559 intentRerouteLat7 ) / clusterCount
andrewonlab4cf9dd22014-11-18 21:28:38 -0500560
andrewonlab79244cc2015-01-26 01:11:49 -0500561 main.log.info( "Intent reroute latency avg for iteration " +
andrewonlabc3336d52015-02-26 18:54:56 -0500562 str( i ) + ": " + str( intentRerouteLatAvg )+ " ms")
andrewonlab79244cc2015-01-26 01:11:49 -0500563
564 if intentRerouteLatAvg > 0.0 and \
565 intentRerouteLatAvg < 1000 and i > numIgnore:
566 intentRerouteLatList.append( intentRerouteLatAvg )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500567 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500568 main.log.info( "Intent reroute latency exceeded " +
569 "threshold. Skipping iteration " + str( i ) )
andrewonlab4cf9dd22014-11-18 21:28:38 -0500570
andrewonlab79244cc2015-01-26 01:11:49 -0500571 main.log.info( "Removing intents for next iteration" )
572 main.ONOS1cli.removeIntent( intentId )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800573
andrewonlab79244cc2015-01-26 01:11:49 -0500574 main.log.info( "Bringing Mininet interface up for next " +
575 "iteration" )
andrewonlabeb1d0542014-12-03 20:12:01 -0500576 main.Mininet1.handle.sendline(
andrewonlab79244cc2015-01-26 01:11:49 -0500577 "sh ifconfig " + intfs + " up" )
578 main.Mininet1.handle.expect( "mininet>" )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800579
andrewonlab79244cc2015-01-26 01:11:49 -0500580 if intentRerouteLatList:
581 intentRerouteLatAvg = sum( intentRerouteLatList ) /\
582 len( intentRerouteLatList )
andrewonlaba57a3042015-01-23 13:53:05 -0500583 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500584 main.log.report( "Intent reroute test failed. Results NA" )
585 intentRerouteLatAvg = "NA"
586 # NOTE: fails test when list is empty
andrewonlaba57a3042015-01-23 13:53:05 -0500587 assertion = main.FALSE
andrewonlab79244cc2015-01-26 01:11:49 -0500588
589 intentRerouteLatStd = \
590 round( numpy.std( intentRerouteLatList ), 1 )
591 # END ITERATION FOR LOOP
592 main.log.report( "Single intent reroute latency - " )
593 main.log.report( "Avg: " + str( intentRerouteLatAvg ) + " ms" )
594 main.log.report(
595 "Std Deviation: " +
596 str( intentRerouteLatStd ) +
597 " ms" )
598
599 utilities.assert_equals(
600 expect=main.TRUE,
601 actual=assertion,
andrewonlaba57a3042015-01-23 13:53:05 -0500602 onpass="Single intent reroute latency test successful",
andrewonlab79244cc2015-01-26 01:11:49 -0500603 onfail="Single intent reroute latency test failed" )
604
605 def CASE4( self, main ):
606 """
andrewonlab042b3912014-12-10 16:40:50 -0500607 Batch intent install
andrewonlab082dfc32015-02-06 13:59:51 -0500608
609 Supports scale-out scenarios and increasing
610 number of intents within each iteration
andrewonlab79244cc2015-01-26 01:11:49 -0500611 """
andrewonlab70decc02014-11-19 18:50:23 -0500612 import time
613 import json
614 import requests
615 import os
andrewonlabeb1d0542014-12-03 20:12:01 -0500616 import numpy
andrewonlab79244cc2015-01-26 01:11:49 -0500617 global clusterCount
andrewonlab302cd532015-02-20 13:59:50 -0500618 global timeToPost
andrewonlab70decc02014-11-19 18:50:23 -0500619
andrewonlab79244cc2015-01-26 01:11:49 -0500620 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
621 ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
622 ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
623 ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
624 ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
625 ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
626 ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
andrewonlaba57a3042015-01-23 13:53:05 -0500627
628 assertion = main.TRUE
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800629
andrewonlab79244cc2015-01-26 01:11:49 -0500630 ONOSIpList = []
631 for i in range( 1, 8 ):
632 ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
andrewonlab4293dcb2014-12-02 15:48:05 -0500633
andrewonlab79244cc2015-01-26 01:11:49 -0500634 ONOSUser = main.params[ 'CTRL' ][ 'user' ]
andrewonlab70decc02014-11-19 18:50:23 -0500635
andrewonlab79244cc2015-01-26 01:11:49 -0500636 defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
andrewonlab70decc02014-11-19 18:50:23 -0500637
andrewonlab79244cc2015-01-26 01:11:49 -0500638 batchIntentSize = int( main.params[ 'TEST' ][ 'batchIntentSize' ] )
639 batchThreshMin = int( main.params[ 'TEST' ][ 'batchThresholdMin' ] )
640 batchThreshMax = int( main.params[ 'TEST' ][ 'batchThresholdMax' ] )
andrewonlab4293dcb2014-12-02 15:48:05 -0500641
andrewonlab79244cc2015-01-26 01:11:49 -0500642 # number of iterations of case
643 numIter = main.params[ 'TEST' ][ 'numIter' ]
644 numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
645 numSwitch = int( main.params[ 'TEST' ][ 'numSwitch' ] )
646 nThread = main.params[ 'TEST' ][ 'numMult' ]
647 #nThread = 105
648
andrewonlabe07f8562015-02-20 12:23:07 -0500649 # DB operation variables
andrewonlab302cd532015-02-20 13:59:50 -0500650 intentFilePath = main.params[ 'DB' ][ 'intentFilePath' ]
andrewonlabe07f8562015-02-20 12:23:07 -0500651
andrewonlab79244cc2015-01-26 01:11:49 -0500652 # Switch assignment NOTE: hardcoded
653 if clusterCount == 1:
654 for i in range( 1, numSwitch + 1 ):
655 main.Mininet1.assignSwController(
656 sw=str( i ),
657 ip1=ONOS1Ip,
658 port1=defaultSwPort )
659 if clusterCount == 3:
660 for i in range( 1, 3 ):
661 main.Mininet1.assignSwController(
662 sw=str( i ),
663 ip1=ONOS1Ip,
664 port1=defaultSwPort )
665 for i in range( 3, 6 ):
666 main.Mininet1.assignSwController(
667 sw=str( i ),
668 ip1=ONOS2Ip,
669 port1=defaultSwPort )
670 for i in range( 6, 9 ):
671 main.Mininet1.assignSwController(
672 sw=str( i ),
673 ip1=ONOS3Ip,
674 port1=defaultSwPort )
675 if clusterCount == 5:
676 main.Mininet1.assignSwController(
677 sw="1",
678 ip1=ONOS1Ip,
679 port1=defaultSwPort )
680 main.Mininet1.assignSwController(
681 sw="2",
682 ip1=ONOS2Ip,
683 port1=defaultSwPort )
684 for i in range( 3, 6 ):
685 main.Mininet1.assignSwController(
686 sw=str( i ),
687 ip1=ONOS3Ip,
688 port1=defaultSwPort )
689 main.Mininet1.assignSwController(
690 sw="6",
691 ip1=ONOS4Ip,
692 port1=defaultSwPort )
693 main.Mininet1.assignSwController(
694 sw="7",
695 ip1=ONOS5Ip,
696 port1=defaultSwPort )
697 main.Mininet1.assignSwController(
698 sw="8",
699 ip1=ONOS5Ip,
700 port1=defaultSwPort )
701
702 if clusterCount == 7:
703 for i in range( 1, 9 ):
andrewonlabeb1d0542014-12-03 20:12:01 -0500704 if i < 8:
andrewonlab79244cc2015-01-26 01:11:49 -0500705 main.Mininet1.assignSwController(
706 sw=str( i ),
707 ip1=ONOSIpList[ i - 1 ],
708 port1=defaultSwPort )
709 elif i >= 8:
710 main.Mininet1.assignSwController(
711 sw=str( i ),
712 ip1=ONOSIpList[ 6 ],
713 port1=defaultSwPort )
andrewonlab70decc02014-11-19 18:50:23 -0500714
andrewonlab79244cc2015-01-26 01:11:49 -0500715 time.sleep( 20 )
andrewonlabeb1d0542014-12-03 20:12:01 -0500716
andrewonlab79244cc2015-01-26 01:11:49 -0500717 main.log.report( "Batch intent installation test of " +
718 str( batchIntentSize ) + " intent(s)" )
andrewonlab4293dcb2014-12-02 15:48:05 -0500719
andrewonlab79244cc2015-01-26 01:11:49 -0500720 batchResultList = []
andrewonlab70decc02014-11-19 18:50:23 -0500721
andrewonlab79244cc2015-01-26 01:11:49 -0500722 main.log.info( "Getting list of available devices" )
723 deviceIdList = []
724 jsonStr = main.ONOS1cli.devices()
725 jsonObj = json.loads( jsonStr )
726 for device in jsonObj:
727 deviceIdList.append( device[ 'id' ] )
andrewonlab70decc02014-11-19 18:50:23 -0500728
andrewonlab302cd532015-02-20 13:59:50 -0500729 # List of install / witdhraw latencies for each batch
andrewonlab79244cc2015-01-26 01:11:49 -0500730 batchInstallLat = []
731 batchWithdrawLat = []
andrewonlab70decc02014-11-19 18:50:23 -0500732
andrewonlab79244cc2015-01-26 01:11:49 -0500733 sleepTime = 10
734
735 baseDir = "/tmp/"
736
andrewonlabe07f8562015-02-20 12:23:07 -0500737 # Batch size increase loop
andrewonlab79244cc2015-01-26 01:11:49 -0500738 for batch in range( 0, 5 ):
andrewonlabe07f8562015-02-20 12:23:07 -0500739 # Max intent install measurement of all nodes
740 # Resets after each batch calculation
741 maxInstallLat = []
742 maxWithdrawLat = []
andrewonlabc3336d52015-02-26 18:54:56 -0500743 # Max single intent install measurement of all nodes
744 # For example, if batch size is 1000, result latency
745 # will be divided by 1000
746 maxSingleInstallLat = []
747 maxSingleWithdrawLat = []
andrewonlabe07f8562015-02-20 12:23:07 -0500748 # Statistical gathering loop over number of iterations
andrewonlab79244cc2015-01-26 01:11:49 -0500749 for i in range( 0, int( numIter ) ):
750 main.log.info( "Pushing " +
751 str( int( batchIntentSize ) * int( nThread ) ) +
752 " intents. Iteration " + str( i ) )
753
754 for node in range( 1, clusterCount + 1 ):
755 saveDir = baseDir + "batch_intent_" + str( node ) + ".txt"
756 main.ONOSbench.pushTestIntentsShell(
757 deviceIdList[ 0 ] + "/2",
758 deviceIdList[ 7 ] + "/2",
759 batchIntentSize,
760 saveDir, ONOSIpList[ node - 1 ],
andrewonlabc3336d52015-02-26 18:54:56 -0500761 numMult=nThread )
andrewonlab79244cc2015-01-26 01:11:49 -0500762
763 # Wait sufficient time for intents to start
764 # installing
765 time.sleep( sleepTime )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800766
andrewonlaba57a3042015-01-23 13:53:05 -0500767 intent = ""
768 counter = 300
andrewonlab79244cc2015-01-26 01:11:49 -0500769 while len( intent ) > 0 and counter > 0:
andrewonlaba57a3042015-01-23 13:53:05 -0500770 main.ONOS1cli.handle.sendline(
andrewonlab79244cc2015-01-26 01:11:49 -0500771 "intents | wc -l" )
andrewonlaba57a3042015-01-23 13:53:05 -0500772 main.ONOS1cli.handle.expect(
andrewonlab79244cc2015-01-26 01:11:49 -0500773 "intents | wc -l" )
andrewonlaba57a3042015-01-23 13:53:05 -0500774 main.ONOS1cli.handle.expect(
andrewonlab79244cc2015-01-26 01:11:49 -0500775 "onos>" )
776 intentTemp = main.ONOS1cli.handle.before()
andrewonlaba57a3042015-01-23 13:53:05 -0500777 intent = main.ONOS1cli.intents()
andrewonlab79244cc2015-01-26 01:11:49 -0500778 intent = json.loads( intent )
779 counter = counter - 1
780 time.sleep( 1 )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800781
andrewonlab79244cc2015-01-26 01:11:49 -0500782 time.sleep( 5 )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800783
andrewonlab79244cc2015-01-26 01:11:49 -0500784 for node in range( 1, clusterCount + 1 ):
785 saveDir = baseDir + "batch_intent_" + str( node ) + ".txt"
786 with open( saveDir ) as fOnos:
787 lineCount = 0
788 for line in fOnos:
andrewonlabc3336d52015-02-26 18:54:56 -0500789 line_temp = ""
andrewonlab79244cc2015-01-26 01:11:49 -0500790 main.log.info( "Line read: " + str( line ) )
andrewonlabc3336d52015-02-26 18:54:56 -0500791 line_temp = line[ 1: ]
792 line_temp = line_temp.split( ": " )
andrewonlabd019a6b2015-02-05 00:05:22 -0500793 #Prevent split method if line doesn't have
794 #space
andrewonlabc3336d52015-02-26 18:54:56 -0500795 if " " in str(line_temp):
796 result = line_temp[ 1 ].split( " " )[ 0 ]
andrewonlabd019a6b2015-02-05 00:05:22 -0500797 else:
798 main.log.warn( "Empty line read" )
799 result = 0
andrewonlab79244cc2015-01-26 01:11:49 -0500800 # TODO: add parameters before appending latency
801 if lineCount == 0:
andrewonlabc3336d52015-02-26 18:54:56 -0500802 if "Failure" in str(line):
803 main.log.warn("Intent installation failed")
804 result = 'NA'
805 else:
806 main.log.info("Install result: "+result)
807 batchInstallLat.append( int( result ) )
andrewonlab79244cc2015-01-26 01:11:49 -0500808 installResult = result
809 elif lineCount == 1:
andrewonlabc3336d52015-02-26 18:54:56 -0500810 if "Failure" in str(line):
811 main.log.warn("Intent withdraw failed")
812 result = 'NA'
813 else:
814 main.log.info("Withdraw result: "+result)
815 batchWithdrawLat.append( int( result ) )
andrewonlab79244cc2015-01-26 01:11:49 -0500816 withdrawResult = result
andrewonlabd019a6b2015-02-05 00:05:22 -0500817 else:
andrewonlabc3336d52015-02-26 18:54:56 -0500818 main.log.warn("Invalid results: excess lines")
andrewonlabd019a6b2015-02-05 00:05:22 -0500819 installResult = 'NA'
820 withdrawResult = 'NA'
andrewonlab79244cc2015-01-26 01:11:49 -0500821 lineCount += 1
822 main.log.info( "Batch install latency for ONOS" +
823 str( node ) + " with " +
824 str( batchIntentSize ) + "intents: " +
825 str( installResult ) + " ms" )
826 main.log.info( "Batch withdraw latency for ONOS" +
827 str( node ) + " with " +
828 str( batchIntentSize ) + "intents: " +
829 str( withdrawResult ) + " ms" )
andrewonlabeb1d0542014-12-03 20:12:01 -0500830
andrewonlabc3336d52015-02-26 18:54:56 -0500831 main.log.info( "Single intent install latency ONOS" +
832 str( node ) + " with " +
833 str( batchIntentSize ) + "intents: " +
834 str( float(installResult) /\
835 int(batchIntentSize) ) + " ms" )
836 main.log.info( "Single intent withdraw latency ONOS" +
837 str( node ) + " with " +
838 str( batchIntentSize ) + "intents: " +
839 str( float(withdrawResult) /\
840 int(batchIntentSize) ) + " ms" )
841
andrewonlab302cd532015-02-20 13:59:50 -0500842 #NOTE: END node loop
843
andrewonlab79244cc2015-01-26 01:11:49 -0500844 if len( batchInstallLat ) > 0 and int( i ) > numIgnore:
845 maxInstallLat.append( max( batchInstallLat ) )
andrewonlabc3336d52015-02-26 18:54:56 -0500846 maxSingleInstallLat.append(
847 max( batchInstallLat ) / int( batchIntentSize )
848 )
andrewonlab79244cc2015-01-26 01:11:49 -0500849 elif len( batchInstallLat ) == 0:
850 # If I failed to read anything from the file,
851 # increase the wait time before checking intents
852 sleepTime += 30
853 if len( batchWithdrawLat ) > 0 and int( i ) > numIgnore:
854 maxWithdrawLat.append( max( batchWithdrawLat ) )
andrewonlabc3336d52015-02-26 18:54:56 -0500855 maxSingleWithdrawLat.append(
856 max( batchWithdrawLat ) / int( batchIntentSize )
857 )
andrewonlab79244cc2015-01-26 01:11:49 -0500858 batchInstallLat = []
859 batchWithdrawLat = []
860
861 # Sleep in between iterations
862 time.sleep( 5 )
863
andrewonlab302cd532015-02-20 13:59:50 -0500864 #NOTE: END iteration loop
865
andrewonlab79244cc2015-01-26 01:11:49 -0500866 if maxInstallLat:
andrewonlabc3336d52015-02-26 18:54:56 -0500867 avgInstallLat = str( round( numpy.average(maxInstallLat)
andrewonlabd019a6b2015-02-05 00:05:22 -0500868 , 2 ))
andrewonlab302cd532015-02-20 13:59:50 -0500869 stdInstallLat = str( round(
870 numpy.std(maxInstallLat), 2))
andrewonlabc3336d52015-02-26 18:54:56 -0500871 avgSingleInstallLat = str( round(
872 numpy.average(maxSingleInstallLat)
873 , 3 ))
874 stdSingleInstallLat = str( round(
875 numpy.std(maxSingleInstallLat),
876 3 ))
andrewonlaba57a3042015-01-23 13:53:05 -0500877 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500878 avgInstallLat = "NA"
andrewonlab302cd532015-02-20 13:59:50 -0500879 stdInstallLat = "NA"
andrewonlab79244cc2015-01-26 01:11:49 -0500880 main.log.report( "Batch installation failed" )
andrewonlaba57a3042015-01-23 13:53:05 -0500881 assertion = main.FALSE
andrewonlabeb1d0542014-12-03 20:12:01 -0500882
andrewonlab79244cc2015-01-26 01:11:49 -0500883 if maxWithdrawLat:
andrewonlabc3336d52015-02-26 18:54:56 -0500884 avgWithdrawLat = str( round( numpy.average(maxWithdrawLat)
andrewonlabd019a6b2015-02-05 00:05:22 -0500885 , 2 ))
andrewonlab302cd532015-02-20 13:59:50 -0500886 stdWithdrawLat = str( round(
887 numpy.std(maxWithdrawLat), 2))
andrewonlabc3336d52015-02-26 18:54:56 -0500888 avgSingleWithdrawLat = str( round(
889 numpy.average(maxSingleWithdrawLat)
890 , 3 ))
891 stdSingleWithdrawLat = str( round(
892 numpy.std(maxSingleWithdrawLat),
893 3 ))
andrewonlaba57a3042015-01-23 13:53:05 -0500894 else:
andrewonlab79244cc2015-01-26 01:11:49 -0500895 avgWithdrawLat = "NA"
andrewonlab302cd532015-02-20 13:59:50 -0500896 stdWithdrawLat = "NA"
andrewonlab79244cc2015-01-26 01:11:49 -0500897 main.log.report( "Batch withdraw failed" )
andrewonlaba57a3042015-01-23 13:53:05 -0500898 assertion = main.FALSE
andrewonlabeb1d0542014-12-03 20:12:01 -0500899
andrewonlab79244cc2015-01-26 01:11:49 -0500900 main.log.report( "Avg of batch installation latency " +
901 "of size " + str( batchIntentSize ) + ": " +
902 str( avgInstallLat ) + " ms" )
903 main.log.report( "Std Deviation of batch installation latency " +
andrewonlabd019a6b2015-02-05 00:05:22 -0500904 ": " +
andrewonlab302cd532015-02-20 13:59:50 -0500905 str( stdInstallLat ) + " ms" )
andrewonlabc3336d52015-02-26 18:54:56 -0500906 main.log.report( "Avg of single installation latency " +
907 "of size " + str( batchIntentSize ) + ": " +
908 str( avgSingleInstallLat ) + " ms" )
909 main.log.report( "Std Deviation of single installation latency " +
910 ": " +
911 str( stdSingleInstallLat ) + " ms" )
andrewonlabeb1d0542014-12-03 20:12:01 -0500912
andrewonlab79244cc2015-01-26 01:11:49 -0500913 main.log.report( "Avg of batch withdraw latency " +
914 "of size " + str( batchIntentSize ) + ": " +
915 str( avgWithdrawLat ) + " ms" )
916 main.log.report( "Std Deviation of batch withdraw latency " +
917 ": " +
andrewonlab302cd532015-02-20 13:59:50 -0500918 str( stdWithdrawLat ) + " ms" )
andrewonlabc3336d52015-02-26 18:54:56 -0500919 main.log.report( "Avg of single withdraw latency " +
920 "of size " + str( batchIntentSize ) + ": " +
921 str( avgSingleWithdrawLat ) + " ms" )
922 main.log.report( "Std Deviation of single withdraw latency " +
923 ": " +
924 str( stdSingleWithdrawLat ) + " ms" )
andrewonlab302cd532015-02-20 13:59:50 -0500925
926 dbCmd = (
andrewonlabc3336d52015-02-26 18:54:56 -0500927 "INSERT INTO intents_latency_tests VALUES("
928 "'"+timeToPost+"','intents_latency_results',"
andrewonlab302cd532015-02-20 13:59:50 -0500929 ""+runNum+","+str(clusterCount)+","+str(batchIntentSize)+","
930 ""+str(avgInstallLat)+","+str(stdInstallLat)+","
931 ""+str(avgWithdrawLat)+","+str(stdWithdrawLat)+");"
932 )
933
934 # Write result to file (which is posted to DB by jenkins)
935 fResult = open(intentFilePath, 'a')
936 if dbCmd:
937 fResult.write(dbCmd+"\n")
938 fResult.close()
andrewonlab79244cc2015-01-26 01:11:49 -0500939
andrewonlabd019a6b2015-02-05 00:05:22 -0500940 if batch == 0:
941 batchIntentSize = 10
942 elif batch == 1:
943 batchIntentSize = 100
944 elif batch == 2:
945 batchIntentSize = 1000
946 elif batch == 3:
947 batchIntentSize = 2000
948 if batch < 4:
949 main.log.report( "Increasing batch intent size to " +
andrewonlab79244cc2015-01-26 01:11:49 -0500950 str(batchIntentSize) )
951
andrewonlab302cd532015-02-20 13:59:50 -0500952 #NOTE: END batch loop
953
andrewonlab79244cc2015-01-26 01:11:49 -0500954 #main.log.info( "Removing all intents for next test case" )
955 #jsonTemp = main.ONOS1cli.intents( jsonFormat=True )
956 #jsonObjIntents = json.loads( jsonTemp )
957 # if jsonObjIntents:
958 # for intents in jsonObjIntents:
959 # tempId = intents[ 'id' ]
960 # main.ONOS1cli.removeIntent( tempId )
961 # main.ONOS1cli.removeIntent( tempId )
962
963 utilities.assert_equals(
964 expect=main.TRUE,
965 actual=assertion,
andrewonlaba57a3042015-01-23 13:53:05 -0500966 onpass="Batch intent install/withdraw test successful",
andrewonlab79244cc2015-01-26 01:11:49 -0500967 onfail="Batch intent install/withdraw test failed" )
kelvin-onlabeaa2eb32015-01-16 15:58:18 -0800968
andrewonlab79244cc2015-01-26 01:11:49 -0500969 def CASE5( self, main ):
970 """
andrewonlab4293dcb2014-12-02 15:48:05 -0500971 Increase number of nodes and initiate CLI
andrewonlab79244cc2015-01-26 01:11:49 -0500972 """
andrewonlab4293dcb2014-12-02 15:48:05 -0500973 import time
974 import json
975
andrewonlab79244cc2015-01-26 01:11:49 -0500976 ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ]
977 ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ]
978 ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ]
979 ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ]
980 ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ]
981 ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ]
982 ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ]
andrewonlab4293dcb2014-12-02 15:48:05 -0500983
andrewonlab79244cc2015-01-26 01:11:49 -0500984 global clusterCount
985 clusterCount += 2
986 main.log.report( "Increasing cluster size to " +
987 str( clusterCount ) )
andrewonlab4293dcb2014-12-02 15:48:05 -0500988
andrewonlab79244cc2015-01-26 01:11:49 -0500989 installResult = main.FALSE
andrewonlab4293dcb2014-12-02 15:48:05 -0500990
andrewonlab79244cc2015-01-26 01:11:49 -0500991 if clusterCount == 3:
992 installResult1 = \
993 main.ONOSbench.onosInstall( node=ONOS2Ip )
994 installResult2 = \
995 main.ONOSbench.onosInstall( node=ONOS3Ip )
996 time.sleep( 5 )
andrewonlab4293dcb2014-12-02 15:48:05 -0500997
andrewonlab79244cc2015-01-26 01:11:49 -0500998 main.log.info( "Starting ONOS CLI" )
999 main.ONOS2cli.startOnosCli( ONOS2Ip )
1000 main.ONOS3cli.startOnosCli( ONOS3Ip )
andrewonlab4293dcb2014-12-02 15:48:05 -05001001
andrewonlab79244cc2015-01-26 01:11:49 -05001002 installResult = installResult1 and installResult2
andrewonlab4293dcb2014-12-02 15:48:05 -05001003
andrewonlab79244cc2015-01-26 01:11:49 -05001004 if clusterCount == 5:
1005 main.log.info( "Installing ONOS on node 4 and 5" )
1006 installResult1 = \
1007 main.ONOSbench.onosInstall( node=ONOS4Ip )
1008 installResult2 = \
1009 main.ONOSbench.onosInstall( node=ONOS5Ip )
andrewonlab4293dcb2014-12-02 15:48:05 -05001010
andrewonlab79244cc2015-01-26 01:11:49 -05001011 main.log.info( "Starting ONOS CLI" )
1012 main.ONOS4cli.startOnosCli( ONOS4Ip )
1013 main.ONOS5cli.startOnosCli( ONOS5Ip )
andrewonlab4293dcb2014-12-02 15:48:05 -05001014
andrewonlab79244cc2015-01-26 01:11:49 -05001015 installResult = installResult1 and installResult2
andrewonlab4293dcb2014-12-02 15:48:05 -05001016
andrewonlab79244cc2015-01-26 01:11:49 -05001017 if clusterCount == 7:
1018 main.log.info( "Installing ONOS on node 6 and 7" )
1019 installResult1 = \
1020 main.ONOSbench.onosInstall( node=ONOS6Ip )
1021 installResult2 = \
1022 main.ONOSbench.onosInstall( node=ONOS7Ip )
andrewonlab4293dcb2014-12-02 15:48:05 -05001023
andrewonlab79244cc2015-01-26 01:11:49 -05001024 main.log.info( "Starting ONOS CLI" )
1025 main.ONOS6cli.startOnosCli( ONOS6Ip )
1026 main.ONOS7cli.startOnosCli( ONOS7Ip )
andrewonlab4293dcb2014-12-02 15:48:05 -05001027
andrewonlab79244cc2015-01-26 01:11:49 -05001028 installResult = installResult1 and installResult2
andrewonlab4293dcb2014-12-02 15:48:05 -05001029
andrewonlab79244cc2015-01-26 01:11:49 -05001030 time.sleep( 5 )
andrewonlab4293dcb2014-12-02 15:48:05 -05001031
andrewonlab79244cc2015-01-26 01:11:49 -05001032 if installResult == main.TRUE:
andrewonlab4293dcb2014-12-02 15:48:05 -05001033 assertion = main.TRUE
1034 else:
1035 assertion = main.FALSE
1036
andrewonlab79244cc2015-01-26 01:11:49 -05001037 utilities.assert_equals( expect=main.TRUE, actual=assertion,
1038 onpass="Scale out to " + str( clusterCount ) +
1039 " nodes successful",
1040 onfail="Scale out to " + str( clusterCount ) +
1041 " nodes failed" )
andrewonlab4293dcb2014-12-02 15:48:05 -05001042
andrewonlab79244cc2015-01-26 01:11:49 -05001043 def CASE7( self, main ):
1044 # TODO: Fix for scale-out scenario
1045 """
andrewonlaba57a3042015-01-23 13:53:05 -05001046 Batch intent reroute latency
andrewonlab79244cc2015-01-26 01:11:49 -05001047 """
andrewonlaba57a3042015-01-23 13:53:05 -05001048 import time
1049 import json
1050 import requests
1051 import os
1052 import numpy
andrewonlab79244cc2015-01-26 01:11:49 -05001053 global clusterCount
andrewonlaba57a3042015-01-23 13:53:05 -05001054
andrewonlab79244cc2015-01-26 01:11:49 -05001055 ONOSIpList = []
1056 for i in range( 1, 8 ):
1057 ONOSIpList.append( main.params[ 'CTRL' ][ 'ip' + str( i ) ] )
andrewonlaba57a3042015-01-23 13:53:05 -05001058
andrewonlab79244cc2015-01-26 01:11:49 -05001059 ONOSUser = main.params[ 'CTRL' ][ 'user' ]
1060 defaultSwPort = main.params[ 'CTRL' ][ 'port1' ]
andrewonlaba57a3042015-01-23 13:53:05 -05001061
andrewonlab79244cc2015-01-26 01:11:49 -05001062 batchIntentSize = main.params[ 'TEST' ][ 'batchIntentSize' ]
1063 batchThreshMin = int( main.params[ 'TEST' ][ 'batchThresholdMin' ] )
1064 batchThreshMax = int( main.params[ 'TEST' ][ 'batchThresholdMax' ] )
1065 intfs = main.params[ 'TEST' ][ 'intfs' ]
1066 installTime = main.params[ 'JSON' ][ 'installedTime' ]
andrewonlaba57a3042015-01-23 13:53:05 -05001067
andrewonlab79244cc2015-01-26 01:11:49 -05001068 # number of iterations of case
1069 numIter = main.params[ 'TEST' ][ 'numIter' ]
1070 numIgnore = int( main.params[ 'TEST' ][ 'numIgnore' ] )
1071 numSwitch = int( main.params[ 'TEST' ][ 'numSwitch' ] )
1072 nThread = main.params[ 'TEST' ][ 'numMult' ]
andrewonlaba57a3042015-01-23 13:53:05 -05001073
andrewonlab79244cc2015-01-26 01:11:49 -05001074 main.log.report( "Batch intent installation test of " +
1075 batchIntentSize + " intents" )
andrewonlaba57a3042015-01-23 13:53:05 -05001076
andrewonlab79244cc2015-01-26 01:11:49 -05001077 batchResultList = []
andrewonlaba57a3042015-01-23 13:53:05 -05001078
andrewonlab79244cc2015-01-26 01:11:49 -05001079 time.sleep( 10 )
andrewonlaba57a3042015-01-23 13:53:05 -05001080
andrewonlab79244cc2015-01-26 01:11:49 -05001081 main.log.info( "Getting list of available devices" )
1082 deviceIdList = []
1083 jsonStr = main.ONOS1cli.devices()
1084 jsonObj = json.loads( jsonStr )
1085 for device in jsonObj:
1086 deviceIdList.append( device[ 'id' ] )
andrewonlaba57a3042015-01-23 13:53:05 -05001087
andrewonlab79244cc2015-01-26 01:11:49 -05001088 batchInstallLat = []
1089 batchWithdrawLat = []
1090 sleepTime = 10
andrewonlaba57a3042015-01-23 13:53:05 -05001091
andrewonlab79244cc2015-01-26 01:11:49 -05001092 baseDir = "/tmp/"
1093 maxInstallLat = []
1094
1095 for i in range( 0, int( numIter ) ):
1096 main.log.info( "Pushing " +
1097 str( int( batchIntentSize ) * int( nThread ) ) +
1098 " intents. Iteration " + str( i ) )
1099
1100 main.ONOSbench.pushTestIntentsShell(
1101 deviceIdList[ 0 ] + "/2",
1102 deviceIdList[ 7 ] + "/2",
1103 batchIntentSize, "/tmp/batch_install.txt",
1104 ONOSIpList[ 0 ], numMult="1", appId="1",
1105 report=False, options="--install" )
1106 # main.ONOSbench.pushTestIntentsShell(
andrewonlaba57a3042015-01-23 13:53:05 -05001107 # "of:0000000000001002/1",
1108 # "of:0000000000002002/1",
1109 # 133, "/tmp/temp2.txt", "10.128.174.2",
andrewonlab79244cc2015-01-26 01:11:49 -05001110 # numMult="6", appId="2",report=False )
1111
1112 # TODO: Check for installation success then proceed
1113 time.sleep( 30 )
1114
1115 # NOTE: this interface is specific to
andrewonlaba57a3042015-01-23 13:53:05 -05001116 # topo-intentFlower.py topology
1117 # reroute case.
andrewonlab79244cc2015-01-26 01:11:49 -05001118 main.log.info( "Disabling interface " + intfs )
andrewonlaba57a3042015-01-23 13:53:05 -05001119 main.Mininet1.handle.sendline(
andrewonlab79244cc2015-01-26 01:11:49 -05001120 "sh ifconfig " + intfs + " down" )
1121 t0System = time.time() * 1000
andrewonlaba57a3042015-01-23 13:53:05 -05001122
andrewonlab79244cc2015-01-26 01:11:49 -05001123 # TODO: Wait sufficient time for intents to install
1124 time.sleep( 10 )
andrewonlaba57a3042015-01-23 13:53:05 -05001125
andrewonlab79244cc2015-01-26 01:11:49 -05001126 # TODO: get intent installation time
1127
1128 # Obtain metrics from ONOS 1, 2, 3
1129 intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
1130 intentsJsonObj1 = json.loads( intentsJsonStr1 )
1131 # Parse values from the json object
1132 intentInstall1 = \
1133 intentsJsonObj1[ installTime ][ 'value' ]
1134 intentRerouteLat1 = \
1135 int( intentInstall1 ) - int( t0System )
1136
1137 if clusterCount == 3:
1138 intentsJsonStr2 =\
1139 main.ONOS2cli.intentsEventsMetrics()
1140 intentsJsonStr3 =\
1141 main.ONOS3cli.intentsEventsMetrics()
1142 intentsJsonObj2 = json.loads( intentsJsonStr2 )
1143 intentsJsonObj3 = json.loads( intentsJsonStr3 )
1144 intentInstall2 = \
1145 intentsJsonObj2[ installTime ][ 'value' ]
1146 intentInstall3 = \
1147 intentsJsonObj3[ installTime ][ 'value' ]
1148 intentRerouteLat2 = \
1149 int( intentInstall2 ) - int( t0System )
1150 intentRerouteLat3 = \
1151 int( intentInstall3 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -05001152 else:
andrewonlab79244cc2015-01-26 01:11:49 -05001153 intentRerouteLat2 = 0
1154 intentRerouteLat3 = 0
andrewonlaba57a3042015-01-23 13:53:05 -05001155
andrewonlab79244cc2015-01-26 01:11:49 -05001156 if clusterCount == 5:
1157 intentsJsonStr4 =\
1158 main.ONOS4cli.intentsEventsMetrics()
1159 intentsJsonStr5 =\
1160 main.ONOS5cli.intentsEventsMetrics()
1161 intentsJsonObj4 = json.loads( intentsJsonStr4 )
1162 intentsJsonObj5 = json.loads( intentsJsonStr5 )
1163 intentInstall4 = \
1164 intentsJsonObj4[ installTime ][ 'value' ]
1165 intentInstall5 = \
1166 intentsJsonObj5[ installTime ][ 'value' ]
1167 intentRerouteLat4 = \
1168 int( intentInstall4 ) - int( t0System )
1169 intentRerouteLat5 = \
1170 int( intentInstall5 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -05001171 else:
andrewonlab79244cc2015-01-26 01:11:49 -05001172 intentRerouteLat4 = 0
1173 intentRerouteLat5 = 0
andrewonlaba57a3042015-01-23 13:53:05 -05001174
andrewonlab79244cc2015-01-26 01:11:49 -05001175 if clusterCount == 7:
1176 intentsJsonStr6 =\
1177 main.ONOS6cli.intentsEventsMetrics()
1178 intentsJsonStr7 =\
1179 main.ONOS7cli.intentsEventsMetrics()
1180 intentsJsonObj6 = json.loads( intentsJsonStr6 )
1181 intentsJsonObj7 = json.loads( intentsJsonStr7 )
1182 intentInstall6 = \
1183 intentsJsonObj6[ installTime ][ 'value' ]
1184 intentInstall7 = \
1185 intentsJsonObj7[ installTime ][ 'value' ]
1186 intentRerouteLat6 = \
1187 int( intentInstall6 ) - int( t0System )
1188 intentRerouteLat7 = \
1189 int( intentInstall7 ) - int( t0System )
andrewonlaba57a3042015-01-23 13:53:05 -05001190 else:
andrewonlab79244cc2015-01-26 01:11:49 -05001191 intentRerouteLat6 = 0
1192 intentRerouteLat7 = 0
andrewonlaba57a3042015-01-23 13:53:05 -05001193
andrewonlab79244cc2015-01-26 01:11:49 -05001194 intentRerouteLatAvg = \
1195 ( intentRerouteLat1 +
1196 intentRerouteLat2 +
1197 intentRerouteLat3 +
1198 intentRerouteLat4 +
1199 intentRerouteLat5 +
1200 intentRerouteLat6 +
1201 intentRerouteLat7 ) / clusterCount
andrewonlaba57a3042015-01-23 13:53:05 -05001202
andrewonlab79244cc2015-01-26 01:11:49 -05001203 main.log.info( "Intent reroute latency avg for iteration " +
1204 str( i ) + ": " + str( intentRerouteLatAvg ) )
1205 # TODO: Remove intents for next iteration
1206
1207 time.sleep( 5 )
1208
1209 intentsStr = main.ONOS1cli.intents()
1210 intentsJson = json.loads( intentsStr )
1211 for intents in intentsJson:
1212 intentId = intents[ 'id' ]
1213 # TODO: make sure this removes all intents
1214 # print intentId
1215 if intentId:
1216 main.ONOS1cli.removeIntent( intentId )
andrewonlaba57a3042015-01-23 13:53:05 -05001217
1218 main.Mininet1.handle.sendline(
andrewonlab79244cc2015-01-26 01:11:49 -05001219 "sh ifconfig " + intfs + " up" )
andrewonlaba57a3042015-01-23 13:53:05 -05001220
andrewonlab79244cc2015-01-26 01:11:49 -05001221 main.log.info( "Intents removed and port back up" )
1222
1223 def CASE9( self, main ):
andrewonlabeb1d0542014-12-03 20:12:01 -05001224 count = 0
andrewonlab79244cc2015-01-26 01:11:49 -05001225 swNum1 = 1
1226 swNum2 = 1
andrewonlabeb1d0542014-12-03 20:12:01 -05001227 appid = 0
andrewonlab79244cc2015-01-26 01:11:49 -05001228 portNum1 = 1
1229 portNum2 = 1
1230
1231 time.sleep( 30 )
andrewonlab4cf9dd22014-11-18 21:28:38 -05001232
andrewonlabeb1d0542014-12-03 20:12:01 -05001233 while True:
andrewonlab79244cc2015-01-26 01:11:49 -05001234 # main.ONOS1cli.pushTestIntents(
andrewonlabeb1d0542014-12-03 20:12:01 -05001235 #"of:0000000000001001/1",
1236 #"of:0000000000002001/1",
andrewonlab79244cc2015-01-26 01:11:49 -05001237 # 100, numMult="10", appId="1" )
1238 # main.ONOS2cli.pushTestIntents(
andrewonlabeb1d0542014-12-03 20:12:01 -05001239 # "of:0000000000001002/1",
1240 # "of:0000000000002002/1",
andrewonlab79244cc2015-01-26 01:11:49 -05001241 # 100, numMult="10", appId="2" )
1242 # main.ONOS2cli.pushTestIntents(
andrewonlabeb1d0542014-12-03 20:12:01 -05001243 # "of:0000000000001003/1",
1244 # "of:0000000000002003/1",
andrewonlab79244cc2015-01-26 01:11:49 -05001245 # 100, numMult="10", appId="3" )
andrewonlabeb1d0542014-12-03 20:12:01 -05001246 count += 1
andrewonlab79244cc2015-01-26 01:11:49 -05001247
andrewonlabeb1d0542014-12-03 20:12:01 -05001248 if count >= 100:
1249 main.ONOSbench.handle.sendline(
andrewonlab79244cc2015-01-26 01:11:49 -05001250 "onos 10.128.174.1 intents-events-metrics >>" +
1251 " /tmp/metrics_intents_temp.txt &" )
andrewonlabeb1d0542014-12-03 20:12:01 -05001252 count = 0
1253
andrewonlab79244cc2015-01-26 01:11:49 -05001254 arg1 = "of:000000000000100" + str( swNum1 ) + "/" + str( portNum1 )
1255 arg2 = "of:000000000000200" + str( swNum2 ) + "/" + str( portNum2 )
andrewonlabeb1d0542014-12-03 20:12:01 -05001256
andrewonlab79244cc2015-01-26 01:11:49 -05001257 swNum1 += 1
1258
1259 if swNum1 > 7:
1260 swNum1 = 1
1261 swNum2 += 1
1262 if swNum2 > 7:
andrewonlabeb1d0542014-12-03 20:12:01 -05001263 appid += 1
1264
andrewonlab79244cc2015-01-26 01:11:49 -05001265 if swNum2 > 7:
1266 swNum2 = 1
1267
1268 main.ONOSbench.pushTestIntentsShell(
andrewonlabeb1d0542014-12-03 20:12:01 -05001269 arg1,
andrewonlab79244cc2015-01-26 01:11:49 -05001270 arg2,
andrewonlab042b3912014-12-10 16:40:50 -05001271 100, "/tmp/temp.txt", "10.128.174.1",
andrewonlab79244cc2015-01-26 01:11:49 -05001272 numMult="10", appId=appid, report=False )
1273 # main.ONOSbench.pushTestIntentsShell(
andrewonlabeb1d0542014-12-03 20:12:01 -05001274 # "of:0000000000001002/1",
1275 # "of:0000000000002002/1",
1276 # 133, "/tmp/temp2.txt", "10.128.174.2",
andrewonlab79244cc2015-01-26 01:11:49 -05001277 # numMult="6", appId="2",report=False )
1278 # main.ONOSbench.pushTestIntentsShell(
andrewonlabeb1d0542014-12-03 20:12:01 -05001279 # "of:0000000000001003/1",
1280 # "of:0000000000002003/1",
1281 # 133, "/tmp/temp3.txt", "10.128.174.3",
andrewonlab79244cc2015-01-26 01:11:49 -05001282 # numMult="6", appId="3",report=False )
andrewonlab92ea3672014-11-04 20:22:14 -05001283
andrewonlab79244cc2015-01-26 01:11:49 -05001284 time.sleep( 0.2 )