blob: ceacb73fd540fe69b1fa6784f1726a785145879d [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
50 main.step( "Building ONOS branch: " + gitBranch )
51 stepResult = main.ONOSbench.cleanInstall( skipTest=True )
52 utilities.assert_equals(expect=main.TRUE,
53 actual=stepResult,
54 onpass="Successfully build onos.",
55 onfail="Failed to build onos. Exiting test...")
56 if not stepResult: main.exit()
57
58 else:
59 main.log.warn( "Skipped pulling onos and Skipped building ONOS" )
chengchiyu08303a02016-09-08 17:40:26 -070060 # The dictionary to record different type of wrongs
61 main.wrong = { 'totalWrong': 0, 'skipDown' : 0, 'TsharkValueIncorrect': 0,
62 'TypeError' : 0, 'decodeJasonError': 0,
63 'checkResultIncorrect': 0}
64 main.maxWrong = int( main.params['TEST'] ['MaxWrong'] )
65 main.resultRange = main.params['TEST']['ResultRange']
66 main.searchTerm = main.params['TEST']['SearchTerm']
67 main.testOnDirectory = os.path.dirname( os.getcwd() )
YPZhang38fb1192016-08-11 11:03:38 -070068 main.MN1Ip = main.params['MN']['ip1']
69 main.dependencyPath = main.testOnDirectory + \
70 main.params['DEPENDENCY']['path']
71 main.topoName = main.params['DEPENDENCY']['topology']
72 main.dependencyFunc = main.params['DEPENDENCY']['function']
73 main.cellName = main.params['ENV']['cellName']
74 main.Apps = main.params['ENV']['cellApps']
75 main.scale = (main.params['SCALE']).split(",")
76
77 main.ofPackage = main.params['TSHARK']
78
79 main.tsharkResultPath = main.params['TEST']['tsharkResultPath']
80 main.sampleSize = int(main.params['TEST']['sampleSize'])
81 main.warmUp = int(main.params['TEST']['warmUp'])
82 main.dbFileName = main.params['DATABASE']['dbName']
83 main.startUpSleep = int(main.params['SLEEP']['startup'])
84 main.measurementSleep = int( main.params['SLEEP']['measure'] )
chengchiyu08303a02016-09-08 17:40:26 -070085 main.deleteSwSleep = int( main.params['SLEEP']['deleteSW'] )
YPZhang38fb1192016-08-11 11:03:38 -070086 main.maxScale = int( main.params['max'] )
87 main.timeout = int( main.params['TIMEOUT']['timeout'] )
88 main.MNSleep = int( main.params['SLEEP']['mininet'])
89 main.device = main.params['TEST']['device']
YPZhang38fb1192016-08-11 11:03:38 -070090 main.log.info("Create Database file " + main.dbFileName)
91 resultsDB = open(main.dbFileName, "w+")
92 resultsDB.close()
93
94 main.switchFunc = imp.load_source(main.dependencyFunc,
95 main.dependencyPath +
96 main.dependencyFunc +
97 ".py")
98
99 def CASE1(self, main):
100 # Clean up test environment and set up
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700101 import time
YPZhang38fb1192016-08-11 11:03:38 -0700102 main.log.info("Get ONOS cluster IP")
103 print(main.scale)
104 main.numCtrls = int(main.scale.pop(0))
105 main.ONOSip = []
106 main.maxNumBatch = 0
107 main.AllONOSip = main.ONOSbench.getOnosIps()
108 for i in range(main.numCtrls):
109 main.ONOSip.append(main.AllONOSip[i])
110 main.log.info(main.ONOSip)
111 main.CLIs = []
112 main.log.info("Creating list of ONOS cli handles")
113 for i in range(main.numCtrls):
114 main.CLIs.append(getattr(main, 'ONOS%scli' % (i + 1)))
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700115
YPZhang38fb1192016-08-11 11:03:38 -0700116 if not main.CLIs:
117 main.log.error("Failed to create the list of ONOS cli handles")
118 main.cleanup()
119 main.exit()
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700120
YPZhang38fb1192016-08-11 11:03:38 -0700121 main.commit = main.ONOSbench.getVersion(report=True)
122 main.commit = main.commit.split(" ")[1]
123 main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls)
124 main.log.info("Safety check, killing all ONOS processes" +
125 " before initiating environment setup")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700126
YPZhang38fb1192016-08-11 11:03:38 -0700127 for i in range(main.numCtrls):
128 main.ONOSbench.onosDie(main.ONOSip[i])
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700129
YPZhang38fb1192016-08-11 11:03:38 -0700130 main.log.info("NODE COUNT = %s" % main.numCtrls)
131 main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
132 main.cellName,
133 main.MN1Ip,
134 main.Apps,
135 main.ONOSip)
136 main.step("Apply cell to environment")
137 cellResult = main.ONOSbench.setCell(main.cellName)
138 verifyResult = main.ONOSbench.verifyCell()
139 stepResult = cellResult and verifyResult
140 utilities.assert_equals(expect=main.TRUE,
141 actual=stepResult,
142 onpass="Successfully applied cell to " + \
143 "environment",
144 onfail="Failed to apply cell to environment ")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700145
YPZhang38fb1192016-08-11 11:03:38 -0700146 main.step("Creating ONOS package")
Jon Hallbd60ea02016-08-23 10:03:59 -0700147 packageResult = main.ONOSbench.buckBuild()
YPZhang38fb1192016-08-11 11:03:38 -0700148 stepResult = packageResult
149 utilities.assert_equals(expect=main.TRUE,
150 actual=stepResult,
151 onpass="Successfully created ONOS package",
152 onfail="Failed to create ONOS package")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700153
YPZhang38fb1192016-08-11 11:03:38 -0700154 main.step("Uninstall ONOS package on all Nodes")
155 uninstallResult = main.TRUE
156 for i in range(int(main.numCtrls)):
157 main.log.info("Uninstalling package on ONOS Node IP: " + main.ONOSip[i])
158 u_result = main.ONOSbench.onosUninstall(main.ONOSip[i])
159 utilities.assert_equals(expect=main.TRUE, actual=u_result,
160 onpass="Test step PASS",
161 onfail="Test step FAIL")
162 uninstallResult = (uninstallResult and u_result)
Jon Hall4ba53f02015-07-29 13:07:41 -0700163
YPZhang38fb1192016-08-11 11:03:38 -0700164 main.step("Install ONOS package on all Nodes")
165 installResult = main.TRUE
166 for i in range(int(main.numCtrls)):
167 main.log.info("Installing package on ONOS Node IP: " + main.ONOSip[i])
168 i_result = main.ONOSbench.onosInstall(node=main.ONOSip[i])
169 utilities.assert_equals(expect=main.TRUE, actual=i_result,
170 onpass="Test step PASS",
171 onfail="Test step FAIL")
172 installResult = installResult and i_result
173
174 main.step("Verify ONOS nodes UP status")
175 statusResult = main.TRUE
176 for i in range(int(main.numCtrls)):
177 main.log.info("ONOS Node " + main.ONOSip[i] + " status:")
178 onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i])
179 utilities.assert_equals(expect=main.TRUE, actual=onos_status,
180 onpass="Test step PASS",
181 onfail="Test step FAIL")
182 statusResult = (statusResult and onos_status)
183 time.sleep(2)
184 main.step("Start ONOS CLI on all nodes")
185 cliResult = main.TRUE
186 main.step(" Start ONOS cli using thread ")
187 startCliResult = main.TRUE
188 pool = []
189 main.threadID = 0
190 for i in range(int(main.numCtrls)):
191 t = main.Thread(target=main.CLIs[i].startOnosCli,
192 threadID=main.threadID,
193 name="startOnosCli",
194 args=[main.ONOSip[i]],
195 kwargs={"onosStartTimeout": main.timeout})
196 pool.append(t)
197 t.start()
198 main.threadID = main.threadID + 1
199 for t in pool:
200 t.join()
201 startCliResult = startCliResult and t.result
202 time.sleep(main.startUpSleep)
203
204 main.log.info("Configure apps")
205 main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider",
206 "maxEvents 1")
207 main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider",
208 "maxBatchMs 0")
209 main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider",
210 "maxIdleMs 0")
chengchiyu08303a02016-09-08 17:40:26 -0700211 for i in range(main.numCtrls):
212 main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.topology")
YPZhang38fb1192016-08-11 11:03:38 -0700213 time.sleep(1)
214
215 main.log.info("Copy topology file to Mininet")
216 main.ONOSbench.copyMininetFile(main.topoName,
217 main.dependencyPath,
218 main.Mininet1.user_name,
219 main.Mininet1.ip_address)
220 main.log.info("Stop Mininet...")
221 main.Mininet1.stopNet()
222 time.sleep(main.MNSleep)
223 main.log.info("Start new mininet topology")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700224 main.Mininet1.startNet()
YPZhang38fb1192016-08-11 11:03:38 -0700225 main.log.info("Assign switch to controller to ONOS node 1")
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700226
YPZhang38fb1192016-08-11 11:03:38 -0700227 time.sleep(2)
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700228
YPZhang38fb1192016-08-11 11:03:38 -0700229 def CASE2(self,main):
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700230 import time
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700231 import json
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700232 import numpy
233
YPZhang38fb1192016-08-11 11:03:38 -0700234 resultDict = {'up' : {}, 'down' : {}}
235 for i in range(1, main.numCtrls + 1):
236 resultDict['up'][ 'node' + str(i) ] = {}
237 resultDict['up'][ 'node' + str(i) ][ 'Ave' ] = {}
238 resultDict['up'][ 'node' + str(i) ][ 'Std' ] = {}
239 resultDict['up'][ 'node' + str(i) ][ 'T_F' ] = []#TCP to Feature
240 resultDict['up'][ 'node' + str(i) ][ 'F_R' ] = []#Feature to Role
241 resultDict['up'][ 'node' + str(i) ][ 'RQ_RR' ] = []#role request to role reply
242 resultDict['up'][ 'node' + str(i) ][ 'RR_D' ] = []#role reply to Device
243 resultDict['up'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph
244 resultDict['up'][ 'node' + str(i) ][ 'E_E' ] = []#TCP to Graph
Jon Hall4ba53f02015-07-29 13:07:41 -0700245
YPZhang38fb1192016-08-11 11:03:38 -0700246 for i in range(1,main.numCtrls + 1):
247 resultDict['down'][ 'node' + str(i) ] = {}
248 resultDict['down'][ 'node' + str(i) ][ 'Ave' ] = {}
249 resultDict['down'][ 'node' + str(i) ][ 'Std' ] = {}
250 resultDict['down'][ 'node' + str(i) ][ 'FA_A' ] = []#Fin_ack to ACK
251 resultDict['down'][ 'node' + str(i) ][ 'A_D' ] = []#Ack to Device
252 resultDict['down'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph
253 resultDict['down'][ 'node' + str(i) ][ 'E_E' ] = []#fin_ack to Graph
254 for i in range(1 , main.sampleSize + main.warmUp):
255 main.log.info("************************************************************")
256 main.log.info("************************ Iteration: {} **********************" .format(str( i )) )
257 if i < main.warmUp:
258 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
259 "up", resultDict, True )
260 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
261 "down", resultDict, True )
chengchiyu08303a02016-09-08 17:40:26 -0700262 main.CLIs[0].removeDevice( "of:0000000000000001" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700263 else:
YPZhang38fb1192016-08-11 11:03:38 -0700264 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
265 "up", resultDict, False )
266 main.switchFunc.captureOfPack (main, main.device, main.ofPackage,
267 "down", resultDict, False )
chengchiyu08303a02016-09-08 17:40:26 -0700268 main.CLIs[0].removeDevice( "of:0000000000000001" )
269
YPZhang38fb1192016-08-11 11:03:38 -0700270 # Dictionary for result
271 maxDict = {}
272 maxDict['down'] = {}
273 maxDict['up'] = {}
274 maxDict['down']['max'] = 0
275 maxDict['up']['max'] = 0
276 maxDict['down']['node'] = 0
277 maxDict['up']['node'] = 0
Jon Hall4ba53f02015-07-29 13:07:41 -0700278
YPZhang38fb1192016-08-11 11:03:38 -0700279 for i in range(1, main.numCtrls + 1):
280 # calculate average and std for result, and grep the max End to End data
281 EtoEtemp = numpy.average( resultDict['up'][ 'node' + str(i) ]['E_E'] )
282 resultDict['up'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
283 if maxDict['up']['max'] < EtoEtemp:
284 # get max End to End latency
285 maxDict['up']['max'] = EtoEtemp
286 maxDict['up']['node'] = i
287 resultDict['up']['node' + str(i)]['Ave']['T_F'] = numpy.average(resultDict['up']['node' + str(i)]['T_F'])
288 resultDict['up']['node' + str(i)]['Ave']['F_R'] = numpy.average(resultDict['up']['node' + str(i)]['F_R'])
289 resultDict['up']['node' + str(i)]['Ave']['RQ_RR'] = numpy.average(resultDict['up']['node' + str(i)]['RQ_RR'])
290 resultDict['up']['node' + str(i)]['Ave']['RR_D'] = numpy.average(resultDict['up']['node' + str(i)]['RR_D'])
291 resultDict['up']['node' + str(i)]['Ave']['D_G'] = numpy.average(resultDict['up']['node' + str(i)]['D_G'])
Jon Hall4ba53f02015-07-29 13:07:41 -0700292
YPZhang38fb1192016-08-11 11:03:38 -0700293 resultDict['up'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['up'][ 'node' + str(i) ]['E_E'] )
294 resultDict['up']['node' + str(i)]['Std']['T_F'] = numpy.std(resultDict['up']['node' + str(i)]['T_F'])
295 resultDict['up']['node' + str(i)]['Std']['F_R'] = numpy.std(resultDict['up']['node' + str(i)]['F_R'])
296 resultDict['up']['node' + str(i)]['Std']['RQ_RR'] = numpy.std(resultDict['up']['node' + str(i)]['RQ_RR'])
297 resultDict['up']['node' + str(i)]['Std']['RR_D'] = numpy.std(resultDict['up']['node' + str(i)]['RR_D'])
298 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 -0700299
YPZhang38fb1192016-08-11 11:03:38 -0700300 # calculate average and std for result, and grep the max End to End data
301 EtoEtemp = numpy.average( resultDict['down'][ 'node' + str(i) ]['E_E'] )
302 resultDict['down'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
303 if maxDict['down']['max'] < EtoEtemp:
304 # get max End to End latency
305 maxDict['down']['max'] = EtoEtemp
306 maxDict['down']['node'] = i
307 resultDict['down']['node' + str(i)]['Ave']['FA_A'] = numpy.average(resultDict['down']['node' + str(i)]['FA_A'])
308 resultDict['down']['node' + str(i)]['Ave']['A_D'] = numpy.average(resultDict['down']['node' + str(i)]['A_D'])
309 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 -0700310
YPZhang38fb1192016-08-11 11:03:38 -0700311 resultDict['down'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['down'][ 'node' + str(i) ]['E_E'] )
312 resultDict['down']['node' + str(i)]['Std']['FA_A'] = numpy.std(resultDict['down']['node' + str(i)]['FA_A'])
313 resultDict['down']['node' + str(i)]['Std']['A_D'] = numpy.std(resultDict['down']['node' + str(i)]['A_D'])
314 resultDict['down']['node' + str(i)]['Std']['D_G'] = numpy.std(resultDict['down']['node' + str(i)]['D_G'])
Jon Hall4ba53f02015-07-29 13:07:41 -0700315
YPZhang38fb1192016-08-11 11:03:38 -0700316 main.log.report( "=====node{} Summary:=====".format( str(i) ) )
317 main.log.report( "=============Switch up=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700318
YPZhang38fb1192016-08-11 11:03:38 -0700319 main.log.report(
320 "End to End average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) )
321 main.log.report(
322 "End to End Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'E_E' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700323
YPZhang38fb1192016-08-11 11:03:38 -0700324 main.log.report(
325 "TCP to Feature average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'T_F' ]) ) )
326 main.log.report(
327 "TCP to Feature Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'T_F' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700328
YPZhang38fb1192016-08-11 11:03:38 -0700329 main.log.report(
330 "Feature to Role average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'F_R' ]) ) )
331 main.log.report(
332 "Feature to Role Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'F_R' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700333
YPZhang38fb1192016-08-11 11:03:38 -0700334 main.log.report(
335 "Role request to Role reply average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RQ_RR' ]) ) )
336 main.log.report(
337 "Role request to Role reply Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'RQ_RR' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700338
YPZhang38fb1192016-08-11 11:03:38 -0700339 main.log.report(
340 "Role reply to Device average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RR_D' ]) ) )
341 main.log.report(
342 "Role reply to Device Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'RR_D' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700343
YPZhang38fb1192016-08-11 11:03:38 -0700344 main.log.report(
345 "Device to Graph average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) )
346 main.log.report(
347 "Device to Graph Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'D_G' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700348
YPZhang38fb1192016-08-11 11:03:38 -0700349 main.log.report( "=============Switch down=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700350
YPZhang38fb1192016-08-11 11:03:38 -0700351 main.log.report(
352 "End to End average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) )
353 main.log.report(
354 "End to End Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'E_E' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700355
YPZhang38fb1192016-08-11 11:03:38 -0700356 main.log.report(
357 "Fin_ACK to ACK average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'FA_A' ]) ) )
358 main.log.report(
359 "Fin_ACK to ACK Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'FA_A' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700360
YPZhang38fb1192016-08-11 11:03:38 -0700361 main.log.report(
362 "ACK to Device average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'A_D' ]) ) )
363 main.log.report(
364 "ACK to Device Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'A_D' ]) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700365
YPZhang38fb1192016-08-11 11:03:38 -0700366 main.log.report(
367 "Device to Graph average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) )
368 main.log.report(
369 "Device to Graph Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'D_G' ]) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700370
YPZhang38fb1192016-08-11 11:03:38 -0700371 with open(main.dbFileName, "a") as dbFile:
372 # TODO: Save STD to Database
373 # Scale number
374 temp = str(main.numCtrls)
375 temp += ",'baremetal1'"
376 # put result
377 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'E_E' ] )
378 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'T_F' ] )
379 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'F_R' ] )
380 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RQ_RR' ] )
381 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RR_D' ] )
382 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'D_G' ] )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700383
YPZhang38fb1192016-08-11 11:03:38 -0700384 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'E_E' ] )
385 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'FA_A' ] )
386 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'A_D' ] )
387 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'D_G' ] )
chengchiyuc6f4cc02016-08-24 14:04:20 -0700388
389 temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Std' ][ 'E_E' ] )
390 temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Std' ][ 'E_E' ] )
391
YPZhang38fb1192016-08-11 11:03:38 -0700392 temp += "\n"
393 dbFile.write( temp )
394 dbFile.close()