andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 1 | # ScaleOutTemplate -> flowTP |
| 2 | # |
| 3 | # CASE1 starts number of nodes specified in param file |
| 4 | # |
| 5 | # cameron@onlab.us |
| 6 | |
| 7 | import sys |
| 8 | import os.path |
| 9 | |
| 10 | |
| 11 | class flowTP1g: |
| 12 | |
| 13 | def __init__( self ): |
| 14 | self.default = '' |
| 15 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 16 | def CASE1( self, main ): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 17 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 18 | import time |
| 19 | global init |
| 20 | try: |
| 21 | if type(init) is not bool: |
| 22 | init = False |
| 23 | except NameError: |
| 24 | init = False |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 25 | |
| 26 | #Load values from params file |
| 27 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 28 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 29 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 30 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 31 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 32 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 33 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 34 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 35 | |
| 36 | main.log.info("==========DEBUG VERSION 3===========") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 37 | |
cameron@onlab.us | 412e956 | 2015-05-13 16:04:34 -0700 | [diff] [blame] | 38 | main.exceptions = [0]*11 |
| 39 | main.warnings = [0]*11 |
| 40 | main.errors = [0]*11 |
| 41 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 42 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 43 | if init == False: |
| 44 | init = True |
| 45 | global clusterCount #number of nodes running |
| 46 | global ONOSIp #list of ONOS IP addresses |
| 47 | global scale |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 48 | global commit |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 49 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 50 | clusterCount = 0 |
| 51 | ONOSIp = [ 0 ] |
| 52 | scale = (main.params[ 'SCALE' ]).split(",") |
| 53 | clusterCount = int(scale[0]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 54 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 55 | #Populate ONOSIp with ips from params |
| 56 | for i in range(1, maxNodes + 1): |
| 57 | ipString = 'ip' + str(i) |
| 58 | ONOSIp.append(main.params[ 'CTRL' ][ ipString ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 59 | |
jenkins | 15b2b13 | 2015-06-23 14:04:09 -0700 | [diff] [blame] | 60 | ONOSIp = [0] |
| 61 | ONOSIp.extend(main.ONOSbench.getOnosIps()) |
jenkins | 15b2b13 | 2015-06-23 14:04:09 -0700 | [diff] [blame] | 62 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 63 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 64 | if skipMvn != "yes": |
| 65 | mvnResult = main.ONOSbench.cleanInstall() |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 66 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 67 | #git |
| 68 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 69 | if gitPull == 'on': |
| 70 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 71 | pullResult = main.ONOSbench.gitPull() |
| 72 | |
| 73 | else: |
| 74 | checkoutResult = main.TRUE |
| 75 | pullResult = main.TRUE |
| 76 | main.log.info( "Skipped git checkout and pull" ) |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 77 | |
| 78 | commit = main.ONOSbench.getVersion() |
| 79 | commit = (commit.split(" "))[1] |
| 80 | |
| 81 | resultsDB = open("flowTP1gDB", "w+") |
| 82 | resultsDB.close() |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 83 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 84 | # -- END OF INIT SECTION --# |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 85 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 86 | clusterCount = int(scale[0]) |
| 87 | scale.remove(scale[0]) |
| 88 | main.log.info("CLUSTER COUNT: " + str(clusterCount)) |
| 89 | |
jenkins | 8f8f4f3 | 2015-06-24 14:05:04 -0700 | [diff] [blame] | 90 | MN1Ip = ONOSIp[len(ONOSIp)-1] |
| 91 | BENCHIp = ONOSIp[len(ONOSIp)-2] |
| 92 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 93 | #kill off all onos processes |
| 94 | main.log.step("Safety check, killing all ONOS processes") |
| 95 | main.log.step("before initiating enviornment setup") |
| 96 | for node in range(1, maxNodes + 1): |
| 97 | main.ONOSbench.onosDie(ONOSIp[node]) |
| 98 | |
| 99 | #Uninstall everywhere |
| 100 | main.log.step( "Cleaning Enviornment..." ) |
| 101 | for i in range(1, maxNodes + 1): |
| 102 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 103 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
| 104 | |
| 105 | #construct the cell file |
| 106 | main.log.info("Creating cell file") |
| 107 | cellIp = [] |
| 108 | for node in range (1, clusterCount + 1): |
| 109 | cellIp.append(ONOSIp[node]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 110 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 111 | main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), *cellIp) |
| 112 | main.log.info("Cell Ip list: " + str(cellIp)) |
| 113 | |
| 114 | main.step( "Set Cell" ) |
| 115 | main.ONOSbench.setCell(cellName) |
| 116 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 117 | main.step( "Creating ONOS package" ) |
| 118 | packageResult = main.ONOSbench.onosPackage() |
| 119 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 120 | main.step( "verify cells" ) |
| 121 | verifyCellResult = main.ONOSbench.verifyCell() |
| 122 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 123 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
| 124 | for node in range(1, clusterCount + 1): |
| 125 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
| 126 | main.ONOSbench.onosInstall( ONOSIp[node]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 127 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 128 | for node in range(1, clusterCount + 1): |
| 129 | for i in range( 2 ): |
| 130 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 131 | if isup: |
| 132 | main.log.info("ONOS " + str(node) + " is up\n") |
| 133 | break |
| 134 | if not isup: |
| 135 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
| 136 | |
| 137 | for node in range(1, clusterCount + 1): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 138 | exec "a = main.ONOS%scli.startOnosCli" %str(node) |
| 139 | a(ONOSIp[node]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 140 | |
| 141 | main.log.info("Startup sequence complete") |
cameron@onlab.us | 412e956 | 2015-05-13 16:04:34 -0700 | [diff] [blame] | 142 | main.ONOSbench.onosErrorLog(ONOSIp[1]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 143 | |
| 144 | def CASE2( self, main ): |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 145 | # |
| 146 | # This is the flow TP test |
| 147 | # |
| 148 | import os.path |
| 149 | import numpy |
| 150 | import math |
| 151 | import time |
| 152 | import datetime |
| 153 | import traceback |
| 154 | |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 155 | global currentNeighbors |
| 156 | try: |
cameron@onlab.us | 50dacf8 | 2015-05-08 14:56:42 -0700 | [diff] [blame] | 157 | currentNeighbors |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 158 | except: |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 159 | currentNeighbors = (main.params[ 'TEST' ][ 'neighbors' ]).split(",")[0] |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 160 | else: |
cameron@onlab.us | 50dacf8 | 2015-05-08 14:56:42 -0700 | [diff] [blame] | 161 | if currentNeighbors == "r": #reset |
| 162 | currentNeighbors = "0" |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 163 | else: |
cameron@onlab.us | 50dacf8 | 2015-05-08 14:56:42 -0700 | [diff] [blame] | 164 | currentNeighbors = "a" |
| 165 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 166 | testCMD = [ 0,0,0,0 ] |
| 167 | warmUp = int(main.params[ 'TEST' ][ 'warmUp' ]) |
| 168 | sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) |
| 169 | switches = int(main.params[ 'TEST' ][ 'switches' ]) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 170 | neighborList = (main.params[ 'TEST' ][ 'neighbors' ]).split(",") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 171 | testCMD[0] = main.params[ 'TEST' ][ 'testCMD0' ] |
| 172 | testCMD[1] = main.params[ 'TEST' ][ 'testCMD1' ] |
| 173 | maxNodes = main.params[ 'availableNodes' ] |
| 174 | onBaremetal = main.params['isOnBaremetal'] |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 175 | cooldown = main.params[ 'TEST' ][ 'cooldown' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 176 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 177 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 178 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 179 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 180 | maxNodes = int(main.params[ 'availableNodes' ]) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 181 | homeDir = os.path.expanduser('~') |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 182 | flowRuleBackup = str(main.params[ 'TEST' ][ 'enableFlowRuleStoreBackup' ]) |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 183 | main.log.info("Flow Rule Backup is set to:" + flowRuleBackup) |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 184 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 185 | servers = str(clusterCount) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 186 | |
| 187 | if clusterCount == 1: |
| 188 | neighborList = ['0'] |
cameron@onlab.us | 50dacf8 | 2015-05-08 14:56:42 -0700 | [diff] [blame] | 189 | currentNeighbors = "r" |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 190 | else: |
| 191 | if currentNeighbors == "a": |
cameron@onlab.us | 50dacf8 | 2015-05-08 14:56:42 -0700 | [diff] [blame] | 192 | neighborList = [str(clusterCount-1)] |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 193 | currentNeighbors = "r" |
cameron@onlab.us | 50dacf8 | 2015-05-08 14:56:42 -0700 | [diff] [blame] | 194 | else: |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 195 | neighborList = ['0'] |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 196 | |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 197 | main.log.info("neightborlist: " + str(neighborList)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 198 | |
| 199 | ts = time.time() |
| 200 | st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 201 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 202 | #write file to change mem limit to 32 gigs (BAREMETAL ONLY!) |
| 203 | if onBaremetal == "true": |
| 204 | filename = "/onos/tools/package/bin/onos-service" |
| 205 | serviceConfig = open(homeDir + filename, 'w+') |
| 206 | serviceConfig.write("#!/bin/bash\n ") |
| 207 | serviceConfig.write("#------------------------------------- \n ") |
| 208 | serviceConfig.write("# Starts ONOS Apache Karaf container\n ") |
| 209 | serviceConfig.write("#------------------------------------- \n ") |
| 210 | serviceConfig.write("#export JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-openjdk-amd64/}\n ") |
jenkins | 399e251 | 2015-03-24 10:31:57 -0700 | [diff] [blame] | 211 | serviceConfig.write("""export JAVA_OPTS="${JAVA_OPTS:--Xms8G -Xmx8G}" \n """) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 212 | serviceConfig.write("") |
| 213 | serviceConfig.write("ONOS_HOME=/opt/onos \n ") |
| 214 | serviceConfig.write("") |
| 215 | serviceConfig.write("[ -d $ONOS_HOME ] && cd $ONOS_HOME || ONOS_HOME=$(dirname $0)/..\n") |
| 216 | serviceConfig.write("""${ONOS_HOME}/apache-karaf-$KARAF_VERSION/bin/karaf "$@" \n """) |
| 217 | serviceConfig.close() |
| 218 | |
| 219 | for n in neighborList: |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 220 | main.log.step("\tSTARTING TEST") |
| 221 | main.log.step("\tLOADING FROM SERVERS: \t" + str(clusterCount) ) |
| 222 | main.log.step("\tNEIGHBORS:\t" + n ) |
| 223 | main.log.info("=============================================================") |
| 224 | main.log.info("=============================================================") |
| 225 | #write file to configure nil link |
| 226 | ipCSV = "" |
| 227 | for i in range (1, int(maxNodes) + 1): |
| 228 | tempstr = "ip" + str(i) |
| 229 | ipCSV += main.params[ 'CTRL' ][ tempstr ] |
| 230 | if i < int(maxNodes): |
| 231 | ipCSV +="," |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 232 | |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 233 | for i in range(5): |
| 234 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders deviceCount 35" """) |
| 235 | main.ONOSbench.handle.expect(":~") |
| 236 | time.sleep(3) |
| 237 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.provider.nil.NullProviders topoShape linear" """) |
| 238 | main.ONOSbench.handle.expect(":~") |
| 239 | time.sleep(3) |
| 240 | main.ONOSbench.handle.sendline("""onos $OC1 "null-simulation start" """) |
| 241 | main.ONOSbench.handle.expect(":~") |
| 242 | time.sleep(3) |
| 243 | main.ONOSbench.handle.sendline("""onos $OC1 "balance-masters" """) |
| 244 | main.ONOSbench.handle.expect(":~") |
| 245 | time.sleep(3) |
| 246 | main.log.info("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """) |
| 247 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg set org.onosproject.store.flow.impl.NewDistributedFlowRuleStore backupEnabled """ + flowRuleBackup + """" """) |
| 248 | main.ONOSbench.handle.expect(":~") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 249 | |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 250 | main.ONOSbench.handle.sendline("""onos $OC1 "cfg get" """) |
| 251 | main.ONOSbench.handle.expect(":~") |
| 252 | main.log.info(main.ONOSbench.handle.before) |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 253 | |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 254 | time.sleep(3) |
| 255 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 256 | main.ONOSbench.handle.expect(":~") |
| 257 | check = main.ONOSbench.handle.before |
| 258 | main.log.info("\nStart up check: \n" + check + "\n") |
| 259 | if "SCC(s)=1," in check: |
| 260 | break |
| 261 | time.sleep(5) |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 262 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 263 | #devide flows |
| 264 | flows = int(main.params[ 'TEST' ][ 'flows' ]) |
| 265 | main.log.info("Flow Target = " + str(flows)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 266 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 267 | flows = (flows *max(int(n)+1,int(servers)))/((int(n) + 1)*int(servers)*(switches)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 268 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 269 | main.log.info("Flows per switch = " + str(flows)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 270 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 271 | #build list of servers in "$OC1, $OC2...." format |
| 272 | serverEnvVars = "" |
| 273 | for i in range (1,int(servers)+1): |
| 274 | serverEnvVars += ("-s " + ONOSIp[i] + " ") |
| 275 | |
| 276 | data = [[""]*int(servers)]*int(sampleSize) |
| 277 | maxes = [""]*int(sampleSize) |
| 278 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 279 | flowCMD = "python3 " + homeDir + "/onos/tools/test/bin/" |
| 280 | flowCMD += testCMD[0] + " " + str(flows) + " " + testCMD[1] |
| 281 | flowCMD += " " + str(n) + " " + str(serverEnvVars) + "-j" |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 282 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 283 | main.log.info(flowCMD) |
| 284 | #time.sleep(60) |
| 285 | |
| 286 | for test in range(0, warmUp + sampleSize): |
| 287 | if test < warmUp: |
| 288 | main.log.info("Warm up " + str(test + 1) + " of " + str(warmUp)) |
| 289 | else: |
| 290 | main.log.info("====== Test run: " + str(test-warmUp+1) + " ======") |
| 291 | |
| 292 | main.ONOSbench.handle.sendline(flowCMD) |
| 293 | main.ONOSbench.handle.expect(":~") |
| 294 | rawResult = main.ONOSbench.handle.before |
| 295 | main.log.info("Raw results: \n" + rawResult + "\n") |
| 296 | |
| 297 | if "failed" in rawResult: |
| 298 | main.log.report("FLOW_TESTER.PY FAILURE") |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 299 | main.log.report( " \n" + rawResult + " \n") |
| 300 | for i in range(clusterCount): |
| 301 | main.log.report("=======================================================") |
| 302 | main.log.report(" ONOS " + str(i) + "LOG REPORT") |
| 303 | main.ONOSbench.logReport(ONOSIp[i], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") |
| 304 | main.ONOSbench.handle.sendline("onos $OC1 flows") |
| 305 | main.ONOSbench.handle.expect(":~") |
| 306 | main.log.info(main.ONOSbench.handle.before) |
| 307 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 308 | break |
| 309 | |
| 310 | ######################################################################################## |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 311 | result = [""]*(clusterCount) |
| 312 | rawResult = rawResult.splitlines() |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 313 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 314 | for node in range(1, clusterCount + 1): |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 315 | for line in rawResult: |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 316 | #print("line: " + line) |
| 317 | if ONOSIp[node] in line and "server" in line: |
| 318 | temp = line.split(" ") |
| 319 | for word in temp: |
| 320 | #print ("word: " + word) |
| 321 | if "elapsed" in repr(word): |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 322 | index = temp.index(word) + 1 |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 323 | myParsed = (temp[index]).replace(",","") |
| 324 | myParsed = myParsed.replace("}","") |
| 325 | myParsed = int(myParsed) |
| 326 | result[node-1] = myParsed |
| 327 | main.log.info( ONOSIp[node] + " : " + str(myParsed)) |
| 328 | break |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 329 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 330 | if test >= warmUp: |
| 331 | for i in result: |
| 332 | if i == "": |
| 333 | main.log.error("Missing data point, critical failure incoming") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 334 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 335 | print result |
| 336 | maxes[test-warmUp] = max(result) |
| 337 | main.log.info("Data collection iteration: " + str(test-warmUp) + " of " + str(sampleSize)) |
| 338 | main.log.info("Throughput time: " + str(maxes[test-warmUp]) + "(ms)") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 339 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 340 | data[test-warmUp] = result |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 341 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 342 | # wait for flows = 0 |
cameron@onlab.us | cd4e8a2 | 2015-05-11 10:58:43 -0700 | [diff] [blame] | 343 | for checkCount in range(0,5): |
| 344 | time.sleep(10) |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 345 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 346 | main.ONOSbench.handle.expect(":~") |
| 347 | flowCheck = main.ONOSbench.handle.before |
| 348 | if "flows=0," in flowCheck: |
| 349 | main.log.info("Flows removed") |
| 350 | break |
| 351 | else: |
| 352 | for line in flowCheck.splitlines(): |
| 353 | if "flows=" in line: |
| 354 | main.log.info("Current Summary: " + line) |
| 355 | if checkCount == 2: |
| 356 | main.log.info("Flows are stuck, moving on ") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 357 | |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 358 | |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 359 | time.sleep(5) |
| 360 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 361 | main.log.info("raw data: " + str(data)) |
| 362 | main.log.info("maxes:" + str(maxes)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 363 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 364 | |
| 365 | # report data |
| 366 | print("") |
| 367 | main.log.info("\t Results (measurments are in milliseconds)") |
| 368 | print("") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 369 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 370 | nodeString = "" |
| 371 | for i in range(1, int(servers) + 1): |
| 372 | nodeString += ("\tNode " + str(i)) |
| 373 | |
| 374 | for test in range(0, sampleSize ): |
| 375 | main.log.info("\t Test iteration " + str(test + 1) ) |
| 376 | main.log.info("\t------------------") |
| 377 | main.log.info(nodeString) |
| 378 | resultString = "" |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 379 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 380 | for i in range(0, int(servers) ): |
| 381 | resultString += ("\t" + str(data[test][i]) ) |
| 382 | main.log.info(resultString) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 383 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 384 | print("\n") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 385 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 386 | avgOfMaxes = numpy.mean(maxes) |
| 387 | main.log.info("Average of max value from each test iteration: " + str(avgOfMaxes)) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 388 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 389 | stdOfMaxes = numpy.std(maxes) |
| 390 | main.log.info("Standard Deviation of max values: " + str(stdOfMaxes)) |
| 391 | print("\n\n") |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 392 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 393 | avgTP = int(main.params[ 'TEST' ][ 'flows' ]) / avgOfMaxes #result in kflows/second |
| 394 | |
| 395 | tp = [] |
| 396 | for i in maxes: |
| 397 | tp.append((int(main.params[ 'TEST' ][ 'flows' ]) / i )) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 398 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 399 | stdTP = numpy.std(tp) |
andrew@onlab.us | 5cdb285 | 2015-03-11 15:11:10 -0700 | [diff] [blame] | 400 | |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 401 | main.log.info("Average thoughput: " + str(avgTP) + " Kflows/second" ) |
| 402 | main.log.info("Standard deviation of throughput: " + str(stdTP) + " Kflows/second") |
| 403 | |
cameron@onlab.us | c80a8c8 | 2015-04-15 14:57:37 -0700 | [diff] [blame] | 404 | resultsLog = open("flowTP1gDB","a") |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 405 | resultString = ("'" + commit + "',") |
| 406 | resultString += ("'1gig',") |
| 407 | resultString += ((main.params[ 'TEST' ][ 'flows' ]) + ",") |
| 408 | resultString += (str(clusterCount) + ",") |
| 409 | resultString += (str(n) + ",") |
| 410 | resultString += (str(avgTP) + "," + str(stdTP) + "\n") |
| 411 | resultsLog.write(resultString) |
cameron@onlab.us | 1949421 | 2015-04-01 16:12:07 -0700 | [diff] [blame] | 412 | resultsLog.close() |
cameron@onlab.us | b5eb9f4 | 2015-05-06 13:55:45 -0700 | [diff] [blame] | 413 | |
| 414 | main.log.report("Result line to file: " + resultString) |
| 415 | |
jenkins | e450d94 | 2015-06-19 13:37:31 -0700 | [diff] [blame] | 416 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d") |