YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 1 | ''' |
| 2 | SCPFportLat test |
| 3 | Test latency for port status change |
| 4 | Up & Down: |
| 5 | PortStatus --- Device --- Link --- Graph |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 6 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 7 | yunpeng@onlab.us |
| 8 | ''' |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 9 | class SCPFportLat: |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 10 | def __init__( self ): |
| 11 | self.default = '' |
| 12 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 13 | def CASE0( self, main ): |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 14 | import os |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 15 | import imp |
| 16 | ''' |
| 17 | - GIT |
| 18 | - BUILDING ONOS |
| 19 | Pull specific ONOS branch, then Build ONOS ono ONOS Bench. |
| 20 | This step is usually skipped. Because in a Jenkins driven automated |
| 21 | test env. We want Jenkins jobs to pull&build for flexibility to handle |
| 22 | different versions of ONOS. |
| 23 | - Construct tests variables |
| 24 | ''' |
| 25 | gitPull = main.params['GIT']['gitPull'] |
| 26 | gitBranch = main.params['GIT']['gitBranch'] |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 27 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 28 | main.case( "Pull onos branch and build onos on Teststation." ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 29 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 30 | if gitPull == 'True': |
| 31 | main.step( "Git Checkout ONOS branch: " + gitBranch ) |
| 32 | stepResult = main.ONOSbench.gitCheckout( branch=gitBranch ) |
| 33 | utilities.assert_equals(expect=main.TRUE, |
| 34 | actual=stepResult, |
| 35 | onpass="Successfully checkout onos branch.", |
| 36 | onfail="Failed to checkout onos branch. Exiting test...") |
| 37 | if not stepResult: main.exit() |
| 38 | |
| 39 | main.step( "Git Pull on ONOS branch:" + gitBranch ) |
| 40 | stepResult = main.ONOSbench.gitPull() |
| 41 | utilities.assert_equals(expect=main.TRUE, |
| 42 | actual=stepResult, |
| 43 | onpass="Successfully pull onos. ", |
| 44 | onfail="Failed to pull onos. Exiting test ...") |
| 45 | if not stepResult: main.exit() |
| 46 | |
| 47 | main.step( "Building ONOS branch: " + gitBranch ) |
| 48 | stepResult = main.ONOSbench.cleanInstall( skipTest=True ) |
| 49 | utilities.assert_equals(expect=main.TRUE, |
| 50 | actual=stepResult, |
| 51 | onpass="Successfully build onos.", |
| 52 | onfail="Failed to build onos. Exiting test...") |
| 53 | if not stepResult: main.exit() |
| 54 | |
| 55 | else: |
| 56 | main.log.warn( "Skipped pulling onos and Skipped building ONOS" ) |
| 57 | |
| 58 | main.testOnDirectory = os.path.dirname( os.getcwd() ) |
| 59 | main.MN1Ip = main.params['MN']['ip1'] |
YPZhang | 0433bee | 2016-07-12 16:10:59 -0700 | [diff] [blame] | 60 | main.dependencyPath = main.testOnDirectory + \ |
| 61 | main.params['DEPENDENCY']['path'] |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 62 | main.dependencyFunc = main.params['DEPENDENCY']['function'] |
| 63 | main.topoName = main.params['DEPENDENCY']['topology'] |
| 64 | main.cellName = main.params['ENV']['cellName'] |
| 65 | main.Apps = main.params['ENV']['cellApps'] |
| 66 | main.scale = (main.params['SCALE']).split(",") |
| 67 | main.ofportStatus = main.params['TSHARK']['ofpPortStatus'] |
| 68 | main.tsharkResultPath = main.params['TSHARK']['tsharkReusltPath'] |
| 69 | main.sampleSize = int( main.params['TEST']['sampleSize'] ) |
| 70 | main.warmUp = int( main.params['TEST']['warmUp'] ) |
| 71 | main.maxProcessTime = int( main.params['TEST']['maxProcessTime']) |
| 72 | main.dbFileName = main.params['DATABASE']['dbName'] |
| 73 | main.startUpSleep = int( main.params['SLEEP']['startup'] ) |
| 74 | main.measurementSleep = int( main.params['SLEEP']['measure'] ) |
| 75 | main.maxScale = int( main.params['max'] ) |
| 76 | main.interface = main.params['TEST']['interface'] |
| 77 | main.timeout = int( main.params['TIMEOUT']['timeout'] ) |
| 78 | main.MNSleep = int( main.params['SLEEP']['mininet']) |
| 79 | main.device = main.params['TEST']['device'] |
| 80 | main.debug = main.params['TEST']['debug'] |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 81 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 82 | if main.debug == "True": |
| 83 | main.debug = True |
| 84 | else: |
| 85 | main.debug = False |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 86 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 87 | main.log.info( "Create Database file " + main.dbFileName ) |
| 88 | resultsDB = open( main.dbFileName, "w+" ) |
| 89 | resultsDB.close() |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 90 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 91 | main.portFunc = imp.load_source(main.dependencyFunc, |
| 92 | main.dependencyPath + |
| 93 | main.dependencyFunc + |
| 94 | ".py") |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 95 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 96 | def CASE1( self, main ): |
| 97 | # Clean up test environment and set up |
| 98 | import time |
| 99 | main.log.info( "Get ONOS cluster IP" ) |
| 100 | print( main.scale ) |
| 101 | main.numCtrls = int( main.scale.pop(0) ) |
| 102 | main.ONOSip = [] |
| 103 | main.maxNumBatch = 0 |
| 104 | main.AllONOSip = main.ONOSbench.getOnosIps() |
| 105 | for i in range( main.numCtrls ): |
| 106 | main.ONOSip.append( main.AllONOSip[i] ) |
| 107 | main.log.info( main.ONOSip ) |
| 108 | main.CLIs = [] |
| 109 | main.log.info( "Creating list of ONOS cli handles" ) |
| 110 | for i in range( main.numCtrls ): |
Devin Lim | 2870684 | 2017-06-08 10:23:48 -0700 | [diff] [blame^] | 111 | main.CLIs.append( getattr(main, 'ONOScli%s' % (i + 1)) ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 112 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 113 | if not main.CLIs: |
| 114 | main.log.error( "Failed to create the list of ONOS cli handles" ) |
| 115 | main.cleanup() |
| 116 | main.exit() |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 117 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 118 | main.commit = main.ONOSbench.getVersion( report=True ) |
| 119 | main.commit = main.commit.split(" ")[1] |
| 120 | main.log.info( "Starting up %s node(s) ONOS cluster" % main.numCtrls ) |
| 121 | main.log.info("Safety check, killing all ONOS processes" + |
| 122 | " before initiating environment setup") |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 123 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 124 | for i in range( main.numCtrls ): |
You Wang | b98a9fa | 2017-02-15 17:27:42 -0800 | [diff] [blame] | 125 | main.ONOSbench.onosStop( main.ONOSip[i] ) |
| 126 | main.ONOSbench.onosKill( main.ONOSip[i] ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 127 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 128 | main.log.info( "NODE COUNT = %s" % main.numCtrls ) |
| 129 | main.ONOSbench.createCellFile(main.ONOSbench.ip_address, |
| 130 | main.cellName, |
| 131 | main.MN1Ip, |
| 132 | main.Apps, |
Devin Lim | 461f087 | 2017-06-05 16:49:33 -0700 | [diff] [blame] | 133 | main.ONOSip, |
| 134 | main.ONOScli1.user_name) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 135 | main.step( "Apply cell to environment" ) |
| 136 | cellResult = main.ONOSbench.setCell( main.cellName ) |
| 137 | verifyResult = main.ONOSbench.verifyCell() |
| 138 | stepResult = cellResult and verifyResult |
| 139 | utilities.assert_equals(expect=main.TRUE, |
| 140 | actual=stepResult, |
| 141 | onpass="Successfully applied cell to " + \ |
| 142 | "environment", |
| 143 | onfail="Failed to apply cell to environment ") |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 144 | |
| 145 | main.step( "Creating ONOS package" ) |
Jon Hall | bd60ea0 | 2016-08-23 10:03:59 -0700 | [diff] [blame] | 146 | packageResult = main.ONOSbench.buckBuild() |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 147 | stepResult = packageResult |
| 148 | utilities.assert_equals(expect=main.TRUE, |
| 149 | actual=stepResult, |
| 150 | onpass="Successfully created ONOS package", |
| 151 | onfail="Failed to create ONOS package") |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 152 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 153 | main.step( "Uninstall ONOS package on all Nodes" ) |
| 154 | uninstallResult = main.TRUE |
| 155 | for i in range( int( main.numCtrls ) ): |
| 156 | main.log.info( "Uninstalling package on ONOS Node IP: " + main.ONOSip[i] ) |
| 157 | u_result = main.ONOSbench.onosUninstall( main.ONOSip[i] ) |
| 158 | utilities.assert_equals(expect=main.TRUE, actual=u_result, |
| 159 | onpass="Test step PASS", |
| 160 | onfail="Test step FAIL") |
| 161 | uninstallResult = uninstallResult and u_result |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 162 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 163 | main.step( "Install ONOS package on all Nodes" ) |
| 164 | installResult = main.TRUE |
| 165 | for i in range( int( main.numCtrls ) ): |
| 166 | main.log.info( "Installing package on ONOS Node IP: " + main.ONOSip[i] ) |
| 167 | i_result = main.ONOSbench.onosInstall( node=main.ONOSip[i] ) |
| 168 | utilities.assert_equals(expect=main.TRUE, actual=i_result, |
| 169 | onpass="Test step PASS", |
| 170 | onfail="Test step FAIL") |
| 171 | installResult = installResult and i_result |
| 172 | |
Chiyu Cheng | ef10950 | 2016-11-21 15:51:38 -0800 | [diff] [blame] | 173 | main.step( "Set up ONOS secure SSH" ) |
| 174 | secureSshResult = main.TRUE |
| 175 | for i in range( int( main.numCtrls ) ): |
| 176 | secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] ) |
| 177 | utilities.assert_equals( expect=main.TRUE, actual=secureSshResult, |
| 178 | onpass="Test step PASS", |
| 179 | onfail="Test step FAIL" ) |
| 180 | |
You Wang | 0357c43 | 2017-01-09 16:13:33 -0800 | [diff] [blame] | 181 | time.sleep( main.startUpSleep ) |
| 182 | main.step( "Starting ONOS service" ) |
| 183 | stopResult = main.TRUE |
| 184 | startResult = main.TRUE |
| 185 | onosIsUp = main.TRUE |
| 186 | for i in range( main.numCtrls ): |
| 187 | onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] ) |
| 188 | if onosIsUp == main.TRUE: |
| 189 | main.log.report( "ONOS instance is up and ready" ) |
| 190 | else: |
| 191 | main.log.report( "ONOS instance may not be up, stop and " + |
| 192 | "start ONOS again " ) |
| 193 | for i in range( main.numCtrls ): |
| 194 | stopResult = stopResult and \ |
| 195 | main.ONOSbench.onosStop( main.ONOSip[ i ] ) |
| 196 | for i in range( main.numCtrls ): |
| 197 | startResult = startResult and \ |
| 198 | main.ONOSbench.onosStart( main.ONOSip[ i ] ) |
| 199 | stepResult = onosIsUp and stopResult and startResult |
| 200 | utilities.assert_equals( expect=main.TRUE, |
| 201 | actual=stepResult, |
| 202 | onpass="ONOS service is ready", |
| 203 | onfail="ONOS service did not start properly" ) |
| 204 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 205 | main.step( "Start ONOS CLI on all nodes" ) |
| 206 | cliResult = main.TRUE |
| 207 | main.step( " Start ONOS cli using thread " ) |
| 208 | startCliResult = main.TRUE |
| 209 | pool = [] |
| 210 | main.threadID = 0 |
| 211 | for i in range( int( main.numCtrls ) ): |
| 212 | t = main.Thread(target=main.CLIs[i].startOnosCli, |
| 213 | threadID=main.threadID, |
| 214 | name="startOnosCli", |
| 215 | args=[main.ONOSip[i]], |
| 216 | kwargs={"onosStartTimeout": main.timeout}) |
| 217 | pool.append(t) |
| 218 | t.start() |
| 219 | main.threadID = main.threadID + 1 |
| 220 | for t in pool: |
| 221 | t.join() |
| 222 | startCliResult = startCliResult and t.result |
| 223 | time.sleep( main.startUpSleep ) |
| 224 | |
| 225 | main.log.info( "Configure apps" ) |
| 226 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 227 | "maxEvents 1") |
| 228 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 229 | "maxBatchMs 0") |
| 230 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 231 | "maxIdleMs 0") |
| 232 | time.sleep(1) |
| 233 | main.log.info( "Copy topology file to Mininet" ) |
| 234 | main.ONOSbench.copyMininetFile(main.topoName, |
| 235 | main.dependencyPath, |
| 236 | main.Mininet1.user_name, |
| 237 | main.Mininet1.ip_address) |
| 238 | main.log.info( "Stop Mininet..." ) |
| 239 | main.Mininet1.stopNet() |
| 240 | time.sleep( main.MNSleep ) |
| 241 | main.log.info( "Start new mininet topology" ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 242 | main.Mininet1.startNet() |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 243 | main.log.info( "Assign switch to controller to ONOS node 1" ) |
| 244 | time.sleep(1) |
| 245 | main.Mininet1.assignSwController( sw='s1', ip=main.ONOSip[0] ) |
| 246 | main.Mininet1.assignSwController( sw='s2', ip=main.ONOSip[0] ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 247 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 248 | time.sleep(2) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 249 | |
| 250 | def CASE2( self, main ): |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 251 | import time |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 252 | import numpy |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 253 | # dictionary for each node and each timestamps |
| 254 | resultDict = {'up' : {}, 'down' : {}} |
| 255 | for d in resultDict: |
| 256 | for i in range( 1, main.numCtrls + 1 ): |
| 257 | resultDict[d][ 'node' + str(i) ] = {} |
| 258 | resultDict[d][ 'node' + str(i) ][ 'Ave' ] = {} |
| 259 | resultDict[d][ 'node' + str(i) ][ 'Std' ] = {} |
| 260 | resultDict[d][ 'node' + str(i) ][ 'EtoE' ] = [] |
| 261 | resultDict[d][ 'node' + str(i) ][ 'PtoD' ] = [] |
| 262 | resultDict[d][ 'node' + str(i) ][ 'DtoL' ] = [] |
| 263 | resultDict[d][ 'node' + str(i) ][ 'LtoG' ] = [] |
| 264 | for i in range( 1, main.sampleSize + main.warmUp ): |
| 265 | main.log.info( "==========================================" ) |
| 266 | main.log.info( "================iteration:{}==============".format(str (i) ) ) |
| 267 | if i > main.warmUp: |
| 268 | # Portdown iteration |
| 269 | main.portFunc.capturePortStatusPack( main, main.device, main.interface, "down", resultDict, False ) |
| 270 | time.sleep(2) |
| 271 | # PortUp iteration |
| 272 | main.portFunc.capturePortStatusPack( main, main.device, main.interface, "up", resultDict, False ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 273 | else: |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 274 | # if warm up, keep old result dictionary |
| 275 | main.portFunc.capturePortStatusPack( main, main.device, main.interface, "down", resultDict, True) |
| 276 | main.portFunc.capturePortStatusPack( main, main.device, main.interface, "up", resultDict, True) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 277 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 278 | # Dictionary for result |
| 279 | maxDict = {} |
| 280 | maxDict['down'] = {} |
| 281 | maxDict['up'] = {} |
| 282 | maxDict['down']['max'] = 0 |
| 283 | maxDict['up']['max'] = 0 |
| 284 | maxDict['down']['node'] = 0 |
| 285 | maxDict['up']['node'] = 0 |
| 286 | EtoEtemp = 0 |
| 287 | for d in resultDict: |
| 288 | for i in range( 1, main.numCtrls + 1 ): |
| 289 | # calculate average and std for result, and grep the max End to End data |
| 290 | EtoEtemp = numpy.average( resultDict[d][ 'node' + str(i) ]['EtoE'] ) |
| 291 | resultDict[d][ 'node' + str(i) ][ 'Ave' ][ 'EtoE' ] = EtoEtemp |
| 292 | if maxDict[d]['max'] < EtoEtemp: |
| 293 | # get max End to End latency |
| 294 | maxDict[d]['max'] = EtoEtemp |
| 295 | maxDict[d]['node'] = i |
| 296 | resultDict[d]['node' + str(i)]['Ave']['PtoD'] = numpy.average(resultDict[d]['node' + str(i)]['PtoD']) |
| 297 | resultDict[d]['node' + str(i)]['Ave']['DtoL'] = numpy.average(resultDict[d]['node' + str(i)]['DtoL']) |
| 298 | resultDict[d]['node' + str(i)]['Ave']['LtoG'] = numpy.average(resultDict[d]['node' + str(i)]['LtoG']) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 299 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 300 | resultDict[d]['node' + str(i)]['Std']['EtoE'] = numpy.std(resultDict[d]['node' + str(i)]['EtoE']) |
| 301 | resultDict[d]['node' + str(i)]['Std']['PtoD'] = numpy.std(resultDict[d]['node' + str(i)]['PtoD']) |
| 302 | resultDict[d]['node' + str(i)]['Std']['DtoL'] = numpy.std(resultDict[d]['node' + str(i)]['DtoL']) |
| 303 | resultDict[d]['node' + str(i)]['Std']['LtoG'] = numpy.std(resultDict[d]['node' + str(i)]['LtoG']) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 304 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 305 | main.log.report( "=====node{} Summary:=====".format( str(i) ) ) |
| 306 | main.log.report( "=============Port {}=======".format( str(d) ) ) |
| 307 | main.log.report( |
| 308 | "End to End average: {}".format( str(resultDict[d][ 'node' + str(i) ][ 'Ave' ][ 'EtoE' ]) ) ) |
| 309 | main.log.report( |
| 310 | "End to End Std: {}".format( str(resultDict[d][ 'node' + str(i) ][ 'Std' ][ 'EtoE' ]) ) ) |
| 311 | main.log.report( |
| 312 | "Package to Device average: {}".format( str(resultDict[d]['node' + str(i)]['Ave']['PtoD']) ) ) |
| 313 | main.log.report( |
| 314 | "Package to Device Std: {}".format( str( resultDict[d]['node' + str(i)]['Std']['PtoD']))) |
| 315 | main.log.report( |
| 316 | "Device to Link average: {}".format( str( resultDict[d]['node' + str(i)]['Ave']['DtoL']) ) ) |
| 317 | main.log.report( |
| 318 | "Device to Link Std: {}".format( str( resultDict[d]['node' + str(i)]['Std']['DtoL']))) |
| 319 | main.log.report( |
| 320 | "Link to Grapg average: {}".format( str( resultDict[d]['node' + str(i)]['Ave']['LtoG']) ) ) |
| 321 | main.log.report( |
| 322 | "Link to Grapg Std: {}".format( str( resultDict[d]['node' + str(i)]['Std']['LtoG'] ) ) ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 323 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 324 | with open( main.dbFileName, "a" ) as dbFile: |
| 325 | # Scale number |
| 326 | temp = str( main.numCtrls ) |
| 327 | temp += ",'baremetal1'" |
| 328 | # put result |
| 329 | temp += "," + str( resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'EtoE' ] ) |
| 330 | temp += "," + str( resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'PtoD' ] ) |
| 331 | temp += "," + str( resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'DtoL' ] ) |
| 332 | temp += "," + str( resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'LtoG' ] ) |
| 333 | temp += "," + str( resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'EtoE' ] ) |
| 334 | temp += "," + str( resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'PtoD' ] ) |
| 335 | temp += "," + str( resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'DtoL' ] ) |
| 336 | temp += "," + str( resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'LtoG' ] ) |
chengchiyu | 074e3ef | 2016-08-24 16:32:32 -0700 | [diff] [blame] | 337 | |
| 338 | temp += "," + str( resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Std' ][ 'EtoE' ] ) |
| 339 | temp += "," + str( resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Std' ][ 'EtoE' ] ) |
| 340 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 341 | temp += "\n" |
| 342 | dbFile.write( temp ) |
| 343 | dbFile.close() |