cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 1 | # CASE1 starts number of nodes specified in param file |
| 2 | # |
| 3 | # cameron@onlab.us |
| 4 | |
| 5 | class SCPFswitchLat: |
| 6 | |
| 7 | def __init__( self ): |
| 8 | self.default = '' |
| 9 | |
| 10 | def CASE1( self, main ): |
| 11 | import sys |
Jon Hall | f632d20 | 2015-07-30 15:45:11 -0700 | [diff] [blame] | 12 | import re |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 13 | import os |
| 14 | import time |
| 15 | |
| 16 | global init |
| 17 | try: |
| 18 | if type(init) is not bool: |
| 19 | init = Fals |
| 20 | except NameError: |
| 21 | init = False |
| 22 | |
| 23 | #Load values from params file |
| 24 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
| 25 | gitPull = main.params[ 'GIT' ][ 'autopull' ] |
| 26 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 27 | Apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 28 | BENCHIp = main.params[ 'BENCH' ][ 'ip' ] |
| 29 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 30 | main.maxNodes = int(main.params[ 'max' ]) |
| 31 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 32 | homeDir = os.path.expanduser('~') |
| 33 | topoCfgFile = main.params['TEST']['topoConfigFile'] |
| 34 | topoCfgName = main.params['TEST']['topoConfigName'] |
| 35 | switchEventResultPath = main.params['DB']['switchEventResultPath'] |
| 36 | skipMvn = main.params ['TEST']['mci'] |
Jon Hall | f632d20 | 2015-07-30 15:45:11 -0700 | [diff] [blame] | 37 | testONpath = re.sub( "(tests)$", "bin", main.testDir ) # TestON/bin |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 38 | user = main.params[ 'CTRL' ][ 'user' ] |
| 39 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 40 | # -- INIT SECTION, ONLY RUNS ONCE -- # |
| 41 | if init == False: |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 42 | init = True |
| 43 | global clusterCount #number of nodes running |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 44 | global scale |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 45 | global commit |
| 46 | global timeToPost |
| 47 | global runNum |
| 48 | global jenkinsBuildNumber |
| 49 | global CLIs |
| 50 | CLIs = [] |
| 51 | main.ONOSIp = [] |
| 52 | |
| 53 | for i in range( 1, 8 ): |
| 54 | CLIs.append( getattr( main, 'ONOS' + str( i ) + 'cli' ) ) |
| 55 | |
| 56 | timeToPost = time.strftime('%Y-%m-%d %H:%M:%S') |
| 57 | runNum = time.strftime('%d%H%M%S') |
| 58 | |
| 59 | try: |
| 60 | jenkinsBuildNumber = str(os.environ['BUILD_NUMBER']) |
| 61 | main.log.report( 'Jenkins build number: ' + jenkinsBuildNumber ) |
| 62 | except KeyError: |
| 63 | jenkinsBuildNumber = str(0) |
| 64 | main.log.info( 'Job is not run by jenkins. ' + 'Build number set to: ' + jenkinsBuildNumber) |
| 65 | |
| 66 | clusterCount = 0 |
| 67 | main.ONOSIp = main.ONOSbench.getOnosIps() |
| 68 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 69 | scale = (main.params[ 'SCALE' ]).split(",") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 70 | clusterCount = int(scale[0]) |
| 71 | |
| 72 | #mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test |
| 73 | if skipMvn != "off": |
| 74 | mvnResult = main.ONOSbench.cleanInstall() |
| 75 | |
| 76 | #git |
| 77 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 78 | if gitPull == 'on': |
| 79 | checkoutResult = main.ONOSbench.gitCheckout( checkoutBranch ) |
| 80 | pullResult = main.ONOSbench.gitPull() |
| 81 | |
| 82 | else: |
| 83 | checkoutResult = main.TRUE |
| 84 | pullResult = main.TRUE |
| 85 | main.log.info( "Skipped git checkout and pull" ) |
| 86 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 87 | main.log.step("Grabbing commit number") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 88 | commit = main.ONOSbench.getVersion() #### |
| 89 | commit = (commit.split(" "))[1] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 90 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 91 | temp = testONpath.replace("bin","") + "tests/SCPFswitchLat/Dependency/" |
kelvin-onlab | d9e23de | 2015-08-06 10:34:44 -0700 | [diff] [blame] | 92 | main.ONOSbench.scp( main.Mininet1, |
| 93 | temp + "topo-perf-1sw.py", |
| 94 | main.Mininet1.home, |
| 95 | direction="to" ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 96 | #main.ONOSbench.handle.expect(":~") |
| 97 | |
| 98 | main.step('Clearing previous DB log file') |
| 99 | print switchEventResultPath |
| 100 | fSwitchLog = open(switchEventResultPath, "w+") |
| 101 | fSwitchLog.write("") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 102 | fSwitchLog.close() |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 103 | |
| 104 | # -- END OF INIT SECTION --# |
| 105 | |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 106 | main.log.step("Adjusting scale") |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 107 | clusterCount = int(scale[0]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 108 | scale.remove(scale[0]) |
| 109 | |
| 110 | #kill off all onos processes |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 111 | main.log.step("Safety check, killing all ONOS processes before initiating enviornment setup") |
| 112 | for node in range(main.maxNodes): |
| 113 | main.ONOSbench.onosDie(main.ONOSIp[node]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 114 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 115 | #Uninstall everywhere |
| 116 | main.log.step( "Cleaning Enviornment..." ) |
| 117 | for i in range(main.maxNodes): |
| 118 | main.log.info(" Uninstalling ONOS " + str(i) ) |
| 119 | main.ONOSbench.onosUninstall( main.ONOSIp[i] ) |
| 120 | main.log.info("Sleep 10 second for uninstall to settle...") |
| 121 | time.sleep(10) |
| 122 | main.ONOSbench.handle.sendline(" ") |
| 123 | main.ONOSbench.handle.expect(":~") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 124 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 125 | #construct the cell file |
| 126 | main.log.info("Creating cell file") |
| 127 | cellIp = [] |
| 128 | for node in range (clusterCount): |
| 129 | cellIp.append(main.ONOSIp[node]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 130 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 131 | main.ONOSbench.createCellFile(main.ONOSbench.ip_address, cellName, MN1Ip, str(Apps), cellIp) |
| 132 | |
| 133 | main.step( "Set Cell" ) |
| 134 | main.ONOSbench.setCell(cellName) |
| 135 | |
| 136 | main.step( "Creating ONOS package" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 137 | packageResult = main.ONOSbench.onosPackage() |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 138 | |
| 139 | main.step( "verify cells" ) |
| 140 | verifyCellResult = main.ONOSbench.verifyCell() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 141 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 142 | main.step('Starting mininet topology ') |
| 143 | main.Mininet1.startNet() |
| 144 | |
| 145 | main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." ) |
| 146 | for node in range(clusterCount): |
| 147 | main.log.info("Starting ONOS " + str(node) + " at IP: " + main.ONOSIp[node]) |
| 148 | main.ONOSbench.onosInstall( node=main.ONOSIp[node]) |
| 149 | |
| 150 | for i in range(50): |
| 151 | time.sleep(15) |
| 152 | print "attempt " + str(i) |
| 153 | main.ONOSbench.handle.sendline("onos $OC1 summary") |
| 154 | main.ONOSbench.handle.expect(":~") |
| 155 | print main.ONOSbench.handle.before |
| 156 | if "nodes=" in main.ONOSbench.handle.before: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 157 | break |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 158 | |
| 159 | for node in range(clusterCount): |
| 160 | for i in range( 2 ): |
| 161 | isup = main.ONOSbench.isup( main.ONOSIp[node] ) |
| 162 | if isup: |
| 163 | main.log.info("ONOS " + str(node) + " is up\n") |
| 164 | break |
| 165 | if not isup: |
| 166 | main.log.report( "ONOS " + str(node) + " didn't start!" ) |
| 167 | main.log.info("Startup sequence complete") |
| 168 | |
| 169 | #time.sleep(20) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 170 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 171 | main.step('Start onos cli') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 172 | for i in range(0,clusterCount): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 173 | cli1 = CLIs[i].startOnosCli(main.ONOSIp[i]) |
| 174 | |
| 175 | main.step( 'Configuring application parameters' ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 176 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 177 | configName = 'org.onosproject.net.topology.impl.DefaultTopologyProvider' |
| 178 | configParam = 'maxEvents 1' |
| 179 | main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam ) |
| 180 | configParam = 'maxBatchMs 0' |
| 181 | main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam ) |
| 182 | configParam = 'maxIdleMs 0' |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 183 | main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 184 | |
| 185 | def CASE2(self, main): |
| 186 | print "Cluster size: " + str(clusterCount) |
| 187 | """ |
| 188 | Assign s3 to ONOSbench and measure latency |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 189 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 190 | There are 4 levels of latency measurements to this test: |
| 191 | 1 ) End-to-end measurement: Complete end-to-end measurement |
| 192 | from TCP ( SYN/ACK ) handshake to Graph change |
| 193 | 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of |
| 194 | measurement from OFP Vendor message to Graph change |
| 195 | 3 ) OFP-to-device measurement: 'ONOS processing without |
| 196 | graph change' snippet of measurement from OFP vendor |
| 197 | message to Device change timestamp |
| 198 | 4 ) T0-to-device measurement: Measurement that includes |
| 199 | the switch handshake to devices timestamp without |
| 200 | the graph view change. ( TCP handshake -> Device |
| 201 | change ) |
| 202 | """ |
| 203 | import time |
| 204 | import subprocess |
| 205 | import json |
| 206 | import requests |
| 207 | import os |
| 208 | import numpy |
| 209 | |
| 210 | ONOSUser = main.params['CTRL']['user'] |
| 211 | numIter = main.params['TEST']['numIter'] |
| 212 | iterIgnore = int(main.params['TEST']['iterIgnore']) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 213 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 214 | deviceTimestampKey = main.params['JSON']['deviceTimestamp'] |
| 215 | graphTimestampKey = main.params['JSON']['graphTimestamp'] |
| 216 | |
| 217 | debugMode = main.params['TEST']['debugMode'] |
| 218 | onosLog = main.params['TEST']['onosLogFile'] |
| 219 | resultPath = main.params['DB']['switchEventResultPath'] |
| 220 | thresholdStr = main.params['TEST']['singleSwThreshold'] |
| 221 | thresholdObj = thresholdStr.split(',') |
| 222 | thresholdMin = int(thresholdObj[0]) |
| 223 | thresholdMax = int(thresholdObj[1]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 224 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 225 | # Look for 'role-request' messages, |
| 226 | # which replaces the 'vendor' messages previously seen |
| 227 | # on OVS 2.0.1 |
| 228 | tsharkTcpString = main.params[ 'TSHARK' ][ 'tcpSynAck' ] |
| 229 | tsharkFeatureReply = main.params[ 'TSHARK' ][ 'featureReply' ] |
| 230 | tsharkRoleRequest = main.params[ 'TSHARK' ][ 'roleRequest' ] |
| 231 | tsharkOfString = main.params[ 'TSHARK' ][ 'ofpRoleReply' ] |
| 232 | tsharkFinAckSequence = main.params[ 'TSHARK' ][ 'finAckSequence' ] |
| 233 | |
| 234 | tsharkOfOutput = '/tmp/tshark_of_topo.txt' |
| 235 | tsharkTcpOutput = '/tmp/tshark_tcp_topo.txt' |
| 236 | tsharkRoleOutput = '/tmp/tshark_role_request.txt' |
| 237 | tsharkFeatureOutput = '/tmp/tshark_feature_reply.txt' |
| 238 | tsharkFinAckOutput = '/tmp/tshark_fin_ack.txt' |
| 239 | |
| 240 | # Switch connect measurement list |
| 241 | # TCP Syn/Ack -> Feature Reply latency collection for each node |
| 242 | tcpToFeatureLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
| 243 | # Feature Reply -> Role Request latency collection for each node |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 244 | featureToRoleRequestLatNodeIter = numpy.zeros((clusterCount, |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 245 | int(numIter))) |
| 246 | # Role Request -> Role Reply latency collection for each node |
| 247 | roleRequestToRoleReplyLatNodeIter = numpy.zeros((clusterCount, |
| 248 | int(numIter))) |
| 249 | # Role Reply -> Device Update latency collection for each node |
| 250 | roleReplyToDeviceLatNodeIter = numpy.zeros((clusterCount, |
| 251 | int(numIter))) |
| 252 | # Device Update -> Graph Update latency collection for each node |
| 253 | deviceToGraphLatNodeIter = numpy.zeros((clusterCount, |
| 254 | int(numIter))) |
| 255 | endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 256 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 257 | # Switch disconnect measurement lists |
| 258 | # Mininet Fin / Ack -> Mininet Ack |
| 259 | finAckTransactionLatNodeIter = numpy.zeros((clusterCount, |
| 260 | int(numIter))) |
| 261 | # Mininet Ack -> Device Event |
| 262 | ackToDeviceLatNodeIter = numpy.zeros((clusterCount, |
| 263 | int(numIter))) |
| 264 | # Device event -> Graph event |
| 265 | deviceToGraphDiscLatNodeIter = numpy.zeros((clusterCount, |
| 266 | int(numIter))) |
| 267 | endToEndDiscLatNodeIter = numpy.zeros((clusterCount, int(numIter))) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 268 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 269 | assertion = main.TRUE |
| 270 | localTime = time.strftime('%x %X') |
| 271 | localTime = localTime.replace('/', '') |
| 272 | localTime = localTime.replace(' ', '_') |
| 273 | localTime = localTime.replace(':', '') |
| 274 | |
| 275 | if debugMode == 'on': |
| 276 | main.ONOSbench.tsharkPcap('eth0', '/tmp/single_sw_lat_pcap_' + localTime) |
| 277 | main.log.info('Debug mode is on') |
| 278 | |
| 279 | main.log.report('Latency of adding one switch to controller') |
| 280 | main.log.report('First ' + str(iterIgnore) + ' iterations ignored' + ' for jvm warmup time') |
| 281 | main.log.report('Total iterations of test: ' + str(numIter)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 282 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 283 | for i in range(0, int(numIter)): |
| 284 | main.log.info('Starting tshark capture') |
| 285 | main.ONOSbench.tsharkGrep(tsharkTcpString, tsharkTcpOutput) |
| 286 | main.ONOSbench.tsharkGrep(tsharkOfString, tsharkOfOutput) |
| 287 | main.ONOSbench.tsharkGrep(tsharkRoleRequest, tsharkRoleOutput) |
| 288 | main.ONOSbench.tsharkGrep(tsharkFeatureReply, tsharkFeatureOutput) |
| 289 | |
| 290 | time.sleep(10) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 291 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 292 | main.log.info('Assigning s3 to controller') |
| 293 | main.Mininet1.assignSwController(sw='s3', |
| 294 | ip=main.ONOSIp[0]) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 295 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 296 | jsonStr = [] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 297 | for node in range (0, clusterCount): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 298 | metricsSwUp = CLIs[node].topologyEventsMetrics() |
| 299 | jsonStr.append(metricsSwUp) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 300 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 301 | time.sleep(10) |
| 302 | |
| 303 | main.log.info('Stopping all Tshark processes') |
| 304 | main.ONOSbench.tsharkStop() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 305 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 306 | time.sleep(5) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 307 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 308 | ''' |
| 309 | main.log.info('Copying over tshark files') |
| 310 | os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] + |
| 311 | ':' + tsharkTcpOutput + ' /tmp/') |
| 312 | os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] + |
| 313 | ':' + tsharkRoleOutput + ' /tmp/') |
| 314 | os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] + |
| 315 | ':' + tsharkFeatureOutput + ' /tmp/') |
| 316 | os.system('scp ' + ONOSUser + '@' + |
| 317 | main.ONOSIp[0] + ':' + tsharkOfOutput + ' /tmp/') |
| 318 | ''' |
| 319 | |
| 320 | # Get tcp syn / ack output |
| 321 | time.sleep(1) |
| 322 | |
| 323 | tcpFile = open(tsharkTcpOutput, 'r') |
| 324 | tempText = tcpFile.readline() |
| 325 | tempText = tempText.split(' ') |
| 326 | main.log.info('Object read in from TCP capture: ' + str(tempText)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 327 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 328 | if len(tempText) > 1: |
| 329 | t0Tcp = float(tempText[1]) * 1000.0 |
| 330 | else: |
| 331 | main.log.error('Tshark output file for TCP' + ' returned unexpected results') |
| 332 | t0Tcp = 0 |
| 333 | assertion = main.FALSE |
| 334 | tcpFile.close() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 335 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 336 | # Get Role reply output |
| 337 | ofFile = open(tsharkOfOutput, 'r') |
| 338 | lineOfp = '' |
| 339 | while True: |
| 340 | tempText = ofFile.readline() |
| 341 | if tempText != '': |
| 342 | lineOfp = tempText |
| 343 | else: |
| 344 | break |
| 345 | obj = lineOfp.split(' ') |
| 346 | main.log.info('Object read in from OFP capture: ' + |
| 347 | str(lineOfp)) |
| 348 | if len(obj) > 1: |
| 349 | t0Ofp = float(obj[1]) * 1000.0 |
| 350 | else: |
| 351 | main.log.error('Tshark output file for OFP' + |
| 352 | ' returned unexpected results') |
| 353 | t0Ofp = 0 |
| 354 | assertion = main.FALSE |
| 355 | ofFile.close() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 356 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 357 | # Get role request output |
| 358 | roleFile = open(tsharkRoleOutput, 'r') |
| 359 | tempText = roleFile.readline() |
| 360 | tempText = tempText.split(' ') |
| 361 | if len(tempText) > 1: |
| 362 | main.log.info('Object read in from role request capture:' + |
| 363 | str(tempText)) |
| 364 | roleTimestamp = float(tempText[1]) * 1000.0 |
| 365 | else: |
| 366 | main.log.error('Tshark output file for role request' + |
| 367 | ' returned unexpected results') |
| 368 | timeRoleRequest = 0 |
| 369 | assertion = main.FALSE |
| 370 | roleFile.close() |
| 371 | |
| 372 | # Get feature reply output |
| 373 | featureFile = open(tsharkFeatureOutput, 'r') |
| 374 | tempText = featureFile.readline() |
| 375 | tempText = tempText.split(' ') |
| 376 | if len(tempText) > 1: |
| 377 | main.log.info('Object read in from feature reply capture: '+ |
| 378 | str(tempText)) |
| 379 | if tempText[1] != ' ' and float(tempText[1]) > 1400000000.0: |
| 380 | temp = tempText[1] |
| 381 | elif tempText[2] != ' ' and float(tempText[2]) > 1400000000.0: |
| 382 | temp = tempText[2] |
| 383 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 384 | temp = 0 |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 385 | featureTimestamp = float(temp) * 1000.0 |
| 386 | else: |
| 387 | main.log.error('Tshark output file for feature reply' + |
| 388 | ' returned unexpected results') |
| 389 | timeFeatureReply = 0 |
| 390 | assertion = main.FALSE |
| 391 | featureFile.close() |
| 392 | |
| 393 | for node in range(0, clusterCount): |
| 394 | nodeNum = node+1 |
| 395 | #metricsSwUp = CLIs[node].topologyEventsMetrics |
| 396 | #jsonStr = metricsSwUp() |
| 397 | jsonObj = json.loads(jsonStr[node]) |
| 398 | if jsonObj: |
| 399 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 400 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 401 | else: |
| 402 | main.log.error( "Unexpected JSON object" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 403 | # If we could not obtain the JSON object, |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 404 | # set the timestamps to 0, which will be |
| 405 | # excluded from the measurement later on |
| 406 | # (realized as invalid) |
| 407 | graphTimestamp = 0 |
| 408 | deviceTimestamp = 0 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 409 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 410 | endToEnd = int(graphTimestamp) - int(t0Tcp) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 411 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 412 | # Below are measurement breakdowns of the end-to-end |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 413 | # measurement. |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 414 | tcpToFeature = int(featureTimestamp) - int(t0Tcp) |
| 415 | featureToRole = int(roleTimestamp) - int(featureTimestamp) |
| 416 | roleToOfp = float(t0Ofp) - float(roleTimestamp) |
| 417 | ofpToDevice = float(deviceTimestamp) - float(t0Ofp) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 418 | # Timestamps gathered from ONOS are millisecond |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 419 | # precision. They are returned as integers, thus no |
| 420 | # need to be more precise than 'int'. However, |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 421 | # the processing seems to be mostly under 1 ms, |
| 422 | # thus this may be a problem point to handle any |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 423 | # submillisecond output that we are unsure of. |
| 424 | # For now, this will be treated as 0 ms if less than 1 ms |
| 425 | deviceToGraph = int(graphTimestamp) - int(deviceTimestamp) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 426 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 427 | if endToEnd >= thresholdMin and\ |
| 428 | endToEnd < thresholdMax and i >= iterIgnore: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 429 | endToEndLatNodeIter[node][i] = endToEnd |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 430 | main.log.info("ONOS "+str(nodeNum)+ " end-to-end: "+ |
| 431 | str(endToEnd) + " ms") |
| 432 | else: |
| 433 | main.log.info("ONOS "+str(nodeNum)+ " end-to-end "+ |
| 434 | "measurement ignored due to excess in "+ |
| 435 | "threshold or premature iteration: ") |
| 436 | main.log.info(str(endToEnd)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 437 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 438 | if tcpToFeature >= thresholdMin and\ |
| 439 | tcpToFeature < thresholdMax and i >= iterIgnore: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 440 | tcpToFeatureLatNodeIter[node][i] = tcpToFeature |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 441 | main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature: "+ |
| 442 | str(tcpToFeature) + " ms") |
| 443 | else: |
| 444 | main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature "+ |
| 445 | "measurement ignored due to excess in "+ |
| 446 | "threshold or premature iteration: ") |
| 447 | main.log.info(str(tcpToFeature)) |
| 448 | |
| 449 | if featureToRole >= thresholdMin and\ |
| 450 | featureToRole < thresholdMax and i >= iterIgnore: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 451 | featureToRoleRequestLatNodeIter[node][i] = featureToRole |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 452 | main.log.info("ONOS "+str(nodeNum)+ " feature-to-role: "+ |
| 453 | str(featureToRole) + " ms") |
| 454 | else: |
| 455 | main.log.info("ONOS "+str(nodeNum)+ " feature-to-role "+ |
| 456 | "measurement ignored due to excess in "+ |
| 457 | "threshold or premature iteration: ") |
| 458 | main.log.info(str(featureToRole)) |
| 459 | |
| 460 | if roleToOfp >= thresholdMin and\ |
| 461 | roleToOfp < thresholdMax and i >= iterIgnore: |
| 462 | roleRequestToRoleReplyLatNodeIter[node][i] = roleToOfp |
| 463 | main.log.info("ONOS "+str(nodeNum)+ " role-to-reply: "+ |
| 464 | str(roleToOfp) + " ms") |
| 465 | else: |
| 466 | main.log.info("ONOS "+str(nodeNum)+ " role-to-reply "+ |
| 467 | "measurement ignored due to excess in "+ |
| 468 | "threshold or premature iteration: ") |
| 469 | main.log.info(str(roleToOfp)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 470 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 471 | if ofpToDevice >= thresholdMin and\ |
| 472 | ofpToDevice < thresholdMax and i >= iterIgnore: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 473 | roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 474 | main.log.info("ONOS "+str(nodeNum)+ " reply-to-device: "+ |
| 475 | str(ofpToDevice) + " ms") |
| 476 | else: |
| 477 | main.log.info("ONOS "+str(nodeNum)+ " reply-to-device "+ |
| 478 | "measurement ignored due to excess in "+ |
| 479 | "threshold or premature iteration: ") |
| 480 | main.log.info(str(ofpToDevice)) |
| 481 | |
| 482 | if deviceToGraph >= thresholdMin and\ |
| 483 | deviceToGraph < thresholdMax and i >= iterIgnore: |
| 484 | deviceToGraphLatNodeIter[node][i] = deviceToGraph |
| 485 | main.log.info("ONOS "+str(nodeNum)+ " device-to-graph: "+ |
| 486 | str(deviceToGraph) + " ms") |
| 487 | else: |
| 488 | if deviceToGraph == 0: |
| 489 | deviceToGraphLatNodeIter[node][i] = 0 |
| 490 | main.log.info("ONOS "+str(nodeNum) + |
| 491 | " device-to-graph measurement "+ |
| 492 | "was set to 0 ms because of precision "+ |
| 493 | "uncertainty. ") |
| 494 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 495 | main.log.info("ONOS "+str(nodeNum)+ |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 496 | " device-to-graph "+ |
| 497 | "measurement ignored due to excess in "+ |
| 498 | "threshold or premature iteration: ") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 499 | main.log.info(str(deviceToGraph)) |
| 500 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 501 | # ******************** |
| 502 | time.sleep(5) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 503 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 504 | # Get device id to remove |
| 505 | deviceIdJsonStr = main.ONOS1cli.devices() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 506 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 507 | main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) ) |
| 508 | deviceId = json.loads(deviceIdJsonStr) |
| 509 | |
| 510 | deviceList = [] |
| 511 | for device in deviceId: |
| 512 | deviceList.append(device['id']) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 513 | |
| 514 | # Measure switch down metrics |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 515 | # TCP FIN/ACK -> TCP FIN |
| 516 | # TCP FIN -> Device Event |
| 517 | # Device Event -> Graph Event |
| 518 | # Capture switch down FIN / ACK packets |
| 519 | |
| 520 | # The -A 1 grep option allows us to grab 1 extra line after the |
| 521 | # last tshark output grepped originally |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 522 | main.ONOSbench.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput, |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 523 | grepOptions = '-A 1' ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 524 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 525 | time.sleep( 5 ) |
| 526 | |
| 527 | removeJsonList = [] |
| 528 | main.step('Remove switch from controller') |
| 529 | main.Mininet1.deleteSwController('s3') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 530 | firstDevice = deviceList[0] |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 531 | |
| 532 | time.sleep( 5 ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 533 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 534 | # We need to get metrics before removing |
| 535 | # device from the store below. |
| 536 | for node in range(0, clusterCount): |
| 537 | metricsSwDown = CLIs[node].topologyEventsMetrics |
| 538 | jsonStr = metricsSwDown() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 539 | removeJsonList.append( json.loads(jsonStr) ) |
| 540 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 541 | main.ONOSbench.tsharkStop() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 542 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 543 | main.log.info( "Removing device " +str(firstDevice)+ |
| 544 | " from ONOS" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 545 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 546 | #if deviceId: |
| 547 | main.ONOS1cli.deviceRemove(firstDevice) |
| 548 | |
| 549 | #main.log.info('Copying over tshark files') |
| 550 | #os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] + ':' + tsharkFinAckOutput + ' /tmp/') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 551 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 552 | time.sleep( 10 ) |
| 553 | finAckOutputList = [] |
| 554 | with open(tsharkFinAckOutput, 'r') as f: |
| 555 | tempLine = f.readlines() |
| 556 | main.log.info('Object read in from FinAck capture: ' + |
| 557 | "\n".join(tempLine)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 558 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 559 | index = 1 |
| 560 | for line in tempLine: |
| 561 | obj = line.split(' ') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 562 | |
| 563 | # There are at least 3 objects in field (valid |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 564 | # tshark output is lengthy) |
| 565 | if len(obj) > 2: |
| 566 | # If first index of object is like an epoch time |
| 567 | if obj[1] != ' ' and float(obj[1]) > 1400000000.0: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 568 | temp = obj[1] |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 569 | elif obj[2] != ' 'and float(obj[2]) > 1400000000.0: |
| 570 | temp = obj[2] |
| 571 | elif obj[3] != ' 'and float(obj[3]) > 1400000000.0: |
| 572 | temp = obj[3] |
| 573 | else: |
| 574 | temp = 0 |
| 575 | if index == 1: |
| 576 | tFinAck = float(temp) * 1000.0 |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 577 | main.log.info("DEBUG-- tFinAck: " + str(tFinAck)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 578 | elif index == 3: |
| 579 | tAck = float(temp) * 1000.0 |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 580 | main.log.info("DEBUG-- tAck: " + str(tAck)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 581 | else: |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 582 | tAck = 0 |
| 583 | else: |
| 584 | main.log.error('Tshark output file for OFP' + |
| 585 | ' returned unexpected results') |
| 586 | tFinAck = 0 |
| 587 | tAck = 0 |
| 588 | assertion = main.FALSE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 589 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 590 | index += 1 |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 591 | main.log.info("DEBUG-- tFinAck: " + str(tFinAck)) |
| 592 | main.log.info("DEBUG-- tAck: " + str(tAck)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 593 | |
| 594 | # with open() as f takes care of closing file |
| 595 | |
| 596 | time.sleep(5) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 597 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 598 | for node in range(0, clusterCount): |
| 599 | nodeNum = node+1 |
| 600 | jsonObj = removeJsonList[node] |
| 601 | if jsonObj: |
| 602 | graphTimestamp = jsonObj[graphTimestampKey]['value'] |
| 603 | deviceTimestamp = jsonObj[deviceTimestampKey]['value'] |
| 604 | main.log.info("Graph timestamp: "+str(graphTimestamp)) |
| 605 | main.log.info("Device timestamp: "+str(deviceTimestamp)) |
| 606 | else: |
| 607 | main.log.error( "Unexpected JSON object" ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 608 | # If we could not obtain the JSON object, |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 609 | # set the timestamps to 0, which will be |
| 610 | # excluded from the measurement later on |
| 611 | # (realized as invalid) |
| 612 | graphTimestamp = 0 |
| 613 | deviceTimestamp = 0 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 614 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 615 | finAckTransaction = float(tAck) - float(tFinAck) |
| 616 | ackToDevice = float(deviceTimestamp) - float(tAck) |
| 617 | deviceToGraph = float(graphTimestamp) - float(deviceTimestamp) |
| 618 | endToEndDisc = int(graphTimestamp) - int(tFinAck) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 619 | main.log.info("DEBUG-- endToEndDisc = graphTimestamp - tFinAck == (" + str(graphTimestamp) + "-" + str(tFinAck) + ")") |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 620 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 621 | if endToEndDisc >= thresholdMin and\ |
| 622 | endToEndDisc < thresholdMax and i >= iterIgnore: |
| 623 | endToEndDiscLatNodeIter[node][i] = endToEndDisc |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 624 | main.log.info("ONOS "+str(nodeNum) + |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 625 | "end-to-end disconnection: "+ |
| 626 | str(endToEndDisc) + " ms" ) |
| 627 | else: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 628 | main.log.info("ONOS " + str(nodeNum) + |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 629 | " end-to-end disconnection "+ |
| 630 | "measurement ignored due to excess in "+ |
| 631 | "threshold or premature iteration: ") |
| 632 | main.log.info(str(endToEndDisc)) |
| 633 | |
| 634 | if finAckTransaction >= thresholdMin and\ |
| 635 | finAckTransaction < thresholdMax and i >= iterIgnore: |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 636 | finAckTransactionLatNodeIter[node][i] = finAckTransaction |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 637 | main.log.info("ONOS "+str(nodeNum)+ |
| 638 | " fin/ack transaction: "+ |
| 639 | str(finAckTransaction) + " ms") |
| 640 | else: |
| 641 | main.log.info("ONOS "+str(nodeNum)+ |
| 642 | " fin/ack transaction "+ |
| 643 | "measurement ignored due to excess in "+ |
| 644 | "threshold or premature iteration: ") |
| 645 | main.log.info(str(finAckTransaction)) |
| 646 | |
| 647 | if ackToDevice >= thresholdMin and\ |
| 648 | ackToDevice < thresholdMax and i >= iterIgnore: |
| 649 | ackToDeviceLatNodeIter[node][i] = ackToDevice |
| 650 | main.log.info("ONOS "+str(nodeNum)+ |
| 651 | " ack-to-device: "+ |
| 652 | str(ackToDevice) + " ms") |
| 653 | else: |
| 654 | main.log.info("ONOS "+str(nodeNum)+ |
| 655 | " ack-to-device "+ |
| 656 | "measurement ignored due to excess in "+ |
| 657 | "threshold or premature iteration: ") |
| 658 | main.log.info(str(ackToDevice)) |
| 659 | |
| 660 | if deviceToGraph >= thresholdMin and\ |
| 661 | deviceToGraph < thresholdMax and i >= iterIgnore: |
| 662 | deviceToGraphDiscLatNodeIter[node][i] = deviceToGraph |
| 663 | main.log.info("ONOS "+str(nodeNum)+ |
| 664 | " device-to-graph disconnect: "+ |
| 665 | str(deviceToGraph) + " ms") |
| 666 | else: |
| 667 | main.log.info("ONOS "+str(nodeNum)+ |
| 668 | " device-to-graph disconnect "+ |
| 669 | "measurement ignored due to excess in "+ |
| 670 | "threshold or premature iteration: ") |
| 671 | main.log.info(str(deviceToGraph)) |
| 672 | |
| 673 | endToEndAvg = 0 |
| 674 | ofpToGraphAvg = 0 |
| 675 | dbCmdList = [] |
| 676 | for node in range(0, clusterCount): |
| 677 | # List of latency for each node |
| 678 | endToEndList = [] |
| 679 | tcpToFeatureList = [] |
| 680 | featureToRoleList = [] |
| 681 | roleToOfpList = [] |
| 682 | ofpToDeviceList = [] |
| 683 | deviceToGraphList = [] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 684 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 685 | finAckTransactionList = [] |
| 686 | ackToDeviceList = [] |
| 687 | deviceToGraphDiscList = [] |
| 688 | endToEndDiscList = [] |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 689 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 690 | # LatNodeIter 2d arrays contain all iteration latency |
| 691 | # for each node of the current scale cluster size |
| 692 | # Switch connection measurements |
| 693 | # Set further acceptance criteria for measurements |
| 694 | # here if you would like to filter reporting results |
| 695 | for item in endToEndLatNodeIter[node]: |
| 696 | if item > 0.0: |
| 697 | endToEndList.append(item) |
| 698 | |
| 699 | for item in tcpToFeatureLatNodeIter[node]: |
| 700 | if item > 0.0: |
| 701 | tcpToFeatureList.append(item) |
| 702 | |
| 703 | for item in featureToRoleRequestLatNodeIter[node]: |
| 704 | if item > 0.0: |
| 705 | featureToRoleList.append(item) |
| 706 | |
| 707 | for item in roleRequestToRoleReplyLatNodeIter[node]: |
| 708 | if item > 0.0: |
| 709 | roleToOfpList.append(item) |
| 710 | |
| 711 | for item in roleReplyToDeviceLatNodeIter[node]: |
| 712 | if item >= 0.0: |
| 713 | ofpToDeviceList.append(item) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 714 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 715 | for item in featureToRoleRequestLatNodeIter[node]: |
| 716 | if item > 0.0: |
| 717 | featureToRoleList.append(item) |
| 718 | |
| 719 | for item in deviceToGraphLatNodeIter[node]: |
| 720 | if item >= 0.0: |
| 721 | deviceToGraphList.append(item) |
| 722 | |
| 723 | # Switch disconnect measurements |
| 724 | for item in endToEndDiscLatNodeIter[node]: |
| 725 | if item > 0.0: |
| 726 | endToEndDiscList.append(item) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 727 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 728 | for item in finAckTransactionLatNodeIter[node]: |
| 729 | if item > 0.0: |
| 730 | finAckTransactionList.append(item) |
| 731 | |
| 732 | for item in ackToDeviceLatNodeIter[node]: |
| 733 | if item > 0.0: |
| 734 | ackToDeviceList.append(item) |
| 735 | |
| 736 | for item in deviceToGraphDiscLatNodeIter[node]: |
| 737 | if item >= 0.0: |
| 738 | deviceToGraphDiscList.append(item) |
| 739 | |
| 740 | endToEndAvg = round(numpy.mean(endToEndList), 2) |
| 741 | endToEndStdDev = round(numpy.std(endToEndList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 742 | main.log.info("endToEndList: " + str(endToEndList)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 743 | |
| 744 | tcpToFeatureAvg = round(numpy.mean(tcpToFeatureList), 2) |
| 745 | tcpToFeatureStdDev = round(numpy.std(tcpToFeatureList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 746 | main.log.info("tcpToFeatureList: " + str(tcpToFeatureList)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 747 | |
| 748 | featureToRoleAvg = round(numpy.mean(featureToRoleList), 2) |
| 749 | featureToRoleStdDev = round(numpy.std(featureToRoleList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 750 | main.log.info("featureToRoleList: " + str(featureToRoleList)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 751 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 752 | roleToOfpAvg = round(numpy.mean(roleToOfpList), 2) |
| 753 | roleToOfpStdDev = round(numpy.std(roleToOfpList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 754 | main.log.info("roleToOfList: " + str(roleToOfpList)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 755 | |
| 756 | ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2) |
| 757 | ofpToDeviceStdDev = round(numpy.std(ofpToDeviceList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 758 | main.log.info("ofpToDeviceList: " + str(ofpToDeviceList)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 759 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 760 | deviceToGraphAvg = round(numpy.mean(deviceToGraphList), 2) |
| 761 | deviceToGraphStdDev = round(numpy.std(deviceToGraphList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 762 | main.log.info("deviceToGraphList: " + str(deviceToGraphList)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 763 | |
| 764 | endToEndDiscAvg = round(numpy.mean(endToEndDiscList), 2) |
| 765 | endToEndDiscStdDev = round(numpy.std(endToEndDiscList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 766 | main.log.info("endToEndDiscList: " + str(endToEndDiscList)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 767 | |
| 768 | finAckAvg = round(numpy.mean(finAckTransactionList), 2) |
| 769 | finAckStdDev = round(numpy.std(finAckTransactionList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 770 | main.log.info("finAckTransactionList: " + str(finAckTransactionList)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 771 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 772 | ackToDeviceAvg = round(numpy.mean(ackToDeviceList), 2) |
| 773 | ackToDeviceStdDev = round(numpy.std(ackToDeviceList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 774 | main.log.info("ackToDeviceList: " + str(ackToDeviceList)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 775 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 776 | deviceToGraphDiscAvg = round(numpy.mean(deviceToGraphDiscList), 2) |
| 777 | deviceToGraphDiscStdDev = round(numpy.std(deviceToGraphDiscList), 2) |
cameron@onlab.us | 222f2e4 | 2015-07-30 12:08:27 -0700 | [diff] [blame] | 778 | main.log.info("deviceToGraphDiscList: " + str(deviceToGraphDiscList)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 779 | |
| 780 | main.log.report(' - Node ' + str(node + 1) + ' Summary - ') |
| 781 | main.log.report(' - Switch Connection Statistics - ') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 782 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 783 | main.log.report(' End-to-end Avg: ' + str(endToEndAvg) + |
| 784 | ' ms' + ' End-to-end Std dev: ' + |
| 785 | str(endToEndStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 786 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 787 | main.log.report(' Tcp-to-feature-reply Avg: ' + |
| 788 | str(tcpToFeatureAvg) + ' ms') |
| 789 | main.log.report(' Tcp-to-feature-reply Std dev: '+ |
| 790 | str(tcpToFeatureStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 791 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 792 | main.log.report(' Feature-reply-to-role-request Avg: ' + |
| 793 | str(featureToRoleAvg) + ' ms') |
| 794 | main.log.report(' Feature-reply-to-role-request Std Dev: ' + |
| 795 | str(featureToRoleStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 796 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 797 | main.log.report(' Role-request-to-role-reply Avg: ' + |
| 798 | str(roleToOfpAvg) +' ms') |
| 799 | main.log.report(' Role-request-to-role-reply Std dev: ' + |
| 800 | str(roleToOfpStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 801 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 802 | main.log.report(' Role-reply-to-device Avg: ' + |
| 803 | str(ofpToDeviceAvg) +' ms') |
| 804 | main.log.report(' Role-reply-to-device Std dev: ' + |
| 805 | str(ofpToDeviceStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 806 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 807 | main.log.report(' Device-to-graph Avg: ' + |
| 808 | str(deviceToGraphAvg) + ' ms') |
| 809 | main.log.report( 'Device-to-graph Std dev: ' + |
| 810 | str(deviceToGraphStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 811 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 812 | main.log.report(' - Switch Disconnection Statistics - ') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 813 | main.log.report(' End-to-end switch disconnect Avg: ' + |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 814 | str(endToEndDiscAvg) + ' ms') |
| 815 | main.log.report(' End-to-end switch disconnect Std dev: ' + |
| 816 | str(endToEndDiscStdDev) + ' ms') |
| 817 | main.log.report(' Fin/Ack-to-Ack Avg: ' + str(finAckAvg) + ' ms') |
| 818 | main.log.report(' Fin/Ack-to-Ack Std dev: ' + |
| 819 | str(finAckStdDev) + ' ms') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 820 | |
| 821 | main.log.report(' Ack-to-device Avg: ' + str(ackToDeviceAvg) + |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 822 | ' ms') |
| 823 | main.log.report(' Ack-to-device Std dev: ' + str(ackToDeviceStdDev) + |
| 824 | ' ms') |
| 825 | |
| 826 | main.log.report(' Device-to-graph (disconnect) Avg: ' + |
| 827 | str(deviceToGraphDiscAvg) + ' ms') |
| 828 | main.log.report(' Device-to-graph (disconnect) Std dev: ' + |
| 829 | str(deviceToGraphDiscStdDev) + ' ms') |
| 830 | |
| 831 | # For database schema, refer to Amazon web services |
| 832 | dbCmdList.append( |
suibin zhang | e94604c | 2015-09-02 20:25:38 -0700 | [diff] [blame] | 833 | "'" + timeToPost + "','switch_latency_results'," + |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 834 | jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" + |
| 835 | str(node + 1) + "'," + |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 836 | str(endToEndAvg) + ',' + |
| 837 | str(tcpToFeatureAvg) + ',' + |
| 838 | str(featureToRoleAvg) + ',' + |
| 839 | str(roleToOfpAvg) + ',' + |
| 840 | str(ofpToDeviceAvg) + ',' + |
| 841 | str(deviceToGraphAvg) + ',' + |
| 842 | str(endToEndDiscAvg) + ',' + |
| 843 | str(finAckAvg) + ',' + |
| 844 | str(ackToDeviceAvg) + ',' + |
suibin zhang | cd907aa | 2015-09-02 17:15:16 -0700 | [diff] [blame] | 845 | str(deviceToGraphDiscAvg)) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 846 | |
| 847 | if debugMode == 'on': |
| 848 | main.ONOSbench.cpLogsToDir('/opt/onos/log/karaf.log', |
| 849 | '/tmp/', copyFileName='sw_lat_karaf') |
| 850 | fResult = open(resultPath, 'a') |
| 851 | for line in dbCmdList: |
| 852 | if line: |
| 853 | fResult.write(line + '\n') |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 854 | main.log.report(line) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 855 | fResult.close() |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 856 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 857 | assertion = main.TRUE |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 858 | |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 859 | utilities.assert_equals(expect=main.TRUE, actual=assertion, |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 860 | onpass='Switch latency test successful', |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 861 | onfail='Switch latency test failed') |
| 862 | |
| 863 | main.Mininet1.stopNet() |