jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame^] | 1 | # 2015.03.12 10:22:05 PDT |
| 2 | #Embedded file name: ../tests/TopoPerfNextBM/TopoPerfNextBM.py |
| 3 | import time |
| 4 | import sys |
| 5 | import os |
| 6 | import re |
| 7 | |
| 8 | class TopoPerfNextBM: |
| 9 | |
| 10 | def __init__(self): |
| 11 | self.default = '' |
| 12 | |
| 13 | def CASE1(self, main): |
| 14 | """ |
| 15 | ONOS startup sequence |
| 16 | """ |
| 17 | global clusterCount |
| 18 | global timeToPost |
| 19 | global runNum |
| 20 | import time |
| 21 | clusterCount = 1 |
| 22 | timeToPost = time.strftime('%Y-%m-%d %H:%M:%S') |
| 23 | runNum = time.strftime('%d%H%M%S') |
| 24 | cellName = main.params['ENV']['cellName'] |
| 25 | gitPull = main.params['GIT']['autoPull'] |
| 26 | checkoutBranch = main.params['GIT']['checkout'] |
| 27 | |
| 28 | ONOS1Ip = main.params['CTRL']['ip1'] |
| 29 | ONOS2Ip = main.params['CTRL']['ip2'] |
| 30 | ONOS3Ip = main.params['CTRL']['ip3'] |
| 31 | ONOS4Ip = main.params['CTRL']['ip4'] |
| 32 | ONOS5Ip = main.params['CTRL']['ip5'] |
| 33 | ONOS6Ip = main.params['CTRL']['ip6'] |
| 34 | ONOS7Ip = main.params['CTRL']['ip7'] |
| 35 | MN1Ip = main.params['MN']['ip1'] |
| 36 | BENCHIp = main.params['BENCH']['ip'] |
| 37 | |
| 38 | topoCfgFile = main.params['TEST']['topoConfigFile'] |
| 39 | topoCfgName = main.params['TEST']['topoConfigName'] |
| 40 | portEventResultPath = main.params['DB']['portEventResultPath'] |
| 41 | switchEventResultPath = main.params['DB']['switchEventResultPath'] |
| 42 | mvnCleanInstall = main.params['TEST']['mci'] |
| 43 | |
| 44 | main.case('Setting up test environment') |
| 45 | main.log.info('Copying topology event accumulator config' + |
| 46 | ' to ONOS /package/etc') |
| 47 | main.ONOSbench.handle.sendline('cp ~/' + |
| 48 | topoCfgFile + ' ~/ONOS/tools/package/etc/' + |
| 49 | topoCfgName) |
| 50 | main.ONOSbench.handle.expect('\\$') |
| 51 | |
| 52 | main.log.report('Setting up test environment') |
| 53 | |
| 54 | main.step('Starting mininet topology ') |
| 55 | main.Mininet1.startNet() |
| 56 | |
| 57 | main.step('Cleaning previously installed ONOS if any') |
| 58 | main.ONOSbench.onosUninstall(nodeIp=ONOS2Ip) |
| 59 | main.ONOSbench.onosUninstall(nodeIp=ONOS3Ip) |
| 60 | main.ONOSbench.onosUninstall(nodeIp=ONOS4Ip) |
| 61 | main.ONOSbench.onosUninstall(nodeIp=ONOS5Ip) |
| 62 | main.ONOSbench.onosUninstall(nodeIp=ONOS6Ip) |
| 63 | main.ONOSbench.onosUninstall(nodeIp=ONOS7Ip) |
| 64 | |
| 65 | main.step('Clearing previous DB log file') |
| 66 | |
| 67 | fPortLog = open(portEventResultPath, 'w') |
| 68 | fPortLog.write('') |
| 69 | fPortLog.close() |
| 70 | fSwitchLog = open(switchEventResultPath, 'w') |
| 71 | fSwitchLog.write('') |
| 72 | fSwitchLog.close() |
| 73 | |
| 74 | cellStr = 'webconsole,onos-core,onos-api,onos-app-metrics,' +\ |
| 75 | 'onos-app-gui,onos-cli,onos-openflow' |
| 76 | |
| 77 | main.step('Creating cell file') |
| 78 | cellFileResult = main.ONOSbench.createCellFile( |
| 79 | BENCHIp, cellName, MN1Ip, cellStr, ONOS1Ip) |
| 80 | |
| 81 | main.step('Applying cell file to environment') |
| 82 | cellApplyResult = main.ONOSbench.setCell(cellName) |
| 83 | verifyCellResult = main.ONOSbench.verifyCell() |
| 84 | |
| 85 | main.step('Git checkout and pull ' + checkoutBranch) |
| 86 | if gitPull == 'on': |
| 87 | checkoutResult = main.TRUE |
| 88 | pullResult = main.ONOSbench.gitPull() |
| 89 | else: |
| 90 | checkoutResult = main.TRUE |
| 91 | pullResult = main.TRUE |
| 92 | main.log.info('Skipped git checkout and pull') |
| 93 | |
| 94 | main.log.report('Commit information - ') |
| 95 | main.ONOSbench.getVersion(report=True) |
| 96 | main.step('Using mvn clean & install') |
| 97 | if mvnCleanInstall == 'on': |
| 98 | mvnResult = main.ONOSbench.cleanInstall() |
| 99 | elif mvnCleanInstall == 'off': |
| 100 | main.log.info('mci turned off by settings') |
| 101 | mvnResult = main.TRUE |
| 102 | main.step('Set cell for ONOS cli env') |
| 103 | main.ONOS1cli.setCell(cellName) |
| 104 | |
| 105 | main.step('Creating ONOS package') |
| 106 | packageResult = main.ONOSbench.onosPackage() |
| 107 | |
| 108 | main.step('Installing ONOS package') |
| 109 | install1Result = main.ONOSbench.onosInstall(node=ONOS1Ip) |
| 110 | |
| 111 | time.sleep(10) |
| 112 | |
| 113 | main.step('Start onos cli') |
| 114 | cli1 = main.ONOS1cli.startOnosCli(ONOS1Ip) |
| 115 | utilities.assert_equals(expect=main.TRUE, |
| 116 | actual=cellFileResult and cellApplyResult and\ |
| 117 | verifyCellResult and checkoutResult and\ |
| 118 | pullResult and mvnResult and\ |
| 119 | install1Result, |
| 120 | onpass='Test Environment setup successful', |
| 121 | onfail='Failed to setup test environment') |
| 122 | |
| 123 | def CASE2(self, main): |
| 124 | """ |
| 125 | Assign s1 to ONOS1 and measure latency |
| 126 | |
| 127 | There are 4 levels of latency measurements to this test: |
| 128 | 1 ) End-to-end measurement: Complete end-to-end measurement |
| 129 | from TCP ( SYN/ACK ) handshake to Graph change |
| 130 | 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of |
| 131 | measurement from OFP Vendor message to Graph change |
| 132 | 3 ) OFP-to-device measurement: 'ONOS processing without |
| 133 | graph change' snippet of measurement from OFP vendor |
| 134 | message to Device change timestamp |
| 135 | 4 ) T0-to-device measurement: Measurement that includes |
| 136 | the switch handshake to devices timestamp without |
| 137 | the graph view change. ( TCP handshake -> Device |
| 138 | change ) |
| 139 | """ |
| 140 | import time |
| 141 | import subprocess |
| 142 | import json |
| 143 | import requests |
| 144 | import os |
| 145 | import numpy |
| 146 | |
| 147 | ONOS1Ip = main.params['CTRL']['ip1'] |
| 148 | ONOS2Ip = main.params['CTRL']['ip2'] |
| 149 | ONOS3Ip = main.params['CTRL']['ip3'] |
| 150 | ONOS4Ip = main.params['CTRL']['ip4'] |
| 151 | ONOS5Ip = main.params['CTRL']['ip5'] |
| 152 | ONOS6Ip = main.params['CTRL']['ip6'] |
| 153 | ONOS7Ip = main.params['CTRL']['ip7'] |
| 154 | |
| 155 | ONOSUser = main.params['CTRL']['user'] |
| 156 | defaultSwPort = main.params['CTRL']['port1'] |
| 157 | numIter = main.params['TEST']['numIter'] |
| 158 | iterIgnore = int(main.params['TEST']['iterIgnore']) |
| 159 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 160 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
| 161 | debugMode = main.params['TEST']['debugMode'] |
| 162 | onosLog = main.params['TEST']['onosLogFile'] |
| 163 | resultPath = main.params['DB']['switchEventResultPath'] |
| 164 | thresholdStr = main.params['TEST']['singleSwThreshold'] |
| 165 | thresholdObj = thresholdStr.split(',') |
| 166 | thresholdMin = int(thresholdObj[0]) |
| 167 | thresholdMax = int(thresholdObj[1]) |
| 168 | |
| 169 | #TODO: Look for 'role-request' messages, |
| 170 | # which replaces the 'vendor' messages previously seen |
| 171 | # on OVS 2.0.1 |
| 172 | tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ] |
| 173 | tsharkTcpString = main.params[ 'TSHARK' ][ 'tcpSynAck' ] |
| 174 | tsharkOfOutput = '/tmp/tshark_of_topo.txt' |
| 175 | tsharkTcpOutput = '/tmp/tshark_tcp_topo.txt' |
| 176 | |
| 177 | latencyEndToEndList = [] |
| 178 | latencyOfpToGraphList = [] |
| 179 | latencyOfpToDeviceList = [] |
| 180 | latencyT0ToDeviceList = [] |
| 181 | latencyTcpToOfpList = [] |
| 182 | |
| 183 | endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 184 | ofpToGraphLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 185 | ofpToDeviceLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 186 | |
| 187 | tcpToOfpLatIter = [] |
| 188 | assertion = main.TRUE |
| 189 | localTime = time.strftime('%x %X') |
| 190 | localTime = localTime.replace('/', '') |
| 191 | localTime = localTime.replace(' ', '_') |
| 192 | localTime = localTime.replace(':', '') |
| 193 | |
| 194 | if debugMode == 'on': |
| 195 | main.ONOS1.tsharkPcap('eth0', |
| 196 | '/tmp/single_sw_lat_pcap_' + localTime) |
| 197 | main.log.info('Debug mode is on') |
| 198 | main.log.report('Latency of adding one switch to controller') |
| 199 | main.log.report('First ' + str(iterIgnore) + |
| 200 | ' iterations ignored' + ' for jvm warmup time') |
| 201 | main.log.report('Total iterations of test: ' + str(numIter)) |
| 202 | |
| 203 | for i in range(0, int(numIter)): |
| 204 | main.log.info('Starting tshark capture') |
| 205 | main.ONOS1.tsharkGrep(tsharkTcpString, tsharkTcpOutput) |
| 206 | main.ONOS1.tsharkGrep(tsharkOfString, tsharkOfOutput) |
| 207 | |
| 208 | time.sleep(10) |
| 209 | |
| 210 | main.log.info('Assigning s3 to controller') |
| 211 | main.Mininet1.assignSwController(sw='3', |
| 212 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 213 | |
| 214 | time.sleep(10) |
| 215 | |
| 216 | main.log.info('Stopping all Tshark processes') |
| 217 | main.ONOS1.tsharkStop() |
| 218 | |
| 219 | main.log.info('Copying over tshark files') |
| 220 | os.system('scp ' + ONOSUser + '@' + ONOS1Ip + |
| 221 | ':' + tsharkTcpOutput + ' /tmp/') |
| 222 | time.sleep(5) |
| 223 | tcpFile = open(tsharkTcpOutput, 'r') |
| 224 | tempText = tcpFile.readline() |
| 225 | tempText = tempText.split(' ') |
| 226 | main.log.info('Object read in from TCP capture: ' + |
| 227 | str(tempText)) |
| 228 | |
| 229 | if len(tempText) > 1: |
| 230 | t0Tcp = float(tempText[1]) * 1000.0 |
| 231 | else: |
| 232 | main.log.error('Tshark output file for TCP' + |
| 233 | ' returned unexpected results') |
| 234 | t0Tcp = 0 |
| 235 | assertion = main.FALSE |
| 236 | tcpFile.close() |
| 237 | |
| 238 | os.system('scp ' + ONOSUser + '@' + |
| 239 | ONOS1Ip + ':' + tsharkOfOutput + ' /tmp/') |
| 240 | |
| 241 | time.sleep(5) |
| 242 | ofFile = open(tsharkOfOutput, 'r') |
| 243 | lineOfp = '' |
| 244 | while True: |
| 245 | tempText = ofFile.readline() |
| 246 | if tempText != '': |
| 247 | lineOfp = tempText |
| 248 | else: |
| 249 | break |
| 250 | |
| 251 | obj = lineOfp.split(' ') |
| 252 | main.log.info('Object read in from OFP capture: ' + |
| 253 | str(lineOfp)) |
| 254 | if len(obj) > 1: |
| 255 | t0Ofp = float(obj[1]) * 1000.0 |
| 256 | else: |
| 257 | main.log.error('Tshark output file for OFP' + |
| 258 | ' returned unexpected results') |
| 259 | t0Ofp = 0 |
| 260 | assertion = main.FALSE |
| 261 | ofFile.close() |
| 262 | |
| 263 | jsonStr1 = main.ONOS1cli.topologyEventsMetrics() |
| 264 | jsonStr2 = '' |
| 265 | jsonStr3 = '' |
| 266 | jsonStr4 = '' |
| 267 | jsonStr5 = '' |
| 268 | jsonStr6 = '' |
| 269 | jsonStr7 = '' |
| 270 | |
| 271 | jsonObj1 = json.loads(jsonStr1) |
| 272 | jsonObj2 = '' |
| 273 | jsonObj3 = '' |
| 274 | jsonObj4 = '' |
| 275 | jsonObj5 = '' |
| 276 | jsonObj6 = '' |
| 277 | jsonObj7 = '' |
| 278 | |
| 279 | graphTimestamp1 = jsonObj1[graphTimestamp]['value'] |
| 280 | deviceTimestamp1 = jsonObj1[deviceTimestamp]['value'] |
| 281 | |
| 282 | main.log.info(' GraphTimestamp: ' + str(graphTimestamp1)) |
| 283 | main.log.info(' DeviceTimestamp: ' + str(deviceTimestamp1)) |
| 284 | |
| 285 | deltaDevice1 = int(deviceTimestamp1) - int(t0Tcp) |
| 286 | deltaGraph1 = int(graphTimestamp1) - int(t0Tcp) |
| 287 | deltaOfpGraph1 = int(graphTimestamp1) - int(t0Ofp) |
| 288 | deltaOfpDevice1 = int(deviceTimestamp1) - int(t0Ofp) |
| 289 | deltaTcpOfp1 = int(t0Ofp) - int(t0Tcp) |
| 290 | |
| 291 | if deltaTcpOfp1 > thresholdMin and\ |
| 292 | deltaTcpOfp1 < thresholdMax and i >= iterIgnore: |
| 293 | tcpToOfpLatIter.append(deltaTcpOfp1) |
| 294 | main.log.info('ONOS1 iter' + str(i) + |
| 295 | ' tcp-to-ofp: ' + |
| 296 | str(deltaTcpOfp1) + ' ms') |
| 297 | else: |
| 298 | tcpToOfpLatIter.append(0) |
| 299 | main.log.info('ONOS1 iter' + str(i) + |
| 300 | ' tcp-to-ofp: ' + str(deltaTcpOfp1) + |
| 301 | ' ms - ignored this iteration') |
| 302 | if deltaGraph1 > thresholdMin and\ |
| 303 | deltaGraph1 < thresholdMax and i >= iterIgnore: |
| 304 | endToEndLatNodeIter[0][i] = deltaGraph1 |
| 305 | main.log.info('ONOS1 iter' + str(i) + |
| 306 | ' end-to-end: ' + |
| 307 | str(deltaGraph1) + ' ms') |
| 308 | else: |
| 309 | main.log.info('ONOS1 iter' + str(i) + |
| 310 | ' end-to-end: ' + str(deltaGraph1) + |
| 311 | ' ms - ignored this iteration') |
| 312 | if deltaOfpGraph1 > thresholdMin and \ |
| 313 | deltaOfpGraph1 < thresholdMax and i >= iterIgnore: |
| 314 | ofpToGraphLatNodeIter[0][i] = deltaOfpGraph1 |
| 315 | main.log.info('ONOS1 iter' + str(i) + |
| 316 | ' ofp-to-graph: ' + |
| 317 | str(deltaOfpGraph1) + ' ms') |
| 318 | if deltaOfpDevice1 > thresholdMin and\ |
| 319 | deltaOfpDevice1 < thresholdMax and i >= iterIgnore: |
| 320 | ofpToDeviceLatNodeIter[0][i] = deltaOfpDevice1 |
| 321 | main.log.info('ONOS1 iter' + str(i) + |
| 322 | ' ofp-to-device: ' + |
| 323 | str(deltaOfpDevice1)) |
| 324 | |
| 325 | if clusterCount >= 3: |
| 326 | jsonStr2 = main.ONOS2cli.topologyEventsMetrics() |
| 327 | jsonStr3 = main.ONOS3cli.topologyEventsMetrics() |
| 328 | jsonObj2 = json.loads(jsonStr2) |
| 329 | jsonObj3 = json.loads(jsonStr3) |
| 330 | graphTimestamp2 = jsonObj2[graphTimestamp]['value'] |
| 331 | graphTimestamp3 = jsonObj3[graphTimestamp]['value'] |
| 332 | deviceTimestamp2 = jsonObj2[deviceTimestamp]['value'] |
| 333 | deviceTimestamp3 = jsonObj3[deviceTimestamp]['value'] |
| 334 | deltaDevice2 = int(deviceTimestamp2) - int(t0Tcp) |
| 335 | deltaDevice3 = int(deviceTimestamp3) - int(t0Tcp) |
| 336 | deltaGraph2 = int(graphTimestamp2) - int(t0Tcp) |
| 337 | deltaGraph3 = int(graphTimestamp3) - int(t0Tcp) |
| 338 | deltaOfpGraph2 = int(graphTimestamp2) - int(t0Ofp) |
| 339 | deltaOfpGraph3 = int(graphTimestamp3) - int(t0Ofp) |
| 340 | deltaOfpDevice2 = int(deviceTimestamp2) - int(t0Ofp) |
| 341 | deltaOfpDevice3 = int(deviceTimestamp3) - int(t0Ofp) |
| 342 | if deltaGraph2 > thresholdMin and\ |
| 343 | deltaGraph2 < thresholdMax and i >= iterIgnore: |
| 344 | endToEndLatNodeIter[1][i] = deltaGraph2 |
| 345 | main.log.info('ONOS2 iter' + str(i) + |
| 346 | ' end-to-end: ' + |
| 347 | str(deltaGraph2) + ' ms') |
| 348 | if deltaOfpGraph2 > thresholdMin and\ |
| 349 | deltaOfpGraph2 < thresholdMax and i >= iterIgnore: |
| 350 | ofpToGraphLatNodeIter[1][i] = deltaOfpGraph2 |
| 351 | main.log.info('ONOS2 iter' + str(i) + |
| 352 | ' ofp-to-graph: ' + |
| 353 | str(deltaOfpGraph2) + ' ms') |
| 354 | if deltaOfpDevice2 > thresholdMin and\ |
| 355 | deltaOfpDevice2 < thresholdMax and i >= iterIgnore: |
| 356 | ofpToDeviceLatNodeIter[1][i] = deltaOfpDevice2 |
| 357 | main.log.info('ONOS2 iter' + str(i) + |
| 358 | ' ofp-to-device: ' + |
| 359 | str(deltaOfpDevice2)) |
| 360 | if deltaGraph3 > thresholdMin and\ |
| 361 | deltaGraph3 < thresholdMax and i >= iterIgnore: |
| 362 | endToEndLatNodeIter[2][i] = deltaGraph3 |
| 363 | main.log.info('ONOS3 iter' + str(i) + |
| 364 | ' end-to-end: ' + str(deltaGraph3) + ' ms') |
| 365 | if deltaOfpGraph3 > thresholdMin and\ |
| 366 | deltaOfpGraph3 < thresholdMax and i >= iterIgnore: |
| 367 | ofpToGraphLatNodeIter[2][i] = deltaOfpGraph3 |
| 368 | main.log.info('ONOS3 iter' + str(i) + |
| 369 | ' ofp-to-graph: ' + |
| 370 | str(deltaOfpGraph3) + ' ms') |
| 371 | if deltaOfpDevice3 > thresholdMin and\ |
| 372 | deltaOfpDevice3 < thresholdMax and i >= iterIgnore: |
| 373 | ofpToDeviceLatNodeIter[2][i] = deltaOfpDevice3 |
| 374 | main.log.info('ONOS3 iter' + str(i) + |
| 375 | ' ofp-to-device: ' + str(deltaOfpDevice3)) |
| 376 | if clusterCount >= 5: |
| 377 | jsonStr4 = main.ONOS4cli.topologyEventsMetrics() |
| 378 | jsonStr5 = main.ONOS5cli.topologyEventsMetrics() |
| 379 | jsonObj4 = json.loads(jsonStr4) |
| 380 | jsonObj5 = json.loads(jsonStr5) |
| 381 | graphTimestamp4 = jsonObj4[graphTimestamp]['value'] |
| 382 | graphTimestamp5 = jsonObj5[graphTimestamp]['value'] |
| 383 | deviceTimestamp4 = jsonObj4[deviceTimestamp]['value'] |
| 384 | deviceTimestamp5 = jsonObj5[deviceTimestamp]['value'] |
| 385 | deltaDevice4 = int(deviceTimestamp4) - int(t0Tcp) |
| 386 | deltaDevice5 = int(deviceTimestamp5) - int(t0Tcp) |
| 387 | deltaGraph4 = int(graphTimestamp4) - int(t0Tcp) |
| 388 | deltaGraph5 = int(graphTimestamp5) - int(t0Tcp) |
| 389 | deltaOfpGraph4 = int(graphTimestamp4) - int(t0Ofp) |
| 390 | deltaOfpGraph5 = int(graphTimestamp5) - int(t0Ofp) |
| 391 | deltaOfpDevice4 = int(deviceTimestamp4) - int(t0Ofp) |
| 392 | deltaOfpDevice5 = int(deviceTimestamp5) - int(t0Ofp) |
| 393 | if deltaGraph4 > thresholdMin and \ |
| 394 | deltaGraph4 < thresholdMax and i >= iterIgnore: |
| 395 | endToEndLatNodeIter[3][i] = deltaGraph4 |
| 396 | main.log.info('ONOS4 iter' + str(i) + |
| 397 | ' end-to-end: ' + str(deltaGraph4) + ' ms') |
| 398 | if deltaOfpDevice4 > thresholdMin and \ |
| 399 | deltaOfpDevice4 < thresholdMax and i >= iterIgnore: |
| 400 | ofpToDeviceLatNodeIter[3][i] = deltaOfpDevice4 |
| 401 | main.log.info('ONOS4 iter' + str(i) + |
| 402 | ' ofp-to-device: ' + str(deltaOfpDevice4)) |
| 403 | if deltaOfpGraph4 > thresholdMin and \ |
| 404 | deltaOfpGraph4 < thresholdMax and i >= iterIgnore: |
| 405 | ofpToGraphLatNodeIter[3][i] = deltaOfpGraph4 |
| 406 | main.log.info('ONOS4 iter' + str(i) + |
| 407 | ' ofp-to-graph: ' + str(deltaOfpGraph4) + ' ms') |
| 408 | if deltaGraph5 > thresholdMin and\ |
| 409 | deltaGraph5 < thresholdMax and i >= iterIgnore: |
| 410 | endToEndLatNodeIter[4][i] = deltaGraph5 |
| 411 | main.log.info('ONOS5 iter' + str(i) + |
| 412 | ' end-to-end: ' + str(deltaGraph5) + ' ms') |
| 413 | if deltaOfpDevice5 > thresholdMin and\ |
| 414 | deltaOfpDevice5 < thresholdMax and i >= iterIgnore: |
| 415 | ofpToDeviceLatNodeIter[4][i] = deltaOfpDevice5 |
| 416 | main.log.info('ONOS5 iter' + str(i) + |
| 417 | ' ofp-to-device: ' + str(deltaOfpDevice5)) |
| 418 | if deltaOfpGraph5 > thresholdMin and\ |
| 419 | deltaOfpGraph5 < thresholdMax and i >= iterIgnore: |
| 420 | ofpToGraphLatNodeIter[4][i] = deltaOfpGraph5 |
| 421 | main.log.info('ONOS5 iter' + str(i) + |
| 422 | ' ofp-to-graph: ' + |
| 423 | str(deltaOfpGraph5) + ' ms') |
| 424 | if clusterCount >= 7: |
| 425 | jsonStr6 = main.ONOS6cli.topologyEventsMetrics() |
| 426 | jsonStr7 = main.ONOS7cli.topologyEventsMetrics() |
| 427 | jsonObj6 = json.loads(jsonStr6) |
| 428 | jsonObj7 = json.loads(jsonStr7) |
| 429 | graphTimestamp6 = jsonObj6[graphTimestamp]['value'] |
| 430 | graphTimestamp7 = jsonObj7[graphTimestamp]['value'] |
| 431 | deviceTimestamp6 = jsonObj6[deviceTimestamp]['value'] |
| 432 | deviceTimestamp7 = jsonObj7[deviceTimestamp]['value'] |
| 433 | deltaDevice6 = int(deviceTimestamp6) - int(t0Tcp) |
| 434 | deltaDevice7 = int(deviceTimestamp7) - int(t0Tcp) |
| 435 | deltaGraph6 = int(graphTimestamp6) - int(t0Tcp) |
| 436 | deltaGraph7 = int(graphTimestamp7) - int(t0Tcp) |
| 437 | deltaOfpGraph6 = int(graphTimestamp6) - int(t0Ofp) |
| 438 | deltaOfpGraph7 = int(graphTimestamp7) - int(t0Ofp) |
| 439 | deltaOfpDevice6 = int(deviceTimestamp6) - int(t0Ofp) |
| 440 | deltaOfpDevice7 = int(deviceTimestamp7) - int(t0Ofp) |
| 441 | if deltaGraph6 > thresholdMin and \ |
| 442 | deltaGraph6 < thresholdMax and i >= iterIgnore: |
| 443 | endToEndLatNodeIter[5][i] = deltaGraph6 |
| 444 | main.log.info('ONOS6 iter' + str(i) + |
| 445 | ' end-to-end: ' + str(deltaGraph6) + ' ms') |
| 446 | if deltaOfpDevice6 > thresholdMin and\ |
| 447 | deltaOfpDevice6 < thresholdMax and i >= iterIgnore: |
| 448 | ofpToDeviceLatNodeIter[5][i] = deltaOfpDevice6 |
| 449 | main.log.info('ONOS6 iter' + str(i) + |
| 450 | ' ofp-to-device: ' + str(deltaOfpDevice6)) |
| 451 | if deltaOfpGraph6 > thresholdMin and\ |
| 452 | deltaOfpGraph6 < thresholdMax and i >= iterIgnore: |
| 453 | ofpToGraphLatNodeIter[5][i] = deltaOfpGraph6 |
| 454 | main.log.info('ONOS6 iter' + str(i) + |
| 455 | ' ofp-to-graph: ' + |
| 456 | str(deltaOfpGraph6) + ' ms') |
| 457 | if deltaGraph7 > thresholdMin and \ |
| 458 | deltaGraph7 < thresholdMax and i >= iterIgnore: |
| 459 | endToEndLatNodeIter[6][i] = deltaGraph7 |
| 460 | main.log.info('ONOS7 iter' + str(i) + |
| 461 | ' end-to-end: ' + |
| 462 | str(deltaGraph7) + ' ms') |
| 463 | if deltaOfpDevice7 > thresholdMin and\ |
| 464 | deltaOfpDevice7 < thresholdMax and i >= iterIgnore: |
| 465 | ofpToDeviceLatNodeIter[6][i] = deltaOfpDevice7 |
| 466 | main.log.info('ONOS7 iter' + str(i) + |
| 467 | ' ofp-to-device: ' + |
| 468 | str(deltaOfpDevice7)) |
| 469 | if deltaOfpGraph7 > thresholdMin and \ |
| 470 | deltaOfpGraph7 < thresholdMax and i >= iterIgnore: |
| 471 | ofpToGraphLatNodeIter[6][i] = deltaOfpGraph7 |
| 472 | main.log.info('ONOS7 iter' + str(i) + |
| 473 | ' ofp-to-graph: ' + |
| 474 | str(deltaOfpGraph7) + ' ms') |
| 475 | |
| 476 | time.sleep(5) |
| 477 | |
| 478 | # Get device id to remove |
| 479 | deviceIdJsonStr = main.ONOS1cli.devices() |
| 480 | |
| 481 | main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) ) |
| 482 | deviceId = json.loads(deviceIdJsonStr) |
| 483 | |
| 484 | deviceList = [] |
| 485 | for device in deviceId: |
| 486 | deviceList.append(device['id']) |
| 487 | |
| 488 | main.step('Remove switch from controller') |
| 489 | main.Mininet1.deleteSwController('s3') |
| 490 | |
| 491 | #firstDevice = deviceList[0] |
| 492 | firstDevice = "of:0000000000000003" |
| 493 | main.log.info( "Removing device " +str(firstDevice)+ |
| 494 | " from ONOS" ) |
| 495 | #if deviceId: |
| 496 | main.ONOS1cli.deviceRemove(firstDevice) |
| 497 | |
| 498 | time.sleep(5) |
| 499 | |
| 500 | endToEndAvg = 0 |
| 501 | ofpToGraphAvg = 0 |
| 502 | endToEndList = [] |
| 503 | ofpToGraphList = [] |
| 504 | ofpToDeviceList = [] |
| 505 | dbCmdList = [] |
| 506 | for node in range(0, clusterCount): |
| 507 | for item in endToEndLatNodeIter[node]: |
| 508 | if item > 0.0: |
| 509 | endToEndList.append(item) |
| 510 | |
| 511 | for item in ofpToGraphLatNodeIter[node]: |
| 512 | if item > 0.0: |
| 513 | ofpToGraphList.append(item) |
| 514 | |
| 515 | for item in ofpToDeviceLatNodeIter[node]: |
| 516 | if item > 0.0: |
| 517 | ofpToDeviceList.append(item) |
| 518 | |
| 519 | endToEndAvg = round(numpy.mean(endToEndList), 2) |
| 520 | ofpToGraphAvg = round(numpy.mean(ofpToGraphList), 2) |
| 521 | endToEndStd = round(numpy.std(endToEndList), 2) |
| 522 | ofpToGraphStd = round(numpy.std(ofpToGraphList), 2) |
| 523 | ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2) |
| 524 | ofpToDeviceStd = round(numpy.std(ofpToDeviceList), 2) |
| 525 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
| 526 | main.log.report(' End-to-end Avg: ' + str(endToEndAvg) + |
| 527 | ' ms' + ' End-to-end Std dev: ' + |
| 528 | str(endToEndStd) + ' ms') |
| 529 | main.log.report(' Ofp-to-graph Avg: ' + str(ofpToGraphAvg) + |
| 530 | ' ms' + ' Ofp-to-graph Std dev: ' + |
| 531 | str(ofpToGraphStd) + ' ms') |
| 532 | main.log.report(' Ofp-to-device Avg: ' + str(ofpToDeviceAvg) + |
| 533 | ' ms' + ' Ofp-to-device Std dev: ' + |
| 534 | str(ofpToDeviceStd) + ' ms') |
| 535 | dbCmdList.append( |
| 536 | "INSERT INTO switch_latency_tests VALUES('" + |
| 537 | timeToPost + "','switch_latency_results'," + |
| 538 | runNum + ',' + str(clusterCount) + ",'baremetal" + |
| 539 | str(node + 1) + "'," + str(endToEndAvg) + ',' + |
| 540 | str(endToEndStd) + ',0,0);') |
| 541 | |
| 542 | if debugMode == 'on': |
| 543 | main.ONOS1.cpLogsToDir('/opt/onos/log/karaf.log', |
| 544 | '/tmp/', copyFileName='sw_lat_karaf') |
| 545 | fResult = open(resultPath, 'a') |
| 546 | for line in dbCmdList: |
| 547 | if line: |
| 548 | fResult.write(line + '\n') |
| 549 | |
| 550 | fResult.close() |
| 551 | assertion = main.TRUE |
| 552 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 553 | onpass='Switch latency test successful', |
| 554 | onfail='Switch latency test failed') |
| 555 | |
| 556 | def CASE3(self, main): |
| 557 | """ |
| 558 | Bring port up / down and measure latency. |
| 559 | Port enable / disable is simulated by ifconfig up / down |
| 560 | |
| 561 | In ONOS-next, we must ensure that the port we are |
| 562 | manipulating is connected to another switch with a valid |
| 563 | connection. Otherwise, graph view will not be updated. |
| 564 | """ |
| 565 | global timeToPost |
| 566 | import time |
| 567 | import subprocess |
| 568 | import os |
| 569 | import requests |
| 570 | import json |
| 571 | import numpy |
| 572 | ONOS1Ip = main.params['CTRL']['ip1'] |
| 573 | ONOS2Ip = main.params['CTRL']['ip2'] |
| 574 | ONOS3Ip = main.params['CTRL']['ip3'] |
| 575 | ONOSUser = main.params['CTRL']['user'] |
| 576 | defaultSwPort = main.params['CTRL']['port1'] |
| 577 | assertion = main.TRUE |
| 578 | numIter = main.params['TEST']['numIter'] |
| 579 | iterIgnore = int(main.params['TEST']['iterIgnore']) |
| 580 | deviceTimestamp = main.params['JSON']['deviceTimestamp'] |
| 581 | graphTimestamp = main.params['JSON']['graphTimestamp'] |
| 582 | linkTimestamp = main.params['JSON']['linkTimestamp'] |
| 583 | |
| 584 | tsharkPortUp = '/tmp/tshark_port_up.txt' |
| 585 | tsharkPortDown = '/tmp/tshark_port_down.txt' |
| 586 | tsharkPortStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ] |
| 587 | |
| 588 | debugMode = main.params['TEST']['debugMode'] |
| 589 | postToDB = main.params['DB']['postToDB'] |
| 590 | resultPath = main.params['DB']['portEventResultPath'] |
| 591 | timeToPost = time.strftime('%Y-%m-%d %H:%M:%S') |
| 592 | localTime = time.strftime('%x %X') |
| 593 | localTime = localTime.replace('/', '') |
| 594 | localTime = localTime.replace(' ', '_') |
| 595 | localTime = localTime.replace(':', '') |
| 596 | |
| 597 | if debugMode == 'on': |
| 598 | main.ONOS1.tsharkPcap('eth0', '/tmp/port_lat_pcap_' + localTime) |
| 599 | |
| 600 | upThresholdStr = main.params['TEST']['portUpThreshold'] |
| 601 | downThresholdStr = main.params['TEST']['portDownThreshold'] |
| 602 | upThresholdObj = upThresholdStr.split(',') |
| 603 | downThresholdObj = downThresholdStr.split(',') |
| 604 | upThresholdMin = int(upThresholdObj[0]) |
| 605 | upThresholdMax = int(upThresholdObj[1]) |
| 606 | downThresholdMin = int(downThresholdObj[0]) |
| 607 | downThresholdMax = int(downThresholdObj[1]) |
| 608 | |
| 609 | interfaceConfig = 's1-eth1' |
| 610 | main.log.report('Port enable / disable latency') |
| 611 | main.log.report('Simulated by ifconfig up / down') |
| 612 | main.log.report('Total iterations of test: ' + str(numIter)) |
| 613 | main.step('Assign switches s1 and s2 to controller 1') |
| 614 | |
| 615 | main.Mininet1.assignSwController(sw='1', |
| 616 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 617 | main.Mininet1.assignSwController(sw='2', |
| 618 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 619 | |
| 620 | time.sleep(15) |
| 621 | |
| 622 | portUpDeviceToOfpList = [] |
| 623 | portUpGraphToOfpList = [] |
| 624 | portDownDeviceToOfpList = [] |
| 625 | portDownGraphToOfpList = [] |
| 626 | |
| 627 | portUpDevNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 628 | portUpGraphNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 629 | portUpLinkLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 630 | portDownDevNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 631 | portDownGraphNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 632 | portDownLinkNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 633 | portUpLinkNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 634 | |
| 635 | for i in range(0, int(numIter)): |
| 636 | main.step('Starting wireshark capture for port status down') |
| 637 | main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortDown) |
| 638 | time.sleep(5) |
| 639 | main.step('Disable port: ' + interfaceConfig) |
| 640 | main.Mininet1.handle.sendline('sh ifconfig ' + |
| 641 | interfaceConfig + ' down') |
| 642 | main.Mininet1.handle.expect('mininet>') |
| 643 | time.sleep(3) |
| 644 | main.ONOS1.tsharkStop() |
| 645 | os.system('scp ' + ONOSUser + '@' + ONOS1Ip + ':' + |
| 646 | tsharkPortDown + ' /tmp/') |
| 647 | fPortDown = open(tsharkPortDown, 'r') |
| 648 | fLine = fPortDown.readline() |
| 649 | objDown = fLine.split(' ') |
| 650 | if len(fLine) > 0: |
| 651 | timestampBeginPtDown = int(float(objDown[1]) * 1000) |
| 652 | if timestampBeginPtDown < 1400000000000: |
| 653 | timestampBeginPtDown = int(float(objDown[2]) * 1000) |
| 654 | main.log.info('Port down begin timestamp: ' + |
| 655 | str(timestampBeginPtDown)) |
| 656 | else: |
| 657 | main.log.info('Tshark output file returned unexpected' + |
| 658 | ' results: ' + str(objDown)) |
| 659 | timestampBeginPtDown = 0 |
| 660 | fPortDown.close() |
| 661 | |
| 662 | main.step('Obtain t1 by metrics call') |
| 663 | |
| 664 | jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics() |
| 665 | jsonObj1 = json.loads(jsonStrUp1) |
| 666 | graphTimestamp1 = jsonObj1[graphTimestamp]['value'] |
| 667 | deviceTimestamp1 = jsonObj1[deviceTimestamp]['value'] |
| 668 | linkTimestamp1 = jsonObj1[linkTimestamp]['value'] |
| 669 | ptDownGraphToOfp1 = int(graphTimestamp1) - int(timestampBeginPtDown) |
| 670 | ptDownDeviceToOfp1 = int(deviceTimestamp1) - int(timestampBeginPtDown) |
| 671 | ptDownLinkToOfp1 = int(linkTimestamp1) - int(timestampBeginPtDown) |
| 672 | |
| 673 | if ptDownGraphToOfp1 > downThresholdMin and\ |
| 674 | ptDownGraphToOfp1 < downThresholdMax and i > iterIgnore: |
| 675 | portDownGraphNodeIter[0][i] = ptDownGraphToOfp1 |
| 676 | main.log.info('ONOS1 iter' + str(i) + |
| 677 | ' port down graph-to-ofp: ' + |
| 678 | str(ptDownGraphToOfp1) + ' ms') |
| 679 | else: |
| 680 | main.log.info('ONOS1 iter' + str(i) + |
| 681 | ' skipped. Result: ' + |
| 682 | str(ptDownGraphToOfp1) + ' ms') |
| 683 | if ptDownDeviceToOfp1 > downThresholdMin and \ |
| 684 | ptDownDeviceToOfp1 < downThresholdMax and i > iterIgnore: |
| 685 | portDownDevNodeIter[0][i] = ptDownDeviceToOfp1 |
| 686 | main.log.info('ONOS1 iter' + str(i) + |
| 687 | ' port down device-to-ofp: ' + |
| 688 | str(ptDownDeviceToOfp1) + ' ms') |
| 689 | else: |
| 690 | main.log.info('ONOS1 iter' + str(i) + |
| 691 | ' skipped. Result: ' + |
| 692 | str(ptDownDeviceToOfp1) + ' ms') |
| 693 | if ptDownLinkToOfp1 > downThresholdMin and\ |
| 694 | ptDownLinkToOfp1 < downThresholdMax and i > iterIgnore: |
| 695 | portDownLinkNodeIter[0][i] = ptDownLinkToOfp1 |
| 696 | main.log.info('ONOS1 iter' + str(i) + |
| 697 | ' port down link-to-ofp: ' + |
| 698 | str(ptDownLinkToOfp1) + ' ms') |
| 699 | else: |
| 700 | main.log.info('ONOS1 Link-to-ofp skipped. Result: ' + |
| 701 | str(ptDownLinkToOfp1) + ' ms') |
| 702 | if clusterCount >= 3: |
| 703 | jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics() |
| 704 | jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics() |
| 705 | jsonObj2 = json.loads(jsonStrUp2) |
| 706 | jsonObj3 = json.loads(jsonStrUp3) |
| 707 | graphTimestamp2 = jsonObj2[graphTimestamp]['value'] |
| 708 | graphTimestamp3 = jsonObj3[graphTimestamp]['value'] |
| 709 | deviceTimestamp2 = jsonObj2[deviceTimestamp]['value'] |
| 710 | deviceTimestamp3 = jsonObj3[deviceTimestamp]['value'] |
| 711 | linkTimestamp2 = jsonObj2[linkTimestamp]['value'] |
| 712 | linkTimestamp3 = jsonObj3[linkTimestamp]['value'] |
| 713 | ptDownGraphToOfp2 = int(graphTimestamp2) - int(timestampBeginPtDown) |
| 714 | ptDownGraphToOfp3 = int(graphTimestamp3) - int(timestampBeginPtDown) |
| 715 | ptDownDeviceToOfp2 = int(deviceTimestamp2) - int(timestampBeginPtDown) |
| 716 | ptDownDeviceToOfp3 = int(deviceTimestamp3) - int(timestampBeginPtDown) |
| 717 | ptDownLinkToOfp2 = int(linkTimestamp2) - int(timestampBeginPtDown) |
| 718 | ptDownLinkToOfp3 = int(linkTimestamp3) - int(timestampBeginPtDown) |
| 719 | if ptDownGraphToOfp2 > downThresholdMin and\ |
| 720 | ptDownGraphToOfp2 < downThresholdMax and i > iterIgnore: |
| 721 | portDownGraphNodeIter[1][i] = ptDownGraphToOfp2 |
| 722 | main.log.info('ONOS2 iter' + str(i) + |
| 723 | ' graph-to-ofp: ' + |
| 724 | str(ptDownGraphToOfp2) + ' ms') |
| 725 | if ptDownDeviceToOfp2 > downThresholdMin and \ |
| 726 | ptDownDeviceToOfp2 < downThresholdMax and i > iterIgnore: |
| 727 | portDownDevNodeIter[1][i] = ptDownDeviceToOfp2 |
| 728 | main.log.info('ONOS2 iter' + str(i) + |
| 729 | ' device-to-ofp: ' + |
| 730 | str(ptDownDeviceToOfp2) + ' ms') |
| 731 | if ptDownLinkToOfp2 > downThresholdMin and\ |
| 732 | ptDownLinkToOfp2 < downThresholdMax and i > iterIgnore: |
| 733 | portDownLinkNodeIter[1][i] = ptDownLinkToOfp2 |
| 734 | main.log.info('ONOS2 iter' + str(i) + |
| 735 | ' link-to-ofp: ' + |
| 736 | str(ptDownLinkToOfp2) + ' ms') |
| 737 | if ptDownGraphToOfp3 > downThresholdMin and\ |
| 738 | ptDownGraphToOfp3 < downThresholdMax and i > iterIgnore: |
| 739 | portDownGraphNodeIter[2][i] = ptDownGraphToOfp3 |
| 740 | main.log.info('ONOS3 iter' + str(i) + |
| 741 | ' graph-to-ofp: ' + |
| 742 | str(ptDownGraphToOfp3) + ' ms') |
| 743 | if ptDownDeviceToOfp3 > downThresholdMin and\ |
| 744 | ptDownDeviceToOfp3 < downThresholdMax and i > iterIgnore: |
| 745 | portDownDevNodeIter[2][i] = ptDownDeviceToOfp3 |
| 746 | main.log.info('ONOS3 iter' + str(i) + |
| 747 | ' device-to-ofp: ' + |
| 748 | str(ptDownDeviceToOfp3) + ' ms') |
| 749 | if ptDownLinkToOfp3 > downThresholdMin and\ |
| 750 | ptDownLinkToOfp3 < downThresholdMax and i > iterIgnore: |
| 751 | portDownLinkNodeIter[2][i] = ptDownLinkToOfp3 |
| 752 | main.log.info('ONOS3 iter' + str(i) + |
| 753 | ' link-to-ofp: ' + |
| 754 | str(ptDownLinkToOfp3) + ' ms') |
| 755 | if clusterCount >= 5: |
| 756 | jsonStrUp4 = main.ONOS4cli.topologyEventsMetrics() |
| 757 | jsonStrUp5 = main.ONOS5cli.topologyEventsMetrics() |
| 758 | jsonObj4 = json.loads(jsonStrUp4) |
| 759 | jsonObj5 = json.loads(jsonStrUp5) |
| 760 | graphTimestamp4 = jsonObj4[graphTimestamp]['value'] |
| 761 | graphTimestamp5 = jsonObj5[graphTimestamp]['value'] |
| 762 | deviceTimestamp4 = jsonObj4[deviceTimestamp]['value'] |
| 763 | deviceTimestamp5 = jsonObj5[deviceTimestamp]['value'] |
| 764 | linkTimestamp4 = jsonObj4[linkTimestamp]['value'] |
| 765 | linkTimestamp5 = jsonObj5[linkTimestamp]['value'] |
| 766 | ptDownGraphToOfp4 = int(graphTimestamp4) - int(timestampBeginPtDown) |
| 767 | ptDownGraphToOfp5 = int(graphTimestamp5) - int(timestampBeginPtDown) |
| 768 | ptDownDeviceToOfp4 = int(deviceTimestamp4) - int(timestampBeginPtDown) |
| 769 | ptDownDeviceToOfp5 = int(deviceTimestamp5) - int(timestampBeginPtDown) |
| 770 | ptDownLinkToOfp4 = int(linkTimestamp4) - int(timestampBeginPtDown) |
| 771 | ptDownLinkToOfp5 = int(linkTimestamp5) - int(timestampBeginPtDown) |
| 772 | if ptDownGraphToOfp4 > downThresholdMin and \ |
| 773 | ptDownGraphToOfp4 < downThresholdMax and i > iterIgnore: |
| 774 | portDownGraphNodeIter[3][i] = ptDownGraphToOfp4 |
| 775 | main.log.info('ONOS4 iter' + str(i) + |
| 776 | ' graph-to-ofp: ' + |
| 777 | str(ptDownGraphToOfp4) + ' ms') |
| 778 | if ptDownDeviceToOfp4 > downThresholdMin and\ |
| 779 | ptDownDeviceToOfp4 < downThresholdMax and i > iterIgnore: |
| 780 | portDownDevNodeIter[3][i] = ptDownDeviceToOfp4 |
| 781 | main.log.info('ONOS4 iter' + str(i) + |
| 782 | ' device-to-ofp: ' + |
| 783 | str(ptDownDeviceToOfp4) + ' ms') |
| 784 | if ptDownLinkToOfp4 > downThresholdMin and\ |
| 785 | ptDownLinkToOfp4 < downThresholdMax and i > iterIgnore: |
| 786 | portDownLinkNodeIter[3][i] = ptDownLinkToOfp4 |
| 787 | main.log.info('ONOS4 iter' + str(i) + |
| 788 | ' link-to-ofp: ' + |
| 789 | str(ptDownLinkToOfp4) + ' ms') |
| 790 | if ptDownGraphToOfp5 > downThresholdMin and\ |
| 791 | ptDownGraphToOfp5 < downThresholdMax and i > iterIgnore: |
| 792 | portDownGraphNodeIter[4][i] = ptDownGraphToOfp5 |
| 793 | main.log.info('ONOS5 iter' + str(i) + |
| 794 | ' graph-to-ofp: ' + |
| 795 | str(ptDownGraphToOfp5) + ' ms') |
| 796 | if ptDownDeviceToOfp5 > downThresholdMin and\ |
| 797 | ptDownDeviceToOfp5 < downThresholdMax and i > iterIgnore: |
| 798 | portDownDevNodeIter[4][i] = ptDownDeviceToOfp5 |
| 799 | main.log.info('ONOS5 iter' + str(i) + |
| 800 | ' device-to-ofp: ' + |
| 801 | str(ptDownDeviceToOfp5) + ' ms') |
| 802 | if ptDownLinkToOfp5 > downThresholdMin and\ |
| 803 | ptDownLinkToOfp5 < downThresholdMax and i > iterIgnore: |
| 804 | portDownLinkNodeIter[4][i] = ptDownLinkToOfp5 |
| 805 | main.log.info('ONOS5 iter' + str(i) + |
| 806 | ' link-to-ofp: ' + |
| 807 | str(ptDownLinkToOfp5) + ' ms') |
| 808 | if clusterCount >= 7: |
| 809 | jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics() |
| 810 | jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics() |
| 811 | jsonObj6 = json.loads(jsonStrUp6) |
| 812 | jsonObj7 = json.loads(jsonStrUp7) |
| 813 | graphTimestamp6 = jsonObj6[graphTimestamp]['value'] |
| 814 | graphTimestamp7 = jsonObj7[graphTimestamp]['value'] |
| 815 | deviceTimestamp6 = jsonObj6[deviceTimestamp]['value'] |
| 816 | deviceTimestamp7 = jsonObj7[deviceTimestamp]['value'] |
| 817 | linkTimestamp6 = jsonObj6[linkTimestamp]['value'] |
| 818 | linkTimestamp7 = jsonObj7[linkTimestamp]['value'] |
| 819 | ptDownGraphToOfp6 = int(graphTimestamp6) - int(timestampBeginPtDown) |
| 820 | ptDownGraphToOfp7 = int(graphTimestamp7) - int(timestampBeginPtDown) |
| 821 | ptDownDeviceToOfp6 = int(deviceTimestamp6) - int(timestampBeginPtDown) |
| 822 | ptDownDeviceToOfp7 = int(deviceTimestamp7) - int(timestampBeginPtDown) |
| 823 | ptDownLinkToOfp6 = int(linkTimestamp6) - int(timestampBeginPtDown) |
| 824 | ptDownLinkToOfp7 = int(linkTimestamp7) - int(timestampBeginPtDown) |
| 825 | if ptDownGraphToOfp6 > downThresholdMin and\ |
| 826 | ptDownGraphToOfp6 < downThresholdMax and i > iterIgnore: |
| 827 | portDownGraphNodeIter[5][i] = ptDownGraphToOfp6 |
| 828 | main.log.info('ONOS6 iter' + str(i) + |
| 829 | ' graph-to-ofp: ' + |
| 830 | str(ptDownGraphToOfp6) + ' ms') |
| 831 | if ptDownDeviceToOfp6 > downThresholdMin and\ |
| 832 | ptDownDeviceToOfp6 < downThresholdMax and i > iterIgnore: |
| 833 | portDownDevNodeIter[5][i] = ptDownDeviceToOfp6 |
| 834 | main.log.info('ONOS6 iter' + str(i) + |
| 835 | ' device-to-ofp: ' + |
| 836 | str(ptDownDeviceToOfp6) + ' ms') |
| 837 | if ptDownLinkToOfp6 > downThresholdMin and\ |
| 838 | ptDownLinkToOfp6 < downThresholdMax and i > iterIgnore: |
| 839 | portDownLinkNodeIter[5][i] = ptDownLinkToOfp6 |
| 840 | main.log.info('ONOS6 iter' + str(i) + |
| 841 | ' link-to-ofp: ' + |
| 842 | str(ptDownLinkToOfp6) + ' ms') |
| 843 | if ptDownGraphToOfp7 > downThresholdMin and\ |
| 844 | ptDownGraphToOfp7 < downThresholdMax and i > iterIgnore: |
| 845 | portDownGraphNodeIter[6][i] = ptDownGraphToOfp7 |
| 846 | main.log.info('ONOS7 iter' + str(i) + |
| 847 | ' graph-to-ofp: ' + |
| 848 | str(ptDownGraphToOfp7) + ' ms') |
| 849 | if ptDownDeviceToOfp7 > downThresholdMin and\ |
| 850 | ptDownDeviceToOfp7 < downThresholdMax and i > iterIgnore: |
| 851 | portDownDevNodeIter[6][i] = ptDownDeviceToOfp7 |
| 852 | main.log.info('ONOS7 iter' + str(i) + |
| 853 | ' device-to-ofp: ' + |
| 854 | str(ptDownDeviceToOfp7) + ' ms') |
| 855 | if ptDownLinkToOfp7 > downThresholdMin and\ |
| 856 | ptDownLinkToOfp7 < downThresholdMax and i > iterIgnore: |
| 857 | portDownLinkNodeIter[6][i] = ptDownLinkToOfp7 |
| 858 | main.log.info('ONOS7 iter' + str(i) + |
| 859 | ' link-to-ofp: ' + |
| 860 | str(ptDownLinkToOfp7) + ' ms') |
| 861 | |
| 862 | time.sleep(3) |
| 863 | |
| 864 | main.step('Starting wireshark capture for port status up') |
| 865 | main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortUp) |
| 866 | |
| 867 | time.sleep(5) |
| 868 | main.step('Enable port and obtain timestamp') |
| 869 | main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up') |
| 870 | main.Mininet1.handle.expect('mininet>') |
| 871 | |
| 872 | time.sleep(5) |
| 873 | main.ONOS1.tsharkStop() |
| 874 | |
| 875 | time.sleep(3) |
| 876 | os.system('scp ' + ONOSUser + '@' + |
| 877 | ONOS1Ip + ':' + tsharkPortUp + ' /tmp/') |
| 878 | |
| 879 | fPortUp = open(tsharkPortUp, 'r') |
| 880 | fLine = fPortUp.readline() |
| 881 | objUp = fLine.split(' ') |
| 882 | if len(fLine) > 0: |
| 883 | timestampBeginPtUp = int(float(objUp[1]) * 1000) |
| 884 | if timestampBeginPtUp < 1400000000000: |
| 885 | timestampBeginPtUp = int(float(objUp[2]) * 1000) |
| 886 | main.log.info('Port up begin timestamp: ' + str(timestampBeginPtUp)) |
| 887 | else: |
| 888 | main.log.info('Tshark output file returned unexpected' + ' results.') |
| 889 | timestampBeginPtUp = 0 |
| 890 | fPortUp.close() |
| 891 | main.step('Obtain t1 by REST call') |
| 892 | jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics() |
| 893 | jsonObj1 = json.loads(jsonStrUp1) |
| 894 | graphTimestamp1 = jsonObj1[graphTimestamp]['value'] |
| 895 | deviceTimestamp1 = jsonObj1[deviceTimestamp]['value'] |
| 896 | linkTimestamp1 = jsonObj1[linkTimestamp]['value'] |
| 897 | ptUpGraphToOfp1 = int(graphTimestamp1) - int(timestampBeginPtUp) |
| 898 | ptUpDeviceToOfp1 = int(deviceTimestamp1) - int(timestampBeginPtUp) |
| 899 | ptUpLinkToOfp1 = int(linkTimestamp1) - int(timestampBeginPtUp) |
| 900 | if ptUpGraphToOfp1 > upThresholdMin and\ |
| 901 | ptUpGraphToOfp1 < upThresholdMax and i > iterIgnore: |
| 902 | portUpGraphNodeIter[0][i] = ptUpGraphToOfp1 |
| 903 | main.log.info('ONOS1 iter' + str(i) + |
| 904 | ' port up graph-to-ofp: ' + |
| 905 | str(ptUpGraphToOfp1) + ' ms') |
| 906 | else: |
| 907 | main.log.info('ONOS1 iter' + str(i) + |
| 908 | ' skipped. Result: ' + |
| 909 | str(ptUpGraphToOfp1) + ' ms') |
| 910 | if ptUpDeviceToOfp1 > upThresholdMin and \ |
| 911 | ptUpDeviceToOfp1 < upThresholdMax and i > iterIgnore: |
| 912 | portUpDevNodeIter[0][i] = ptUpDeviceToOfp1 |
| 913 | main.log.info('ONOS1 iter' + str(i) + |
| 914 | ' port up device-to-ofp: ' + |
| 915 | str(ptUpDeviceToOfp1) + ' ms') |
| 916 | else: |
| 917 | main.log.info('ONOS1 iter' + str(i) + |
| 918 | ' skipped. Result: ' + |
| 919 | str(ptUpDeviceToOfp1) + ' ms') |
| 920 | if ptUpLinkToOfp1 > downThresholdMin and\ |
| 921 | ptUpLinkToOfp1 < downThresholdMax and i > iterIgnore: |
| 922 | portUpLinkNodeIter[0][i] = ptUpLinkToOfp1 |
| 923 | main.log.info('ONOS1 iter' + str(i) + |
| 924 | ' link-to-ofp: ' + |
| 925 | str(ptUpLinkToOfp1) + ' ms') |
| 926 | if clusterCount >= 3: |
| 927 | jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics() |
| 928 | jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics() |
| 929 | jsonObj2 = json.loads(jsonStrUp2) |
| 930 | jsonObj3 = json.loads(jsonStrUp3) |
| 931 | graphTimestamp2 = jsonObj2[graphTimestamp]['value'] |
| 932 | graphTimestamp3 = jsonObj3[graphTimestamp]['value'] |
| 933 | deviceTimestamp2 = jsonObj2[deviceTimestamp]['value'] |
| 934 | deviceTimestamp3 = jsonObj3[deviceTimestamp]['value'] |
| 935 | linkTimestamp2 = jsonObj2[linkTimestamp]['value'] |
| 936 | linkTimestamp3 = jsonObj3[linkTimestamp]['value'] |
| 937 | ptUpGraphToOfp2 = int(graphTimestamp2) - int(timestampBeginPtUp) |
| 938 | ptUpGraphToOfp3 = int(graphTimestamp3) - int(timestampBeginPtUp) |
| 939 | ptUpDeviceToOfp2 = int(deviceTimestamp2) - int(timestampBeginPtUp) |
| 940 | ptUpDeviceToOfp3 = int(deviceTimestamp3) - int(timestampBeginPtUp) |
| 941 | ptUpLinkToOfp2 = int(linkTimestamp2) - int(timestampBeginPtUp) |
| 942 | ptUpLinkToOfp3 = int(linkTimestamp3) - int(timestampBeginPtUp) |
| 943 | if ptUpGraphToOfp2 > upThresholdMin and\ |
| 944 | ptUpGraphToOfp2 < upThresholdMax and i > iterIgnore: |
| 945 | portUpGraphNodeIter[1][i] = ptUpGraphToOfp2 |
| 946 | main.log.info('ONOS2 iter' + str(i) + |
| 947 | ' port up graph-to-ofp: ' + |
| 948 | str(ptUpGraphToOfp2) + ' ms') |
| 949 | if ptUpDeviceToOfp2 > upThresholdMin and\ |
| 950 | ptUpDeviceToOfp2 < upThresholdMax and i > iterIgnore: |
| 951 | portUpDevNodeIter[1][i] = ptUpDeviceToOfp2 |
| 952 | main.log.info('ONOS2 iter' + str(i) + |
| 953 | ' port up device-to-ofp: ' + |
| 954 | str(ptUpDeviceToOfp2) + ' ms') |
| 955 | if ptUpLinkToOfp2 > downThresholdMin and\ |
| 956 | ptUpLinkToOfp2 < downThresholdMax and i > iterIgnore: |
| 957 | portUpLinkNodeIter[1][i] = ptUpLinkToOfp2 |
| 958 | main.log.info('ONOS2 iter' + str(i) + |
| 959 | ' port up link-to-ofp: ' + |
| 960 | str(ptUpLinkToOfp2) + ' ms') |
| 961 | if ptUpGraphToOfp3 > upThresholdMin and\ |
| 962 | ptUpGraphToOfp3 < upThresholdMax and i > iterIgnore: |
| 963 | portUpGraphNodeIter[2][i] = ptUpGraphToOfp3 |
| 964 | main.log.info('ONOS3 iter' + str(i) + |
| 965 | ' port up graph-to-ofp: ' + |
| 966 | str(ptUpGraphToOfp3) + ' ms') |
| 967 | if ptUpDeviceToOfp3 > upThresholdMin and\ |
| 968 | ptUpDeviceToOfp3 < upThresholdMax and i > iterIgnore: |
| 969 | portUpDevNodeIter[2][i] = ptUpDeviceToOfp3 |
| 970 | main.log.info('ONOS3 iter' + str(i) + |
| 971 | ' port up device-to-ofp: ' + |
| 972 | str(ptUpDeviceToOfp3) + ' ms') |
| 973 | if ptUpLinkToOfp3 > downThresholdMin and\ |
| 974 | ptUpLinkToOfp3 < downThresholdMax and i > iterIgnore: |
| 975 | portUpLinkNodeIter[2][i] = ptUpLinkToOfp3 |
| 976 | main.log.info('ONOS3 iter' + str(i) + |
| 977 | ' port up link-to-ofp: ' + |
| 978 | str(ptUpLinkToOfp3) + ' ms') |
| 979 | if clusterCount >= 5: |
| 980 | jsonStrUp4 = main.ONOS4cli.topologyEventsMetrics() |
| 981 | jsonStrUp5 = main.ONOS5cli.topologyEventsMetrics() |
| 982 | jsonObj4 = json.loads(jsonStrUp4) |
| 983 | jsonObj5 = json.loads(jsonStrUp5) |
| 984 | graphTimestamp4 = jsonObj4[graphTimestamp]['value'] |
| 985 | graphTimestamp5 = jsonObj5[graphTimestamp]['value'] |
| 986 | deviceTimestamp4 = jsonObj4[deviceTimestamp]['value'] |
| 987 | deviceTimestamp5 = jsonObj5[deviceTimestamp]['value'] |
| 988 | linkTimestamp4 = jsonObj4[linkTimestamp]['value'] |
| 989 | linkTimestamp5 = jsonObj5[linkTimestamp]['value'] |
| 990 | ptUpGraphToOfp4 = int(graphTimestamp4) - int(timestampBeginPtUp) |
| 991 | ptUpGraphToOfp5 = int(graphTimestamp5) - int(timestampBeginPtUp) |
| 992 | ptUpDeviceToOfp4 = int(deviceTimestamp4) - int(timestampBeginPtUp) |
| 993 | ptUpDeviceToOfp5 = int(deviceTimestamp5) - int(timestampBeginPtUp) |
| 994 | ptUpLinkToOfp4 = int(linkTimestamp4) - int(timestampBeginPtUp) |
| 995 | ptUpLinkToOfp5 = int(linkTimestamp5) - int(timestampBeginPtUp) |
| 996 | if ptUpGraphToOfp4 > upThresholdMin and\ |
| 997 | ptUpGraphToOfp4 < upThresholdMax and i > iterIgnore: |
| 998 | portUpGraphNodeIter[3][i] = ptUpGraphToOfp4 |
| 999 | main.log.info('ONOS4 iter' + str(i) + |
| 1000 | ' port up graph-to-ofp: ' + |
| 1001 | str(ptUpGraphToOfp4) + ' ms') |
| 1002 | if ptUpDeviceToOfp4 > upThresholdMin and\ |
| 1003 | ptUpDeviceToOfp4 < upThresholdMax and i > iterIgnore: |
| 1004 | portUpDevNodeIter[3][i] = ptUpDeviceToOfp4 |
| 1005 | main.log.info('ONOS4 iter' + str(i) + |
| 1006 | ' port up device-to-ofp: ' + |
| 1007 | str(ptUpDeviceToOfp4) + ' ms') |
| 1008 | if ptUpGraphToOfp5 > upThresholdMin and\ |
| 1009 | ptUpGraphToOfp5 < upThresholdMax and i > iterIgnore: |
| 1010 | portUpGraphNodeIter[4][i] = ptUpGraphToOfp5 |
| 1011 | main.log.info('ONSO5 iter' + str(i) + |
| 1012 | ' port up graph-to-ofp: ' + |
| 1013 | str(ptUpGraphToOfp5) + ' ms') |
| 1014 | if ptUpDeviceToOfp5 > upThresholdMin and \ |
| 1015 | ptUpDeviceToOfp5 < upThresholdMax and i > iterIgnore: |
| 1016 | portUpDevNodeIter[4][i] = ptUpDeviceToOfp5 |
| 1017 | main.log.info('ONOS5 iter' + str(i) + |
| 1018 | ' port up device-to-ofp: ' + |
| 1019 | str(ptUpDeviceToOfp5) + ' ms') |
| 1020 | if clusterCount >= 7: |
| 1021 | jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics() |
| 1022 | jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics() |
| 1023 | jsonObj6 = json.loads(jsonStrUp6) |
| 1024 | jsonObj7 = json.loads(jsonStrUp7) |
| 1025 | graphTimestamp6 = jsonObj6[graphTimestamp]['value'] |
| 1026 | graphTimestamp7 = jsonObj7[graphTimestamp]['value'] |
| 1027 | deviceTimestamp6 = jsonObj6[deviceTimestamp]['value'] |
| 1028 | deviceTimestamp7 = jsonObj7[deviceTimestamp]['value'] |
| 1029 | ptUpGraphToOfp6 = int(graphTimestamp6) - int(timestampBeginPtUp) |
| 1030 | ptUpGraphToOfp7 = int(graphTimestamp7) - int(timestampBeginPtUp) |
| 1031 | ptUpDeviceToOfp6 = int(deviceTimestamp6) - int(timestampBeginPtUp) |
| 1032 | ptUpDeviceToOfp7 = int(deviceTimestamp7) - int(timestampBeginPtUp) |
| 1033 | if ptUpGraphToOfp6 > upThresholdMin and\ |
| 1034 | ptUpGraphToOfp6 < upThresholdMax and i > iterIgnore: |
| 1035 | portUpGraphNodeIter[5][i] = ptUpGraphToOfp6 |
| 1036 | main.log.info('iter' + str(i) + |
| 1037 | ' port up graph-to-ofp: ' + |
| 1038 | str(ptUpGraphToOfp6) + ' ms') |
| 1039 | if ptUpDeviceToOfp6 > upThresholdMin and\ |
| 1040 | ptUpDeviceToOfp6 < upThresholdMax and i > iterIgnore: |
| 1041 | portUpDevNodeIter[5][i] = ptUpDeviceToOfp6 |
| 1042 | main.log.info('iter' + str(i) + |
| 1043 | ' port up device-to-ofp: ' + |
| 1044 | str(ptUpDeviceToOfp6) + ' ms') |
| 1045 | if ptUpGraphToOfp7 > upThresholdMin and \ |
| 1046 | ptUpGraphToOfp7 < upThresholdMax and i > iterIgnore: |
| 1047 | portUpGraphNodeIter[6][i] = ptUpGraphToOfp7 |
| 1048 | main.log.info('iter' + str(i) + |
| 1049 | ' port up graph-to-ofp: ' + |
| 1050 | str(ptUpGraphToOfp7) + ' ms') |
| 1051 | if ptUpDeviceToOfp7 > upThresholdMin and\ |
| 1052 | ptUpDeviceToOfp7 < upThresholdMax and i > iterIgnore: |
| 1053 | portUpDevNodeIter[6][i] = ptUpDeviceToOfp7 |
| 1054 | main.log.info('iter' + str(i) + |
| 1055 | ' port up device-to-ofp: ' + |
| 1056 | str(ptUpDeviceToOfp7) + ' ms') |
| 1057 | |
| 1058 | dbCmdList = [] |
| 1059 | for node in range(0, clusterCount): |
| 1060 | portUpDevList = [] |
| 1061 | portUpGraphList = [] |
| 1062 | portDownDevList = [] |
| 1063 | portDownGraphList = [] |
| 1064 | portUpDevAvg = 0 |
| 1065 | portUpGraphAvg = 0 |
| 1066 | portDownDevAvg = 0 |
| 1067 | portDownGraphAvg = 0 |
| 1068 | for item in portUpDevNodeIter[node]: |
| 1069 | if item > 0.0: |
| 1070 | portUpDevList.append(item) |
| 1071 | |
| 1072 | for item in portUpGraphNodeIter[node]: |
| 1073 | if item > 0.0: |
| 1074 | portUpGraphList.append(item) |
| 1075 | |
| 1076 | for item in portDownDevNodeIter[node]: |
| 1077 | if item > 0.0: |
| 1078 | portDownDevList.append(item) |
| 1079 | |
| 1080 | for item in portDownGraphNodeIter[node]: |
| 1081 | if item > 0.0: |
| 1082 | portDownGraphList.append(item) |
| 1083 | |
| 1084 | portUpDevAvg = round(numpy.mean(portUpDevList), 2) |
| 1085 | portUpGraphAvg = round(numpy.mean(portUpGraphList), 2) |
| 1086 | portDownDevAvg = round(numpy.mean(portDownDevList), 2) |
| 1087 | portDownGraphAvg = round(numpy.mean(portDownGraphList), 2) |
| 1088 | portUpStdDev = round(numpy.std(portUpGraphList), 2) |
| 1089 | portDownStdDev = round(numpy.std(portDownGraphList), 2) |
| 1090 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
| 1091 | main.log.report(' Port up ofp-to-device ' + |
| 1092 | str(round(portUpDevAvg, 2)) + ' ms') |
| 1093 | main.log.report(' Port up ofp-to-graph ' + |
| 1094 | str(portUpGraphAvg) + ' ms') |
| 1095 | main.log.report(' Port down ofp-to-device ' + |
| 1096 | str(round(portDownDevAvg, 2)) + ' ms') |
| 1097 | main.log.report(' Port down ofp-to-graph ' + |
| 1098 | str(portDownGraphAvg) + ' ms') |
| 1099 | dbCmdList.append("INSERT INTO port_latency_tests VALUES('" + |
| 1100 | timeToPost + "','port_latency_results'," + runNum + |
| 1101 | ',' + str(clusterCount) + ",'baremetal" + str(node + 1) + |
| 1102 | "'," + str(portUpGraphAvg) + ',' + str(portUpStdDev) + |
| 1103 | '' + str(portDownGraphAvg) + ',' + str(portDownStdDev) + ');') |
| 1104 | |
| 1105 | fResult = open(resultPath, 'a') |
| 1106 | for line in dbCmdList: |
| 1107 | if line: |
| 1108 | fResult.write(line + '\n') |
| 1109 | |
| 1110 | fResult.close() |
| 1111 | main.Mininet1.deleteSwController('s1') |
| 1112 | main.Mininet1.deleteSwController('s2') |
| 1113 | utilities.assert_equals(expect=main.TRUE, |
| 1114 | actual=assertion, |
| 1115 | onpass='Port discovery latency calculation successful', |
| 1116 | onfail='Port discovery test failed') |
| 1117 | |
| 1118 | def CASE4(self, main): |
| 1119 | """ |
| 1120 | Increase number of nodes and initiate CLI |
| 1121 | |
| 1122 | With the most recent implementation, we need a method to |
| 1123 | ensure all ONOS nodes are killed, as well as redefine |
| 1124 | the cell files to ensure all nodes that will be used |
| 1125 | is in the cell file. Otherwise, exceptions will |
| 1126 | prohibit test from running successfully. |
| 1127 | |
| 1128 | 3/12/15 |
| 1129 | |
| 1130 | """ |
| 1131 | global clusterCount |
| 1132 | import time |
| 1133 | import os |
| 1134 | |
| 1135 | clusterCount += 2 |
| 1136 | |
| 1137 | benchIp = main.params[ 'BENCH' ][ 'ip' ] |
| 1138 | features = main.params[ 'ENV' ][ 'cellFeatures' ] |
| 1139 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 1140 | mininetIp = main.params[ 'MN' ][ 'ip1' ] |
| 1141 | |
| 1142 | main.log.report('Increasing cluster size to ' + str(clusterCount)) |
| 1143 | |
| 1144 | main.log.step( "Killing all ONOS processes before scale-out" ) |
| 1145 | |
| 1146 | for i in range( 1, 8 ): |
| 1147 | main.ONOSbench.onosDie( |
| 1148 | main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 1149 | main.ONOSbench.onosUninstall( |
| 1150 | main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 1151 | |
| 1152 | main.step( "Creating scale-out cell file" ) |
| 1153 | cellIp = [] |
| 1154 | for node in range( 1, clusterCount + 1 ): |
| 1155 | cellIp.append( main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1156 | |
| 1157 | main.log.info( "Cell Ip list: " + str(cellIp) ) |
| 1158 | main.ONOSbench.createCellFile( benchIp, cellName, mininetIp, |
| 1159 | str(features), *cellIp ) |
| 1160 | |
| 1161 | main.step( "Setting cell definition" ) |
| 1162 | main.ONOSbench.setCell(cellName) |
| 1163 | |
| 1164 | main.step( "Packaging cell definition" ) |
| 1165 | main.ONOSbench.onosPackage() |
| 1166 | |
| 1167 | #for node in range( 1, clusterCount + 1 ): |
| 1168 | # main.log.info( "Starting ONOS " +str(node)+ " at IP: "+ |
| 1169 | # main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1170 | # Concurrently install onos to avoid election timeouts |
| 1171 | # os.system("onos-install -f "+main.params[ 'CTRL' ][ 'ip'+str(node) ]+" &" ) |
| 1172 | |
| 1173 | #time.sleep( 30 ) |
| 1174 | |
| 1175 | for node in range( 1, clusterCount + 1 ): |
| 1176 | main.ONOSbench.onosInstall(node = main.params[ 'CTRL' ][ 'ip'+str(node) ]) |
| 1177 | time.sleep(10) |
| 1178 | exec "a = main.ONOS%scli.startOnosCli" %str(node) |
| 1179 | a(main.params[ 'CTRL' ][ 'ip'+str(node) ]) |
| 1180 | |
| 1181 | time.sleep(20) |
| 1182 | |
| 1183 | for node in range( 1, clusterCount + 1): |
| 1184 | for i in range( 2 ): |
| 1185 | isup = main.ONOSbench.isup( |
| 1186 | main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1187 | if isup: |
| 1188 | main.log.info( "ONOS "+str(node) + " is up\n") |
| 1189 | break |
| 1190 | if not isup: |
| 1191 | main.log.error( "ONOS "+str(node) + " did not start" ) |