andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 1 | # ScaleOutTemplate -> flowTP |
| 2 | # |
| 3 | # CASE1 starts number of nodes specified in param file |
| 4 | # |
| 5 | # cameron@onlab.us |
| 6 | |
| 7 | import sys |
| 8 | import os.path |
| 9 | |
| 10 | |
| 11 | class flowTP1g: |
| 12 | |
| 13 | def __init__( self ): |
| 14 | self.default = '' |
| 15 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 16 | def CASE1( self, main ): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 17 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 18 | import time |
| 19 | global init |
| 20 | try: |
| 21 | if type(init) is not bool: |
| 22 | init = False |
| 23 | except NameError: |
| 24 | init = False |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 25 | |
| 26 | #Load values from params file |
| 27 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 28 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 29 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 30 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 31 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 32 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 33 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 34 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 35 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 36 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 37 | |
| 38 | #----do i need this line? |
| 39 | #main.ONOSbench.handle.sendline("export TERM=vt100") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 40 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 41 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 42 | if init == False: |
| 43 | init = True |
| 44 | global clusterCount #number of nodes running |
| 45 | global ONOSIp #list of ONOS IP addresses |
| 46 | global scale |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 47 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 48 | clusterCount = 0 |
| 49 | ONOSIp = [ 0 ] |
| 50 | scale = (main.params[ 'SCALE' ]).split(",") |
| 51 | clusterCount = int(scale[0]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 52 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 53 | #Populate ONOSIp with ips from params |
| 54 | for i in range(1, maxNodes + 1): |
| 55 | ipString = 'ip' + str(i) |
| 56 | ONOSIp.append(main.params[ 'CTRL' ][ ipString ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 57 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 58 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 59 | if skipMvn != "yes": |
| 60 | mvnResult = main.ONOSbench.cleanInstall() |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 61 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 62 | #git |
| 63 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 64 | if gitPull == 'on': |
| 65 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 66 | pullResult = main.ONOSbench.gitPull() |
| 67 | |
| 68 | else: |
| 69 | checkoutResult = main.TRUE |
| 70 | pullResult = main.TRUE |
| 71 | main.log.info( "Skipped git checkout and pull" ) |
| 72 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 73 | # -- END OF INIT SECTION --# |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 74 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 75 | clusterCount = int(scale[0]) |
| 76 | scale.remove(scale[0]) |
| 77 | main.log.info("CLUSTER COUNT: " + str(clusterCount)) |
| 78 | |
| 79 | #kill off all onos processes |
| 80 | main.log.step("Safety check, killing all ONOS processes") |
| 81 | main.log.step("before initiating enviornment setup") |
| 82 | for node in range(1, maxNodes + 1): |
| 83 | main.ONOSbench.onosDie(ONOSIp[node]) |
| 84 | |
| 85 | #Uninstall everywhere |
| 86 | main.log.step( "Cleaning Enviornment..." ) |
| 87 | for i in range(1, maxNodes + 1): |
| 88 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 89 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
| 90 | |
| 91 | #construct the cell file |
| 92 | main.log.info("Creating cell file") |
| 93 | cellIp = [] |
| 94 | for node in range (1, clusterCount + 1): |
| 95 | cellIp.append(ONOSIp[node]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 96 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 97 | main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp) |
| 98 | main.log.info("Cell Ip list: " + str(cellIp)) |
| 99 | |
| 100 | main.step( "Set Cell" ) |
| 101 | main.ONOSbench.setCell(cellName) |
| 102 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 103 | main.step( "Creating ONOS package" ) |
| 104 | packageResult = main.ONOSbench.onosPackage() |
| 105 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 106 | main.step( "verify cells" ) |
| 107 | verifyCellResult = main.ONOSbench.verifyCell() |
| 108 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 109 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
| 110 | for node in range(1, clusterCount + 1): |
| 111 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
| 112 | main.ONOSbench.onosInstall( ONOSIp[node]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 113 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 114 | for node in range(1, clusterCount + 1): |
| 115 | for i in range( 2 ): |
| 116 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 117 | if isup: |
| 118 | main.log.info("ONOS " + str(node) + " is up\n") |
| 119 | break |
| 120 | if not isup: |
| 121 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
| 122 | |
| 123 | for node in range(1, clusterCount + 1): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 124 | exec "a = main.ONOS%scli.startOnosCli" %str(node) |
| 125 | a(ONOSIp[node]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 126 | |
| 127 | main.log.info("Startup sequence complete") |
| 128 | |
| 129 | |
| 130 | def CASE2( self, main ): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 131 | # |
| 132 | # This is the flow TP test |
| 133 | # |
| 134 | import os.path |
| 135 | import numpy |
| 136 | import math |
| 137 | import time |
| 138 | import datetime |
| 139 | import traceback |
| 140 | |
| 141 | testCMD = [ 0,0,0,0 ] |
| 142 | warmUp = int(main.params[ 'TEST' ][ 'warmUp' ]) |
| 143 | sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) |
| 144 | switches = int(main.params[ 'TEST' ][ 'switches' ]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 145 | neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 146 | testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ] |
| 147 | testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ] |
| 148 | maxNodes = main.params[ 'availableNodes' ] |
| 149 | onBaremetal = main.params['isOnBaremetal'] |
| 150 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 151 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 152 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 153 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 154 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 155 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 156 | homeDir = os.path.expanduser('~') |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 157 | |
| 158 | servers = str(clusterCount) |
| 159 | for i in range(0, len(neighborList)): |
| 160 | if neighborList[i] == 'a': |
| 161 | neighborList[i] = str(clusterCount - 1) |
| 162 | |
| 163 | if clusterCount == 1: |
| 164 | neighborList = ['0'] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 165 | main.log.info("neightborlist: " + str(neighborList)) |
| 166 | |
| 167 | ts = time.time() |
| 168 | st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') |
| 169 | logFileName = "../logs/flowTPResultsLog" + str(st) |
| 170 | |
| 171 | #initialize log file, remove any previous data |
| 172 | resultsLog = open("flowTPResultsLog","w+") |
| 173 | resultsLog.close() |
| 174 | |
| 175 | #write file to change mem limit to 32 gigs (BAREMETAL ONLY!) |
| 176 | if onBaremetal == "true": |
| 177 | filename = "/onos/tools/package/bin/onos-service" |
| 178 | serviceConfig = open(homeDir + filename, 'w+') |
| 179 | serviceConfig.write("#!/bin/bash\n ") |
| 180 | serviceConfig.write("#------------------------------------- \n ") |
| 181 | serviceConfig.write("# Starts ONOS Apache Karaf container\n ") |
| 182 | serviceConfig.write("#------------------------------------- \n ") |
| 183 | serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ") |
jenkins | 399e251 | 2015-03-24 10:31:57 -0700 | [diff] [blame] | 184 | serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 185 | serviceConfig.write("") |
| 186 | serviceConfig.write("ONOS_HOME=/opt/onos \n ") |
| 187 | serviceConfig.write("") |
| 188 | serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n") |
| 189 | serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """) |
| 190 | serviceConfig.close() |
| 191 | |
| 192 | for n in neighborList: |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 193 | main.log.step("\tSTARTING TEST") |
| 194 | main.log.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) ) |
| 195 | main.log.step("\tNEIGHBORS:\t" + n ) |
| 196 | main.log.info("=============================================================") |
| 197 | main.log.info("=============================================================") |
| 198 | #write file to configure nil link |
| 199 | ipCSV = "" |
| 200 | for i in range (1, int(maxNodes) + 1): |
| 201 | tempstr = "ip" + str(i) |
| 202 | ipCSV += main.params[ 'CTRL' ][ tempstr ] |
| 203 | if i < int(maxNodes): |
| 204 | ipCSV +="," |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 205 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 206 | filename = "/onos/tools/package/etc/org.onosproject.provider.nil.link.impl.NullLinkProvider.cfg" |
| 207 | linkConfig = open(homeDir + filename,'w+') |
| 208 | linkConfig.write("# eventRate = 2000\n") |
| 209 | linkConfig.write("neighbors = " + ipCSV) |
| 210 | main.log.info(" NullLinkProvider.cfg: " + ipCSV) |
| 211 | linkConfig.close() |
| 212 | |
| 213 | #config null device |
| 214 | cellIp = [] |
| 215 | for node in range(1, clusterCount + 1): |
| 216 | cellIp.append(ONOSIp[node]) |
| 217 | main.log.info(" NullDeviceProvider.cfg: " + str(cellIp)) |
| 218 | main.ONOSbench.configNullDev(cellIp, switches) |
| 219 | |
| 220 | #devide flows |
| 221 | flows = int(main.params[ 'TEST' ][ 'flows' ]) |
| 222 | main.log.info("Flow Target = " + str(flows)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 223 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 224 | flows = (flows *max(int(n)+1,int(servers)))/((int(n) + 1)*int(servers)*(switches)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 225 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 226 | main.log.info("Flows per switch = " + str(flows)) |
| 227 | #main.log.info("Total flows = " + str(switches * flows)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 228 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 229 | #build list of servers in "$OC1, $OC2...." format |
| 230 | serverEnvVars = "" |
| 231 | for i in range (1,int(servers)+1): |
| 232 | serverEnvVars += ("-s " + ONOSIp[i] + " ") |
| 233 | |
| 234 | data = [[""]*int(servers)]*int(sampleSize) |
| 235 | maxes = [""]*int(sampleSize) |
| 236 | |
| 237 | for test in range(0, (warmUp + sampleSize)): |
| 238 | flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/" |
| 239 | flowCMD += testCMD[0] + " " + str(flows) + " " + testCMD[1] |
| 240 | flowCMD += " " + str(n) + " " + str(serverEnvVars) |
| 241 | print("\n") |
| 242 | main.log.info("COMMAND: " + flowCMD) |
| 243 | main.log.info("Executing command") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 244 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 245 | for i in range(0,15): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 246 | main.ONOSbench.handle.sendline(flowCMD) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 247 | time.sleep(1) |
| 248 | main.ONOSbench.handle.expect(":~") |
| 249 | rawResult = main.ONOSbench.handle.before |
| 250 | if " -> " in rawResult: |
| 251 | break |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 252 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 253 | result = [""]*(clusterCount) |
| 254 | rawResult = rawResult.splitlines() |
| 255 | print(rawResult) |
| 256 | for node in range(1, clusterCount + 1): |
| 257 | for line in rawResult |
| 258 | if ONOSIp[node] in line and " -> " in line: |
| 259 | myLine = line.split(" ") |
| 260 | for word in myLine: |
| 261 | if "ms" in word: |
| 262 | result[node-1] = int(word.replace("ms","")) |
| 263 | main.log.info("Parsed result: " + str(result[node-1])) |
| 264 | break |
| 265 | break |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 266 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 267 | if test >= warmUp: |
| 268 | for i in result: |
| 269 | if i == "": |
| 270 | main.log.error("Missing data point, critical failure incoming") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 271 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 272 | print result |
| 273 | maxes[test-warmUp] = max(result) |
| 274 | main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize)) |
| 275 | main.log.info("Throughput time: " + str(maxes[test-warmUp]) + "(ms)") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 276 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 277 | if test >= warmUp: |
| 278 | data[test-warmUp] = result |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 279 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 280 | # wait for flows = 0 |
| 281 | removedFlows = False |
| 282 | repeat = 0 |
| 283 | time.sleep(3) |
| 284 | while ( removedFlows == False and repeat <= 10 ): |
| 285 | main.ONOSbench.handle.sendline("onos $OC1 summary| cut -d ' ' -f6") |
| 286 | main.ONOSbench.handle.expect("~") |
| 287 | before = main.ONOSbench.handle.before |
| 288 | parseTest = before.splitlines() |
| 289 | flowsummary = "" |
| 290 | for line in parseTest: |
| 291 | if "flow" in str(line): |
| 292 | flowsummary = line |
| 293 | break |
| 294 | currentflow = "" |
| 295 | for word in flowsummary.split(" "): |
| 296 | if "flow" in str(word): |
| 297 | currentflow = str(word) |
| 298 | currentflow = currentflow.replace(",","") |
| 299 | currentflow = currentflow.replace("\n","") |
| 300 | #main.log.info(currentflow) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 301 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 302 | zeroFlow = "flows=0" |
| 303 | if zeroFlow in before: |
| 304 | removedFlows = True |
| 305 | main.log.info("\t Wait 5 sec of cool down...") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 306 | time.sleep(5) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 307 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 308 | time.sleep(5) |
| 309 | repeat +=1 |
| 310 | |
| 311 | main.log.info("raw data: " + str(data)) |
| 312 | main.log.info("maxes:" + str(maxes)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 313 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 314 | |
| 315 | # report data |
| 316 | print("") |
| 317 | main.log.info("\t Results (measurments are in milliseconds)") |
| 318 | print("") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 319 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 320 | nodeString = "" |
| 321 | for i in range(1, int(servers) + 1): |
| 322 | nodeString += ("\tNode " + str(i)) |
| 323 | |
| 324 | for test in range(0, sampleSize ): |
| 325 | main.log.info("\t Test iteration " + str(test + 1) ) |
| 326 | main.log.info("\t------------------") |
| 327 | main.log.info(nodeString) |
| 328 | resultString = "" |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 329 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 330 | for i in range(0, int(servers) ): |
| 331 | resultString += ("\t" + str(data[test][i]) ) |
| 332 | main.log.info(resultString) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 333 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 334 | print("\n") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 335 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 336 | avgOfMaxes = numpy.mean(maxes) |
| 337 | main.log.info("Average of max value from each test iteration: " + str(avgOfMaxes)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 338 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 339 | stdOfMaxes = numpy.std(maxes) |
| 340 | main.log.info("Standard Deviation of max values: " + str(stdOfMaxes)) |
| 341 | print("\n\n") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 342 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 343 | avgTP = int(main.params[ 'TEST' ][ 'flows' ]) / avgOfMaxes #result in kflows/second |
| 344 | |
| 345 | tp = [] |
| 346 | for i in maxes: |
| 347 | tp.append((int(main.params[ 'TEST' ][ 'flows' ]) / i )) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 348 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 349 | stdTP = numpy.std(tp) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 350 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 351 | main.log.info("Average thoughput: " + str(avgTP) + " Kflows/second" ) |
| 352 | main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second") |
| 353 | |
| 354 | resultsLog = open(logFileName,"a") |
| 355 | resultsLog.write(str(main.params[ 'TEST' ][ 'flows' ]) + "," + n + "," + str(servers) + str(switches) + "," + str(warmUp)) |
| 356 | resultsLog.write("," +str(sampleSize) + "," + str(avgTP) + "," + str(stdTP) + "\n") |
| 357 | resultsLog.close() |
| 358 | |
| 359 | |