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 | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 195 | thresholdMin = int(thresholdObj[0]) |
| 196 | thresholdMax = int(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) |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 269 | |
| 270 | jsonStr = [] |
| 271 | for node in range (0, clusterCount): |
| 272 | metricsSwUp = CLIs[node].topologyEventsMetrics() |
| 273 | jsonStr.append(metricsSwUp) |
| 274 | |
| 275 | time.sleep(1) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 276 | |
| 277 | main.log.info('Stopping all Tshark processes') |
| 278 | main.ONOS1.tsharkStop() |
| 279 | |
| 280 | main.log.info('Copying over tshark files') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 281 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 282 | ':' + tsharkTcpOutput + ' /tmp/') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 283 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 284 | ':' + tsharkRoleOutput + ' /tmp/') |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 285 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 286 | ':' + tsharkFeatureOutput + ' /tmp/') |
| 287 | os.system('scp ' + ONOSUser + '@' + |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 288 | nodeIpList[0] + ':' + tsharkOfOutput + ' /tmp/') |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 289 | |
| 290 | # Get tcp syn / ack output |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 291 | # time.sleep(1) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 292 | tcpFile = open(tsharkTcpOutput, 'r') |
| 293 | tempText = tcpFile.readline() |
| 294 | tempText = tempText.split(' ') |
| 295 | main.log.info('Object read in from TCP capture: ' + |
| 296 | str(tempText)) |
| 297 | |
| 298 | if len(tempText) > 1: |
| 299 | t0Tcp = float(tempText[1]) * 1000.0 |
| 300 | else: |
| 301 | main.log.error('Tshark output file for TCP' + |
| 302 | ' returned unexpected results') |
| 303 | t0Tcp = 0 |
| 304 | assertion = main.FALSE |
| 305 | tcpFile.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 306 | |
| 307 | # Get Role reply output |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 308 | ofFile = open(tsharkOfOutput, 'r') |
| 309 | lineOfp = '' |
| 310 | while True: |
| 311 | tempText = ofFile.readline() |
| 312 | if tempText != '': |
| 313 | lineOfp = tempText |
| 314 | else: |
| 315 | break |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 316 | obj = lineOfp.split(' ') |
| 317 | main.log.info('Object read in from OFP capture: ' + |
| 318 | str(lineOfp)) |
| 319 | if len(obj) > 1: |
| 320 | t0Ofp = float(obj[1]) * 1000.0 |
| 321 | else: |
| 322 | main.log.error('Tshark output file for OFP' + |
| 323 | ' returned unexpected results') |
| 324 | t0Ofp = 0 |
| 325 | assertion = main.FALSE |
| 326 | ofFile.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 327 | |
| 328 | # Get role request output |
| 329 | roleFile = open(tsharkRoleOutput, 'r') |
| 330 | tempText = roleFile.readline() |
| 331 | tempText = tempText.split(' ') |
| 332 | if len(tempText) > 1: |
| 333 | main.log.info('Object read in from role request capture:' + |
| 334 | str(tempText)) |
| 335 | roleTimestamp = float(tempText[1]) * 1000.0 |
| 336 | else: |
| 337 | main.log.error('Tshark output file for role request' + |
| 338 | ' returned unexpected results') |
| 339 | timeRoleRequest = 0 |
| 340 | assertion = main.FALSE |
| 341 | roleFile.close() |
| 342 | |
| 343 | # Get feature reply output |
| 344 | featureFile = open(tsharkFeatureOutput, 'r') |
| 345 | tempText = featureFile.readline() |
| 346 | tempText = tempText.split(' ') |
| 347 | if len(tempText) > 1: |
| 348 | main.log.info('Object read in from feature reply capture: '+ |
| 349 | str(tempText)) |
| 350 | featureTimestamp = float(tempText[1]) * 1000.0 |
| 351 | else: |
| 352 | main.log.error('Tshark output file for feature reply' + |
| 353 | ' returned unexpected results') |
| 354 | timeFeatureReply = 0 |
| 355 | assertion = main.FALSE |
| 356 | featureFile.close() |
| 357 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 358 | for node in range(0, clusterCount): |
| 359 | nodeNum = node+1 |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 360 | #metricsSwUp = CLIs[node].topologyEventsMetrics |
| 361 | #jsonStr = metricsSwUp() |
| 362 | jsonObj = json.loads(jsonStr[node]) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 363 | if jsonObj: |
| 364 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 365 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 366 | else: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 367 | main.log.error( "Unexpected JSON object" ) |
| 368 | # If we could not obtain the JSON object, |
| 369 | # set the timestamps to 0, which will be |
| 370 | # excluded from the measurement later on |
| 371 | # (realized as invalid) |
| 372 | graphTimestamp = 0 |
| 373 | deviceTimestamp = 0 |
| 374 | |
| 375 | endToEnd = int(graphTimestamp) - int(t0Tcp) |
| 376 | |
| 377 | # Below are measurement breakdowns of the end-to-end |
| 378 | # measurement. |
| 379 | tcpToFeature = int(featureTimestamp) - int(t0Tcp) |
| 380 | featureToRole = int(roleTimestamp) - int(featureTimestamp) |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 381 | roleToOfp = float(t0Ofp) - float(roleTimestamp) |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 382 | ofpToDevice = float(deviceTimestamp) - float(t0Ofp) |
| 383 | # Timestamps gathered from ONOS are millisecond |
| 384 | # precision. They are returned as integers, thus no |
| 385 | # need to be more precise than 'int'. However, |
| 386 | # the processing seems to be mostly under 1 ms, |
| 387 | # thus this may be a problem point to handle any |
| 388 | # submillisecond output that we are unsure of. |
| 389 | # For now, this will be treated as 0 ms if less than 1 ms |
| 390 | deviceToGraph = int(graphTimestamp) - int(deviceTimestamp) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 391 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 392 | if endToEnd >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 393 | endToEnd < thresholdMax and i >= iterIgnore: |
| 394 | endToEndLatNodeIter[node][i] = endToEnd |
| 395 | main.log.info("ONOS "+str(nodeNum)+ " end-to-end: "+ |
| 396 | str(endToEnd) + " ms") |
| 397 | else: |
| 398 | main.log.info("ONOS "+str(nodeNum)+ " end-to-end "+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 399 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 400 | "threshold or premature iteration: ") |
| 401 | main.log.info(str(endToEnd)) |
| 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 "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 411 | "threshold or premature iteration: ") |
| 412 | main.log.info(str(tcpToFeature)) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 413 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 414 | if featureToRole >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 415 | featureToRole < thresholdMax and i >= iterIgnore: |
| 416 | featureToRoleRequestLatNodeIter[node][i] = featureToRole |
| 417 | main.log.info("ONOS "+str(nodeNum)+ " feature-to-role: "+ |
| 418 | str(featureToRole) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 419 | else: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 420 | main.log.info("ONOS "+str(nodeNum)+ " feature-to-role "+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 421 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 422 | "threshold or premature iteration: ") |
| 423 | main.log.info(str(featureToRole)) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 424 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 425 | if roleToOfp >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 426 | roleToOfp < thresholdMax and i >= iterIgnore: |
| 427 | roleRequestToRoleReplyLatNodeIter[node][i] = roleToOfp |
| 428 | main.log.info("ONOS "+str(nodeNum)+ " role-to-reply: "+ |
| 429 | str(roleToOfp) + " ms") |
| 430 | else: |
| 431 | main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+ |
| 432 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 433 | "threshold or premature iteration: ") |
| 434 | main.log.info(str(roleToOfp)) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 435 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 436 | if ofpToDevice >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 437 | ofpToDevice < thresholdMax and i >= iterIgnore: |
| 438 | roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice |
| 439 | main.log.info("ONOS "+str(nodeNum)+ " reply-to-device: "+ |
| 440 | str(ofpToDevice) + " ms") |
| 441 | else: |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 442 | main.log.info("ONOS "+str(nodeNum)+ " reply-to-device "+ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 443 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 444 | "threshold or premature iteration: ") |
| 445 | main.log.info(str(ofpToDevice)) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 446 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 447 | if deviceToGraph >= thresholdMin and\ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 448 | deviceToGraph < thresholdMax and i >= iterIgnore: |
| 449 | deviceToGraphLatNodeIter[node][i] = deviceToGraph |
| 450 | main.log.info("ONOS "+str(nodeNum)+ " device-to-graph: "+ |
| 451 | str(deviceToGraph) + " ms") |
| 452 | else: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 453 | if deviceToGraph == 0: |
| 454 | deviceToGraphLatNodeIter[node][i] = 0 |
| 455 | main.log.info("ONOS "+str(nodeNum) + |
| 456 | " device-to-graph measurement "+ |
| 457 | "was set to 0 ms because of precision "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 458 | "uncertainty. ") |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 459 | else: |
| 460 | main.log.info("ONOS "+str(nodeNum)+ |
| 461 | " device-to-graph "+ |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 462 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 463 | "threshold or premature iteration: ") |
| 464 | main.log.info(str(deviceToGraph)) |
| 465 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 466 | # ******************** |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 467 | time.sleep(5) |
| 468 | |
| 469 | # Get device id to remove |
| 470 | deviceIdJsonStr = main.ONOS1cli.devices() |
| 471 | |
| 472 | main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) ) |
| 473 | deviceId = json.loads(deviceIdJsonStr) |
| 474 | |
| 475 | deviceList = [] |
| 476 | for device in deviceId: |
| 477 | deviceList.append(device['id']) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 478 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 479 | # Measure switch down metrics |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 480 | # TCP FIN/ACK -> TCP FIN |
| 481 | # TCP FIN -> Device Event |
| 482 | # Device Event -> Graph Event |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 483 | # Capture switch down FIN / ACK packets |
| 484 | |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 485 | # The -A 1 grep option allows us to grab 1 extra line after the |
| 486 | # last tshark output grepped originally |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 487 | main.ONOS1.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput, |
| 488 | grepOptions = '-A 1' ) |
| 489 | |
| 490 | time.sleep( 5 ) |
| 491 | |
| 492 | removeJsonList = [] |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 493 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 494 | main.step('Remove switch from controller') |
| 495 | main.Mininet1.deleteSwController('s3') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 496 | firstDevice = deviceList[0] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 497 | main.log.info( "Removing device " +str(firstDevice)+ |
| 498 | " from ONOS" ) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 499 | |
| 500 | time.sleep( 5 ) |
| 501 | |
| 502 | # We need to get metrics before removing |
| 503 | # device from the store below. |
| 504 | for node in range(0, clusterCount): |
| 505 | metricsSwDown = CLIs[node].topologyEventsMetrics |
| 506 | jsonStr = metricsSwDown() |
| 507 | removeJsonList.append( json.loads(jsonStr) ) |
| 508 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 509 | #if deviceId: |
| 510 | main.ONOS1cli.deviceRemove(firstDevice) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 511 | |
| 512 | main.ONOS1.tsharkStop() |
| 513 | |
| 514 | main.log.info('Copying over tshark files') |
| 515 | os.system('scp ' + ONOSUser + '@' + nodeIpList[0] + |
| 516 | ':' + tsharkFinAckOutput + ' /tmp/') |
| 517 | |
| 518 | time.sleep( 10 ) |
| 519 | finAckOutputList = [] |
| 520 | with open(tsharkFinAckOutput, 'r') as f: |
| 521 | tempLine = f.readlines() |
| 522 | main.log.info('Object read in from FinAck capture: ' + |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 523 | "\n".join(tempLine)) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 524 | |
| 525 | index = 1 |
| 526 | for line in tempLine: |
| 527 | obj = line.split(' ') |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 528 | |
| 529 | # There are at least 3 objects in field (valid |
| 530 | # tshark output is lengthy) |
| 531 | if len(obj) > 2: |
| 532 | # If first index of object is like an epoch time |
andrew@onlab.us | a838a06 | 2015-04-23 19:10:25 -0400 | [diff] [blame] | 533 | if obj[0] > 1400000000: |
| 534 | temp = obj[0] |
| 535 | elif obj[1] > 1400000000: |
| 536 | temp = obj[1] |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 537 | elif obj[2] > 1400000000: |
andrew@onlab.us | a838a06 | 2015-04-23 19:10:25 -0400 | [diff] [blame] | 538 | temp = obj[2] |
| 539 | elif obj[3] > 1400000000: |
| 540 | temp = obj[3] |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 541 | else: |
| 542 | temp = 0 |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 543 | if index == 1: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 544 | tFinAck = float(temp) * 1000.0 |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 545 | elif index == 3: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 546 | tAck = float(temp) * 1000.0 |
| 547 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 548 | else: |
| 549 | main.log.error('Tshark output file for OFP' + |
| 550 | ' returned unexpected results') |
| 551 | tFinAck = 0 |
| 552 | tAck = 0 |
| 553 | assertion = main.FALSE |
| 554 | |
| 555 | index = index+1 |
| 556 | |
| 557 | # with open() as f takes care of closing file |
| 558 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 559 | time.sleep(5) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 560 | |
| 561 | for node in range(0, clusterCount): |
| 562 | nodeNum = node+1 |
| 563 | jsonObj = removeJsonList[node] |
| 564 | if jsonObj: |
| 565 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 566 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 567 | main.log.info("Graph timestamp: "+str(graphTimestamp)) |
| 568 | main.log.info("Device timestamp: "+str(deviceTimestamp)) |
| 569 | else: |
| 570 | main.log.error( "Unexpected JSON object" ) |
| 571 | # If we could not obtain the JSON object, |
| 572 | # set the timestamps to 0, which will be |
| 573 | # excluded from the measurement later on |
| 574 | # (realized as invalid) |
| 575 | graphTimestamp = 0 |
| 576 | deviceTimestamp = 0 |
| 577 | |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 578 | finAckTransaction = float(tAck) - float(tFinAck) |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 579 | ackToDevice = float(deviceTimestamp) - float(tAck) |
| 580 | deviceToGraph = float(graphTimestamp) - float(deviceTimestamp) |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 581 | endToEndDisc = int(graphTimestamp) - int(tFinAck) |
| 582 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 583 | if endToEndDisc >= thresholdMin and\ |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 584 | endToEndDisc < thresholdMax and i >= iterIgnore: |
| 585 | endToEndDiscLatNodeIter[node][i] = endToEndDisc |
| 586 | main.log.info("ONOS "+str(nodeNum) + |
| 587 | "end-to-end disconnection: "+ |
| 588 | str(endToEndDisc) + " ms" ) |
| 589 | else: |
| 590 | main.log.info("ONOS " + str(nodeNum) + |
| 591 | " end-to-end disconnection "+ |
| 592 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 593 | "threshold or premature iteration: ") |
| 594 | main.log.info(str(endToEndDisc)) |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 595 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 596 | if finAckTransaction >= thresholdMin and\ |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 597 | finAckTransaction < thresholdMax and i >= iterIgnore: |
| 598 | finAckTransactionLatNodeIter[node][i] = finAckTransaction |
| 599 | main.log.info("ONOS "+str(nodeNum)+ |
| 600 | " fin/ack transaction: "+ |
| 601 | str(finAckTransaction) + " ms") |
| 602 | else: |
| 603 | main.log.info("ONOS "+str(nodeNum)+ |
| 604 | " fin/ack transaction "+ |
| 605 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 606 | "threshold or premature iteration: ") |
| 607 | main.log.info(str(finAckTransaction)) |
| 608 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 609 | if ackToDevice >= thresholdMin and\ |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 610 | ackToDevice < thresholdMax and i >= iterIgnore: |
| 611 | ackToDeviceLatNodeIter[node][i] = ackToDevice |
| 612 | main.log.info("ONOS "+str(nodeNum)+ |
| 613 | " ack-to-device: "+ |
| 614 | str(ackToDevice) + " ms") |
| 615 | else: |
| 616 | main.log.info("ONOS "+str(nodeNum)+ |
| 617 | " ack-to-device "+ |
| 618 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 619 | "threshold or premature iteration: ") |
| 620 | main.log.info(str(ackToDevice)) |
| 621 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 622 | if deviceToGraph >= thresholdMin and\ |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 623 | deviceToGraph < thresholdMax and i >= iterIgnore: |
| 624 | deviceToGraphDiscLatNodeIter[node][i] = deviceToGraph |
| 625 | main.log.info("ONOS "+str(nodeNum)+ |
| 626 | " device-to-graph disconnect: "+ |
| 627 | str(deviceToGraph) + " ms") |
| 628 | else: |
| 629 | main.log.info("ONOS "+str(nodeNum)+ |
| 630 | " device-to-graph disconnect "+ |
| 631 | "measurement ignored due to excess in "+ |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 632 | "threshold or premature iteration: ") |
| 633 | main.log.info(str(deviceToGraph)) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 634 | |
| 635 | endToEndAvg = 0 |
| 636 | ofpToGraphAvg = 0 |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 637 | dbCmdList = [] |
| 638 | for node in range(0, clusterCount): |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 639 | # List of latency for each node |
| 640 | endToEndList = [] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 641 | tcpToFeatureList = [] |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 642 | featureToRoleList = [] |
| 643 | roleToOfpList = [] |
| 644 | ofpToDeviceList = [] |
| 645 | deviceToGraphList = [] |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 646 | |
| 647 | finAckTransactionList = [] |
| 648 | ackToDeviceList = [] |
| 649 | deviceToGraphDiscList = [] |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 650 | endToEndDiscList = [] |
| 651 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 652 | # LatNodeIter 2d arrays contain all iteration latency |
| 653 | # for each node of the current scale cluster size |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 654 | # Switch connection measurements |
| 655 | # Set further acceptance criteria for measurements |
| 656 | # here if you would like to filter reporting results |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 657 | for item in endToEndLatNodeIter[node]: |
| 658 | if item > 0.0: |
| 659 | endToEndList.append(item) |
| 660 | |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 661 | for item in tcpToFeatureLatNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 662 | if item > 0.0: |
| 663 | tcpToFeatureList.append(item) |
| 664 | |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 665 | for item in featureToRoleRequestLatNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 666 | if item > 0.0: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 667 | featureToRoleList.append(item) |
| 668 | |
| 669 | for item in roleRequestToRoleReplyLatNodeIter[node]: |
| 670 | if item > 0.0: |
| 671 | roleToOfpList.append(item) |
| 672 | |
| 673 | for item in roleReplyToDeviceLatNodeIter[node]: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 674 | if item >= 0.0: |
| 675 | ofpToDeviceList.append(item) |
| 676 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 677 | for item in featureToRoleRequestLatNodeIter[node]: |
| 678 | if item > 0.0: |
| 679 | featureToRoleList.append(item) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 680 | |
| 681 | for item in deviceToGraphLatNodeIter[node]: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 682 | if item >= 0.0: |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 683 | deviceToGraphList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 684 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 685 | # Switch disconnect measurements |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 686 | for item in endToEndDiscLatNodeIter[node]: |
| 687 | if item > 0.0: |
| 688 | endToEndDiscList.append(item) |
| 689 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 690 | for item in finAckTransactionLatNodeIter[node]: |
| 691 | if item > 0.0: |
| 692 | finAckTransactionList.append(item) |
| 693 | |
| 694 | for item in ackToDeviceLatNodeIter[node]: |
| 695 | if item > 0.0: |
| 696 | ackToDeviceList.append(item) |
| 697 | |
| 698 | for item in deviceToGraphDiscLatNodeIter[node]: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 699 | if item >= 0.0: |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 700 | deviceToGraphDiscList.append(item) |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 701 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 702 | endToEndAvg = round(numpy.mean(endToEndList), 2) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 703 | endToEndStdDev = round(numpy.std(endToEndList), 2) |
| 704 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 705 | tcpToFeatureAvg = round(numpy.mean(tcpToFeatureList), 2) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 706 | tcpToFeatureStdDev = round(numpy.std(tcpToFeatureList), 2) |
| 707 | |
| 708 | featureToRoleAvg = round(numpy.mean(featureToRoleList), 2) |
| 709 | featureToRoleStdDev = round(numpy.std(featureToRoleList), 2) |
| 710 | |
| 711 | roleToOfpAvg = round(numpy.mean(roleToOfpList), 2) |
| 712 | roleToOfpStdDev = round(numpy.std(roleToOfpList), 2) |
| 713 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 714 | ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2) |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 715 | ofpToDeviceStdDev = round(numpy.std(ofpToDeviceList), 2) |
| 716 | |
| 717 | deviceToGraphAvg = round(numpy.mean(deviceToGraphList), 2) |
| 718 | deviceToGraphStdDev = round(numpy.std(deviceToGraphList), 2) |
| 719 | |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 720 | endToEndDiscAvg = round(numpy.mean(endToEndDiscList), 2) |
| 721 | endToEndDiscStdDev = round(numpy.std(endToEndDiscList), 2) |
| 722 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 723 | finAckAvg = round(numpy.mean(finAckTransactionList), 2) |
| 724 | finAckStdDev = round(numpy.std(finAckTransactionList), 2) |
| 725 | |
| 726 | ackToDeviceAvg = round(numpy.mean(ackToDeviceList), 2) |
| 727 | ackToDeviceStdDev = round(numpy.std(ackToDeviceList), 2) |
| 728 | |
| 729 | deviceToGraphDiscAvg = round(numpy.mean(deviceToGraphDiscList), 2) |
| 730 | deviceToGraphDiscStdDev = round(numpy.std(deviceToGraphDiscList), 2) |
| 731 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 732 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 733 | main.log.report(' - Switch Connection Statistics - ') |
| 734 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 735 | main.log.report(' End-to-end Avg: ' + str(endToEndAvg) + |
| 736 | ' ms' + ' End-to-end Std dev: ' + |
andrew@onlab.us | 0f468c4 | 2015-04-02 17:05:47 -0400 | [diff] [blame] | 737 | str(endToEndStdDev) + ' ms') |
| 738 | |
| 739 | main.log.report(' Tcp-to-feature-reply Avg: ' + |
| 740 | str(tcpToFeatureAvg) + ' ms') |
| 741 | main.log.report(' Tcp-to-feature-reply Std dev: '+ |
| 742 | str(tcpToFeatureStdDev) + ' ms') |
| 743 | |
| 744 | main.log.report(' Feature-reply-to-role-request Avg: ' + |
| 745 | str(featureToRoleAvg) + ' ms') |
| 746 | main.log.report(' Feature-reply-to-role-request Std Dev: ' + |
| 747 | str(featureToRoleStdDev) + ' ms') |
| 748 | |
| 749 | main.log.report(' Role-request-to-role-reply Avg: ' + |
| 750 | str(roleToOfpAvg) +' ms') |
| 751 | main.log.report(' Role-request-to-role-reply Std dev: ' + |
| 752 | str(roleToOfpStdDev) + ' ms') |
| 753 | |
| 754 | main.log.report(' Role-reply-to-device Avg: ' + |
| 755 | str(ofpToDeviceAvg) +' ms') |
| 756 | main.log.report(' Role-reply-to-device Std dev: ' + |
| 757 | str(ofpToDeviceStdDev) + ' ms') |
| 758 | |
| 759 | main.log.report(' Device-to-graph Avg: ' + |
| 760 | str(deviceToGraphAvg) + ' ms') |
| 761 | main.log.report( 'Device-to-graph Std dev: ' + |
| 762 | str(deviceToGraphStdDev) + ' ms') |
| 763 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 764 | main.log.report(' - Switch Disconnection Statistics - ') |
andrew@onlab.us | 9210ba1 | 2015-04-09 14:11:27 -0400 | [diff] [blame] | 765 | main.log.report(' End-to-end switch disconnect Avg: ' + |
| 766 | str(endToEndDiscAvg) + ' ms') |
| 767 | main.log.report(' End-to-end switch disconnect Std dev: ' + |
| 768 | str(endToEndDiscStdDev) + ' ms') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 769 | main.log.report(' Fin/Ack-to-Ack Avg: ' + str(finAckAvg) + ' ms') |
| 770 | main.log.report(' Fin/Ack-to-Ack Std dev: ' + |
| 771 | str(finAckStdDev) + ' ms') |
| 772 | |
| 773 | main.log.report(' Ack-to-device Avg: ' + str(ackToDeviceAvg) + |
| 774 | ' ms') |
| 775 | main.log.report(' Ack-to-device Std dev: ' + str(ackToDeviceStdDev) + |
| 776 | ' ms') |
| 777 | |
| 778 | main.log.report(' Device-to-graph (disconnect) Avg: ' + |
| 779 | str(deviceToGraphDiscAvg) + ' ms') |
| 780 | main.log.report(' Device-to-graph (disconnect) Std dev: ' + |
| 781 | str(deviceToGraphDiscStdDev) + ' ms') |
| 782 | |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 783 | # For database schema, refer to Amazon web services |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 784 | dbCmdList.append( |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 785 | "INSERT INTO switch_latency_details VALUES('" + |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 786 | timeToPost + "','switch_latency_results'," + |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 787 | jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" + |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 788 | str(node + 1) + "'," + |
| 789 | str(endToEndAvg) + ',' + |
| 790 | str(tcpToFeatureAvg) + ',' + |
| 791 | str(featureToRoleAvg) + ',' + |
| 792 | str(roleToOfpAvg) + ',' + |
| 793 | str(ofpToDeviceAvg) + ',' + |
| 794 | str(deviceToGraphAvg) + ',' + |
| 795 | str(endToEndDiscAvg) + ',' + |
| 796 | str(finAckAvg) + ',' + |
| 797 | str(ackToDeviceAvg) + ',' + |
| 798 | str(deviceToGraphDiscAvg) + |
| 799 | ');') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 800 | |
| 801 | if debugMode == 'on': |
| 802 | main.ONOS1.cpLogsToDir('/opt/onos/log/karaf.log', |
| 803 | '/tmp/', copyFileName='sw_lat_karaf') |
| 804 | fResult = open(resultPath, 'a') |
| 805 | for line in dbCmdList: |
| 806 | if line: |
| 807 | fResult.write(line + '\n') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 808 | fResult.close() |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 809 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 810 | assertion = main.TRUE |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 811 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 812 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
| 813 | onpass='Switch latency test successful', |
| 814 | onfail='Switch latency test failed') |
| 815 | |
| 816 | def CASE3(self, main): |
| 817 | """ |
| 818 | Bring port up / down and measure latency. |
| 819 | Port enable / disable is simulated by ifconfig up / down |
| 820 | |
| 821 | In ONOS-next, we must ensure that the port we are |
| 822 | manipulating is connected to another switch with a valid |
| 823 | connection. Otherwise, graph view will not be updated. |
| 824 | """ |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 825 | import time |
| 826 | import subprocess |
| 827 | import os |
| 828 | import requests |
| 829 | import json |
| 830 | import numpy |
| 831 | ONOS1Ip = main.params['CTRL']['ip1'] |
| 832 | ONOS2Ip = main.params['CTRL']['ip2'] |
| 833 | ONOS3Ip = main.params['CTRL']['ip3'] |
| 834 | ONOSUser = main.params['CTRL']['user'] |
| 835 | defaultSwPort = main.params['CTRL']['port1'] |
| 836 | assertion = main.TRUE |
| 837 | numIter = main.params['TEST']['numIter'] |
| 838 | iterIgnore = int(main.params['TEST']['iterIgnore']) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 839 | |
| 840 | deviceTimestampKey = main.params['JSON']['deviceTimestamp'] |
| 841 | graphTimestampKey = main.params['JSON']['graphTimestamp'] |
| 842 | linkTimestampKey = main.params['JSON']['linkTimestamp'] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 843 | |
| 844 | tsharkPortUp = '/tmp/tshark_port_up.txt' |
| 845 | tsharkPortDown = '/tmp/tshark_port_down.txt' |
| 846 | tsharkPortStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ] |
| 847 | |
| 848 | debugMode = main.params['TEST']['debugMode'] |
| 849 | postToDB = main.params['DB']['postToDB'] |
| 850 | resultPath = main.params['DB']['portEventResultPath'] |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 851 | localTime = time.strftime('%x %X') |
| 852 | localTime = localTime.replace('/', '') |
| 853 | localTime = localTime.replace(' ', '_') |
| 854 | localTime = localTime.replace(':', '') |
| 855 | |
| 856 | if debugMode == 'on': |
| 857 | main.ONOS1.tsharkPcap('eth0', '/tmp/port_lat_pcap_' + localTime) |
| 858 | |
| 859 | upThresholdStr = main.params['TEST']['portUpThreshold'] |
| 860 | downThresholdStr = main.params['TEST']['portDownThreshold'] |
| 861 | upThresholdObj = upThresholdStr.split(',') |
| 862 | downThresholdObj = downThresholdStr.split(',') |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 863 | upThresholdMin = int(upThresholdObj[0]) |
| 864 | upThresholdMax = int(upThresholdObj[1]) |
| 865 | downThresholdMin = int(downThresholdObj[0]) |
| 866 | downThresholdMax = int(downThresholdObj[1]) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 867 | |
| 868 | interfaceConfig = 's1-eth1' |
| 869 | main.log.report('Port enable / disable latency') |
| 870 | main.log.report('Simulated by ifconfig up / down') |
| 871 | main.log.report('Total iterations of test: ' + str(numIter)) |
| 872 | main.step('Assign switches s1 and s2 to controller 1') |
| 873 | |
| 874 | main.Mininet1.assignSwController(sw='1', |
| 875 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 876 | main.Mininet1.assignSwController(sw='2', |
| 877 | ip1=ONOS1Ip, port1=defaultSwPort) |
| 878 | |
| 879 | time.sleep(15) |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 880 | |
| 881 | portUpEndToEndNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 882 | portUpOfpToDevNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 883 | portUpDevToLinkNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 884 | portUpLinkToGraphNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 885 | |
| 886 | portDownEndToEndNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 887 | portDownOfpToDevNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 888 | portDownDevToLinkNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 889 | portDownLinkToGraphNodeIter = numpy.zeros((clusterCount, int(numIter))) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 890 | |
| 891 | for i in range(0, int(numIter)): |
| 892 | main.step('Starting wireshark capture for port status down') |
| 893 | main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortDown) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 894 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 895 | time.sleep(5) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 896 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 897 | main.step('Disable port: ' + interfaceConfig) |
| 898 | main.Mininet1.handle.sendline('sh ifconfig ' + |
| 899 | interfaceConfig + ' down') |
| 900 | main.Mininet1.handle.expect('mininet>') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 901 | |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 902 | jsonStrPtDown = [] |
| 903 | for node in range (0, clusterCount): |
| 904 | metricsPortDown = CLIs[node].topologyEventsMetrics() |
| 905 | jsonStrPtDown.append(metricsPortDown) |
| 906 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 907 | time.sleep(3) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 908 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 909 | main.ONOS1.tsharkStop() |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 910 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 911 | os.system('scp ' + ONOSUser + '@' + ONOS1Ip + ':' + |
| 912 | tsharkPortDown + ' /tmp/') |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 913 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 914 | fPortDown = open(tsharkPortDown, 'r') |
| 915 | fLine = fPortDown.readline() |
| 916 | objDown = fLine.split(' ') |
| 917 | if len(fLine) > 0: |
| 918 | timestampBeginPtDown = int(float(objDown[1]) * 1000) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 919 | # At times, tshark reports timestamp at the 3rd |
| 920 | # index of the array. If initial readings were |
| 921 | # unlike the epoch timestamp, then check the 3rd |
| 922 | # index and set that as a timestamp |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 923 | if timestampBeginPtDown < 1400000000000: |
| 924 | timestampBeginPtDown = int(float(objDown[2]) * 1000) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 925 | # If there are any suspicion of invalid results |
| 926 | # check this reported value |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 927 | main.log.info('Port down begin timestamp: ' + |
| 928 | str(timestampBeginPtDown)) |
| 929 | else: |
| 930 | main.log.info('Tshark output file returned unexpected' + |
| 931 | ' results: ' + str(objDown)) |
| 932 | timestampBeginPtDown = 0 |
| 933 | fPortDown.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 934 | |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 935 | for node in range(0, clusterCount): |
| 936 | nodeNum = node+1 |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 937 | # metricsDown = CLIs[node].topologyEventsMetrics |
| 938 | #jsonStrPtDown[node] = metricsDown() |
| 939 | jsonObj = json.loads(jsonStrPtDown[node]) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 940 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 941 | if jsonObj: |
| 942 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 943 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 944 | linkTimestamp = jsonObj[linkTimestampKey]['value'] |
| 945 | else: |
| 946 | main.log.error( "Unexpected json object" ) |
| 947 | graphTimestamp = 0 |
| 948 | deviceTimestamp = 0 |
| 949 | linkTimestamp = 0 |
| 950 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 951 | ptDownEndToEnd = int(graphTimestamp) - int(timestampBeginPtDown) |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 952 | ptDownOfpToDevice = float(deviceTimestamp) - float(timestampBeginPtDown) |
| 953 | ptDownDeviceToLink = float(linkTimestamp) - float(deviceTimestamp) |
| 954 | ptDownLinkToGraph = float(graphTimestamp) - float(linkTimestamp) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 955 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 956 | if ptDownEndToEnd >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 957 | ptDownEndToEnd < downThresholdMax and i >= iterIgnore: |
| 958 | portDownEndToEndNodeIter[node][i] = ptDownEndToEnd |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 959 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 960 | " port down End-to-end: "+ |
| 961 | str(ptDownEndToEnd) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 962 | else: |
| 963 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 964 | " port down End-to-end ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 965 | " due to excess in threshold or premature iteration") |
| 966 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 967 | if ptDownOfpToDevice >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 968 | ptDownOfpToDevice < downThresholdMax and i >= iterIgnore: |
| 969 | portDownOfpToDevNodeIter[node][i] = ptDownOfpToDevice |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 970 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 971 | " port down Ofp-to-device: "+ |
| 972 | str(ptDownOfpToDevice) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 973 | else: |
| 974 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 975 | " port down Ofp-to-device ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 976 | " due to excess in threshold or premature iteration") |
| 977 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 978 | if ptDownDeviceToLink >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 979 | ptDownDeviceToLink < downThresholdMax and i >= iterIgnore: |
| 980 | portDownDevToLinkNodeIter[node][i] = ptDownDeviceToLink |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 981 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 982 | " port down Device-to-link "+ |
| 983 | str(ptDownDeviceToLink) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 984 | else: |
| 985 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 986 | " port down Device-to-link ignored"+ |
| 987 | " due to excess in threshold or premature iteration") |
| 988 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 989 | if ptDownLinkToGraph >= downThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 990 | ptDownLinkToGraph < downThresholdMax and i >= iterIgnore: |
| 991 | portDownLinkToGraphNodeIter[node][i] = ptDownLinkToGraph |
| 992 | main.log.info("ONOS "+str(nodeNum)+ |
| 993 | " port down Link-to-graph "+ |
| 994 | str(ptDownLinkToGraph) + " ms") |
| 995 | else: |
| 996 | main.log.info("ONOS "+str(nodeNum)+ |
| 997 | " port down Link-to-graph ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 998 | " due to excess in threshold or premature iteration") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 999 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1000 | time.sleep(3) |
| 1001 | |
| 1002 | main.step('Starting wireshark capture for port status up') |
| 1003 | main.ONOS1.tsharkGrep(tsharkPortStatus, tsharkPortUp) |
| 1004 | |
| 1005 | time.sleep(5) |
| 1006 | main.step('Enable port and obtain timestamp') |
| 1007 | main.Mininet1.handle.sendline('sh ifconfig ' + interfaceConfig + ' up') |
| 1008 | main.Mininet1.handle.expect('mininet>') |
| 1009 | |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 1010 | jsonStrPtUp = [] |
| 1011 | for node in range (0, clusterCount): |
| 1012 | metricsPortUp = CLIs[node].topologyEventsMetrics() |
| 1013 | jsonStrPtUp.append(metricsPortUp) |
| 1014 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1015 | time.sleep(5) |
| 1016 | main.ONOS1.tsharkStop() |
| 1017 | |
| 1018 | time.sleep(3) |
| 1019 | os.system('scp ' + ONOSUser + '@' + |
| 1020 | ONOS1Ip + ':' + tsharkPortUp + ' /tmp/') |
| 1021 | |
| 1022 | fPortUp = open(tsharkPortUp, 'r') |
| 1023 | fLine = fPortUp.readline() |
| 1024 | objUp = fLine.split(' ') |
| 1025 | if len(fLine) > 0: |
| 1026 | timestampBeginPtUp = int(float(objUp[1]) * 1000) |
| 1027 | if timestampBeginPtUp < 1400000000000: |
| 1028 | timestampBeginPtUp = int(float(objUp[2]) * 1000) |
| 1029 | main.log.info('Port up begin timestamp: ' + str(timestampBeginPtUp)) |
| 1030 | else: |
| 1031 | main.log.info('Tshark output file returned unexpected' + ' results.') |
| 1032 | timestampBeginPtUp = 0 |
| 1033 | fPortUp.close() |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1034 | |
| 1035 | for node in range(0, clusterCount): |
| 1036 | nodeNum = node+1 |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 1037 | #metricsUp = CLIs[node].topologyEventsMetrics |
| 1038 | #jsonStrUp = metricsUp() |
| 1039 | jsonObj = json.loads(jsonStrPtUp[node]) |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1040 | |
| 1041 | if jsonObj: |
| 1042 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 1043 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 1044 | linkTimestamp = jsonObj[linkTimestampKey]['value'] |
| 1045 | else: |
| 1046 | main.log.error( "Unexpected json object" ) |
| 1047 | graphTimestamp = 0 |
| 1048 | deviceTimestamp = 0 |
| 1049 | linkTimestamp = 0 |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1050 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1051 | ptUpEndToEnd = int(graphTimestamp) - int(timestampBeginPtUp) |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1052 | ptUpOfpToDevice = float(deviceTimestamp) - float(timestampBeginPtUp) |
| 1053 | ptUpDeviceToLink = float(linkTimestamp) - float(deviceTimestamp) |
| 1054 | ptUpLinkToGraph = float(graphTimestamp) - float(linkTimestamp) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1055 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1056 | if ptUpEndToEnd >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1057 | ptUpEndToEnd < upThresholdMax and i > iterIgnore: |
| 1058 | portUpEndToEndNodeIter[node][i] = ptUpEndToEnd |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1059 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1060 | " port up End-to-end: "+ |
| 1061 | str(ptUpEndToEnd) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1062 | else: |
| 1063 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1064 | " port up End-to-end ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1065 | " due to excess in threshold or premature iteration") |
| 1066 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1067 | if ptUpOfpToDevice >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1068 | ptUpOfpToDevice < upThresholdMax and i > iterIgnore: |
| 1069 | portUpOfpToDevNodeIter[node][i] = ptUpOfpToDevice |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1070 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1071 | " port up Ofp-to-device: "+ |
| 1072 | str(ptUpOfpToDevice) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1073 | else: |
| 1074 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1075 | " port up Ofp-to-device ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1076 | " due to excess in threshold or premature iteration") |
| 1077 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1078 | if ptUpDeviceToLink >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1079 | ptUpDeviceToLink < upThresholdMax and i > iterIgnore: |
| 1080 | portUpDevToLinkNodeIter[node][i] = ptUpDeviceToLink |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1081 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1082 | " port up Device-to-link: "+ |
| 1083 | str(ptUpDeviceToLink) + " ms") |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1084 | else: |
| 1085 | main.log.info("ONOS "+str(nodeNum)+ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1086 | " port up Device-to-link ignored"+ |
| 1087 | " due to excess in threshold or premature iteration") |
| 1088 | |
andrew@onlab.us | 9a3d2bb | 2015-04-14 19:33:32 -0400 | [diff] [blame] | 1089 | if ptUpLinkToGraph >= upThresholdMin and\ |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1090 | ptUpLinkToGraph < upThresholdMax and i > iterIgnore: |
| 1091 | portUpLinkToGraphNodeIter[node][i] = ptUpLinkToGraph |
| 1092 | main.log.info("ONOS "+str(nodeNum)+ |
| 1093 | " port up Link-to-graph: "+ |
| 1094 | str(ptUpLinkToGraph) + " ms") |
| 1095 | else: |
| 1096 | main.log.info("ONOS "+str(nodeNum)+ |
| 1097 | " port up Link-to-graph ignored"+ |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1098 | " due to excess in threshold or premature iteration") |
| 1099 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1100 | dbCmdList = [] |
| 1101 | for node in range(0, clusterCount): |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1102 | portUpEndToEndList = [] |
| 1103 | portUpOfpToDevList = [] |
| 1104 | portUpDevToLinkList = [] |
| 1105 | portUpLinkToGraphList = [] |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1106 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1107 | portDownEndToEndList = [] |
| 1108 | portDownOfpToDevList = [] |
| 1109 | portDownDevToLinkList = [] |
| 1110 | portDownLinkToGraphList = [] |
| 1111 | |
| 1112 | portUpEndToEndAvg = 0 |
| 1113 | portUpOfpToDevAvg = 0 |
| 1114 | portUpDevToLinkAvg = 0 |
| 1115 | portUpLinkToGraphAvg = 0 |
| 1116 | |
| 1117 | portDownEndToEndAvg = 0 |
| 1118 | portDownOfpToDevAvg = 0 |
| 1119 | portDownDevToLinkAvg = 0 |
| 1120 | portDownLinkToGraphAvg = 0 |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1121 | |
andrew@onlab.us | aa1f0dc | 2015-04-10 12:18:01 -0400 | [diff] [blame] | 1122 | # TODO: Update for more pythonic way to get list |
| 1123 | # portUpDevList = [item for item in portUpDevNodeIter[node] |
| 1124 | # if item > 0.0] |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1125 | for item in portUpEndToEndNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1126 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1127 | portUpEndToEndList.append(item) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1128 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1129 | for item in portUpOfpToDevNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1130 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1131 | portUpOfpToDevList.append(item) |
| 1132 | |
| 1133 | for item in portUpDevToLinkNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1134 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1135 | portUpDevToLinkList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1136 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1137 | for item in portUpLinkToGraphNodeIter[node]: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 1138 | if item >= 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1139 | portUpLinkToGraphList.append(item) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1140 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1141 | for item in portDownEndToEndNodeIter[node]: |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1142 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1143 | portDownEndToEndList.append(item) |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1144 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1145 | for item in portDownOfpToDevNodeIter[node]: |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1146 | if item > 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1147 | portDownOfpToDevList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1148 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1149 | for item in portDownDevToLinkNodeIter[node]: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 1150 | if item >= 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1151 | portDownDevToLinkList.append(item) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1152 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1153 | for item in portDownLinkToGraphNodeIter[node]: |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 1154 | if item >= 0.0: |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1155 | portDownLinkToGraphList.append(item) |
| 1156 | |
| 1157 | portUpEndToEndAvg = round(numpy.mean(portUpEndToEndList), 2) |
| 1158 | portUpOfpToDevAvg = round(numpy.mean(portUpOfpToDevList), 2) |
| 1159 | portUpDevToLinkAvg = round(numpy.mean(portUpDevToLinkList), 2) |
| 1160 | portUpLinkToGraphAvg = round(numpy.mean(portUpLinkToGraphList), 2) |
| 1161 | |
| 1162 | portDownEndToEndAvg = round(numpy.mean(portDownEndToEndList), 2) |
| 1163 | portDownOfpToDevAvg = round(numpy.mean(portDownOfpToDevList), 2) |
| 1164 | portDownDevToLinkAvg = round(numpy.mean(portDownDevToLinkList), 2) |
| 1165 | portDownLinkToGraphAvg = round(numpy.mean(portDownLinkToGraphList), 2) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1166 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1167 | portUpStdDev = round(numpy.std(portUpEndToEndList), 2) |
| 1168 | portDownStdDev = round(numpy.std(portDownEndToEndList), 2) |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1169 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1170 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1171 | main.log.report(' Port up End-to-end ' + |
| 1172 | str(portUpEndToEndAvg) + ' ms') |
| 1173 | main.log.report(' Port up Ofp-to-device ' + |
| 1174 | str(portUpOfpToDevAvg) + ' ms') |
| 1175 | main.log.report(' Port up Device-to-link ' + |
| 1176 | str(portUpDevToLinkAvg) + ' ms') |
| 1177 | main.log.report(' Port up Link-to-graph ' + |
| 1178 | str(portUpLinkToGraphAvg) + ' ms') |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1179 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1180 | main.log.report(' Port down End-to-end ' + |
| 1181 | str(round(portDownEndToEndAvg, 2)) + ' ms') |
| 1182 | main.log.report(' Port down Ofp-to-device ' + |
| 1183 | str(portDownOfpToDevAvg) + ' ms') |
andrew@onlab.us | 55711ed | 2015-04-23 14:28:08 -0400 | [diff] [blame] | 1184 | main.log.report(' Port down Device-to-link ' + |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1185 | str(portDownDevToLinkAvg) + ' ms') |
| 1186 | main.log.report(' Port down Link-to-graph' + |
| 1187 | str(portDownLinkToGraphAvg) + ' ms') |
jenkins | 8ba10ab | 2015-03-24 10:31:31 -0700 | [diff] [blame] | 1188 | |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1189 | dbCmdList.append("INSERT INTO port_latency_details VALUES('" + |
andrew@onlab.us | 09a4a0c | 2015-04-09 13:38:13 -0400 | [diff] [blame] | 1190 | timeToPost + "','port_latency_results'," + jenkinsBuildNumber + |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1191 | ',' + str(clusterCount) + ",'baremetal" + str(node + 1) + |
andrew@onlab.us | ede8aaf | 2015-04-10 14:32:26 -0400 | [diff] [blame] | 1192 | "'," + |
| 1193 | str(portUpEndToEndAvg) +',' + |
| 1194 | str(portUpOfpToDevAvg) + ',' + |
| 1195 | str(portUpDevToLinkAvg) + ',' + |
| 1196 | str(portUpLinkToGraphAvg) + ',' + |
| 1197 | str(portDownEndToEndAvg) + ',' + |
| 1198 | str(portDownOfpToDevAvg) + ',' + |
| 1199 | str(portDownDevToLinkAvg) + ',' + |
| 1200 | str(portDownLinkToGraphAvg) + |
| 1201 | ');') |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1202 | |
| 1203 | fResult = open(resultPath, 'a') |
| 1204 | for line in dbCmdList: |
| 1205 | if line: |
| 1206 | fResult.write(line + '\n') |
| 1207 | |
| 1208 | fResult.close() |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1209 | |
| 1210 | # Delete switches from controller to prepare for next |
| 1211 | # set of tests |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1212 | main.Mininet1.deleteSwController('s1') |
| 1213 | main.Mininet1.deleteSwController('s2') |
| 1214 | utilities.assert_equals(expect=main.TRUE, |
| 1215 | actual=assertion, |
| 1216 | onpass='Port discovery latency calculation successful', |
| 1217 | onfail='Port discovery test failed') |
| 1218 | |
| 1219 | def CASE4(self, main): |
| 1220 | """ |
| 1221 | Increase number of nodes and initiate CLI |
| 1222 | |
| 1223 | With the most recent implementation, we need a method to |
| 1224 | ensure all ONOS nodes are killed, as well as redefine |
| 1225 | the cell files to ensure all nodes that will be used |
| 1226 | is in the cell file. Otherwise, exceptions will |
| 1227 | prohibit test from running successfully. |
| 1228 | |
| 1229 | 3/12/15 |
| 1230 | |
| 1231 | """ |
| 1232 | global clusterCount |
| 1233 | import time |
| 1234 | import os |
| 1235 | |
| 1236 | clusterCount += 2 |
| 1237 | |
| 1238 | benchIp = main.params[ 'BENCH' ][ 'ip' ] |
| 1239 | features = main.params[ 'ENV' ][ 'cellFeatures' ] |
| 1240 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 1241 | mininetIp = main.params[ 'MN' ][ 'ip1' ] |
| 1242 | |
| 1243 | main.log.report('Increasing cluster size to ' + str(clusterCount)) |
| 1244 | |
| 1245 | main.log.step( "Killing all ONOS processes before scale-out" ) |
| 1246 | |
| 1247 | for i in range( 1, 8 ): |
| 1248 | main.ONOSbench.onosDie( |
| 1249 | main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 1250 | main.ONOSbench.onosUninstall( |
| 1251 | main.params[ 'CTRL' ][ 'ip'+str(i) ] ) |
| 1252 | |
| 1253 | main.step( "Creating scale-out cell file" ) |
| 1254 | cellIp = [] |
| 1255 | for node in range( 1, clusterCount + 1 ): |
| 1256 | cellIp.append( main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1257 | |
| 1258 | main.log.info( "Cell Ip list: " + str(cellIp) ) |
| 1259 | main.ONOSbench.createCellFile( benchIp, cellName, mininetIp, |
| 1260 | str(features), *cellIp ) |
| 1261 | |
| 1262 | main.step( "Setting cell definition" ) |
| 1263 | main.ONOSbench.setCell(cellName) |
| 1264 | |
| 1265 | main.step( "Packaging cell definition" ) |
| 1266 | main.ONOSbench.onosPackage() |
| 1267 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1268 | for node in range( 1, clusterCount + 1 ): |
jenkins | ac38ab7 | 2015-03-13 11:24:10 -0700 | [diff] [blame] | 1269 | main.ONOSbench.onosInstall( |
| 1270 | node = main.params[ 'CTRL' ][ 'ip'+str(node) ]) |
| 1271 | |
| 1272 | time.sleep( 20 ) |
| 1273 | |
jenkins | 7ead5a8 | 2015-03-13 10:28:21 -0700 | [diff] [blame] | 1274 | for node in range( 1, clusterCount + 1): |
| 1275 | for i in range( 2 ): |
| 1276 | isup = main.ONOSbench.isup( |
| 1277 | main.params[ 'CTRL' ][ 'ip'+str(node) ] ) |
| 1278 | if isup: |
| 1279 | main.log.info( "ONOS "+str(node) + " is up\n") |
| 1280 | break |
| 1281 | if not isup: |
| 1282 | main.log.error( "ONOS "+str(node) + " did not start" ) |
jenkins | ac38ab7 | 2015-03-13 11:24:10 -0700 | [diff] [blame] | 1283 | |
andrew@onlab.us | b4cb2b8 | 2015-04-03 14:06:09 -0400 | [diff] [blame] | 1284 | for node in range( 0, clusterCount ): |
| 1285 | CLIs[node].startOnosCli( cellIp[node] ) |
| 1286 | |
| 1287 | main.step( 'Setting configurations for metrics' ) |
| 1288 | configParam = 'maxEvents 1' |
| 1289 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 1290 | configParam = 'maxBatchMs 0' |
| 1291 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 1292 | configParam = 'maxIdleMs 0' |
| 1293 | main.ONOSbench.onosCfgSet( nodeIpList[0], configName, configParam ) |
| 1294 | |
| 1295 | main.step( 'Activating essential applications' ) |
| 1296 | CLIs[0].activateApp( 'org.onosproject.metrics' ) |
| 1297 | CLIs[0].activateApp( 'org.onosproject.openflow' ) |
jenkins | ac38ab7 | 2015-03-13 11:24:10 -0700 | [diff] [blame] | 1298 | |