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