cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 1 | # ScaleOutTemplate |
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 |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 8 | import os.path |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 9 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 10 | |
| 11 | class IntentEventTP: |
| 12 | |
| 13 | def __init__( self ): |
| 14 | self.default = '' |
| 15 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 16 | def CASE1( self, main ): |
| 17 | |
| 18 | import time |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 19 | import os.path |
| 20 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 21 | global init |
| 22 | try: |
| 23 | if type(init) is not bool: |
| 24 | init = False |
| 25 | except NameError: |
| 26 | init = False |
| 27 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 28 | #Load values from params file |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 29 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 30 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 31 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 32 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 33 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 34 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 35 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 36 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 37 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 38 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 39 | numSwitches = (main.params[ 'TEST' ][ 'numSwitches' ]).split(",") |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 40 | flowRuleBU = main.params[ 'TEST' ][ 'flowRuleBUEnabled' ] |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 41 | onBaremetal = main.params['isOnBaremetal'] |
| 42 | homeDir = os.path.expanduser('~') |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 43 | |
cameron@onlab.us | 412e956 | 2015-05-13 16:04:34 -0700 | [diff] [blame] | 44 | main.exceptions = [0]*11 |
| 45 | main.warnings = [0]*11 |
| 46 | main.errors = [0]*11 |
| 47 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 48 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 49 | if init == False: |
| 50 | init = True |
| 51 | global clusterCount #number of nodes running |
| 52 | global ONOSIp #list of ONOS IP addresses |
| 53 | global scale |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 54 | global commit |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 55 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 56 | clusterCount = 0 |
| 57 | ONOSIp = [ 0 ] |
| 58 | scale = (main.params[ 'SCALE' ]).split(",") |
| 59 | clusterCount = int(scale[0]) |
| 60 | |
| 61 | #Populate ONOSIp with ips from params |
| 62 | for i in range(1, maxNodes + 1): |
| 63 | ipString = 'ip' + str(i) |
| 64 | ONOSIp.append(main.params[ 'CTRL' ][ ipString ]) |
| 65 | |
| 66 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 67 | if skipMvn != "yes": |
| 68 | mvnResult = main.ONOSbench.cleanInstall() |
| 69 | |
| 70 | #git |
| 71 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 72 | if gitPull == 'on': |
| 73 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 74 | pullResult = main.ONOSbench.gitPull() |
| 75 | |
| 76 | else: |
| 77 | checkoutResult = main.TRUE |
| 78 | pullResult = main.TRUE |
| 79 | main.log.info( "Skipped git checkout and pull" ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 80 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 81 | commit = main.ONOSbench.getVersion() |
| 82 | commit = (commit.split(" "))[1] |
| 83 | |
| 84 | resultsDB = open("IntentEventTPDB", "w+") |
| 85 | resultsDB.close() |
| 86 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 87 | # -- END OF INIT SECTION --# |
| 88 | |
| 89 | clusterCount = int(scale[0]) |
| 90 | scale.remove(scale[0]) |
| 91 | |
| 92 | #kill off all onos processes |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 93 | main.log.step("Safety check, killing all ONOS processes") |
| 94 | main.log.step("before initiating enviornment setup") |
| 95 | for node in range(1, maxNodes + 1): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 96 | main.ONOSbench.onosDie(ONOSIp[node]) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 97 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 98 | #Uninstall everywhere |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 99 | main.log.step( "Cleaning Enviornment..." ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 100 | for i in range(1, maxNodes + 1): |
| 101 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 102 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 103 | |
| 104 | #construct the cell file |
| 105 | main.log.info("Creating cell file") |
| 106 | cellIp = [] |
| 107 | for node in range (1, clusterCount + 1): |
| 108 | cellIp.append(ONOSIp[node]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 109 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 110 | main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp) |
| 111 | |
| 112 | main.step( "Set Cell" ) |
| 113 | main.ONOSbench.setCell(cellName) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 114 | |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 115 | myDistribution = [] |
| 116 | for node in range (1, clusterCount + 1): |
| 117 | myDistribution.append(numSwitches[node-1]) |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 118 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 119 | #main.ONOSbench.createLinkGraphFile( BENCHIp,cellIp,myDistribution) |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 120 | |
| 121 | if onBaremetal == "True": |
| 122 | filename = "/onos/tools/package/bin/onos-service" |
| 123 | serviceConfig = open(homeDir + filename, 'w+') |
| 124 | serviceConfig.write("#!/bin/bash\n ") |
| 125 | serviceConfig.write("#------------------------------------- \n ") |
| 126 | serviceConfig.write("# Starts ONOS Apache Karaf container\n ") |
| 127 | serviceConfig.write("#------------------------------------- \n ") |
| 128 | serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ") |
| 129 | serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """) |
| 130 | serviceConfig.write("") |
| 131 | serviceConfig.write("ONOS_HOME=/opt/onos \n ") |
| 132 | serviceConfig.write("") |
| 133 | serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n") |
| 134 | serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """) |
| 135 | serviceConfig.close() |
| 136 | main.log.info("Set /onos/tools/package/bin/onos-service with 8G Xms/Xmx Options.") |
| 137 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 138 | main.step( "Creating ONOS package" ) |
| 139 | packageResult = main.ONOSbench.onosPackage() |
| 140 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 141 | main.step( "verify cells" ) |
| 142 | verifyCellResult = main.ONOSbench.verifyCell() |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 143 | |
| 144 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 145 | for node in range(1, clusterCount + 1): |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 146 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 147 | main.ONOSbench.onosInstall( ONOSIp[node]) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 148 | |
cameron@onlab.us | 1201bc4 | 2015-04-01 16:30:05 -0700 | [diff] [blame] | 149 | for node in range(1, clusterCount + 1): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 150 | for i in range( 2 ): |
| 151 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 152 | if isup: |
| 153 | main.log.info("ONOS " + str(node) + " is up\n") |
| 154 | break |
| 155 | if not isup: |
| 156 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 157 | main.log.info("Startup sequence complete") |
| 158 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 159 | time.sleep(20) |
| 160 | |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 161 | |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 162 | while True: |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 163 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount """ + str(clusterCount*10) + """ " """) |
| 164 | main.ONOSbench.handle.expect(":~") |
| 165 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg get org.onosproject.provider.nil.NullProviders" """) |
| 166 | main.ONOSbench.handle.expect(":~") |
| 167 | if ("value=" + str(clusterCount*10)) in main.ONOSbench.handle.before: |
| 168 | main.log.info("Device count set") |
| 169 | main.log.info("before" + main.ONOSbench.handle.before) |
| 170 | break |
| 171 | time.sleep(10) |
| 172 | main.log.info("cfg set failure, retrying") |
| 173 | main.log.info("before" + main.ONOSbench.handle.before) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 174 | |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 175 | while True: |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 176 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """) |
| 177 | main.ONOSbench.handle.expect(":~") |
| 178 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg get org.onosproject.provider.nil.NullProviders" """) |
| 179 | main.ONOSbench.handle.expect(":~") |
| 180 | if ("value=linear") in main.ONOSbench.handle.before: |
| 181 | main.log.info("Device count set") |
| 182 | main.log.info("before" + main.ONOSbench.handle.before) |
| 183 | break |
| 184 | time.sleep(10) |
| 185 | main.log.info("cfg set failure, retrying") |
| 186 | main.log.info("before" + main.ONOSbench.handle.before) |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 187 | |
| 188 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBU + """" """) |
| 189 | main.ONOSbench.handle.expect(":~") |
| 190 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg get" """) |
| 191 | main.ONOSbench.handle.expect(":~") |
| 192 | main.log.info(main.ONOSbench.handle.before) |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 193 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 194 | time.sleep(10) |
| 195 | main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """) |
| 196 | main.ONOSbench.handle.expect(":~") |
| 197 | print main.ONOSbench.handle.before |
| 198 | time.sleep(10) |
| 199 | main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """) |
| 200 | main.ONOSbench.handle.expect(":~") |
| 201 | print main.ONOSbench.handle.before |
| 202 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 203 | lastOutput = "--" |
| 204 | origin = time.time() |
| 205 | clockStarted = False |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 206 | while True: |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 207 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 208 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | f33b45c | 2015-05-06 13:54:46 -0700 | [diff] [blame] | 209 | main.log.info("before" + main.ONOSbench.handle.before) |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 210 | clusterCheck = ((main.ONOSbench.handle.before).splitlines())[3] |
| 211 | print("\nBefore: " + str(clusterCheck)) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 212 | if ("SCC(s)=1,") in clusterCheck: |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 213 | break |
| 214 | if clusterCheck != lastOutput: |
| 215 | sameOutput = False |
| 216 | elif clusterCheck == lastOutput: |
| 217 | if clockStarted == False: |
| 218 | start = time.time() |
| 219 | clockStarted = True |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 220 | if time.time() > (start + 10): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 221 | main.log.error("TIMEOUT EXCEEDED: Clusters have not converged, continuing anyway...") |
| 222 | break |
| 223 | lastOutput = clusterCheck |
| 224 | time.sleep(5) |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 225 | main.ONOSbench.onosErrorLog(ONOSIp[1]) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 226 | |
| 227 | def CASE2( self, main ): |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 228 | import time |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 229 | import json |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 230 | import string |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 231 | import csv |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 232 | import numpy |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 233 | import os.path |
| 234 | |
| 235 | global currentNeighbors |
| 236 | neighbors = [] |
| 237 | |
| 238 | try: |
| 239 | currentNeighbors |
| 240 | except: |
| 241 | currentNeighbors = "0" |
| 242 | neighbors = ['0'] |
| 243 | else: |
| 244 | if currentNeighbors == "r": #reset |
| 245 | currentNeighbors = "a" |
| 246 | neighbors = ['0'] |
| 247 | else: |
| 248 | currentNeighbors = "r" |
| 249 | neighbors = ['a'] |
| 250 | |
| 251 | if clusterCount == 1: |
| 252 | currentNeighbors = "r" |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 253 | |
andrew@onlab.us | 2ae3a11 | 2015-02-02 11:24:32 -0800 | [diff] [blame] | 254 | main.log.info("Cluster Count = " + str(clusterCount)) |
| 255 | |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 256 | intentsRate = main.params['METRICS']['intents_rate'] |
| 257 | intentsWithdrawn = main.params[ 'METRICS' ][ 'intents_withdrawn' ] |
| 258 | intentsFailed = main.params[ 'METRICS' ][ 'intents_failed' ] |
| 259 | testDuration = main.params[ 'TEST' ][ 'duration' ] |
| 260 | logInterval = main.params[ 'TEST' ][ 'log_interval' ] |
| 261 | debug = main.params[ 'debugMode' ] |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 262 | numKeys = main.params[ 'TEST' ][ 'numKeys' ] |
| 263 | cyclePeriod = main.params[ 'TEST' ][ 'cyclePeriod' ] |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 264 | #neighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",") |
andrew@onlab.us | 1033220 | 2015-03-11 15:04:43 -0700 | [diff] [blame] | 265 | metricList = [intentsRate, intentsWithdrawn, intentsFailed] |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 266 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 267 | for n in range(0, len(neighbors)): |
| 268 | if neighbors[n] == 'a': |
| 269 | neighbors[n] = str(clusterCount -1) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 270 | if int(clusterCount) == 1: |
| 271 | neighbors = neighbors.pop() |
| 272 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 273 | for n in neighbors: |
| 274 | main.log.info("Run with " + n + " neighbors") |
| 275 | time.sleep(5) |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 276 | main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller numKeys " + numKeys ) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 277 | main.ONOSbench.handle.expect(":~") |
| 278 | main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller numNeighbors " + n ) |
| 279 | main.ONOSbench.handle.expect(":~") |
| 280 | main.ONOSbench.handle.sendline("onos $OC1 cfg set org.onosproject.intentperf.IntentPerfInstaller cyclePeriod " + cyclePeriod ) |
| 281 | main.ONOSbench.handle.expect(":~") |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 282 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 283 | cmd = "onos $OC1 intent-perf-start" |
| 284 | main.ONOSbench.handle.sendline(cmd) |
| 285 | main.ONOSbench.handle.expect(":~") |
| 286 | main.log.info("Starting ONOS (all nodes) intent-perf from $OC1" ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 287 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 288 | main.log.info( "Starting test loop for " + str(testDuration) + " seconds...\n" ) |
| 289 | stop = time.time() + float( testDuration ) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 290 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 291 | while time.time() < stop: |
| 292 | time.sleep( float( logInterval ) ) |
| 293 | groupResult = [] |
| 294 | for node in range (1, clusterCount + 1): |
| 295 | groupResult.append(0) |
jenkins | 3af0cd8 | 2015-03-24 10:27:16 -0700 | [diff] [blame] | 296 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 297 | cmd = " onos-ssh $OC" + str(node) + """ cat /opt/onos/log/karaf.log | grep "SNAPSHOT | Throughput" | tail -1 """ |
| 298 | main.log.info("COMMAND: " + str(cmd)) |
| 299 | |
| 300 | x = 0 |
| 301 | while True: |
| 302 | main.ONOSbench.handle.sendline(cmd) |
| 303 | main.ONOSbench.handle.expect(":~") |
| 304 | raw = main.ONOSbench.handle.before |
| 305 | if "OVERALL=" in raw: |
| 306 | break |
| 307 | x += 1 |
| 308 | if x > 10: |
| 309 | main.log.error("Expected output not being recieved... continuing") |
| 310 | break |
| 311 | time.sleep(2) |
| 312 | |
| 313 | raw = raw.splitlines() |
| 314 | splitResults = [] |
| 315 | for line in raw: |
| 316 | splitResults.extend(line.split(" ")) |
| 317 | |
| 318 | myResult = "--" |
| 319 | for field in splitResults: |
| 320 | if "OVERALL" in field: |
| 321 | myResult = field |
| 322 | |
| 323 | if myResult == "--": |
| 324 | main.log.error("Parsing/Pexpect error\n" + str(splitResults)) |
| 325 | |
| 326 | myResult = myResult.replace(";", "") |
| 327 | myResult = myResult.replace("OVERALL=","") |
| 328 | myResult = float(myResult) |
| 329 | groupResult[len(groupResult) -1] = myResult |
| 330 | |
| 331 | main.log.info("Node " + str(node) + " overall rate: " + str(myResult)) |
| 332 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 333 | clusterTotal = str(numpy.sum(groupResult)) |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 334 | main.log.report("Results from this round of polling: " + str(groupResult)) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 335 | main.log.report("Cluster Total: " + clusterTotal + "\n") |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 336 | |
cameron@onlab.us | 059c256 | 2015-04-02 14:12:51 -0700 | [diff] [blame] | 337 | cmd = "onos $OC1 intent-perf-stop" |
| 338 | main.ONOSbench.handle.sendline(cmd) |
| 339 | main.ONOSbench.handle.expect(":~") |
| 340 | main.log.info("Stopping intentperf" ) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 341 | |
| 342 | resultsDB = open("IntentEventTPDB", "a") |
| 343 | for node in groupResult: |
| 344 | |
| 345 | resultString = "'" + commit + "'," |
| 346 | resultString += "'1gig'," |
| 347 | resultString += str(clusterCount) + "," |
| 348 | resultString += "'baremetal" + str(int(groupResult.index(node)) + 1) + "'," |
| 349 | resultString += n + "," |
| 350 | resultString += str(node) + "," |
| 351 | resultString += str(0) + "\n" #no stddev |
| 352 | resultsDB.write(resultString) |
| 353 | |
| 354 | resultsDB.close() |
cameron@onlab.us | c10e22c | 2015-05-13 13:07:28 -0700 | [diff] [blame] | 355 | |
| 356 | main.ONOSbench.onosErrorLog(ONOSIp[1]) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 357 | |
| 358 | |