blob: ab6715dcc2cbcaa63f4317ea53bcd002f8bc22bc [file] [log] [blame]
cameron@onlab.us21106ea2015-07-23 15:32:51 -07001# CASE1 starts number of nodes specified in param file
2#
3# cameron@onlab.us
4
5class SCPFswitchLat:
6
7 def __init__( self ):
8 self.default = ''
9
10 def CASE1( self, main ):
11 import sys
Jon Hallf632d202015-07-30 15:45:11 -070012 import re
cameron@onlab.us21106ea2015-07-23 15:32:51 -070013 import os
14 import time
15
16 global init
17 try:
18 if type(init) is not bool:
19 init = Fals
20 except NameError:
21 init = False
22
23 #Load values from params file
24 checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
25 gitPull = main.params[ 'GIT' ][ 'autopull' ]
26 cellName = main.params[ 'ENV' ][ 'cellName' ]
27 Apps = main.params[ 'ENV' ][ 'cellApps' ]
28 BENCHIp = main.params[ 'BENCH' ][ 'ip' ]
29 MN1Ip = main.params[ 'MN' ][ 'ip1' ]
30 main.maxNodes = int(main.params[ 'max' ])
31 cellName = main.params[ 'ENV' ][ 'cellName' ]
32 homeDir = os.path.expanduser('~')
33 topoCfgFile = main.params['TEST']['topoConfigFile']
34 topoCfgName = main.params['TEST']['topoConfigName']
35 switchEventResultPath = main.params['DB']['switchEventResultPath']
36 skipMvn = main.params ['TEST']['mci']
Jon Hallf632d202015-07-30 15:45:11 -070037 testONpath = re.sub( "(tests)$", "bin", main.testDir ) # TestON/bin
cameron@onlab.us21106ea2015-07-23 15:32:51 -070038 user = main.params[ 'CTRL' ][ 'user' ]
39
Jon Hall4ba53f02015-07-29 13:07:41 -070040 # -- INIT SECTION, ONLY RUNS ONCE -- #
41 if init == False:
cameron@onlab.us21106ea2015-07-23 15:32:51 -070042 init = True
43 global clusterCount #number of nodes running
Jon Hall4ba53f02015-07-29 13:07:41 -070044 global scale
cameron@onlab.us21106ea2015-07-23 15:32:51 -070045 global commit
46 global timeToPost
47 global runNum
48 global jenkinsBuildNumber
49 global CLIs
50 CLIs = []
51 main.ONOSIp = []
52
53 for i in range( 1, 8 ):
54 CLIs.append( getattr( main, 'ONOS' + str( i ) + 'cli' ) )
55
56 timeToPost = time.strftime('%Y-%m-%d %H:%M:%S')
57 runNum = time.strftime('%d%H%M%S')
58
59 try:
60 jenkinsBuildNumber = str(os.environ['BUILD_NUMBER'])
61 main.log.report( 'Jenkins build number: ' + jenkinsBuildNumber )
62 except KeyError:
63 jenkinsBuildNumber = str(0)
64 main.log.info( 'Job is not run by jenkins. ' + 'Build number set to: ' + jenkinsBuildNumber)
65
66 clusterCount = 0
67 main.ONOSIp = main.ONOSbench.getOnosIps()
68
Jon Hall4ba53f02015-07-29 13:07:41 -070069 scale = (main.params[ 'SCALE' ]).split(",")
cameron@onlab.us21106ea2015-07-23 15:32:51 -070070 clusterCount = int(scale[0])
71
72 #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
73 if skipMvn != "off":
74 mvnResult = main.ONOSbench.cleanInstall()
75
76 #git
77 main.step( "Git checkout and pull " + checkoutBranch )
78 if gitPull == 'on':
79 checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
80 pullResult = main.ONOSbench.gitPull()
81
82 else:
83 checkoutResult = main.TRUE
84 pullResult = main.TRUE
85 main.log.info( "Skipped git checkout and pull" )
86
Jon Hall4ba53f02015-07-29 13:07:41 -070087 main.log.step("Grabbing commit number")
cameron@onlab.us21106ea2015-07-23 15:32:51 -070088 commit = main.ONOSbench.getVersion() ####
89 commit = (commit.split(" "))[1]
Jon Hall4ba53f02015-07-29 13:07:41 -070090
cameron@onlab.us21106ea2015-07-23 15:32:51 -070091 temp = testONpath.replace("bin","") + "tests/SCPFswitchLat/Dependency/"
kelvin-onlabd9e23de2015-08-06 10:34:44 -070092 main.ONOSbench.scp( main.Mininet1,
93 temp + "topo-perf-1sw.py",
94 main.Mininet1.home,
95 direction="to" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -070096 #main.ONOSbench.handle.expect(":~")
97
98 main.step('Clearing previous DB log file')
99 print switchEventResultPath
100 fSwitchLog = open(switchEventResultPath, "w+")
101 fSwitchLog.write("")
Jon Hall4ba53f02015-07-29 13:07:41 -0700102 fSwitchLog.close()
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700103
104 # -- END OF INIT SECTION --#
105
Jon Hall4ba53f02015-07-29 13:07:41 -0700106 main.log.step("Adjusting scale")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700107 clusterCount = int(scale[0])
Jon Hall4ba53f02015-07-29 13:07:41 -0700108 scale.remove(scale[0])
109
110 #kill off all onos processes
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700111 main.log.step("Safety check, killing all ONOS processes before initiating enviornment setup")
112 for node in range(main.maxNodes):
113 main.ONOSbench.onosDie(main.ONOSIp[node])
Jon Hall4ba53f02015-07-29 13:07:41 -0700114
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700115 #Uninstall everywhere
116 main.log.step( "Cleaning Enviornment..." )
117 for i in range(main.maxNodes):
118 main.log.info(" Uninstalling ONOS " + str(i) )
119 main.ONOSbench.onosUninstall( main.ONOSIp[i] )
120 main.log.info("Sleep 10 second for uninstall to settle...")
121 time.sleep(10)
122 main.ONOSbench.handle.sendline(" ")
123 main.ONOSbench.handle.expect(":~")
Jon Hall4ba53f02015-07-29 13:07:41 -0700124
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700125 #construct the cell file
126 main.log.info("Creating cell file")
127 cellIp = []
128 for node in range (clusterCount):
129 cellIp.append(main.ONOSIp[node])
Jon Hall4ba53f02015-07-29 13:07:41 -0700130
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700131 main.ONOSbench.createCellFile(main.ONOSbench.ip_address, cellName, MN1Ip, str(Apps), cellIp)
132
133 main.step( "Set Cell" )
134 main.ONOSbench.setCell(cellName)
135
136 main.step( "Creating ONOS package" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700137 packageResult = main.ONOSbench.onosPackage()
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700138
139 main.step( "verify cells" )
140 verifyCellResult = main.ONOSbench.verifyCell()
Jon Hall4ba53f02015-07-29 13:07:41 -0700141
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700142 main.step('Starting mininet topology ')
143 main.Mininet1.startNet()
144
145 main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
146 for node in range(clusterCount):
147 main.log.info("Starting ONOS " + str(node) + " at IP: " + main.ONOSIp[node])
148 main.ONOSbench.onosInstall( node=main.ONOSIp[node])
149
150 for i in range(50):
151 time.sleep(15)
152 print "attempt " + str(i)
153 main.ONOSbench.handle.sendline("onos $OC1 summary")
154 main.ONOSbench.handle.expect(":~")
155 print main.ONOSbench.handle.before
156 if "nodes=" in main.ONOSbench.handle.before:
Jon Hall4ba53f02015-07-29 13:07:41 -0700157 break
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700158
159 for node in range(clusterCount):
160 for i in range( 2 ):
161 isup = main.ONOSbench.isup( main.ONOSIp[node] )
162 if isup:
163 main.log.info("ONOS " + str(node) + " is up\n")
164 break
165 if not isup:
166 main.log.report( "ONOS " + str(node) + " didn't start!" )
167 main.log.info("Startup sequence complete")
168
169 #time.sleep(20)
Jon Hall4ba53f02015-07-29 13:07:41 -0700170
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700171 main.step('Start onos cli')
Jon Hall4ba53f02015-07-29 13:07:41 -0700172 for i in range(0,clusterCount):
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700173 cli1 = CLIs[i].startOnosCli(main.ONOSIp[i])
174
175 main.step( 'Configuring application parameters' )
Jon Hall4ba53f02015-07-29 13:07:41 -0700176
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700177 configName = 'org.onosproject.net.topology.impl.DefaultTopologyProvider'
178 configParam = 'maxEvents 1'
179 main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
180 configParam = 'maxBatchMs 0'
181 main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
182 configParam = 'maxIdleMs 0'
Jon Hall4ba53f02015-07-29 13:07:41 -0700183 main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700184
185 def CASE2(self, main):
186 print "Cluster size: " + str(clusterCount)
187 """
188 Assign s3 to ONOSbench and measure latency
Jon Hall4ba53f02015-07-29 13:07:41 -0700189
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700190 There are 4 levels of latency measurements to this test:
191 1 ) End-to-end measurement: Complete end-to-end measurement
192 from TCP ( SYN/ACK ) handshake to Graph change
193 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of
194 measurement from OFP Vendor message to Graph change
195 3 ) OFP-to-device measurement: 'ONOS processing without
196 graph change' snippet of measurement from OFP vendor
197 message to Device change timestamp
198 4 ) T0-to-device measurement: Measurement that includes
199 the switch handshake to devices timestamp without
200 the graph view change. ( TCP handshake -> Device
201 change )
202 """
203 import time
204 import subprocess
205 import json
206 import requests
207 import os
208 import numpy
209
210 ONOSUser = main.params['CTRL']['user']
211 numIter = main.params['TEST']['numIter']
212 iterIgnore = int(main.params['TEST']['iterIgnore'])
Jon Hall4ba53f02015-07-29 13:07:41 -0700213
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700214 deviceTimestampKey = main.params['JSON']['deviceTimestamp']
215 graphTimestampKey = main.params['JSON']['graphTimestamp']
216
217 debugMode = main.params['TEST']['debugMode']
218 onosLog = main.params['TEST']['onosLogFile']
219 resultPath = main.params['DB']['switchEventResultPath']
220 thresholdStr = main.params['TEST']['singleSwThreshold']
221 thresholdObj = thresholdStr.split(',')
222 thresholdMin = int(thresholdObj[0])
223 thresholdMax = int(thresholdObj[1])
Jon Hall4ba53f02015-07-29 13:07:41 -0700224
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700225 # Look for 'role-request' messages,
226 # which replaces the 'vendor' messages previously seen
227 # on OVS 2.0.1
228 tsharkTcpString = main.params[ 'TSHARK' ][ 'tcpSynAck' ]
229 tsharkFeatureReply = main.params[ 'TSHARK' ][ 'featureReply' ]
230 tsharkRoleRequest = main.params[ 'TSHARK' ][ 'roleRequest' ]
231 tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ]
232 tsharkFinAckSequence = main.params[ 'TSHARK' ][ 'finAckSequence' ]
233
234 tsharkOfOutput = '/tmp/tshark_of_topo.txt'
235 tsharkTcpOutput = '/tmp/tshark_tcp_topo.txt'
236 tsharkRoleOutput = '/tmp/tshark_role_request.txt'
237 tsharkFeatureOutput = '/tmp/tshark_feature_reply.txt'
238 tsharkFinAckOutput = '/tmp/tshark_fin_ack.txt'
239
240 # Switch connect measurement list
241 # TCP Syn/Ack -> Feature Reply latency collection for each node
242 tcpToFeatureLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
243 # Feature Reply -> Role Request latency collection for each node
Jon Hall4ba53f02015-07-29 13:07:41 -0700244 featureToRoleRequestLatNodeIter = numpy.zeros((clusterCount,
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700245 int(numIter)))
246 # Role Request -> Role Reply latency collection for each node
247 roleRequestToRoleReplyLatNodeIter = numpy.zeros((clusterCount,
248 int(numIter)))
249 # Role Reply -> Device Update latency collection for each node
250 roleReplyToDeviceLatNodeIter = numpy.zeros((clusterCount,
251 int(numIter)))
252 # Device Update -> Graph Update latency collection for each node
253 deviceToGraphLatNodeIter = numpy.zeros((clusterCount,
254 int(numIter)))
255 endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
Jon Hall4ba53f02015-07-29 13:07:41 -0700256
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700257 # Switch disconnect measurement lists
258 # Mininet Fin / Ack -> Mininet Ack
259 finAckTransactionLatNodeIter = numpy.zeros((clusterCount,
260 int(numIter)))
261 # Mininet Ack -> Device Event
262 ackToDeviceLatNodeIter = numpy.zeros((clusterCount,
263 int(numIter)))
264 # Device event -> Graph event
265 deviceToGraphDiscLatNodeIter = numpy.zeros((clusterCount,
266 int(numIter)))
267 endToEndDiscLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
Jon Hall4ba53f02015-07-29 13:07:41 -0700268
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700269 assertion = main.TRUE
270 localTime = time.strftime('%x %X')
271 localTime = localTime.replace('/', '')
272 localTime = localTime.replace(' ', '_')
273 localTime = localTime.replace(':', '')
274
275 if debugMode == 'on':
276 main.ONOSbench.tsharkPcap('eth0', '/tmp/single_sw_lat_pcap_' + localTime)
277 main.log.info('Debug mode is on')
278
279 main.log.report('Latency of adding one switch to controller')
280 main.log.report('First ' + str(iterIgnore) + ' iterations ignored' + ' for jvm warmup time')
281 main.log.report('Total iterations of test: ' + str(numIter))
Jon Hall4ba53f02015-07-29 13:07:41 -0700282
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700283 for i in range(0, int(numIter)):
284 main.log.info('Starting tshark capture')
285 main.ONOSbench.tsharkGrep(tsharkTcpString, tsharkTcpOutput)
286 main.ONOSbench.tsharkGrep(tsharkOfString, tsharkOfOutput)
287 main.ONOSbench.tsharkGrep(tsharkRoleRequest, tsharkRoleOutput)
288 main.ONOSbench.tsharkGrep(tsharkFeatureReply, tsharkFeatureOutput)
289
290 time.sleep(10)
Jon Hall4ba53f02015-07-29 13:07:41 -0700291
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700292 main.log.info('Assigning s3 to controller')
293 main.Mininet1.assignSwController(sw='s3',
294 ip=main.ONOSIp[0])
Jon Hall4ba53f02015-07-29 13:07:41 -0700295
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700296 jsonStr = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700297 for node in range (0, clusterCount):
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700298 metricsSwUp = CLIs[node].topologyEventsMetrics()
299 jsonStr.append(metricsSwUp)
Jon Hall4ba53f02015-07-29 13:07:41 -0700300
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700301 time.sleep(10)
302
303 main.log.info('Stopping all Tshark processes')
304 main.ONOSbench.tsharkStop()
Jon Hall4ba53f02015-07-29 13:07:41 -0700305
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700306 time.sleep(5)
Jon Hall4ba53f02015-07-29 13:07:41 -0700307
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700308 '''
309 main.log.info('Copying over tshark files')
310 os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] +
311 ':' + tsharkTcpOutput + ' /tmp/')
312 os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] +
313 ':' + tsharkRoleOutput + ' /tmp/')
314 os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] +
315 ':' + tsharkFeatureOutput + ' /tmp/')
316 os.system('scp ' + ONOSUser + '@' +
317 main.ONOSIp[0] + ':' + tsharkOfOutput + ' /tmp/')
318 '''
319
320 # Get tcp syn / ack output
321 time.sleep(1)
322
323 tcpFile = open(tsharkTcpOutput, 'r')
324 tempText = tcpFile.readline()
325 tempText = tempText.split(' ')
326 main.log.info('Object read in from TCP capture: ' + str(tempText))
Jon Hall4ba53f02015-07-29 13:07:41 -0700327
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700328 if len(tempText) > 1:
329 t0Tcp = float(tempText[1]) * 1000.0
330 else:
331 main.log.error('Tshark output file for TCP' + ' returned unexpected results')
332 t0Tcp = 0
333 assertion = main.FALSE
334 tcpFile.close()
Jon Hall4ba53f02015-07-29 13:07:41 -0700335
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700336 # Get Role reply output
337 ofFile = open(tsharkOfOutput, 'r')
338 lineOfp = ''
339 while True:
340 tempText = ofFile.readline()
341 if tempText != '':
342 lineOfp = tempText
343 else:
344 break
345 obj = lineOfp.split(' ')
346 main.log.info('Object read in from OFP capture: ' +
347 str(lineOfp))
348 if len(obj) > 1:
349 t0Ofp = float(obj[1]) * 1000.0
350 else:
351 main.log.error('Tshark output file for OFP' +
352 ' returned unexpected results')
353 t0Ofp = 0
354 assertion = main.FALSE
355 ofFile.close()
Jon Hall4ba53f02015-07-29 13:07:41 -0700356
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700357 # Get role request output
358 roleFile = open(tsharkRoleOutput, 'r')
359 tempText = roleFile.readline()
360 tempText = tempText.split(' ')
361 if len(tempText) > 1:
362 main.log.info('Object read in from role request capture:' +
363 str(tempText))
364 roleTimestamp = float(tempText[1]) * 1000.0
365 else:
366 main.log.error('Tshark output file for role request' +
367 ' returned unexpected results')
368 timeRoleRequest = 0
369 assertion = main.FALSE
370 roleFile.close()
371
372 # Get feature reply output
373 featureFile = open(tsharkFeatureOutput, 'r')
374 tempText = featureFile.readline()
375 tempText = tempText.split(' ')
376 if len(tempText) > 1:
377 main.log.info('Object read in from feature reply capture: '+
378 str(tempText))
379 if tempText[1] != ' ' and float(tempText[1]) > 1400000000.0:
380 temp = tempText[1]
381 elif tempText[2] != ' ' and float(tempText[2]) > 1400000000.0:
382 temp = tempText[2]
383 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700384 temp = 0
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700385 featureTimestamp = float(temp) * 1000.0
386 else:
387 main.log.error('Tshark output file for feature reply' +
388 ' returned unexpected results')
389 timeFeatureReply = 0
390 assertion = main.FALSE
391 featureFile.close()
392
393 for node in range(0, clusterCount):
394 nodeNum = node+1
395 #metricsSwUp = CLIs[node].topologyEventsMetrics
396 #jsonStr = metricsSwUp()
397 jsonObj = json.loads(jsonStr[node])
398 if jsonObj:
399 graphTimestamp = jsonObj[graphTimestampKey]['value']
400 deviceTimestamp = jsonObj[deviceTimestampKey]['value']
401 else:
402 main.log.error( "Unexpected JSON object" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700403 # If we could not obtain the JSON object,
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700404 # set the timestamps to 0, which will be
405 # excluded from the measurement later on
406 # (realized as invalid)
407 graphTimestamp = 0
408 deviceTimestamp = 0
Jon Hall4ba53f02015-07-29 13:07:41 -0700409
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700410 endToEnd = int(graphTimestamp) - int(t0Tcp)
Jon Hall4ba53f02015-07-29 13:07:41 -0700411
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700412 # Below are measurement breakdowns of the end-to-end
Jon Hall4ba53f02015-07-29 13:07:41 -0700413 # measurement.
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700414 tcpToFeature = int(featureTimestamp) - int(t0Tcp)
415 featureToRole = int(roleTimestamp) - int(featureTimestamp)
416 roleToOfp = float(t0Ofp) - float(roleTimestamp)
417 ofpToDevice = float(deviceTimestamp) - float(t0Ofp)
Jon Hall4ba53f02015-07-29 13:07:41 -0700418 # Timestamps gathered from ONOS are millisecond
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700419 # precision. They are returned as integers, thus no
420 # need to be more precise than 'int'. However,
Jon Hall4ba53f02015-07-29 13:07:41 -0700421 # the processing seems to be mostly under 1 ms,
422 # thus this may be a problem point to handle any
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700423 # submillisecond output that we are unsure of.
424 # For now, this will be treated as 0 ms if less than 1 ms
425 deviceToGraph = int(graphTimestamp) - int(deviceTimestamp)
Jon Hall4ba53f02015-07-29 13:07:41 -0700426
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700427 if endToEnd >= thresholdMin and\
428 endToEnd < thresholdMax and i >= iterIgnore:
Jon Hall4ba53f02015-07-29 13:07:41 -0700429 endToEndLatNodeIter[node][i] = endToEnd
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700430 main.log.info("ONOS "+str(nodeNum)+ " end-to-end: "+
431 str(endToEnd) + " ms")
432 else:
433 main.log.info("ONOS "+str(nodeNum)+ " end-to-end "+
434 "measurement ignored due to excess in "+
435 "threshold or premature iteration: ")
436 main.log.info(str(endToEnd))
Jon Hall4ba53f02015-07-29 13:07:41 -0700437
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700438 if tcpToFeature >= thresholdMin and\
439 tcpToFeature < thresholdMax and i >= iterIgnore:
Jon Hall4ba53f02015-07-29 13:07:41 -0700440 tcpToFeatureLatNodeIter[node][i] = tcpToFeature
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700441 main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature: "+
442 str(tcpToFeature) + " ms")
443 else:
444 main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature "+
445 "measurement ignored due to excess in "+
446 "threshold or premature iteration: ")
447 main.log.info(str(tcpToFeature))
448
449 if featureToRole >= thresholdMin and\
450 featureToRole < thresholdMax and i >= iterIgnore:
Jon Hall4ba53f02015-07-29 13:07:41 -0700451 featureToRoleRequestLatNodeIter[node][i] = featureToRole
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700452 main.log.info("ONOS "+str(nodeNum)+ " feature-to-role: "+
453 str(featureToRole) + " ms")
454 else:
455 main.log.info("ONOS "+str(nodeNum)+ " feature-to-role "+
456 "measurement ignored due to excess in "+
457 "threshold or premature iteration: ")
458 main.log.info(str(featureToRole))
459
460 if roleToOfp >= thresholdMin and\
461 roleToOfp < thresholdMax and i >= iterIgnore:
462 roleRequestToRoleReplyLatNodeIter[node][i] = roleToOfp
463 main.log.info("ONOS "+str(nodeNum)+ " role-to-reply: "+
464 str(roleToOfp) + " ms")
465 else:
466 main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+
467 "measurement ignored due to excess in "+
468 "threshold or premature iteration: ")
469 main.log.info(str(roleToOfp))
Jon Hall4ba53f02015-07-29 13:07:41 -0700470
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700471 if ofpToDevice >= thresholdMin and\
472 ofpToDevice < thresholdMax and i >= iterIgnore:
Jon Hall4ba53f02015-07-29 13:07:41 -0700473 roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700474 main.log.info("ONOS "+str(nodeNum)+ " reply-to-device: "+
475 str(ofpToDevice) + " ms")
476 else:
477 main.log.info("ONOS "+str(nodeNum)+ " reply-to-device "+
478 "measurement ignored due to excess in "+
479 "threshold or premature iteration: ")
480 main.log.info(str(ofpToDevice))
481
482 if deviceToGraph >= thresholdMin and\
483 deviceToGraph < thresholdMax and i >= iterIgnore:
484 deviceToGraphLatNodeIter[node][i] = deviceToGraph
485 main.log.info("ONOS "+str(nodeNum)+ " device-to-graph: "+
486 str(deviceToGraph) + " ms")
487 else:
488 if deviceToGraph == 0:
489 deviceToGraphLatNodeIter[node][i] = 0
490 main.log.info("ONOS "+str(nodeNum) +
491 " device-to-graph measurement "+
492 "was set to 0 ms because of precision "+
493 "uncertainty. ")
494 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700495 main.log.info("ONOS "+str(nodeNum)+
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700496 " device-to-graph "+
497 "measurement ignored due to excess in "+
498 "threshold or premature iteration: ")
Jon Hall4ba53f02015-07-29 13:07:41 -0700499 main.log.info(str(deviceToGraph))
500
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700501 # ********************
502 time.sleep(5)
Jon Hall4ba53f02015-07-29 13:07:41 -0700503
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700504 # Get device id to remove
505 deviceIdJsonStr = main.ONOS1cli.devices()
Jon Hall4ba53f02015-07-29 13:07:41 -0700506
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700507 main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) )
508 deviceId = json.loads(deviceIdJsonStr)
509
510 deviceList = []
511 for device in deviceId:
512 deviceList.append(device['id'])
Jon Hall4ba53f02015-07-29 13:07:41 -0700513
514 # Measure switch down metrics
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700515 # TCP FIN/ACK -> TCP FIN
516 # TCP FIN -> Device Event
517 # Device Event -> Graph Event
518 # Capture switch down FIN / ACK packets
519
520 # The -A 1 grep option allows us to grab 1 extra line after the
521 # last tshark output grepped originally
Jon Hall4ba53f02015-07-29 13:07:41 -0700522 main.ONOSbench.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput,
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700523 grepOptions = '-A 1' )
Jon Hall4ba53f02015-07-29 13:07:41 -0700524
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700525 time.sleep( 5 )
526
527 removeJsonList = []
528 main.step('Remove switch from controller')
529 main.Mininet1.deleteSwController('s3')
Jon Hall4ba53f02015-07-29 13:07:41 -0700530 firstDevice = deviceList[0]
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700531
532 time.sleep( 5 )
Jon Hall4ba53f02015-07-29 13:07:41 -0700533
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700534 # We need to get metrics before removing
535 # device from the store below.
536 for node in range(0, clusterCount):
537 metricsSwDown = CLIs[node].topologyEventsMetrics
538 jsonStr = metricsSwDown()
Jon Hall4ba53f02015-07-29 13:07:41 -0700539 removeJsonList.append( json.loads(jsonStr) )
540
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700541 main.ONOSbench.tsharkStop()
Jon Hall4ba53f02015-07-29 13:07:41 -0700542
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700543 main.log.info( "Removing device " +str(firstDevice)+
544 " from ONOS" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700545
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700546 #if deviceId:
547 main.ONOS1cli.deviceRemove(firstDevice)
548
549 #main.log.info('Copying over tshark files')
550 #os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] + ':' + tsharkFinAckOutput + ' /tmp/')
Jon Hall4ba53f02015-07-29 13:07:41 -0700551
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700552 time.sleep( 10 )
553 finAckOutputList = []
554 with open(tsharkFinAckOutput, 'r') as f:
555 tempLine = f.readlines()
556 main.log.info('Object read in from FinAck capture: ' +
557 "\n".join(tempLine))
Jon Hall4ba53f02015-07-29 13:07:41 -0700558
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700559 index = 1
560 for line in tempLine:
561 obj = line.split(' ')
Jon Hall4ba53f02015-07-29 13:07:41 -0700562
563 # There are at least 3 objects in field (valid
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700564 # tshark output is lengthy)
565 if len(obj) > 2:
566 # If first index of object is like an epoch time
567 if obj[1] != ' ' and float(obj[1]) > 1400000000.0:
Jon Hall4ba53f02015-07-29 13:07:41 -0700568 temp = obj[1]
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700569 elif obj[2] != ' 'and float(obj[2]) > 1400000000.0:
570 temp = obj[2]
571 elif obj[3] != ' 'and float(obj[3]) > 1400000000.0:
572 temp = obj[3]
573 else:
574 temp = 0
575 if index == 1:
576 tFinAck = float(temp) * 1000.0
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700577 main.log.info("DEBUG-- tFinAck: " + str(tFinAck))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700578 elif index == 3:
579 tAck = float(temp) * 1000.0
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700580 main.log.info("DEBUG-- tAck: " + str(tAck))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700581 else:
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700582 tAck = 0
583 else:
584 main.log.error('Tshark output file for OFP' +
585 ' returned unexpected results')
586 tFinAck = 0
587 tAck = 0
588 assertion = main.FALSE
Jon Hall4ba53f02015-07-29 13:07:41 -0700589
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700590 index += 1
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700591 main.log.info("DEBUG-- tFinAck: " + str(tFinAck))
592 main.log.info("DEBUG-- tAck: " + str(tAck))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700593
594 # with open() as f takes care of closing file
595
596 time.sleep(5)
Jon Hall4ba53f02015-07-29 13:07:41 -0700597
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700598 for node in range(0, clusterCount):
599 nodeNum = node+1
600 jsonObj = removeJsonList[node]
601 if jsonObj:
602 graphTimestamp = jsonObj[graphTimestampKey]['value']
603 deviceTimestamp = jsonObj[deviceTimestampKey]['value']
604 main.log.info("Graph timestamp: "+str(graphTimestamp))
605 main.log.info("Device timestamp: "+str(deviceTimestamp))
606 else:
607 main.log.error( "Unexpected JSON object" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700608 # If we could not obtain the JSON object,
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700609 # set the timestamps to 0, which will be
610 # excluded from the measurement later on
611 # (realized as invalid)
612 graphTimestamp = 0
613 deviceTimestamp = 0
Jon Hall4ba53f02015-07-29 13:07:41 -0700614
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700615 finAckTransaction = float(tAck) - float(tFinAck)
616 ackToDevice = float(deviceTimestamp) - float(tAck)
617 deviceToGraph = float(graphTimestamp) - float(deviceTimestamp)
618 endToEndDisc = int(graphTimestamp) - int(tFinAck)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700619 main.log.info("DEBUG-- endToEndDisc = graphTimestamp - tFinAck == (" + str(graphTimestamp) + "-" + str(tFinAck) + ")")
Jon Hall4ba53f02015-07-29 13:07:41 -0700620
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700621 if endToEndDisc >= thresholdMin and\
622 endToEndDisc < thresholdMax and i >= iterIgnore:
623 endToEndDiscLatNodeIter[node][i] = endToEndDisc
Jon Hall4ba53f02015-07-29 13:07:41 -0700624 main.log.info("ONOS "+str(nodeNum) +
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700625 "end-to-end disconnection: "+
626 str(endToEndDisc) + " ms" )
627 else:
Jon Hall4ba53f02015-07-29 13:07:41 -0700628 main.log.info("ONOS " + str(nodeNum) +
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700629 " end-to-end disconnection "+
630 "measurement ignored due to excess in "+
631 "threshold or premature iteration: ")
632 main.log.info(str(endToEndDisc))
633
634 if finAckTransaction >= thresholdMin and\
635 finAckTransaction < thresholdMax and i >= iterIgnore:
Jon Hall4ba53f02015-07-29 13:07:41 -0700636 finAckTransactionLatNodeIter[node][i] = finAckTransaction
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700637 main.log.info("ONOS "+str(nodeNum)+
638 " fin/ack transaction: "+
639 str(finAckTransaction) + " ms")
640 else:
641 main.log.info("ONOS "+str(nodeNum)+
642 " fin/ack transaction "+
643 "measurement ignored due to excess in "+
644 "threshold or premature iteration: ")
645 main.log.info(str(finAckTransaction))
646
647 if ackToDevice >= thresholdMin and\
648 ackToDevice < thresholdMax and i >= iterIgnore:
649 ackToDeviceLatNodeIter[node][i] = ackToDevice
650 main.log.info("ONOS "+str(nodeNum)+
651 " ack-to-device: "+
652 str(ackToDevice) + " ms")
653 else:
654 main.log.info("ONOS "+str(nodeNum)+
655 " ack-to-device "+
656 "measurement ignored due to excess in "+
657 "threshold or premature iteration: ")
658 main.log.info(str(ackToDevice))
659
660 if deviceToGraph >= thresholdMin and\
661 deviceToGraph < thresholdMax and i >= iterIgnore:
662 deviceToGraphDiscLatNodeIter[node][i] = deviceToGraph
663 main.log.info("ONOS "+str(nodeNum)+
664 " device-to-graph disconnect: "+
665 str(deviceToGraph) + " ms")
666 else:
667 main.log.info("ONOS "+str(nodeNum)+
668 " device-to-graph disconnect "+
669 "measurement ignored due to excess in "+
670 "threshold or premature iteration: ")
671 main.log.info(str(deviceToGraph))
672
673 endToEndAvg = 0
674 ofpToGraphAvg = 0
675 dbCmdList = []
676 for node in range(0, clusterCount):
677 # List of latency for each node
678 endToEndList = []
679 tcpToFeatureList = []
680 featureToRoleList = []
681 roleToOfpList = []
682 ofpToDeviceList = []
683 deviceToGraphList = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700684
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700685 finAckTransactionList = []
686 ackToDeviceList = []
687 deviceToGraphDiscList = []
688 endToEndDiscList = []
Jon Hall4ba53f02015-07-29 13:07:41 -0700689
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700690 # LatNodeIter 2d arrays contain all iteration latency
691 # for each node of the current scale cluster size
692 # Switch connection measurements
693 # Set further acceptance criteria for measurements
694 # here if you would like to filter reporting results
695 for item in endToEndLatNodeIter[node]:
696 if item > 0.0:
697 endToEndList.append(item)
698
699 for item in tcpToFeatureLatNodeIter[node]:
700 if item > 0.0:
701 tcpToFeatureList.append(item)
702
703 for item in featureToRoleRequestLatNodeIter[node]:
704 if item > 0.0:
705 featureToRoleList.append(item)
706
707 for item in roleRequestToRoleReplyLatNodeIter[node]:
708 if item > 0.0:
709 roleToOfpList.append(item)
710
711 for item in roleReplyToDeviceLatNodeIter[node]:
712 if item >= 0.0:
713 ofpToDeviceList.append(item)
Jon Hall4ba53f02015-07-29 13:07:41 -0700714
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700715 for item in featureToRoleRequestLatNodeIter[node]:
716 if item > 0.0:
717 featureToRoleList.append(item)
718
719 for item in deviceToGraphLatNodeIter[node]:
720 if item >= 0.0:
721 deviceToGraphList.append(item)
722
723 # Switch disconnect measurements
724 for item in endToEndDiscLatNodeIter[node]:
725 if item > 0.0:
726 endToEndDiscList.append(item)
Jon Hall4ba53f02015-07-29 13:07:41 -0700727
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700728 for item in finAckTransactionLatNodeIter[node]:
729 if item > 0.0:
730 finAckTransactionList.append(item)
731
732 for item in ackToDeviceLatNodeIter[node]:
733 if item > 0.0:
734 ackToDeviceList.append(item)
735
736 for item in deviceToGraphDiscLatNodeIter[node]:
737 if item >= 0.0:
738 deviceToGraphDiscList.append(item)
739
740 endToEndAvg = round(numpy.mean(endToEndList), 2)
741 endToEndStdDev = round(numpy.std(endToEndList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700742 main.log.info("endToEndList: " + str(endToEndList))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700743
744 tcpToFeatureAvg = round(numpy.mean(tcpToFeatureList), 2)
745 tcpToFeatureStdDev = round(numpy.std(tcpToFeatureList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700746 main.log.info("tcpToFeatureList: " + str(tcpToFeatureList))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700747
748 featureToRoleAvg = round(numpy.mean(featureToRoleList), 2)
749 featureToRoleStdDev = round(numpy.std(featureToRoleList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700750 main.log.info("featureToRoleList: " + str(featureToRoleList))
Jon Hall4ba53f02015-07-29 13:07:41 -0700751
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700752 roleToOfpAvg = round(numpy.mean(roleToOfpList), 2)
753 roleToOfpStdDev = round(numpy.std(roleToOfpList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700754 main.log.info("roleToOfList: " + str(roleToOfpList))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700755
756 ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2)
757 ofpToDeviceStdDev = round(numpy.std(ofpToDeviceList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700758 main.log.info("ofpToDeviceList: " + str(ofpToDeviceList))
Jon Hall4ba53f02015-07-29 13:07:41 -0700759
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700760 deviceToGraphAvg = round(numpy.mean(deviceToGraphList), 2)
761 deviceToGraphStdDev = round(numpy.std(deviceToGraphList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700762 main.log.info("deviceToGraphList: " + str(deviceToGraphList))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700763
764 endToEndDiscAvg = round(numpy.mean(endToEndDiscList), 2)
765 endToEndDiscStdDev = round(numpy.std(endToEndDiscList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700766 main.log.info("endToEndDiscList: " + str(endToEndDiscList))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700767
768 finAckAvg = round(numpy.mean(finAckTransactionList), 2)
769 finAckStdDev = round(numpy.std(finAckTransactionList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700770 main.log.info("finAckTransactionList: " + str(finAckTransactionList))
Jon Hall4ba53f02015-07-29 13:07:41 -0700771
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700772 ackToDeviceAvg = round(numpy.mean(ackToDeviceList), 2)
773 ackToDeviceStdDev = round(numpy.std(ackToDeviceList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700774 main.log.info("ackToDeviceList: " + str(ackToDeviceList))
Jon Hall4ba53f02015-07-29 13:07:41 -0700775
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700776 deviceToGraphDiscAvg = round(numpy.mean(deviceToGraphDiscList), 2)
777 deviceToGraphDiscStdDev = round(numpy.std(deviceToGraphDiscList), 2)
cameron@onlab.us222f2e42015-07-30 12:08:27 -0700778 main.log.info("deviceToGraphDiscList: " + str(deviceToGraphDiscList))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700779
780 main.log.report(' - Node ' + str(node + 1) + ' Summary - ')
781 main.log.report(' - Switch Connection Statistics - ')
Jon Hall4ba53f02015-07-29 13:07:41 -0700782
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700783 main.log.report(' End-to-end Avg: ' + str(endToEndAvg) +
784 ' ms' + ' End-to-end Std dev: ' +
785 str(endToEndStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700786
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700787 main.log.report(' Tcp-to-feature-reply Avg: ' +
788 str(tcpToFeatureAvg) + ' ms')
789 main.log.report(' Tcp-to-feature-reply Std dev: '+
790 str(tcpToFeatureStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700791
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700792 main.log.report(' Feature-reply-to-role-request Avg: ' +
793 str(featureToRoleAvg) + ' ms')
794 main.log.report(' Feature-reply-to-role-request Std Dev: ' +
795 str(featureToRoleStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700796
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700797 main.log.report(' Role-request-to-role-reply Avg: ' +
798 str(roleToOfpAvg) +' ms')
799 main.log.report(' Role-request-to-role-reply Std dev: ' +
800 str(roleToOfpStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700801
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700802 main.log.report(' Role-reply-to-device Avg: ' +
803 str(ofpToDeviceAvg) +' ms')
804 main.log.report(' Role-reply-to-device Std dev: ' +
805 str(ofpToDeviceStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700806
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700807 main.log.report(' Device-to-graph Avg: ' +
808 str(deviceToGraphAvg) + ' ms')
809 main.log.report( 'Device-to-graph Std dev: ' +
810 str(deviceToGraphStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700811
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700812 main.log.report(' - Switch Disconnection Statistics - ')
Jon Hall4ba53f02015-07-29 13:07:41 -0700813 main.log.report(' End-to-end switch disconnect Avg: ' +
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700814 str(endToEndDiscAvg) + ' ms')
815 main.log.report(' End-to-end switch disconnect Std dev: ' +
816 str(endToEndDiscStdDev) + ' ms')
817 main.log.report(' Fin/Ack-to-Ack Avg: ' + str(finAckAvg) + ' ms')
818 main.log.report(' Fin/Ack-to-Ack Std dev: ' +
819 str(finAckStdDev) + ' ms')
Jon Hall4ba53f02015-07-29 13:07:41 -0700820
821 main.log.report(' Ack-to-device Avg: ' + str(ackToDeviceAvg) +
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700822 ' ms')
823 main.log.report(' Ack-to-device Std dev: ' + str(ackToDeviceStdDev) +
824 ' ms')
825
826 main.log.report(' Device-to-graph (disconnect) Avg: ' +
827 str(deviceToGraphDiscAvg) + ' ms')
828 main.log.report(' Device-to-graph (disconnect) Std dev: ' +
829 str(deviceToGraphDiscStdDev) + ' ms')
830
831 # For database schema, refer to Amazon web services
832 dbCmdList.append(
833 "INSERT INTO switch_latency_details VALUES('" +
834 timeToPost + "','switch_latency_results'," +
Jon Hall4ba53f02015-07-29 13:07:41 -0700835 jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" +
836 str(node + 1) + "'," +
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700837 str(endToEndAvg) + ',' +
838 str(tcpToFeatureAvg) + ',' +
839 str(featureToRoleAvg) + ',' +
840 str(roleToOfpAvg) + ',' +
841 str(ofpToDeviceAvg) + ',' +
842 str(deviceToGraphAvg) + ',' +
843 str(endToEndDiscAvg) + ',' +
844 str(finAckAvg) + ',' +
845 str(ackToDeviceAvg) + ',' +
Jon Hall4ba53f02015-07-29 13:07:41 -0700846 str(deviceToGraphDiscAvg) +
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700847 ');')
848
849 if debugMode == 'on':
850 main.ONOSbench.cpLogsToDir('/opt/onos/log/karaf.log',
851 '/tmp/', copyFileName='sw_lat_karaf')
852 fResult = open(resultPath, 'a')
853 for line in dbCmdList:
854 if line:
855 fResult.write(line + '\n')
Jon Hall4ba53f02015-07-29 13:07:41 -0700856 main.log.report(line)
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700857 fResult.close()
Jon Hall4ba53f02015-07-29 13:07:41 -0700858
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700859 assertion = main.TRUE
Jon Hall4ba53f02015-07-29 13:07:41 -0700860
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700861 utilities.assert_equals(expect=main.TRUE, actual=assertion,
Jon Hall4ba53f02015-07-29 13:07:41 -0700862 onpass='Switch latency test successful',
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700863 onfail='Switch latency test failed')
864
865 main.Mininet1.stopNet()