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' ] |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 37 | |
| 38 | main.log.info("==========DEBUG VERSION 3===========") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 39 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 40 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 41 | if init == False: |
| 42 | init = True |
| 43 | global clusterCount #number of nodes running |
| 44 | global ONOSIp #list of ONOS IP addresses |
| 45 | global scale |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 46 | global commit |
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" ) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 72 | |
| 73 | commit = main.ONOSbench.getVersion() |
| 74 | commit = (commit.split(" "))[1] |
| 75 | |
| 76 | resultsDB = open("flowTP1gDB", "w+") |
| 77 | resultsDB.close() |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 78 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 79 | # -- END OF INIT SECTION --# |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 80 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 81 | clusterCount = int(scale[0]) |
| 82 | scale.remove(scale[0]) |
| 83 | main.log.info("CLUSTER COUNT: " + str(clusterCount)) |
| 84 | |
| 85 | #kill off all onos processes |
| 86 | main.log.step("Safety check, killing all ONOS processes") |
| 87 | main.log.step("before initiating enviornment setup") |
| 88 | for node in range(1, maxNodes + 1): |
| 89 | main.ONOSbench.onosDie(ONOSIp[node]) |
| 90 | |
| 91 | #Uninstall everywhere |
| 92 | main.log.step( "Cleaning Enviornment..." ) |
| 93 | for i in range(1, maxNodes + 1): |
| 94 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 95 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
| 96 | |
| 97 | #construct the cell file |
| 98 | main.log.info("Creating cell file") |
| 99 | cellIp = [] |
| 100 | for node in range (1, clusterCount + 1): |
| 101 | cellIp.append(ONOSIp[node]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 102 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 103 | main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp) |
| 104 | main.log.info("Cell Ip list: " + str(cellIp)) |
| 105 | |
| 106 | main.step( "Set Cell" ) |
| 107 | main.ONOSbench.setCell(cellName) |
| 108 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 109 | main.step( "Creating ONOS package" ) |
| 110 | packageResult = main.ONOSbench.onosPackage() |
| 111 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 112 | main.step( "verify cells" ) |
| 113 | verifyCellResult = main.ONOSbench.verifyCell() |
| 114 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 115 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
| 116 | for node in range(1, clusterCount + 1): |
| 117 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
| 118 | main.ONOSbench.onosInstall( ONOSIp[node]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 119 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 120 | for node in range(1, clusterCount + 1): |
| 121 | for i in range( 2 ): |
| 122 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 123 | if isup: |
| 124 | main.log.info("ONOS " + str(node) + " is up\n") |
| 125 | break |
| 126 | if not isup: |
| 127 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
| 128 | |
| 129 | for node in range(1, clusterCount + 1): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 130 | exec "a = main.ONOS%scli.startOnosCli" %str(node) |
| 131 | a(ONOSIp[node]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 132 | |
| 133 | main.log.info("Startup sequence complete") |
| 134 | |
| 135 | |
| 136 | def CASE2( self, main ): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 137 | # |
| 138 | # This is the flow TP test |
| 139 | # |
| 140 | import os.path |
| 141 | import numpy |
| 142 | import math |
| 143 | import time |
| 144 | import datetime |
| 145 | import traceback |
| 146 | |
| 147 | testCMD = [ 0,0,0,0 ] |
| 148 | warmUp = int(main.params[ 'TEST' ][ 'warmUp' ]) |
| 149 | sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) |
| 150 | switches = int(main.params[ 'TEST' ][ 'switches' ]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 151 | neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 152 | testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ] |
| 153 | testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ] |
| 154 | maxNodes = main.params[ 'availableNodes' ] |
| 155 | onBaremetal = main.params['isOnBaremetal'] |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 156 | cooldown = main.params[ 'TEST' ][ 'cooldown' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 157 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 158 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 159 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 160 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 161 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 162 | homeDir = os.path.expanduser('~') |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 163 | flowRuleBackup = str(main.params[ 'TEST' ][ 'enableFlowRuleStoreBackup' ]) |
| 164 | print flowRuleBackup |
| 165 | |
| 166 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 167 | servers = str(clusterCount) |
| 168 | for i in range(0, len(neighborList)): |
| 169 | if neighborList[i] == 'a': |
| 170 | neighborList[i] = str(clusterCount - 1) |
| 171 | |
| 172 | if clusterCount == 1: |
| 173 | neighborList = ['0'] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 174 | main.log.info("neightborlist: " + str(neighborList)) |
| 175 | |
| 176 | ts = time.time() |
| 177 | st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 178 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 179 | #write file to change mem limit to 32 gigs (BAREMETAL ONLY!) |
| 180 | if onBaremetal == "true": |
| 181 | filename = "/onos/tools/package/bin/onos-service" |
| 182 | serviceConfig = open(homeDir + filename, 'w+') |
| 183 | serviceConfig.write("#!/bin/bash\n ") |
| 184 | serviceConfig.write("#------------------------------------- \n ") |
| 185 | serviceConfig.write("# Starts ONOS Apache Karaf container\n ") |
| 186 | serviceConfig.write("#------------------------------------- \n ") |
| 187 | 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] | 188 | serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 189 | serviceConfig.write("") |
| 190 | serviceConfig.write("ONOS_HOME=/opt/onos \n ") |
| 191 | serviceConfig.write("") |
| 192 | serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n") |
| 193 | serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """) |
| 194 | serviceConfig.close() |
| 195 | |
| 196 | for n in neighborList: |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 197 | main.log.step("\tSTARTING TEST") |
| 198 | main.log.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) ) |
| 199 | main.log.step("\tNEIGHBORS:\t" + n ) |
| 200 | main.log.info("=============================================================") |
| 201 | main.log.info("=============================================================") |
| 202 | #write file to configure nil link |
| 203 | ipCSV = "" |
| 204 | for i in range (1, int(maxNodes) + 1): |
| 205 | tempstr = "ip" + str(i) |
| 206 | ipCSV += main.params[ 'CTRL' ][ tempstr ] |
| 207 | if i < int(maxNodes): |
| 208 | ipCSV +="," |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 209 | |
| 210 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 211 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount 35" """) |
| 212 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 213 | time.sleep(3) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 214 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """) |
| 215 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 216 | time.sleep(3) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 217 | main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """) |
| 218 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 219 | time.sleep(3) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 220 | main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """) |
| 221 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 222 | time.sleep(3) |
| 223 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.store.flow.impl.DistributedFlowRuleStore backupEnabled """ + str(flowRuleBackup) + """ " """) |
| 224 | main.ONOSbench.handle.expect(":~") |
| 225 | |
| 226 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 227 | main.ONOSbench.handle.expect(":~") |
| 228 | check = main.ONOSbench.handle.before |
| 229 | main.log.info("\nStart up check: \n" + check + "\n") |
| 230 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 231 | #devide flows |
| 232 | flows = int(main.params[ 'TEST' ][ 'flows' ]) |
| 233 | main.log.info("Flow Target = " + str(flows)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 234 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 235 | 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] | 236 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 237 | main.log.info("Flows per switch = " + str(flows)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 238 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 239 | #build list of servers in "$OC1, $OC2...." format |
| 240 | serverEnvVars = "" |
| 241 | for i in range (1,int(servers)+1): |
| 242 | serverEnvVars += ("-s " + ONOSIp[i] + " ") |
| 243 | |
| 244 | data = [[""]*int(servers)]*int(sampleSize) |
| 245 | maxes = [""]*int(sampleSize) |
| 246 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 247 | flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/" |
| 248 | flowCMD += testCMD[0] + " " + str(flows) + " " + testCMD[1] |
| 249 | flowCMD += " " + str(n) + " " + str(serverEnvVars) + "-j" |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 250 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 251 | main.log.info(flowCMD) |
| 252 | #time.sleep(60) |
| 253 | |
| 254 | for test in range(0, warmUp + sampleSize): |
| 255 | if test < warmUp: |
| 256 | main.log.info("Warm up " + str(test + 1) + " of " + str(warmUp)) |
| 257 | else: |
| 258 | main.log.info("====== Test run: " + str(test-warmUp+1) + " ======") |
| 259 | |
| 260 | main.ONOSbench.handle.sendline(flowCMD) |
| 261 | main.ONOSbench.handle.expect(":~") |
| 262 | rawResult = main.ONOSbench.handle.before |
| 263 | main.log.info("Raw results: \n" + rawResult + "\n") |
| 264 | |
| 265 | if "failed" in rawResult: |
| 266 | main.log.report("FLOW_TESTER.PY FAILURE") |
| 267 | main.log.report( " \n" + rawResult + " \n") |
| 268 | break |
| 269 | |
| 270 | ######################################################################################## |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 271 | result = [""]*(clusterCount) |
| 272 | rawResult = rawResult.splitlines() |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 273 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 274 | for node in range(1, clusterCount + 1): |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 275 | for line in rawResult: |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 276 | #print("line: " + line) |
| 277 | if ONOSIp[node] in line and "server" in line: |
| 278 | temp = line.split(" ") |
| 279 | for word in temp: |
| 280 | #print ("word: " + word) |
| 281 | if "elapsed" in repr(word): |
| 282 | #print("in elapsed ==========") |
| 283 | index = temp.index(word) + 1 |
| 284 | #print ("index: " + str(index)) |
| 285 | #print ("temp[index]: " + temp[index]) |
| 286 | myParsed = (temp[index]).replace(",","") |
| 287 | myParsed = myParsed.replace("}","") |
| 288 | myParsed = int(myParsed) |
| 289 | result[node-1] = myParsed |
| 290 | main.log.info( ONOSIp[node] + " : " + str(myParsed)) |
| 291 | break |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 292 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 293 | if test >= warmUp: |
| 294 | for i in result: |
| 295 | if i == "": |
| 296 | main.log.error("Missing data point, critical failure incoming") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 297 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 298 | print result |
| 299 | maxes[test-warmUp] = max(result) |
| 300 | main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize)) |
| 301 | main.log.info("Throughput time: " + str(maxes[test-warmUp]) + "(ms)") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 302 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 303 | data[test-warmUp] = result |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 304 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 305 | # wait for flows = 0 |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 306 | for checkCount in range(0,3): |
| 307 | time.sleep(6) |
| 308 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 309 | main.ONOSbench.handle.expect(":~") |
| 310 | flowCheck = main.ONOSbench.handle.before |
| 311 | if "flows=0," in flowCheck: |
| 312 | main.log.info("Flows removed") |
| 313 | break |
| 314 | else: |
| 315 | for line in flowCheck.splitlines(): |
| 316 | if "flows=" in line: |
| 317 | main.log.info("Current Summary: " + line) |
| 318 | if checkCount == 2: |
| 319 | main.log.info("Flows are stuck, moving on ") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 320 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 321 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 322 | time.sleep(5) |
| 323 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 324 | main.log.info("raw data: " + str(data)) |
| 325 | main.log.info("maxes:" + str(maxes)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 326 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 327 | |
| 328 | # report data |
| 329 | print("") |
| 330 | main.log.info("\t Results (measurments are in milliseconds)") |
| 331 | print("") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 332 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 333 | nodeString = "" |
| 334 | for i in range(1, int(servers) + 1): |
| 335 | nodeString += ("\tNode " + str(i)) |
| 336 | |
| 337 | for test in range(0, sampleSize ): |
| 338 | main.log.info("\t Test iteration " + str(test + 1) ) |
| 339 | main.log.info("\t------------------") |
| 340 | main.log.info(nodeString) |
| 341 | resultString = "" |
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 | for i in range(0, int(servers) ): |
| 344 | resultString += ("\t" + str(data[test][i]) ) |
| 345 | main.log.info(resultString) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 346 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 347 | print("\n") |
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 | avgOfMaxes = numpy.mean(maxes) |
| 350 | 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] | 351 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 352 | stdOfMaxes = numpy.std(maxes) |
| 353 | main.log.info("Standard Deviation of max values: " + str(stdOfMaxes)) |
| 354 | print("\n\n") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 355 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 356 | avgTP = int(main.params[ 'TEST' ][ 'flows' ]) / avgOfMaxes #result in kflows/second |
| 357 | |
| 358 | tp = [] |
| 359 | for i in maxes: |
| 360 | tp.append((int(main.params[ 'TEST' ][ 'flows' ]) / i )) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 361 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 362 | stdTP = numpy.std(tp) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 363 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 364 | main.log.info("Average thoughput: " + str(avgTP) + " Kflows/second" ) |
| 365 | main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second") |
| 366 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 367 | resultsLog = open("flowTP1gDB","a") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 368 | resultString = ("'" + commit + "',") |
| 369 | resultString += ("'1gig',") |
| 370 | resultString += ((main.params[ 'TEST' ][ 'flows' ]) + ",") |
| 371 | resultString += (str(clusterCount) + ",") |
| 372 | resultString += (str(n) + ",") |
| 373 | resultString += (str(avgTP) + "," + str(stdTP) + "\n") |
| 374 | resultsLog.write(resultString) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 375 | resultsLog.close() |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame^] | 376 | |
| 377 | main.log.report("Result line to file: " + resultString) |
| 378 | |
| 379 | |