cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -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 SCPFflowTp1g: |
| 12 | |
| 13 | def __init__( self ): |
| 14 | self.default = '' |
| 15 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 16 | def CASE1( self, main ): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 17 | |
| 18 | import time |
| 19 | global init |
| 20 | try: |
| 21 | if type(init) is not bool: |
| 22 | init = False |
| 23 | except NameError: |
| 24 | init = False |
| 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' ] |
| 30 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 31 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 32 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 33 | main.maxNodes = int(main.params[ 'max' ]) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 34 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 35 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 36 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 37 | main.log.info("==========DEBUG VERSION 3===========") |
| 38 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 39 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 40 | if init == False: |
| 41 | init = True |
| 42 | global clusterCount #number of nodes running |
| 43 | global ONOSIp #list of ONOS IP addresses |
| 44 | global scale |
| 45 | global commit |
| 46 | |
| 47 | clusterCount = 0 |
| 48 | ONOSIp = [ 0 ] |
| 49 | scale = (main.params[ 'SCALE' ]).split(",") |
| 50 | clusterCount = int(scale[0]) |
| 51 | |
| 52 | #Populate ONOSIp with ips from params |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 53 | for i in range(1, main.maxNodes + 1): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 54 | ipString = 'ip' + str(i) |
| 55 | ONOSIp.append(main.params[ 'CTRL' ][ ipString ]) |
| 56 | |
| 57 | ONOSIp = [0] |
| 58 | ONOSIp.extend(main.ONOSbench.getOnosIps()) |
| 59 | |
| 60 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 61 | if skipMvn != "yes": |
| 62 | mvnResult = main.ONOSbench.cleanInstall() |
| 63 | |
| 64 | #git |
| 65 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 66 | if gitPull == 'on': |
| 67 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 68 | pullResult = main.ONOSbench.gitPull() |
| 69 | |
| 70 | else: |
| 71 | checkoutResult = main.TRUE |
| 72 | pullResult = main.TRUE |
| 73 | main.log.info( "Skipped git checkout and pull" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 74 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 75 | commit = main.ONOSbench.getVersion() |
| 76 | commit = (commit.split(" "))[1] |
| 77 | |
suibin | e1e5877 | 2015-07-15 09:52:59 -0700 | [diff] [blame] | 78 | resultsDB = open("/tmp/flowTP1gDB", "w+") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 79 | resultsDB.close() |
| 80 | |
| 81 | # -- END OF INIT SECTION --# |
| 82 | |
| 83 | clusterCount = int(scale[0]) |
| 84 | scale.remove(scale[0]) |
| 85 | main.log.info("CLUSTER COUNT: " + str(clusterCount)) |
| 86 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 87 | #kill off all onos processes |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 88 | main.log.step("Safety check, killing all ONOS processes") |
Jon Hall | 70b2ff4 | 2015-11-17 15:49:44 -0800 | [diff] [blame] | 89 | main.log.step("before initiating environment setup") |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 90 | for node in range(1, main.maxNodes + 1): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 91 | main.ONOSbench.onosDie(ONOSIp[node]) |
| 92 | |
| 93 | #Uninstall everywhere |
| 94 | main.log.step( "Cleaning Enviornment..." ) |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 95 | for i in range(1, main.maxNodes + 1): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 96 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 97 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
| 98 | |
| 99 | #construct the cell file |
| 100 | main.log.info("Creating cell file") |
| 101 | cellIp = [] |
| 102 | for node in range (1, clusterCount + 1): |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 103 | cellIp.append(ONOSIp[node]) |
| 104 | |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 105 | main.ONOSbench.createCellFile(BENCHIp,cellName,"localhost",str(Apps), cellIp) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 106 | main.log.info("Cell Ip list: " + str(cellIp)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 107 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 108 | main.step( "Set Cell" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 109 | main.ONOSbench.setCell(cellName) |
| 110 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 111 | main.step( "Creating ONOS package" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 112 | packageResult = main.ONOSbench.onosPackage() |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 113 | |
| 114 | main.step( "verify cells" ) |
| 115 | verifyCellResult = main.ONOSbench.verifyCell() |
| 116 | |
| 117 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
| 118 | for node in range(1, clusterCount + 1): |
| 119 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
| 120 | main.ONOSbench.onosInstall( ONOSIp[node]) |
| 121 | |
| 122 | for node in range(1, clusterCount + 1): |
| 123 | for i in range( 2 ): |
| 124 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 125 | if isup: |
| 126 | main.log.info("ONOS " + str(node) + " is up\n") |
| 127 | break |
| 128 | if not isup: |
| 129 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 130 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 131 | for node in range(1, clusterCount + 1): |
| 132 | exec "a = main.ONOS%scli.startOnosCli" %str(node) |
| 133 | a(ONOSIp[node]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 134 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 135 | main.log.info("Startup sequence complete") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 136 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 137 | def CASE2( self, main ): |
| 138 | # |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 139 | # This is the flow TP test |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 140 | # |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 141 | import os.path |
| 142 | import numpy |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 143 | import math |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 144 | import time |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 145 | import datetime |
| 146 | import traceback |
| 147 | |
| 148 | global currentNeighbors |
| 149 | try: |
| 150 | currentNeighbors |
| 151 | except: |
| 152 | currentNeighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")[0] |
| 153 | else: |
| 154 | if currentNeighbors == "r": #reset |
| 155 | currentNeighbors = "0" |
| 156 | else: |
| 157 | currentNeighbors = "a" |
| 158 | |
| 159 | testCMD = [ 0,0,0,0 ] |
| 160 | warmUp = int(main.params[ 'TEST' ][ 'warmUp' ]) |
| 161 | sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) |
| 162 | switches = int(main.params[ 'TEST' ][ 'switches' ]) |
| 163 | neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",") |
| 164 | testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ] |
| 165 | testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ] |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 166 | main.maxNodes = main.params[ 'max' ] |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 167 | cooldown = main.params[ 'TEST' ][ 'cooldown' ] |
| 168 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 169 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 170 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 171 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 172 | homeDir = os.path.expanduser('~') |
| 173 | flowRuleBackup = str(main.params[ 'TEST' ][ 'enableFlowRuleStoreBackup' ]) |
| 174 | main.log.info("Flow Rule Backup is set to:" + flowRuleBackup) |
| 175 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 176 | servers = str(clusterCount) |
| 177 | |
| 178 | if clusterCount == 1: |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 179 | neighborList = ['0'] |
| 180 | currentNeighbors = "r" |
| 181 | else: |
| 182 | if currentNeighbors == "a": |
| 183 | neighborList = [str(clusterCount-1)] |
| 184 | currentNeighbors = "r" |
| 185 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 186 | neighborList = ['0'] |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 187 | |
| 188 | main.log.info("neightborlist: " + str(neighborList)) |
| 189 | |
| 190 | ts = time.time() |
| 191 | st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') |
| 192 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 193 | for n in neighborList: |
| 194 | main.log.step("\tSTARTING TEST") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 195 | main.log.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) ) |
| 196 | main.log.step("\tNEIGHBORS:\t" + n ) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 197 | main.log.info("=============================================================") |
| 198 | main.log.info("=============================================================") |
| 199 | #write file to configure nil link |
| 200 | ipCSV = "" |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 201 | for i in range (1, int(main.maxNodes) + 1): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 202 | tempstr = "ip" + str(i) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 203 | ipCSV += main.params[ 'CTRL' ][ tempstr ] |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 204 | if i < int(main.maxNodes): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 205 | ipCSV +="," |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 206 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 207 | for i in range(3): |
| 208 | main.ONOSbench.onosCfgSet(ONOSIp[1], "org.onosproject.provider.nil.NullProviders", "deviceCount 35") |
| 209 | main.ONOSbench.onosCfgSet(ONOSIp[1], "org.onosproject.provider.nil.NullProviders", "topoShape linear") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 210 | main.ONOSbench.onosCfgSet(ONOSIp[1], "org.onosproject.provider.nil.NullProviders", "enabled true") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 211 | |
| 212 | time.sleep(5) |
| 213 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 214 | main.ONOSbench.handle.expect(":~") |
| 215 | check = main.ONOSbench.handle.before |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 216 | main.log.info("\nStart up check: \n" + check + "\n") |
| 217 | if "SCC(s)=1," in check: |
suibin zhang | a3746bf | 2015-09-05 09:36:39 -0700 | [diff] [blame] | 218 | main.ONOSbench.handle.sendline( "onos $OC1 balance-masters" ) |
suibin zhang | 45efc1b | 2015-09-04 16:48:10 -0700 | [diff] [blame] | 219 | main.ONOSbench.handle.expect( ":~" ) |
| 220 | time.sleep(5) |
| 221 | main.ONOSbench.handle.sendline( "onos $OC1 roles ") |
| 222 | main.ONOSbench.handle.expect ( ":~" ) |
| 223 | main.log.info( "switch masterships:" + str( main.ONOSbench.handle.before ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 224 | break |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 225 | time.sleep(5) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 226 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 227 | #devide flows |
| 228 | flows = int(main.params[ 'TEST' ][ 'flows' ]) |
| 229 | main.log.info("Flow Target = " + str(flows)) |
| 230 | |
| 231 | flows = (flows *max(int(n)+1,int(servers)))/((int(n) + 1)*int(servers)*(switches)) |
| 232 | |
| 233 | main.log.info("Flows per switch = " + str(flows)) |
| 234 | |
| 235 | #build list of servers in "$OC1, $OC2...." format |
| 236 | serverEnvVars = "" |
| 237 | for i in range (1,int(servers)+1): |
| 238 | serverEnvVars += ("-s " + ONOSIp[i] + " ") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 239 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 240 | data = [[""]*int(servers)]*int(sampleSize) |
| 241 | maxes = [""]*int(sampleSize) |
| 242 | |
| 243 | flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/" |
| 244 | flowCMD += testCMD[0] + " " + str(flows) + " " + testCMD[1] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 245 | flowCMD += " " + str(n) + " " + str(serverEnvVars) + "-j" |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 246 | |
| 247 | main.log.info(flowCMD) |
| 248 | #time.sleep(60) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 249 | |
| 250 | for test in range(0, warmUp + sampleSize): |
| 251 | if test < warmUp: |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 252 | main.log.info("Warm up " + str(test + 1) + " of " + str(warmUp)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 253 | else: |
| 254 | main.log.info("====== Test run: " + str(test-warmUp+1) + " ======") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 255 | |
| 256 | main.ONOSbench.handle.sendline(flowCMD) |
| 257 | main.ONOSbench.handle.expect(":~") |
| 258 | rawResult = main.ONOSbench.handle.before |
| 259 | main.log.info("Raw results: \n" + rawResult + "\n") |
| 260 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 261 | if "failed" in rawResult: |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 262 | main.log.report("FLOW_TESTER.PY FAILURE") |
| 263 | main.log.report( " \n" + rawResult + " \n") |
YPZhang | 325822f | 2016-06-17 16:01:45 -0700 | [diff] [blame] | 264 | for i in range(1, clusterCount+1): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 265 | main.log.report("=======================================================") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 266 | main.log.report(" ONOS " + str(i) + "LOG REPORT") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 267 | main.ONOSbench.logReport(ONOSIp[i], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 268 | main.ONOSbench.handle.sendline("onos $OC1 flows") |
| 269 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 270 | main.log.info(main.ONOSbench.handle.before) |
| 271 | |
| 272 | break |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 273 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 274 | ######################################################################################## |
| 275 | result = [""]*(clusterCount) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 276 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 277 | #print("rawResult: " + rawResult) |
| 278 | |
| 279 | rawResult = rawResult.splitlines() |
| 280 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 281 | for node in range(1, clusterCount + 1): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 282 | for line in rawResult: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 283 | #print("line: " + line) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 284 | if ONOSIp[node] in line and "server" in line: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 285 | temp = line.split(" ") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 286 | for word in temp: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 287 | #print ("word: " + word) |
| 288 | if "elapsed" in repr(word): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 289 | index = temp.index(word) + 1 |
| 290 | myParsed = (temp[index]).replace(",","") |
| 291 | myParsed = myParsed.replace("}","") |
| 292 | myParsed = int(myParsed) |
| 293 | result[node-1] = myParsed |
| 294 | main.log.info( ONOSIp[node] + " : " + str(myParsed)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 295 | break |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 296 | |
| 297 | if test >= warmUp: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 298 | for i in result: |
| 299 | if i == "": |
cameron@onlab.us | b3aa498 | 2015-07-13 15:20:41 -0700 | [diff] [blame] | 300 | main.log.error("Missing data point, critical failure incoming") |
| 301 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 302 | print result |
| 303 | maxes[test-warmUp] = max(result) |
| 304 | main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 305 | main.log.info("Throughput time: " + str(maxes[test-warmUp]) + "(ms)") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 306 | |
| 307 | data[test-warmUp] = result |
| 308 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 309 | # wait for flows = 0 |
| 310 | for checkCount in range(0,5): |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 311 | time.sleep(10) |
| 312 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 313 | main.ONOSbench.handle.expect(":~") |
| 314 | flowCheck = main.ONOSbench.handle.before |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 315 | if "flows=0," in flowCheck: |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 316 | main.log.info("Flows removed") |
| 317 | break |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 318 | else: |
| 319 | for line in flowCheck.splitlines(): |
| 320 | if "flows=" in line: |
| 321 | main.log.info("Current Summary: " + line) |
| 322 | if checkCount == 2: |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 323 | main.log.info("Flows are stuck, moving on ") |
| 324 | |
| 325 | |
| 326 | time.sleep(5) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 327 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 328 | main.log.info("raw data: " + str(data)) |
| 329 | main.log.info("maxes:" + str(maxes)) |
| 330 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 331 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 332 | # report data |
| 333 | print("") |
| 334 | main.log.info("\t Results (measurments are in milliseconds)") |
| 335 | print("") |
| 336 | |
| 337 | nodeString = "" |
| 338 | for i in range(1, int(servers) + 1): |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 339 | nodeString += ("\tNode " + str(i)) |
| 340 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 341 | for test in range(0, sampleSize ): |
| 342 | main.log.info("\t Test iteration " + str(test + 1) ) |
| 343 | main.log.info("\t------------------") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 344 | main.log.info(nodeString) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 345 | resultString = "" |
| 346 | |
| 347 | for i in range(0, int(servers) ): |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 348 | resultString += ("\t" + str(data[test][i]) ) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 349 | main.log.info(resultString) |
| 350 | |
| 351 | print("\n") |
| 352 | |
| 353 | avgOfMaxes = numpy.mean(maxes) |
| 354 | main.log.info("Average of max value from each test iteration: " + str(avgOfMaxes)) |
| 355 | |
| 356 | stdOfMaxes = numpy.std(maxes) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 357 | main.log.info("Standard Deviation of max values: " + str(stdOfMaxes)) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 358 | print("\n\n") |
| 359 | |
| 360 | avgTP = int(main.params[ 'TEST' ][ 'flows' ]) / avgOfMaxes #result in kflows/second |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 361 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 362 | tp = [] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 363 | for i in maxes: |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 364 | tp.append((int(main.params[ 'TEST' ][ 'flows' ]) / i )) |
| 365 | |
| 366 | stdTP = numpy.std(tp) |
| 367 | |
| 368 | main.log.info("Average thoughput: " + str(avgTP) + " Kflows/second" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 369 | main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 370 | |
suibin | 584c070 | 2015-07-14 15:57:27 -0700 | [diff] [blame] | 371 | resultsLog = open("/tmp/flowTP1gDB","a") |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 372 | resultString = ("'" + commit + "',") |
| 373 | resultString += ("'1gig',") |
| 374 | resultString += ((main.params[ 'TEST' ][ 'flows' ]) + ",") |
| 375 | resultString += (str(clusterCount) + ",") |
| 376 | resultString += (str(n) + ",") |
| 377 | resultString += (str(avgTP) + "," + str(stdTP) + "\n") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 378 | resultsLog.write(resultString) |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 379 | resultsLog.close() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 380 | |
cameron@onlab.us | 946d99c | 2015-07-08 15:34:37 -0700 | [diff] [blame] | 381 | main.log.report("Result line to file: " + resultString) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 382 | |
| 383 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") |