blob: e6f62ef956d46dd219cc2eeafb0e3fc7675c2c61 [file] [log] [blame]
GlennRCdc7ab012015-07-23 15:40:12 -07001# CASE1 starts number of nodes specified in param file
2#
3# cameron@onlab.us
4
5class SCPFportLat:
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
GlennRCdc7ab012015-07-23 15:40:12 -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
YPZhang0433bee2016-07-12 16:10:59 -070024 main.testOnDirectory = os.path.dirname(os.getcwd())
GlennRCdc7ab012015-07-23 15:40:12 -070025 checkoutBranch = main.params[ 'GIT' ][ 'checkout' ]
26 gitPull = main.params[ 'GIT' ][ 'autopull' ]
27 cellName = main.params[ 'ENV' ][ 'cellName' ]
28 Apps = main.params[ 'ENV' ][ 'cellApps' ]
29 BENCHIp = main.params[ 'BENCH' ][ 'ip' ]
30 MN1Ip = main.params[ 'MN' ][ 'ip1' ]
31 main.maxNodes = int(main.params[ 'max' ])
32 cellName = main.params[ 'ENV' ][ 'cellName' ]
33 homeDir = os.path.expanduser('~')
34 topoCfgFile = main.params['TEST']['topoConfigFile']
35 topoCfgName = main.params['TEST']['topoConfigName']
GlennRCb3147232015-07-31 14:09:40 -070036 resultPath = main.params['DB']['portEventResultPath']
GlennRCdc7ab012015-07-23 15:40:12 -070037 skipMvn = main.params ['TEST']['mci']
YPZhang0433bee2016-07-12 16:10:59 -070038 main.topology = main.params['DEPENDENCY']['topology']
39 main.dependencyPath = main.testOnDirectory + \
40 main.params['DEPENDENCY']['path']
Jon Hallf632d202015-07-30 15:45:11 -070041 testONpath = re.sub( "(tests)$", "bin", main.testDir ) # TestON/bin
GlennRCdc7ab012015-07-23 15:40:12 -070042
43 # -- INIT SECTION, ONLY RUNS ONCE -- #
44 if init == False:
45 init = True
46 global clusterCount #number of nodes running
47 global ONOSIp #list of ONOS IP addresses
48 global scale
49 global commit
50 global timeToPost
51 global runNum
52 global jenkinsBuildNumber
53 global CLIs
54 CLIs = []
55
56 timeToPost = time.strftime('%Y-%m-%d %H:%M:%S')
57 runNum = time.strftime('%d%H%M%S')
58 ONOSIp = main.ONOSbench.getOnosIps()
59
60 #Assigning ONOS cli handles to a list
61 for i in range(main.maxNodes):
62 CLIs.append( getattr( main, 'ONOS' + str(i+1) + 'cli'))
63
64 try:
65 jenkinsBuildNumber = str(os.environ['BUILD_NUMBER'])
66 main.log.report( 'Jenkins build number: ' + jenkinsBuildNumber )
67 except KeyError:
68 jenkinsBuildNumber = str(0)
69 main.log.info( 'Job is not run by jenkins. ' + 'Build number set to: ' + jenkinsBuildNumber)
70
71 clusterCount = 0
72 ONOSIp = main.ONOSbench.getOnosIps()
73
74 scale = (main.params[ 'SCALE' ]).split(",")
75 clusterCount = int(scale[0])
76
77 #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
78 if skipMvn != "off":
79 mvnResult = main.ONOSbench.cleanInstall()
80
81 #git
82 main.step( "Git checkout and pull " + checkoutBranch )
83 if gitPull == 'on':
84 checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
85 pullResult = main.ONOSbench.gitPull()
86
87 else:
88 checkoutResult = main.TRUE
89 pullResult = main.TRUE
90 main.log.info( "Skipped git checkout and pull" )
91
92 main.step("Grabbing commit number")
93 commit = main.ONOSbench.getVersion()
94 commit = (commit.split(" "))[1]
95
96 main.step("Creating results file")
GlennRCb3147232015-07-31 14:09:40 -070097 resultsDB = open(resultPath, "w+")
GlennRCdc7ab012015-07-23 15:40:12 -070098 resultsDB.close()
99
100 main.log.report('Commit information - ')
101 main.ONOSbench.getVersion(report=True)
102
103 # -- END OF INIT SECTION --#
104
105 main.step("Adjusting scale")
106 clusterCount = int(scale[0])
107 scale.remove(scale[0])
108
109 #kill off all onos processes
110 main.step("Killing all ONOS processes before environmnet setup")
111 for node in range(main.maxNodes):
112 main.ONOSbench.onosDie(ONOSIp[node])
113
114 #Uninstall everywhere
115 main.step( "Cleaning Enviornment..." )
116 for i in range(main.maxNodes):
117 main.log.info(" Uninstalling ONOS " + str(i) )
118 main.ONOSbench.onosUninstall( ONOSIp[i] )
119 main.log.info("Sleep 10 second for uninstall to settle...")
120 time.sleep(10)
121 main.ONOSbench.handle.sendline(" ")
122 main.ONOSbench.handle.expect(":~")
123
124 #construct the cell file
125 main.log.info("Creating cell file")
126 cellIp = []
127 for node in range (clusterCount):
128 cellIp.append(ONOSIp[node])
129
130 main.ONOSbench.createCellFile("localhost",cellName,MN1Ip,str(Apps), cellIp)
131
132 main.step( "Set Cell" )
133 main.ONOSbench.setCell(cellName)
134
135 main.step( "Creating ONOS package" )
136 packageResult = main.ONOSbench.onosPackage()
137
138 main.step( "verify cells" )
139 verifyCellResult = main.ONOSbench.verifyCell()
140
141 main.step('Starting mininet topology ')
YPZhang0433bee2016-07-12 16:10:59 -0700142 copyResult = main.ONOSbench.copyMininetFile(main.topology,
143 main.dependencyPath,
144 main.Mininet1.user_name,
145 main.Mininet1.ip_address)
GlennRCdc7ab012015-07-23 15:40:12 -0700146 main.Mininet1.startNet()
147
GlennRCdc7ab012015-07-23 15:40:12 -0700148 main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
149 for node in range(clusterCount):
150 main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
151 main.ONOSbench.onosInstall( ONOSIp[node])
152
153 for node in range(clusterCount):
154 for i in range( 2 ):
155 isup = main.ONOSbench.isup( ONOSIp[node] )
156 if isup:
157 main.log.info("ONOS " + str(node + 1) + " is up\n")
158 break
159 if not isup:
160 main.log.report( "ONOS " + str(node) + " didn't start!" )
161 main.log.info("Startup sequence complete")
162
163 main.step('Starting onos CLIs')
164 for i in range(clusterCount):
165 CLIs[i].startOnosCli(ONOSIp[i])
166
167 time.sleep(20)
168
169 main.step( 'activating essential applications' )
170 CLIs[0].activateApp( 'org.onosproject.metrics' )
171 CLIs[0].activateApp( 'org.onosproject.openflow' )
172
173 main.step( 'Configuring application parameters' )
174
175 configName = 'org.onosproject.net.topology.impl.DefaultTopologyProvider'
176 configParam = 'maxEvents 1'
177 main.ONOSbench.onosCfgSet( ONOSIp[0], configName, configParam )
178 configParam = 'maxBatchMs 0'
179 main.ONOSbench.onosCfgSet( ONOSIp[0], configName, configParam )
180 configParam = 'maxIdleMs 0'
181 main.ONOSbench.onosCfgSet( ONOSIp[0], configName, configParam )
182
183 def CASE2( self, main ):
184 """
185 Bring port up / down and measure latency.
186 Port enable / disable is simulated by ifconfig up / down
187
188 In ONOS-next, we must ensure that the port we are
189 manipulating is connected to another switch with a valid
190 connection. Otherwise, graph view will not be updated.
191 """
192 import time
193 import subprocess
194 import os
195 import requests
196 import json
197 import numpy
198
199 ONOSUser = main.params['CTRL']['user']
200 numIter = main.params['TEST']['numIter']
201 iterIgnore = int(main.params['TEST']['iterIgnore'])
202
203 deviceTimestampKey = main.params['JSON']['deviceTimestamp']
204 graphTimestampKey = main.params['JSON']['graphTimestamp']
205 linkTimestampKey = main.params['JSON']['linkTimestamp']
206
207 tsharkPortUp = '/tmp/tshark_port_up.txt'
208 tsharkPortDown = '/tmp/tshark_port_down.txt'
209 tsharkPortStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ]
210
211 debugMode = main.params['TEST']['debugMode']
212 postToDB = main.params['DB']['postToDB']
213 resultPath = main.params['DB']['portEventResultPath']
214 localTime = time.strftime('%x %X')
215 localTime = localTime.replace('/', '')
216 localTime = localTime.replace(' ', '_')
217 localTime = localTime.replace(':', '')
218
219 if debugMode == 'on':
220 main.ONOSbench.tsharkPcap('eth0', '/tmp/port_lat_pcap_' + localTime)
221
222 upThresholdStr = main.params['TEST']['portUpThreshold']
223 downThresholdStr = main.params['TEST']['portDownThreshold']
224 upThresholdObj = upThresholdStr.split(',')
225 downThresholdObj = downThresholdStr.split(',')
226 upThresholdMin = int(upThresholdObj[0])
227 upThresholdMax = int(upThresholdObj[1])
228 downThresholdMin = int(downThresholdObj[0])
229 downThresholdMax = int(downThresholdObj[1])
230
231 interfaceConfig = 's1-eth1'
232 main.log.report('Port enable / disable latency')
233 main.log.report('Simulated by ifconfig up / down')
234 main.log.report('Total iterations of test: ' + str(numIter))
235 main.step('Assign switches s1 and s2 to controller 1')
236
237 main.Mininet1.assignSwController(sw='s1', ip=ONOSIp[0])
238 main.Mininet1.assignSwController(sw='s2', ip=ONOSIp[0])
239
240 time.sleep(15)
241
242 portUpEndToEndNodeIter = numpy.zeros((clusterCount, int(numIter)))
243 portUpOfpToDevNodeIter = numpy.zeros((clusterCount, int(numIter)))
244 portUpDevToLinkNodeIter = numpy.zeros((clusterCount, int(numIter)))
245 portUpLinkToGraphNodeIter = numpy.zeros((clusterCount, int(numIter)))
246
247 portDownEndToEndNodeIter = numpy.zeros((clusterCount, int(numIter)))
248 portDownOfpToDevNodeIter = numpy.zeros((clusterCount, int(numIter)))
249 portDownDevToLinkNodeIter = numpy.zeros((clusterCount, int(numIter)))
250 portDownLinkToGraphNodeIter = numpy.zeros((clusterCount, int(numIter)))
251
252 for i in range(0, int(numIter)):
GlennRCf6952812015-08-05 10:49:47 -0700253 main.log.report('Iteration: ' + str(i+1) + ' ClusterCount: ' + str(clusterCount))
GlennRCdc7ab012015-07-23 15:40:12 -0700254 main.step('Starting wireshark capture for port status down')
255 main.ONOSbench.tsharkGrep(tsharkPortStatus, tsharkPortDown)
256
257 time.sleep(2)
258
259 main.step('Disable port: ' + interfaceConfig)
260 main.Mininet1.handle.sendline('sh ifconfig ' +
261 interfaceConfig + ' down')
262 main.Mininet1.handle.expect('mininet>')
263
264 time.sleep(2)
265
266 jsonStrPtDown = []
267 for node in range (0, clusterCount):
268 metricsPortDown = CLIs[node].topologyEventsMetrics()
269 jsonStrPtDown.append(metricsPortDown)
270
271 time.sleep(10)
272
273 main.ONOSbench.tsharkStop()
274
275 fPortDown = open(tsharkPortDown, 'r')
276 fLine = fPortDown.readline()
277 objDown = fLine.split(' ')
278 if len(fLine) > 0:
279 timestampBeginPtDown = int(float(objDown[1]) * 1000)
280 # At times, tshark reports timestamp at the 3rd
281 # index of the array. If initial readings were
282 # unlike the epoch timestamp, then check the 3rd
283 # index and set that as a timestamp
284 if timestampBeginPtDown < 1400000000000:
285 timestampBeginPtDown = int(float(objDown[2]) * 1000)
286 else:
287 main.log.info('Tshark output file returned unexpected' +
288 ' results: ' + str(objDown))
289 timestampBeginPtDown = 0
290 fPortDown.close()
291
292 for node in range(0, clusterCount):
293 nodeNum = node+1
294 metricsDown = CLIs[node].topologyEventsMetrics
295 jsonStrPtDown[node] = metricsDown()
296 jsonObj = json.loads(jsonStrPtDown[node])
297
298 if jsonObj:
299 graphTimestamp = jsonObj[graphTimestampKey]['value']
300 deviceTimestamp = jsonObj[deviceTimestampKey]['value']
301 linkTimestamp = jsonObj[linkTimestampKey]['value']
302 else:
303 main.log.error( "Unexpected json object" )
304 graphTimestamp = 0
305 deviceTimestamp = 0
306 linkTimestamp = 0
307
308 main.log.info('ptDownTimestamp: ' + str(timestampBeginPtDown))
309 main.log.info("graphTimestamp: " + str(graphTimestamp))
310 main.log.info("deviceTimestamp: " + str(deviceTimestamp))
311 main.log.info("linkTimestamp: " + str(linkTimestamp))
312
313 ptDownEndToEnd = int(graphTimestamp) - int(timestampBeginPtDown)
314 ptDownOfpToDevice = float(deviceTimestamp) - float(timestampBeginPtDown)
315 ptDownDeviceToLink = float(linkTimestamp) - float(deviceTimestamp)
316 ptDownLinkToGraph = float(graphTimestamp) - float(linkTimestamp)
317
318 if ptDownEndToEnd < downThresholdMin or ptDownEndToEnd >= downThresholdMax:
319 main.log.info("ONOS " +str(nodeNum) + " surpassed threshold - port down End-to-end: "+ str(ptDownEndToEnd) + " ms")
320 elif i < iterIgnore:
321 main.log.info("ONOS "+str(nodeNum) + " warming up - port down End-to-end: "+ str(ptDownEndToEnd) + " ms")
322 else:
323 portDownEndToEndNodeIter[node][i] = ptDownEndToEnd
324 main.log.info("ONOS "+str(nodeNum) + " port down End-to-end: "+ str(ptDownEndToEnd) + " ms")
325
326 if ptDownOfpToDevice < downThresholdMin or ptDownOfpToDevice >= downThresholdMax:
327 main.log.info("ONOS " +str(nodeNum) + " surpassed threshold - port down Ofp-to-device: "+ str(ptDownOfpToDevice) + " ms")
328 elif i < iterIgnore:
329 main.log.info("ONOS "+str(nodeNum) + " warming up - port down Ofp-to-device: "+ str(ptDownOfpToDevice) + " ms")
330 else:
331 portDownOfpToDevNodeIter[node][i] = ptDownOfpToDevice
332 main.log.info("ONOS "+str(nodeNum) + " port down Ofp-to-device: "+ str(ptDownOfpToDevice) + " ms")
333
334 if ptDownDeviceToLink < downThresholdMin or ptDownDeviceToLink >= downThresholdMax:
335 main.log.info("ONOS " +str(nodeNum) + " surpassed threshold - port down Device-to-link: "+ str(ptDownDeviceToLink) + " ms")
336 elif i < iterIgnore:
337 main.log.info("ONOS "+str(nodeNum) + " warming up - port down Device-to-link: "+ str(ptDownDeviceToLink) + " ms")
338 else:
339 portDownDevToLinkNodeIter[node][i] = ptDownDeviceToLink
340 main.log.info("ONOS "+str(nodeNum) + " port down Device-to-link: "+ str(ptDownDeviceToLink) + " ms")
341
342 if ptDownLinkToGraph < downThresholdMin or ptDownLinkToGraph >= downThresholdMax:
343 main.log.info("ONOS " +str(nodeNum) + " surpassed threshold - port down Link-to-graph: "+ str(ptDownLinkToGraph) + " ms")
344 elif i < iterIgnore:
345 main.log.info("ONOS "+str(nodeNum) + " warming up - port down Link-to-graph: "+ str(ptDownLinkToGraph) + " ms")
346 else:
347 portDownLinkToGraphNodeIter[node][i] = ptDownLinkToGraph
348 main.log.info("ONOS "+str(nodeNum) + " port down Link-to-graph: "+ str(ptDownLinkToGraph) + " ms")
349
350 time.sleep(3)
351
352 main.step('Starting wireshark capture for port status up')
353 main.ONOSbench.tsharkGrep(tsharkPortStatus, tsharkPortUp)
354
355 time.sleep(5)
356 main.step('Enable port and obtain timestamp')
357 main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up')
358 main.Mininet1.handle.expect('mininet>')
359
GlennRCb3147232015-07-31 14:09:40 -0700360 time.sleep(5)
361
GlennRCdc7ab012015-07-23 15:40:12 -0700362 jsonStrPtUp = []
363 for node in range (0, clusterCount):
364 metricsPortUp = CLIs[node].topologyEventsMetrics()
365 jsonStrPtUp.append(metricsPortUp)
366
367 time.sleep(5)
368 main.ONOSbench.tsharkStop()
369
370 time.sleep(3)
371
372 fPortUp = open(tsharkPortUp, 'r')
373 fLine = fPortUp.readline()
374 objUp = fLine.split(' ')
375 if len(fLine) > 0:
376 timestampBeginPtUp = int(float(objUp[1]) * 1000)
377 if timestampBeginPtUp < 1400000000000:
378 timestampBeginPtUp = int(float(objUp[2]) * 1000)
379 else:
380 main.log.info('Tshark output file returned unexpected' + ' results.')
381 timestampBeginPtUp = 0
382 fPortUp.close()
383
384 for node in range(0, clusterCount):
385 nodeNum = node+1
386 metricsUp = CLIs[node].topologyEventsMetrics
387 jsonStrUp = metricsUp()
388 jsonObj = json.loads(jsonStrPtUp[node])
389
390 if jsonObj:
391 graphTimestamp = jsonObj[graphTimestampKey]['value']
392 deviceTimestamp = jsonObj[deviceTimestampKey]['value']
393 linkTimestamp = jsonObj[linkTimestampKey]['value']
394 else:
395 main.log.error( "Unexpected json object" )
396 graphTimestamp = 0
397 deviceTimestamp = 0
398 linkTimestamp = 0
399
400
GlennRCb3147232015-07-31 14:09:40 -0700401 main.log.info('ptUpTimestamp: ' + str(timestampBeginPtUp))
GlennRCdc7ab012015-07-23 15:40:12 -0700402 main.log.info("graphTimestamp: " + str(graphTimestamp))
403 main.log.info("deviceTimestamp: " + str(deviceTimestamp))
404 main.log.info("linkTimestamp: " + str(linkTimestamp))
405
406 ptUpEndToEnd = int(graphTimestamp) - int(timestampBeginPtUp)
407 ptUpOfpToDevice = float(deviceTimestamp) - float(timestampBeginPtUp)
408 ptUpDeviceToLink = float(linkTimestamp) - float(deviceTimestamp)
409 ptUpLinkToGraph = float(graphTimestamp) - float(linkTimestamp)
410
411 if ptUpEndToEnd < upThresholdMin or ptUpEndToEnd >= upThresholdMax:
412 main.log.info("ONOS " +str(nodeNum) + " surpassed threshold - port up End-to-end: "+ str(ptUpEndToEnd) + " ms")
413 elif i < iterIgnore:
414 main.log.info("ONOS "+str(nodeNum) + " warming up - port up End-to-end: "+ str(ptUpEndToEnd) + " ms")
415 else:
416 portUpEndToEndNodeIter[node][i] = ptUpEndToEnd
417 main.log.info("ONOS "+str(nodeNum) + " port up End-to-end: "+ str(ptUpEndToEnd) + " ms")
418
419 if ptUpOfpToDevice < upThresholdMin or ptUpOfpToDevice >= upThresholdMax:
420 main.log.info("ONOS " + str(nodeNum) + " surpassed threshold - port up Ofp-to-device: "+ str(ptUpOfpToDevice) + " ms")
421 elif i < iterIgnore:
422 main.log.info("ONOS "+ str(nodeNum) + " warming up - port up Ofp-to-device: "+ str(ptUpOfpToDevice) + " ms")
423 else:
424 portUpOfpToDevNodeIter[node][i] = ptUpOfpToDevice
425 main.log.info("ONOS "+ str(nodeNum) + " port up Ofp-to-device: "+ str(ptUpOfpToDevice) + " ms")
426
427 if ptUpDeviceToLink < upThresholdMin or ptUpDeviceToLink >= upThresholdMax:
428 main.log.info("ONOS " +str(nodeNum) + " surpassed threshold - port up Device-to-link: "+ str(ptUpDeviceToLink) + " ms")
429 elif i < iterIgnore:
430 main.log.info("ONOS "+str(nodeNum) + " warming up - port up Device-to-link: "+ str(ptUpDeviceToLink) + " ms")
431 else:
432 portUpDevToLinkNodeIter[node][i] = ptUpDeviceToLink
433 main.log.info("ONOS "+str(nodeNum) + " port up Device-to-link: "+ str(ptUpDeviceToLink) + " ms")
434
435 if ptUpLinkToGraph < upThresholdMin or ptUpLinkToGraph >= upThresholdMax:
436 main.log.info("ONOS " + str(nodeNum) + " surpassed threshold - port up Link-to-graph: " + str(ptUpLinkToGraph) + " ms")
437 elif i < iterIgnore:
438 main.log.info("ONOS " + str(nodeNum) + " warming up - port up Link-to-graph: " + str(ptUpLinkToGraph) + " ms")
439 else:
440 portUpLinkToGraphNodeIter[node][i] = ptUpLinkToGraph
441 main.log.info("ONOS " + str(nodeNum) + " port up Link-to-graph: " + str(ptUpLinkToGraph) + " ms")
442
443 dbCmdList = []
444 for node in range(0, clusterCount):
445 portUpEndToEndList = []
446 portUpOfpToDevList = []
447 portUpDevToLinkList = []
448 portUpLinkToGraphList = []
449
450 portDownEndToEndList = []
451 portDownOfpToDevList = []
452 portDownDevToLinkList = []
453 portDownLinkToGraphList = []
454
455 portUpEndToEndAvg = 0
456 portUpOfpToDevAvg = 0
457 portUpDevToLinkAvg = 0
458 portUpLinkToGraphAvg = 0
459
460 portDownEndToEndAvg = 0
461 portDownOfpToDevAvg = 0
462 portDownDevToLinkAvg = 0
463 portDownLinkToGraphAvg = 0
464
465 # TODO: Update for more pythonic way to get list
466 # portUpDevList = [item for item in portUpDevNodeIter[node]
467 # if item > 0.0]
468 for item in portUpEndToEndNodeIter[node]:
469 if item > 0.0:
470 portUpEndToEndList.append(item)
471
472 for item in portUpOfpToDevNodeIter[node]:
473 if item > 0.0:
474 portUpOfpToDevList.append(item)
475
476 for item in portUpDevToLinkNodeIter[node]:
477 if item > 0.0:
478 portUpDevToLinkList.append(item)
479
480 for item in portUpLinkToGraphNodeIter[node]:
481 if item >= 0.0:
482 portUpLinkToGraphList.append(item)
483
484 for item in portDownEndToEndNodeIter[node]:
485 if item > 0.0:
486 portDownEndToEndList.append(item)
487
488 for item in portDownOfpToDevNodeIter[node]:
489 if item > 0.0:
490 portDownOfpToDevList.append(item)
491
492 for item in portDownDevToLinkNodeIter[node]:
493 if item >= 0.0:
494 portDownDevToLinkList.append(item)
495
496 for item in portDownLinkToGraphNodeIter[node]:
497 if item >= 0.0:
498 portDownLinkToGraphList.append(item)
499
500 portUpEndToEndAvg = round(numpy.mean(portUpEndToEndList), 2)
501 portUpOfpToDevAvg = round(numpy.mean(portUpOfpToDevList), 2)
502 portUpDevToLinkAvg = round(numpy.mean(portUpDevToLinkList), 2)
503 portUpLinkToGraphAvg = round(numpy.mean(portUpLinkToGraphList), 2)
504
505 portDownEndToEndAvg = round(numpy.mean(portDownEndToEndList), 2)
506 portDownOfpToDevAvg = round(numpy.mean(portDownOfpToDevList), 2)
507 portDownDevToLinkAvg = round(numpy.mean(portDownDevToLinkList), 2)
508 portDownLinkToGraphAvg = round(numpy.mean(portDownLinkToGraphList), 2)
509
510 portUpStdDev = round(numpy.std(portUpEndToEndList), 2)
511 portDownStdDev = round(numpy.std(portDownEndToEndList), 2)
512
513 main.log.report(' - Node ' + str(node + 1) + ' Summary ---------------- ')
514 main.log.report(' Port up End-to-end ' +
515 str(portUpEndToEndAvg) + ' ms')
516 main.log.report(' Port up Ofp-to-device ' +
517 str(portUpOfpToDevAvg) + ' ms')
518 main.log.report(' Port up Device-to-link ' +
519 str(portUpDevToLinkAvg) + ' ms')
520 main.log.report(' Port up Link-to-graph ' +
521 str(portUpLinkToGraphAvg) + ' ms')
522
523 main.log.report(' Port down End-to-end ' +
524 str(round(portDownEndToEndAvg, 2)) + ' ms')
525 main.log.report(' Port down Ofp-to-device ' +
526 str(portDownOfpToDevAvg) + ' ms')
527 main.log.report(' Port down Device-to-link ' +
528 str(portDownDevToLinkAvg) + ' ms')
529 main.log.report(' Port down Link-to-graph' +
530 str(portDownLinkToGraphAvg) + ' ms')
531
suibin zhangcd907aa2015-09-02 17:15:16 -0700532 dbCmdList.append(
suibin zhange94604c2015-09-02 20:25:38 -0700533 "'" + timeToPost + "','port_latency_results'," + jenkinsBuildNumber +
GlennRCdc7ab012015-07-23 15:40:12 -0700534 ',' + str(clusterCount) + ",'baremetal" + str(node + 1) +
535 "'," +
536 str(portUpEndToEndAvg) +',' +
537 str(portUpOfpToDevAvg) + ',' +
538 str(portUpDevToLinkAvg) + ',' +
539 str(portUpLinkToGraphAvg) + ',' +
540 str(portDownEndToEndAvg) + ',' +
541 str(portDownOfpToDevAvg) + ',' +
542 str(portDownDevToLinkAvg) + ',' +
suibin zhangcd907aa2015-09-02 17:15:16 -0700543 str(portDownLinkToGraphAvg))
GlennRCdc7ab012015-07-23 15:40:12 -0700544
545 fResult = open(resultPath, 'a')
546 for line in dbCmdList:
547 if line:
548 fResult.write(line + '\n')
549
550 fResult.close()
551
552 # Delete switches from controller to prepare for next
553 # set of tests
554 main.Mininet1.deleteSwController('s1')
555 main.Mininet1.deleteSwController('s2')
556
557 main.log.info("Stopping mininet")
558 main.Mininet1.stopNet()