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 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 221 | for i in range( 2 ): |
| 222 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 223 | if isup: |
| 224 | main.log.info("ONOS " + str(node) + " is up\n") |
| 225 | break |
| 226 | if not isup: |
| 227 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 228 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 229 | lastOutput = "--" |
| 230 | origin = time.time() |
| 231 | clockStarted = False |
| 232 | while True: |
| 233 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 234 | main.ONOSbench.handle.expect(":~") |
| 235 | clusterCheck = ((main.ONOSbench.handle.before).splitlines())[3] |
| 236 | print("\nBefore: " + str(clusterCheck)) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 237 | if ("SCC(s)=1,") in clusterCheck: |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 238 | break |
| 239 | if clusterCheck != lastOutput: |
| 240 | sameOutput = False |
| 241 | elif clusterCheck == lastOutput: |
| 242 | if clockStarted == False: |
| 243 | start = time.time() |
| 244 | clockStarted = True |
| 245 | if time.time() > (start + 60): |
| 246 | main.log.error("TIMEOUT EXCEEDED: Clusters have not converged, continuing anyway...") |
| 247 | break |
| 248 | lastOutput = clusterCheck |
| 249 | time.sleep(5) |
| 250 | |
| 251 | |
| 252 | def CASE3( self, main ): |
| 253 | import time |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 254 | import json |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 255 | import string |
| 256 | import csv |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 257 | import numpy |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 258 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 259 | main.log.info("Cluster Count = " + str(clusterCount)) |
| 260 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 261 | intentsRate = main.params['METRICS']['intents_rate'] |
| 262 | intentsWithdrawn = main.params[ 'METRICS' ][ 'intents_withdrawn' ] |
| 263 | intentsFailed = main.params[ 'METRICS' ][ 'intents_failed' ] |
| 264 | testDuration = main.params[ 'TEST' ][ 'duration' ] |
| 265 | logInterval = main.params[ 'TEST' ][ 'log_interval' ] |
| 266 | debug = main.params[ 'debugMode' ] |
| 267 | |
| 268 | metricList = [intentsRate, intentsWithdrawn, intentsFailed] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 269 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 270 | tempsleep =20 |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 271 | main.log.info("sleeping " + str(tempsleep)) |
| 272 | time.sleep(tempsleep) |
| 273 | |
| 274 | loadFrom = ['0'] |
| 275 | loadFrom.extend((main.params[ 'TEST' ][ 'loadFrom' ]).split(",")) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 276 | |
| 277 | for node in range(1, clusterCount+1): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 278 | if loadFrom[node] == "1": |
| 279 | cmd = "onos $OC" + str(node) + " feature:install onos-app-intent-perf" |
| 280 | main.ONOSbench.handle.sendline(cmd) |
| 281 | main.ONOSbench.handle.expect(":~") |
| 282 | main.log.info("Load initiated on node " + str(node)) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 283 | |
| 284 | time.sleep(5) |
| 285 | actcmd = "onos $OC" + str(node) + " intent-perf-start" |
| 286 | main.ONOSbench.handle.sendline(actcmd) |
| 287 | main.ONOSbench.handle.expect(":~") |
| 288 | main.log.info("Starting ONOS " + str(node) + " intent-perf...") |
| 289 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 290 | main.log.info( "Starting test loop for " + str(testDuration) + " seconds...\n" ) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 291 | stop = time.time() + float( testDuration ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 292 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 293 | while time.time() < stop: |
| 294 | time.sleep( float( logInterval ) ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 295 | groupResult = [] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 296 | for node in range (1, clusterCount + 1): |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 297 | if loadFrom[node] == "0": continue |
| 298 | groupResult.append(0) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 299 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 300 | cmd = " onos-ssh $OC" + str(node) + """ cat /opt/onos/log/karaf.log | grep "SNAPSHOT | Throughput" | tail -1 """ |
| 301 | main.log.info("COMMAND: " + str(cmd)) |
| 302 | |
| 303 | x = 0 |
| 304 | while True: |
| 305 | main.ONOSbench.handle.sendline(cmd) |
| 306 | main.ONOSbench.handle.expect(":~") |
| 307 | raw = main.ONOSbench.handle.before |
| 308 | if "OVERALL=" in raw: |
| 309 | break |
| 310 | x += 1 |
| 311 | if x > 10: |
| 312 | main.log.error("Expected output not being recieved... continuing") |
| 313 | break |
| 314 | time.sleep(2) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 315 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 316 | raw = raw.splitlines() |
| 317 | splitResults = [] |
| 318 | for line in raw: |
| 319 | splitResults.extend(line.split(" ")) |
| 320 | |
| 321 | myResult = "--" |
| 322 | for field in splitResults: |
| 323 | if "OVERALL" in field: |
| 324 | myResult = field |
| 325 | |
| 326 | if myResult == "--": |
| 327 | main.log.error("Parsing/Pexpect error\n" + str(splitResults)) |
| 328 | |
| 329 | myResult = myResult.replace(";", "") |
| 330 | myResult = myResult.replace("OVERALL=","") |
| 331 | myResult = float(myResult) |
| 332 | groupResult[len(groupResult) -1] = myResult |
| 333 | |
| 334 | main.log.info("Node " + str(node) + " overall rate: " + str(myResult)) |
| 335 | |
| 336 | main.log.report("Results from this round of polling: " + str(groupResult)) |
| 337 | main.log.report("Cluster Total: " + str(numpy.sum(groupResult)) + "\n") |
| 338 | |