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