blob: e89491ab62e2d80f2ba6b874246a73423d5c0225 [file] [log] [blame]
jenkins7ead5a82015-03-13 10:28:21 -07001# 2015.03.12 10:22:05 PDT
2#Embedded file name: ../tests/TopoPerfNextBM/TopoPerfNextBM.py
3import time
4import sys
5import os
6import re
7
8class TopoPerfNextBM:
9
10 def __init__(self):
11 self.default = ''
12
13 def CASE1(self, main):
14 """
15 ONOS startup sequence
16 """
17 global clusterCount
18 global timeToPost
19 global runNum
andrew@onlab.us0f468c42015-04-02 17:05:47 -040020
jenkins7ead5a82015-03-13 10:28:21 -070021 import time
22 clusterCount = 1
23 timeToPost = time.strftime('%Y-%m-%d %H:%M:%S')
24 runNum = time.strftime('%d%H%M%S')
25 cellName = main.params['ENV']['cellName']
26 gitPull = main.params['GIT']['autoPull']
27 checkoutBranch = main.params['GIT']['checkout']
andrew@onlab.us0f468c42015-04-02 17:05:47 -040028
29 global CLIs
30 CLIs = []
31 global nodes
32 nodes = []
33 global nodeIpList
34 nodeIpList = []
35 for i in range( 1, 8 ):
36 CLIs.append( getattr( main, 'ONOS' + str( i ) + 'cli' ) )
37 nodes.append( getattr( main, 'ONOS' + str( i ) ) )
38 nodeIpList.append( main.params[ 'CTRL' ][ 'ip'+str(i) ] )
39
jenkins7ead5a82015-03-13 10:28:21 -070040 MN1Ip = main.params['MN']['ip1']
41 BENCHIp = main.params['BENCH']['ip']
andrew@onlab.us0f468c42015-04-02 17:05:47 -040042 cellFeatures = main.params['ENV']['cellFeatures']
jenkins7ead5a82015-03-13 10:28:21 -070043 topoCfgFile = main.params['TEST']['topoConfigFile']
44 topoCfgName = main.params['TEST']['topoConfigName']
45 portEventResultPath = main.params['DB']['portEventResultPath']
46 switchEventResultPath = main.params['DB']['switchEventResultPath']
47 mvnCleanInstall = main.params['TEST']['mci']
48
49 main.case('Setting up test environment')
andrew@onlab.us0f468c42015-04-02 17:05:47 -040050
51 # NOTE: Below is deprecated after new way to install features
52 #main.log.info('Copying topology event accumulator config' +
53 # ' to ONOS /package/etc')
54 #main.ONOSbench.handle.sendline('cp ~/' +
55 # topoCfgFile + ' ~/ONOS/tools/package/etc/' +
56 # topoCfgName)
57 #main.ONOSbench.handle.expect('\\$')
jenkins7ead5a82015-03-13 10:28:21 -070058
59 main.log.report('Setting up test environment')
60
61 main.step('Starting mininet topology ')
62 main.Mininet1.startNet()
63
64 main.step('Cleaning previously installed ONOS if any')
andrew@onlab.us0f468c42015-04-02 17:05:47 -040065 # Nodes 2 ~ 7
66 for i in range( 1, 7 ):
67 main.ONOSbench.onosUninstall(nodeIp=nodeIpList[i])
jenkins7ead5a82015-03-13 10:28:21 -070068
69 main.step('Clearing previous DB log file')
70
71 fPortLog = open(portEventResultPath, 'w')
72 fPortLog.write('')
73 fPortLog.close()
74 fSwitchLog = open(switchEventResultPath, 'w')
75 fSwitchLog.write('')
76 fSwitchLog.close()
77
jenkins7ead5a82015-03-13 10:28:21 -070078 main.step('Creating cell file')
79 cellFileResult = main.ONOSbench.createCellFile(
andrew@onlab.us0f468c42015-04-02 17:05:47 -040080 BENCHIp, cellName, MN1Ip, cellFeatures, nodeIpList[0])
jenkins7ead5a82015-03-13 10:28:21 -070081
82 main.step('Applying cell file to environment')
83 cellApplyResult = main.ONOSbench.setCell(cellName)
84 verifyCellResult = main.ONOSbench.verifyCell()
85
86 main.step('Git checkout and pull ' + checkoutBranch)
87 if gitPull == 'on':
88 checkoutResult = main.TRUE
89 pullResult = main.ONOSbench.gitPull()
90 else:
91 checkoutResult = main.TRUE
92 pullResult = main.TRUE
93 main.log.info('Skipped git checkout and pull')
94
95 main.log.report('Commit information - ')
96 main.ONOSbench.getVersion(report=True)
97 main.step('Using mvn clean & install')
98 if mvnCleanInstall == 'on':
99 mvnResult = main.ONOSbench.cleanInstall()
100 elif mvnCleanInstall == 'off':
101 main.log.info('mci turned off by settings')
102 mvnResult = main.TRUE
103 main.step('Set cell for ONOS cli env')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400104 CLIs[0].setCell(cellName)
jenkins7ead5a82015-03-13 10:28:21 -0700105
106 main.step('Creating ONOS package')
107 packageResult = main.ONOSbench.onosPackage()
108
109 main.step('Installing ONOS package')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400110 install1Result = main.ONOSbench.onosInstall(node=nodeIpList[0])
jenkins7ead5a82015-03-13 10:28:21 -0700111
112 time.sleep(10)
113
114 main.step('Start onos cli')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400115 cli1 = CLIs[0].startOnosCli(nodeIpList[0])
116
117 main.step( 'activating essential applications' )
118 CLIs[0].activateApp( 'org.onosproject.metrics' )
119 CLIs[0].activateApp( 'org.onosproject.openflow' )
120
121 main.step( 'Configuring application parameters' )
122 # TODO: Check driver for this functionality
123 main.ONOSbench.handle.sendline(
124 'onos '+nodeIpList[0]+
125 ' cfg set org.onosproject.net.'+
126 'topology.impl.DefaultTopologyProvider'+
127 ' maxEvents 1')
128 main.ONOSbench.handle.expect(":~")
129 main.ONOSbench.handle.sendline(
130 'onos '+nodeIpList[0]+
131 ' cfg set org.onosproject.net.'+
132 'topology.impl.DefaultTopologyProvider'+
133 ' maxBatchMs 0')
134 main.ONOSbench.handle.expect(":~")
135 main.ONOSbench.handle.sendline(
136 'onos '+nodeIpList[0]+
137 ' cfg set org.onosproject.net.'+
138 'topology.impl.DefaultTopologyProvider'+
139 ' maxIdleMs 0')
140 main.ONOSbench.handle.expect(":~")
141
jenkins7ead5a82015-03-13 10:28:21 -0700142 utilities.assert_equals(expect=main.TRUE,
143 actual=cellFileResult and cellApplyResult and\
144 verifyCellResult and checkoutResult and\
145 pullResult and mvnResult and\
146 install1Result,
147 onpass='Test Environment setup successful',
148 onfail='Failed to setup test environment')
149
150 def CASE2(self, main):
151 """
152 Assign s1 to ONOS1 and measure latency
153
154 There are 4 levels of latency measurements to this test:
155 1 ) End-to-end measurement: Complete end-to-end measurement
156 from TCP ( SYN/ACK ) handshake to Graph change
157 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of
158 measurement from OFP Vendor message to Graph change
159 3 ) OFP-to-device measurement: 'ONOS processing without
160 graph change' snippet of measurement from OFP vendor
161 message to Device change timestamp
162 4 ) T0-to-device measurement: Measurement that includes
163 the switch handshake to devices timestamp without
164 the graph view change. ( TCP handshake -> Device
165 change )
166 """
167 import time
168 import subprocess
169 import json
170 import requests
171 import os
172 import numpy
173
jenkins7ead5a82015-03-13 10:28:21 -0700174 ONOSUser = main.params['CTRL']['user']
175 defaultSwPort = main.params['CTRL']['port1']
176 numIter = main.params['TEST']['numIter']
177 iterIgnore = int(main.params['TEST']['iterIgnore'])
jenkins8ba10ab2015-03-24 10:31:31 -0700178
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400179 deviceTimestampKey = main.params['JSON']['deviceTimestamp']
180 graphTimestampKey = main.params['JSON']['graphTimestamp']
jenkins8ba10ab2015-03-24 10:31:31 -0700181
jenkins7ead5a82015-03-13 10:28:21 -0700182 debugMode = main.params['TEST']['debugMode']
183 onosLog = main.params['TEST']['onosLogFile']
184 resultPath = main.params['DB']['switchEventResultPath']
185 thresholdStr = main.params['TEST']['singleSwThreshold']
186 thresholdObj = thresholdStr.split(',')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400187 thresholdMin = float(thresholdObj[0])
188 thresholdMax = float(thresholdObj[1])
jenkins7ead5a82015-03-13 10:28:21 -0700189
jenkins8ba10ab2015-03-24 10:31:31 -0700190 # Look for 'role-request' messages,
191 # which replaces the 'vendor' messages previously seen
192 # on OVS 2.0.1
jenkins7ead5a82015-03-13 10:28:21 -0700193 tsharkTcpString = main.params[ 'TSHARK' ][ 'tcpSynAck' ]
jenkins8ba10ab2015-03-24 10:31:31 -0700194 tsharkFeatureReply = main.params[ 'TSHARK' ][ 'featureReply' ]
195 tsharkRoleRequest = main.params[ 'TSHARK' ][ 'roleRequest' ]
196 tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ]
197
jenkins7ead5a82015-03-13 10:28:21 -0700198 tsharkOfOutput = '/tmp/tshark_of_topo.txt'
199 tsharkTcpOutput = '/tmp/tshark_tcp_topo.txt'
jenkins8ba10ab2015-03-24 10:31:31 -0700200 tsharkRoleOutput = '/tmp/tshark_role_request.txt'
201 tsharkFeatureOutput = '/tmp/tshark_feature_reply.txt'
jenkins7ead5a82015-03-13 10:28:21 -0700202
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400203 # TCP Syn/Ack -> Feature Reply latency collection for each node
204 tcpToFeatureLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
205 # Feature Reply -> Role Request latency collection for each node
206 featureToRoleRequestLatNodeIter = numpy.zeros((clusterCount,
207 int(numIter)))
208 # Role Request -> Role Reply latency collection for each node
209 roleRequestToRoleReplyLatNodeIter = numpy.zeros((clusterCount,
210 int(numIter)))
211 # Role Reply -> Device Update latency collection for each node
212 roleReplyToDeviceLatNodeIter = numpy.zeros((clusterCount,
213 int(numIter)))
214 # Device Update -> Graph Update latency collection for each node
215 deviceToGraphLatNodeIter = numpy.zeros((clusterCount,
216 int(numIter)))
217
218
jenkins7ead5a82015-03-13 10:28:21 -0700219 endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
220 ofpToGraphLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
221 ofpToDeviceLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
222
223 tcpToOfpLatIter = []
jenkins8ba10ab2015-03-24 10:31:31 -0700224 tcpToFeatureLatIter = []
225 tcpToRoleLatIter = []
jenkins7ead5a82015-03-13 10:28:21 -0700226 assertion = main.TRUE
227 localTime = time.strftime('%x %X')
228 localTime = localTime.replace('/', '')
229 localTime = localTime.replace(' ', '_')
230 localTime = localTime.replace(':', '')
231
232 if debugMode == 'on':
233 main.ONOS1.tsharkPcap('eth0',
234 '/tmp/single_sw_lat_pcap_' + localTime)
235 main.log.info('Debug mode is on')
236 main.log.report('Latency of adding one switch to controller')
237 main.log.report('First ' + str(iterIgnore) +
238 ' iterations ignored' + ' for jvm warmup time')
239 main.log.report('Total iterations of test: ' + str(numIter))
240
241 for i in range(0, int(numIter)):
242 main.log.info('Starting tshark capture')
243 main.ONOS1.tsharkGrep(tsharkTcpString, tsharkTcpOutput)
244 main.ONOS1.tsharkGrep(tsharkOfString, tsharkOfOutput)
jenkins8ba10ab2015-03-24 10:31:31 -0700245 main.ONOS1.tsharkGrep(tsharkRoleRequest, tsharkRoleOutput)
246 main.ONOS1.tsharkGrep(tsharkFeatureReply, tsharkFeatureOutput)
247
jenkins7ead5a82015-03-13 10:28:21 -0700248 time.sleep(10)
249
250 main.log.info('Assigning s3 to controller')
251 main.Mininet1.assignSwController(sw='3',
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400252 ip1=nodeIpList[0], port1=defaultSwPort)
jenkins7ead5a82015-03-13 10:28:21 -0700253
254 time.sleep(10)
255
256 main.log.info('Stopping all Tshark processes')
257 main.ONOS1.tsharkStop()
258
259 main.log.info('Copying over tshark files')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400260 os.system('scp ' + ONOSUser + '@' + nodeIpList[0] +
jenkins7ead5a82015-03-13 10:28:21 -0700261 ':' + tsharkTcpOutput + ' /tmp/')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400262 os.system('scp ' + ONOSUser + '@' + nodeIpList[0] +
jenkins8ba10ab2015-03-24 10:31:31 -0700263 ':' + tsharkRoleOutput + ' /tmp/')
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400264 os.system('scp ' + ONOSUser + '@' + nodeIpList[0] +
jenkins8ba10ab2015-03-24 10:31:31 -0700265 ':' + tsharkFeatureOutput + ' /tmp/')
266 os.system('scp ' + ONOSUser + '@' +
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400267 nodeIpList[0] + ':' + tsharkOfOutput + ' /tmp/')
jenkins8ba10ab2015-03-24 10:31:31 -0700268
269 # Get tcp syn / ack output
jenkins7ead5a82015-03-13 10:28:21 -0700270 time.sleep(5)
271 tcpFile = open(tsharkTcpOutput, 'r')
272 tempText = tcpFile.readline()
273 tempText = tempText.split(' ')
274 main.log.info('Object read in from TCP capture: ' +
275 str(tempText))
276
277 if len(tempText) > 1:
278 t0Tcp = float(tempText[1]) * 1000.0
279 else:
280 main.log.error('Tshark output file for TCP' +
281 ' returned unexpected results')
282 t0Tcp = 0
283 assertion = main.FALSE
284 tcpFile.close()
jenkins8ba10ab2015-03-24 10:31:31 -0700285
286 # Get Role reply output
jenkins7ead5a82015-03-13 10:28:21 -0700287 time.sleep(5)
288 ofFile = open(tsharkOfOutput, 'r')
289 lineOfp = ''
290 while True:
291 tempText = ofFile.readline()
292 if tempText != '':
293 lineOfp = tempText
294 else:
295 break
jenkins7ead5a82015-03-13 10:28:21 -0700296 obj = lineOfp.split(' ')
297 main.log.info('Object read in from OFP capture: ' +
298 str(lineOfp))
299 if len(obj) > 1:
300 t0Ofp = float(obj[1]) * 1000.0
301 else:
302 main.log.error('Tshark output file for OFP' +
303 ' returned unexpected results')
304 t0Ofp = 0
305 assertion = main.FALSE
306 ofFile.close()
jenkins8ba10ab2015-03-24 10:31:31 -0700307
308 # Get role request output
309 roleFile = open(tsharkRoleOutput, 'r')
310 tempText = roleFile.readline()
311 tempText = tempText.split(' ')
312 if len(tempText) > 1:
313 main.log.info('Object read in from role request capture:' +
314 str(tempText))
315 roleTimestamp = float(tempText[1]) * 1000.0
316 else:
317 main.log.error('Tshark output file for role request' +
318 ' returned unexpected results')
319 timeRoleRequest = 0
320 assertion = main.FALSE
321 roleFile.close()
322
323 # Get feature reply output
324 featureFile = open(tsharkFeatureOutput, 'r')
325 tempText = featureFile.readline()
326 tempText = tempText.split(' ')
327 if len(tempText) > 1:
328 main.log.info('Object read in from feature reply capture: '+
329 str(tempText))
330 featureTimestamp = float(tempText[1]) * 1000.0
331 else:
332 main.log.error('Tshark output file for feature reply' +
333 ' returned unexpected results')
334 timeFeatureReply = 0
335 assertion = main.FALSE
336 featureFile.close()
337
338 # TODO: calculate feature reply, role request times
339 # stack measurements correctly and report
340
jenkins8ba10ab2015-03-24 10:31:31 -0700341 #TODO: Refactor in progress
342
343 for node in range(0, clusterCount):
344 nodeNum = node+1
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400345 metricsSwUp = CLIs[node].topologyEventsMetrics
jenkins8ba10ab2015-03-24 10:31:31 -0700346 jsonStr = metricsSwUp()
347 jsonObj = json.loads(jsonStr)
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400348 if jsonObj:
349 graphTimestamp = jsonObj[graphTimestampKey]['value']
350 deviceTimestamp = jsonObj[deviceTimestampKey]['value']
jenkins8ba10ab2015-03-24 10:31:31 -0700351 else:
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400352 main.log.error( "Unexpected JSON object" )
353 # If we could not obtain the JSON object,
354 # set the timestamps to 0, which will be
355 # excluded from the measurement later on
356 # (realized as invalid)
357 graphTimestamp = 0
358 deviceTimestamp = 0
359
360 endToEnd = int(graphTimestamp) - int(t0Tcp)
361
362 # Below are measurement breakdowns of the end-to-end
363 # measurement.
364 tcpToFeature = int(featureTimestamp) - int(t0Tcp)
365 featureToRole = int(roleTimestamp) - int(featureTimestamp)
366 roleToOfp = int(t0Ofp) - int(roleTimestamp)
367 ofpToDevice = int(deviceTimestamp) - int(t0Ofp)
368 deviceToGraph = float(graphTimestamp) - float(deviceTimestamp)
369
370 if endToEnd > thresholdMin and\
371 endToEnd < thresholdMax and i >= iterIgnore:
372 endToEndLatNodeIter[node][i] = endToEnd
373 main.log.info("ONOS "+str(nodeNum)+ " end-to-end: "+
374 str(endToEnd) + " ms")
375 else:
376 main.log.info("ONOS "+str(nodeNum)+ " end-to-end "+
jenkins8ba10ab2015-03-24 10:31:31 -0700377 "measurement ignored due to excess in "+
378 "threshold or premature iteration")
379
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400380 if tcpToFeature > thresholdMin and\
381 tcpToFeature < thresholdMax and i >= iterIgnore:
382 tcpToFeatureLatNodeIter[node][i] = tcpToFeature
383 main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature: "+
384 str(tcpToFeature) + " ms")
jenkins8ba10ab2015-03-24 10:31:31 -0700385 else:
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400386 main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature "+
jenkins8ba10ab2015-03-24 10:31:31 -0700387 "measurement ignored due to excess in "+
388 "threshold or premature iteration")
389
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400390 if featureToRole > thresholdMin and\
391 featureToRole < thresholdMax and i >= iterIgnore:
392 featureToRoleRequestLatNodeIter[node][i] = featureToRole
393 main.log.info("ONOS "+str(nodeNum)+ " feature-to-role: "+
394 str(featureToRole) + " ms")
jenkins8ba10ab2015-03-24 10:31:31 -0700395 else:
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400396 main.log.info("ONOS "+str(nodeNum)+ " feature-to-role "+
jenkins8ba10ab2015-03-24 10:31:31 -0700397 "measurement ignored due to excess in "+
398 "threshold or premature iteration")
399
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400400 if roleToOfp > thresholdMin and\
401 roleToOfp < thresholdMax and i >= iterIgnore:
402 roleRequestToRoleReplyLatNodeIter[node][i] = roleToOfp
403 main.log.info("ONOS "+str(nodeNum)+ " role-to-reply: "+
404 str(roleToOfp) + " ms")
405 else:
406 main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+
407 "measurement ignored due to excess in "+
408 "threshold or premature iteration")
409
410 if ofpToDevice > thresholdMin and\
411 ofpToDevice < thresholdMax and i >= iterIgnore:
412 roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice
413 main.log.info("ONOS "+str(nodeNum)+ " reply-to-device: "+
414 str(ofpToDevice) + " ms")
415 else:
416 main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+
417 "measurement ignored due to excess in "+
418 "threshold or premature iteration")
jenkins8ba10ab2015-03-24 10:31:31 -0700419
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400420 if deviceToGraph > thresholdMin and\
421 deviceToGraph < thresholdMax and i >= iterIgnore:
422 deviceToGraphLatNodeIter[node][i] = deviceToGraph
423 main.log.info("ONOS "+str(nodeNum)+ " device-to-graph: "+
424 str(deviceToGraph) + " ms")
425 else:
426 main.log.info("ONOS "+str(nodeNum)+ " device=to-graph "+
427 "measurement ignored due to excess in "+
428 "threshold or premature iteration")
429
jenkins8ba10ab2015-03-24 10:31:31 -0700430 # ********************
jenkins7ead5a82015-03-13 10:28:21 -0700431 time.sleep(5)
432
433 # Get device id to remove
434 deviceIdJsonStr = main.ONOS1cli.devices()
435
436 main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) )
437 deviceId = json.loads(deviceIdJsonStr)
438
439 deviceList = []
440 for device in deviceId:
441 deviceList.append(device['id'])
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400442
443 # TODO: Measure switch down metrics
444 # TCP FIN/ACK -> TCP FIN
445 # TCP FIN -> Device Event
446 # Device Event -> Graph Event
447
jenkins7ead5a82015-03-13 10:28:21 -0700448 main.step('Remove switch from controller')
449 main.Mininet1.deleteSwController('s3')
450
451 #firstDevice = deviceList[0]
452 firstDevice = "of:0000000000000003"
453 main.log.info( "Removing device " +str(firstDevice)+
454 " from ONOS" )
455 #if deviceId:
456 main.ONOS1cli.deviceRemove(firstDevice)
457
458 time.sleep(5)
459
460 endToEndAvg = 0
461 ofpToGraphAvg = 0
jenkins7ead5a82015-03-13 10:28:21 -0700462 dbCmdList = []
463 for node in range(0, clusterCount):
jenkins8ba10ab2015-03-24 10:31:31 -0700464 # List of latency for each node
465 endToEndList = []
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400466
jenkins8ba10ab2015-03-24 10:31:31 -0700467 tcpToFeatureList = []
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400468 featureToRoleList = []
469 roleToOfpList = []
470 ofpToDeviceList = []
471 deviceToGraphList = []
jenkins8ba10ab2015-03-24 10:31:31 -0700472
473 # LatNodeIter 2d arrays contain all iteration latency
474 # for each node of the current scale cluster size
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400475
476 # TODO: Use the new breakdown latency lists
jenkins8ba10ab2015-03-24 10:31:31 -0700477
jenkins7ead5a82015-03-13 10:28:21 -0700478 for item in endToEndLatNodeIter[node]:
479 if item > 0.0:
480 endToEndList.append(item)
481
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400482 for item in tcpToFeatureLatNodeIter[node]:
jenkins8ba10ab2015-03-24 10:31:31 -0700483 if item > 0.0:
484 tcpToFeatureList.append(item)
485
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400486 for item in featureToRoleRequestLatNodeIter[node]:
jenkins8ba10ab2015-03-24 10:31:31 -0700487 if item > 0.0:
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400488 featureToRoleList.append(item)
489
490 for item in roleRequestToRoleReplyLatNodeIter[node]:
491 if item > 0.0:
492 roleToOfpList.append(item)
493
494 for item in roleReplyToDeviceLatNodeIter[node]:
495 if item > 0.0:
496 ofpToDeviceList.append(item)
497
498 for item in deviceToGraphLatNodeIter[node]:
499 if item > 0.0:
500 deviceToGraphList.append(item)
jenkins8ba10ab2015-03-24 10:31:31 -0700501
jenkins7ead5a82015-03-13 10:28:21 -0700502 endToEndAvg = round(numpy.mean(endToEndList), 2)
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400503 endToEndStdDev = round(numpy.std(endToEndList), 2)
504
jenkins8ba10ab2015-03-24 10:31:31 -0700505 tcpToFeatureAvg = round(numpy.mean(tcpToFeatureList), 2)
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400506 tcpToFeatureStdDev = round(numpy.std(tcpToFeatureList), 2)
507
508 featureToRoleAvg = round(numpy.mean(featureToRoleList), 2)
509 featureToRoleStdDev = round(numpy.std(featureToRoleList), 2)
510
511 roleToOfpAvg = round(numpy.mean(roleToOfpList), 2)
512 roleToOfpStdDev = round(numpy.std(roleToOfpList), 2)
513
jenkins7ead5a82015-03-13 10:28:21 -0700514 ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2)
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400515 ofpToDeviceStdDev = round(numpy.std(ofpToDeviceList), 2)
516
517 deviceToGraphAvg = round(numpy.mean(deviceToGraphList), 2)
518 deviceToGraphStdDev = round(numpy.std(deviceToGraphList), 2)
519
jenkins7ead5a82015-03-13 10:28:21 -0700520 main.log.report(' - Node ' + str(node + 1) + ' Summary - ')
521 main.log.report(' End-to-end Avg: ' + str(endToEndAvg) +
522 ' ms' + ' End-to-end Std dev: ' +
andrew@onlab.us0f468c42015-04-02 17:05:47 -0400523 str(endToEndStdDev) + ' ms')
524
525 main.log.report(' Tcp-to-feature-reply Avg: ' +
526 str(tcpToFeatureAvg) + ' ms')
527 main.log.report(' Tcp-to-feature-reply Std dev: '+
528 str(tcpToFeatureStdDev) + ' ms')
529
530 main.log.report(' Feature-reply-to-role-request Avg: ' +
531 str(featureToRoleAvg) + ' ms')
532 main.log.report(' Feature-reply-to-role-request Std Dev: ' +
533 str(featureToRoleStdDev) + ' ms')
534
535 main.log.report(' Role-request-to-role-reply Avg: ' +
536 str(roleToOfpAvg) +' ms')
537 main.log.report(' Role-request-to-role-reply Std dev: ' +
538 str(roleToOfpStdDev) + ' ms')
539
540 main.log.report(' Role-reply-to-device Avg: ' +
541 str(ofpToDeviceAvg) +' ms')
542 main.log.report(' Role-reply-to-device Std dev: ' +
543 str(ofpToDeviceStdDev) + ' ms')
544
545 main.log.report(' Device-to-graph Avg: ' +
546 str(deviceToGraphAvg) + ' ms')
547 main.log.report( 'Device-to-graph Std dev: ' +
548 str(deviceToGraphStdDev) + ' ms')
549
jenkins7ead5a82015-03-13 10:28:21 -0700550 dbCmdList.append(
551 "INSERT INTO switch_latency_tests VALUES('" +
552 timeToPost + "','switch_latency_results'," +
553 runNum + ',' + str(clusterCount) + ",'baremetal" +
554 str(node + 1) + "'," + str(endToEndAvg) + ',' +
555 str(endToEndStd) + ',0,0);')
556
557 if debugMode == 'on':
558 main.ONOS1.cpLogsToDir('/opt/onos/log/karaf.log',
559 '/tmp/', copyFileName='sw_lat_karaf')
560 fResult = open(resultPath, 'a')
561 for line in dbCmdList:
562 if line:
563 fResult.write(line + '\n')
564
565 fResult.close()
566 assertion = main.TRUE
567 utilities.assert_equals(expect=main.TRUE, actual=assertion,
568 onpass='Switch latency test successful',
569 onfail='Switch latency test failed')
570
571 def CASE3(self, main):
572 """
573 Bring port up / down and measure latency.
574 Port enable / disable is simulated by ifconfig up / down
575
576 In ONOS-next, we must ensure that the port we are
577 manipulating is connected to another switch with a valid
578 connection. Otherwise, graph view will not be updated.
579 """
580 global timeToPost
581 import time
582 import subprocess
583 import os
584 import requests
585 import json
586 import numpy
587 ONOS1Ip = main.params['CTRL']['ip1']
588 ONOS2Ip = main.params['CTRL']['ip2']
589 ONOS3Ip = main.params['CTRL']['ip3']
590 ONOSUser = main.params['CTRL']['user']
591 defaultSwPort = main.params['CTRL']['port1']
592 assertion = main.TRUE
593 numIter = main.params['TEST']['numIter']
594 iterIgnore = int(main.params['TEST']['iterIgnore'])
595 deviceTimestamp = main.params['JSON']['deviceTimestamp']
596 graphTimestamp = main.params['JSON']['graphTimestamp']
597 linkTimestamp = main.params['JSON']['linkTimestamp']
598
599 tsharkPortUp = '/tmp/tshark_port_up.txt'
600 tsharkPortDown = '/tmp/tshark_port_down.txt'
601 tsharkPortStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ]
602
603 debugMode = main.params['TEST']['debugMode']
604 postToDB = main.params['DB']['postToDB']
605 resultPath = main.params['DB']['portEventResultPath']
606 timeToPost = time.strftime('%Y-%m-%d %H:%M:%S')
607 localTime = time.strftime('%x %X')
608 localTime = localTime.replace('/', '')
609 localTime = localTime.replace(' ', '_')
610 localTime = localTime.replace(':', '')
611
612 if debugMode == 'on':
613 main.ONOS1.tsharkPcap('eth0', '/tmp/port_lat_pcap_' + localTime)
614
615 upThresholdStr = main.params['TEST']['portUpThreshold']
616 downThresholdStr = main.params['TEST']['portDownThreshold']
617 upThresholdObj = upThresholdStr.split(',')
618 downThresholdObj = downThresholdStr.split(',')
619 upThresholdMin = int(upThresholdObj[0])
620 upThresholdMax = int(upThresholdObj[1])
621 downThresholdMin = int(downThresholdObj[0])
622 downThresholdMax = int(downThresholdObj[1])
623
624 interfaceConfig = 's1-eth1'
625 main.log.report('Port enable / disable latency')
626 main.log.report('Simulated by ifconfig up / down')
627 main.log.report('Total iterations of test: ' + str(numIter))
628 main.step('Assign switches s1 and s2 to controller 1')
629
630 main.Mininet1.assignSwController(sw='1',
631 ip1=ONOS1Ip, port1=defaultSwPort)
632 main.Mininet1.assignSwController(sw='2',
633 ip1=ONOS1Ip, port1=defaultSwPort)
634
635 time.sleep(15)
636
637 portUpDeviceToOfpList = []
638 portUpGraphToOfpList = []
639 portDownDeviceToOfpList = []
640 portDownGraphToOfpList = []
641
642 portUpDevNodeIter = numpy.zeros((clusterCount, int(numIter)))
643 portUpGraphNodeIter = numpy.zeros((clusterCount, int(numIter)))
644 portUpLinkLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
645 portDownDevNodeIter = numpy.zeros((clusterCount, int(numIter)))
646 portDownGraphNodeIter = numpy.zeros((clusterCount, int(numIter)))
647 portDownLinkNodeIter = numpy.zeros((clusterCount, int(numIter)))
648 portUpLinkNodeIter = numpy.zeros((clusterCount, int(numIter)))
649
650 for i in range(0, int(numIter)):
651 main.step('Starting wireshark capture for port status down')
652 main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortDown)
653 time.sleep(5)
654 main.step('Disable port: ' + interfaceConfig)
655 main.Mininet1.handle.sendline('sh ifconfig ' +
656 interfaceConfig + ' down')
657 main.Mininet1.handle.expect('mininet>')
658 time.sleep(3)
659 main.ONOS1.tsharkStop()
660 os.system('scp ' + ONOSUser + '@' + ONOS1Ip + ':' +
661 tsharkPortDown + ' /tmp/')
662 fPortDown = open(tsharkPortDown, 'r')
663 fLine = fPortDown.readline()
664 objDown = fLine.split(' ')
665 if len(fLine) > 0:
666 timestampBeginPtDown = int(float(objDown[1]) * 1000)
667 if timestampBeginPtDown < 1400000000000:
668 timestampBeginPtDown = int(float(objDown[2]) * 1000)
669 main.log.info('Port down begin timestamp: ' +
670 str(timestampBeginPtDown))
671 else:
672 main.log.info('Tshark output file returned unexpected' +
673 ' results: ' + str(objDown))
674 timestampBeginPtDown = 0
675 fPortDown.close()
jenkins8ba10ab2015-03-24 10:31:31 -0700676
677 """
678 # TODO: Refactor in progress
679
680 for node in range(0, clusterCount):
681 nodeNum = node+1
682 exec "metricsDown = main.ONOS%scli.topologyEventsMetrics"%str(nodeNum)
683 jsonStrDown = metricsDown()
684 jsonObj = json.loads(jsonStrDown)
685
686 graphTimestamp = jsonObj[graphTimestamp]['value']
687 deviceTimestamp = jsonObj[deviceTimestamp]['value']
688 linkTimestamp = jsonObj[linkTimestamp]['value']
689
690 ptDownGraphToOfp = int(graphTimestamp) - int(timestampBeginPtDown)
691 ptDownDeviceToOfp = int(deviceTimestamp) - int(timestampBeginPtDown)
692 ptDownLinkToOfp = int(linkTimestamp) - int(timestampBeginPtDown)
693
694 if ptDownGraphToOfp > downThresholdMin and\
695 ptDownGraphToOfp < downThresholdMax and i > iterIgnore:
696 portDownGraphNodeIter[node][i] = ptDownGraphToOfp
697 main.log.info("ONOS "+str(nodeNum)+
698 " port down graph-to-ofp: "+
699 str(ptDownGraphToOfp) + " ms")
700 else:
701 main.log.info("ONOS "+str(nodeNum)+
702 " port down graph-to-ofp ignored"+
703 " due to excess in threshold or premature iteration")
704
705 if ptDownDeviceToOfp > downThresholdMin and\
706 ptDownDeviceToOfp < downThresholdMax and i > iterIgnore:
707 portDownDeviceNodeIter[node][i] = ptDownDeviceToOfp
708 main.log.info("ONOS "+str(nodeNum)+
709 " port down device-to-ofp: "+
710 str(ptDownDeviceToOfp) + " ms")
711 else:
712 main.log.info("ONOS "+str(nodeNum)+
713 " port down device-to-ofp ignored"+
714 " due to excess in threshold or premature iteration")
715
716 if ptDownLinkToOfp > downThresholdMin and\
717 ptDownLinkToOfp < downThresholdMax and i > iterIgnore:
718 portDownLinkNodeIter[node][i] = ptDownLinkToOfp
719 main.log.info("ONOS "+str(nodeNum)+
720 " port down link-to-ofp: "+
721 str(ptDownLinkToOfp) + " ms")
722 else:
723 main.log.info("ONOS "+str(nodeNum)+
724 " port down link-to-ofp ignored"+
725 " due to excess in threshold or premature iteration")
726 """
727 # *************************
728
jenkins7ead5a82015-03-13 10:28:21 -0700729 main.step('Obtain t1 by metrics call')
730
731 jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics()
732 jsonObj1 = json.loads(jsonStrUp1)
733 graphTimestamp1 = jsonObj1[graphTimestamp]['value']
734 deviceTimestamp1 = jsonObj1[deviceTimestamp]['value']
735 linkTimestamp1 = jsonObj1[linkTimestamp]['value']
736 ptDownGraphToOfp1 = int(graphTimestamp1) - int(timestampBeginPtDown)
737 ptDownDeviceToOfp1 = int(deviceTimestamp1) - int(timestampBeginPtDown)
738 ptDownLinkToOfp1 = int(linkTimestamp1) - int(timestampBeginPtDown)
jenkins8ba10ab2015-03-24 10:31:31 -0700739
jenkins7ead5a82015-03-13 10:28:21 -0700740 if ptDownGraphToOfp1 > downThresholdMin and\
741 ptDownGraphToOfp1 < downThresholdMax and i > iterIgnore:
742 portDownGraphNodeIter[0][i] = ptDownGraphToOfp1
743 main.log.info('ONOS1 iter' + str(i) +
744 ' port down graph-to-ofp: ' +
745 str(ptDownGraphToOfp1) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -0700746
jenkins7ead5a82015-03-13 10:28:21 -0700747 if ptDownDeviceToOfp1 > downThresholdMin and \
748 ptDownDeviceToOfp1 < downThresholdMax and i > iterIgnore:
749 portDownDevNodeIter[0][i] = ptDownDeviceToOfp1
750 main.log.info('ONOS1 iter' + str(i) +
751 ' port down device-to-ofp: ' +
752 str(ptDownDeviceToOfp1) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -0700753 if ptDownLinkToOfp1 > downThresholdMin and\
754 ptDownLinkToOfp1 < downThresholdMax and i > iterIgnore:
755 portDownLinkNodeIter[0][i] = ptDownLinkToOfp1
756 main.log.info('ONOS1 iter' + str(i) +
757 ' port down link-to-ofp: ' +
758 str(ptDownLinkToOfp1) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -0700759
jenkins7ead5a82015-03-13 10:28:21 -0700760 if clusterCount >= 3:
761 jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics()
762 jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics()
763 jsonObj2 = json.loads(jsonStrUp2)
764 jsonObj3 = json.loads(jsonStrUp3)
765 graphTimestamp2 = jsonObj2[graphTimestamp]['value']
766 graphTimestamp3 = jsonObj3[graphTimestamp]['value']
767 deviceTimestamp2 = jsonObj2[deviceTimestamp]['value']
768 deviceTimestamp3 = jsonObj3[deviceTimestamp]['value']
769 linkTimestamp2 = jsonObj2[linkTimestamp]['value']
770 linkTimestamp3 = jsonObj3[linkTimestamp]['value']
771 ptDownGraphToOfp2 = int(graphTimestamp2) - int(timestampBeginPtDown)
772 ptDownGraphToOfp3 = int(graphTimestamp3) - int(timestampBeginPtDown)
773 ptDownDeviceToOfp2 = int(deviceTimestamp2) - int(timestampBeginPtDown)
774 ptDownDeviceToOfp3 = int(deviceTimestamp3) - int(timestampBeginPtDown)
775 ptDownLinkToOfp2 = int(linkTimestamp2) - int(timestampBeginPtDown)
776 ptDownLinkToOfp3 = int(linkTimestamp3) - int(timestampBeginPtDown)
777 if ptDownGraphToOfp2 > downThresholdMin and\
778 ptDownGraphToOfp2 < downThresholdMax and i > iterIgnore:
779 portDownGraphNodeIter[1][i] = ptDownGraphToOfp2
780 main.log.info('ONOS2 iter' + str(i) +
781 ' graph-to-ofp: ' +
782 str(ptDownGraphToOfp2) + ' ms')
783 if ptDownDeviceToOfp2 > downThresholdMin and \
784 ptDownDeviceToOfp2 < downThresholdMax and i > iterIgnore:
785 portDownDevNodeIter[1][i] = ptDownDeviceToOfp2
786 main.log.info('ONOS2 iter' + str(i) +
787 ' device-to-ofp: ' +
788 str(ptDownDeviceToOfp2) + ' ms')
789 if ptDownLinkToOfp2 > downThresholdMin and\
790 ptDownLinkToOfp2 < downThresholdMax and i > iterIgnore:
791 portDownLinkNodeIter[1][i] = ptDownLinkToOfp2
792 main.log.info('ONOS2 iter' + str(i) +
793 ' link-to-ofp: ' +
794 str(ptDownLinkToOfp2) + ' ms')
795 if ptDownGraphToOfp3 > downThresholdMin and\
796 ptDownGraphToOfp3 < downThresholdMax and i > iterIgnore:
797 portDownGraphNodeIter[2][i] = ptDownGraphToOfp3
798 main.log.info('ONOS3 iter' + str(i) +
799 ' graph-to-ofp: ' +
800 str(ptDownGraphToOfp3) + ' ms')
801 if ptDownDeviceToOfp3 > downThresholdMin and\
802 ptDownDeviceToOfp3 < downThresholdMax and i > iterIgnore:
803 portDownDevNodeIter[2][i] = ptDownDeviceToOfp3
804 main.log.info('ONOS3 iter' + str(i) +
805 ' device-to-ofp: ' +
806 str(ptDownDeviceToOfp3) + ' ms')
807 if ptDownLinkToOfp3 > downThresholdMin and\
808 ptDownLinkToOfp3 < downThresholdMax and i > iterIgnore:
809 portDownLinkNodeIter[2][i] = ptDownLinkToOfp3
810 main.log.info('ONOS3 iter' + str(i) +
811 ' link-to-ofp: ' +
812 str(ptDownLinkToOfp3) + ' ms')
813 if clusterCount >= 5:
814 jsonStrUp4 = main.ONOS4cli.topologyEventsMetrics()
815 jsonStrUp5 = main.ONOS5cli.topologyEventsMetrics()
816 jsonObj4 = json.loads(jsonStrUp4)
817 jsonObj5 = json.loads(jsonStrUp5)
818 graphTimestamp4 = jsonObj4[graphTimestamp]['value']
819 graphTimestamp5 = jsonObj5[graphTimestamp]['value']
820 deviceTimestamp4 = jsonObj4[deviceTimestamp]['value']
821 deviceTimestamp5 = jsonObj5[deviceTimestamp]['value']
822 linkTimestamp4 = jsonObj4[linkTimestamp]['value']
823 linkTimestamp5 = jsonObj5[linkTimestamp]['value']
824 ptDownGraphToOfp4 = int(graphTimestamp4) - int(timestampBeginPtDown)
825 ptDownGraphToOfp5 = int(graphTimestamp5) - int(timestampBeginPtDown)
826 ptDownDeviceToOfp4 = int(deviceTimestamp4) - int(timestampBeginPtDown)
827 ptDownDeviceToOfp5 = int(deviceTimestamp5) - int(timestampBeginPtDown)
828 ptDownLinkToOfp4 = int(linkTimestamp4) - int(timestampBeginPtDown)
829 ptDownLinkToOfp5 = int(linkTimestamp5) - int(timestampBeginPtDown)
830 if ptDownGraphToOfp4 > downThresholdMin and \
831 ptDownGraphToOfp4 < downThresholdMax and i > iterIgnore:
832 portDownGraphNodeIter[3][i] = ptDownGraphToOfp4
833 main.log.info('ONOS4 iter' + str(i) +
834 ' graph-to-ofp: ' +
835 str(ptDownGraphToOfp4) + ' ms')
836 if ptDownDeviceToOfp4 > downThresholdMin and\
837 ptDownDeviceToOfp4 < downThresholdMax and i > iterIgnore:
838 portDownDevNodeIter[3][i] = ptDownDeviceToOfp4
839 main.log.info('ONOS4 iter' + str(i) +
840 ' device-to-ofp: ' +
841 str(ptDownDeviceToOfp4) + ' ms')
842 if ptDownLinkToOfp4 > downThresholdMin and\
843 ptDownLinkToOfp4 < downThresholdMax and i > iterIgnore:
844 portDownLinkNodeIter[3][i] = ptDownLinkToOfp4
845 main.log.info('ONOS4 iter' + str(i) +
846 ' link-to-ofp: ' +
847 str(ptDownLinkToOfp4) + ' ms')
848 if ptDownGraphToOfp5 > downThresholdMin and\
849 ptDownGraphToOfp5 < downThresholdMax and i > iterIgnore:
850 portDownGraphNodeIter[4][i] = ptDownGraphToOfp5
851 main.log.info('ONOS5 iter' + str(i) +
852 ' graph-to-ofp: ' +
853 str(ptDownGraphToOfp5) + ' ms')
854 if ptDownDeviceToOfp5 > downThresholdMin and\
855 ptDownDeviceToOfp5 < downThresholdMax and i > iterIgnore:
856 portDownDevNodeIter[4][i] = ptDownDeviceToOfp5
857 main.log.info('ONOS5 iter' + str(i) +
858 ' device-to-ofp: ' +
859 str(ptDownDeviceToOfp5) + ' ms')
860 if ptDownLinkToOfp5 > downThresholdMin and\
861 ptDownLinkToOfp5 < downThresholdMax and i > iterIgnore:
862 portDownLinkNodeIter[4][i] = ptDownLinkToOfp5
863 main.log.info('ONOS5 iter' + str(i) +
864 ' link-to-ofp: ' +
865 str(ptDownLinkToOfp5) + ' ms')
866 if clusterCount >= 7:
867 jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics()
868 jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics()
869 jsonObj6 = json.loads(jsonStrUp6)
870 jsonObj7 = json.loads(jsonStrUp7)
871 graphTimestamp6 = jsonObj6[graphTimestamp]['value']
872 graphTimestamp7 = jsonObj7[graphTimestamp]['value']
873 deviceTimestamp6 = jsonObj6[deviceTimestamp]['value']
874 deviceTimestamp7 = jsonObj7[deviceTimestamp]['value']
875 linkTimestamp6 = jsonObj6[linkTimestamp]['value']
876 linkTimestamp7 = jsonObj7[linkTimestamp]['value']
877 ptDownGraphToOfp6 = int(graphTimestamp6) - int(timestampBeginPtDown)
878 ptDownGraphToOfp7 = int(graphTimestamp7) - int(timestampBeginPtDown)
879 ptDownDeviceToOfp6 = int(deviceTimestamp6) - int(timestampBeginPtDown)
880 ptDownDeviceToOfp7 = int(deviceTimestamp7) - int(timestampBeginPtDown)
881 ptDownLinkToOfp6 = int(linkTimestamp6) - int(timestampBeginPtDown)
882 ptDownLinkToOfp7 = int(linkTimestamp7) - int(timestampBeginPtDown)
883 if ptDownGraphToOfp6 > downThresholdMin and\
884 ptDownGraphToOfp6 < downThresholdMax and i > iterIgnore:
885 portDownGraphNodeIter[5][i] = ptDownGraphToOfp6
886 main.log.info('ONOS6 iter' + str(i) +
887 ' graph-to-ofp: ' +
888 str(ptDownGraphToOfp6) + ' ms')
889 if ptDownDeviceToOfp6 > downThresholdMin and\
890 ptDownDeviceToOfp6 < downThresholdMax and i > iterIgnore:
891 portDownDevNodeIter[5][i] = ptDownDeviceToOfp6
892 main.log.info('ONOS6 iter' + str(i) +
893 ' device-to-ofp: ' +
894 str(ptDownDeviceToOfp6) + ' ms')
895 if ptDownLinkToOfp6 > downThresholdMin and\
896 ptDownLinkToOfp6 < downThresholdMax and i > iterIgnore:
897 portDownLinkNodeIter[5][i] = ptDownLinkToOfp6
898 main.log.info('ONOS6 iter' + str(i) +
899 ' link-to-ofp: ' +
900 str(ptDownLinkToOfp6) + ' ms')
901 if ptDownGraphToOfp7 > downThresholdMin and\
902 ptDownGraphToOfp7 < downThresholdMax and i > iterIgnore:
903 portDownGraphNodeIter[6][i] = ptDownGraphToOfp7
904 main.log.info('ONOS7 iter' + str(i) +
905 ' graph-to-ofp: ' +
906 str(ptDownGraphToOfp7) + ' ms')
907 if ptDownDeviceToOfp7 > downThresholdMin and\
908 ptDownDeviceToOfp7 < downThresholdMax and i > iterIgnore:
909 portDownDevNodeIter[6][i] = ptDownDeviceToOfp7
910 main.log.info('ONOS7 iter' + str(i) +
911 ' device-to-ofp: ' +
912 str(ptDownDeviceToOfp7) + ' ms')
913 if ptDownLinkToOfp7 > downThresholdMin and\
914 ptDownLinkToOfp7 < downThresholdMax and i > iterIgnore:
915 portDownLinkNodeIter[6][i] = ptDownLinkToOfp7
916 main.log.info('ONOS7 iter' + str(i) +
917 ' link-to-ofp: ' +
918 str(ptDownLinkToOfp7) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -0700919
jenkins7ead5a82015-03-13 10:28:21 -0700920 time.sleep(3)
921
922 main.step('Starting wireshark capture for port status up')
923 main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortUp)
924
925 time.sleep(5)
926 main.step('Enable port and obtain timestamp')
927 main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up')
928 main.Mininet1.handle.expect('mininet>')
929
930 time.sleep(5)
931 main.ONOS1.tsharkStop()
932
933 time.sleep(3)
934 os.system('scp ' + ONOSUser + '@' +
935 ONOS1Ip + ':' + tsharkPortUp + ' /tmp/')
936
937 fPortUp = open(tsharkPortUp, 'r')
938 fLine = fPortUp.readline()
939 objUp = fLine.split(' ')
940 if len(fLine) > 0:
941 timestampBeginPtUp = int(float(objUp[1]) * 1000)
942 if timestampBeginPtUp < 1400000000000:
943 timestampBeginPtUp = int(float(objUp[2]) * 1000)
944 main.log.info('Port up begin timestamp: ' + str(timestampBeginPtUp))
945 else:
946 main.log.info('Tshark output file returned unexpected' + ' results.')
947 timestampBeginPtUp = 0
948 fPortUp.close()
jenkins8ba10ab2015-03-24 10:31:31 -0700949 """
950 # TODO: Refactoring in progress
951
952 for node in range(0, clusterCount):
953 nodeNum = node+1
954 exec "metricsUp = main.ONOS%scli.topologyEventsMetrics"%str(nodeNum)
955 jsonStrUp = metricsUp()
956 jsonObj = json.loads(jsonStrUp)
957
958 print jsonObj
959
960 graphTimestamp = jsonObj[graphTimestamp]['value']
961 deviceTimestamp = jsonObj[deviceTimestamp]['value']
962 linkTimestamp = jsonObj[linkTimestamp]['value']
963
964 ptUpGraphToOfp = int(graphTimestamp) - int(timestampBeginPtUp)
965 ptUpDeviceToOfp = int(deviceTimestamp) - int(timestampBeginPtUp)
966 ptUpLinkToOfp = int(linkTimestamp) - int(timestampBeginPtUp)
967
968 if ptUpGraphToOfp > upThresholdMin and\
969 ptUpGraphToOfp < upThresholdMax and i > iterIgnore:
970 portUpGraphNodeIter[node][i] = ptUpGraphToOfp
971 main.log.info("ONOS "+str(nodeNum)+
972 " port up graph-to-ofp: "+
973 str(ptUpGraphToOfp) + " ms")
974 else:
975 main.log.info("ONOS "+str(nodeNum)+
976 " port up graph-to-ofp ignored"+
977 " due to excess in threshold or premature iteration")
978
979 if ptUpDeviceToOfp > upThresholdMin and\
980 ptUpDeviceToOfp < upThresholdMax and i > iterIgnore:
981 portUpDeviceNodeIter[node][i] = ptUpDeviceToOfp
982 main.log.info("ONOS "+str(nodeNum)+
983 " port up device-to-ofp: "+
984 str(ptUpDeviceToOfp) + " ms")
985 else:
986 main.log.info("ONOS "+str(nodeNum)+
987 " port up device-to-ofp ignored"+
988 " due to excess in threshold or premature iteration")
989
990 if ptUpLinkToOfp > upThresholdMin and\
991 ptUpLinkToOfp < upThresholdMax and i > iterIgnore:
992 portUpLinkNodeIter[node][i] = ptUpLinkToOfp
993 main.log.info("ONOS "+str(nodeNum)+
994 " port up link-to-ofp: "+
995 str(ptUpLinkToOfp) + " ms")
996 else:
997 main.log.info("ONOS "+str(nodeNum)+
998 " port up link-to-ofp ignored"+
999 " due to excess in threshold or premature iteration")
1000
1001 """
1002
1003 # *****************************
1004
jenkins7ead5a82015-03-13 10:28:21 -07001005 main.step('Obtain t1 by REST call')
1006 jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics()
1007 jsonObj1 = json.loads(jsonStrUp1)
1008 graphTimestamp1 = jsonObj1[graphTimestamp]['value']
1009 deviceTimestamp1 = jsonObj1[deviceTimestamp]['value']
1010 linkTimestamp1 = jsonObj1[linkTimestamp]['value']
1011 ptUpGraphToOfp1 = int(graphTimestamp1) - int(timestampBeginPtUp)
1012 ptUpDeviceToOfp1 = int(deviceTimestamp1) - int(timestampBeginPtUp)
1013 ptUpLinkToOfp1 = int(linkTimestamp1) - int(timestampBeginPtUp)
1014 if ptUpGraphToOfp1 > upThresholdMin and\
1015 ptUpGraphToOfp1 < upThresholdMax and i > iterIgnore:
1016 portUpGraphNodeIter[0][i] = ptUpGraphToOfp1
1017 main.log.info('ONOS1 iter' + str(i) +
1018 ' port up graph-to-ofp: ' +
1019 str(ptUpGraphToOfp1) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -07001020 if ptUpDeviceToOfp1 > upThresholdMin and \
1021 ptUpDeviceToOfp1 < upThresholdMax and i > iterIgnore:
1022 portUpDevNodeIter[0][i] = ptUpDeviceToOfp1
1023 main.log.info('ONOS1 iter' + str(i) +
1024 ' port up device-to-ofp: ' +
1025 str(ptUpDeviceToOfp1) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -07001026 if ptUpLinkToOfp1 > downThresholdMin and\
1027 ptUpLinkToOfp1 < downThresholdMax and i > iterIgnore:
1028 portUpLinkNodeIter[0][i] = ptUpLinkToOfp1
1029 main.log.info('ONOS1 iter' + str(i) +
1030 ' link-to-ofp: ' +
1031 str(ptUpLinkToOfp1) + ' ms')
1032 if clusterCount >= 3:
1033 jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics()
1034 jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics()
1035 jsonObj2 = json.loads(jsonStrUp2)
1036 jsonObj3 = json.loads(jsonStrUp3)
1037 graphTimestamp2 = jsonObj2[graphTimestamp]['value']
1038 graphTimestamp3 = jsonObj3[graphTimestamp]['value']
1039 deviceTimestamp2 = jsonObj2[deviceTimestamp]['value']
1040 deviceTimestamp3 = jsonObj3[deviceTimestamp]['value']
1041 linkTimestamp2 = jsonObj2[linkTimestamp]['value']
1042 linkTimestamp3 = jsonObj3[linkTimestamp]['value']
1043 ptUpGraphToOfp2 = int(graphTimestamp2) - int(timestampBeginPtUp)
1044 ptUpGraphToOfp3 = int(graphTimestamp3) - int(timestampBeginPtUp)
1045 ptUpDeviceToOfp2 = int(deviceTimestamp2) - int(timestampBeginPtUp)
1046 ptUpDeviceToOfp3 = int(deviceTimestamp3) - int(timestampBeginPtUp)
1047 ptUpLinkToOfp2 = int(linkTimestamp2) - int(timestampBeginPtUp)
1048 ptUpLinkToOfp3 = int(linkTimestamp3) - int(timestampBeginPtUp)
1049 if ptUpGraphToOfp2 > upThresholdMin and\
1050 ptUpGraphToOfp2 < upThresholdMax and i > iterIgnore:
1051 portUpGraphNodeIter[1][i] = ptUpGraphToOfp2
1052 main.log.info('ONOS2 iter' + str(i) +
1053 ' port up graph-to-ofp: ' +
1054 str(ptUpGraphToOfp2) + ' ms')
1055 if ptUpDeviceToOfp2 > upThresholdMin and\
1056 ptUpDeviceToOfp2 < upThresholdMax and i > iterIgnore:
1057 portUpDevNodeIter[1][i] = ptUpDeviceToOfp2
1058 main.log.info('ONOS2 iter' + str(i) +
1059 ' port up device-to-ofp: ' +
1060 str(ptUpDeviceToOfp2) + ' ms')
1061 if ptUpLinkToOfp2 > downThresholdMin and\
1062 ptUpLinkToOfp2 < downThresholdMax and i > iterIgnore:
1063 portUpLinkNodeIter[1][i] = ptUpLinkToOfp2
1064 main.log.info('ONOS2 iter' + str(i) +
1065 ' port up link-to-ofp: ' +
1066 str(ptUpLinkToOfp2) + ' ms')
1067 if ptUpGraphToOfp3 > upThresholdMin and\
1068 ptUpGraphToOfp3 < upThresholdMax and i > iterIgnore:
1069 portUpGraphNodeIter[2][i] = ptUpGraphToOfp3
1070 main.log.info('ONOS3 iter' + str(i) +
1071 ' port up graph-to-ofp: ' +
1072 str(ptUpGraphToOfp3) + ' ms')
1073 if ptUpDeviceToOfp3 > upThresholdMin and\
1074 ptUpDeviceToOfp3 < upThresholdMax and i > iterIgnore:
1075 portUpDevNodeIter[2][i] = ptUpDeviceToOfp3
1076 main.log.info('ONOS3 iter' + str(i) +
1077 ' port up device-to-ofp: ' +
1078 str(ptUpDeviceToOfp3) + ' ms')
1079 if ptUpLinkToOfp3 > downThresholdMin and\
1080 ptUpLinkToOfp3 < downThresholdMax and i > iterIgnore:
1081 portUpLinkNodeIter[2][i] = ptUpLinkToOfp3
1082 main.log.info('ONOS3 iter' + str(i) +
1083 ' port up link-to-ofp: ' +
1084 str(ptUpLinkToOfp3) + ' ms')
1085 if clusterCount >= 5:
1086 jsonStrUp4 = main.ONOS4cli.topologyEventsMetrics()
1087 jsonStrUp5 = main.ONOS5cli.topologyEventsMetrics()
1088 jsonObj4 = json.loads(jsonStrUp4)
1089 jsonObj5 = json.loads(jsonStrUp5)
1090 graphTimestamp4 = jsonObj4[graphTimestamp]['value']
1091 graphTimestamp5 = jsonObj5[graphTimestamp]['value']
1092 deviceTimestamp4 = jsonObj4[deviceTimestamp]['value']
1093 deviceTimestamp5 = jsonObj5[deviceTimestamp]['value']
1094 linkTimestamp4 = jsonObj4[linkTimestamp]['value']
1095 linkTimestamp5 = jsonObj5[linkTimestamp]['value']
1096 ptUpGraphToOfp4 = int(graphTimestamp4) - int(timestampBeginPtUp)
1097 ptUpGraphToOfp5 = int(graphTimestamp5) - int(timestampBeginPtUp)
1098 ptUpDeviceToOfp4 = int(deviceTimestamp4) - int(timestampBeginPtUp)
1099 ptUpDeviceToOfp5 = int(deviceTimestamp5) - int(timestampBeginPtUp)
1100 ptUpLinkToOfp4 = int(linkTimestamp4) - int(timestampBeginPtUp)
1101 ptUpLinkToOfp5 = int(linkTimestamp5) - int(timestampBeginPtUp)
1102 if ptUpGraphToOfp4 > upThresholdMin and\
1103 ptUpGraphToOfp4 < upThresholdMax and i > iterIgnore:
1104 portUpGraphNodeIter[3][i] = ptUpGraphToOfp4
1105 main.log.info('ONOS4 iter' + str(i) +
1106 ' port up graph-to-ofp: ' +
1107 str(ptUpGraphToOfp4) + ' ms')
1108 if ptUpDeviceToOfp4 > upThresholdMin and\
1109 ptUpDeviceToOfp4 < upThresholdMax and i > iterIgnore:
1110 portUpDevNodeIter[3][i] = ptUpDeviceToOfp4
1111 main.log.info('ONOS4 iter' + str(i) +
1112 ' port up device-to-ofp: ' +
1113 str(ptUpDeviceToOfp4) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -07001114 if ptUpLinkToOfp4 > downThresholdMin and\
1115 ptUpLinkToOfp4 < downThresholdMax and i > iterIgnore:
1116 portUpLinkNodeIter[3][i] = ptUpLinkToOfp4
1117 main.log.info('ONOS4 iter' + str(i) +
1118 ' port up link-to-ofp: ' +
1119 str(ptUpLinkToOfp4) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -07001120 if ptUpGraphToOfp5 > upThresholdMin and\
1121 ptUpGraphToOfp5 < upThresholdMax and i > iterIgnore:
1122 portUpGraphNodeIter[4][i] = ptUpGraphToOfp5
jenkins8ba10ab2015-03-24 10:31:31 -07001123 main.log.info('ONOS5 iter' + str(i) +
jenkins7ead5a82015-03-13 10:28:21 -07001124 ' port up graph-to-ofp: ' +
1125 str(ptUpGraphToOfp5) + ' ms')
1126 if ptUpDeviceToOfp5 > upThresholdMin and \
1127 ptUpDeviceToOfp5 < upThresholdMax and i > iterIgnore:
1128 portUpDevNodeIter[4][i] = ptUpDeviceToOfp5
1129 main.log.info('ONOS5 iter' + str(i) +
1130 ' port up device-to-ofp: ' +
1131 str(ptUpDeviceToOfp5) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -07001132 if ptUpLinkToOfp5 > downThresholdMin and\
1133 ptUpLinkToOfp5 < downThresholdMax and i > iterIgnore:
1134 portUpLinkNodeIter[4][i] = ptUpLinkToOfp5
1135 main.log.info('ONOS5 iter' + str(i) +
1136 ' port up link-to-ofp: ' +
1137 str(ptUpLinkToOfp5) + ' ms')
1138
jenkins7ead5a82015-03-13 10:28:21 -07001139 if clusterCount >= 7:
1140 jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics()
1141 jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics()
1142 jsonObj6 = json.loads(jsonStrUp6)
1143 jsonObj7 = json.loads(jsonStrUp7)
1144 graphTimestamp6 = jsonObj6[graphTimestamp]['value']
1145 graphTimestamp7 = jsonObj7[graphTimestamp]['value']
1146 deviceTimestamp6 = jsonObj6[deviceTimestamp]['value']
1147 deviceTimestamp7 = jsonObj7[deviceTimestamp]['value']
jenkins8ba10ab2015-03-24 10:31:31 -07001148 linkTimestamp6 = jsonObj6[linkTimestamp]['value']
1149 linkTimestamp7 = jsonObj7[linkTimestamp]['value']
jenkins7ead5a82015-03-13 10:28:21 -07001150 ptUpGraphToOfp6 = int(graphTimestamp6) - int(timestampBeginPtUp)
1151 ptUpGraphToOfp7 = int(graphTimestamp7) - int(timestampBeginPtUp)
1152 ptUpDeviceToOfp6 = int(deviceTimestamp6) - int(timestampBeginPtUp)
1153 ptUpDeviceToOfp7 = int(deviceTimestamp7) - int(timestampBeginPtUp)
jenkins8ba10ab2015-03-24 10:31:31 -07001154 ptUpLinkToOfp6 = int(linkTimestamp6) - int(timestampBeginPtUp)
1155 ptUpLinkToOfp7 = int(linkTimestamp7) - int(timestampBeginPtUp)
jenkins7ead5a82015-03-13 10:28:21 -07001156 if ptUpGraphToOfp6 > upThresholdMin and\
1157 ptUpGraphToOfp6 < upThresholdMax and i > iterIgnore:
1158 portUpGraphNodeIter[5][i] = ptUpGraphToOfp6
jenkins8ba10ab2015-03-24 10:31:31 -07001159 main.log.info('ONOS6 iter' + str(i) +
jenkins7ead5a82015-03-13 10:28:21 -07001160 ' port up graph-to-ofp: ' +
1161 str(ptUpGraphToOfp6) + ' ms')
1162 if ptUpDeviceToOfp6 > upThresholdMin and\
1163 ptUpDeviceToOfp6 < upThresholdMax and i > iterIgnore:
1164 portUpDevNodeIter[5][i] = ptUpDeviceToOfp6
jenkins8ba10ab2015-03-24 10:31:31 -07001165 main.log.info('ONOS6 iter' + str(i) +
jenkins7ead5a82015-03-13 10:28:21 -07001166 ' port up device-to-ofp: ' +
1167 str(ptUpDeviceToOfp6) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -07001168 if ptUpLinkToOfp6 > downThresholdMin and\
1169 ptUpLinkToOfp6 < downThresholdMax and i > iterIgnore:
1170 portUpLinkNodeIter[5][i] = ptUpLinkToOfp6
1171 main.log.info('ONOS6 iter' + str(i) +
1172 ' port up link-to-ofp: ' +
1173 str(ptUpLinkToOfp6) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -07001174 if ptUpGraphToOfp7 > upThresholdMin and \
1175 ptUpGraphToOfp7 < upThresholdMax and i > iterIgnore:
1176 portUpGraphNodeIter[6][i] = ptUpGraphToOfp7
jenkins8ba10ab2015-03-24 10:31:31 -07001177 main.log.info('ONOS7 iter' + str(i) +
jenkins7ead5a82015-03-13 10:28:21 -07001178 ' port up graph-to-ofp: ' +
1179 str(ptUpGraphToOfp7) + ' ms')
1180 if ptUpDeviceToOfp7 > upThresholdMin and\
1181 ptUpDeviceToOfp7 < upThresholdMax and i > iterIgnore:
1182 portUpDevNodeIter[6][i] = ptUpDeviceToOfp7
jenkins8ba10ab2015-03-24 10:31:31 -07001183 main.log.info('ONOS7 iter' + str(i) +
jenkins7ead5a82015-03-13 10:28:21 -07001184 ' port up device-to-ofp: ' +
1185 str(ptUpDeviceToOfp7) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -07001186 if ptUpLinkToOfp7 > downThresholdMin and\
1187 ptUpLinkToOfp7 < downThresholdMax and i > iterIgnore:
1188 portUpLinkNodeIter[6][i] = ptUpLinkToOfp7
1189 main.log.info('ONOS7 iter' + str(i) +
1190 ' port up link-to-ofp: ' +
1191 str(ptUpLinkToOfp7) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -07001192
1193 dbCmdList = []
1194 for node in range(0, clusterCount):
1195 portUpDevList = []
1196 portUpGraphList = []
jenkins8ba10ab2015-03-24 10:31:31 -07001197 portUpLinkList = []
jenkins7ead5a82015-03-13 10:28:21 -07001198 portDownDevList = []
1199 portDownGraphList = []
jenkins8ba10ab2015-03-24 10:31:31 -07001200 portDownLinkList = []
1201
jenkins7ead5a82015-03-13 10:28:21 -07001202 portUpDevAvg = 0
1203 portUpGraphAvg = 0
jenkins8ba10ab2015-03-24 10:31:31 -07001204 portUpLinkAvg = 0
jenkins7ead5a82015-03-13 10:28:21 -07001205 portDownDevAvg = 0
1206 portDownGraphAvg = 0
jenkins8ba10ab2015-03-24 10:31:31 -07001207 portDownLinkAvg = 0
1208
jenkins7ead5a82015-03-13 10:28:21 -07001209 for item in portUpDevNodeIter[node]:
1210 if item > 0.0:
1211 portUpDevList.append(item)
1212
1213 for item in portUpGraphNodeIter[node]:
1214 if item > 0.0:
1215 portUpGraphList.append(item)
1216
jenkins8ba10ab2015-03-24 10:31:31 -07001217 for item in portUpLinkNodeIter[node]:
1218 if item > 0.0:
1219 portUpLinkList.append(item)
1220
jenkins7ead5a82015-03-13 10:28:21 -07001221 for item in portDownDevNodeIter[node]:
1222 if item > 0.0:
1223 portDownDevList.append(item)
1224
1225 for item in portDownGraphNodeIter[node]:
1226 if item > 0.0:
1227 portDownGraphList.append(item)
1228
jenkins8ba10ab2015-03-24 10:31:31 -07001229 for item in portDownLinkNodeIter[node]:
1230 if item > 0.0:
1231 portDownLinkList.append(item)
1232
jenkins7ead5a82015-03-13 10:28:21 -07001233 portUpDevAvg = round(numpy.mean(portUpDevList), 2)
1234 portUpGraphAvg = round(numpy.mean(portUpGraphList), 2)
jenkins8ba10ab2015-03-24 10:31:31 -07001235 portUpLinkAvg = round(numpy.mean(portUpLinkList), 2)
1236
jenkins7ead5a82015-03-13 10:28:21 -07001237 portDownDevAvg = round(numpy.mean(portDownDevList), 2)
1238 portDownGraphAvg = round(numpy.mean(portDownGraphList), 2)
jenkins8ba10ab2015-03-24 10:31:31 -07001239 portDownLinkAvg = round(numpy.mean(portDownLinkList), 2)
1240
jenkins7ead5a82015-03-13 10:28:21 -07001241 portUpStdDev = round(numpy.std(portUpGraphList), 2)
1242 portDownStdDev = round(numpy.std(portDownGraphList), 2)
jenkins8ba10ab2015-03-24 10:31:31 -07001243
jenkins7ead5a82015-03-13 10:28:21 -07001244 main.log.report(' - Node ' + str(node + 1) + ' Summary - ')
1245 main.log.report(' Port up ofp-to-device ' +
jenkins8ba10ab2015-03-24 10:31:31 -07001246 str(portUpDevAvg) + ' ms')
jenkins7ead5a82015-03-13 10:28:21 -07001247 main.log.report(' Port up ofp-to-graph ' +
1248 str(portUpGraphAvg) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -07001249 main.log.report(' Port up ofp-to-link ' +
1250 str(portUpLinkAvg) + ' ms')
1251
jenkins7ead5a82015-03-13 10:28:21 -07001252 main.log.report(' Port down ofp-to-device ' +
1253 str(round(portDownDevAvg, 2)) + ' ms')
1254 main.log.report(' Port down ofp-to-graph ' +
1255 str(portDownGraphAvg) + ' ms')
jenkins8ba10ab2015-03-24 10:31:31 -07001256 main.log.report(' Port down ofp-to-link ' +
1257 str(portDownLinkAvg) + ' ms')
1258
jenkins7ead5a82015-03-13 10:28:21 -07001259 dbCmdList.append("INSERT INTO port_latency_tests VALUES('" +
1260 timeToPost + "','port_latency_results'," + runNum +
1261 ',' + str(clusterCount) + ",'baremetal" + str(node + 1) +
1262 "'," + str(portUpGraphAvg) + ',' + str(portUpStdDev) +
1263 '' + str(portDownGraphAvg) + ',' + str(portDownStdDev) + ');')
1264
1265 fResult = open(resultPath, 'a')
1266 for line in dbCmdList:
1267 if line:
1268 fResult.write(line + '\n')
1269
1270 fResult.close()
1271 main.Mininet1.deleteSwController('s1')
1272 main.Mininet1.deleteSwController('s2')
1273 utilities.assert_equals(expect=main.TRUE,
1274 actual=assertion,
1275 onpass='Port discovery latency calculation successful',
1276 onfail='Port discovery test failed')
1277
1278 def CASE4(self, main):
1279 """
1280 Increase number of nodes and initiate CLI
1281
1282 With the most recent implementation, we need a method to
1283 ensure all ONOS nodes are killed, as well as redefine
1284 the cell files to ensure all nodes that will be used
1285 is in the cell file. Otherwise, exceptions will
1286 prohibit test from running successfully.
1287
1288 3/12/15
1289
1290 """
1291 global clusterCount
1292 import time
1293 import os
1294
1295 clusterCount += 2
1296
1297 benchIp = main.params[ 'BENCH' ][ 'ip' ]
1298 features = main.params[ 'ENV' ][ 'cellFeatures' ]
1299 cellName = main.params[ 'ENV' ][ 'cellName' ]
1300 mininetIp = main.params[ 'MN' ][ 'ip1' ]
1301
1302 main.log.report('Increasing cluster size to ' + str(clusterCount))
1303
1304 main.log.step( "Killing all ONOS processes before scale-out" )
1305
1306 for i in range( 1, 8 ):
1307 main.ONOSbench.onosDie(
1308 main.params[ 'CTRL' ][ 'ip'+str(i) ] )
1309 main.ONOSbench.onosUninstall(
1310 main.params[ 'CTRL' ][ 'ip'+str(i) ] )
1311
1312 main.step( "Creating scale-out cell file" )
1313 cellIp = []
1314 for node in range( 1, clusterCount + 1 ):
1315 cellIp.append( main.params[ 'CTRL' ][ 'ip'+str(node) ] )
1316
1317 main.log.info( "Cell Ip list: " + str(cellIp) )
1318 main.ONOSbench.createCellFile( benchIp, cellName, mininetIp,
1319 str(features), *cellIp )
1320
1321 main.step( "Setting cell definition" )
1322 main.ONOSbench.setCell(cellName)
1323
1324 main.step( "Packaging cell definition" )
1325 main.ONOSbench.onosPackage()
1326
jenkins7ead5a82015-03-13 10:28:21 -07001327 for node in range( 1, clusterCount + 1 ):
jenkinsac38ab72015-03-13 11:24:10 -07001328 main.ONOSbench.onosInstall(
1329 node = main.params[ 'CTRL' ][ 'ip'+str(node) ])
1330
1331 time.sleep( 20 )
1332
jenkins7ead5a82015-03-13 10:28:21 -07001333 for node in range( 1, clusterCount + 1):
1334 for i in range( 2 ):
1335 isup = main.ONOSbench.isup(
1336 main.params[ 'CTRL' ][ 'ip'+str(node) ] )
1337 if isup:
1338 main.log.info( "ONOS "+str(node) + " is up\n")
1339 break
1340 if not isup:
1341 main.log.error( "ONOS "+str(node) + " did not start" )
jenkinsac38ab72015-03-13 11:24:10 -07001342
1343 for node in range( 1, clusterCount + 1):
1344 exec "a = main.ONOS%scli.startOnosCli" %str(node)
1345 a(main.params[ 'CTRL' ][ 'ip'+str(node) ])
1346