blob: 32477a6bc9f5bbf8638eadeef6d910b53744ae5e [file] [log] [blame]
jenkins7ead5a82015-03-13 10:28:21 -07001# 2015.03.12 10:28:21 PDT
2#Embedded file name: ../tests/IntentPerfNextBM/IntentPerfNextBM.py
3
4
5class IntentPerfNextBM:
6
7 def __init__(self):
8 self.default = ''
9
10 def CASE1(self, main):
11 """
12 ONOS startup sequence
13 """
14 global clusterCount
15 global timeToPost
16 global runNum
17 import time
18
19 clusterCount = 1
20 timeToPost = time.strftime('%Y-%m-%d %H:%M:%S')
21 runNum = time.strftime('%d%H%M%S')
22 cellName = main.params['ENV']['cellName']
23 gitPull = main.params['GIT']['autoPull']
24 checkoutBranch = main.params['GIT']['checkout']
25 intentFilePath = main.params['DB']['intentFilePath']
jenkins404984b2015-03-24 10:30:37 -070026 cellStr = main.params[ 'TEST' ][ 'cellStr' ]
jenkins7ead5a82015-03-13 10:28:21 -070027 ONOSIp = []
28
29 for i in range(1, 8):
30 ONOSIp.append(main.params['CTRL']['ip' + str(i)])
31 main.ONOSbench.onosUninstall(nodeIp=ONOSIp[i - 1])
32
33 MN1Ip = main.params['MN']['ip1']
34 BENCHIp = main.params['BENCH']['ip']
35 main.case('Setting up test environment')
36 main.step('Clearing previous DB log file')
37 fIntentLog = open(intentFilePath, 'w')
38 fIntentLog.write('')
39 fIntentLog.close()
40 main.step('Starting mininet topology')
41 main.Mininet1.startNet()
42 main.step('Creating cell file')
jenkins404984b2015-03-24 10:30:37 -070043 cellFileResult = main.ONOSbench.createCellFile(
44 BENCHIp, cellName, MN1Ip, cellStr, ONOSIp[0])
jenkins7ead5a82015-03-13 10:28:21 -070045 main.step('Applying cell file to environment')
46 cellApplyResult = main.ONOSbench.setCell(cellName)
47 verifyCellResult = main.ONOSbench.verifyCell()
48 main.step('Removing raft logs')
49 main.ONOSbench.onosRemoveRaftLogs()
50 main.step('Git checkout and pull ' + checkoutBranch)
51
52 if gitPull == 'on':
53 checkoutResult = main.ONOSbench.gitCheckout(checkoutBranch)
54 pullResult = main.ONOSbench.gitPull()
55 main.step('Using onos-build to compile ONOS')
56 buildResult = main.ONOSbench.onosBuild()
57 else:
58 checkoutResult = main.TRUE
59 pullResult = main.TRUE
60 buildResult = main.TRUE
61 main.log.info('Git pull skipped by configuration')
62
63 main.log.report('Commit information - ')
64 main.ONOSbench.getVersion(report=True)
65 main.step('Creating ONOS package')
66 packageResult = main.ONOSbench.onosPackage()
67 main.step('Installing ONOS package')
68 install1Result = main.ONOSbench.onosInstall(node=ONOSIp[0])
69 main.step('Set cell for ONOScli env')
70 main.ONOS1cli.setCell(cellName)
71 time.sleep(5)
72 main.step('Start onos cli')
73 cli1 = main.ONOS1cli.startOnosCli(ONOSIp[0])
74 utilities.assert_equals(expect=main.TRUE,
75 actual=cellFileResult and cellApplyResult and\
76 verifyCellResult and checkoutResult and\
77 pullResult and buildResult and install1Result,
78 onpass='ONOS started successfully',
79 onfail='Failed to start ONOS')
80
81 def CASE2(self, main):
82 """
83 Batch intent install
84
85 Supports scale-out scenarios and increasing
86 number of intents within each iteration
87 """
88 import time
89 import json
90 import requests
91 import os
92 import numpy
93 ONOS1Ip = main.params['CTRL']['ip1']
94 ONOS2Ip = main.params['CTRL']['ip2']
95 ONOS3Ip = main.params['CTRL']['ip3']
96 ONOS4Ip = main.params['CTRL']['ip4']
97 ONOS5Ip = main.params['CTRL']['ip5']
98 ONOS6Ip = main.params['CTRL']['ip6']
99 ONOS7Ip = main.params['CTRL']['ip7']
100 assertion = main.TRUE
101 ONOSIpList = []
102
103 for i in range(1, 8):
104 ONOSIpList.append(main.params['CTRL']['ip' + str(i)])
105
106 ONOSUser = main.params['CTRL']['user']
107 defaultSwPort = main.params['CTRL']['port1']
108 batchIntentSize = int(main.params['TEST']['batchIntentSize'])
109 batchThreshMin = int(main.params['TEST']['batchThresholdMin'])
110 batchThreshMax = int(main.params['TEST']['batchThresholdMax'])
111 numIter = main.params['TEST']['numIter']
112 numIgnore = int(main.params['TEST']['numIgnore'])
113 numSwitch = int(main.params['TEST']['numSwitch'])
114 nThread = main.params['TEST']['numMult']
115 intentFilePath = main.params['DB']['intentFilePath']
116
117 if clusterCount == 1:
118 for i in range(1, numSwitch + 1):
119 main.Mininet1.assignSwController(sw=str(i),
120 ip1=ONOS1Ip, port1=defaultSwPort)
121 if clusterCount == 3:
122 for i in range(1, 3):
123 main.Mininet1.assignSwController(sw=str(i),
124 ip1=ONOS1Ip, port1=defaultSwPort)
125 for i in range(3, 6):
126 main.Mininet1.assignSwController(sw=str(i),
127 ip1=ONOS2Ip, port1=defaultSwPort)
128 for i in range(6, 9):
129 main.Mininet1.assignSwController(sw=str(i),
130 ip1=ONOS3Ip, port1=defaultSwPort)
131 if clusterCount == 5:
132 main.Mininet1.assignSwController(sw='1',
133 ip1=ONOS1Ip, port1=defaultSwPort)
134 main.Mininet1.assignSwController(sw='2',
135 ip1=ONOS2Ip, port1=defaultSwPort)
136 for i in range(3, 6):
137 main.Mininet1.assignSwController(sw=str(i),
138 ip1=ONOS3Ip, port1=defaultSwPort)
139 main.Mininet1.assignSwController(sw='6',
140 ip1=ONOS4Ip, port1=defaultSwPort)
141 main.Mininet1.assignSwController(sw='7',
142 ip1=ONOS5Ip, port1=defaultSwPort)
143 main.Mininet1.assignSwController(sw='8',
144 ip1=ONOS5Ip, port1=defaultSwPort)
145 if clusterCount == 7:
146 for i in range(1, 9):
147 if i < 8:
148 main.Mininet1.assignSwController(sw=str(i),
149 ip1=ONOSIpList[i - 1], port1=defaultSwPort)
150 elif i >= 8:
151 main.Mininet1.assignSwController(sw=str(i),
152 ip1=ONOSIpList[6], port1=defaultSwPort)
153
154 time.sleep(20)
155
jenkins7ead5a82015-03-13 10:28:21 -0700156 deviceIdList = []
157 batchInstallLat = []
158 batchWithdrawLat = []
159
160 main.log.report('Batch intent installation test of ' +
161 str(batchIntentSize) + ' intent(s)')
162 main.log.info('Getting list of available devices')
163
164 jsonStr = main.ONOS1cli.devices()
165 jsonObj = json.loads(jsonStr)
166 for device in jsonObj:
167 deviceIdList.append(device['id'])
168
jenkins404984b2015-03-24 10:30:37 -0700169 if not jsonObj:
170 main.log.warn( "Devices not found, check topology" )
171
jenkins7ead5a82015-03-13 10:28:21 -0700172 sleepTime = 10
173 baseDir = '/tmp/'
174 for batch in range(0, 5):
175 maxInstallLat = []
176 maxWithdrawLat = []
177 maxSingleInstallLat = []
178 maxSingleWithdrawLat = []
179 for i in range(0, int(numIter)):
180 main.log.info('Pushing ' + str(
181 int(batchIntentSize) * int(nThread)) +
182 ' intents. Iteration ' + str(i))
183 saveDir = baseDir + 'batch_intent_1.txt'
184 main.ONOSbench.pushTestIntentsShell(deviceIdList[0] +
185 '/2', deviceIdList[7] + '/2', batchIntentSize,
186 saveDir, ONOSIpList[0], numMult=nThread)
187 time.sleep(sleepTime)
188 intent = ''
189 counter = 300
190 while len(intent) > 0 and counter > 0:
191 main.ONOS1cli.handle.sendline('intents | wc -l')
192 main.ONOS1cli.handle.expect('intents | wc -l')
193 main.ONOS1cli.handle.expect('onos>')
194 intentTemp = main.ONOS1cli.handle.before()
195 intent = main.ONOS1cli.intents()
196 intent = json.loads(intent)
197 counter = counter - 1
198 time.sleep(1)
199
200 time.sleep(5)
201 saveDir = baseDir + 'batch_intent_1.txt'
202 with open(saveDir) as fOnos:
203 lineCount = 0
204 for line in fOnos:
205 line_temp = ''
206 main.log.info('Line read: ' + str(line))
207 line_temp = line[1:]
208 line_temp = line_temp.split(': ')
209 if ' ' in str(line_temp):
210 result = line_temp[1].split(' ')[0]
211 else:
212 main.log.warn('Empty line read')
213 result = 0
214 if lineCount == 0:
215 if 'Failure' in str(line):
216 main.log.warn('Intent installation failed')
217 result = 'NA'
218 else:
219 main.log.info('Install result: ' + result)
220 batchInstallLat.append(int(result))
221 installResult = result
222 elif lineCount == 1:
223 if 'Failure' in str(line):
224 main.log.warn('Intent withdraw failed')
225 result = 'NA'
226 else:
227 main.log.info('Withdraw result: ' + result)
228 batchWithdrawLat.append(int(result))
229 withdrawResult = result
230 else:
231 main.log.warn('Invalid results')
232 installResult = 'NA'
233 withdrawResult = 'NA'
234 lineCount += 1
235
236 main.log.info('Batch install latency with' +
237 str(batchIntentSize) + 'intents: ' +
238 str(installResult) + ' ms')
239 main.log.info('Batch withdraw latency with' +
240 str(batchIntentSize) + 'intents: ' +
241 str(withdrawResult) + ' ms')
242 main.log.info('Single intent install latency with' +
243 str(batchIntentSize) + 'intents: ' +
244 str(float(installResult) / int(batchIntentSize))+' ms')
245 main.log.info('Single intent withdraw latency with' +
246 str(batchIntentSize) + 'intents: ' +
247 str(float(withdrawResult)/ int(batchIntentSize))+' ms')
248 if len(batchInstallLat) > 0 and int(i) > numIgnore:
249 maxInstallLat.append(max(batchInstallLat))
250 maxSingleInstallLat.append(
251 max(batchInstallLat) / int(batchIntentSize))
252 elif len(batchInstallLat) == 0:
253 sleepTime += 30
254 if len(batchWithdrawLat) > 0 and int(i) > numIgnore:
255 maxWithdrawLat.append(max(batchWithdrawLat))
256 maxSingleWithdrawLat.append(
257 max(batchWithdrawLat) / int(batchIntentSize))
258 batchInstallLat = []
259 batchWithdrawLat = []
260 time.sleep(5)
261
262 if maxInstallLat:
263 avgInstallLat = str(round(
264 numpy.average(maxInstallLat), 2))
265 stdInstallLat = str(round(
266 numpy.std(maxInstallLat), 2))
267 avgSingleInstallLat = str(round(
268 numpy.average(maxSingleInstallLat), 3))
269 stdSingleInstallLat = str(round(
270 numpy.std(maxSingleInstallLat), 3))
271 else:
272 avgInstallLat = 'NA'
273 stdInstallLat = 'NA'
274 main.log.report('Batch installation failed')
275 assertion = main.FALSE
276 if maxWithdrawLat:
277 avgWithdrawLat = str(round(
278 numpy.average(maxWithdrawLat), 2))
279 stdWithdrawLat = str(round(
280 numpy.std(maxWithdrawLat), 2))
281 avgSingleWithdrawLat = str(round(
282 numpy.average(maxSingleWithdrawLat), 3))
283 stdSingleWithdrawLat = str(round(
284 numpy.std(maxSingleWithdrawLat), 3))
285 else:
286 avgWithdrawLat = 'NA'
287 stdWithdrawLat = 'NA'
288 main.log.report('Batch withdraw failed')
289 assertion = main.FALSE
jenkins404984b2015-03-24 10:30:37 -0700290
jenkins7ead5a82015-03-13 10:28:21 -0700291 main.log.report('Avg of batch installation latency ' +
292 'of size ' + str(batchIntentSize) + ': ' +
293 str(avgInstallLat) + ' ms')
294 main.log.report('Std Deviation of batch installation latency ' +
295 ': ' + str(round(numpy.std(maxInstallLat), 2)) + ' ms')
296 main.log.report('Avg of batch withdraw latency ' +
297 'of size ' + str(batchIntentSize) + ': ' +
298 str(avgWithdrawLat) + ' ms')
299 main.log.report('Std Deviation of batch withdraw latency ' +
300 ': ' + str(round(numpy.std(maxWithdrawLat), 2)) + ' ms')
jenkins404984b2015-03-24 10:30:37 -0700301
jenkins7ead5a82015-03-13 10:28:21 -0700302 main.log.report('Avg of batch withdraw latency ' + 'of size ' +
303 str(batchIntentSize) + ': ' + str(avgWithdrawLat) + ' ms')
304 main.log.report('Std Deviation of batch withdraw latency ' +
305 ': ' + str(stdWithdrawLat) + ' ms')
306 main.log.report('Avg of single withdraw latency ' + 'of size ' +
307 str(batchIntentSize) + ': ' +
308 str(avgSingleWithdrawLat) + ' ms')
309 main.log.report('Std Deviation of single withdraw latency ' +
310 ': ' + str(stdSingleWithdrawLat) + ' ms')
jenkins404984b2015-03-24 10:30:37 -0700311
jenkins7ead5a82015-03-13 10:28:21 -0700312 dbCmd = "INSERT INTO intents_latency_tests VALUES('" +\
313 timeToPost + "','intents_latency_results'," +\
314 runNum + ',' + str(clusterCount) + ',' +\
315 str(batchIntentSize) + ',' + str(avgInstallLat) +\
316 ',' + str(stdInstallLat) + ',' + str(avgWithdrawLat) +\
317 ',' + str(stdWithdrawLat) + ');'
318
319 fResult = open(intentFilePath, 'a')
320 if dbCmd:
321 fResult.write(dbCmd + '\n')
322 fResult.close()
323 if batch == 0:
324 batchIntentSize = 10
325 elif batch == 1:
326 batchIntentSize = 100
327 elif batch == 2:
328 batchIntentSize = 1000
329 elif batch == 3:
330 batchIntentSize = 1500
331 if batch < 4:
332 main.log.report('Increasing batch intent size to ' +
333 str(batchIntentSize))
334
335 utilities.assert_equals(expect=main.TRUE, actual=assertion,
336 onpass='Batch intent install/withdraw test successful',
337 onfail='Batch intent install/withdraw test failed')
338
339 def CASE3(self, main):
340 """
341 Batch intent reroute latency
342 """
343 import time
344 import json
345 import requests
346 import os
347 import numpy
348
349 ONOS1Ip = main.params['CTRL']['ip1']
350 ONOS2Ip = main.params['CTRL']['ip2']
351 ONOS3Ip = main.params['CTRL']['ip3']
352 ONOS4Ip = main.params['CTRL']['ip4']
353 ONOS5Ip = main.params['CTRL']['ip5']
354 ONOS6Ip = main.params['CTRL']['ip6']
355 ONOS7Ip = main.params['CTRL']['ip7']
356
357 ONOSIpList = []
358 for i in range(1, 8):
359 ONOSIpList.append(main.params['CTRL']['ip' + str(i)])
360
361 ONOSUser = main.params['CTRL']['user']
362 defaultSwPort = main.params['CTRL']['port1']
363 batchIntentSize = main.params['TEST']['batchIntentSize']
364 thresholdMin = int(main.params['TEST']['batchThresholdMin'])
365 thresholdMax = int(main.params['TEST']['batchThresholdMax'])
366
367 intfs = main.params['TEST']['intfs']
368 installTime = main.params['JSON']['installedTime']
369 numIter = main.params['TEST']['numIter']
370 numIgnore = int(main.params['TEST']['numIgnore'])
371 numSwitch = int(main.params['TEST']['numSwitch'])
372 nThread = main.params['TEST']['numMult']
373
374 tsharkPortStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ]
375 tsharkPortDown = '/tmp/tshark_port_down_reroute.txt'
376
377 if clusterCount == 1:
378 for i in range(1, numSwitch + 1):
379 main.Mininet1.assignSwController(sw=str(i),
380 ip1=ONOS1Ip, port1=defaultSwPort)
381 if clusterCount == 3:
382 for i in range(1, 3):
383 main.Mininet1.assignSwController(sw=str(i),
384 ip1=ONOS1Ip, port1=defaultSwPort)
385 for i in range(3, 6):
386 main.Mininet1.assignSwController(sw=str(i),
387 ip1=ONOS2Ip, port1=defaultSwPort)
388 for i in range(6, 9):
389 main.Mininet1.assignSwController(sw=str(i),
390 ip1=ONOS3Ip, port1=defaultSwPort)
391 if clusterCount == 5:
392 main.Mininet1.assignSwController(sw='1',
393 ip1=ONOS1Ip, port1=defaultSwPort)
394 main.Mininet1.assignSwController(sw='2',
395 ip1=ONOS2Ip, port1=defaultSwPort)
396 for i in range(3, 6):
397 main.Mininet1.assignSwController(sw=str(i),
398 ip1=ONOS3Ip, port1=defaultSwPort)
399 main.Mininet1.assignSwController(sw='6',
400 ip1=ONOS4Ip, port1=defaultSwPort)
401 main.Mininet1.assignSwController(sw='7',
402 ip1=ONOS5Ip, port1=defaultSwPort)
403 main.Mininet1.assignSwController(sw='8',
404 ip1=ONOS5Ip, port1=defaultSwPort)
405 if clusterCount == 7:
406 for i in range(1, 9):
407 if i < 8:
408 main.Mininet1.assignSwController(sw=str(i),
409 ip1=ONOSIpList[i - 1], port1=defaultSwPort)
410 elif i >= 8:
411 main.Mininet1.assignSwController(sw=str(i),
412 ip1=ONOSIpList[6], port1=defaultSwPort)
413
414 main.log.report('Batch intent reroute test ')
415
416 batchIntentRerouteAvgSystem = numpy.zeros((
417 clusterCount, int(numIter)))
418 batchIntentRerouteStdSystem = numpy.zeros((
419 clusterCount, int(numIter)))
420 batchIntentRerouteAvgPort = numpy.zeros((
421 clusterCount, int(numIter)))
422 batchIntentRerouteStdSystem = numpy.zeros((
423 clusterCount, int(numIter)))
424
425 time.sleep(10)
426
427 main.log.info('Getting list of available devices')
428
429 deviceIdList = []
430 jsonStr = main.ONOS1cli.devices()
431 jsonObj = json.loads(jsonStr)
432 for device in jsonObj:
433 deviceIdList.append(device['id'])
434 if not jsonObj:
435 main.log.warn('No devices have been discovered')
436 assertion = main.FALSE
437
438 sleepTime = 10
439
440 baseDir = '/tmp/'
441 for batch in range(0, 5):
442 maxRerouteLatSystem = []
443 maxRerouteLatPort = []
444 for i in range(0, int(numIter)):
445 rerouteLatSystem = []
446 rerouteLatPort = []
447 main.log.info('Pushing ' + str(
448 int(batchIntentSize) * int(nThread)) +
449 ' intents. Iteration ' + str(i))
450 main.ONOSbench.pushTestIntentsShell(
451 deviceIdList[0] + '/2', deviceIdList[7] +
452 '/2', batchIntentSize, '/tmp/batch_install.txt',
453 ONOSIpList[0], numMult='1', report=False,
454 options='-i')
455
456 time.sleep(10)
457
458 main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortDown)
459 main.log.info('Disabling interface ' + intfs)
460 main.Mininet1.handle.sendline(
461 'sh ifconfig ' + intfs + ' down')
462 t0System = time.time() * 1000
463
464 time.sleep(3)
465
466 main.ONOS1.tsharkStop()
467
468 time.sleep(2)
469
470 os.system('scp ' + ONOSUser + '@' + ONOSIpList[0] +
471 ':' + tsharkPortDown + ' /tmp/')
472 time.sleep(5)
473
474 fPortDown = open(tsharkPortDown, 'r')
475 fLine = fPortDown.readline()
476 objDown = fLine.split(' ')
477 if len(fLine) > 0:
478 timestampBeginPtDown = int(float(objDown[1]) * 1000)
479 if timestampBeginPtDown < 1400000000000:
480 timestampBeginPtDown = int(float(objDown[2]) * 1000)
481 main.log.info('Port down begin timestamp: ' +
482 str(timestampBeginPtDown))
483 else:
484 main.log.info('Tshark output file returned unexpected' +
485 ' results: ' + str(fLine))
486 fPortDown.close()
487
488 intentsJsonStr1 = main.ONOS1cli.intentsEventsMetrics()
489 intentsJsonObj1 = json.loads(intentsJsonStr1)
490 intentInstall1 = intentsJsonObj1[installTime]['value']
491 intentRerouteLat1 = int(intentInstall1) - int(t0System)
492 intentRerouteLatPort1 =\
493 int(intentInstall1) - int(timestampBeginPtDown)
494
495 if intentRerouteLat1 > thresholdMin and \
496 intentRerouteLat1 < thresholdMax and\
497 i > numIgnore:
498 rerouteLatSystem.append(intentRerouteLat1)
499 main.log.info('ONOS1 Intent Reroute Lat ' +
500 ' size: ' + str(batchIntentSize) +
501 ' system-to-install: ' +
502 str(intentRerouteLat1) + ' ms')
503 if intentRerouteLatPort1 > thresholdMin and\
504 intentRerouteLatPort1 < thresholdMax and\
505 i > numIgnore:
506 rerouteLatPort.append(intentRerouteLatPort1)
507
508 main.log.info('ONOS1 Intent Reroute Lat ' +
509 ' size: ' + str(batchIntentSize) +
510 ' system-to-install: ' +
511 str(intentRerouteLatPort1) + ' ms')
512
513 if clusterCount == 3:
514 intentsJsonStr2 = main.ONOS2cli.intentsEventsMetrics()
515 intentsJsonStr3 = main.ONOS3cli.intentsEventsMetrics()
516 intentsJsonObj2 = json.loads(intentsJsonStr2)
517 intentsJsonObj3 = json.loads(intentsJsonStr3)
518 intentInstall2 = intentsJsonObj2[installTime]['value']
519 intentInstall3 = intentsJsonObj3[installTime]['value']
520 intentRerouteLat2 = int(intentInstall2) - int(t0System)
521 intentRerouteLat3 = int(intentInstall3) - int(t0System)
522 intentRerouteLatPort2 = int(intentInstall2) - int(timestampBeginPtDown)
523 intentRerouteLatPort3 = int(intentInstall3) - int(timestampBeginPtDown)
524
525 if intentRerouteLat2 > thresholdMin and\
526 intentRerouteLat2 < thresholdMax and\
527 i > numIgnore:
528 rerouteLatSystem.append(intentRerouteLat2)
529 main.log.info('ONOS2 Intent Reroute Lat' +
530 ' size: ' + str(batchIntentSize) +
531 ' system-to-install: ' + str(intentRerouteLat2) + ' ms')
532 if intentRerouteLat3 > thresholdMin and\
533 intentRerouteLat3 < thresholdMax and\
534 i > numIgnore:
535 rerouteLatSystem.append(intentRerouteLat3)
536 main.log.info('ONOS3 Intent Reroute Lat' +
537 ' size: ' + str(batchIntentSize) +
538 ' system-to-install: ' + str(intentRerouteLat3) +
539 ' ms')
540 if intentRerouteLatPort2 > thresholdMin and\
541 intentRerouteLatPort2 < thresholdMax and\
542 i > numIgnore:
543 rerouteLatPort.append(intentRerouteLatPort2)
544 main.log.info('ONOS2 Intent Reroute Lat' +
545 ' size: ' + str(batchIntentSize) +
546 ' port-to-install: ' +
547 str(intentRerouteLatPort2) + ' ms')
548 if intentRerouteLatPort3 > thresholdMin and\
549 intentRerouteLatPort3 < thresholdMax and\
550 i > numIgnore:
551 rerouteLatPort.append(intentRerouteLatPort3)
552 main.log.info('ONOS3 Intent Reroute Lat' +
553 ' size: ' + str(batchIntentSize) +
554 ' port-to-install: ' +
555 str(intentRerouteLatPort2) + ' ms')
556
557 if clusterCount == 5:
558 intentsJsonStr4 = main.ONOS4cli.intentsEventsMetrics()
559 intentsJsonStr5 = main.ONOS5cli.intentsEventsMetrics()
560 intentsJsonObj4 = json.loads(intentsJsonStr4)
561 intentsJsonObj5 = json.loads(intentsJsonStr5)
562 intentInstall4 = intentsJsonObj4[installTime]['value']
563 intentInstall5 = intentsJsonObj5[installTime]['value']
564 intentRerouteLat4 = int(intentInstall4) - int(t0System)
565 intentRerouteLat5 = int(intentInstall5) - int(t0System)
566 intentRerouteLatPort4 =\
567 int(intentInstall4) - int(timestampBeginPtDown)
568 intentRerouteLatPort5 =\
569 int(intentInstall5) - int(timestampBeginPtDown)
570 if intentRerouteLat4 > thresholdMin and\
571 intentRerouteLat4 < thresholdMax and \
572 i > numIgnore:
573 rerouteLatSystem.append(intentRerouteLat4)
574 main.log.info('ONOS4 Intent Reroute Lat' +
575 ' size: ' + str(batchIntentSize) +
576 ' system-to-install: ' + str(intentRerouteLat4) +
577 ' ms')
578 if intentRerouteLat5 > thresholdMin and\
579 intentRerouteLat5 < thresholdMax and\
580 i > numIgnore:
581 rerouteLatSystem.append(intentRerouteLat5)
582 main.log.info('ONOS5 Intent Reroute Lat' +
583 ' size: ' + str(batchIntentSize) +
584 ' system-to-install: ' +
585 str(intentRerouteLat5) + ' ms')
586 if intentRerouteLatPort4 > thresholdMin and\
587 intentRerouteLatPort4 < thresholdMax and\
588 i > numIgnore:
589 rerouteLatPort.append(intentRerouteLatPort4)
590 main.log.info('ONOS4 Intent Reroute Lat' +
591 ' size: ' + str(batchIntentSize) +
592 ' port-to-install: ' +
593 str(intentRerouteLatPort4) + ' ms')
594 if intentRerouteLatPort5 > thresholdMin and\
595 intentRerouteLatPort5 < thresholdMax and\
596 i > numIgnore:
597 rerouteLatPort.append(intentRerouteLatPort5)
598 main.log.info('ONOS5 Intent Reroute Lat' +
599 ' size: ' + str(batchIntentSize) +
600 ' port-to-install: ' +
601 str(intentRerouteLatPort5) + ' ms')
602
603 if clusterCount == 7:
604 intentsJsonStr6 = main.ONOS6cli.intentsEventsMetrics()
605 intentsJsonStr7 = main.ONOS7cli.intentsEventsMetrics()
606 intentsJsonObj6 = json.loads(intentsJsonStr6)
607 intentsJsonObj7 = json.loads(intentsJsonStr7)
608 intentInstall6 = intentsJsonObj6[installTime]['value']
609 intentInstall7 = intentsJsonObj7[installTime]['value']
610 intentRerouteLat6 = int(intentInstall6) - int(t0System)
611 intentRerouteLat7 = int(intentInstall7) - int(t0System)
612 intentRerouteLatPort4 =\
613 int(intentInstall4) - int(timestampBeginPtDown)
614 intentRerouteLatPort5 =\
615 int(intentInstall5) - int(timestampBeginPtDown)
616 if intentRerouteLat6 > thresholdMin and\
617 intentRerouteLat6 < thresholdMax and\
618 i > numIgnore:
619 rerouteLatSystem.append(intentRerouteLat6)
620 main.log.info('ONOS6 Intent Reroute Lat' +
621 ' size: ' + str(batchIntentSize) +
622 ' system-to-install: ' +
623 str(intentRerouteLat6) + ' ms')
624 if intentRerouteLat7 > thresholdMin and\
625 intentRerouteLat7 < thresholdMax and\
626 i > numIgnore:
627 rerouteLatSystem.append(intentRerouteLat7)
628 main.log.info('ONOS7 Intent Reroute Lat' +
629 ' size: ' + str(batchIntentSize) +
630 ' system-to-install: ' +
631 str(intentRerouteLat7) + ' ms')
632 if intentRerouteLatPort6 > thresholdMin and\
633 intentRerouteLatPort6 < thresholdMax and\
634 i > numIgnore:
635 rerouteLatPort.append(intentRerouteLatPort6)
636 main.log.info('ONOS6 Intent Reroute Lat' +
637 ' size: ' + str(batchIntentSize) +
638 ' port-to-install: ' +
639 str(intentRerouteLatPort6) + ' ms')
640 if intentRerouteLatPort7 > thresholdMin and\
641 intentRerouteLatPort7 < thresholdMax and\
642 i > numIgnore:
643 rerouteLatPort.append(intentRerouteLatPort7)
644 main.log.info('ONOS7 Intent Reroute Lat' +
645 ' size: ' + str(batchIntentSize) +
646 ' port-to-install: ' +
647 str(intentRerouteLatPort7) + ' ms')
648
649 time.sleep(5)
650
651 main.log.info('System: ' + str(rerouteLatSystem))
652 main.log.info('Port: ' + str(rerouteLatPort))
653 if rerouteLatSystem:
654 maxRerouteLatSystem = max(rerouteLatSystem)
655 main.log.info('Max system: ' + str(maxRerouteLatSystem))
656 if rerouteLatPort:
657 maxRerouteLatPort = max(rerouteLatPort)
658 main.log.info('Max port: ' + str(maxRerouteLatPort))
659
660 # Bring port back up for next iteration
661 main.Mininet1.handle.sendline('sh ifconfig ' + intfs + ' up')
662 time.sleep(5)
663
664 # Use 'withdraw' option to withdraw batch intents
665 main.ONOSbench.pushTestIntentsShell(
666 deviceIdList[0] + '/2', deviceIdList[7] + '/2',
667 batchIntentSize, '/tmp/batch_install.txt',
668 ONOSIpList[0], numMult='1', report=False, options='-w')
669 main.log.info('Intents removed and port back up')
670
671 # NOTE: End iteration loop
672 if batch == 1:
673 batchIntentSize = 10
674 elif batch == 2:
675 batchIntentSize = 100
676 elif batch == 3:
677 batchIntentSize = 500
678 elif batch == 4:
679 batchIntentSize = 1000
680 main.log.info('Batch intent size increased to ' + str(batchIntentSize))
681
682 def CASE4(self, main):
683 """
684 Increase number of nodes and initiate CLI
685 """
686 global clusterCount
687 import time
688 import json
689
jenkins7ead5a82015-03-13 10:28:21 -0700690 clusterCount += 2
jenkins404984b2015-03-24 10:30:37 -0700691
692 cellName = main.params[ 'ENV' ][ 'cellName' ]
693 features = main.params[ 'TEST' ][ 'cellStr' ]
694 benchIp = main.params[ 'BENCH' ][ 'ip' ]
695 mininetIp = main.params[ 'MN' ][ 'ip1' ]
696
jenkins7ead5a82015-03-13 10:28:21 -0700697 main.log.report('Increasing cluster size to ' + str(clusterCount))
698
699 ONOSIp = []
700 for i in range( 1, 8 ):
jenkins404984b2015-03-24 10:30:37 -0700701 ONOSIp.append( main.params[ 'CTRL' ][ 'ip'+str(i) ] )
jenkins7ead5a82015-03-13 10:28:21 -0700702
703 main.step( "Cleaning environment" )
jenkins404984b2015-03-24 10:30:37 -0700704 for i in range( 0, 7 ):
jenkins7ead5a82015-03-13 10:28:21 -0700705 main.ONOSbench.onosDie( ONOSIp[i] )
jenkins404984b2015-03-24 10:30:37 -0700706 main.log.info( "Uninstalling ONOS "+str(i+1) )
jenkins7ead5a82015-03-13 10:28:21 -0700707 main.ONOSbench.onosUninstall( ONOSIp[i] )
708
709 main.step( "Creating new cell file" )
710 cellIp = []
jenkins404984b2015-03-24 10:30:37 -0700711 for node in range( 1, clusterCount + 1 ):
jenkins7ead5a82015-03-13 10:28:21 -0700712 cellIp.append( ONOSIp[node] )
713 main.ONOSbench.createCellFile( benchIp, cellName,
714 mininetIp, str(features), *cellIp )
715
716 main.step( "Setting cell definition" )
717 main.ONOSbench.setCell( cellName )
718
719 main.step( "Packaging cell definition" )
720 main.ONOSbench.onosPackage()
721
722 for node in range( 1, clusterCount + 1 ):
jenkins404984b2015-03-24 10:30:37 -0700723 main.ONOSbench.onosInstall( node = ONOSIp[node] )
724
725 time.sleep( 20 )
jenkins7ead5a82015-03-13 10:28:21 -0700726
727 for node in range( 1, clusterCount + 1 ):
728 for i in range( 2 ):
729 isup = main.ONOSbench.isup( ONOSIp[node] )
730 if isup:
731 main.log.info( "ONOS "+str(node) + " is up\n")
732 assertion = main.TRUE
733 break
734 if not isup:
735 main.log.info( "ONOS" + str(node) + " did not start")
736
jenkins404984b2015-03-24 10:30:37 -0700737 for node in range( 1, clusterCount + 1 ):
738 exec "a = main.ONOS%scli.startOnosCli" %str(node)
739 a( ONOSIp[node] )
740
741 time.sleep(30)
742
jenkins7ead5a82015-03-13 10:28:21 -0700743 utilities.assert_equals(expect=main.TRUE, actual=assertion,
744 onpass='Scale out to ' + str(clusterCount) + ' nodes successful',
745 onfail='Scale out to ' + str(clusterCount) + ' nodes failed')
746