blob: 1f6ecbfc6adafa99502cf9c8ff1189d1cb339351 [file] [log] [blame]
andrew@onlab.us5cdb2852015-03-11 15:11:10 -07001# ScaleOutTemplate -> flowTP
2#
3# CASE1 starts number of nodes specified in param file
4#
5# cameron@onlab.us
6
7import sys
8import os.path
9
10
11class flowTP1g:
12
13 def __init__( self ):
14 self.default = ''
15
cameron@onlab.us19494212015-04-01 16:12:07 -070016 def CASE1( self, main ):
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070017
cameron@onlab.us19494212015-04-01 16:12:07 -070018 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.us5cdb2852015-03-11 15:11:10 -070025
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.us19494212015-04-01 16:12:07 -070030 Apps = main.params[ 'ENV' ][ 'cellApps' ]
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070031 BENCHUser = main.params[ 'BENCH' ][ 'user' ]
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070032 maxNodes = int(main.params[ 'availableNodes' ])
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070033 skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cameron@onlab.us19494212015-04-01 16:12:07 -070034 cellName = main.params[ 'ENV' ][ 'cellName' ]
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -070035
36 main.log.info("==========DEBUG VERSION 3===========")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070037
cameron@onlab.us412e9562015-05-13 16:04:34 -070038 main.exceptions = [0]*11
39 main.warnings = [0]*11
40 main.errors = [0]*11
41
cameron@onlab.us19494212015-04-01 16:12:07 -070042 # -- INIT SECTION, ONLY RUNS ONCE -- #
43 if init == False:
44 init = True
45 global clusterCount #number of nodes running
46 global ONOSIp #list of ONOS IP addresses
47 global scale
cameron@onlab.usc80a8c82015-04-15 14:57:37 -070048 global commit
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070049
cameron@onlab.us19494212015-04-01 16:12:07 -070050 clusterCount = 0
51 ONOSIp = [ 0 ]
52 scale = (main.params[ 'SCALE' ]).split(",")
53 clusterCount = int(scale[0])
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070054
cameron@onlab.us19494212015-04-01 16:12:07 -070055 #Populate ONOSIp with ips from params
56 for i in range(1, maxNodes + 1):
57 ipString = 'ip' + str(i)
58 ONOSIp.append(main.params[ 'CTRL' ][ ipString ])
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070059
jenkins15b2b132015-06-23 14:04:09 -070060 ONOSIp = [0]
61 ONOSIp.extend(main.ONOSbench.getOnosIps())
jenkins15b2b132015-06-23 14:04:09 -070062
cameron@onlab.us19494212015-04-01 16:12:07 -070063 #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
64 if skipMvn != "yes":
65 mvnResult = main.ONOSbench.cleanInstall()
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070066
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070067 #git
68 main.step( "Git checkout and pull " + checkoutBranch )
69 if gitPull == 'on':
70 checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch )
71 pullResult = main.ONOSbench.gitPull()
72
73 else:
74 checkoutResult = main.TRUE
75 pullResult = main.TRUE
76 main.log.info( "Skipped git checkout and pull" )
cameron@onlab.usc80a8c82015-04-15 14:57:37 -070077
78 commit = main.ONOSbench.getVersion()
79 commit = (commit.split(" "))[1]
80
81 resultsDB = open("flowTP1gDB", "w+")
82 resultsDB.close()
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070083
cameron@onlab.us19494212015-04-01 16:12:07 -070084 # -- END OF INIT SECTION --#
andrew@onlab.us5cdb2852015-03-11 15:11:10 -070085
cameron@onlab.us19494212015-04-01 16:12:07 -070086 clusterCount = int(scale[0])
87 scale.remove(scale[0])
88 main.log.info("CLUSTER COUNT: " + str(clusterCount))
89
jenkins8f8f4f32015-06-24 14:05:04 -070090 MN1Ip = ONOSIp[len(ONOSIp)-1]
91 BENCHIp = ONOSIp[len(ONOSIp)-2]
92
cameron@onlab.us19494212015-04-01 16:12:07 -070093 #kill off all onos processes
94 main.log.step("Safety check, killing all ONOS processes")
95 main.log.step("before initiating enviornment setup")
96 for node in range(1, maxNodes + 1):
97 main.ONOSbench.onosDie(ONOSIp[node])
98
99 #Uninstall everywhere
100 main.log.step( "Cleaning Enviornment..." )
101 for i in range(1, maxNodes + 1):
102 main.log.info(" Uninstalling ONOS " + str(i) )
103 main.ONOSbench.onosUninstall( ONOSIp[i] )
104
105 #construct the cell file
106 main.log.info("Creating cell file")
107 cellIp = []
108 for node in range (1, clusterCount + 1):
109 cellIp.append(ONOSIp[node])
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700110
cameron@onlab.us19494212015-04-01 16:12:07 -0700111 main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp)
112 main.log.info("Cell Ip list: " + str(cellIp))
113
114 main.step( "Set Cell" )
115 main.ONOSbench.setCell(cellName)
116
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700117 main.step( "Creating ONOS package" )
118 packageResult = main.ONOSbench.onosPackage()
119
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700120 main.step( "verify cells" )
121 verifyCellResult = main.ONOSbench.verifyCell()
122
cameron@onlab.us19494212015-04-01 16:12:07 -0700123 main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
124 for node in range(1, clusterCount + 1):
125 main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
126 main.ONOSbench.onosInstall( ONOSIp[node])
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700127
cameron@onlab.us19494212015-04-01 16:12:07 -0700128 for node in range(1, clusterCount + 1):
129 for i in range( 2 ):
130 isup = main.ONOSbench.isup( ONOSIp[node] )
131 if isup:
132 main.log.info("ONOS " + str(node) + " is up\n")
133 break
134 if not isup:
135 main.log.report( "ONOS " + str(node) + " didn't start!" )
136
137 for node in range(1, clusterCount + 1):
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700138 exec "a = main.ONOS%scli.startOnosCli" %str(node)
139 a(ONOSIp[node])
cameron@onlab.us19494212015-04-01 16:12:07 -0700140
141 main.log.info("Startup sequence complete")
cameron@onlab.us412e9562015-05-13 16:04:34 -0700142 main.ONOSbench.onosErrorLog(ONOSIp[1])
cameron@onlab.us19494212015-04-01 16:12:07 -0700143
144 def CASE2( self, main ):
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700145 #
146 # This is the flow TP test
147 #
148 import os.path
149 import numpy
150 import math
151 import time
152 import datetime
153 import traceback
154
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700155 global currentNeighbors
156 try:
cameron@onlab.us50dacf82015-05-08 14:56:42 -0700157 currentNeighbors
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700158 except:
jenkinse450d942015-06-19 13:37:31 -0700159 currentNeighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")[0]
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700160 else:
cameron@onlab.us50dacf82015-05-08 14:56:42 -0700161 if currentNeighbors == "r": #reset
162 currentNeighbors = "0"
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700163 else:
cameron@onlab.us50dacf82015-05-08 14:56:42 -0700164 currentNeighbors = "a"
165
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700166 testCMD = [ 0,0,0,0 ]
167 warmUp = int(main.params[ 'TEST' ][ 'warmUp' ])
168 sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ])
169 switches = int(main.params[ 'TEST' ][ 'switches' ])
cameron@onlab.us19494212015-04-01 16:12:07 -0700170 neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700171 testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ]
172 testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ]
173 maxNodes = main.params[ 'availableNodes' ]
174 onBaremetal = main.params['isOnBaremetal']
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700175 cooldown = main.params[ 'TEST' ][ 'cooldown' ]
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700176 cellName = main.params[ 'ENV' ][ 'cellName' ]
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700177 BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
178 BENCHUser = main.params[ 'BENCH' ][ 'user' ]
179 MN1Ip = main.params[ 'MN' ][ 'ip1' ]
180 maxNodes = int(main.params[ 'availableNodes' ])
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700181 homeDir = os.path.expanduser('~')
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700182 flowRuleBackup = str(main.params[ 'TEST' ][ 'enableFlowRuleStoreBackup' ])
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700183 main.log.info("Flow Rule Backup is set to:" + flowRuleBackup)
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700184
cameron@onlab.us19494212015-04-01 16:12:07 -0700185 servers = str(clusterCount)
cameron@onlab.us19494212015-04-01 16:12:07 -0700186
187 if clusterCount == 1:
188 neighborList = ['0']
cameron@onlab.us50dacf82015-05-08 14:56:42 -0700189 currentNeighbors = "r"
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700190 else:
191 if currentNeighbors == "a":
cameron@onlab.us50dacf82015-05-08 14:56:42 -0700192 neighborList = [str(clusterCount-1)]
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700193 currentNeighbors = "r"
cameron@onlab.us50dacf82015-05-08 14:56:42 -0700194 else:
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700195 neighborList = ['0']
jenkinse450d942015-06-19 13:37:31 -0700196
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700197 main.log.info("neightborlist: " + str(neighborList))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700198
199 ts = time.time()
200 st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700201
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700202 #write file to change mem limit to 32 gigs (BAREMETAL ONLY!)
203 if onBaremetal == "true":
204 filename = "/onos/tools/package/bin/onos-service"
205 serviceConfig = open(homeDir + filename, 'w+')
206 serviceConfig.write("#!/bin/bash\n ")
207 serviceConfig.write("#------------------------------------- \n ")
208 serviceConfig.write("# Starts ONOS Apache Karaf container\n ")
209 serviceConfig.write("#------------------------------------- \n ")
210 serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ")
jenkins399e2512015-03-24 10:31:57 -0700211 serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """)
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700212 serviceConfig.write("")
213 serviceConfig.write("ONOS_HOME=/opt/onos \n ")
214 serviceConfig.write("")
215 serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n")
216 serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """)
217 serviceConfig.close()
218
219 for n in neighborList:
cameron@onlab.us19494212015-04-01 16:12:07 -0700220 main.log.step("\tSTARTING TEST")
221 main.log.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) )
222 main.log.step("\tNEIGHBORS:\t" + n )
223 main.log.info("=============================================================")
224 main.log.info("=============================================================")
225 #write file to configure nil link
226 ipCSV = ""
227 for i in range (1, int(maxNodes) + 1):
228 tempstr = "ip" + str(i)
229 ipCSV += main.params[ 'CTRL' ][ tempstr ]
230 if i < int(maxNodes):
231 ipCSV +=","
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700232
jenkinse450d942015-06-19 13:37:31 -0700233 for i in range(5):
234 main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount 35" """)
235 main.ONOSbench.handle.expect(":~")
236 time.sleep(3)
237 main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """)
238 main.ONOSbench.handle.expect(":~")
239 time.sleep(3)
240 main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """)
241 main.ONOSbench.handle.expect(":~")
242 time.sleep(3)
243 main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """)
244 main.ONOSbench.handle.expect(":~")
245 time.sleep(3)
246 main.log.info("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """)
247 main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """)
248 main.ONOSbench.handle.expect(":~")
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700249
jenkinse450d942015-06-19 13:37:31 -0700250 main.ONOSbench.handle.sendline("""onos $OC1 "cfg get" """)
251 main.ONOSbench.handle.expect(":~")
252 main.log.info(main.ONOSbench.handle.before)
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700253
jenkinse450d942015-06-19 13:37:31 -0700254 time.sleep(3)
255 main.ONOSbench.handle.sendline("onos $OC1 summary")
256 main.ONOSbench.handle.expect(":~")
257 check = main.ONOSbench.handle.before
258 main.log.info("\nStart up check: \n" + check + "\n")
259 if "SCC(s)=1," in check:
260 break
261 time.sleep(5)
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700262
cameron@onlab.us19494212015-04-01 16:12:07 -0700263 #devide flows
264 flows = int(main.params[ 'TEST' ][ 'flows' ])
265 main.log.info("Flow Target = " + str(flows))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700266
cameron@onlab.us19494212015-04-01 16:12:07 -0700267 flows = (flows *max(int(n)+1,int(servers)))/((int(n) + 1)*int(servers)*(switches))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700268
cameron@onlab.us19494212015-04-01 16:12:07 -0700269 main.log.info("Flows per switch = " + str(flows))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700270
cameron@onlab.us19494212015-04-01 16:12:07 -0700271 #build list of servers in "$OC1, $OC2...." format
272 serverEnvVars = ""
273 for i in range (1,int(servers)+1):
274 serverEnvVars += ("-s " + ONOSIp[i] + " ")
275
276 data = [[""]*int(servers)]*int(sampleSize)
277 maxes = [""]*int(sampleSize)
278
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700279 flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/"
280 flowCMD += testCMD[0] + " " + str(flows) + " " + testCMD[1]
281 flowCMD += " " + str(n) + " " + str(serverEnvVars) + "-j"
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700282
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700283 main.log.info(flowCMD)
284 #time.sleep(60)
285
286 for test in range(0, warmUp + sampleSize):
287 if test < warmUp:
288 main.log.info("Warm up " + str(test + 1) + " of " + str(warmUp))
289 else:
290 main.log.info("====== Test run: " + str(test-warmUp+1) + " ======")
291
292 main.ONOSbench.handle.sendline(flowCMD)
293 main.ONOSbench.handle.expect(":~")
294 rawResult = main.ONOSbench.handle.before
295 main.log.info("Raw results: \n" + rawResult + "\n")
296
297 if "failed" in rawResult:
298 main.log.report("FLOW_TESTER.PY FAILURE")
jenkinse450d942015-06-19 13:37:31 -0700299 main.log.report( " \n" + rawResult + " \n")
300 for i in range(clusterCount):
301 main.log.report("=======================================================")
302 main.log.report(" ONOS " + str(i) + "LOG REPORT")
303 main.ONOSbench.logReport(ONOSIp[i], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
304 main.ONOSbench.handle.sendline("onos $OC1 flows")
305 main.ONOSbench.handle.expect(":~")
306 main.log.info(main.ONOSbench.handle.before)
307
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700308 break
309
310 ########################################################################################
cameron@onlab.us19494212015-04-01 16:12:07 -0700311 result = [""]*(clusterCount)
312 rawResult = rawResult.splitlines()
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700313
cameron@onlab.us19494212015-04-01 16:12:07 -0700314 for node in range(1, clusterCount + 1):
cameron@onlab.usc80a8c82015-04-15 14:57:37 -0700315 for line in rawResult:
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700316 #print("line: " + line)
317 if ONOSIp[node] in line and "server" in line:
318 temp = line.split(" ")
319 for word in temp:
320 #print ("word: " + word)
321 if "elapsed" in repr(word):
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700322 index = temp.index(word) + 1
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700323 myParsed = (temp[index]).replace(",","")
324 myParsed = myParsed.replace("}","")
325 myParsed = int(myParsed)
326 result[node-1] = myParsed
327 main.log.info( ONOSIp[node] + " : " + str(myParsed))
328 break
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700329
cameron@onlab.us19494212015-04-01 16:12:07 -0700330 if test >= warmUp:
331 for i in result:
332 if i == "":
333 main.log.error("Missing data point, critical failure incoming")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700334
cameron@onlab.us19494212015-04-01 16:12:07 -0700335 print result
336 maxes[test-warmUp] = max(result)
337 main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize))
338 main.log.info("Throughput time: " + str(maxes[test-warmUp]) + "(ms)")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700339
cameron@onlab.us19494212015-04-01 16:12:07 -0700340 data[test-warmUp] = result
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700341
cameron@onlab.us19494212015-04-01 16:12:07 -0700342 # wait for flows = 0
cameron@onlab.uscd4e8a22015-05-11 10:58:43 -0700343 for checkCount in range(0,5):
344 time.sleep(10)
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700345 main.ONOSbench.handle.sendline("onos $OC1 summary")
346 main.ONOSbench.handle.expect(":~")
347 flowCheck = main.ONOSbench.handle.before
348 if "flows=0," in flowCheck:
349 main.log.info("Flows removed")
350 break
351 else:
352 for line in flowCheck.splitlines():
353 if "flows=" in line:
354 main.log.info("Current Summary: " + line)
355 if checkCount == 2:
356 main.log.info("Flows are stuck, moving on ")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700357
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700358
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700359 time.sleep(5)
360
cameron@onlab.us19494212015-04-01 16:12:07 -0700361 main.log.info("raw data: " + str(data))
362 main.log.info("maxes:" + str(maxes))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700363
cameron@onlab.us19494212015-04-01 16:12:07 -0700364
365 # report data
366 print("")
367 main.log.info("\t Results (measurments are in milliseconds)")
368 print("")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700369
cameron@onlab.us19494212015-04-01 16:12:07 -0700370 nodeString = ""
371 for i in range(1, int(servers) + 1):
372 nodeString += ("\tNode " + str(i))
373
374 for test in range(0, sampleSize ):
375 main.log.info("\t Test iteration " + str(test + 1) )
376 main.log.info("\t------------------")
377 main.log.info(nodeString)
378 resultString = ""
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700379
cameron@onlab.us19494212015-04-01 16:12:07 -0700380 for i in range(0, int(servers) ):
381 resultString += ("\t" + str(data[test][i]) )
382 main.log.info(resultString)
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700383
cameron@onlab.us19494212015-04-01 16:12:07 -0700384 print("\n")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700385
cameron@onlab.us19494212015-04-01 16:12:07 -0700386 avgOfMaxes = numpy.mean(maxes)
387 main.log.info("Average of max value from each test iteration: " + str(avgOfMaxes))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700388
cameron@onlab.us19494212015-04-01 16:12:07 -0700389 stdOfMaxes = numpy.std(maxes)
390 main.log.info("Standard Deviation of max values: " + str(stdOfMaxes))
391 print("\n\n")
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700392
cameron@onlab.us19494212015-04-01 16:12:07 -0700393 avgTP = int(main.params[ 'TEST' ][ 'flows' ]) / avgOfMaxes #result in kflows/second
394
395 tp = []
396 for i in maxes:
397 tp.append((int(main.params[ 'TEST' ][ 'flows' ]) / i ))
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700398
cameron@onlab.us19494212015-04-01 16:12:07 -0700399 stdTP = numpy.std(tp)
andrew@onlab.us5cdb2852015-03-11 15:11:10 -0700400
cameron@onlab.us19494212015-04-01 16:12:07 -0700401 main.log.info("Average thoughput: " + str(avgTP) + " Kflows/second" )
402 main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second")
403
cameron@onlab.usc80a8c82015-04-15 14:57:37 -0700404 resultsLog = open("flowTP1gDB","a")
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700405 resultString = ("'" + commit + "',")
406 resultString += ("'1gig',")
407 resultString += ((main.params[ 'TEST' ][ 'flows' ]) + ",")
408 resultString += (str(clusterCount) + ",")
409 resultString += (str(n) + ",")
410 resultString += (str(avgTP) + "," + str(stdTP) + "\n")
411 resultsLog.write(resultString)
cameron@onlab.us19494212015-04-01 16:12:07 -0700412 resultsLog.close()
cameron@onlab.usb5eb9f42015-05-06 13:55:45 -0700413
414 main.log.report("Result line to file: " + resultString)
415
jenkinse450d942015-06-19 13:37:31 -0700416 main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")