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 | ''' |
| 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" ) |
| 60 | |
| 61 | main.testOnDirectory = os.path.dirname(os.getcwd()) |
| 62 | main.MN1Ip = main.params['MN']['ip1'] |
| 63 | main.dependencyPath = main.testOnDirectory + \ |
| 64 | main.params['DEPENDENCY']['path'] |
| 65 | main.topoName = main.params['DEPENDENCY']['topology'] |
| 66 | main.dependencyFunc = main.params['DEPENDENCY']['function'] |
| 67 | main.cellName = main.params['ENV']['cellName'] |
| 68 | main.Apps = main.params['ENV']['cellApps'] |
| 69 | main.scale = (main.params['SCALE']).split(",") |
| 70 | |
| 71 | main.ofPackage = main.params['TSHARK'] |
| 72 | |
| 73 | main.tsharkResultPath = main.params['TEST']['tsharkResultPath'] |
| 74 | main.sampleSize = int(main.params['TEST']['sampleSize']) |
| 75 | main.warmUp = int(main.params['TEST']['warmUp']) |
| 76 | main.dbFileName = main.params['DATABASE']['dbName'] |
| 77 | main.startUpSleep = int(main.params['SLEEP']['startup']) |
| 78 | main.measurementSleep = int( main.params['SLEEP']['measure'] ) |
| 79 | 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'] |
| 83 | |
| 84 | main.log.info("Create Database file " + main.dbFileName) |
| 85 | resultsDB = open(main.dbFileName, "w+") |
| 86 | resultsDB.close() |
| 87 | |
| 88 | main.switchFunc = imp.load_source(main.dependencyFunc, |
| 89 | main.dependencyPath + |
| 90 | main.dependencyFunc + |
| 91 | ".py") |
| 92 | |
| 93 | def CASE1(self, main): |
| 94 | # Clean up test environment and set up |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 95 | import time |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 96 | main.log.info("Get ONOS cluster IP") |
| 97 | print(main.scale) |
| 98 | main.numCtrls = int(main.scale.pop(0)) |
| 99 | main.ONOSip = [] |
| 100 | main.maxNumBatch = 0 |
| 101 | main.AllONOSip = main.ONOSbench.getOnosIps() |
| 102 | for i in range(main.numCtrls): |
| 103 | main.ONOSip.append(main.AllONOSip[i]) |
| 104 | main.log.info(main.ONOSip) |
| 105 | main.CLIs = [] |
| 106 | main.log.info("Creating list of ONOS cli handles") |
| 107 | for i in range(main.numCtrls): |
| 108 | main.CLIs.append(getattr(main, 'ONOS%scli' % (i + 1))) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 109 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 110 | if not main.CLIs: |
| 111 | main.log.error("Failed to create the list of ONOS cli handles") |
| 112 | main.cleanup() |
| 113 | main.exit() |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 114 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 115 | main.commit = main.ONOSbench.getVersion(report=True) |
| 116 | main.commit = main.commit.split(" ")[1] |
| 117 | main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls) |
| 118 | main.log.info("Safety check, killing all ONOS processes" + |
| 119 | " before initiating environment setup") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 120 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 121 | for i in range(main.numCtrls): |
| 122 | main.ONOSbench.onosDie(main.ONOSip[i]) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 123 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 124 | 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, |
| 129 | main.ONOSip) |
| 130 | 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.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 139 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 140 | main.step("Creating ONOS package") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 141 | packageResult = main.ONOSbench.onosPackage() |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 142 | 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.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 147 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 148 | 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 Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 157 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 158 | 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 | |
| 168 | main.step("Verify ONOS nodes UP status") |
| 169 | statusResult = main.TRUE |
| 170 | for i in range(int(main.numCtrls)): |
| 171 | main.log.info("ONOS Node " + main.ONOSip[i] + " status:") |
| 172 | onos_status = main.ONOSbench.onosStatus(node=main.ONOSip[i]) |
| 173 | utilities.assert_equals(expect=main.TRUE, actual=onos_status, |
| 174 | onpass="Test step PASS", |
| 175 | onfail="Test step FAIL") |
| 176 | statusResult = (statusResult and onos_status) |
| 177 | time.sleep(2) |
| 178 | main.step("Start ONOS CLI on all nodes") |
| 179 | cliResult = main.TRUE |
| 180 | main.step(" Start ONOS cli using thread ") |
| 181 | startCliResult = main.TRUE |
| 182 | pool = [] |
| 183 | main.threadID = 0 |
| 184 | for i in range(int(main.numCtrls)): |
| 185 | t = main.Thread(target=main.CLIs[i].startOnosCli, |
| 186 | threadID=main.threadID, |
| 187 | name="startOnosCli", |
| 188 | args=[main.ONOSip[i]], |
| 189 | kwargs={"onosStartTimeout": main.timeout}) |
| 190 | pool.append(t) |
| 191 | t.start() |
| 192 | main.threadID = main.threadID + 1 |
| 193 | for t in pool: |
| 194 | t.join() |
| 195 | startCliResult = startCliResult and t.result |
| 196 | time.sleep(main.startUpSleep) |
| 197 | |
| 198 | main.log.info("Configure apps") |
| 199 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 200 | "maxEvents 1") |
| 201 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 202 | "maxBatchMs 0") |
| 203 | main.CLIs[0].setCfg("org.onosproject.net.topology.impl.DefaultTopologyProvider", |
| 204 | "maxIdleMs 0") |
| 205 | time.sleep(1) |
| 206 | |
| 207 | main.log.info("Copy topology file to Mininet") |
| 208 | main.ONOSbench.copyMininetFile(main.topoName, |
| 209 | main.dependencyPath, |
| 210 | main.Mininet1.user_name, |
| 211 | main.Mininet1.ip_address) |
| 212 | main.log.info("Stop Mininet...") |
| 213 | main.Mininet1.stopNet() |
| 214 | time.sleep(main.MNSleep) |
| 215 | main.log.info("Start new mininet topology") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 216 | main.Mininet1.startNet() |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 217 | main.log.info("Assign switch to controller to ONOS node 1") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 218 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 219 | time.sleep(2) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 220 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 221 | def CASE2(self,main): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 222 | import time |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 223 | import json |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 224 | import numpy |
| 225 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 226 | resultDict = {'up' : {}, 'down' : {}} |
| 227 | for i in range(1, main.numCtrls + 1): |
| 228 | resultDict['up'][ 'node' + str(i) ] = {} |
| 229 | resultDict['up'][ 'node' + str(i) ][ 'Ave' ] = {} |
| 230 | resultDict['up'][ 'node' + str(i) ][ 'Std' ] = {} |
| 231 | resultDict['up'][ 'node' + str(i) ][ 'T_F' ] = []#TCP to Feature |
| 232 | resultDict['up'][ 'node' + str(i) ][ 'F_R' ] = []#Feature to Role |
| 233 | resultDict['up'][ 'node' + str(i) ][ 'RQ_RR' ] = []#role request to role reply |
| 234 | resultDict['up'][ 'node' + str(i) ][ 'RR_D' ] = []#role reply to Device |
| 235 | resultDict['up'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph |
| 236 | resultDict['up'][ 'node' + str(i) ][ 'E_E' ] = []#TCP to Graph |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 237 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 238 | for i in range(1,main.numCtrls + 1): |
| 239 | resultDict['down'][ 'node' + str(i) ] = {} |
| 240 | resultDict['down'][ 'node' + str(i) ][ 'Ave' ] = {} |
| 241 | resultDict['down'][ 'node' + str(i) ][ 'Std' ] = {} |
| 242 | resultDict['down'][ 'node' + str(i) ][ 'FA_A' ] = []#Fin_ack to ACK |
| 243 | resultDict['down'][ 'node' + str(i) ][ 'A_D' ] = []#Ack to Device |
| 244 | resultDict['down'][ 'node' + str(i) ][ 'D_G' ] = []#Device to Graph |
| 245 | resultDict['down'][ 'node' + str(i) ][ 'E_E' ] = []#fin_ack to Graph |
| 246 | for i in range(1 , main.sampleSize + main.warmUp): |
| 247 | main.log.info("************************************************************") |
| 248 | main.log.info("************************ Iteration: {} **********************" .format(str( i )) ) |
| 249 | if i < main.warmUp: |
| 250 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
| 251 | "up", resultDict, True ) |
| 252 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
| 253 | "down", resultDict, True ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 254 | else: |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 255 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
| 256 | "up", resultDict, False ) |
| 257 | main.switchFunc.captureOfPack (main, main.device, main.ofPackage, |
| 258 | "down", resultDict, False ) |
| 259 | # Dictionary for result |
| 260 | maxDict = {} |
| 261 | maxDict['down'] = {} |
| 262 | maxDict['up'] = {} |
| 263 | maxDict['down']['max'] = 0 |
| 264 | maxDict['up']['max'] = 0 |
| 265 | maxDict['down']['node'] = 0 |
| 266 | maxDict['up']['node'] = 0 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 267 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 268 | for i in range(1, main.numCtrls + 1): |
| 269 | # calculate average and std for result, and grep the max End to End data |
| 270 | EtoEtemp = numpy.average( resultDict['up'][ 'node' + str(i) ]['E_E'] ) |
| 271 | resultDict['up'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp |
| 272 | if maxDict['up']['max'] < EtoEtemp: |
| 273 | # get max End to End latency |
| 274 | maxDict['up']['max'] = EtoEtemp |
| 275 | maxDict['up']['node'] = i |
| 276 | resultDict['up']['node' + str(i)]['Ave']['T_F'] = numpy.average(resultDict['up']['node' + str(i)]['T_F']) |
| 277 | resultDict['up']['node' + str(i)]['Ave']['F_R'] = numpy.average(resultDict['up']['node' + str(i)]['F_R']) |
| 278 | resultDict['up']['node' + str(i)]['Ave']['RQ_RR'] = numpy.average(resultDict['up']['node' + str(i)]['RQ_RR']) |
| 279 | resultDict['up']['node' + str(i)]['Ave']['RR_D'] = numpy.average(resultDict['up']['node' + str(i)]['RR_D']) |
| 280 | 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] | 281 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 282 | resultDict['up'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['up'][ 'node' + str(i) ]['E_E'] ) |
| 283 | resultDict['up']['node' + str(i)]['Std']['T_F'] = numpy.std(resultDict['up']['node' + str(i)]['T_F']) |
| 284 | resultDict['up']['node' + str(i)]['Std']['F_R'] = numpy.std(resultDict['up']['node' + str(i)]['F_R']) |
| 285 | resultDict['up']['node' + str(i)]['Std']['RQ_RR'] = numpy.std(resultDict['up']['node' + str(i)]['RQ_RR']) |
| 286 | resultDict['up']['node' + str(i)]['Std']['RR_D'] = numpy.std(resultDict['up']['node' + str(i)]['RR_D']) |
| 287 | 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] | 288 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 289 | # calculate average and std for result, and grep the max End to End data |
| 290 | EtoEtemp = numpy.average( resultDict['down'][ 'node' + str(i) ]['E_E'] ) |
| 291 | resultDict['down'][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ] = EtoEtemp |
| 292 | if maxDict['down']['max'] < EtoEtemp: |
| 293 | # get max End to End latency |
| 294 | maxDict['down']['max'] = EtoEtemp |
| 295 | maxDict['down']['node'] = i |
| 296 | resultDict['down']['node' + str(i)]['Ave']['FA_A'] = numpy.average(resultDict['down']['node' + str(i)]['FA_A']) |
| 297 | resultDict['down']['node' + str(i)]['Ave']['A_D'] = numpy.average(resultDict['down']['node' + str(i)]['A_D']) |
| 298 | 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] | 299 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 300 | resultDict['down'][ 'node' + str(i) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict['down'][ 'node' + str(i) ]['E_E'] ) |
| 301 | resultDict['down']['node' + str(i)]['Std']['FA_A'] = numpy.std(resultDict['down']['node' + str(i)]['FA_A']) |
| 302 | resultDict['down']['node' + str(i)]['Std']['A_D'] = numpy.std(resultDict['down']['node' + str(i)]['A_D']) |
| 303 | 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] | 304 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 305 | main.log.report( "=====node{} Summary:=====".format( str(i) ) ) |
| 306 | main.log.report( "=============Switch up=======" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 307 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 308 | main.log.report( |
| 309 | "End to End average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) ) |
| 310 | main.log.report( |
| 311 | "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] | 312 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 313 | main.log.report( |
| 314 | "TCP to Feature average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'T_F' ]) ) ) |
| 315 | main.log.report( |
| 316 | "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] | 317 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 318 | main.log.report( |
| 319 | "Feature to Role average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'F_R' ]) ) ) |
| 320 | main.log.report( |
| 321 | "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] | 322 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 323 | main.log.report( |
| 324 | "Role request to Role reply average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RQ_RR' ]) ) ) |
| 325 | main.log.report( |
| 326 | "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] | 327 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 328 | main.log.report( |
| 329 | "Role reply to Device average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'RR_D' ]) ) ) |
| 330 | main.log.report( |
| 331 | "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] | 332 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 333 | main.log.report( |
| 334 | "Device to Graph average: {}".format( str(resultDict["up"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) ) |
| 335 | main.log.report( |
| 336 | "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] | 337 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 338 | main.log.report( "=============Switch down=======" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 339 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 340 | main.log.report( |
| 341 | "End to End average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'E_E' ]) ) ) |
| 342 | main.log.report( |
| 343 | "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] | 344 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 345 | main.log.report( |
| 346 | "Fin_ACK to ACK average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'FA_A' ]) ) ) |
| 347 | main.log.report( |
| 348 | "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] | 349 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 350 | main.log.report( |
| 351 | "ACK to Device average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'A_D' ]) ) ) |
| 352 | main.log.report( |
| 353 | "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] | 354 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 355 | main.log.report( |
| 356 | "Device to Graph average: {}".format( str(resultDict["down"][ 'node' + str(i) ][ 'Ave' ][ 'D_G' ]) ) ) |
| 357 | main.log.report( |
| 358 | "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] | 359 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 360 | with open(main.dbFileName, "a") as dbFile: |
| 361 | # TODO: Save STD to Database |
| 362 | # Scale number |
| 363 | temp = str(main.numCtrls) |
| 364 | temp += ",'baremetal1'" |
| 365 | # put result |
| 366 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'E_E' ] ) |
| 367 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'T_F' ] ) |
| 368 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'F_R' ] ) |
| 369 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RQ_RR' ] ) |
| 370 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Ave' ][ 'RR_D' ] ) |
| 371 | 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] | 372 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 373 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'E_E' ] ) |
| 374 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'FA_A' ] ) |
| 375 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'A_D' ] ) |
| 376 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Ave' ][ 'D_G' ] ) |
chengchiyu | c6f4cc0 | 2016-08-24 14:04:20 -0700 | [diff] [blame] | 377 | |
| 378 | temp += "," + str( "%.2f" % resultDict['up'][ 'node' + str(maxDict['up']['node']) ][ 'Std' ][ 'E_E' ] ) |
| 379 | temp += "," + str( "%.2f" % resultDict['down'][ 'node' + str(maxDict['down']['node']) ][ 'Std' ][ 'E_E' ] ) |
| 380 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 381 | temp += "\n" |
| 382 | dbFile.write( temp ) |
| 383 | dbFile.close() |