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