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