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