YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 1 | ''' |
| 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.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 10 | |
| 11 | class SCPFswitchLat: |
| 12 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 13 | def __init__(self): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 14 | self.default = '' |
| 15 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 16 | def CASE0( self, main ): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 17 | import os |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 18 | 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 | ''' |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 28 | try: |
| 29 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 30 | main.testSetUp = ONOSSetup() |
| 31 | except ImportError: |
| 32 | main.log.error( "ONOSSetup not found. exiting the test" ) |
| 33 | main.exit() |
| 34 | main.testSetUp.envSetupDescription() |
| 35 | stepResult = main.FALSE |
| 36 | try: |
| 37 | # The dictionary to record different type of wrongs |
| 38 | main.wrong = { 'totalWrong': 0, 'skipDown' : 0, 'TsharkValueIncorrect': 0, |
| 39 | 'TypeError' : 0, 'decodeJasonError': 0, |
| 40 | 'checkResultIncorrect': 0} |
| 41 | main.maxWrong = int( main.params['TEST'] ['MaxWrong'] ) |
| 42 | main.resultRange = main.params['TEST']['ResultRange'] |
| 43 | main.searchTerm = main.params['TEST']['SearchTerm'] |
| 44 | main.MN1Ip = main.params['MN']['ip1'] |
| 45 | main.dependencyPath = main.testOnDirectory + \ |
| 46 | main.params['DEPENDENCY']['path'] |
| 47 | main.topoName = main.params['DEPENDENCY']['topology'] |
| 48 | main.dependencyFunc = main.params['DEPENDENCY']['function'] |
| 49 | main.cellName = main.params['ENV']['cellName'] |
| 50 | main.apps = main.params['ENV']['cellApps'] |
| 51 | main.scale = (main.params['SCALE']).split(",") |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 52 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 53 | main.ofPackage = main.params['TSHARK'] |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 54 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 55 | main.tsharkResultPath = main.params['TEST']['tsharkResultPath'] |
| 56 | main.sampleSize = int(main.params['TEST']['sampleSize']) |
| 57 | main.warmUp = int(main.params['TEST']['warmUp']) |
| 58 | main.dbFileName = main.params['DATABASE']['dbName'] |
| 59 | main.startUpSleep = int(main.params['SLEEP']['startup']) |
| 60 | main.measurementSleep = int( main.params['SLEEP']['measure'] ) |
| 61 | main.deleteSwSleep = int( main.params['SLEEP']['deleteSW'] ) |
| 62 | main.maxScale = int( main.params['max'] ) |
| 63 | main.timeout = int( main.params['TIMEOUT']['timeout'] ) |
| 64 | main.MNSleep = int( main.params['SLEEP']['mininet']) |
| 65 | main.device = main.params['TEST']['device'] |
| 66 | stepResult = main.testSetUp.gitPulling() |
| 67 | main.log.info("Create Database file " + main.dbFileName) |
| 68 | resultsDB = open(main.dbFileName, "w+") |
| 69 | resultsDB.close() |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 70 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 71 | main.switchFunc = imp.load_source(main.dependencyFunc, |
| 72 | main.dependencyPath + |
| 73 | main.dependencyFunc + |
| 74 | ".py") |
| 75 | except Exception as e: |
| 76 | main.testSetUp.envSetupException( e ) |
| 77 | main.testSetUp.evnSetupConclusion( stepResult ) |
| 78 | main.commit = main.commit.split( " " )[ 1 ] |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 79 | def CASE1(self, main): |
| 80 | # Clean up test environment and set up |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 81 | import time |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 82 | try: |
| 83 | from tests.dependencies.utils import Utils |
| 84 | except ImportError: |
| 85 | main.log.error( "Utils not found exiting the test" ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 86 | main.exit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 87 | try: |
| 88 | main.Utils |
| 89 | except ( NameError, AttributeError ): |
| 90 | main.Utils = Utils() |
| 91 | main.maxNumBatch = 0 |
| 92 | main.testSetUp.getNumCtrls( True ) |
| 93 | main.testSetUp.envSetup( includeGitPull=False, makeMaxNodes=False ) |
| 94 | main.testSetUp.ONOSSetUp( main.Mininet1, True, |
| 95 | cellName=main.cellName, killRemoveMax=False, |
| 96 | CtrlsSet=False ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 97 | |
| 98 | main.log.info("Configure apps") |
| 99 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 100 | "maxEvents 1") |
| 101 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 102 | "maxBatchMs 0") |
| 103 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 104 | "maxIdleMs 0") |
chengchiyu | 08303a0 | 2016-09-08 17:40:26 -0700 | [diff] [blame] | 105 | for i in range(main.numCtrls): |
| 106 | main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.topology") |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 107 | time.sleep(1) |
| 108 | |
| 109 | main.log.info("Copy topology file to Mininet") |
| 110 | main.ONOSbench.copyMininetFile(main.topoName, |
| 111 | main.dependencyPath, |
| 112 | main.Mininet1.user_name, |
| 113 | main.Mininet1.ip_address) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame^] | 114 | main.Utils.mininetCleanup( main.Mininet1 ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 115 | time.sleep(main.MNSleep) |
| 116 | main.log.info("Start new mininet topology") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 117 | main.Mininet1.startNet() |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 118 | main.log.info("Assign switch to controller to ONOS node 1") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 119 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 120 | time.sleep(2) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 121 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 122 | def CASE2(self,main): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 123 | import time |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 124 | import json |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 125 | import numpy |
| 126 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 127 | resultDict = {'up' : {}, 'down' : {}} |
| 128 | for i in range(1, main.numCtrls + 1): |
| 129 | resultDict['up'][ 'node' + str(i) ] = {} |
| 130 | resultDict['up'][ 'node' + str(i) ][ 'Ave' ] = {} |
| 131 | resultDict['up'][ 'node' + str(i) ][ 'Std' ] = {} |
| 132 | resultDict['up'][ 'node' + str(i) ][ 'T_F' ] = []#TCP to Feature |
| 133 | resultDict['up'][ 'node' + str(i) ][ 'F_R' ] = []#Feature to Role |
| 134 | resultDict['up'][ 'node' + str(i) ][ 'RQ_RR' ] = []#role request to role reply |
| 135 | resultDict['up'][ 'node' + str(i) ][ 'RR_D' ] = []#role reply to Device |
| 136 | resultDict['up'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph |
| 137 | resultDict['up'][ 'node' + str(i) ][ 'E_E' ] = []#TCP to Graph |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 138 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 139 | for i in range(1,main.numCtrls + 1): |
| 140 | resultDict['down'][ 'node' + str(i) ] = {} |
| 141 | resultDict['down'][ 'node' + str(i) ][ 'Ave' ] = {} |
| 142 | resultDict['down'][ 'node' + str(i) ][ 'Std' ] = {} |
| 143 | resultDict['down'][ 'node' + str(i) ][ 'FA_A' ] = []#Fin_ack to ACK |
| 144 | resultDict['down'][ 'node' + str(i) ][ 'A_D' ] = []#Ack to Device |
| 145 | resultDict['down'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph |
| 146 | resultDict['down'][ 'node' + str(i) ][ 'E_E' ] = []#fin_ack to Graph |
| 147 | for i in range(1 , main.sampleSize + main.warmUp): |
| 148 | main.log.info("************************************************************") |
| 149 | main.log.info("************************ Iteration: {} **********************" .format(str( i )) ) |
| 150 | if i < main.warmUp: |
| 151 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
| 152 | "up", resultDict, True ) |
| 153 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
| 154 | "down", resultDict, True ) |
chengchiyu | 08303a0 | 2016-09-08 17:40:26 -0700 | [diff] [blame] | 155 | main.CLIs[0].removeDevice( "of:0000000000000001" ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 156 | else: |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 157 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
| 158 | "up", resultDict, False ) |
| 159 | main.switchFunc.captureOfPack (main, main.device, main.ofPackage, |
| 160 | "down", resultDict, False ) |
chengchiyu | 08303a0 | 2016-09-08 17:40:26 -0700 | [diff] [blame] | 161 | main.CLIs[0].removeDevice( "of:0000000000000001" ) |
| 162 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 163 | # Dictionary for result |
| 164 | maxDict = {} |
| 165 | maxDict['down'] = {} |
| 166 | maxDict['up'] = {} |
| 167 | maxDict['down']['max'] = 0 |
| 168 | maxDict['up']['max'] = 0 |
| 169 | maxDict['down']['node'] = 0 |
| 170 | maxDict['up']['node'] = 0 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 171 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 172 | for i in range(1, main.numCtrls + 1): |
| 173 | # calculate average and std for result, and grep the max End to End data |
| 174 | EtoEtemp = numpy.average( resultDict['up'][ 'node' + str(i) ]['E_E'] ) |
| 175 | resultDict['up'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp |
| 176 | if maxDict['up']['max'] < EtoEtemp: |
| 177 | # get max End to End latency |
| 178 | maxDict['up']['max'] = EtoEtemp |
| 179 | maxDict['up']['node'] = i |
| 180 | resultDict['up']['node' + str(i)]['Ave']['T_F'] = numpy.average(resultDict['up']['node' + str(i)]['T_F']) |
| 181 | resultDict['up']['node' + str(i)]['Ave']['F_R'] = numpy.average(resultDict['up']['node' + str(i)]['F_R']) |
| 182 | resultDict['up']['node' + str(i)]['Ave']['RQ_RR'] = numpy.average(resultDict['up']['node' + str(i)]['RQ_RR']) |
| 183 | resultDict['up']['node' + str(i)]['Ave']['RR_D'] = numpy.average(resultDict['up']['node' + str(i)]['RR_D']) |
| 184 | resultDict['up']['node' + str(i)]['Ave']['D_G'] = numpy.average(resultDict['up']['node' + str(i)]['D_G']) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 185 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 186 | resultDict['up'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['up'][ 'node' + str(i) ]['E_E'] ) |
| 187 | resultDict['up']['node' + str(i)]['Std']['T_F'] = numpy.std(resultDict['up']['node' + str(i)]['T_F']) |
| 188 | resultDict['up']['node' + str(i)]['Std']['F_R'] = numpy.std(resultDict['up']['node' + str(i)]['F_R']) |
| 189 | resultDict['up']['node' + str(i)]['Std']['RQ_RR'] = numpy.std(resultDict['up']['node' + str(i)]['RQ_RR']) |
| 190 | resultDict['up']['node' + str(i)]['Std']['RR_D'] = numpy.std(resultDict['up']['node' + str(i)]['RR_D']) |
| 191 | resultDict['up']['node' + str(i)]['Std']['D_G'] = numpy.std(resultDict['up']['node' + str(i)]['D_G']) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 192 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 193 | # calculate average and std for result, and grep the max End to End data |
| 194 | EtoEtemp = numpy.average( resultDict['down'][ 'node' + str(i) ]['E_E'] ) |
| 195 | resultDict['down'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp |
| 196 | if maxDict['down']['max'] < EtoEtemp: |
| 197 | # get max End to End latency |
| 198 | maxDict['down']['max'] = EtoEtemp |
| 199 | maxDict['down']['node'] = i |
| 200 | resultDict['down']['node' + str(i)]['Ave']['FA_A'] = numpy.average(resultDict['down']['node' + str(i)]['FA_A']) |
| 201 | resultDict['down']['node' + str(i)]['Ave']['A_D'] = numpy.average(resultDict['down']['node' + str(i)]['A_D']) |
| 202 | resultDict['down']['node' + str(i)]['Ave']['D_G'] = numpy.average(resultDict['down']['node' + str(i)]['D_G']) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 203 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 204 | resultDict['down'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['down'][ 'node' + str(i) ]['E_E'] ) |
| 205 | resultDict['down']['node' + str(i)]['Std']['FA_A'] = numpy.std(resultDict['down']['node' + str(i)]['FA_A']) |
| 206 | resultDict['down']['node' + str(i)]['Std']['A_D'] = numpy.std(resultDict['down']['node' + str(i)]['A_D']) |
| 207 | resultDict['down']['node' + str(i)]['Std']['D_G'] = numpy.std(resultDict['down']['node' + str(i)]['D_G']) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 208 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 209 | main.log.report( "=====node{} Summary:=====".format( str(i) ) ) |
| 210 | main.log.report( "=============Switch up=======" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 211 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 212 | main.log.report( |
| 213 | "End to End average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) ) |
| 214 | main.log.report( |
| 215 | "End to End Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'E_E' ]) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 216 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 217 | main.log.report( |
| 218 | "TCP to Feature average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'T_F' ]) ) ) |
| 219 | main.log.report( |
| 220 | "TCP to Feature Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'T_F' ]) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 221 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 222 | main.log.report( |
| 223 | "Feature to Role average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'F_R' ]) ) ) |
| 224 | main.log.report( |
| 225 | "Feature to Role Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'F_R' ]) ) ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 226 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 227 | main.log.report( |
| 228 | "Role request to Role reply average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RQ_RR' ]) ) ) |
| 229 | main.log.report( |
| 230 | "Role request to Role reply Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'RQ_RR' ]) ) ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 231 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 232 | main.log.report( |
| 233 | "Role reply to Device average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RR_D' ]) ) ) |
| 234 | main.log.report( |
| 235 | "Role reply to Device Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'RR_D' ]) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 236 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 237 | main.log.report( |
| 238 | "Device to Graph average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) ) |
| 239 | main.log.report( |
| 240 | "Device to Graph Std: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Std' ][ 'D_G' ]) ) ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 241 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 242 | main.log.report( "=============Switch down=======" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 243 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 244 | main.log.report( |
| 245 | "End to End average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) ) |
| 246 | main.log.report( |
| 247 | "End to End Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'E_E' ]) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 248 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 249 | main.log.report( |
| 250 | "Fin_ACK to ACK average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'FA_A' ]) ) ) |
| 251 | main.log.report( |
| 252 | "Fin_ACK to ACK Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'FA_A' ]) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 253 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 254 | main.log.report( |
| 255 | "ACK to Device average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'A_D' ]) ) ) |
| 256 | main.log.report( |
| 257 | "ACK to Device Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'A_D' ]) ) ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 258 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 259 | main.log.report( |
| 260 | "Device to Graph average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) ) |
| 261 | main.log.report( |
| 262 | "Device to Graph Std: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Std' ][ 'D_G' ]) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 263 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 264 | with open(main.dbFileName, "a") as dbFile: |
| 265 | # TODO: Save STD to Database |
| 266 | # Scale number |
| 267 | temp = str(main.numCtrls) |
| 268 | temp += ",'baremetal1'" |
| 269 | # put result |
| 270 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'E_E' ] ) |
| 271 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'T_F' ] ) |
| 272 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'F_R' ] ) |
| 273 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RQ_RR' ] ) |
| 274 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RR_D' ] ) |
| 275 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'D_G' ] ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 276 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 277 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'E_E' ] ) |
| 278 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'FA_A' ] ) |
| 279 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'A_D' ] ) |
| 280 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'D_G' ] ) |
chengchiyu | c6f4cc0 | 2016-08-24 14:04:20 -0700 | [diff] [blame] | 281 | |
| 282 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Std' ][ 'E_E' ] ) |
| 283 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Std' ][ 'E_E' ] ) |
| 284 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 285 | temp += "\n" |
| 286 | dbFile.write( temp ) |
| 287 | dbFile.close() |