blob: 6a5731d2cca32b811c060d11d3a82e708589a20c [file] [log] [blame]
YPZhang38fb1192016-08-11 11:03:38 -07001'''
2 SCPFswitchLat
3 Test Switch add/remove latency
4 calculate package latency between switch and ONOS
5 Switch UP:
6 TCP -- Feature Reply -- Role Request -- Role Reply -- Device -- Graph
7 Siwtch Down:
8 Openflow FIN/ACK -- ACK -- Device -- Graph
9'''
cameron@onlab.us21106ea2015-07-23 15:32:51 -070010
11class SCPFswitchLat:
12
YPZhang38fb1192016-08-11 11:03:38 -070013 def __init__(self):
cameron@onlab.us21106ea2015-07-23 15:32:51 -070014 self.default = ''
15
YPZhang38fb1192016-08-11 11:03:38 -070016 def CASE0( self, main ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -070017 import os
YPZhang38fb1192016-08-11 11:03:38 -070018 import imp
19 '''
20 - GIT
21 - BUILDING ONOS
22 Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
23 This step is usually skipped. Because in a Jenkins driven automated
24 test env. We want Jenkins jobs to pull&build for flexibility to handle
25 different versions of ONOS.
26 - Construct tests variables
27 '''
28 gitPull = main.params['GIT']['gitPull']
29 gitBranch = main.params['GIT']['gitBranch']
30
31 main.case( "Pull onos branch and build onos on Teststation." )
32
33 if gitPull == 'True':
34 main.step( "Git Checkout ONOS branch: " + gitBranch )
35 stepResult = main.ONOSbench.gitCheckout( branch=gitBranch )
36 utilities.assert_equals(expect=main.TRUE,
37 actual=stepResult,
38 onpass="Successfully checkout onos branch.",
39 onfail="Failed to checkout onos branch. Exiting test...")
40 if not stepResult: main.exit()
41
42 main.step( "Git Pull on ONOS branch:" + gitBranch )
43 stepResult = main.ONOSbench.gitPull()
44 utilities.assert_equals(expect=main.TRUE,
45 actual=stepResult,
46 onpass="Successfully pull onos. ",
47 onfail="Failed to pull onos. Exiting test ...")
48 if not stepResult: main.exit()
49
YPZhang38fb1192016-08-11 11:03:38 -070050
51 else:
52 main.log.warn( "Skipped pulling onos and Skipped building ONOS" )
chengchiyu08303a02016-09-08 17:40:26 -070053 # The dictionary to record different type of wrongs
54 main.wrong = { 'totalWrong': 0, 'skipDown' : 0, 'TsharkValueIncorrect': 0,
55 'TypeError' : 0, 'decodeJasonError': 0,
56 'checkResultIncorrect': 0}
57 main.maxWrong = int( main.params['TEST'] ['MaxWrong'] )
58 main.resultRange = main.params['TEST']['ResultRange']
59 main.searchTerm = main.params['TEST']['SearchTerm']
60 main.testOnDirectory = os.path.dirname( os.getcwd() )
YPZhang38fb1192016-08-11 11:03:38 -070061 main.MN1Ip = main.params['MN']['ip1']
62 main.dependencyPath = main.testOnDirectory + \
63 main.params['DEPENDENCY']['path']
64 main.topoName = main.params['DEPENDENCY']['topology']
65 main.dependencyFunc = main.params['DEPENDENCY']['function']
66 main.cellName = main.params['ENV']['cellName']
67 main.Apps = main.params['ENV']['cellApps']
68 main.scale = (main.params['SCALE']).split(",")
69
70 main.ofPackage = main.params['TSHARK']
71
72 main.tsharkResultPath = main.params['TEST']['tsharkResultPath']
73 main.sampleSize = int(main.params['TEST']['sampleSize'])
74 main.warmUp = int(main.params['TEST']['warmUp'])
75 main.dbFileName = main.params['DATABASE']['dbName']
76 main.startUpSleep = int(main.params['SLEEP']['startup'])
77 main.measurementSleep = int( main.params['SLEEP']['measure'] )
chengchiyu08303a02016-09-08 17:40:26 -070078 main.deleteSwSleep = int( main.params['SLEEP']['deleteSW'] )
YPZhang38fb1192016-08-11 11:03:38 -070079 main.maxScale = int( main.params['max'] )
80 main.timeout = int( main.params['TIMEOUT']['timeout'] )
81 main.MNSleep = int( main.params['SLEEP']['mininet'])
82 main.device = main.params['TEST']['device']
YPZhang38fb1192016-08-11 11:03:38 -070083 main.log.info("Create Database file " + main.dbFileName)
84 resultsDB = open(main.dbFileName, "w+")
85 resultsDB.close()
86
87 main.switchFunc = imp.load_source(main.dependencyFunc,
88 main.dependencyPath +
89 main.dependencyFunc +
90 ".py")
91
92 def CASE1(self, main):
93 # Clean up test environment and set up
cameron@onlab.us21106ea2015-07-23 15:32:51 -070094 import time
YPZhang38fb1192016-08-11 11:03:38 -070095 main.log.info("Get ONOS cluster IP")
96 print(main.scale)
97 main.numCtrls = int(main.scale.pop(0))
98 main.ONOSip = []
99 main.maxNumBatch = 0
100 main.AllONOSip = main.ONOSbench.getOnosIps()
101 for i in range(main.numCtrls):
102 main.ONOSip.append(main.AllONOSip[i])
103 main.log.info(main.ONOSip)
104 main.CLIs = []
105 main.log.info("Creating list of ONOS cli handles")
106 for i in range(main.numCtrls):
Devin Lim28706842017-06-08 10:23:48 -0700107 main.CLIs.append(getattr(main, 'ONOScli%s' % (i + 1)))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700108
YPZhang38fb1192016-08-11 11:03:38 -0700109 if not main.CLIs:
110 main.log.error("Failed to create the list of ONOS cli handles")
111 main.cleanup()
112 main.exit()
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700113
YPZhang38fb1192016-08-11 11:03:38 -0700114 main.commit = main.ONOSbench.getVersion(report=True)
115 main.commit = main.commit.split(" ")[1]
116 main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls)
117 main.log.info("Safety check, killing all ONOS processes" +
118 " before initiating environment setup")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700119
YPZhang38fb1192016-08-11 11:03:38 -0700120 for i in range(main.numCtrls):
You Wangb98a9fa2017-02-15 17:27:42 -0800121 main.ONOSbench.onosStop(main.ONOSip[i])
122 main.ONOSbench.onosKill(main.ONOSip[i])
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700123
YPZhang38fb1192016-08-11 11:03:38 -0700124 main.log.info("NODE COUNT = %s" % main.numCtrls)
125 main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
126 main.cellName,
127 main.MN1Ip,
128 main.Apps,
Devin Limdc78e202017-06-09 18:30:07 -0700129 main.ONOSip, main.ONOScli1.karafUser)
YPZhang38fb1192016-08-11 11:03:38 -0700130 main.step("Apply cell to environment")
131 cellResult = main.ONOSbench.setCell(main.cellName)
132 verifyResult = main.ONOSbench.verifyCell()
133 stepResult = cellResult and verifyResult
134 utilities.assert_equals(expect=main.TRUE,
135 actual=stepResult,
136 onpass="Successfully applied cell to " + \
137 "environment",
138 onfail="Failed to apply cell to environment ")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700139
YPZhang38fb1192016-08-11 11:03:38 -0700140 main.step("Creating ONOS package")
Jon Hallbd60ea02016-08-23 10:03:59 -0700141 packageResult = main.ONOSbench.buckBuild()
YPZhang38fb1192016-08-11 11:03:38 -0700142 stepResult = packageResult
143 utilities.assert_equals(expect=main.TRUE,
144 actual=stepResult,
145 onpass="Successfully created ONOS package",
146 onfail="Failed to create ONOS package")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700147
YPZhang38fb1192016-08-11 11:03:38 -0700148 main.step("Uninstall ONOS package on all Nodes")
149 uninstallResult = main.TRUE
150 for i in range(int(main.numCtrls)):
151 main.log.info("Uninstalling package on ONOS Node IP: " + main.ONOSip[i])
152 u_result = main.ONOSbench.onosUninstall(main.ONOSip[i])
153 utilities.assert_equals(expect=main.TRUE, actual=u_result,
154 onpass="Test step PASS",
155 onfail="Test step FAIL")
156 uninstallResult = (uninstallResult and u_result)
Jon Hall4ba53f02015-07-29 13:07:41 -0700157
YPZhang38fb1192016-08-11 11:03:38 -0700158 main.step("Install ONOS package on all Nodes")
159 installResult = main.TRUE
160 for i in range(int(main.numCtrls)):
161 main.log.info("Installing package on ONOS Node IP: " + main.ONOSip[i])
162 i_result = main.ONOSbench.onosInstall(node=main.ONOSip[i])
163 utilities.assert_equals(expect=main.TRUE, actual=i_result,
164 onpass="Test step PASS",
165 onfail="Test step FAIL")
166 installResult = installResult and i_result
167
Chiyu Chengef109502016-11-21 15:51:38 -0800168 main.step( "Set up ONOS secure SSH" )
169 secureSshResult = main.TRUE
170 for i in range( int( main.numCtrls ) ):
171 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
172 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
173 onpass="Test step PASS",
174 onfail="Test step FAIL" )
175
You Wang0357c432017-01-09 16:13:33 -0800176 time.sleep( main.startUpSleep )
177 main.step( "Starting ONOS service" )
178 stopResult = main.TRUE
179 startResult = main.TRUE
180 onosIsUp = main.TRUE
181 for i in range( main.numCtrls ):
182 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
183 if onosIsUp == main.TRUE:
184 main.log.report( "ONOS instance is up and ready" )
185 else:
186 main.log.report( "ONOS instance may not be up, stop and " +
187 "start ONOS again " )
188 for i in range( main.numCtrls ):
189 stopResult = stopResult and \
190 main.ONOSbench.onosStop( main.ONOSip[ i ] )
191 for i in range( main.numCtrls ):
192 startResult = startResult and \
193 main.ONOSbench.onosStart( main.ONOSip[ i ] )
194 stepResult = onosIsUp and stopResult and startResult
195 utilities.assert_equals( expect=main.TRUE,
196 actual=stepResult,
197 onpass="ONOS service is ready",
198 onfail="ONOS service did not start properly" )
199
YPZhang38fb1192016-08-11 11:03:38 -0700200 time.sleep(2)
201 main.step("Start ONOS CLI on all nodes")
202 cliResult = main.TRUE
203 main.step(" Start ONOS cli using thread ")
204 startCliResult = main.TRUE
205 pool = []
206 main.threadID = 0
207 for i in range(int(main.numCtrls)):
208 t = main.Thread(target=main.CLIs[i].startOnosCli,
209 threadID=main.threadID,
210 name="startOnosCli",
211 args=[main.ONOSip[i]],
212 kwargs={"onosStartTimeout": main.timeout})
213 pool.append(t)
214 t.start()
215 main.threadID = main.threadID + 1
216 for t in pool:
217 t.join()
218 startCliResult = startCliResult and t.result
219 time.sleep(main.startUpSleep)
220
221 main.log.info("Configure apps")
222 main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider",
223 "maxEvents 1")
224 main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider",
225 "maxBatchMs 0")
226 main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider",
227 "maxIdleMs 0")
chengchiyu08303a02016-09-08 17:40:26 -0700228 for i in range(main.numCtrls):
229 main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.topology")
YPZhang38fb1192016-08-11 11:03:38 -0700230 time.sleep(1)
231
232 main.log.info("Copy topology file to Mininet")
233 main.ONOSbench.copyMininetFile(main.topoName,
234 main.dependencyPath,
235 main.Mininet1.user_name,
236 main.Mininet1.ip_address)
237 main.log.info("Stop Mininet...")
238 main.Mininet1.stopNet()
239 time.sleep(main.MNSleep)
240 main.log.info("Start new mininet topology")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700241 main.Mininet1.startNet()
YPZhang38fb1192016-08-11 11:03:38 -0700242 main.log.info("Assign switch to controller to ONOS node 1")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700243
YPZhang38fb1192016-08-11 11:03:38 -0700244 time.sleep(2)
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700245
YPZhang38fb1192016-08-11 11:03:38 -0700246 def CASE2(self,main):
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700247 import time
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700248 import json
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700249 import numpy
250
YPZhang38fb1192016-08-11 11:03:38 -0700251 resultDict = {'up' : {}, 'down' : {}}
252 for i in range(1, main.numCtrls + 1):
253 resultDict['up'][ 'node' + str(i) ] = {}
254 resultDict['up'][ 'node' + str(i) ][ 'Ave' ] = {}
255 resultDict['up'][ 'node' + str(i) ][ 'Std' ] = {}
256 resultDict['up'][ 'node' + str(i) ][ 'T_F' ] = []#TCP to Feature
257 resultDict['up'][ 'node' + str(i) ][ 'F_R' ] = []#Feature to Role
258 resultDict['up'][ 'node' + str(i) ][ 'RQ_RR' ] = []#role request to role reply
259 resultDict['up'][ 'node' + str(i) ][ 'RR_D' ] = []#role reply to Device
260 resultDict['up'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph
261 resultDict['up'][ 'node' + str(i) ][ 'E_E' ] = []#TCP to Graph
Jon Hall4ba53f02015-07-29 13:07:41 -0700262
YPZhang38fb1192016-08-11 11:03:38 -0700263 for i in range(1,main.numCtrls + 1):
264 resultDict['down'][ 'node' + str(i) ] = {}
265 resultDict['down'][ 'node' + str(i) ][ 'Ave' ] = {}
266 resultDict['down'][ 'node' + str(i) ][ 'Std' ] = {}
267 resultDict['down'][ 'node' + str(i) ][ 'FA_A' ] = []#Fin_ack to ACK
268 resultDict['down'][ 'node' + str(i) ][ 'A_D' ] = []#Ack to Device
269 resultDict['down'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph
270 resultDict['down'][ 'node' + str(i) ][ 'E_E' ] = []#fin_ack to Graph
271 for i in range(1 , main.sampleSize + main.warmUp):
272 main.log.info("************************************************************")
273 main.log.info("************************ Iteration: {} **********************" .format(str( i )) )
274 if i < main.warmUp:
275 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
276 "up", resultDict, True )
277 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
278 "down", resultDict, True )
chengchiyu08303a02016-09-08 17:40:26 -0700279 main.CLIs[0].removeDevice( "of:0000000000000001" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700280 else:
YPZhang38fb1192016-08-11 11:03:38 -0700281 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
282 "up", resultDict, False )
283 main.switchFunc.captureOfPack (main, main.device, main.ofPackage,
284 "down", resultDict, False )
chengchiyu08303a02016-09-08 17:40:26 -0700285 main.CLIs[0].removeDevice( "of:0000000000000001" )
286
YPZhang38fb1192016-08-11 11:03:38 -0700287 # Dictionary for result
288 maxDict = {}
289 maxDict['down'] = {}
290 maxDict['up'] = {}
291 maxDict['down']['max'] = 0
292 maxDict['up']['max'] = 0
293 maxDict['down']['node'] = 0
294 maxDict['up']['node'] = 0
Jon Hall4ba53f02015-07-29 13:07:41 -0700295
YPZhang38fb1192016-08-11 11:03:38 -0700296 for i in range(1, main.numCtrls + 1):
297 # calculate average and std for result, and grep the max End to End data
298 EtoEtemp = numpy.average( resultDict['up'][ 'node' + str(i) ]['E_E'] )
299 resultDict['up'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
300 if maxDict['up']['max'] < EtoEtemp:
301 # get max End to End latency
302 maxDict['up']['max'] = EtoEtemp
303 maxDict['up']['node'] = i
304 resultDict['up']['node' + str(i)]['Ave']['T_F'] = numpy.average(resultDict['up']['node' + str(i)]['T_F'])
305 resultDict['up']['node' + str(i)]['Ave']['F_R'] = numpy.average(resultDict['up']['node' + str(i)]['F_R'])
306 resultDict['up']['node' + str(i)]['Ave']['RQ_RR'] = numpy.average(resultDict['up']['node' + str(i)]['RQ_RR'])
307 resultDict['up']['node' + str(i)]['Ave']['RR_D'] = numpy.average(resultDict['up']['node' + str(i)]['RR_D'])
308 resultDict['up']['node' + str(i)]['Ave']['D_G'] = numpy.average(resultDict['up']['node' + str(i)]['D_G'])
Jon Hall4ba53f02015-07-29 13:07:41 -0700309
YPZhang38fb1192016-08-11 11:03:38 -0700310 resultDict['up'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['up'][ 'node' + str(i) ]['E_E'] )
311 resultDict['up']['node' + str(i)]['Std']['T_F'] = numpy.std(resultDict['up']['node' + str(i)]['T_F'])
312 resultDict['up']['node' + str(i)]['Std']['F_R'] = numpy.std(resultDict['up']['node' + str(i)]['F_R'])
313 resultDict['up']['node' + str(i)]['Std']['RQ_RR'] = numpy.std(resultDict['up']['node' + str(i)]['RQ_RR'])
314 resultDict['up']['node' + str(i)]['Std']['RR_D'] = numpy.std(resultDict['up']['node' + str(i)]['RR_D'])
315 resultDict['up']['node' + str(i)]['Std']['D_G'] = numpy.std(resultDict['up']['node' + str(i)]['D_G'])
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700316
YPZhang38fb1192016-08-11 11:03:38 -0700317 # calculate average and std for result, and grep the max End to End data
318 EtoEtemp = numpy.average( resultDict['down'][ 'node' + str(i) ]['E_E'] )
319 resultDict['down'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
320 if maxDict['down']['max'] < EtoEtemp:
321 # get max End to End latency
322 maxDict['down']['max'] = EtoEtemp
323 maxDict['down']['node'] = i
324 resultDict['down']['node' + str(i)]['Ave']['FA_A'] = numpy.average(resultDict['down']['node' + str(i)]['FA_A'])
325 resultDict['down']['node' + str(i)]['Ave']['A_D'] = numpy.average(resultDict['down']['node' + str(i)]['A_D'])
326 resultDict['down']['node' + str(i)]['Ave']['D_G'] = numpy.average(resultDict['down']['node' + str(i)]['D_G'])
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700327
YPZhang38fb1192016-08-11 11:03:38 -0700328 resultDict['down'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['down'][ 'node' + str(i) ]['E_E'] )
329 resultDict['down']['node' + str(i)]['Std']['FA_A'] = numpy.std(resultDict['down']['node' + str(i)]['FA_A'])
330 resultDict['down']['node' + str(i)]['Std']['A_D'] = numpy.std(resultDict['down']['node' + str(i)]['A_D'])
331 resultDict['down']['node' + str(i)]['Std']['D_G'] = numpy.std(resultDict['down']['node' + str(i)]['D_G'])
Jon Hall4ba53f02015-07-29 13:07:41 -0700332
YPZhang38fb1192016-08-11 11:03:38 -0700333 main.log.report( "=====node{} Summary:=====".format( str(i) ) )
334 main.log.report( "=============Switch up=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700335
YPZhang38fb1192016-08-11 11:03:38 -0700336 main.log.report(
337 "End to End average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) )
338 main.log.report(
339 "End to End Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'E_E' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700340
YPZhang38fb1192016-08-11 11:03:38 -0700341 main.log.report(
342 "TCP to Feature average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'T_F' ]) ) )
343 main.log.report(
344 "TCP to Feature Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'T_F' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700345
YPZhang38fb1192016-08-11 11:03:38 -0700346 main.log.report(
347 "Feature to Role average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'F_R' ]) ) )
348 main.log.report(
349 "Feature to Role Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'F_R' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700350
YPZhang38fb1192016-08-11 11:03:38 -0700351 main.log.report(
352 "Role request to Role reply average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RQ_RR' ]) ) )
353 main.log.report(
354 "Role request to Role reply Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'RQ_RR' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700355
YPZhang38fb1192016-08-11 11:03:38 -0700356 main.log.report(
357 "Role reply to Device average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RR_D' ]) ) )
358 main.log.report(
359 "Role reply to Device Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'RR_D' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700360
YPZhang38fb1192016-08-11 11:03:38 -0700361 main.log.report(
362 "Device to Graph average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) )
363 main.log.report(
364 "Device to Graph Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'D_G' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700365
YPZhang38fb1192016-08-11 11:03:38 -0700366 main.log.report( "=============Switch down=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700367
YPZhang38fb1192016-08-11 11:03:38 -0700368 main.log.report(
369 "End to End average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) )
370 main.log.report(
371 "End to End Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'E_E' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700372
YPZhang38fb1192016-08-11 11:03:38 -0700373 main.log.report(
374 "Fin_ACK to ACK average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'FA_A' ]) ) )
375 main.log.report(
376 "Fin_ACK to ACK Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'FA_A' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700377
YPZhang38fb1192016-08-11 11:03:38 -0700378 main.log.report(
379 "ACK to Device average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'A_D' ]) ) )
380 main.log.report(
381 "ACK to Device Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'A_D' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700382
YPZhang38fb1192016-08-11 11:03:38 -0700383 main.log.report(
384 "Device to Graph average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) )
385 main.log.report(
386 "Device to Graph Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'D_G' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700387
YPZhang38fb1192016-08-11 11:03:38 -0700388 with open(main.dbFileName, "a") as dbFile:
389 # TODO: Save STD to Database
390 # Scale number
391 temp = str(main.numCtrls)
392 temp += ",'baremetal1'"
393 # put result
394 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'E_E' ] )
395 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'T_F' ] )
396 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'F_R' ] )
397 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RQ_RR' ] )
398 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RR_D' ] )
399 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'D_G' ] )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700400
YPZhang38fb1192016-08-11 11:03:38 -0700401 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'E_E' ] )
402 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'FA_A' ] )
403 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'A_D' ] )
404 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'D_G' ] )
chengchiyuc6f4cc02016-08-24 14:04:20 -0700405
406 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Std' ][ 'E_E' ] )
407 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Std' ][ 'E_E' ] )
408
YPZhang38fb1192016-08-11 11:03:38 -0700409 temp += "\n"
410 dbFile.write( temp )
411 dbFile.close()