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