andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 1 | # ScaleOutTemplate --> IntentEventTP |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 2 | # |
| 3 | # CASE1 starts number of nodes specified in param file |
| 4 | # |
| 5 | # cameron@onlab.us |
| 6 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 7 | import sys |
| 8 | import os |
| 9 | import time |
| 10 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 11 | |
| 12 | class IntentEventTP: |
| 13 | |
| 14 | def __init__( self ): |
| 15 | self.default = '' |
| 16 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 17 | def CASE1( self, main ): #This is the initialization case |
| 18 | import os.path #this case will clean up all nodes |
| 19 | import time #but only node 1 is started in this case |
| 20 | |
| 21 | global clusterCount #number of nodes running |
| 22 | global ONOSIp #list of ONOS IP addresses |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 23 | clusterCount = 1 |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 24 | ONOSIp = [ 0 ] |
| 25 | |
| 26 | #Load values from params file |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 27 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 28 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 29 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 30 | Features= main.params[ 'ENV' ][ 'cellFeatures' ] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 31 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 32 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 33 | maxNodes = int(main.params[ 'availableNodes' ]) |
| 34 | MNip = main.params[ 'MN' ][ 'ip1' ] |
| 35 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 36 | numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",") |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 37 | |
| 38 | homeDir = os.path.expanduser('~') |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 39 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 40 | main.ONOSbench.handle.sendline("export TERM=vt100") |
| 41 | dump = main.ONOSbench.handle.expect(":~") |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 42 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 43 | #Populate ONOSIp with ips from params |
| 44 | for i in range(1, maxNodes + 1): |
| 45 | ipString = 'ip' + str(i) |
| 46 | ONOSIp.append(main.params[ 'CTRL' ][ ipString ]) |
| 47 | |
| 48 | #kill off all onos processes |
| 49 | main.log.step("Safety check, killing all ONOS processes") |
| 50 | main.log.step("before initiating enviornment setup") |
| 51 | for node in range(1, maxNodes + 1): |
| 52 | main.log.info("killing node " + str(node)) |
| 53 | main.ONOSbench.onosDie(ONOSIp[node]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 54 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 55 | #construct the cell file |
| 56 | main.log.info("Creating cell file") |
| 57 | exec "a = main.ONOSbench.createCellFile" |
| 58 | cellIp = [] |
| 59 | for node in range (1, clusterCount + 1): |
| 60 | cellIp.append(ONOSIp[node]) |
| 61 | a(BENCHIp,cellName,MNip,str(Features), *cellIp) |
| 62 | |
| 63 | main.step( "Set Cell" ) |
| 64 | main.ONOSbench.setCell(cellName) |
| 65 | |
| 66 | #Uninstall everywhere |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 67 | main.log.step( "Cleaning Enviornment..." ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 68 | for i in range(1, maxNodes + 1): |
| 69 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 70 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 71 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 72 | #git |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 73 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 74 | if gitPull == 'on': |
| 75 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 76 | pullResult = main.ONOSbench.gitPull() |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 77 | else: |
| 78 | checkoutResult = main.TRUE |
| 79 | pullResult = main.TRUE |
| 80 | main.log.info( "Skipped git checkout and pull" ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 81 | |
| 82 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 83 | if skipMvn != "yes": |
| 84 | mvnResult = main.ONOSbench.cleanInstall() |
| 85 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 86 | #null link |
| 87 | #null provider |
| 88 | #linkgraph |
| 89 | #intentPerf |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 90 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 91 | myDistribution = [] |
| 92 | for node in range (1, clusterCount + 1): |
| 93 | myDistribution.append(numSwitches[node-1]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 94 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 95 | main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution) |
| 96 | main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution) |
| 97 | main.ONOSbench.createNullLinkProviderFile(BENCHIp) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 98 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 99 | main.log.step("Writing IntentPerf config file") |
| 100 | intentPerfConfig = open( homeDir + "/onos/tools/package/etc/org.onosproject.intentperf.IntentPerfInstaller.cfg", "w+") |
| 101 | intentPerfConfig.write("numKeys = 40000\n") |
| 102 | intentPerfConfig.write("cyclePeriod = 1000\n") |
| 103 | intentPerfConfig.write("numNeighors = 0\n") |
| 104 | intentPerfConfig.close() |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 105 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 106 | main.step( "Creating ONOS package" ) |
| 107 | packageResult = main.ONOSbench.onosPackage() |
| 108 | |
| 109 | main.step( "Installing ONOS package" ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 110 | install1Result = main.ONOSbench.onosInstall( node=ONOSIp[1] ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 111 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 112 | main.step( "verify cells" ) |
| 113 | verifyCellResult = main.ONOSbench.verifyCell() |
| 114 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 115 | main.step( "Checking if ONOS is up yet" ) |
| 116 | for i in range( 2 ): |
| 117 | isup = main.ONOSbench.isup( ONOSIp[1] ) |
| 118 | if isup: |
| 119 | break |
| 120 | if not isup: |
| 121 | main.log.report( "ONOS1 didn't start!" ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 122 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 123 | lastOutput = "--" |
| 124 | origin = time.time() |
| 125 | clockStarted = False |
| 126 | while True: |
| 127 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 128 | main.ONOSbench.handle.expect(":~") |
| 129 | clusterCheck = ((main.ONOSbench.handle.before).splitlines())[3] |
| 130 | print("\nBefore: " + str(clusterCheck)) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 131 | if "SCC(s)=1," in clusterCheck: |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 132 | break |
| 133 | if clusterCheck != lastOutput: |
| 134 | sameOutput = False |
| 135 | elif clusterCheck == lastOutput: |
| 136 | if clockStarted == False: |
| 137 | start = time.time() |
| 138 | clockStarted = True |
| 139 | if time.time() > (start + 30): |
| 140 | main.log.error("TIMEOUT EXCEEDED: Clusters have not converged, continuing anyway...") |
| 141 | break |
| 142 | lastOutput = clusterCheck |
| 143 | time.sleep(5) |
| 144 | |
| 145 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 146 | |
| 147 | def CASE2( self, main ): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 148 | # This case increases the cluster size by whatever scale is |
| 149 | # Note: 'scale' is the size of the step |
| 150 | # if scaling is not a part of your test, simply run this case |
| 151 | # once after CASE1 to set up your enviornment for your desired |
| 152 | # cluster size. If scaling is a part of you test call this case each time |
| 153 | # you want to increase cluster size |
| 154 | |
| 155 | '' |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 156 | 'Increase number of nodes and initiate CLI' |
| 157 | '' |
| 158 | import time |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 159 | import os.path |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 160 | global clusterCount |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 161 | |
| 162 | Features= main.params[ 'ENV' ][ 'cellFeatures' ] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 163 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 164 | MNip = main.params[ 'MN' ][ 'ip1' ] |
| 165 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 166 | numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",") |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 167 | scale = int( main.params[ 'SCALE' ] ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 168 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 169 | clusterCount += scale |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 170 | homeDir = os.path.expanduser('~') |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 171 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 172 | #kill off all onos processes |
| 173 | main.log.step("Safety check, killing all ONOS processes") |
| 174 | main.log.step("before initiating enviornment setup") |
| 175 | for node in range(1, maxNodes + 1): |
| 176 | main.ONOSbench.onosDie(ONOSIp[node]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 177 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 178 | #Uninstall everywhere |
| 179 | main.log.step( "Cleaning Enviornment..." ) |
| 180 | for i in range(1, maxNodes + 1): |
| 181 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 182 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
| 183 | |
| 184 | #construct the cell file |
| 185 | main.log.info("Creating cell file") |
| 186 | exec "a = main.ONOSbench.createCellFile" |
| 187 | cellIp = [] |
| 188 | for node in range (1, clusterCount + 1): |
| 189 | cellIp.append(ONOSIp[node]) |
| 190 | a(BENCHIp,cellName,MNip,str(Features), *cellIp) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 191 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 192 | main.step( "Set Cell" ) |
| 193 | main.ONOSbench.setCell(cellName) |
| 194 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 195 | myDistribution = [] |
| 196 | for node in range (1, clusterCount + 1): |
| 197 | myDistribution.append(numSwitches[node-1]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 198 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 199 | main.ONOSbench.createLinkGraphFile( BENCHIp, cellIp, myDistribution) |
| 200 | main.ONOSbench.createNullDevProviderFile( BENCHIp, cellIp, myDistribution) |
| 201 | main.ONOSbench.createNullLinkProviderFile( BENCHIp ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 202 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 203 | #neighbors = max(1, clusterCount-1) |
| 204 | neighbors = 0 |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 205 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 206 | main.log.step("Writing IntentPerf config file") |
| 207 | intentPerfConfig = open( homeDir + "/onos/tools/package/etc/org.onosproject.intentperf.IntentPerfInstaller.cfg", "w+") |
| 208 | intentPerfConfig.write("numKeys = 40000\n") |
| 209 | intentPerfConfig.write("cyclePeriod = 1000\n") |
| 210 | intentPerfConfig.write("numNeighors = " + str(neighbors) + "\n") |
| 211 | intentPerfConfig.close() |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 212 | |
| 213 | main.step( "Creating ONOS package, preparing to reinstall" ) |
| 214 | packageResult = main.ONOSbench.onosPackage() |
| 215 | |
| 216 | main.log.report( "Reinstalling on all nodes and increasing cluster size to " + str( clusterCount ) ) |
| 217 | for node in range(1, clusterCount + 1): |
| 218 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
| 219 | main.ONOSbench.onosInstall( ONOSIp[node]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 220 | |
cameron@onlab.us | 1201bc4 | 2015-04-01 16:30:05 -0700 | [diff] [blame] | 221 | for node in range(1, clusterCount + 1): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 222 | for i in range( 2 ): |
| 223 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 224 | if isup: |
| 225 | main.log.info("ONOS " + str(node) + " is up\n") |
| 226 | break |
| 227 | if not isup: |
| 228 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 229 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 230 | lastOutput = "--" |
| 231 | origin = time.time() |
| 232 | clockStarted = False |
| 233 | while True: |
| 234 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 235 | main.ONOSbench.handle.expect(":~") |
| 236 | clusterCheck = ((main.ONOSbench.handle.before).splitlines())[3] |
| 237 | print("\nBefore: " + str(clusterCheck)) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 238 | if ("SCC(s)=1,") in clusterCheck: |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 239 | break |
| 240 | if clusterCheck != lastOutput: |
| 241 | sameOutput = False |
| 242 | elif clusterCheck == lastOutput: |
| 243 | if clockStarted == False: |
| 244 | start = time.time() |
| 245 | clockStarted = True |
| 246 | if time.time() > (start + 60): |
| 247 | main.log.error("TIMEOUT EXCEEDED: Clusters have not converged, continuing anyway...") |
| 248 | break |
| 249 | lastOutput = clusterCheck |
| 250 | time.sleep(5) |
| 251 | |
| 252 | |
| 253 | def CASE3( self, main ): |
| 254 | import time |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 255 | import json |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 256 | import string |
| 257 | import csv |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 258 | import numpy |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 259 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 260 | main.log.info("Cluster Count = " + str(clusterCount)) |
| 261 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 262 | intentsRate = main.params['METRICS']['intents_rate'] |
| 263 | intentsWithdrawn = main.params[ 'METRICS' ][ 'intents_withdrawn' ] |
| 264 | intentsFailed = main.params[ 'METRICS' ][ 'intents_failed' ] |
| 265 | testDuration = main.params[ 'TEST' ][ 'duration' ] |
| 266 | logInterval = main.params[ 'TEST' ][ 'log_interval' ] |
| 267 | debug = main.params[ 'debugMode' ] |
| 268 | |
| 269 | metricList = [intentsRate, intentsWithdrawn, intentsFailed] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 270 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 271 | tempsleep =20 |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 272 | main.log.info("sleeping " + str(tempsleep)) |
| 273 | time.sleep(tempsleep) |
| 274 | |
| 275 | loadFrom = ['0'] |
| 276 | loadFrom.extend((main.params[ 'TEST' ][ 'loadFrom' ]).split(",")) |
cameron@onlab.us | 1201bc4 | 2015-04-01 16:30:05 -0700 | [diff] [blame] | 277 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 278 | for node in range(1, clusterCount+1): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 279 | if loadFrom[node] == "1": |
| 280 | cmd = "onos $OC" + str(node) + " feature:install onos-app-intent-perf" |
| 281 | main.ONOSbench.handle.sendline(cmd) |
| 282 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | 1201bc4 | 2015-04-01 16:30:05 -0700 | [diff] [blame] | 283 | main.log.info( "intent-perf feature installed on: ONOS" + str(node) ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 284 | |
cameron@onlab.us | 1201bc4 | 2015-04-01 16:30:05 -0700 | [diff] [blame] | 285 | time.sleep(5) |
| 286 | actcmd = "onos $OC1" + " intent-perf-start" |
| 287 | main.ONOSbench.handle.sendline(actcmd) |
| 288 | main.ONOSbench.handle.expect(":~") |
| 289 | main.log.info("Starting ONOS (all nodes) intent-perf from $OC1" ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 290 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 291 | main.log.info( "Starting test loop for " + str(testDuration) + " seconds...\n" ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 292 | stop = time.time() + float( testDuration ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 293 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 294 | while time.time() < stop: |
| 295 | time.sleep( float( logInterval ) ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 296 | groupResult = [] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 297 | for node in range (1, clusterCount + 1): |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 298 | if loadFrom[node] == "0": continue |
| 299 | groupResult.append(0) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 300 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 301 | cmd = " onos-ssh $OC" + str(node) + """ cat /opt/onos/log/karaf.log | grep "SNAPSHOT | Throughput" | tail -1 """ |
| 302 | main.log.info("COMMAND: " + str(cmd)) |
| 303 | |
| 304 | x = 0 |
| 305 | while True: |
| 306 | main.ONOSbench.handle.sendline(cmd) |
| 307 | main.ONOSbench.handle.expect(":~") |
| 308 | raw = main.ONOSbench.handle.before |
| 309 | if "OVERALL=" in raw: |
| 310 | break |
| 311 | x += 1 |
| 312 | if x > 10: |
| 313 | main.log.error("Expected output not being recieved... continuing") |
| 314 | break |
| 315 | time.sleep(2) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 316 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 317 | raw = raw.splitlines() |
| 318 | splitResults = [] |
| 319 | for line in raw: |
| 320 | splitResults.extend(line.split(" ")) |
| 321 | |
| 322 | myResult = "--" |
| 323 | for field in splitResults: |
| 324 | if "OVERALL" in field: |
| 325 | myResult = field |
| 326 | |
| 327 | if myResult == "--": |
| 328 | main.log.error("Parsing/Pexpect error\n" + str(splitResults)) |
| 329 | |
| 330 | myResult = myResult.replace(";", "") |
| 331 | myResult = myResult.replace("OVERALL=","") |
| 332 | myResult = float(myResult) |
| 333 | groupResult[len(groupResult) -1] = myResult |
| 334 | |
| 335 | main.log.info("Node " + str(node) + " overall rate: " + str(myResult)) |
| 336 | |
| 337 | main.log.report("Results from this round of polling: " + str(groupResult)) |
| 338 | main.log.report("Cluster Total: " + str(numpy.sum(groupResult)) + "\n") |
| 339 | |