cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 1 | # ScaleOutTemplate |
| 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 SCPFintentRerouteLat: |
| 12 | |
| 13 | def __init__( self ): |
| 14 | self.default = '' |
| 15 | |
| 16 | def CASE1( self, main ): |
| 17 | |
| 18 | import time |
| 19 | |
| 20 | global init |
| 21 | try: |
| 22 | if type(init) is not bool: |
| 23 | init = False |
| 24 | except NameError: |
| 25 | init = False |
| 26 | |
| 27 | #Load values from params file |
| 28 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 29 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 30 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 31 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 32 | BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
cameron@onlab.us | dc9d069 | 2015-07-13 16:02:27 -0700 | [diff] [blame] | 33 | BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 34 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 35 | main.maxNodes = int(main.params[ 'max' ]) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 36 | skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ] |
| 37 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 38 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 39 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 40 | if init == False: |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 41 | init = True |
| 42 | global clusterCount #number of nodes running |
| 43 | global ONOSIp #list of ONOS IP addresses |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 44 | global scale |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 45 | global commit |
| 46 | |
| 47 | clusterCount = 0 |
| 48 | ONOSIp = [ 0 ] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 49 | scale = (main.params[ 'SCALE' ]).split(",") |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 50 | clusterCount = int(scale[0]) |
| 51 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 52 | #Populate ONOSIp with ips from params |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 53 | ONOSIp = [0] |
| 54 | ONOSIp.extend(main.ONOSbench.getOnosIps()) |
| 55 | |
| 56 | print("-----------------" + str(ONOSIp)) |
| 57 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 58 | if skipMvn != "yes": |
| 59 | mvnResult = main.ONOSbench.cleanInstall() |
| 60 | |
| 61 | #git |
| 62 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 63 | if gitPull == 'on': |
| 64 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 65 | pullResult = main.ONOSbench.gitPull() |
| 66 | |
| 67 | else: |
| 68 | checkoutResult = main.TRUE |
| 69 | pullResult = main.TRUE |
| 70 | main.log.info( "Skipped git checkout and pull" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 71 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 72 | commit = main.ONOSbench.getVersion() |
| 73 | commit = (commit.split(" "))[1] |
| 74 | |
suibin | 584c070 | 2015-07-14 15:57:27 -0700 | [diff] [blame] | 75 | resultsDB = open("/tmp/IntentRerouteLatDB", "w+") |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 76 | resultsDB.close() |
| 77 | |
| 78 | # -- END OF INIT SECTION --# |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 79 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 80 | clusterCount = int(scale[0]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 81 | scale.remove(scale[0]) |
| 82 | |
| 83 | #kill off all onos processes |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 84 | main.log.step("Safety check, killing all ONOS processes") |
| 85 | main.log.step("before initiating enviornment setup") |
cameron@onlab.us | dc9d069 | 2015-07-13 16:02:27 -0700 | [diff] [blame] | 86 | for node in range(1, main.maxNodes + 1): |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 87 | main.ONOSbench.onosDie(ONOSIp[node]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 88 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 89 | #Uninstall everywhere |
| 90 | main.log.step( "Cleaning Enviornment..." ) |
cameron@onlab.us | dc9d069 | 2015-07-13 16:02:27 -0700 | [diff] [blame] | 91 | for i in range(1, main.maxNodes + 1): |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 92 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 93 | main.ONOSbench.onosUninstall( ONOSIp[i] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 94 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 95 | #construct the cell file |
| 96 | main.log.info("Creating cell file") |
| 97 | cellIp = [] |
| 98 | for node in range (1, clusterCount + 1): |
| 99 | cellIp.append(ONOSIp[node]) |
cameron@onlab.us | dc9d069 | 2015-07-13 16:02:27 -0700 | [diff] [blame] | 100 | |
| 101 | main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,str(Apps), cellIp) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 102 | |
| 103 | main.step( "Set Cell" ) |
| 104 | main.ONOSbench.setCell(cellName) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 105 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 106 | main.step( "Creating ONOS package" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 107 | packageResult = main.ONOSbench.onosPackage() |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 108 | |
| 109 | main.step( "verify cells" ) |
| 110 | verifyCellResult = main.ONOSbench.verifyCell() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 111 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 112 | main.log.report( "Initializing " + str( clusterCount ) + " node cluster." ) |
| 113 | for node in range(1, clusterCount + 1): |
| 114 | main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node]) |
| 115 | main.ONOSbench.onosInstall( ONOSIp[node]) |
| 116 | |
| 117 | for node in range(1, clusterCount + 1): |
| 118 | for i in range( 2 ): |
| 119 | isup = main.ONOSbench.isup( ONOSIp[node] ) |
| 120 | if isup: |
| 121 | main.log.info("ONOS " + str(node) + " is up\n") |
| 122 | break |
| 123 | if not isup: |
| 124 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
| 125 | main.log.info("Startup sequence complete") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 126 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 127 | deviceMastership = (main.params[ 'TEST' ][ "s" + str(clusterCount) ]).split(",") |
| 128 | print("Device mastership list: " + str(deviceMastership)) |
| 129 | |
| 130 | main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.store.flow.impl.NewDistributedFlowRuleStore", "backupEnabled false") |
| 131 | |
| 132 | main.log.step("Setting up null provider") |
| 133 | for i in range(3): |
| 134 | main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.provider.nil.NullProviders", "deviceCount 8") |
| 135 | main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.provider.nil.NullProviders", "topoShape reroute") |
| 136 | main.ONOSbench.onosCfgSet( ONOSIp[1], "org.onosproject.provider.nil.NullProviders", "enabled true") |
| 137 | time.sleep(5) |
| 138 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 139 | main.ONOSbench.handle.expect(":~") |
| 140 | x = main.ONOSbench.handle.before |
| 141 | if "devices=8" in x and "links=16," in x: |
| 142 | break |
| 143 | |
| 144 | index = 1 |
| 145 | for node in deviceMastership: |
| 146 | for attempt in range(0,10): |
| 147 | cmd = ( "onos $OC" + node + """ "device-role null:000000000000000""" + str(index) + " " + ONOSIp[int(node)] + """ master" """) |
| 148 | main.log.info("assigning mastership of device " + str(index) + " to node " + node + ": \n " + cmd + "\n") |
| 149 | main.ONOSbench.handle.sendline(cmd) |
| 150 | main.ONOSbench.handle.expect(":~") |
| 151 | time.sleep(4) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 152 | |
| 153 | cmd = ( "onos $OC" + node + " roles|grep 00000" + str(index)) |
| 154 | main.log.info(cmd) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 155 | main.ONOSbench.handle.sendline(cmd) |
| 156 | main.ONOSbench.handle.expect(":~") |
| 157 | check = main.ONOSbench.handle.before |
| 158 | main.log.info("CHECK:\n" + check) |
| 159 | if ("master=" + ONOSIp[int(node)]) in check: |
| 160 | break |
| 161 | index += 1 |
| 162 | |
| 163 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"]) |
| 164 | |
| 165 | def CASE2( self, main ): |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 166 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 167 | import time |
| 168 | import numpy |
| 169 | import datetime |
| 170 | #from scipy import stats |
| 171 | |
| 172 | ts = time.time() |
| 173 | date = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d') |
| 174 | |
| 175 | sampleSize = int(main.params[ 'TEST' ][ 'sampleSize' ]) |
| 176 | warmUp = int(main.params[ 'TEST' ][ 'warmUp' ]) |
| 177 | intentsList = (main.params[ 'TEST' ][ 'intents' ]).split(",") |
| 178 | debug = main.params[ 'TEST' ][ 'debug' ] |
| 179 | for i in range(0,len(intentsList)): |
| 180 | intentsList[i] = int(intentsList[i]) |
| 181 | |
| 182 | timestampMetrics = [] |
| 183 | if main.params['METRICS']['Submitted'] == "1": |
| 184 | timestampMetrics.append("Submitted") |
| 185 | if main.params['METRICS']['Installed'] == "1": |
| 186 | timestampMetrics.append("Installed") |
| 187 | if main.params['METRICS']['Failed'] == "1": |
| 188 | timestampMetrics.append("Failed") |
| 189 | if main.params['METRICS']['Withdraw'] == "1": |
| 190 | timestampMetrics.append("Withdraw") |
| 191 | if main.params['METRICS']['Withdrawn'] == "1": |
| 192 | timestampMetrics.append("Withdrawn") |
| 193 | if debug: main.log.info(timestampMetrics) |
| 194 | |
| 195 | if debug == "True": |
| 196 | debug = True |
| 197 | else: |
| 198 | debug = False |
| 199 | |
| 200 | ingress = "null:0000000000000001" |
| 201 | egress = "null:0000000000000007" |
| 202 | |
| 203 | for intents in intentsList: |
| 204 | main.log.report("Intent Batch size: " + str(intents) + "\n ") |
| 205 | myResult = [["latency", "lastNode"] for x in range(sampleSize)] |
| 206 | |
| 207 | for run in range(0, (warmUp + sampleSize)): |
| 208 | if run > warmUp: |
| 209 | main.log.info("Starting test iteration " + str(run-warmUp)) |
| 210 | |
| 211 | cmd = """onos $OC1 "push-test-intents -i """ |
| 212 | cmd += ingress + "/0 " |
| 213 | cmd += egress + "/0 " |
| 214 | cmd += str(intents) +""" 1" """ |
| 215 | if debug: main.log.info(cmd) |
| 216 | |
| 217 | withdrawCmd = cmd.replace("intents -i", "intents -w ") |
| 218 | |
| 219 | #push-test-intents |
| 220 | main.ONOSbench.handle.sendline(cmd) |
| 221 | main.ONOSbench.handle.expect(":~") |
| 222 | myRawResult = main.ONOSbench.handle.before |
| 223 | |
| 224 | for i in range(0, 40): |
| 225 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 226 | main.ONOSbench.handle.expect(":~") |
| 227 | linkCheck = main.ONOSbench.handle.before |
| 228 | if ("links=16,") in linkCheck and ("flows=" + str(intents*7) + ","): |
| 229 | break |
| 230 | if i == 39: |
| 231 | main.log.error("Flow/link count incorrect, data invalid."+ linkCheck) |
| 232 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], "d") |
| 233 | #main.ONOSbench.logReport(ONOSIp[(clusterCount-1)], ["ERROR", "WARNING", "EXCEPT"], "d") |
| 234 | main.ONOSbench.sendline("onos $OC1 summary") |
| 235 | main.ONOSbench.sendline("onos $OC1 devices") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 236 | main.ONOSbench.sendline("onos $OC1 links") |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 237 | main.ONOSbench.expect(":~") |
| 238 | main.log.info(main.ONOSbench.before) |
| 239 | |
| 240 | #collect timestamp from link cut |
| 241 | cmd = """onos $OC1 null-link "null:0000000000000004/1 null:0000000000000003/2 down" """ |
| 242 | if debug: main.log.info("COMMAND: " + str(cmd)) |
| 243 | main.ONOSbench.handle.sendline(cmd) |
| 244 | main.ONOSbench.handle.expect(":~") |
| 245 | |
| 246 | cmd = "onos-ssh $OC1 cat /opt/onos/log/karaf.log | grep TopologyManager| tail -1" |
| 247 | for i in range(0,10): |
| 248 | main.ONOSbench.handle.sendline(cmd) |
| 249 | time.sleep(2) |
| 250 | main.ONOSbench.handle.expect(":~") |
| 251 | raw = main.ONOSbench.handle.before |
| 252 | #if "NullLinkProvider" in raw and "links=14" in raw: |
| 253 | if "links=14" in raw: |
| 254 | break |
| 255 | if i >= 9: |
| 256 | main.log.error("Expected output not being recieved... continuing") |
| 257 | main.log.info(raw) |
| 258 | break |
| 259 | time.sleep(2) |
| 260 | |
GlennRC | 2b28a41 | 2015-10-14 10:28:50 -0700 | [diff] [blame] | 261 | if debug: main.log.debug("raw: " + raw) |
| 262 | |
| 263 | try: |
| 264 | temp = raw.splitlines() |
| 265 | except ValueError: |
| 266 | main.log.error("Exception at line 264: cannot split lines") |
| 267 | continue |
| 268 | |
| 269 | if debug: main.log.debug("temp (after splitlines): " + str(temp)) |
| 270 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 271 | for line in temp: |
| 272 | if str(date) in line: |
| 273 | temp = line |
| 274 | break |
| 275 | |
GlennRC | 2b28a41 | 2015-10-14 10:28:50 -0700 | [diff] [blame] | 276 | if debug: main.log.debug("temp (checking for date): " + str(temp)) |
| 277 | |
| 278 | try: |
| 279 | cutTimestamp = (temp.split(" "))[0] + " " + (temp.split(" "))[1] |
| 280 | except ValueError: |
| 281 | main.log.error("Exception at line 279: cannot split on spaces") |
| 282 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 283 | if debug: main.log.info("Cut timestamp: " + cutTimestamp) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 284 | |
| 285 | #validate link count and flow count |
| 286 | for i in range(0, 40): |
| 287 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 288 | main.ONOSbench.handle.expect(":~") |
| 289 | linkCheck = main.ONOSbench.handle.before |
| 290 | #if "links=" + str(7*intents)+ "," in linkCheck and ("flows=" + str(7*intents) + ",") in linkCheck: |
| 291 | if "links=14," in linkCheck and ("flows=" + str(8*intents) + ",") in linkCheck: |
| 292 | break |
| 293 | if i == 39: |
| 294 | main.log.error("Link or flow count incorrect, data invalid." + linkCheck) |
| 295 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], "d") |
| 296 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 297 | time.sleep(5) #trying to avoid negative values |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 298 | |
| 299 | #intents events metrics installed timestamp |
| 300 | IEMtimestamps = [0]*(clusterCount + 1) |
| 301 | installedTemp = [0]*(clusterCount + 1) |
| 302 | for node in range(1, clusterCount +1): |
| 303 | cmd = "onos $OC" + str(node) + """ "intents-events-metrics"|grep Timestamp """ |
| 304 | raw = "" |
| 305 | while "epoch)" not in raw: |
| 306 | main.ONOSbench.handle.sendline(cmd) |
| 307 | main.ONOSbench.handle.expect(":~") |
| 308 | raw = main.ONOSbench.handle.before |
| 309 | |
| 310 | print(raw) |
| 311 | |
| 312 | intentsTimestamps = {} |
| 313 | rawTimestamps = raw.splitlines() |
| 314 | for line in rawTimestamps: |
| 315 | if "Timestamp" in line and "grep" not in line: |
| 316 | metricKey = (line.split(" "))[1] |
| 317 | metricTimestamp = (line.split(" ")[len(line.split(" ")) -1]).replace("epoch)=","") |
| 318 | metricTimestamp = float(metricTimestamp) |
| 319 | metricTimestamp = numpy.divide(metricTimestamp, 1000) |
| 320 | if debug: main.log.info(repr(metricTimestamp)) |
| 321 | intentsTimestamps[metricKey] = metricTimestamp |
| 322 | if metricKey == "Installed": |
| 323 | installedTemp[node] = metricTimestamp |
| 324 | |
| 325 | main.log.info("Node: " + str(node) + " Timestamps: " + str(intentsTimestamps)) |
| 326 | IEMtimestamps[node] = intentsTimestamps |
| 327 | |
| 328 | myMax = max(installedTemp) |
| 329 | indexOfMax = installedTemp.index(myMax) |
| 330 | |
| 331 | #number crunch |
| 332 | for metric in timestampMetrics: #this is where we sould add support for computing other timestamp metrics |
| 333 | if metric == "Installed": |
| 334 | if run >= warmUp: |
| 335 | main.log.report("link cut timestamp: " + cutTimestamp) |
| 336 | #readableInstalledTimestamp = str(intentsTimestamps["Installed"]) |
| 337 | readableInstalledTimestamp = str(myMax) |
| 338 | |
| 339 | #main.log.report("Intent Installed timestamp: " + str(intentsTimestamps["Installed"])) |
| 340 | main.log.report("Intent Installed timestamp: " + str(myMax)) |
| 341 | |
| 342 | cutEpoch = time.mktime(time.strptime(cutTimestamp, "%Y-%m-%d %H:%M:%S,%f")) |
| 343 | if debug: main.log.info("cutEpoch=" + str(cutEpoch)) |
| 344 | #rerouteLatency = float(intentsTimestamps["Installed"] - cutEpoch) |
| 345 | rerouteLatency = float(myMax - cutEpoch) |
| 346 | |
| 347 | rerouteLatency = numpy.divide(rerouteLatency, 1000) |
| 348 | main.log.report("Reroute latency:" + str(rerouteLatency) + " (seconds)\n ") |
| 349 | myResult[run-warmUp][0] = rerouteLatency |
| 350 | myResult[run-warmUp][1] = indexOfMax |
| 351 | if debug: main.log.info("Latency: " + str(myResult[run-warmUp][0])) |
| 352 | if debug: main.log.info("last node: " + str(myResult[run-warmUp][1])) |
| 353 | |
| 354 | cmd = """ onos $OC1 null-link "null:0000000000000004/1 null:0000000000000003/2 up" """ |
| 355 | if debug: main.log.info(cmd) |
| 356 | main.ONOSbench.handle.sendline(cmd) |
| 357 | main.ONOSbench.handle.expect(":~") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 358 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 359 | #wait for intent withdraw |
| 360 | main.ONOSbench.handle.sendline(withdrawCmd) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 361 | main.log.info(withdrawCmd) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 362 | main.ONOSbench.handle.expect(":~") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 363 | if debug: main.log.info(main.ONOSbench.handle.before) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 364 | main.ONOSbench.handle.sendline("onos $OC1 intents|grep WITHDRAWN|wc -l") |
| 365 | main.ONOSbench.handle.expect(":~") |
| 366 | intentWithdrawCheck = main.ONOSbench.handle.before |
| 367 | if (str(intents)) in intentWithdrawCheck: |
| 368 | main.log.info("intents withdrawn") |
| 369 | if debug: main.log.info(intentWithdrawCheck) |
| 370 | |
| 371 | # wait for links to be reestablished |
| 372 | for i in range(0, 10): |
| 373 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 374 | main.ONOSbench.handle.expect(":~") |
| 375 | linkCheck = main.ONOSbench.handle.before |
| 376 | if "links=16," in linkCheck: |
| 377 | break |
| 378 | time.sleep(1) |
| 379 | if i == 9: |
| 380 | main.log.info("Links Failed to reconnect, next iteration of data invalid." + linkCheck) |
| 381 | |
| 382 | if run < warmUp: |
| 383 | main.log.info("Warm up run " + str(run+1) + " completed") |
| 384 | |
| 385 | if debug: main.log.info(myResult) |
| 386 | latTemp = [] |
| 387 | nodeTemp = [] |
| 388 | for i in myResult: |
| 389 | latTemp.append(i[0]) |
| 390 | nodeTemp.append(i[1]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 391 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 392 | mode = {} |
| 393 | for i in nodeTemp: |
| 394 | if i in mode: |
| 395 | mode[i] += 1 |
| 396 | else: |
| 397 | mode[i] = 1 |
| 398 | |
| 399 | for i in mode.keys(): |
| 400 | if mode[i] == max(mode.values()): |
| 401 | nodeMode = i |
| 402 | |
| 403 | average = numpy.average(latTemp) |
| 404 | stdDev = numpy.std(latTemp) |
| 405 | |
| 406 | average = numpy.multiply(average, 1000) |
| 407 | stdDev = numpy.multiply(stdDev, 1000) |
| 408 | |
| 409 | main.log.report("Scale: " + str(clusterCount) + " \tIntent batch: " + str(intents)) |
| 410 | main.log.report("Latency average:................" + str(average)) |
| 411 | main.log.report("Latency standard deviation:....." + str(stdDev)) |
| 412 | main.log.report("Mode of last node to respond:..." + str(nodeMode)) |
| 413 | main.log.report("________________________________________________________") |
| 414 | |
suibin | e1e5877 | 2015-07-15 09:52:59 -0700 | [diff] [blame] | 415 | resultsDB = open("/tmp/IntentRerouteLatDB", "a") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 416 | resultsDB.write("'" + commit + "',") |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 417 | resultsDB.write(str(clusterCount) + ",") |
| 418 | resultsDB.write(str(intents) + ",") |
| 419 | resultsDB.write(str(average) + ",") |
| 420 | resultsDB.write(str(stdDev) + "\n") |
| 421 | resultsDB.close() |
| 422 | |
| 423 | main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"]) |
| 424 | |