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