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 |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 20 | global jenkinsBuildNumber |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 21 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 22 | import time |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 23 | import os |
| 24 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 25 | clusterCount = 1 |
| 26 | timeToPost = time.strftime('%Y-%m-%d %H:%M:%S') |
| 27 | runNum = time.strftime('%d%H%M%S') |
| 28 | cellName = main.params['ENV']['cellName'] |
| 29 | gitPull = main.params['GIT']['autoPull'] |
| 30 | checkoutBranch = main.params['GIT']['checkout'] |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 31 | |
| 32 | # Get jenkins build number from environment. |
| 33 | # This environment variable will only exist when |
| 34 | # triggered by a jenkins job |
| 35 | try: |
| 36 | jenkinsBuildNumber = str(os.environ['BUILD_NUMBER']) |
| 37 | main.log.report( 'Jenkins build number: ' + |
| 38 | jenkinsBuildNumber ) |
| 39 | except KeyError: |
| 40 | # Jenkins build number is also used in posting to DB |
| 41 | # If this test is not triggered by jenkins, give |
| 42 | # it the runNum variable instead, ensuring that |
| 43 | # the DB post will recognize it as a non-jenkins run |
| 44 | jenkinsBuildNumber = str(runNum) |
| 45 | main.log.info( 'Job is not run by jenkins. '+ |
| 46 | 'Build number set to: ' + jenkinsBuildNumber) |
| 47 | |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 48 | global CLIs |
| 49 | CLIs = [] |
| 50 | global nodes |
| 51 | nodes = [] |
| 52 | global nodeIpList |
| 53 | nodeIpList = [] |
| 54 | for i in range( 1, 8 ): |
| 55 | CLIs.append( getattr( main, 'ONOS' + str( i ) + 'cli' ) ) |
| 56 | nodes.append( getattr( main, 'ONOS' + str( i ) ) ) |
| 57 | nodeIpList.append( main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 58 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 59 | MN1Ip = main.params['MN']['ip1'] |
| 60 | BENCHIp = main.params['BENCH']['ip'] |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 61 | cellFeatures = main.params['ENV']['cellFeatures'] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 62 | topoCfgFile = main.params['TEST']['topoConfigFile'] |
| 63 | topoCfgName = main.params['TEST']['topoConfigName'] |
| 64 | portEventResultPath = main.params['DB']['portEventResultPath'] |
| 65 | switchEventResultPath = main.params['DB']['switchEventResultPath'] |
| 66 | mvnCleanInstall = main.params['TEST']['mci'] |
| 67 | |
| 68 | main.case('Setting up test environment') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 69 | |
| 70 | # NOTE: Below is deprecated after new way to install features |
| 71 | #main.log.info('Copying topology event accumulator config' + |
| 72 | # ' to ONOS /package/etc') |
| 73 | #main.ONOSbench.handle.sendline('cp ~/' + |
| 74 | # topoCfgFile + ' ~/ONOS/tools/package/etc/' + |
| 75 | # topoCfgName) |
| 76 | #main.ONOSbench.handle.expect('\\$') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 77 | |
| 78 | main.log.report('Setting up test environment') |
| 79 | |
| 80 | main.step('Starting mininet topology ') |
| 81 | main.Mininet1.startNet() |
| 82 | |
| 83 | main.step('Cleaning previously installed ONOS if any') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 84 | # Nodes 2 ~ 7 |
| 85 | for i in range( 1, 7 ): |
| 86 | main.ONOSbench.onosUninstall(nodeIp=nodeIpList[i]) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 87 | |
| 88 | main.step('Clearing previous DB log file') |
| 89 | |
| 90 | fPortLog = open(portEventResultPath, 'w') |
| 91 | fPortLog.write('') |
| 92 | fPortLog.close() |
| 93 | fSwitchLog = open(switchEventResultPath, 'w') |
| 94 | fSwitchLog.write('') |
| 95 | fSwitchLog.close() |
| 96 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 97 | main.step('Creating cell file') |
| 98 | cellFileResult = main.ONOSbench.createCellFile( |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 99 | BENCHIp, cellName, MN1Ip, cellFeatures, nodeIpList[0]) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 100 | |
| 101 | main.step('Applying cell file to environment') |
| 102 | cellApplyResult = main.ONOSbench.setCell(cellName) |
| 103 | verifyCellResult = main.ONOSbench.verifyCell() |
| 104 | |
| 105 | main.step('Git checkout and pull ' + checkoutBranch) |
| 106 | if gitPull == 'on': |
| 107 | checkoutResult = main.TRUE |
| 108 | pullResult = main.ONOSbench.gitPull() |
| 109 | else: |
| 110 | checkoutResult = main.TRUE |
| 111 | pullResult = main.TRUE |
| 112 | main.log.info('Skipped git checkout and pull') |
| 113 | |
| 114 | main.log.report('Commit information - ') |
| 115 | main.ONOSbench.getVersion(report=True) |
| 116 | main.step('Using mvn clean & install') |
| 117 | if mvnCleanInstall == 'on': |
| 118 | mvnResult = main.ONOSbench.cleanInstall() |
| 119 | elif mvnCleanInstall == 'off': |
| 120 | main.log.info('mci turned off by settings') |
| 121 | mvnResult = main.TRUE |
| 122 | main.step('Set cell for ONOS cli env') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 123 | CLIs[0].setCell(cellName) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 124 | |
| 125 | main.step('Creating ONOS package') |
| 126 | packageResult = main.ONOSbench.onosPackage() |
| 127 | |
| 128 | main.step('Installing ONOS package') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 129 | install1Result = main.ONOSbench.onosInstall(node=nodeIpList[0]) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 130 | |
| 131 | time.sleep(10) |
| 132 | |
| 133 | main.step('Start onos cli') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 134 | cli1 = CLIs[0].startOnosCli(nodeIpList[0]) |
| 135 | |
| 136 | main.step( 'activating essential applications' ) |
| 137 | CLIs[0].activateApp( 'org.onosproject.metrics' ) |
| 138 | CLIs[0].activateApp( 'org.onosproject.openflow' ) |
| 139 | |
| 140 | main.step( 'Configuring application parameters' ) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 141 | |
| 142 | configName = 'org.onosproject.net.topology.impl.DefaultTopologyProvider' |
| 143 | configParam = 'maxEvents 1' |
| 144 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 145 | configParam = 'maxBatchMs 0' |
| 146 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 147 | configParam = 'maxIdleMs 0' |
| 148 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 149 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 150 | utilities.assert_equals(expect=main.TRUE, |
| 151 | actual=cellFileResult and cellApplyResult and\ |
| 152 | verifyCellResult and checkoutResult and\ |
| 153 | pullResult and mvnResult and\ |
| 154 | install1Result, |
| 155 | onpass='Test Environment setup successful', |
| 156 | onfail='Failed to setup test environment') |
| 157 | |
| 158 | def CASE2(self, main): |
| 159 | """ |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 160 | Assign s3 to ONOS1 and measure latency |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 161 | |
| 162 | There are 4 levels of latency measurements to this test: |
| 163 | 1 ) End-to-end measurement: Complete end-to-end measurement |
| 164 | from TCP ( SYN/ACK ) handshake to Graph change |
| 165 | 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of |
| 166 | measurement from OFP Vendor message to Graph change |
| 167 | 3 ) OFP-to-device measurement: 'ONOS processing without |
| 168 | graph change' snippet of measurement from OFP vendor |
| 169 | message to Device change timestamp |
| 170 | 4 ) T0-to-device measurement: Measurement that includes |
| 171 | the switch handshake to devices timestamp without |
| 172 | the graph view change. ( TCP handshake -> Device |
| 173 | change ) |
| 174 | """ |
| 175 | import time |
| 176 | import subprocess |
| 177 | import json |
| 178 | import requests |
| 179 | import os |
| 180 | import numpy |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 181 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 182 | ONOSUser = main.params['CTRL']['user'] |
| 183 | defaultSwPort = main.params['CTRL']['port1'] |
| 184 | numIter = main.params['TEST']['numIter'] |
| 185 | iterIgnore = int(main.params['TEST']['iterIgnore']) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 186 | |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 187 | deviceTimestampKey = main.params['JSON']['deviceTimestamp'] |
| 188 | graphTimestampKey = main.params['JSON']['graphTimestamp'] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 189 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 190 | debugMode = main.params['TEST']['debugMode'] |
| 191 | onosLog = main.params['TEST']['onosLogFile'] |
| 192 | resultPath = main.params['DB']['switchEventResultPath'] |
| 193 | thresholdStr = main.params['TEST']['singleSwThreshold'] |
| 194 | thresholdObj = thresholdStr.split(',') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 195 | thresholdMin = float(thresholdObj[0]) |
| 196 | thresholdMax = float(thresholdObj[1]) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 197 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 198 | # Look for 'role-request' messages, |
| 199 | # which replaces the 'vendor' messages previously seen |
| 200 | # on OVS 2.0.1 |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 201 | tsharkTcpString = main.params[ 'TSHARK' ][ 'tcpSynAck' ] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 202 | tsharkFeatureReply = main.params[ 'TSHARK' ][ 'featureReply' ] |
| 203 | tsharkRoleRequest = main.params[ 'TSHARK' ][ 'roleRequest' ] |
| 204 | tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ] |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 205 | tsharkFinAckSequence = main.params[ 'TSHARK' ][ 'finAckSequence' ] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 206 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 207 | tsharkOfOutput = '/tmp/tshark_of_topo.txt' |
| 208 | tsharkTcpOutput = '/tmp/tshark_tcp_topo.txt' |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 209 | tsharkRoleOutput = '/tmp/tshark_role_request.txt' |
| 210 | tsharkFeatureOutput = '/tmp/tshark_feature_reply.txt' |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 211 | tsharkFinAckOutput = '/tmp/tshark_fin_ack.txt' |
| 212 | |
| 213 | # Switch connect measurement list |
| 214 | # TCP Syn/Ack -> Feature Reply latency collection for each node |
| 215 | tcpToFeatureLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 216 | # Feature Reply -> Role Request latency collection for each node |
| 217 | featureToRoleRequestLatNodeIter = numpy.zeros((clusterCount, |
| 218 | int(numIter))) |
| 219 | # Role Request -> Role Reply latency collection for each node |
| 220 | roleRequestToRoleReplyLatNodeIter = numpy.zeros((clusterCount, |
| 221 | int(numIter))) |
| 222 | # Role Reply -> Device Update latency collection for each node |
| 223 | roleReplyToDeviceLatNodeIter = numpy.zeros((clusterCount, |
| 224 | int(numIter))) |
| 225 | # Device Update -> Graph Update latency collection for each node |
| 226 | deviceToGraphLatNodeIter = numpy.zeros((clusterCount, |
| 227 | int(numIter))) |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 228 | endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 229 | |
| 230 | # Switch disconnect measurement lists |
| 231 | # Mininet Fin / Ack -> Mininet Ack |
| 232 | finAckTransactionLatNodeIter = numpy.zeros((clusterCount, |
| 233 | int(numIter))) |
| 234 | # Mininet Ack -> Device Event |
| 235 | ackToDeviceLatNodeIter = numpy.zeros((clusterCount, |
| 236 | int(numIter))) |
| 237 | # Device event -> Graph event |
| 238 | deviceToGraphDiscLatNodeIter = numpy.zeros((clusterCount, |
| 239 | int(numIter))) |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 240 | endToEndDiscLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 241 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 242 | assertion = main.TRUE |
| 243 | localTime = time.strftime('%x %X') |
| 244 | localTime = localTime.replace('/', '') |
| 245 | localTime = localTime.replace(' ', '_') |
| 246 | localTime = localTime.replace(':', '') |
| 247 | |
| 248 | if debugMode == 'on': |
| 249 | main.ONOS1.tsharkPcap('eth0', |
| 250 | '/tmp/single_sw_lat_pcap_' + localTime) |
| 251 | main.log.info('Debug mode is on') |
| 252 | main.log.report('Latency of adding one switch to controller') |
| 253 | main.log.report('First ' + str(iterIgnore) + |
| 254 | ' iterations ignored' + ' for jvm warmup time') |
| 255 | main.log.report('Total iterations of test: ' + str(numIter)) |
| 256 | |
| 257 | for i in range(0, int(numIter)): |
| 258 | main.log.info('Starting tshark capture') |
| 259 | main.ONOS1.tsharkGrep(tsharkTcpString, tsharkTcpOutput) |
| 260 | main.ONOS1.tsharkGrep(tsharkOfString, tsharkOfOutput) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 261 | main.ONOS1.tsharkGrep(tsharkRoleRequest, tsharkRoleOutput) |
| 262 | main.ONOS1.tsharkGrep(tsharkFeatureReply, tsharkFeatureOutput) |
| 263 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 264 | time.sleep(10) |
| 265 | |
| 266 | main.log.info('Assigning s3 to controller') |
| 267 | main.Mininet1.assignSwController(sw='3', |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 268 | ip1=nodeIpList[0], port1=defaultSwPort) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 269 | |
| 270 | time.sleep(10) |
| 271 | |
| 272 | main.log.info('Stopping all Tshark processes') |
| 273 | main.ONOS1.tsharkStop() |
| 274 | |
| 275 | main.log.info('Copying over tshark files') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 276 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 277 | ':' + tsharkTcpOutput + ' /tmp/') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 278 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 279 | ':' + tsharkRoleOutput + ' /tmp/') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 280 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 281 | ':' + tsharkFeatureOutput + ' /tmp/') |
| 282 | os.system('scp ' + ONOSUser + '@' + |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 283 | nodeIpList[0] + ':' + tsharkOfOutput + ' /tmp/') |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 284 | |
| 285 | # Get tcp syn / ack output |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 286 | time.sleep(5) |
| 287 | tcpFile = open(tsharkTcpOutput, 'r') |
| 288 | tempText = tcpFile.readline() |
| 289 | tempText = tempText.split(' ') |
| 290 | main.log.info('Object read in from TCP capture: ' + |
| 291 | str(tempText)) |
| 292 | |
| 293 | if len(tempText) > 1: |
| 294 | t0Tcp = float(tempText[1]) * 1000.0 |
| 295 | else: |
| 296 | main.log.error('Tshark output file for TCP' + |
| 297 | ' returned unexpected results') |
| 298 | t0Tcp = 0 |
| 299 | assertion = main.FALSE |
| 300 | tcpFile.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 301 | |
| 302 | # Get Role reply output |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 303 | time.sleep(5) |
| 304 | ofFile = open(tsharkOfOutput, 'r') |
| 305 | lineOfp = '' |
| 306 | while True: |
| 307 | tempText = ofFile.readline() |
| 308 | if tempText != '': |
| 309 | lineOfp = tempText |
| 310 | else: |
| 311 | break |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 312 | obj = lineOfp.split(' ') |
| 313 | main.log.info('Object read in from OFP capture: ' + |
| 314 | str(lineOfp)) |
| 315 | if len(obj) > 1: |
| 316 | t0Ofp = float(obj[1]) * 1000.0 |
| 317 | else: |
| 318 | main.log.error('Tshark output file for OFP' + |
| 319 | ' returned unexpected results') |
| 320 | t0Ofp = 0 |
| 321 | assertion = main.FALSE |
| 322 | ofFile.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 323 | |
| 324 | # Get role request output |
| 325 | roleFile = open(tsharkRoleOutput, 'r') |
| 326 | tempText = roleFile.readline() |
| 327 | tempText = tempText.split(' ') |
| 328 | if len(tempText) > 1: |
| 329 | main.log.info('Object read in from role request capture:' + |
| 330 | str(tempText)) |
| 331 | roleTimestamp = float(tempText[1]) * 1000.0 |
| 332 | else: |
| 333 | main.log.error('Tshark output file for role request' + |
| 334 | ' returned unexpected results') |
| 335 | timeRoleRequest = 0 |
| 336 | assertion = main.FALSE |
| 337 | roleFile.close() |
| 338 | |
| 339 | # Get feature reply output |
| 340 | featureFile = open(tsharkFeatureOutput, 'r') |
| 341 | tempText = featureFile.readline() |
| 342 | tempText = tempText.split(' ') |
| 343 | if len(tempText) > 1: |
| 344 | main.log.info('Object read in from feature reply capture: '+ |
| 345 | str(tempText)) |
| 346 | featureTimestamp = float(tempText[1]) * 1000.0 |
| 347 | else: |
| 348 | main.log.error('Tshark output file for feature reply' + |
| 349 | ' returned unexpected results') |
| 350 | timeFeatureReply = 0 |
| 351 | assertion = main.FALSE |
| 352 | featureFile.close() |
| 353 | |
| 354 | # TODO: calculate feature reply, role request times |
| 355 | # stack measurements correctly and report |
| 356 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 357 | #TODO: Refactor in progress |
| 358 | |
| 359 | for node in range(0, clusterCount): |
| 360 | nodeNum = node+1 |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 361 | metricsSwUp = CLIs[node].topologyEventsMetrics |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 362 | jsonStr = metricsSwUp() |
| 363 | jsonObj = json.loads(jsonStr) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 364 | if jsonObj: |
| 365 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 366 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 367 | else: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 368 | main.log.error( "Unexpected JSON object" ) |
| 369 | # If we could not obtain the JSON object, |
| 370 | # set the timestamps to 0, which will be |
| 371 | # excluded from the measurement later on |
| 372 | # (realized as invalid) |
| 373 | graphTimestamp = 0 |
| 374 | deviceTimestamp = 0 |
| 375 | |
| 376 | endToEnd = int(graphTimestamp) - int(t0Tcp) |
| 377 | |
| 378 | # Below are measurement breakdowns of the end-to-end |
| 379 | # measurement. |
| 380 | tcpToFeature = int(featureTimestamp) - int(t0Tcp) |
| 381 | featureToRole = int(roleTimestamp) - int(featureTimestamp) |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 382 | roleToOfp = float(t0Ofp) - float(roleTimestamp) |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 383 | ofpToDevice = float(deviceTimestamp) - float(t0Ofp) |
| 384 | # Timestamps gathered from ONOS are millisecond |
| 385 | # precision. They are returned as integers, thus no |
| 386 | # need to be more precise than 'int'. However, |
| 387 | # the processing seems to be mostly under 1 ms, |
| 388 | # thus this may be a problem point to handle any |
| 389 | # submillisecond output that we are unsure of. |
| 390 | # For now, this will be treated as 0 ms if less than 1 ms |
| 391 | deviceToGraph = int(graphTimestamp) - int(deviceTimestamp) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 392 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 393 | if endToEnd >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 394 | endToEnd < thresholdMax and i >= iterIgnore: |
| 395 | endToEndLatNodeIter[node][i] = endToEnd |
| 396 | main.log.info("ONOS "+str(nodeNum)+ " end-to-end: "+ |
| 397 | str(endToEnd) + " ms") |
| 398 | else: |
| 399 | main.log.info("ONOS "+str(nodeNum)+ " end-to-end "+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 400 | "measurement ignored due to excess in "+ |
| 401 | "threshold or premature iteration") |
| 402 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 403 | if tcpToFeature >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 404 | tcpToFeature < thresholdMax and i >= iterIgnore: |
| 405 | tcpToFeatureLatNodeIter[node][i] = tcpToFeature |
| 406 | main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature: "+ |
| 407 | str(tcpToFeature) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 408 | else: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 409 | main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature "+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 410 | "measurement ignored due to excess in "+ |
| 411 | "threshold or premature iteration") |
| 412 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 413 | if featureToRole >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 414 | featureToRole < thresholdMax and i >= iterIgnore: |
| 415 | featureToRoleRequestLatNodeIter[node][i] = featureToRole |
| 416 | main.log.info("ONOS "+str(nodeNum)+ " feature-to-role: "+ |
| 417 | str(featureToRole) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 418 | else: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 419 | main.log.info("ONOS "+str(nodeNum)+ " feature-to-role "+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 420 | "measurement ignored due to excess in "+ |
| 421 | "threshold or premature iteration") |
| 422 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 423 | if roleToOfp >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 424 | roleToOfp < thresholdMax and i >= iterIgnore: |
| 425 | roleRequestToRoleReplyLatNodeIter[node][i] = roleToOfp |
| 426 | main.log.info("ONOS "+str(nodeNum)+ " role-to-reply: "+ |
| 427 | str(roleToOfp) + " ms") |
| 428 | else: |
| 429 | main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+ |
| 430 | "measurement ignored due to excess in "+ |
| 431 | "threshold or premature iteration") |
| 432 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 433 | if ofpToDevice >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 434 | ofpToDevice < thresholdMax and i >= iterIgnore: |
| 435 | roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice |
| 436 | main.log.info("ONOS "+str(nodeNum)+ " reply-to-device: "+ |
| 437 | str(ofpToDevice) + " ms") |
| 438 | else: |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 439 | main.log.info("ONOS "+str(nodeNum)+ " reply-to-device "+ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 440 | "measurement ignored due to excess in "+ |
| 441 | "threshold or premature iteration") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 442 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 443 | if deviceToGraph >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 444 | deviceToGraph < thresholdMax and i >= iterIgnore: |
| 445 | deviceToGraphLatNodeIter[node][i] = deviceToGraph |
| 446 | main.log.info("ONOS "+str(nodeNum)+ " device-to-graph: "+ |
| 447 | str(deviceToGraph) + " ms") |
| 448 | else: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 449 | if deviceToGraph == 0: |
| 450 | deviceToGraphLatNodeIter[node][i] = 0 |
| 451 | main.log.info("ONOS "+str(nodeNum) + |
| 452 | " device-to-graph measurement "+ |
| 453 | "was set to 0 ms because of precision "+ |
| 454 | "uncertainty") |
| 455 | else: |
| 456 | main.log.info("ONOS "+str(nodeNum)+ |
| 457 | " device-to-graph "+ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 458 | "measurement ignored due to excess in "+ |
| 459 | "threshold or premature iteration") |
| 460 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 461 | # ******************** |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 462 | time.sleep(5) |
| 463 | |
| 464 | # Get device id to remove |
| 465 | deviceIdJsonStr = main.ONOS1cli.devices() |
| 466 | |
| 467 | main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) ) |
| 468 | deviceId = json.loads(deviceIdJsonStr) |
| 469 | |
| 470 | deviceList = [] |
| 471 | for device in deviceId: |
| 472 | deviceList.append(device['id']) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 473 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 474 | # Measure switch down metrics |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 475 | # TCP FIN/ACK -> TCP FIN |
| 476 | # TCP FIN -> Device Event |
| 477 | # Device Event -> Graph Event |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 478 | # Capture switch down FIN / ACK packets |
| 479 | |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 480 | # The -A 1 grep option allows us to grab 1 extra line after the |
| 481 | # last tshark output grepped originally |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 482 | main.ONOS1.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput, |
| 483 | grepOptions = '-A 1' ) |
| 484 | |
| 485 | time.sleep( 5 ) |
| 486 | |
| 487 | removeJsonList = [] |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 488 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 489 | main.step('Remove switch from controller') |
| 490 | main.Mininet1.deleteSwController('s3') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 491 | firstDevice = deviceList[0] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 492 | main.log.info( "Removing device " +str(firstDevice)+ |
| 493 | " from ONOS" ) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 494 | |
| 495 | time.sleep( 5 ) |
| 496 | |
| 497 | # We need to get metrics before removing |
| 498 | # device from the store below. |
| 499 | for node in range(0, clusterCount): |
| 500 | metricsSwDown = CLIs[node].topologyEventsMetrics |
| 501 | jsonStr = metricsSwDown() |
| 502 | removeJsonList.append( json.loads(jsonStr) ) |
| 503 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 504 | #if deviceId: |
| 505 | main.ONOS1cli.deviceRemove(firstDevice) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 506 | |
| 507 | main.ONOS1.tsharkStop() |
| 508 | |
| 509 | main.log.info('Copying over tshark files') |
| 510 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
| 511 | ':' + tsharkFinAckOutput + ' /tmp/') |
| 512 | |
| 513 | time.sleep( 10 ) |
| 514 | finAckOutputList = [] |
| 515 | with open(tsharkFinAckOutput, 'r') as f: |
| 516 | tempLine = f.readlines() |
| 517 | main.log.info('Object read in from FinAck capture: ' + |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 518 | "\n".join(tempLine)) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 519 | |
| 520 | index = 1 |
| 521 | for line in tempLine: |
| 522 | obj = line.split(' ') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 523 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 524 | if len(obj) > 1: |
| 525 | if index == 1: |
| 526 | tFinAck = float(obj[1]) * 1000.0 |
| 527 | elif index == 3: |
| 528 | tAck = float(obj[1]) * 1000.0 |
| 529 | else: |
| 530 | main.log.error('Tshark output file for OFP' + |
| 531 | ' returned unexpected results') |
| 532 | tFinAck = 0 |
| 533 | tAck = 0 |
| 534 | assertion = main.FALSE |
| 535 | |
| 536 | index = index+1 |
| 537 | |
| 538 | # with open() as f takes care of closing file |
| 539 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 540 | time.sleep(5) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 541 | |
| 542 | for node in range(0, clusterCount): |
| 543 | nodeNum = node+1 |
| 544 | jsonObj = removeJsonList[node] |
| 545 | if jsonObj: |
| 546 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 547 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 548 | main.log.info("Graph timestamp: "+str(graphTimestamp)) |
| 549 | main.log.info("Device timestamp: "+str(deviceTimestamp)) |
| 550 | else: |
| 551 | main.log.error( "Unexpected JSON object" ) |
| 552 | # If we could not obtain the JSON object, |
| 553 | # set the timestamps to 0, which will be |
| 554 | # excluded from the measurement later on |
| 555 | # (realized as invalid) |
| 556 | graphTimestamp = 0 |
| 557 | deviceTimestamp = 0 |
| 558 | |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 559 | finAckTransaction = float(tAck) - float(tFinAck) |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 560 | ackToDevice = float(deviceTimestamp) - float(tAck) |
| 561 | deviceToGraph = float(graphTimestamp) - float(deviceTimestamp) |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 562 | endToEndDisc = int(graphTimestamp) - int(tFinAck) |
| 563 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 564 | if endToEndDisc >= thresholdMin and\ |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 565 | endToEndDisc < thresholdMax and i >= iterIgnore: |
| 566 | endToEndDiscLatNodeIter[node][i] = endToEndDisc |
| 567 | main.log.info("ONOS "+str(nodeNum) + |
| 568 | "end-to-end disconnection: "+ |
| 569 | str(endToEndDisc) + " ms" ) |
| 570 | else: |
| 571 | main.log.info("ONOS " + str(nodeNum) + |
| 572 | " end-to-end disconnection "+ |
| 573 | "measurement ignored due to excess in "+ |
| 574 | "threshold or premature iteration") |
| 575 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 576 | if finAckTransaction >= thresholdMin and\ |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 577 | finAckTransaction < thresholdMax and i >= iterIgnore: |
| 578 | finAckTransactionLatNodeIter[node][i] = finAckTransaction |
| 579 | main.log.info("ONOS "+str(nodeNum)+ |
| 580 | " fin/ack transaction: "+ |
| 581 | str(finAckTransaction) + " ms") |
| 582 | else: |
| 583 | main.log.info("ONOS "+str(nodeNum)+ |
| 584 | " fin/ack transaction "+ |
| 585 | "measurement ignored due to excess in "+ |
| 586 | "threshold or premature iteration") |
| 587 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 588 | if ackToDevice >= thresholdMin and\ |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 589 | ackToDevice < thresholdMax and i >= iterIgnore: |
| 590 | ackToDeviceLatNodeIter[node][i] = ackToDevice |
| 591 | main.log.info("ONOS "+str(nodeNum)+ |
| 592 | " ack-to-device: "+ |
| 593 | str(ackToDevice) + " ms") |
| 594 | else: |
| 595 | main.log.info("ONOS "+str(nodeNum)+ |
| 596 | " ack-to-device "+ |
| 597 | "measurement ignored due to excess in "+ |
| 598 | "threshold or premature iteration") |
| 599 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 600 | if deviceToGraph >= thresholdMin and\ |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 601 | deviceToGraph < thresholdMax and i >= iterIgnore: |
| 602 | deviceToGraphDiscLatNodeIter[node][i] = deviceToGraph |
| 603 | main.log.info("ONOS "+str(nodeNum)+ |
| 604 | " device-to-graph disconnect: "+ |
| 605 | str(deviceToGraph) + " ms") |
| 606 | else: |
| 607 | main.log.info("ONOS "+str(nodeNum)+ |
| 608 | " device-to-graph disconnect "+ |
| 609 | "measurement ignored due to excess in "+ |
| 610 | "threshold or premature iteration") |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 611 | |
| 612 | endToEndAvg = 0 |
| 613 | ofpToGraphAvg = 0 |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 614 | dbCmdList = [] |
| 615 | for node in range(0, clusterCount): |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 616 | # List of latency for each node |
| 617 | endToEndList = [] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 618 | tcpToFeatureList = [] |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 619 | featureToRoleList = [] |
| 620 | roleToOfpList = [] |
| 621 | ofpToDeviceList = [] |
| 622 | deviceToGraphList = [] |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 623 | |
| 624 | finAckTransactionList = [] |
| 625 | ackToDeviceList = [] |
| 626 | deviceToGraphDiscList = [] |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 627 | endToEndDiscList = [] |
| 628 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 629 | # LatNodeIter 2d arrays contain all iteration latency |
| 630 | # for each node of the current scale cluster size |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 631 | # Switch connection measurements |
| 632 | # Set further acceptance criteria for measurements |
| 633 | # here if you would like to filter reporting results |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 634 | for item in endToEndLatNodeIter[node]: |
| 635 | if item > 0.0: |
| 636 | endToEndList.append(item) |
| 637 | |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 638 | for item in tcpToFeatureLatNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 639 | if item > 0.0: |
| 640 | tcpToFeatureList.append(item) |
| 641 | |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 642 | for item in featureToRoleRequestLatNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 643 | if item > 0.0: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 644 | featureToRoleList.append(item) |
| 645 | |
| 646 | for item in roleRequestToRoleReplyLatNodeIter[node]: |
| 647 | if item > 0.0: |
| 648 | roleToOfpList.append(item) |
| 649 | |
| 650 | for item in roleReplyToDeviceLatNodeIter[node]: |
| 651 | if item > 0.0: |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 652 | tcpToFeatureList.append(item) |
| 653 | |
| 654 | for item in featureToRoleRequestLatNodeIter[node]: |
| 655 | if item > 0.0: |
| 656 | featureToRoleList.append(item) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 657 | |
| 658 | for item in deviceToGraphLatNodeIter[node]: |
| 659 | if item > 0.0: |
| 660 | deviceToGraphList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 661 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 662 | # Switch disconnect measurements |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 663 | for item in endToEndDiscLatNodeIter[node]: |
| 664 | if item > 0.0: |
| 665 | endToEndDiscList.append(item) |
| 666 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 667 | for item in finAckTransactionLatNodeIter[node]: |
| 668 | if item > 0.0: |
| 669 | finAckTransactionList.append(item) |
| 670 | |
| 671 | for item in ackToDeviceLatNodeIter[node]: |
| 672 | if item > 0.0: |
| 673 | ackToDeviceList.append(item) |
| 674 | |
| 675 | for item in deviceToGraphDiscLatNodeIter[node]: |
| 676 | if item > 0.0: |
| 677 | deviceToGraphDiscList.append(item) |
| 678 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 679 | endToEndAvg = round(numpy.mean(endToEndList), 2) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 680 | endToEndStdDev = round(numpy.std(endToEndList), 2) |
| 681 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 682 | tcpToFeatureAvg = round(numpy.mean(tcpToFeatureList), 2) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 683 | tcpToFeatureStdDev = round(numpy.std(tcpToFeatureList), 2) |
| 684 | |
| 685 | featureToRoleAvg = round(numpy.mean(featureToRoleList), 2) |
| 686 | featureToRoleStdDev = round(numpy.std(featureToRoleList), 2) |
| 687 | |
| 688 | roleToOfpAvg = round(numpy.mean(roleToOfpList), 2) |
| 689 | roleToOfpStdDev = round(numpy.std(roleToOfpList), 2) |
| 690 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 691 | ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 692 | ofpToDeviceStdDev = round(numpy.std(ofpToDeviceList), 2) |
| 693 | |
| 694 | deviceToGraphAvg = round(numpy.mean(deviceToGraphList), 2) |
| 695 | deviceToGraphStdDev = round(numpy.std(deviceToGraphList), 2) |
| 696 | |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 697 | endToEndDiscAvg = round(numpy.mean(endToEndDiscList), 2) |
| 698 | endToEndDiscStdDev = round(numpy.std(endToEndDiscList), 2) |
| 699 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 700 | finAckAvg = round(numpy.mean(finAckTransactionList), 2) |
| 701 | finAckStdDev = round(numpy.std(finAckTransactionList), 2) |
| 702 | |
| 703 | ackToDeviceAvg = round(numpy.mean(ackToDeviceList), 2) |
| 704 | ackToDeviceStdDev = round(numpy.std(ackToDeviceList), 2) |
| 705 | |
| 706 | deviceToGraphDiscAvg = round(numpy.mean(deviceToGraphDiscList), 2) |
| 707 | deviceToGraphDiscStdDev = round(numpy.std(deviceToGraphDiscList), 2) |
| 708 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 709 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 710 | main.log.report(' - Switch Connection Statistics - ') |
| 711 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 712 | main.log.report(' End-to-end Avg: ' + str(endToEndAvg) + |
| 713 | ' ms' + ' End-to-end Std dev: ' + |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 714 | str(endToEndStdDev) + ' ms') |
| 715 | |
| 716 | main.log.report(' Tcp-to-feature-reply Avg: ' + |
| 717 | str(tcpToFeatureAvg) + ' ms') |
| 718 | main.log.report(' Tcp-to-feature-reply Std dev: '+ |
| 719 | str(tcpToFeatureStdDev) + ' ms') |
| 720 | |
| 721 | main.log.report(' Feature-reply-to-role-request Avg: ' + |
| 722 | str(featureToRoleAvg) + ' ms') |
| 723 | main.log.report(' Feature-reply-to-role-request Std Dev: ' + |
| 724 | str(featureToRoleStdDev) + ' ms') |
| 725 | |
| 726 | main.log.report(' Role-request-to-role-reply Avg: ' + |
| 727 | str(roleToOfpAvg) +' ms') |
| 728 | main.log.report(' Role-request-to-role-reply Std dev: ' + |
| 729 | str(roleToOfpStdDev) + ' ms') |
| 730 | |
| 731 | main.log.report(' Role-reply-to-device Avg: ' + |
| 732 | str(ofpToDeviceAvg) +' ms') |
| 733 | main.log.report(' Role-reply-to-device Std dev: ' + |
| 734 | str(ofpToDeviceStdDev) + ' ms') |
| 735 | |
| 736 | main.log.report(' Device-to-graph Avg: ' + |
| 737 | str(deviceToGraphAvg) + ' ms') |
| 738 | main.log.report( 'Device-to-graph Std dev: ' + |
| 739 | str(deviceToGraphStdDev) + ' ms') |
| 740 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 741 | main.log.report(' - Switch Disconnection Statistics - ') |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 742 | main.log.report(' End-to-end switch disconnect Avg: ' + |
| 743 | str(endToEndDiscAvg) + ' ms') |
| 744 | main.log.report(' End-to-end switch disconnect Std dev: ' + |
| 745 | str(endToEndDiscStdDev) + ' ms') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 746 | main.log.report(' Fin/Ack-to-Ack Avg: ' + str(finAckAvg) + ' ms') |
| 747 | main.log.report(' Fin/Ack-to-Ack Std dev: ' + |
| 748 | str(finAckStdDev) + ' ms') |
| 749 | |
| 750 | main.log.report(' Ack-to-device Avg: ' + str(ackToDeviceAvg) + |
| 751 | ' ms') |
| 752 | main.log.report(' Ack-to-device Std dev: ' + str(ackToDeviceStdDev) + |
| 753 | ' ms') |
| 754 | |
| 755 | main.log.report(' Device-to-graph (disconnect) Avg: ' + |
| 756 | str(deviceToGraphDiscAvg) + ' ms') |
| 757 | main.log.report(' Device-to-graph (disconnect) Std dev: ' + |
| 758 | str(deviceToGraphDiscStdDev) + ' ms') |
| 759 | |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 760 | # For database schema, refer to Amazon web services |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 761 | dbCmdList.append( |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 762 | "INSERT INTO switch_latency_details VALUES('" + |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 763 | timeToPost + "','switch_latency_results'," + |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 764 | jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" + |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 765 | str(node + 1) + "'," + |
| 766 | str(endToEndAvg) + ',' + |
| 767 | str(tcpToFeatureAvg) + ',' + |
| 768 | str(featureToRoleAvg) + ',' + |
| 769 | str(roleToOfpAvg) + ',' + |
| 770 | str(ofpToDeviceAvg) + ',' + |
| 771 | str(deviceToGraphAvg) + ',' + |
| 772 | str(endToEndDiscAvg) + ',' + |
| 773 | str(finAckAvg) + ',' + |
| 774 | str(ackToDeviceAvg) + ',' + |
| 775 | str(deviceToGraphDiscAvg) + |
| 776 | ');') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 777 | |
| 778 | if debugMode == 'on': |
| 779 | main.ONOS1.cpLogsToDir('/opt/onos/log/karaf.log', |
| 780 | '/tmp/', copyFileName='sw_lat_karaf') |
| 781 | fResult = open(resultPath, 'a') |
| 782 | for line in dbCmdList: |
| 783 | if line: |
| 784 | fResult.write(line + '\n') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 785 | fResult.close() |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 786 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 787 | assertion = main.TRUE |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 788 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 789 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 790 | onpass='Switch latency test successful', |
| 791 | onfail='Switch latency test failed') |
| 792 | |
| 793 | def CASE3(self, main): |
| 794 | """ |
| 795 | Bring port up / down and measure latency. |
| 796 | Port enable / disable is simulated by ifconfig up / down |
| 797 | |
| 798 | In ONOS-next, we must ensure that the port we are |
| 799 | manipulating is connected to another switch with a valid |
| 800 | connection. Otherwise, graph view will not be updated. |
| 801 | """ |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 802 | import time |
| 803 | import subprocess |
| 804 | import os |
| 805 | import requests |
| 806 | import json |
| 807 | import numpy |
| 808 | ONOS1Ip = main.params['CTRL']['ip1'] |
| 809 | ONOS2Ip = main.params['CTRL']['ip2'] |
| 810 | ONOS3Ip = main.params['CTRL']['ip3'] |
| 811 | ONOSUser = main.params['CTRL']['user'] |
| 812 | defaultSwPort = main.params['CTRL']['port1'] |
| 813 | assertion = main.TRUE |
| 814 | numIter = main.params['TEST']['numIter'] |
| 815 | iterIgnore = int(main.params['TEST']['iterIgnore']) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 816 | |
| 817 | deviceTimestampKey = main.params['JSON']['deviceTimestamp'] |
| 818 | graphTimestampKey = main.params['JSON']['graphTimestamp'] |
| 819 | linkTimestampKey = main.params['JSON']['linkTimestamp'] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 820 | |
| 821 | tsharkPortUp = '/tmp/tshark_port_up.txt' |
| 822 | tsharkPortDown = '/tmp/tshark_port_down.txt' |
| 823 | tsharkPortStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ] |
| 824 | |
| 825 | debugMode = main.params['TEST']['debugMode'] |
| 826 | postToDB = main.params['DB']['postToDB'] |
| 827 | resultPath = main.params['DB']['portEventResultPath'] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 828 | localTime = time.strftime('%x %X') |
| 829 | localTime = localTime.replace('/', '') |
| 830 | localTime = localTime.replace(' ', '_') |
| 831 | localTime = localTime.replace(':', '') |
| 832 | |
| 833 | if debugMode == 'on': |
| 834 | main.ONOS1.tsharkPcap('eth0', '/tmp/port_lat_pcap_' + localTime) |
| 835 | |
| 836 | upThresholdStr = main.params['TEST']['portUpThreshold'] |
| 837 | downThresholdStr = main.params['TEST']['portDownThreshold'] |
| 838 | upThresholdObj = upThresholdStr.split(',') |
| 839 | downThresholdObj = downThresholdStr.split(',') |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 840 | upThresholdMin = float(upThresholdObj[0]) |
| 841 | upThresholdMax = float(upThresholdObj[1]) |
| 842 | downThresholdMin = float(downThresholdObj[0]) |
| 843 | downThresholdMax = float(downThresholdObj[1]) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 844 | |
| 845 | interfaceConfig = 's1-eth1' |
| 846 | main.log.report('Port enable / disable latency') |
| 847 | main.log.report('Simulated by ifconfig up / down') |
| 848 | main.log.report('Total iterations of test: ' + str(numIter)) |
| 849 | main.step('Assign switches s1 and s2 to controller 1') |
| 850 | |
| 851 | main.Mininet1.assignSwController(sw='1', |
| 852 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 853 | main.Mininet1.assignSwController(sw='2', |
| 854 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 855 | |
| 856 | time.sleep(15) |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 857 | |
| 858 | portUpEndToEndNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 859 | portUpOfpToDevNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 860 | portUpDevToLinkNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 861 | portUpLinkToGraphNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 862 | |
| 863 | portDownEndToEndNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 864 | portDownOfpToDevNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 865 | portDownDevToLinkNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 866 | portDownLinkToGraphNodeIter = numpy.zeros((clusterCount, int(numIter))) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 867 | |
| 868 | for i in range(0, int(numIter)): |
| 869 | main.step('Starting wireshark capture for port status down') |
| 870 | main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortDown) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 871 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 872 | time.sleep(5) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 873 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 874 | main.step('Disable port: ' + interfaceConfig) |
| 875 | main.Mininet1.handle.sendline('sh ifconfig ' + |
| 876 | interfaceConfig + ' down') |
| 877 | main.Mininet1.handle.expect('mininet>') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 878 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 879 | time.sleep(3) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 880 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 881 | main.ONOS1.tsharkStop() |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 882 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 883 | os.system('scp ' + ONOSUser + '@' + ONOS1Ip + ':' + |
| 884 | tsharkPortDown + ' /tmp/') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 885 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 886 | fPortDown = open(tsharkPortDown, 'r') |
| 887 | fLine = fPortDown.readline() |
| 888 | objDown = fLine.split(' ') |
| 889 | if len(fLine) > 0: |
| 890 | timestampBeginPtDown = int(float(objDown[1]) * 1000) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 891 | # At times, tshark reports timestamp at the 3rd |
| 892 | # index of the array. If initial readings were |
| 893 | # unlike the epoch timestamp, then check the 3rd |
| 894 | # index and set that as a timestamp |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 895 | if timestampBeginPtDown < 1400000000000: |
| 896 | timestampBeginPtDown = int(float(objDown[2]) * 1000) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 897 | # If there are any suspicion of invalid results |
| 898 | # check this reported value |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 899 | main.log.info('Port down begin timestamp: ' + |
| 900 | str(timestampBeginPtDown)) |
| 901 | else: |
| 902 | main.log.info('Tshark output file returned unexpected' + |
| 903 | ' results: ' + str(objDown)) |
| 904 | timestampBeginPtDown = 0 |
| 905 | fPortDown.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 906 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 907 | for node in range(0, clusterCount): |
| 908 | nodeNum = node+1 |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 909 | metricsDown = CLIs[node].topologyEventsMetrics |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 910 | jsonStrDown = metricsDown() |
| 911 | jsonObj = json.loads(jsonStrDown) |
| 912 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 913 | if jsonObj: |
| 914 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 915 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 916 | linkTimestamp = jsonObj[linkTimestampKey]['value'] |
| 917 | else: |
| 918 | main.log.error( "Unexpected json object" ) |
| 919 | graphTimestamp = 0 |
| 920 | deviceTimestamp = 0 |
| 921 | linkTimestamp = 0 |
| 922 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 923 | ptDownEndToEnd = int(graphTimestamp) - int(timestampBeginPtDown) |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 924 | ptDownOfpToDevice = float(deviceTimestamp) - float(timestampBeginPtDown) |
| 925 | ptDownDeviceToLink = float(linkTimestamp) - float(deviceTimestamp) |
| 926 | ptDownLinkToGraph = float(graphTimestamp) - float(linkTimestamp) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 927 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 928 | if ptDownEndToEnd >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 929 | ptDownEndToEnd < downThresholdMax and i >= iterIgnore: |
| 930 | portDownEndToEndNodeIter[node][i] = ptDownEndToEnd |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 931 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 932 | " port down End-to-end: "+ |
| 933 | str(ptDownEndToEnd) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 934 | else: |
| 935 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 936 | " port down End-to-end ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 937 | " due to excess in threshold or premature iteration") |
| 938 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 939 | if ptDownOfpToDevice >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 940 | ptDownOfpToDevice < downThresholdMax and i >= iterIgnore: |
| 941 | portDownOfpToDevNodeIter[node][i] = ptDownOfpToDevice |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 942 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 943 | " port down Ofp-to-device: "+ |
| 944 | str(ptDownOfpToDevice) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 945 | else: |
| 946 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 947 | " port down Ofp-to-device ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 948 | " due to excess in threshold or premature iteration") |
| 949 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 950 | if ptDownDeviceToLink >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 951 | ptDownDeviceToLink < downThresholdMax and i >= iterIgnore: |
| 952 | portDownDevToLinkNodeIter[node][i] = ptDownDeviceToLink |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 953 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 954 | " port down Device-to-link "+ |
| 955 | str(ptDownDeviceToLink) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 956 | else: |
| 957 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 958 | " port down Device-to-link ignored"+ |
| 959 | " due to excess in threshold or premature iteration") |
| 960 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 961 | if ptDownLinkToGraph >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 962 | ptDownLinkToGraph < downThresholdMax and i >= iterIgnore: |
| 963 | portDownLinkToGraphNodeIter[node][i] = ptDownLinkToGraph |
| 964 | main.log.info("ONOS "+str(nodeNum)+ |
| 965 | " port down Link-to-graph "+ |
| 966 | str(ptDownLinkToGraph) + " ms") |
| 967 | else: |
| 968 | main.log.info("ONOS "+str(nodeNum)+ |
| 969 | " port down Link-to-graph ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 970 | " due to excess in threshold or premature iteration") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 971 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 972 | time.sleep(3) |
| 973 | |
| 974 | main.step('Starting wireshark capture for port status up') |
| 975 | main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortUp) |
| 976 | |
| 977 | time.sleep(5) |
| 978 | main.step('Enable port and obtain timestamp') |
| 979 | main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up') |
| 980 | main.Mininet1.handle.expect('mininet>') |
| 981 | |
| 982 | time.sleep(5) |
| 983 | main.ONOS1.tsharkStop() |
| 984 | |
| 985 | time.sleep(3) |
| 986 | os.system('scp ' + ONOSUser + '@' + |
| 987 | ONOS1Ip + ':' + tsharkPortUp + ' /tmp/') |
| 988 | |
| 989 | fPortUp = open(tsharkPortUp, 'r') |
| 990 | fLine = fPortUp.readline() |
| 991 | objUp = fLine.split(' ') |
| 992 | if len(fLine) > 0: |
| 993 | timestampBeginPtUp = int(float(objUp[1]) * 1000) |
| 994 | if timestampBeginPtUp < 1400000000000: |
| 995 | timestampBeginPtUp = int(float(objUp[2]) * 1000) |
| 996 | main.log.info('Port up begin timestamp: ' + str(timestampBeginPtUp)) |
| 997 | else: |
| 998 | main.log.info('Tshark output file returned unexpected' + ' results.') |
| 999 | timestampBeginPtUp = 0 |
| 1000 | fPortUp.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1001 | |
| 1002 | for node in range(0, clusterCount): |
| 1003 | nodeNum = node+1 |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1004 | metricsUp = CLIs[node].topologyEventsMetrics |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1005 | jsonStrUp = metricsUp() |
| 1006 | jsonObj = json.loads(jsonStrUp) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1007 | |
| 1008 | if jsonObj: |
| 1009 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 1010 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 1011 | linkTimestamp = jsonObj[linkTimestampKey]['value'] |
| 1012 | else: |
| 1013 | main.log.error( "Unexpected json object" ) |
| 1014 | graphTimestamp = 0 |
| 1015 | deviceTimestamp = 0 |
| 1016 | linkTimestamp = 0 |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1017 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1018 | ptUpEndToEnd = int(graphTimestamp) - int(timestampBeginPtUp) |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1019 | ptUpOfpToDevice = float(deviceTimestamp) - float(timestampBeginPtUp) |
| 1020 | ptUpDeviceToLink = float(linkTimestamp) - float(deviceTimestamp) |
| 1021 | ptUpLinkToGraph = float(graphTimestamp) - float(linkTimestamp) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1022 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1023 | if ptUpEndToEnd >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1024 | ptUpEndToEnd < upThresholdMax and i > iterIgnore: |
| 1025 | portUpEndToEndNodeIter[node][i] = ptUpEndToEnd |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1026 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1027 | " port up End-to-end: "+ |
| 1028 | str(ptUpEndToEnd) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1029 | else: |
| 1030 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1031 | " port up End-to-end ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1032 | " due to excess in threshold or premature iteration") |
| 1033 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1034 | if ptUpOfpToDevice >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1035 | ptUpOfpToDevice < upThresholdMax and i > iterIgnore: |
| 1036 | portUpOfpToDevNodeIter[node][i] = ptUpOfpToDevice |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1037 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1038 | " port up Ofp-to-device: "+ |
| 1039 | str(ptUpOfpToDevice) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1040 | else: |
| 1041 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1042 | " port up Ofp-to-device ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1043 | " due to excess in threshold or premature iteration") |
| 1044 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1045 | if ptUpDeviceToLink >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1046 | ptUpDeviceToLink < upThresholdMax and i > iterIgnore: |
| 1047 | portUpDevToLinkNodeIter[node][i] = ptUpDeviceToLink |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1048 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1049 | " port up Device-to-link: "+ |
| 1050 | str(ptUpDeviceToLink) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1051 | else: |
| 1052 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1053 | " port up Device-to-link ignored"+ |
| 1054 | " due to excess in threshold or premature iteration") |
| 1055 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1056 | if ptUpLinkToGraph >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1057 | ptUpLinkToGraph < upThresholdMax and i > iterIgnore: |
| 1058 | portUpLinkToGraphNodeIter[node][i] = ptUpLinkToGraph |
| 1059 | main.log.info("ONOS "+str(nodeNum)+ |
| 1060 | " port up Link-to-graph: "+ |
| 1061 | str(ptUpLinkToGraph) + " ms") |
| 1062 | else: |
| 1063 | main.log.info("ONOS "+str(nodeNum)+ |
| 1064 | " port up Link-to-graph ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1065 | " due to excess in threshold or premature iteration") |
| 1066 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1067 | dbCmdList = [] |
| 1068 | for node in range(0, clusterCount): |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1069 | portUpEndToEndList = [] |
| 1070 | portUpOfpToDevList = [] |
| 1071 | portUpDevToLinkList = [] |
| 1072 | portUpLinkToGraphList = [] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1073 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1074 | portDownEndToEndList = [] |
| 1075 | portDownOfpToDevList = [] |
| 1076 | portDownDevToLinkList = [] |
| 1077 | portDownLinkToGraphList = [] |
| 1078 | |
| 1079 | portUpEndToEndAvg = 0 |
| 1080 | portUpOfpToDevAvg = 0 |
| 1081 | portUpDevToLinkAvg = 0 |
| 1082 | portUpLinkToGraphAvg = 0 |
| 1083 | |
| 1084 | portDownEndToEndAvg = 0 |
| 1085 | portDownOfpToDevAvg = 0 |
| 1086 | portDownDevToLinkAvg = 0 |
| 1087 | portDownLinkToGraphAvg = 0 |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1088 | |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 1089 | # TODO: Update for more pythonic way to get list |
| 1090 | # portUpDevList = [item for item in portUpDevNodeIter[node] |
| 1091 | # if item > 0.0] |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1092 | for item in portUpEndToEndNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1093 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1094 | portUpEndToEndList.append(item) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1095 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1096 | for item in portUpOfpToDevNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1097 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1098 | portUpOfpToDevList.append(item) |
| 1099 | |
| 1100 | for item in portUpDevToLinkNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1101 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1102 | portUpDevToLinkList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1103 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1104 | for item in portUpLinkToGraphNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1105 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1106 | portUpLinkToGraphList.append(item) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1107 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1108 | |
| 1109 | for item in portDownEndToEndNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1110 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1111 | portDownEndToEndList.append(item) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1112 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1113 | for item in portDownOfpToDevNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1114 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1115 | portDownOfpToDevList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1116 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1117 | for item in portDownDevToLinkNodeIter[node]: |
| 1118 | if item > 0.0: |
| 1119 | portDownDevToLinkList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1120 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1121 | for item in portDownLinkToGraphNodeIter[node]: |
| 1122 | if item > 0.0: |
| 1123 | portDownLinkToGraphList.append(item) |
| 1124 | |
| 1125 | portUpEndToEndAvg = round(numpy.mean(portUpEndToEndList), 2) |
| 1126 | portUpOfpToDevAvg = round(numpy.mean(portUpOfpToDevList), 2) |
| 1127 | portUpDevToLinkAvg = round(numpy.mean(portUpDevToLinkList), 2) |
| 1128 | portUpLinkToGraphAvg = round(numpy.mean(portUpLinkToGraphList), 2) |
| 1129 | |
| 1130 | portDownEndToEndAvg = round(numpy.mean(portDownEndToEndList), 2) |
| 1131 | portDownOfpToDevAvg = round(numpy.mean(portDownOfpToDevList), 2) |
| 1132 | portDownDevToLinkAvg = round(numpy.mean(portDownDevToLinkList), 2) |
| 1133 | portDownLinkToGraphAvg = round(numpy.mean(portDownLinkToGraphList), 2) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1134 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1135 | portUpStdDev = round(numpy.std(portUpEndToEndList), 2) |
| 1136 | portDownStdDev = round(numpy.std(portDownEndToEndList), 2) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1137 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1138 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1139 | main.log.report(' Port up End-to-end ' + |
| 1140 | str(portUpEndToEndAvg) + ' ms') |
| 1141 | main.log.report(' Port up Ofp-to-device ' + |
| 1142 | str(portUpOfpToDevAvg) + ' ms') |
| 1143 | main.log.report(' Port up Device-to-link ' + |
| 1144 | str(portUpDevToLinkAvg) + ' ms') |
| 1145 | main.log.report(' Port up Link-to-graph ' + |
| 1146 | str(portUpLinkToGraphAvg) + ' ms') |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1147 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1148 | main.log.report(' Port down End-to-end ' + |
| 1149 | str(round(portDownEndToEndAvg, 2)) + ' ms') |
| 1150 | main.log.report(' Port down Ofp-to-device ' + |
| 1151 | str(portDownOfpToDevAvg) + ' ms') |
| 1152 | main.log.report(' Port down Device-to-link' + |
| 1153 | str(portDownDevToLinkAvg) + ' ms') |
| 1154 | main.log.report(' Port down Link-to-graph' + |
| 1155 | str(portDownLinkToGraphAvg) + ' ms') |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1156 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1157 | dbCmdList.append("INSERT INTO port_latency_details VALUES('" + |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 1158 | timeToPost + "','port_latency_results'," + jenkinsBuildNumber + |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1159 | ',' + str(clusterCount) + ",'baremetal" + str(node + 1) + |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1160 | "'," + |
| 1161 | str(portUpEndToEndAvg) +',' + |
| 1162 | str(portUpOfpToDevAvg) + ',' + |
| 1163 | str(portUpDevToLinkAvg) + ',' + |
| 1164 | str(portUpLinkToGraphAvg) + ',' + |
| 1165 | str(portDownEndToEndAvg) + ',' + |
| 1166 | str(portDownOfpToDevAvg) + ',' + |
| 1167 | str(portDownDevToLinkAvg) + ',' + |
| 1168 | str(portDownLinkToGraphAvg) + |
| 1169 | ');') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1170 | |
| 1171 | fResult = open(resultPath, 'a') |
| 1172 | for line in dbCmdList: |
| 1173 | if line: |
| 1174 | fResult.write(line + '\n') |
| 1175 | |
| 1176 | fResult.close() |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1177 | |
| 1178 | # Delete switches from controller to prepare for next |
| 1179 | # set of tests |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1180 | main.Mininet1.deleteSwController('s1') |
| 1181 | main.Mininet1.deleteSwController('s2') |
| 1182 | utilities.assert_equals(expect=main.TRUE, |
| 1183 | actual=assertion, |
| 1184 | onpass='Port discovery latency calculation successful', |
| 1185 | onfail='Port discovery test failed') |
| 1186 | |
| 1187 | def CASE4(self, main): |
| 1188 | """ |
| 1189 | Increase number of nodes and initiate CLI |
| 1190 | |
| 1191 | With the most recent implementation, we need a method to |
| 1192 | ensure all ONOS nodes are killed, as well as redefine |
| 1193 | the cell files to ensure all nodes that will be used |
| 1194 | is in the cell file. Otherwise, exceptions will |
| 1195 | prohibit test from running successfully. |
| 1196 | |
| 1197 | 3/12/15 |
| 1198 | |
| 1199 | """ |
| 1200 | global clusterCount |
| 1201 | import time |
| 1202 | import os |
| 1203 | |
| 1204 | clusterCount += 2 |
| 1205 | |
| 1206 | benchIp = main.params[ 'BENCH' ][ 'ip' ] |
| 1207 | features = main.params[ 'ENV' ][ 'cellFeatures' ] |
| 1208 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 1209 | mininetIp = main.params[ 'MN' ][ 'ip1' ] |
| 1210 | |
| 1211 | main.log.report('Increasing cluster size to ' + str(clusterCount)) |
| 1212 | |
| 1213 | main.log.step( "Killing all ONOS processes before scale-out" ) |
| 1214 | |
| 1215 | for i in range( 1, 8 ): |
| 1216 | main.ONOSbench.onosDie( |
| 1217 | main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 1218 | main.ONOSbench.onosUninstall( |
| 1219 | main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 1220 | |
| 1221 | main.step( "Creating scale-out cell file" ) |
| 1222 | cellIp = [] |
| 1223 | for node in range( 1, clusterCount + 1 ): |
| 1224 | cellIp.append( main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1225 | |
| 1226 | main.log.info( "Cell Ip list: " + str(cellIp) ) |
| 1227 | main.ONOSbench.createCellFile( benchIp, cellName, mininetIp, |
| 1228 | str(features), *cellIp ) |
| 1229 | |
| 1230 | main.step( "Setting cell definition" ) |
| 1231 | main.ONOSbench.setCell(cellName) |
| 1232 | |
| 1233 | main.step( "Packaging cell definition" ) |
| 1234 | main.ONOSbench.onosPackage() |
| 1235 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1236 | for node in range( 1, clusterCount + 1 ): |
jenkins | ac38ab7 | 2015-03-13 11:24:10 -0700 | [diff] [blame] | 1237 | main.ONOSbench.onosInstall( |
| 1238 | node = main.params[ 'CTRL' ][ 'ip'+str(node) ]) |
| 1239 | |
| 1240 | time.sleep( 20 ) |
| 1241 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1242 | for node in range( 1, clusterCount + 1): |
| 1243 | for i in range( 2 ): |
| 1244 | isup = main.ONOSbench.isup( |
| 1245 | main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1246 | if isup: |
| 1247 | main.log.info( "ONOS "+str(node) + " is up\n") |
| 1248 | break |
| 1249 | if not isup: |
| 1250 | main.log.error( "ONOS "+str(node) + " did not start" ) |
jenkins | ac38ab7 | 2015-03-13 11:24:10 -0700 | [diff] [blame] | 1251 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1252 | for node in range( 0, clusterCount ): |
| 1253 | CLIs[node].startOnosCli( cellIp[node] ) |
| 1254 | |
| 1255 | main.step( 'Setting configurations for metrics' ) |
| 1256 | configParam = 'maxEvents 1' |
| 1257 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 1258 | configParam = 'maxBatchMs 0' |
| 1259 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 1260 | configParam = 'maxIdleMs 0' |
| 1261 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 1262 | |
| 1263 | main.step( 'Activating essential applications' ) |
| 1264 | CLIs[0].activateApp( 'org.onosproject.metrics' ) |
| 1265 | CLIs[0].activateApp( 'org.onosproject.openflow' ) |
jenkins | ac38ab7 | 2015-03-13 11:24:10 -0700 | [diff] [blame] | 1266 | |