andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1 | # TopoPerfNext |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 2 | # |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 3 | # Topology Performance test for ONOS-next |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 4 | # |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 5 | # andrew@onlab.us |
andrewonlab | 4f50ec9 | 2014-11-11 14:24:45 -0500 | [diff] [blame] | 6 | # |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 7 | # If your machine does not come with numpy |
| 8 | # run the following command: |
| 9 | # sudo apt-get install python-numpy python-scipy |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 10 | |
| 11 | import time |
| 12 | import sys |
| 13 | import os |
| 14 | import re |
| 15 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 16 | |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 17 | class TopoPerfNext: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 18 | |
| 19 | def __init__( self ): |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 20 | self.default = '' |
| 21 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 22 | def CASE1( self, main ): |
| 23 | """ |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 24 | ONOS startup sequence |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 25 | """ |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 26 | import time |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 27 | |
| 28 | # Global cluster count for scale-out purposes |
| 29 | global clusterCount |
| 30 | # Set initial cluster count |
| 31 | clusterCount = 1 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 32 | ## |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 33 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 34 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 35 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 36 | gitPull = main.params[ 'GIT' ][ 'autoPull' ] |
| 37 | checkoutBranch = main.params[ 'GIT' ][ 'checkout' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 38 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 39 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 40 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 41 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 42 | ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 43 | ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 44 | ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ] |
| 45 | ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ] |
| 46 | |
| 47 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 48 | BENCHIp = main.params[ 'BENCH' ][ 'ip' ] |
| 49 | |
| 50 | topoCfgFile = main.params[ 'TEST' ][ 'topoConfigFile' ] |
| 51 | topoCfgName = main.params[ 'TEST' ][ 'topoConfigName' ] |
| 52 | |
| 53 | mvnCleanInstall = main.params[ 'TEST' ][ 'mci' ] |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 54 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 55 | main.case( "Setting up test environment" ) |
| 56 | main.log.info( "Copying topology event accumulator config" + |
| 57 | " to ONOS /package/etc" ) |
| 58 | main.ONOSbench.handle.sendline( "cp ~/" + |
| 59 | topoCfgFile + |
| 60 | " ~/ONOS/tools/package/etc/" + |
| 61 | topoCfgName ) |
| 62 | main.ONOSbench.handle.expect( "\$" ) |
andrewonlab | 6c8bbeb | 2014-11-14 12:43:48 -0500 | [diff] [blame] | 63 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 64 | main.log.report( "Setting up test environment" ) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 65 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 66 | main.step( "Cleaning previously installed ONOS if any" ) |
| 67 | main.ONOSbench.onosUninstall( nodeIp=ONOS2Ip ) |
| 68 | main.ONOSbench.onosUninstall( nodeIp=ONOS3Ip ) |
| 69 | main.ONOSbench.onosUninstall( nodeIp=ONOS4Ip ) |
| 70 | main.ONOSbench.onosUninstall( nodeIp=ONOS5Ip ) |
| 71 | main.ONOSbench.onosUninstall( nodeIp=ONOS6Ip ) |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 72 | main.ONOSbench.onosUninstall( nodeIp=ONOS7Ip ) |
andrewonlab | 0e1825c | 2014-11-20 20:07:00 -0500 | [diff] [blame] | 73 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 74 | main.step( "Creating cell file" ) |
| 75 | cellFileResult = main.ONOSbench.createCellFile( |
| 76 | BENCHIp, cellName, MN1Ip, |
| 77 | "onos-core,onos-app-metrics,onos-app-gui", |
| 78 | ONOS1Ip ) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 79 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 80 | main.step( "Applying cell file to environment" ) |
| 81 | cellApplyResult = main.ONOSbench.setCell( cellName ) |
| 82 | verifyCellResult = main.ONOSbench.verifyCell() |
andrewonlab | 6c8bbeb | 2014-11-14 12:43:48 -0500 | [diff] [blame] | 83 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 84 | # NOTE: This step may be removed after proper |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 85 | # copy cat log functionality |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 86 | main.step( "Removing raft/copy-cat logs from ONOS nodes" ) |
| 87 | main.ONOSbench.onosRemoveRaftLogs() |
| 88 | time.sleep( 30 ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 89 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 90 | main.step( "Git checkout and pull " + checkoutBranch ) |
| 91 | if gitPull == 'on': |
| 92 | # checkoutResult = \ |
| 93 | # main.ONOSbench.gitCheckout( checkoutBranch ) |
| 94 | checkoutResult = main.TRUE |
| 95 | pullResult = main.ONOSbench.gitPull() |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 96 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 97 | checkoutResult = main.TRUE |
| 98 | pullResult = main.TRUE |
| 99 | main.log.info( "Skipped git checkout and pull" ) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 100 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 101 | main.log.report( "Commit information - " ) |
| 102 | main.ONOSbench.getVersion( report=True ) |
andrewonlab | 9284434 | 2014-11-18 16:39:11 -0500 | [diff] [blame] | 103 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 104 | main.step( "Using mvn clean & install" ) |
| 105 | if mvnCleanInstall == 'on': |
| 106 | mvnResult = main.ONOSbench.cleanInstall() |
| 107 | elif mvnCleanInstall == 'off': |
| 108 | main.log.info("mci turned off by settings") |
| 109 | mvnResult = main.TRUE |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 110 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 111 | main.step( "Set cell for ONOS cli env" ) |
| 112 | main.ONOS1cli.setCell( cellName ) |
| 113 | # main.ONOS2cli.setCell( cellName ) |
| 114 | # main.ONOS3cli.setCell( cellName ) |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 115 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 116 | main.step( "Creating ONOS package" ) |
| 117 | packageResult = main.ONOSbench.onosPackage() |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 118 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 119 | main.step( "Installing ONOS package" ) |
| 120 | install1Result = main.ONOSbench.onosInstall( node=ONOS1Ip ) |
| 121 | #install2Result = main.ONOSbench.onosInstall( node=ONOS2Ip ) |
| 122 | #install3Result = main.ONOSbench.onosInstall( node=ONOS3Ip ) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 123 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 124 | time.sleep( 10 ) |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 125 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 126 | main.step( "Start onos cli" ) |
| 127 | cli1 = main.ONOS1cli.startOnosCli( ONOS1Ip ) |
| 128 | #cli2 = main.ONOS2cli.startOnosCli( ONOS2Ip ) |
| 129 | #cli3 = main.ONOS3cli.startOnosCli( ONOS3Ip ) |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 130 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 131 | utilities.assert_equals( expect=main.TRUE, |
| 132 | actual=cellFileResult and cellApplyResult and |
| 133 | verifyCellResult and checkoutResult and |
| 134 | pullResult and mvnResult and |
| 135 | install1Result, # and install2Result and |
| 136 | # install3Result, |
| 137 | onpass="Test Environment setup successful", |
| 138 | onfail="Failed to setup test environment" ) |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 139 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 140 | def CASE2( self, main ): |
| 141 | """ |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 142 | Assign s1 to ONOS1 and measure latency |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 143 | |
andrewonlab | 3a7c3c7 | 2014-10-24 17:21:03 -0400 | [diff] [blame] | 144 | There are 4 levels of latency measurements to this test: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 145 | 1 ) End-to-end measurement: Complete end-to-end measurement |
| 146 | from TCP ( SYN/ACK ) handshake to Graph change |
| 147 | 2 ) OFP-to-graph measurement: 'ONOS processing' snippet of |
andrewonlab | 3a7c3c7 | 2014-10-24 17:21:03 -0400 | [diff] [blame] | 148 | measurement from OFP Vendor message to Graph change |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 149 | 3 ) OFP-to-device measurement: 'ONOS processing without |
andrewonlab | 3a7c3c7 | 2014-10-24 17:21:03 -0400 | [diff] [blame] | 150 | graph change' snippet of measurement from OFP vendor |
| 151 | message to Device change timestamp |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 152 | 4 ) T0-to-device measurement: Measurement that includes |
| 153 | the switch handshake to devices timestamp without |
| 154 | the graph view change. ( TCP handshake -> Device |
| 155 | change ) |
| 156 | """ |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 157 | import time |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 158 | import subprocess |
| 159 | import json |
| 160 | import requests |
| 161 | import os |
andrewonlab | 4f50ec9 | 2014-11-11 14:24:45 -0500 | [diff] [blame] | 162 | import numpy |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 163 | global clusterCount |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 164 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 165 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 166 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 167 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 168 | ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 169 | ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 170 | ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ] |
| 171 | ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ] |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 172 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 173 | ONOSUser = main.params[ 'CTRL' ][ 'user' ] |
andrewonlab | 4b5c8b9 | 2014-11-10 16:04:33 -0500 | [diff] [blame] | 174 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 175 | defaultSwPort = main.params[ 'CTRL' ][ 'port1' ] |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 176 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 177 | # Number of iterations of case |
| 178 | numIter = main.params[ 'TEST' ][ 'numIter' ] |
| 179 | # Number of first 'x' iterations to ignore: |
| 180 | iterIgnore = int( main.params[ 'TEST' ][ 'iterIgnore' ] ) |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 181 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 182 | # Timestamp 'keys' for json metrics output. |
| 183 | # These are subject to change, hence moved into params |
| 184 | deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ] |
| 185 | graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 186 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 187 | debugMode = main.params[ 'TEST' ][ 'debugMode' ] |
| 188 | onosLog = main.params[ 'TEST' ][ 'onosLogFile' ] |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 189 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 190 | # Threshold for the test |
| 191 | thresholdStr = main.params[ 'TEST' ][ 'singleSwThreshold' ] |
| 192 | thresholdObj = thresholdStr.split( "," ) |
| 193 | thresholdMin = int( thresholdObj[ 0 ] ) |
| 194 | thresholdMax = int( thresholdObj[ 1 ] ) |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 195 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 196 | # List of switch add latency collected from |
| 197 | # all iterations |
| 198 | latencyEndToEndList = [] |
| 199 | latencyOfpToGraphList = [] |
| 200 | latencyOfpToDeviceList = [] |
| 201 | latencyT0ToDeviceList = [] |
| 202 | latencyTcpToOfpList = [] |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 203 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 204 | # Initialize 2d array for [node][iteration] storage |
| 205 | endToEndLatNodeIter = numpy.zeros(( clusterCount, int(numIter) )) |
| 206 | ofpToGraphLatNodeIter = numpy.zeros(( clusterCount, int(numIter) )) |
| 207 | # tcp-to-ofp measurements are same throughout each iteration |
| 208 | tcpToOfpLatIter = [] |
| 209 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 210 | # Directory/file to store tshark results |
| 211 | tsharkOfOutput = "/tmp/tshark_of_topo.txt" |
| 212 | tsharkTcpOutput = "/tmp/tshark_tcp_topo.txt" |
| 213 | |
| 214 | # String to grep in tshark output |
| 215 | tsharkTcpString = "TCP 74 " + defaultSwPort |
| 216 | tsharkOfString = "OFP 86 Vendor" |
| 217 | |
| 218 | # Initialize assertion to TRUE |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 219 | assertion = main.TRUE |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 220 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 221 | localTime = time.strftime( '%x %X' ) |
| 222 | localTime = localTime.replace( "/", "" ) |
| 223 | localTime = localTime.replace( " ", "_" ) |
| 224 | localTime = localTime.replace( ":", "" ) |
| 225 | if debugMode == 'on': |
| 226 | main.ONOS1.tsharkPcap( "eth0", |
| 227 | "/tmp/single_sw_lat_pcap_" + localTime ) |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 228 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 229 | main.log.info( "Debug mode is on" ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 230 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 231 | main.log.report( "Latency of adding one switch to controller" ) |
| 232 | main.log.report( "First " + str( iterIgnore ) + " iterations ignored" + |
| 233 | " for jvm warmup time" ) |
| 234 | main.log.report( "Total iterations of test: " + str( numIter ) ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 235 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 236 | for i in range( 0, int( numIter ) ): |
| 237 | main.log.info( "Starting tshark capture" ) |
| 238 | |
| 239 | #* TCP [ ACK, SYN ] is used as t0A, the |
| 240 | # very first "exchange" between ONOS and |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 241 | # the switch for end-to-end measurement |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 242 | #* OFP [ Stats Reply ] is used for t0B |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 243 | # the very last OFP message between ONOS |
| 244 | # and the switch for ONOS measurement |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 245 | main.ONOS1.tsharkGrep( tsharkTcpString, |
| 246 | tsharkTcpOutput ) |
| 247 | main.ONOS1.tsharkGrep( tsharkOfString, |
| 248 | tsharkOfOutput ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 249 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 250 | # Wait and ensure tshark is started and |
| 251 | # capturing |
| 252 | time.sleep( 10 ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 253 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 254 | main.log.info( "Assigning s1 to controller" ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 255 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 256 | main.Mininet1.assignSwController( |
| 257 | sw="1", |
| 258 | ip1=ONOS1Ip, |
| 259 | port1=defaultSwPort ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 260 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 261 | # Wait and ensure switch is assigned |
| 262 | # before stopping tshark |
| 263 | time.sleep( 30 ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 264 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 265 | main.log.info( "Stopping all Tshark processes" ) |
| 266 | main.ONOS1.stopTshark() |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 267 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 268 | # tshark output is saved in ONOS. Use subprocess |
| 269 | # to copy over files to TestON for parsing |
| 270 | main.log.info( "Copying over tshark files" ) |
| 271 | |
| 272 | # TCP CAPTURE **** |
| 273 | # Copy the tshark output from ONOS machine to |
| 274 | # TestON machine in tsharkTcpOutput directory>file |
| 275 | os.system( "scp " + ONOSUser + "@" + ONOS1Ip + ":" + |
| 276 | tsharkTcpOutput + " /tmp/" ) |
| 277 | tcpFile = open( tsharkTcpOutput, 'r' ) |
| 278 | tempText = tcpFile.readline() |
| 279 | tempText = tempText.split( " " ) |
| 280 | |
| 281 | main.log.info( "Object read in from TCP capture: " + |
| 282 | str( tempText ) ) |
| 283 | if len( tempText ) > 1: |
| 284 | t0Tcp = float( tempText[ 1 ] ) * 1000.0 |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 285 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 286 | main.log.error( "Tshark output file for TCP" + |
| 287 | " returned unexpected results" ) |
| 288 | t0Tcp = 0 |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 289 | assertion = main.FALSE |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 290 | |
| 291 | tcpFile.close() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 292 | #**************** |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 293 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 294 | # OF CAPTURE **** |
| 295 | os.system( "scp " + ONOSUser + "@" + ONOS1Ip + ":" + |
| 296 | tsharkOfOutput + " /tmp/" ) |
| 297 | ofFile = open( tsharkOfOutput, 'r' ) |
| 298 | |
| 299 | lineOfp = "" |
| 300 | # Read until last line of file |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 301 | while True: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 302 | tempText = ofFile.readline() |
| 303 | if tempText != '': |
| 304 | lineOfp = tempText |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 305 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 306 | break |
| 307 | obj = lineOfp.split( " " ) |
| 308 | |
| 309 | main.log.info( "Object read in from OFP capture: " + |
| 310 | str( lineOfp ) ) |
| 311 | |
| 312 | if len( lineOfp ) > 1: |
| 313 | t0Ofp = float( obj[ 1 ] ) * 1000.0 |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 314 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 315 | main.log.error( "Tshark output file for OFP" + |
| 316 | " returned unexpected results" ) |
| 317 | t0Ofp = 0 |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 318 | assertion = main.FALSE |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 319 | |
| 320 | ofFile.close() |
andrewonlab | e674534 | 2014-10-17 14:29:13 -0400 | [diff] [blame] | 321 | #**************** |
andrewonlab | 867212a | 2014-10-22 20:13:38 -0400 | [diff] [blame] | 322 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 323 | jsonStr1 = main.ONOS1cli.topologyEventsMetrics() |
| 324 | # Initialize scale-out variables |
| 325 | jsonStr2 = "" |
| 326 | jsonStr3 = "" |
| 327 | jsonStr4 = "" |
| 328 | jsonStr5 = "" |
| 329 | jsonStr6 = "" |
| 330 | jsonStr7 = "" |
andrewonlab | e9fb672 | 2014-10-24 12:20:35 -0400 | [diff] [blame] | 331 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 332 | jsonObj1 = json.loads( jsonStr1 ) |
| 333 | # Initialize scale-out variables |
| 334 | jsonObj2 = "" |
| 335 | jsonObj3 = "" |
| 336 | jsonObj4 = "" |
| 337 | jsonObj5 = "" |
| 338 | jsonObj6 = "" |
| 339 | jsonObj7 = "" |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 340 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 341 | # Obtain graph timestamp. This timestsamp captures |
| 342 | # the epoch time at which the topology graph was updated. |
| 343 | graphTimestamp1 = \ |
| 344 | jsonObj1[ graphTimestamp ][ 'value' ] |
| 345 | # Obtain device timestamp. This timestamp captures |
| 346 | # the epoch time at which the device event happened |
| 347 | deviceTimestamp1 = \ |
| 348 | jsonObj1[ deviceTimestamp ][ 'value' ] |
| 349 | |
| 350 | # t0 to device processing latency |
| 351 | deltaDevice1 = int( deviceTimestamp1 ) - int( t0Tcp ) |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 352 | # t0 to graph processing latency ( end-to-end ) |
| 353 | deltaGraph1 = int( graphTimestamp1 ) - int( t0Tcp ) |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 354 | # ofp to graph processing latency ( ONOS processing ) |
| 355 | deltaOfpGraph1 = int( graphTimestamp1 ) - int( t0Ofp ) |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 356 | # ofp to device processing latency ( ONOS processing ) |
| 357 | deltaOfpDevice1 = float( deviceTimestamp1 ) - float( t0Ofp ) |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 358 | # tcp to ofp processing latency ( switch connection ) |
| 359 | deltaTcpOfp1 = int(t0Ofp) - int(t0Tcp) |
| 360 | |
| 361 | if deltaTcpOfp1 > thresholdMin and deltaTcpOfp1 < thresholdMax\ |
| 362 | and i >= iterIgnore: |
| 363 | tcpToOfpLatIter.append(deltaTcpOfp1) |
| 364 | main.log.info("iter"+str(i)+" tcp-to-ofp: "+ |
| 365 | str(deltaTcpOfp1)+" ms") |
| 366 | else: |
| 367 | tcpToOfpLatIter.append(0) |
| 368 | main.log.info("iter"+str(i)+" tcp-to-ofp: "+ |
| 369 | str(deltaTcpOfp1)+" ms - ignored this iteration") |
| 370 | |
| 371 | # Store initial measurements in data array |
| 372 | #This measurement is for node 1 |
| 373 | |
| 374 | if deltaGraph1 > thresholdMin and deltaGraph1 < thresholdMax\ |
| 375 | and i >= iterIgnore: |
| 376 | endToEndLatNodeIter[0][i] = deltaGraph1 |
| 377 | main.log.info("ONOS1 iter"+str(i)+" end-to-end: "+ |
| 378 | str(deltaGraph1)+" ms") |
| 379 | else: |
| 380 | main.log.info("ONOS1 iter"+str(i)+" end-to-end: "+ |
| 381 | str(deltaGraph1)+" ms - ignored this iteration") |
| 382 | |
| 383 | |
| 384 | if deltaOfpGraph1 > thresholdMin and deltaOfpGraph1 < thresholdMax\ |
| 385 | and i >= iterIgnore: |
| 386 | ofpToGraphLatNodeIter[0][i] = deltaOfpGraph1 |
| 387 | |
| 388 | main.log.info("ONOS1 iter"+str(i)+" ofp-to-graph: "+ |
| 389 | str(deltaOfpGraph1)+" ms") |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 390 | |
| 391 | # TODO: Create even cluster number events |
| 392 | |
| 393 | # Include scale-out measurements when applicable |
| 394 | if clusterCount >= 3: |
| 395 | jsonStr2 = main.ONOS2cli.topologyEventsMetrics() |
| 396 | jsonStr3 = main.ONOS3cli.topologyEventsMetrics() |
| 397 | jsonObj2 = json.loads( jsonStr2 ) |
| 398 | jsonObj3 = json.loads( jsonStr3 ) |
| 399 | graphTimestamp2 = \ |
| 400 | jsonObj2[ graphTimestamp ][ 'value' ] |
| 401 | graphTimestamp3 = \ |
| 402 | jsonObj3[ graphTimestamp ][ 'value' ] |
| 403 | deviceTimestamp2 = \ |
| 404 | jsonObj2[ deviceTimestamp ][ 'value' ] |
| 405 | deviceTimestamp3 = \ |
| 406 | jsonObj3[ deviceTimestamp ][ 'value' ] |
| 407 | deltaDevice2 = int( deviceTimestamp2 ) - int( t0Tcp ) |
| 408 | deltaDevice3 = int( deviceTimestamp3 ) - int( t0Tcp ) |
| 409 | deltaGraph2 = int( graphTimestamp2 ) - int( t0Tcp ) |
| 410 | deltaGraph3 = int( graphTimestamp3 ) - int( t0Tcp ) |
| 411 | deltaOfpGraph2 = int( graphTimestamp2 ) - int( t0Ofp ) |
| 412 | deltaOfpGraph3 = int( graphTimestamp3 ) - int( t0Ofp ) |
| 413 | deltaOfpDevice2 = float( deviceTimestamp2 ) -\ |
| 414 | float( t0Ofp ) |
| 415 | deltaOfpDevice3 = float( deviceTimestamp3 ) -\ |
| 416 | float( t0Ofp ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 417 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 418 | if deltaGraph2 > thresholdMin and\ |
| 419 | deltaGraph2 < thresholdMax and i >= iterIgnore: |
| 420 | endToEndLatNodeIter[1][i] = deltaGraph2 |
| 421 | main.log.info("ONOS2 iter"+str(i)+" end-to-end: "+ |
| 422 | str(deltaGraph2)+" ms") |
| 423 | |
| 424 | if deltaOfpGraph2 > thresholdMin and\ |
| 425 | deltaOfpGraph2 < thresholdMax and i >= iterIgnore: |
| 426 | ofpToGraphLatNodeIter[1][i] = deltaOfpGraph2 |
| 427 | main.log.info("ONOS2 iter"+str(i)+" ofp-to-graph: "+ |
| 428 | str(deltaOfpGraph2)+" ms") |
| 429 | |
| 430 | if deltaGraph3 > thresholdMin and\ |
| 431 | deltaGraph3 < thresholdMax and i >= iterIgnore: |
| 432 | endToEndLatNodeIter[2][i] = deltaGraph3 |
| 433 | main.log.info("ONOS3 iter"+str(i)+" end-to-end: "+ |
| 434 | str(deltaGraph3)+" ms") |
| 435 | |
| 436 | if deltaOfpGraph3 > thresholdMin and\ |
| 437 | deltaOfpGraph3 < thresholdMax and i >= iterIgnore: |
| 438 | ofpToGraphLatNodeIter[2][i] = deltaOfpGraph3 |
| 439 | main.log.info("ONOS3 iter"+str(i)+" ofp-to-graph: "+ |
| 440 | str(deltaOfpGraph3)+" ms") |
| 441 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 442 | if clusterCount >= 5: |
| 443 | jsonStr4 = main.ONOS4cli.topologyEventsMetrics() |
| 444 | jsonStr5 = main.ONOS5cli.topologyEventsMetrics() |
| 445 | jsonObj4 = json.loads( jsonStr4 ) |
| 446 | jsonObj5 = json.loads( jsonStr5 ) |
| 447 | graphTimestamp4 = \ |
| 448 | jsonObj4[ graphTimestamp ][ 'value' ] |
| 449 | graphTimestamp5 = \ |
| 450 | jsonObj5[ graphTimestamp ][ 'value' ] |
| 451 | deviceTimestamp4 = \ |
| 452 | jsonObj4[ deviceTimestamp ][ 'value' ] |
| 453 | deviceTimestamp5 = \ |
| 454 | jsonObj5[ deviceTimestamp ][ 'value' ] |
| 455 | deltaDevice4 = int( deviceTimestamp4 ) - int( t0Tcp ) |
| 456 | deltaDevice5 = int( deviceTimestamp5 ) - int( t0Tcp ) |
| 457 | deltaGraph4 = int( graphTimestamp4 ) - int( t0Tcp ) |
| 458 | deltaGraph5 = int( graphTimestamp5 ) - int( t0Tcp ) |
| 459 | deltaOfpGraph4 = int( graphTimestamp4 ) - int( t0Ofp ) |
| 460 | deltaOfpGraph5 = int( graphTimestamp5 ) - int( t0Ofp ) |
| 461 | deltaOfpDevice4 = float( deviceTimestamp4 ) -\ |
| 462 | float( t0Ofp ) |
| 463 | deltaOfpDevice5 = float( deviceTimestamp5 ) -\ |
| 464 | float( t0Ofp ) |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 465 | |
| 466 | if deltaGraph4 > thresholdMin and\ |
| 467 | deltaGraph4 < thresholdMax and i >= iterIgnore: |
| 468 | endToEndLatNodeIter[3][i] = deltaGraph4 |
| 469 | main.log.info("ONOS4 iter"+str(i)+" end-to-end: "+ |
| 470 | str(deltaGraph4)+" ms") |
| 471 | |
| 472 | #TODO: |
| 473 | if deltaOfpGraph4 > thresholdMin and\ |
| 474 | deltaOfpGraph4 < thresholdMax and i >= iterIgnore: |
| 475 | ofpToGraphLatNodeIter[3][i] = deltaOfpGraph4 |
| 476 | main.log.info("ONOS4 iter"+str(i)+" ofp-to-graph: "+ |
| 477 | str(deltaOfpGraph4)+" ms") |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 478 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 479 | if deltaGraph5 > thresholdMin and\ |
| 480 | deltaGraph5 < thresholdMax and i >= iterIgnore: |
| 481 | endToEndLatNodeIter[4][i] = deltaGraph5 |
| 482 | main.log.info("ONOS5 iter"+str(i)+" end-to-end: "+ |
| 483 | str(deltaGraph5)+" ms") |
| 484 | |
| 485 | if deltaOfpGraph5 > thresholdMin and\ |
| 486 | deltaOfpGraph5 < thresholdMax and i >= iterIgnore: |
| 487 | ofpToGraphLatNodeIter[4][i] = deltaOfpGraph5 |
| 488 | main.log.info("ONOS5 iter"+str(i)+" ofp-to-graph: "+ |
| 489 | str(deltaOfpGraph5)+" ms") |
| 490 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 491 | if clusterCount >= 7: |
| 492 | jsonStr6 = main.ONOS6cli.topologyEventsMetrics() |
| 493 | jsonStr7 = main.ONOS7cli.topologyEventsMetrics() |
| 494 | jsonObj6 = json.loads( jsonStr6 ) |
| 495 | jsonObj7 = json.loads( jsonStr7 ) |
| 496 | graphTimestamp6 = \ |
| 497 | jsonObj6[ graphTimestamp ][ 'value' ] |
| 498 | graphTimestamp7 = \ |
| 499 | jsonObj7[ graphTimestamp ][ 'value' ] |
| 500 | deviceTimestamp6 = \ |
| 501 | jsonObj6[ deviceTimestamp ][ 'value' ] |
| 502 | deviceTimestamp7 = \ |
| 503 | jsonObj7[ deviceTimestamp ][ 'value' ] |
| 504 | deltaDevice6 = int( deviceTimestamp6 ) - int( t0Tcp ) |
| 505 | deltaDevice7 = int( deviceTimestamp7 ) - int( t0Tcp ) |
| 506 | deltaGraph6 = int( graphTimestamp6 ) - int( t0Tcp ) |
| 507 | deltaGraph7 = int( graphTimestamp7 ) - int( t0Tcp ) |
| 508 | deltaOfpGraph6 = int( graphTimestamp6 ) - int( t0Ofp ) |
| 509 | deltaOfpGraph7 = int( graphTimestamp7 ) - int( t0Ofp ) |
| 510 | deltaOfpDevice6 = float( deviceTimestamp6 ) -\ |
| 511 | float( t0Ofp ) |
| 512 | deltaOfpDevice7 = float( deviceTimestamp7 ) -\ |
| 513 | float( t0Ofp ) |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 514 | |
| 515 | if deltaGraph6 > thresholdMin and\ |
| 516 | deltaGraph6 < thresholdMax and i >= iterIgnore: |
| 517 | endToEndLatNodeIter[5][i] = deltaGraph6 |
| 518 | main.log.info("ONOS6 iter"+str(i)+" end-to-end: "+ |
| 519 | str(deltaGraph6)+" ms") |
| 520 | |
| 521 | #TODO: |
| 522 | if deltaOfpGraph6 > thresholdMin and\ |
| 523 | deltaOfpGraph6 < thresholdMax and i >= iterIgnore: |
| 524 | ofpToGraphLatNodeIter[5][i] = deltaOfpGraph6 |
| 525 | main.log.info("ONOS6 iter"+str(i)+" ofp-to-graph: "+ |
| 526 | str(deltaOfpGraph6)+" ms") |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 527 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 528 | if deltaGraph7 > thresholdMin and\ |
| 529 | deltaGraph7 < thresholdMax and i >= iterIgnore: |
| 530 | endToEndLatNodeIter[6][i] = deltaGraph7 |
| 531 | main.log.info("ONOS7 iter"+str(i)+" end-to-end: "+ |
| 532 | str(deltaGraph7)+" ms") |
| 533 | |
| 534 | if deltaOfpGraph7 > thresholdMin and\ |
| 535 | deltaOfpGraph7 < thresholdMax and i >= iterIgnore: |
| 536 | ofpToGraphLatNodeIter[6][i] = deltaOfpGraph7 |
| 537 | main.log.info("ONOS7 iter"+str(i)+" ofp-to-graph: "+ |
| 538 | str(deltaOfpGraph7)+" ms") |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 539 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 540 | main.step( "Remove switch from controller" ) |
| 541 | main.Mininet1.deleteSwController( "s1" ) |
andrewonlab | f47993a | 2014-10-24 17:56:01 -0400 | [diff] [blame] | 542 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 543 | time.sleep( 5 ) |
| 544 | |
| 545 | # END of for loop iteration |
| 546 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 547 | #str( round( numpy.std( latencyT0ToDeviceList ), 1 ) ) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 548 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 549 | endToEndAvg = 0 |
| 550 | ofpToGraphAvg = 0 |
| 551 | endToEndList = [] |
| 552 | ofpToGraphList = [] |
andrewonlab | 6986416 | 2014-11-11 16:28:48 -0500 | [diff] [blame] | 553 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 554 | for node in range( 0, clusterCount ): |
| 555 | # The latency 2d array was initialized to 0. |
| 556 | # If an iteration was ignored, then we have some 0's in |
| 557 | # our calculation. To avoid having this interfere with our |
| 558 | # results, we must delete any index where 0 is found... |
| 559 | # WARN: Potentially, we could have latency that hovers at |
| 560 | # 0 ms once we have optimized code. FIXME for when this is |
| 561 | # the case. Being able to obtain sub-millisecond accuracy |
| 562 | # can prevent this from happening |
| 563 | for item in endToEndLatNodeIter[node]: |
| 564 | if item > 0.0: |
| 565 | endToEndList.append(item) |
| 566 | for item in ofpToGraphLatNodeIter[node]: |
| 567 | if item > 0.0: |
| 568 | ofpToGraphList.append(item) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 569 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 570 | endToEndAvg = numpy.mean(endToEndList) |
| 571 | ofpToGraphAvg = numpy.mean(ofpToGraphList) |
andrewonlab | c15c958 | 2014-10-24 16:35:52 -0400 | [diff] [blame] | 572 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 573 | main.log.report( " - Node "+str(node+1)+" Summary - " ) |
| 574 | main.log.report( " End-to-end Avg: "+ |
| 575 | str(round(endToEndAvg,2))+" ms"+ |
| 576 | " End-to-end Std dev: "+ |
| 577 | str(round(numpy.std(endToEndList),2))+" ms") |
| 578 | main.log.report( " Ofp-to-graph Avg: "+ |
| 579 | str(round(ofpToGraphAvg,2))+" ms"+ |
| 580 | " Ofp-to-graph Std dev: "+ |
| 581 | str(round(numpy.std(ofpToGraphList),2))+ |
| 582 | " ms") |
andrewonlab | 226024e | 2014-10-24 16:01:32 -0400 | [diff] [blame] | 583 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 584 | if debugMode == 'on': |
| 585 | main.ONOS1.cpLogsToDir( "/opt/onos/log/karaf.log", |
| 586 | "/tmp/", copyFileName="sw_lat_karaf" ) |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 587 | |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 588 | #TODO: correct assert |
| 589 | assertion = main.TRUE |
| 590 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 591 | utilities.assert_equals( expect=main.TRUE, actual=assertion, |
| 592 | onpass="Switch latency test successful", |
| 593 | onfail="Switch latency test failed" ) |
andrewonlab | ba44bcf | 2014-10-16 16:54:41 -0400 | [diff] [blame] | 594 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 595 | def CASE3( self, main ): |
| 596 | """ |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 597 | Bring port up / down and measure latency. |
| 598 | Port enable / disable is simulated by ifconfig up / down |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 599 | |
| 600 | In ONOS-next, we must ensure that the port we are |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 601 | manipulating is connected to another switch with a valid |
| 602 | connection. Otherwise, graph view will not be updated. |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 603 | """ |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 604 | import time |
| 605 | import subprocess |
| 606 | import os |
| 607 | import requests |
| 608 | import json |
andrewonlab | 4f50ec9 | 2014-11-11 14:24:45 -0500 | [diff] [blame] | 609 | import numpy |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 610 | global clusterCount |
andrewonlab | 2a6c934 | 2014-10-16 13:40:15 -0400 | [diff] [blame] | 611 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 612 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 613 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 614 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 615 | ONOSUser = main.params[ 'CTRL' ][ 'user' ] |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 616 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 617 | defaultSwPort = main.params[ 'CTRL' ][ 'port1' ] |
| 618 | |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 619 | assertion = main.TRUE |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 620 | # Number of iterations of case |
| 621 | numIter = main.params[ 'TEST' ][ 'numIter' ] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 622 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 623 | # Timestamp 'keys' for json metrics output. |
| 624 | # These are subject to change, hence moved into params |
| 625 | deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ] |
| 626 | graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ] |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 627 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 628 | debugMode = main.params[ 'TEST' ][ 'debugMode' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 629 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 630 | localTime = time.strftime( '%x %X' ) |
| 631 | localTime = localTime.replace( "/", "" ) |
| 632 | localTime = localTime.replace( " ", "_" ) |
| 633 | localTime = localTime.replace( ":", "" ) |
| 634 | if debugMode == 'on': |
| 635 | main.ONOS1.tsharkPcap( "eth0", |
| 636 | "/tmp/port_lat_pcap_" + localTime ) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 637 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 638 | # Threshold for this test case |
| 639 | upThresholdStr = main.params[ 'TEST' ][ 'portUpThreshold' ] |
| 640 | downThresholdStr = main.params[ 'TEST' ][ 'portDownThreshold' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 641 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 642 | upThresholdObj = upThresholdStr.split( "," ) |
| 643 | downThresholdObj = downThresholdStr.split( "," ) |
| 644 | |
| 645 | upThresholdMin = int( upThresholdObj[ 0 ] ) |
| 646 | upThresholdMax = int( upThresholdObj[ 1 ] ) |
| 647 | |
| 648 | downThresholdMin = int( downThresholdObj[ 0 ] ) |
| 649 | downThresholdMax = int( downThresholdObj[ 1 ] ) |
| 650 | |
| 651 | # NOTE: Some hardcoded variables you may need to configure |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 652 | # besides the params |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 653 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 654 | tsharkPortStatus = "OFP 130 Port Status" |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 655 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 656 | tsharkPortUp = "/tmp/tshark_port_up.txt" |
| 657 | tsharkPortDown = "/tmp/tshark_port_down.txt" |
| 658 | interfaceConfig = "s1-eth1" |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 659 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 660 | main.log.report( "Port enable / disable latency" ) |
| 661 | main.log.report( "Simulated by ifconfig up / down" ) |
| 662 | main.log.report( "Total iterations of test: " + str( numIter ) ) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 663 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 664 | main.step( "Assign switches s1 and s2 to controller 1" ) |
| 665 | main.Mininet1.assignSwController( sw="1", ip1=ONOS1Ip, |
| 666 | port1=defaultSwPort ) |
| 667 | main.Mininet1.assignSwController( sw="2", ip1=ONOS1Ip, |
| 668 | port1=defaultSwPort ) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 669 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 670 | # Give enough time for metrics to propagate the |
| 671 | # assign controller event. Otherwise, these events may |
| 672 | # carry over to our measurements |
| 673 | time.sleep( 15 ) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 674 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 675 | portUpDeviceToOfpList = [] |
| 676 | portUpGraphToOfpList = [] |
| 677 | portDownDeviceToOfpList = [] |
| 678 | portDownGraphToOfpList = [] |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 679 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 680 | for i in range( 0, int( numIter ) ): |
| 681 | main.step( "Starting wireshark capture for port status down" ) |
| 682 | main.ONOS1.tsharkGrep( tsharkPortStatus, |
| 683 | tsharkPortDown ) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 684 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 685 | time.sleep( 5 ) |
| 686 | |
| 687 | # Disable interface that is connected to switch 2 |
| 688 | main.step( "Disable port: " + interfaceConfig ) |
| 689 | main.Mininet1.handle.sendline( "sh ifconfig " + |
| 690 | interfaceConfig + " down" ) |
| 691 | main.Mininet1.handle.expect( "mininet>" ) |
| 692 | |
| 693 | time.sleep( 3 ) |
| 694 | main.ONOS1.tsharkStop() |
| 695 | |
| 696 | # Copy tshark output file from ONOS to TestON instance |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 697 | #/tmp directory |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 698 | os.system( "scp " + ONOSUser + "@" + ONOS1Ip + ":" + |
| 699 | tsharkPortDown + " /tmp/" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 700 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 701 | fPortDown = open( tsharkPortDown, 'r' ) |
| 702 | # Get first line of port down event from tshark |
| 703 | fLine = fPortDown.readline() |
| 704 | objDown = fLine.split( " " ) |
| 705 | if len( fLine ) > 0: |
| 706 | # NOTE: objDown[ 1 ] is a very unreliable |
| 707 | # way to determine the timestamp. If |
| 708 | # results seem way off, check the object |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 709 | # itself by printing it out |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 710 | timestampBeginPtDown = int( float( objDown[ 1 ] ) * 1000 ) |
| 711 | # For some reason, wireshark decides to record the |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 712 | # timestamp at the 3rd object position instead of |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 713 | # 2nd at unpredictable times. This statement is |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 714 | # used to capture that odd behavior and use the |
| 715 | # correct epoch time |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 716 | if timestampBeginPtDown < 1400000000000: |
| 717 | timestampBeginPtDown = \ |
| 718 | int( float( objDown[ 2 ] ) * 1000 ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 719 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 720 | main.log.info( "Port down begin timestamp: " + |
| 721 | str( timestampBeginPtDown ) ) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 722 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 723 | main.log.info( "Tshark output file returned unexpected" + |
| 724 | " results: " + str( objDown ) ) |
| 725 | timestampBeginPtDown = 0 |
| 726 | fPortDown.close() |
| 727 | |
| 728 | main.step( "Obtain t1 by metrics call" ) |
| 729 | jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics() |
| 730 | jsonObj1 = json.loads( jsonStrUp1 ) |
| 731 | # Obtain graph timestamp. This timestsamp captures |
| 732 | # the epoch time at which the topology graph was updated. |
| 733 | graphTimestamp1 = \ |
| 734 | jsonObj1[ graphTimestamp ][ 'value' ] |
| 735 | # Obtain device timestamp. This timestamp captures |
| 736 | # the epoch time at which the device event happened |
| 737 | deviceTimestamp1 = \ |
| 738 | jsonObj1[ deviceTimestamp ][ 'value' ] |
| 739 | # Get delta between graph event and OFP |
| 740 | ptDownGraphToOfp1 = int( graphTimestamp1 ) -\ |
| 741 | int( timestampBeginPtDown ) |
| 742 | # Get delta between device event and OFP |
| 743 | ptDownDeviceToOfp1 = int( deviceTimestamp1 ) -\ |
| 744 | int( timestampBeginPtDown ) |
| 745 | |
| 746 | if clusterCount >= 3: |
| 747 | jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics() |
| 748 | jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics() |
| 749 | jsonObj2 = json.loads( jsonStrUp2 ) |
| 750 | jsonObj3 = json.loads( jsonStrUp3 ) |
| 751 | graphTimestamp2 = \ |
| 752 | jsonObj2[ graphTimestamp ][ 'value' ] |
| 753 | graphTimestamp3 = \ |
| 754 | jsonObj3[ graphTimestamp ][ 'value' ] |
| 755 | deviceTimestamp2 = \ |
| 756 | jsonObj2[ deviceTimestamp ][ 'value' ] |
| 757 | deviceTimestamp3 = \ |
| 758 | jsonObj3[ deviceTimestamp ][ 'value' ] |
| 759 | ptDownGraphToOfp2 = int( graphTimestamp2 ) -\ |
| 760 | int( timestampBeginPtDown ) |
| 761 | ptDownGraphToOfp3 = int( graphTimestamp3 ) -\ |
| 762 | int( timestampBeginPtDown ) |
| 763 | ptDownDeviceToOfp2 = int( deviceTimestamp2 ) -\ |
| 764 | int( timestampBeginPtDown ) |
| 765 | ptDownDeviceToOfp3 = int( deviceTimestamp3 ) -\ |
| 766 | int( timestampBeginPtDown ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 767 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 768 | ptDownGraphToOfp2 = 0 |
| 769 | ptDownGraphToOfp3 = 0 |
| 770 | ptDownDeviceToOfp2 = 0 |
| 771 | ptDownDeviceToOfp3 = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 772 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 773 | if clusterCount >= 5: |
| 774 | jsonStrUp4 = main.ONOS4cli.topologyEventsMetrics() |
| 775 | jsonStrUp5 = main.ONOS5cli.topologyEventsMetrics() |
| 776 | jsonObj4 = json.loads( jsonStrUp4 ) |
| 777 | jsonObj5 = json.loads( jsonStrUp5 ) |
| 778 | graphTimestamp4 = \ |
| 779 | jsonObj4[ graphTimestamp ][ 'value' ] |
| 780 | graphTimestamp5 = \ |
| 781 | jsonObj5[ graphTimestamp ][ 'value' ] |
| 782 | deviceTimestamp4 = \ |
| 783 | jsonObj4[ deviceTimestamp ][ 'value' ] |
| 784 | deviceTimestamp5 = \ |
| 785 | jsonObj5[ deviceTimestamp ][ 'value' ] |
| 786 | ptDownGraphToOfp4 = int( graphTimestamp4 ) -\ |
| 787 | int( timestampBeginPtDown ) |
| 788 | ptDownGraphToOfp5 = int( graphTimestamp5 ) -\ |
| 789 | int( timestampBeginPtDown ) |
| 790 | ptDownDeviceToOfp4 = int( deviceTimestamp4 ) -\ |
| 791 | int( timestampBeginPtDown ) |
| 792 | ptDownDeviceToOfp5 = int( deviceTimestamp5 ) -\ |
| 793 | int( timestampBeginPtDown ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 794 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 795 | ptDownGraphToOfp4 = 0 |
| 796 | ptDownGraphToOfp5 = 0 |
| 797 | ptDownDeviceToOfp4 = 0 |
| 798 | ptDownDeviceToOfp5 = 0 |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 799 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 800 | if clusterCount >= 7: |
| 801 | jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics() |
| 802 | jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics() |
| 803 | jsonObj6 = json.loads( jsonStrUp6 ) |
| 804 | jsonObj7 = json.loads( jsonStrUp7 ) |
| 805 | graphTimestamp6 = \ |
| 806 | jsonObj6[ graphTimestamp ][ 'value' ] |
| 807 | graphTimestamp7 = \ |
| 808 | jsonObj7[ graphTimestamp ][ 'value' ] |
| 809 | deviceTimestamp6 = \ |
| 810 | jsonObj6[ deviceTimestamp ][ 'value' ] |
| 811 | deviceTimestamp7 = \ |
| 812 | jsonObj7[ deviceTimestamp ][ 'value' ] |
| 813 | ptDownGraphToOfp6 = int( graphTimestamp6 ) -\ |
| 814 | int( timestampBeginPtDown ) |
| 815 | ptDownGraphToOfp7 = int( graphTimestamp7 ) -\ |
| 816 | int( timestampBeginPtDown ) |
| 817 | ptDownDeviceToOfp6 = int( deviceTimestamp6 ) -\ |
| 818 | int( timestampBeginPtDown ) |
| 819 | ptDownDeviceToOfp7 = int( deviceTimestamp7 ) -\ |
| 820 | int( timestampBeginPtDown ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 821 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 822 | ptDownGraphToOfp6 = 0 |
| 823 | ptDownGraphToOfp7 = 0 |
| 824 | ptDownDeviceToOfp6 = 0 |
| 825 | ptDownDeviceToOfp7 = 0 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 826 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 827 | time.sleep( 3 ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 828 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 829 | # Caluclate average across clusters |
| 830 | ptDownGraphToOfpAvg =\ |
| 831 | ( int( ptDownGraphToOfp1 ) + |
| 832 | int( ptDownGraphToOfp2 ) + |
| 833 | int( ptDownGraphToOfp3 ) + |
| 834 | int( ptDownGraphToOfp4 ) + |
| 835 | int( ptDownGraphToOfp5 ) + |
| 836 | int( ptDownGraphToOfp6 ) + |
| 837 | int( ptDownGraphToOfp7 ) ) / clusterCount |
| 838 | ptDownDeviceToOfpAvg = \ |
| 839 | ( int( ptDownDeviceToOfp1 ) + |
| 840 | int( ptDownDeviceToOfp2 ) + |
| 841 | int( ptDownDeviceToOfp3 ) + |
| 842 | int( ptDownDeviceToOfp4 ) + |
| 843 | int( ptDownDeviceToOfp5 ) + |
| 844 | int( ptDownDeviceToOfp6 ) + |
| 845 | int( ptDownDeviceToOfp7 ) ) / clusterCount |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 846 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 847 | if ptDownGraphToOfpAvg > downThresholdMin and \ |
| 848 | ptDownGraphToOfpAvg < downThresholdMax: |
| 849 | portDownGraphToOfpList.append( |
| 850 | ptDownGraphToOfpAvg ) |
| 851 | main.log.info( "Port down: graph to ofp avg: " + |
| 852 | str( ptDownGraphToOfpAvg ) + " ms" ) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 853 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 854 | main.log.info( "Average port down graph-to-ofp result" + |
| 855 | " exceeded the threshold: " + |
| 856 | str( ptDownGraphToOfpAvg ) ) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 857 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 858 | if ptDownDeviceToOfpAvg > 0 and \ |
| 859 | ptDownDeviceToOfpAvg < 1000: |
| 860 | portDownDeviceToOfpList.append( |
| 861 | ptDownDeviceToOfpAvg ) |
| 862 | main.log.info( "Port down: device to ofp avg: " + |
| 863 | str( ptDownDeviceToOfpAvg ) + " ms" ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 864 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 865 | main.log.info( "Average port down device-to-ofp result" + |
| 866 | " exceeded the threshold: " + |
| 867 | str( ptDownDeviceToOfpAvg ) ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 868 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 869 | # Port up events |
| 870 | main.step( "Enable port and obtain timestamp" ) |
| 871 | main.step( "Starting wireshark capture for port status up" ) |
| 872 | main.ONOS1.tsharkGrep( tsharkPortStatus, tsharkPortUp ) |
| 873 | time.sleep( 5 ) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 874 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 875 | main.Mininet1.handle.sendline( "sh ifconfig " + |
| 876 | interfaceConfig + " up" ) |
| 877 | main.Mininet1.handle.expect( "mininet>" ) |
| 878 | |
| 879 | # Allow time for tshark to capture event |
| 880 | time.sleep( 5 ) |
| 881 | main.ONOS1.tsharkStop() |
| 882 | |
| 883 | time.sleep( 3 ) |
| 884 | os.system( "scp " + ONOSUser + "@" + ONOS1Ip + ":" + |
| 885 | tsharkPortUp + " /tmp/" ) |
| 886 | fPortUp = open( tsharkPortUp, 'r' ) |
| 887 | fLine = fPortUp.readline() |
| 888 | objUp = fLine.split( " " ) |
| 889 | if len( fLine ) > 0: |
| 890 | timestampBeginPtUp = int( float( objUp[ 1 ] ) * 1000 ) |
| 891 | if timestampBeginPtUp < 1400000000000: |
| 892 | timestampBeginPtUp = \ |
| 893 | int( float( objUp[ 2 ] ) * 1000 ) |
| 894 | main.log.info( "Port up begin timestamp: " + |
| 895 | str( timestampBeginPtUp ) ) |
andrewonlab | 8d29f12 | 2014-10-22 17:15:04 -0400 | [diff] [blame] | 896 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 897 | main.log.info( "Tshark output file returned unexpected" + |
| 898 | " results." ) |
| 899 | timestampBeginPtUp = 0 |
| 900 | fPortUp.close() |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 901 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 902 | # Obtain metrics shortly afterwards |
| 903 | # This timestsamp captures |
| 904 | # the epoch time at which the topology graph was updated. |
| 905 | main.step( "Obtain t1 by REST call" ) |
| 906 | jsonStrUp1 = main.ONOS1cli.topologyEventsMetrics() |
| 907 | jsonObj1 = json.loads( jsonStrUp1 ) |
| 908 | graphTimestamp1 = \ |
| 909 | jsonObj1[ graphTimestamp ][ 'value' ] |
| 910 | # Obtain device timestamp. This timestamp captures |
| 911 | # the epoch time at which the device event happened |
| 912 | deviceTimestamp1 = \ |
| 913 | jsonObj1[ deviceTimestamp ][ 'value' ] |
| 914 | # Get delta between graph event and OFP |
| 915 | ptUpGraphToOfp1 = int( graphTimestamp1 ) -\ |
| 916 | int( timestampBeginPtUp ) |
| 917 | # Get delta between device event and OFP |
| 918 | ptUpDeviceToOfp1 = int( deviceTimestamp1 ) -\ |
| 919 | int( timestampBeginPtUp ) |
andrewonlab | 393531a | 2014-10-27 18:36:26 -0400 | [diff] [blame] | 920 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 921 | if clusterCount >= 3: |
| 922 | jsonStrUp2 = main.ONOS2cli.topologyEventsMetrics() |
| 923 | jsonStrUp3 = main.ONOS3cli.topologyEventsMetrics() |
| 924 | jsonObj2 = json.loads( jsonStrUp2 ) |
| 925 | jsonObj3 = json.loads( jsonStrUp3 ) |
| 926 | graphTimestamp2 = \ |
| 927 | jsonObj2[ graphTimestamp ][ 'value' ] |
| 928 | graphTimestamp3 = \ |
| 929 | jsonObj3[ graphTimestamp ][ 'value' ] |
| 930 | deviceTimestamp2 = \ |
| 931 | jsonObj2[ deviceTimestamp ][ 'value' ] |
| 932 | deviceTimestamp3 = \ |
| 933 | jsonObj3[ deviceTimestamp ][ 'value' ] |
| 934 | ptUpGraphToOfp2 = int( graphTimestamp2 ) -\ |
| 935 | int( timestampBeginPtUp ) |
| 936 | ptUpGraphToOfp3 = int( graphTimestamp3 ) -\ |
| 937 | int( timestampBeginPtUp ) |
| 938 | ptUpDeviceToOfp2 = int( deviceTimestamp2 ) -\ |
| 939 | int( timestampBeginPtUp ) |
| 940 | ptUpDeviceToOfp3 = int( deviceTimestamp3 ) -\ |
| 941 | int( timestampBeginPtUp ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 942 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 943 | ptUpGraphToOfp2 = 0 |
| 944 | ptUpGraphToOfp3 = 0 |
| 945 | ptUpDeviceToOfp2 = 0 |
| 946 | ptUpDeviceToOfp3 = 0 |
andrewonlab | b1998c5 | 2014-11-10 13:31:43 -0500 | [diff] [blame] | 947 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 948 | if clusterCount >= 5: |
| 949 | jsonStrUp4 = main.ONOS4cli.topologyEventsMetrics() |
| 950 | jsonStrUp5 = main.ONOS5cli.topologyEventsMetrics() |
| 951 | jsonObj4 = json.loads( jsonStrUp4 ) |
| 952 | jsonObj5 = json.loads( jsonStrUp5 ) |
| 953 | graphTimestamp4 = \ |
| 954 | jsonObj4[ graphTimestamp ][ 'value' ] |
| 955 | graphTimestamp5 = \ |
| 956 | jsonObj5[ graphTimestamp ][ 'value' ] |
| 957 | deviceTimestamp4 = \ |
| 958 | jsonObj4[ deviceTimestamp ][ 'value' ] |
| 959 | deviceTimestamp5 = \ |
| 960 | jsonObj5[ deviceTimestamp ][ 'value' ] |
| 961 | ptUpGraphToOfp4 = int( graphTimestamp4 ) -\ |
| 962 | int( timestampBeginPtUp ) |
| 963 | ptUpGraphToOfp5 = int( graphTimestamp5 ) -\ |
| 964 | int( timestampBeginPtUp ) |
| 965 | ptUpDeviceToOfp4 = int( deviceTimestamp4 ) -\ |
| 966 | int( timestampBeginPtUp ) |
| 967 | ptUpDeviceToOfp5 = int( deviceTimestamp5 ) -\ |
| 968 | int( timestampBeginPtUp ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 969 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 970 | ptUpGraphToOfp4 = 0 |
| 971 | ptUpGraphToOfp5 = 0 |
| 972 | ptUpDeviceToOfp4 = 0 |
| 973 | ptUpDeviceToOfp5 = 0 |
| 974 | |
| 975 | if clusterCount >= 7: |
| 976 | jsonStrUp6 = main.ONOS6cli.topologyEventsMetrics() |
| 977 | jsonStrUp7 = main.ONOS7cli.topologyEventsMetrics() |
| 978 | jsonObj6 = json.loads( jsonStrUp6 ) |
| 979 | jsonObj7 = json.loads( jsonStrUp7 ) |
| 980 | graphTimestamp6 = \ |
| 981 | jsonObj6[ graphTimestamp ][ 'value' ] |
| 982 | graphTimestamp7 = \ |
| 983 | jsonObj7[ graphTimestamp ][ 'value' ] |
| 984 | deviceTimestamp6 = \ |
| 985 | jsonObj6[ deviceTimestamp ][ 'value' ] |
| 986 | deviceTimestamp7 = \ |
| 987 | jsonObj7[ deviceTimestamp ][ 'value' ] |
| 988 | ptUpGraphToOfp6 = int( graphTimestamp6 ) -\ |
| 989 | int( timestampBeginPtUp ) |
| 990 | ptUpGraphToOfp7 = int( graphTimestamp7 ) -\ |
| 991 | int( timestampBeginPtUp ) |
| 992 | ptUpDeviceToOfp6 = int( deviceTimestamp6 ) -\ |
| 993 | int( timestampBeginPtUp ) |
| 994 | ptUpDeviceToOfp7 = int( deviceTimestamp7 ) -\ |
| 995 | int( timestampBeginPtUp ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 996 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 997 | ptUpGraphToOfp6 = 0 |
| 998 | ptUpGraphToOfp7 = 0 |
| 999 | ptUpDeviceToOfp6 = 0 |
| 1000 | ptUpDeviceToOfp7 = 0 |
| 1001 | |
| 1002 | ptUpGraphToOfpAvg = \ |
| 1003 | ( int( ptUpGraphToOfp1 ) + |
| 1004 | int( ptUpGraphToOfp2 ) + |
| 1005 | int( ptUpGraphToOfp3 ) + |
| 1006 | int( ptUpGraphToOfp4 ) + |
| 1007 | int( ptUpGraphToOfp5 ) + |
| 1008 | int( ptUpGraphToOfp6 ) + |
| 1009 | int( ptUpGraphToOfp7 ) ) / clusterCount |
| 1010 | |
| 1011 | ptUpDeviceToOfpAvg = \ |
| 1012 | ( int( ptUpDeviceToOfp1 ) + |
| 1013 | int( ptUpDeviceToOfp2 ) + |
| 1014 | int( ptUpDeviceToOfp3 ) + |
| 1015 | int( ptUpDeviceToOfp4 ) + |
| 1016 | int( ptUpDeviceToOfp5 ) + |
| 1017 | int( ptUpDeviceToOfp6 ) + |
| 1018 | int( ptUpDeviceToOfp7 ) ) / clusterCount |
| 1019 | |
| 1020 | if ptUpGraphToOfpAvg > upThresholdMin and \ |
| 1021 | ptUpGraphToOfpAvg < upThresholdMax: |
| 1022 | portUpGraphToOfpList.append( |
| 1023 | ptUpGraphToOfpAvg ) |
| 1024 | main.log.info( "Port down: graph to ofp avg: " + |
| 1025 | str( ptUpGraphToOfpAvg ) + " ms" ) |
| 1026 | else: |
| 1027 | main.log.info( "Average port up graph-to-ofp result" + |
| 1028 | " exceeded the threshold: " + |
| 1029 | str( ptUpGraphToOfpAvg ) ) |
| 1030 | |
| 1031 | if ptUpDeviceToOfpAvg > upThresholdMin and \ |
| 1032 | ptUpDeviceToOfpAvg < upThresholdMax: |
| 1033 | portUpDeviceToOfpList.append( |
| 1034 | ptUpDeviceToOfpAvg ) |
| 1035 | main.log.info( "Port up: device to ofp avg: " + |
| 1036 | str( ptUpDeviceToOfpAvg ) + " ms" ) |
| 1037 | else: |
| 1038 | main.log.info( "Average port up device-to-ofp result" + |
| 1039 | " exceeded the threshold: " + |
| 1040 | str( ptUpDeviceToOfpAvg ) ) |
| 1041 | |
| 1042 | # END ITERATION FOR LOOP |
| 1043 | |
| 1044 | # Check all list for latency existence and set assertion |
| 1045 | if ( portDownGraphToOfpList and portDownDeviceToOfpList |
| 1046 | and portUpGraphToOfpList and portUpDeviceToOfpList ): |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1047 | assertion = main.TRUE |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1048 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1049 | main.log.report( "Cluster size: " + str( clusterCount ) + |
| 1050 | " node(s)" ) |
| 1051 | # Calculate and report latency measurements |
| 1052 | portDownGraphToOfpMin = min( portDownGraphToOfpList ) |
| 1053 | portDownGraphToOfpMax = max( portDownGraphToOfpList ) |
| 1054 | portDownGraphToOfpAvg = \ |
| 1055 | ( sum( portDownGraphToOfpList ) / |
| 1056 | len( portDownGraphToOfpList ) ) |
| 1057 | portDownGraphToOfpStdDev = \ |
| 1058 | str( round( numpy.std( portDownGraphToOfpList ), 1 ) ) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1059 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1060 | main.log.report( "Port down graph-to-ofp " + |
| 1061 | "Avg: " + str( portDownGraphToOfpAvg ) + " ms " + |
| 1062 | "Std Deviation: " + portDownGraphToOfpStdDev + " ms" ) |
| 1063 | |
| 1064 | portDownDeviceToOfpMin = min( portDownDeviceToOfpList ) |
| 1065 | portDownDeviceToOfpMax = max( portDownDeviceToOfpList ) |
| 1066 | portDownDeviceToOfpAvg = \ |
| 1067 | ( sum( portDownDeviceToOfpList ) / |
| 1068 | len( portDownDeviceToOfpList ) ) |
| 1069 | portDownDeviceToOfpStdDev = \ |
| 1070 | str( round( numpy.std( portDownDeviceToOfpList ), 1 ) ) |
| 1071 | |
| 1072 | main.log.report( |
| 1073 | "Port down device-to-ofp " + |
| 1074 | "Avg: " + |
| 1075 | str( portDownDeviceToOfpAvg ) + |
| 1076 | " ms " + |
| 1077 | "Std Deviation: " + |
| 1078 | portDownDeviceToOfpStdDev + |
| 1079 | " ms" ) |
| 1080 | |
| 1081 | portUpGraphToOfpMin = min( portUpGraphToOfpList ) |
| 1082 | portUpGraphToOfpMax = max( portUpGraphToOfpList ) |
| 1083 | portUpGraphToOfpAvg = \ |
| 1084 | ( sum( portUpGraphToOfpList ) / |
| 1085 | len( portUpGraphToOfpList ) ) |
| 1086 | portUpGraphToOfpStdDev = \ |
| 1087 | str( round( numpy.std( portUpGraphToOfpList ), 1 ) ) |
| 1088 | |
| 1089 | main.log.report( "Port up graph-to-ofp " + |
| 1090 | "Avg: " + str( portUpGraphToOfpAvg ) + " ms " + |
| 1091 | "Std Deviation: " + portUpGraphToOfpStdDev + " ms" ) |
| 1092 | |
| 1093 | portUpDeviceToOfpMin = min( portUpDeviceToOfpList ) |
| 1094 | portUpDeviceToOfpMax = max( portUpDeviceToOfpList ) |
| 1095 | portUpDeviceToOfpAvg = \ |
| 1096 | ( sum( portUpDeviceToOfpList ) / |
| 1097 | len( portUpDeviceToOfpList ) ) |
| 1098 | portUpDeviceToOfpStdDev = \ |
| 1099 | str( round( numpy.std( portUpDeviceToOfpList ), 1 ) ) |
| 1100 | |
| 1101 | main.log.report( "Port up device-to-ofp " + |
| 1102 | "Avg: " + str( portUpDeviceToOfpAvg ) + " ms " + |
| 1103 | "Std Deviation: " + portUpDeviceToOfpStdDev + " ms" ) |
| 1104 | |
| 1105 | # Remove switches from controller for next test |
| 1106 | main.Mininet1.deleteSwController( "s1" ) |
| 1107 | main.Mininet1.deleteSwController( "s2" ) |
| 1108 | |
| 1109 | utilities.assert_equals( |
| 1110 | expect=main.TRUE, |
| 1111 | actual=assertion, |
| 1112 | onpass="Port discovery latency calculation successful", |
| 1113 | onfail="Port discovery test failed" ) |
| 1114 | |
| 1115 | def CASE4( self, main ): |
| 1116 | """ |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1117 | Link down event using loss rate 100% |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1118 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1119 | Important: |
| 1120 | Use a simple 2 switch topology with 1 link between |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1121 | the two switches. Ensure that mac addresses of the |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1122 | switches are 1 / 2 respectively |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1123 | """ |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1124 | import time |
| 1125 | import subprocess |
| 1126 | import os |
| 1127 | import requests |
| 1128 | import json |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1129 | import numpy |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1130 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1131 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 1132 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 1133 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 1134 | ONOSUser = main.params[ 'CTRL' ][ 'user' ] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1135 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1136 | defaultSwPort = main.params[ 'CTRL' ][ 'port1' ] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1137 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1138 | # Number of iterations of case |
| 1139 | numIter = main.params[ 'TEST' ][ 'numIter' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1140 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1141 | # Timestamp 'keys' for json metrics output. |
| 1142 | # These are subject to change, hence moved into params |
| 1143 | deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ] |
| 1144 | linkTimestamp = main.params[ 'JSON' ][ 'linkTimestamp' ] |
| 1145 | graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1146 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1147 | debugMode = main.params[ 'TEST' ][ 'debugMode' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1148 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1149 | localTime = time.strftime( '%x %X' ) |
| 1150 | localTime = localTime.replace( "/", "" ) |
| 1151 | localTime = localTime.replace( " ", "_" ) |
| 1152 | localTime = localTime.replace( ":", "" ) |
| 1153 | if debugMode == 'on': |
| 1154 | main.ONOS1.tsharkPcap( "eth0", |
| 1155 | "/tmp/link_lat_pcap_" + localTime ) |
| 1156 | |
| 1157 | # Threshold for this test case |
| 1158 | upThresholdStr = main.params[ 'TEST' ][ 'linkUpThreshold' ] |
| 1159 | downThresholdStr = main.params[ 'TEST' ][ 'linkDownThreshold' ] |
| 1160 | |
| 1161 | upThresholdObj = upThresholdStr.split( "," ) |
| 1162 | downThresholdObj = downThresholdStr.split( "," ) |
| 1163 | |
| 1164 | upThresholdMin = int( upThresholdObj[ 0 ] ) |
| 1165 | upThresholdMax = int( upThresholdObj[ 1 ] ) |
| 1166 | |
| 1167 | downThresholdMin = int( downThresholdObj[ 0 ] ) |
| 1168 | downThresholdMax = int( downThresholdObj[ 1 ] ) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1169 | |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1170 | assertion = main.TRUE |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1171 | # Link event timestamp to system time list |
| 1172 | linkDownLinkToSystemList = [] |
| 1173 | linkUpLinkToSystemList = [] |
| 1174 | # Graph event timestamp to system time list |
| 1175 | linkDownGraphToSystemList = [] |
| 1176 | linkUpGraphToSystemList = [] |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1177 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1178 | main.log.report( "Link up / down discovery latency between " + |
| 1179 | "two switches" ) |
| 1180 | main.log.report( "Simulated by setting loss-rate 100%" ) |
| 1181 | main.log.report( "'tc qdisc add dev <intfs> root netem loss 100%'" ) |
| 1182 | main.log.report( "Total iterations of test: " + str( numIter ) ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1183 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1184 | main.step( "Assign all switches" ) |
| 1185 | main.Mininet1.assignSwController( sw="1", |
| 1186 | ip1=ONOS1Ip, port1=defaultSwPort ) |
| 1187 | main.Mininet1.assignSwController( sw="2", |
| 1188 | ip1=ONOS1Ip, port1=defaultSwPort ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1189 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1190 | main.step( "Verifying switch assignment" ) |
| 1191 | resultS1 = main.Mininet1.getSwController( sw="s1" ) |
| 1192 | resultS2 = main.Mininet1.getSwController( sw="s2" ) |
andrewonlab | 3622beb | 2014-10-28 16:07:56 -0400 | [diff] [blame] | 1193 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1194 | # Allow time for events to finish before taking measurements |
| 1195 | time.sleep( 10 ) |
| 1196 | |
| 1197 | linkDown1 = False |
| 1198 | linkDown2 = False |
| 1199 | linkDown3 = False |
| 1200 | # Start iteration of link event test |
| 1201 | for i in range( 0, int( numIter ) ): |
| 1202 | main.step( "Getting initial system time as t0" ) |
| 1203 | |
| 1204 | # System time in epoch ms |
| 1205 | timestampLinkDownT0 = time.time() * 1000 |
| 1206 | # Link down is simulated by 100% loss rate using traffic |
| 1207 | # control command |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1208 | main.Mininet1.handle.sendline( |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1209 | "sh tc qdisc add dev s1-eth1 root netem loss 100%" ) |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1210 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1211 | # TODO: Iterate through 'links' command to verify that |
| 1212 | # link s1 -> s2 went down ( loop timeout 30 seconds ) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1213 | # on all 3 ONOS instances |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1214 | main.log.info( "Checking ONOS for link update" ) |
| 1215 | loopCount = 0 |
| 1216 | while( not ( linkDown1 and linkDown2 and linkDown3 ) |
| 1217 | and loopCount < 30 ): |
| 1218 | jsonStr1 = main.ONOS1cli.links() |
| 1219 | jsonStr2 = main.ONOS2cli.links() |
| 1220 | jsonStr3 = main.ONOS3cli.links() |
| 1221 | |
| 1222 | if not ( jsonStr1 and jsonStr2 and jsonStr3 ): |
| 1223 | main.log.error( "CLI command returned error " ) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1224 | break |
| 1225 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1226 | jsonObj1 = json.loads( jsonStr1 ) |
| 1227 | jsonObj2 = json.loads( jsonStr2 ) |
| 1228 | jsonObj3 = json.loads( jsonStr3 ) |
| 1229 | for obj1 in jsonObj1: |
| 1230 | if '01' not in obj1[ 'src' ][ 'device' ]: |
| 1231 | linkDown1 = True |
| 1232 | main.log.info( "Link down from " + |
| 1233 | "s1 -> s2 on ONOS1 detected" ) |
| 1234 | for obj2 in jsonObj2: |
| 1235 | if '01' not in obj2[ 'src' ][ 'device' ]: |
| 1236 | linkDown2 = True |
| 1237 | main.log.info( "Link down from " + |
| 1238 | "s1 -> s2 on ONOS2 detected" ) |
| 1239 | for obj3 in jsonObj3: |
| 1240 | if '01' not in obj3[ 'src' ][ 'device' ]: |
| 1241 | linkDown3 = True |
| 1242 | main.log.info( "Link down from " + |
| 1243 | "s1 -> s2 on ONOS3 detected" ) |
| 1244 | |
| 1245 | loopCount += 1 |
| 1246 | # If CLI doesn't like the continuous requests |
| 1247 | # and exits in this loop, increase the sleep here. |
| 1248 | # Consequently, while loop timeout will increase |
| 1249 | time.sleep( 1 ) |
| 1250 | |
| 1251 | # Give time for metrics measurement to catch up |
| 1252 | # NOTE: May need to be configured more accurately |
| 1253 | time.sleep( 10 ) |
| 1254 | # If we exited the while loop and link down 1,2,3 are still |
| 1255 | # false, then ONOS has failed to discover link down event |
| 1256 | if not ( linkDown1 and linkDown2 and linkDown3 ): |
| 1257 | main.log.info( "Link down discovery failed" ) |
| 1258 | |
| 1259 | linkDownLatGraph1 = 0 |
| 1260 | linkDownLatGraph2 = 0 |
| 1261 | linkDownLatGraph3 = 0 |
| 1262 | linkDownLatDevice1 = 0 |
| 1263 | linkDownLatDevice2 = 0 |
| 1264 | linkDownLatDevice3 = 0 |
| 1265 | |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1266 | assertion = main.FALSE |
| 1267 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1268 | jsonTopoMetrics1 =\ |
| 1269 | main.ONOS1cli.topologyEventsMetrics() |
| 1270 | jsonTopoMetrics2 =\ |
| 1271 | main.ONOS2cli.topologyEventsMetrics() |
| 1272 | jsonTopoMetrics3 =\ |
| 1273 | main.ONOS3cli.topologyEventsMetrics() |
| 1274 | jsonTopoMetrics1 = json.loads( jsonTopoMetrics1 ) |
| 1275 | jsonTopoMetrics2 = json.loads( jsonTopoMetrics2 ) |
| 1276 | jsonTopoMetrics3 = json.loads( jsonTopoMetrics3 ) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1277 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1278 | main.log.info( "Obtaining graph and device timestamp" ) |
| 1279 | graphTimestamp1 = \ |
| 1280 | jsonTopoMetrics1[ graphTimestamp ][ 'value' ] |
| 1281 | graphTimestamp2 = \ |
| 1282 | jsonTopoMetrics2[ graphTimestamp ][ 'value' ] |
| 1283 | graphTimestamp3 = \ |
| 1284 | jsonTopoMetrics3[ graphTimestamp ][ 'value' ] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1285 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1286 | linkTimestamp1 = \ |
| 1287 | jsonTopoMetrics1[ linkTimestamp ][ 'value' ] |
| 1288 | linkTimestamp2 = \ |
| 1289 | jsonTopoMetrics2[ linkTimestamp ][ 'value' ] |
| 1290 | linkTimestamp3 = \ |
| 1291 | jsonTopoMetrics3[ linkTimestamp ][ 'value' ] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1292 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1293 | if graphTimestamp1 and graphTimestamp2 and\ |
| 1294 | graphTimestamp3 and linkTimestamp1 and\ |
| 1295 | linkTimestamp2 and linkTimestamp3: |
| 1296 | linkDownLatGraph1 = int( graphTimestamp1 ) -\ |
| 1297 | int( timestampLinkDownT0 ) |
| 1298 | linkDownLatGraph2 = int( graphTimestamp2 ) -\ |
| 1299 | int( timestampLinkDownT0 ) |
| 1300 | linkDownLatGraph3 = int( graphTimestamp3 ) -\ |
| 1301 | int( timestampLinkDownT0 ) |
| 1302 | |
| 1303 | linkDownLatLink1 = int( linkTimestamp1 ) -\ |
| 1304 | int( timestampLinkDownT0 ) |
| 1305 | linkDownLatLink2 = int( linkTimestamp2 ) -\ |
| 1306 | int( timestampLinkDownT0 ) |
| 1307 | linkDownLatLink3 = int( linkTimestamp3 ) -\ |
| 1308 | int( timestampLinkDownT0 ) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1309 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1310 | main.log.error( "There was an error calculating" + |
| 1311 | " the delta for link down event" ) |
| 1312 | linkDownLatGraph1 = 0 |
| 1313 | linkDownLatGraph2 = 0 |
| 1314 | linkDownLatGraph3 = 0 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1315 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1316 | linkDownLatDevice1 = 0 |
| 1317 | linkDownLatDevice2 = 0 |
| 1318 | linkDownLatDevice3 = 0 |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1319 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1320 | main.log.info( "Link down latency ONOS1 iteration " + |
| 1321 | str( i ) + " (end-to-end): " + |
| 1322 | str( linkDownLatGraph1 ) + " ms" ) |
| 1323 | main.log.info( "Link down latency ONOS2 iteration " + |
| 1324 | str( i ) + " (end-to-end): " + |
| 1325 | str( linkDownLatGraph2 ) + " ms" ) |
| 1326 | main.log.info( "Link down latency ONOS3 iteration " + |
| 1327 | str( i ) + " (end-to-end): " + |
| 1328 | str( linkDownLatGraph3 ) + " ms" ) |
| 1329 | |
| 1330 | main.log.info( "Link down latency ONOS1 iteration " + |
| 1331 | str( i ) + " (link-event-to-system-timestamp): " + |
| 1332 | str( linkDownLatLink1 ) + " ms" ) |
| 1333 | main.log.info( "Link down latency ONOS2 iteration " + |
| 1334 | str( i ) + " (link-event-to-system-timestamp): " + |
| 1335 | str( linkDownLatLink2 ) + " ms" ) |
| 1336 | main.log.info( "Link down latency ONOS3 iteration " + |
| 1337 | str( i ) + " (link-event-to-system-timestamp): " + |
| 1338 | str( linkDownLatLink3 ) ) |
| 1339 | |
| 1340 | # Calculate avg of node calculations |
| 1341 | linkDownLatGraphAvg =\ |
| 1342 | ( linkDownLatGraph1 + |
| 1343 | linkDownLatGraph2 + |
| 1344 | linkDownLatGraph3 ) / 3 |
| 1345 | linkDownLatLinkAvg =\ |
| 1346 | ( linkDownLatLink1 + |
| 1347 | linkDownLatLink2 + |
| 1348 | linkDownLatLink3 ) / 3 |
| 1349 | |
| 1350 | # Set threshold and append latency to list |
| 1351 | if linkDownLatGraphAvg > downThresholdMin and\ |
| 1352 | linkDownLatGraphAvg < downThresholdMax: |
| 1353 | linkDownGraphToSystemList.append( |
| 1354 | linkDownLatGraphAvg ) |
| 1355 | else: |
| 1356 | main.log.info( "Link down latency exceeded threshold" ) |
| 1357 | main.log.info( "Results for iteration " + str( i ) + |
| 1358 | "have been omitted" ) |
| 1359 | if linkDownLatLinkAvg > downThresholdMin and\ |
| 1360 | linkDownLatLinkAvg < downThresholdMax: |
| 1361 | linkDownLinkToSystemList.append( |
| 1362 | linkDownLatLinkAvg ) |
| 1363 | else: |
| 1364 | main.log.info( "Link down latency exceeded threshold" ) |
| 1365 | main.log.info( "Results for iteration " + str( i ) + |
| 1366 | "have been omitted" ) |
| 1367 | |
| 1368 | # NOTE: To remove loss rate and measure latency: |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1369 | # 'sh tc qdisc del dev s1-eth1 root' |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1370 | timestampLinkUpT0 = time.time() * 1000 |
| 1371 | main.Mininet1.handle.sendline( "sh tc qdisc del dev " + |
| 1372 | "s1-eth1 root" ) |
| 1373 | main.Mininet1.handle.expect( "mininet>" ) |
| 1374 | |
| 1375 | main.log.info( "Checking ONOS for link update" ) |
| 1376 | |
| 1377 | linkDown1 = True |
| 1378 | linkDown2 = True |
| 1379 | linkDown3 = True |
| 1380 | loopCount = 0 |
| 1381 | while( ( linkDown1 and linkDown2 and linkDown3 ) |
| 1382 | and loopCount < 30 ): |
| 1383 | jsonStr1 = main.ONOS1cli.links() |
| 1384 | jsonStr2 = main.ONOS2cli.links() |
| 1385 | jsonStr3 = main.ONOS3cli.links() |
| 1386 | if not ( jsonStr1 and jsonStr2 and jsonStr3 ): |
| 1387 | main.log.error( "CLI command returned error " ) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1388 | break |
| 1389 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1390 | jsonObj1 = json.loads( jsonStr1 ) |
| 1391 | jsonObj2 = json.loads( jsonStr2 ) |
| 1392 | jsonObj3 = json.loads( jsonStr3 ) |
| 1393 | |
| 1394 | for obj1 in jsonObj1: |
| 1395 | if '01' in obj1[ 'src' ][ 'device' ]: |
| 1396 | linkDown1 = False |
| 1397 | main.log.info( "Link up from " + |
| 1398 | "s1 -> s2 on ONOS1 detected" ) |
| 1399 | for obj2 in jsonObj2: |
| 1400 | if '01' in obj2[ 'src' ][ 'device' ]: |
| 1401 | linkDown2 = False |
| 1402 | main.log.info( "Link up from " + |
| 1403 | "s1 -> s2 on ONOS2 detected" ) |
| 1404 | for obj3 in jsonObj3: |
| 1405 | if '01' in obj3[ 'src' ][ 'device' ]: |
| 1406 | linkDown3 = False |
| 1407 | main.log.info( "Link up from " + |
| 1408 | "s1 -> s2 on ONOS3 detected" ) |
| 1409 | |
| 1410 | loopCount += 1 |
| 1411 | time.sleep( 1 ) |
| 1412 | |
| 1413 | if ( linkDown1 and linkDown2 and linkDown3 ): |
| 1414 | main.log.info( "Link up discovery failed" ) |
| 1415 | |
| 1416 | linkUpLatGraph1 = 0 |
| 1417 | linkUpLatGraph2 = 0 |
| 1418 | linkUpLatGraph3 = 0 |
| 1419 | linkUpLatDevice1 = 0 |
| 1420 | linkUpLatDevice2 = 0 |
| 1421 | linkUpLatDevice3 = 0 |
| 1422 | |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1423 | assertion = main.FALSE |
| 1424 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1425 | jsonTopoMetrics1 =\ |
| 1426 | main.ONOS1cli.topologyEventsMetrics() |
| 1427 | jsonTopoMetrics2 =\ |
| 1428 | main.ONOS2cli.topologyEventsMetrics() |
| 1429 | jsonTopoMetrics3 =\ |
| 1430 | main.ONOS3cli.topologyEventsMetrics() |
| 1431 | jsonTopoMetrics1 = json.loads( jsonTopoMetrics1 ) |
| 1432 | jsonTopoMetrics2 = json.loads( jsonTopoMetrics2 ) |
| 1433 | jsonTopoMetrics3 = json.loads( jsonTopoMetrics3 ) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1434 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1435 | main.log.info( "Obtaining graph and device timestamp" ) |
| 1436 | graphTimestamp1 = \ |
| 1437 | jsonTopoMetrics1[ graphTimestamp ][ 'value' ] |
| 1438 | graphTimestamp2 = \ |
| 1439 | jsonTopoMetrics2[ graphTimestamp ][ 'value' ] |
| 1440 | graphTimestamp3 = \ |
| 1441 | jsonTopoMetrics3[ graphTimestamp ][ 'value' ] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1442 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1443 | linkTimestamp1 = \ |
| 1444 | jsonTopoMetrics1[ linkTimestamp ][ 'value' ] |
| 1445 | linkTimestamp2 = \ |
| 1446 | jsonTopoMetrics2[ linkTimestamp ][ 'value' ] |
| 1447 | linkTimestamp3 = \ |
| 1448 | jsonTopoMetrics3[ linkTimestamp ][ 'value' ] |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1449 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1450 | if graphTimestamp1 and graphTimestamp2 and\ |
| 1451 | graphTimestamp3 and linkTimestamp1 and\ |
| 1452 | linkTimestamp2 and linkTimestamp3: |
| 1453 | linkUpLatGraph1 = int( graphTimestamp1 ) -\ |
| 1454 | int( timestampLinkUpT0 ) |
| 1455 | linkUpLatGraph2 = int( graphTimestamp2 ) -\ |
| 1456 | int( timestampLinkUpT0 ) |
| 1457 | linkUpLatGraph3 = int( graphTimestamp3 ) -\ |
| 1458 | int( timestampLinkUpT0 ) |
| 1459 | |
| 1460 | linkUpLatLink1 = int( linkTimestamp1 ) -\ |
| 1461 | int( timestampLinkUpT0 ) |
| 1462 | linkUpLatLink2 = int( linkTimestamp2 ) -\ |
| 1463 | int( timestampLinkUpT0 ) |
| 1464 | linkUpLatLink3 = int( linkTimestamp3 ) -\ |
| 1465 | int( timestampLinkUpT0 ) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1466 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1467 | main.log.error( "There was an error calculating" + |
| 1468 | " the delta for link down event" ) |
| 1469 | linkUpLatGraph1 = 0 |
| 1470 | linkUpLatGraph2 = 0 |
| 1471 | linkUpLatGraph3 = 0 |
kelvin-onlab | 8a83258 | 2015-01-16 17:06:11 -0800 | [diff] [blame] | 1472 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1473 | linkUpLatDevice1 = 0 |
| 1474 | linkUpLatDevice2 = 0 |
| 1475 | linkUpLatDevice3 = 0 |
| 1476 | |
| 1477 | if debugMode == 'on': |
| 1478 | main.log.info( "Link up latency ONOS1 iteration " + |
| 1479 | str( i ) + " (end-to-end): " + |
| 1480 | str( linkUpLatGraph1 ) + " ms" ) |
| 1481 | main.log.info( "Link up latency ONOS2 iteration " + |
| 1482 | str( i ) + " (end-to-end): " + |
| 1483 | str( linkUpLatGraph2 ) + " ms" ) |
| 1484 | main.log.info( "Link up latency ONOS3 iteration " + |
| 1485 | str( i ) + " (end-to-end): " + |
| 1486 | str( linkUpLatGraph3 ) + " ms" ) |
| 1487 | |
| 1488 | main.log.info( |
| 1489 | "Link up latency ONOS1 iteration " + |
| 1490 | str( i ) + |
| 1491 | " (link-event-to-system-timestamp): " + |
| 1492 | str( linkUpLatLink1 ) + |
| 1493 | " ms" ) |
| 1494 | main.log.info( |
| 1495 | "Link up latency ONOS2 iteration " + |
| 1496 | str( i ) + |
| 1497 | " (link-event-to-system-timestamp): " + |
| 1498 | str( linkUpLatLink2 ) + |
| 1499 | " ms" ) |
| 1500 | main.log.info( |
| 1501 | "Link up latency ONOS3 iteration " + |
| 1502 | str( i ) + |
| 1503 | " (link-event-to-system-timestamp): " + |
| 1504 | str( linkUpLatLink3 ) ) |
| 1505 | |
| 1506 | # Calculate avg of node calculations |
| 1507 | linkUpLatGraphAvg =\ |
| 1508 | ( linkUpLatGraph1 + |
| 1509 | linkUpLatGraph2 + |
| 1510 | linkUpLatGraph3 ) / 3 |
| 1511 | linkUpLatLinkAvg =\ |
| 1512 | ( linkUpLatLink1 + |
| 1513 | linkUpLatLink2 + |
| 1514 | linkUpLatLink3 ) / 3 |
| 1515 | |
| 1516 | # Set threshold and append latency to list |
| 1517 | if linkUpLatGraphAvg > upThresholdMin and\ |
| 1518 | linkUpLatGraphAvg < upThresholdMax: |
| 1519 | linkUpGraphToSystemList.append( |
| 1520 | linkUpLatGraphAvg ) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1521 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1522 | main.log.info( "Link up latency exceeded threshold" ) |
| 1523 | main.log.info( "Results for iteration " + str( i ) + |
| 1524 | "have been omitted" ) |
| 1525 | if linkUpLatLinkAvg > upThresholdMin and\ |
| 1526 | linkUpLatLinkAvg < upThresholdMax: |
| 1527 | linkUpLinkToSystemList.append( |
| 1528 | linkUpLatLinkAvg ) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1529 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1530 | main.log.info( "Link up latency exceeded threshold" ) |
| 1531 | main.log.info( "Results for iteration " + str( i ) + |
| 1532 | "have been omitted" ) |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1533 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1534 | # Calculate min, max, avg of list and report |
| 1535 | linkDownMin = min( linkDownGraphToSystemList ) |
| 1536 | linkDownMax = max( linkDownGraphToSystemList ) |
| 1537 | linkDownAvg = sum( linkDownGraphToSystemList ) / \ |
| 1538 | len( linkDownGraphToSystemList ) |
| 1539 | linkUpMin = min( linkUpGraphToSystemList ) |
| 1540 | linkUpMax = max( linkUpGraphToSystemList ) |
| 1541 | linkUpAvg = sum( linkUpGraphToSystemList ) / \ |
| 1542 | len( linkUpGraphToSystemList ) |
| 1543 | linkDownStdDev = \ |
| 1544 | str( round( numpy.std( linkDownGraphToSystemList ), 1 ) ) |
| 1545 | linkUpStdDev = \ |
| 1546 | str( round( numpy.std( linkUpGraphToSystemList ), 1 ) ) |
andrewonlab | abb11c3 | 2014-11-04 15:03:24 -0500 | [diff] [blame] | 1547 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1548 | main.log.report( "Link down latency " + |
| 1549 | "Avg: " + str( linkDownAvg ) + " ms " + |
| 1550 | "Std Deviation: " + linkDownStdDev + " ms" ) |
| 1551 | main.log.report( "Link up latency " + |
| 1552 | "Avg: " + str( linkUpAvg ) + " ms " + |
| 1553 | "Std Deviation: " + linkUpStdDev + " ms" ) |
andrewonlab | 4e12448 | 2014-11-04 13:37:25 -0500 | [diff] [blame] | 1554 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1555 | utilities.assert_equals( |
| 1556 | expect=main.TRUE, |
| 1557 | actual=assertion, |
| 1558 | onpass="Link discovery latency calculation successful", |
| 1559 | onfail="Link discovery latency case failed" ) |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1560 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1561 | def CASE5( self, main ): |
| 1562 | """ |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1563 | 100 Switch discovery latency |
| 1564 | |
| 1565 | Important: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1566 | This test case can be potentially dangerous if |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1567 | your machine has previously set iptables rules. |
| 1568 | One of the steps of the test case will flush |
| 1569 | all existing iptables rules. |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1570 | Note: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1571 | You can specify the number of switches in the |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1572 | params file to adjust the switch discovery size |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1573 | ( and specify the corresponding topology in Mininet1 |
| 1574 | .topo file ) |
| 1575 | """ |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1576 | import time |
| 1577 | import subprocess |
| 1578 | import os |
| 1579 | import requests |
| 1580 | import json |
| 1581 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1582 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 1583 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 1584 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 1585 | MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 1586 | ONOSUser = main.params[ 'CTRL' ][ 'user' ] |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1587 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1588 | defaultSwPort = main.params[ 'CTRL' ][ 'port1' ] |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1589 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1590 | # Number of iterations of case |
| 1591 | numIter = main.params[ 'TEST' ][ 'numIter' ] |
| 1592 | numSw = main.params[ 'TEST' ][ 'numSwitch' ] |
andrewonlab | 58f7d70 | 2014-11-07 13:21:19 -0500 | [diff] [blame] | 1593 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1594 | # Timestamp 'keys' for json metrics output. |
| 1595 | # These are subject to change, hence moved into params |
| 1596 | deviceTimestamp = main.params[ 'JSON' ][ 'deviceTimestamp' ] |
| 1597 | graphTimestamp = main.params[ 'JSON' ][ 'graphTimestamp' ] |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1598 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1599 | debugMode = main.params[ 'TEST' ][ 'debugMode' ] |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1600 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1601 | localTime = time.strftime( '%X' ) |
| 1602 | localTime = localTime.replace( "/", "" ) |
| 1603 | localTime = localTime.replace( " ", "_" ) |
| 1604 | localTime = localTime.replace( ":", "" ) |
| 1605 | if debugMode == 'on': |
| 1606 | main.ONOS1.tsharkPcap( "eth0", |
| 1607 | "/tmp/100_sw_lat_pcap_" + localTime ) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1608 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1609 | # Threshold for this test case |
| 1610 | swDiscThresholdStr = main.params[ 'TEST' ][ 'swDisc100Threshold' ] |
| 1611 | swDiscThresholdObj = swDiscThresholdStr.split( "," ) |
| 1612 | swDiscThresholdMin = int( swDiscThresholdObj[ 0 ] ) |
| 1613 | swDiscThresholdMax = int( swDiscThresholdObj[ 1 ] ) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1614 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1615 | tsharkOfpOutput = "/tmp/tshark_ofp_" + numSw + "sw.txt" |
| 1616 | tsharkTcpOutput = "/tmp/tshark_tcp_" + numSw + "sw.txt" |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1617 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1618 | tsharkOfpResultList = [] |
| 1619 | tsharkTcpResultList = [] |
| 1620 | |
| 1621 | swDiscoveryLatList = [] |
| 1622 | |
| 1623 | main.case( numSw + " Switch discovery latency" ) |
| 1624 | main.step( "Assigning all switches to ONOS1" ) |
| 1625 | for i in range( 1, int( numSw ) + 1 ): |
| 1626 | main.Mininet1.assignSwController( |
| 1627 | sw=str( i ), |
| 1628 | ip1=ONOS1Ip, |
| 1629 | port1=defaultSwPort ) |
| 1630 | |
| 1631 | # Ensure that nodes are configured with ptpd |
| 1632 | # Just a warning message |
| 1633 | main.log.info( "Please check ptpd configuration to ensure" + |
| 1634 | " All nodes' system times are in sync" ) |
| 1635 | time.sleep( 5 ) |
| 1636 | |
| 1637 | for i in range( 0, int( numIter ) ): |
| 1638 | |
| 1639 | main.step( "Set iptables rule to block incoming sw connections" ) |
| 1640 | # Set iptables rule to block incoming switch connections |
| 1641 | # The rule description is as follows: |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1642 | # Append to INPUT rule, |
| 1643 | # behavior DROP that matches following: |
| 1644 | # * packet type: tcp |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1645 | # * source IP: MN1Ip |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1646 | # * destination PORT: 6633 |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1647 | main.ONOS1.handle.sendline( |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1648 | "sudo iptables -A INPUT -p tcp -s " + MN1Ip + |
| 1649 | " --dport " + defaultSwPort + " -j DROP" ) |
| 1650 | main.ONOS1.handle.expect( "\$" ) |
| 1651 | # Append to OUTPUT rule, |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1652 | # behavior DROP that matches following: |
| 1653 | # * packet type: tcp |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1654 | # * source IP: MN1Ip |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1655 | # * destination PORT: 6633 |
| 1656 | main.ONOS1.handle.sendline( |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1657 | "sudo iptables -A OUTPUT -p tcp -s " + MN1Ip + |
| 1658 | " --dport " + defaultSwPort + " -j DROP" ) |
| 1659 | main.ONOS1.handle.expect( "\$" ) |
| 1660 | # Give time to allow rule to take effect |
| 1661 | # NOTE: Sleep period may need to be configured |
andrewonlab | 8790abb | 2014-11-06 13:51:54 -0500 | [diff] [blame] | 1662 | # based on the number of switches in the topology |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1663 | main.log.info( "Please wait for switch connection to " + |
| 1664 | "time out" ) |
| 1665 | time.sleep( 60 ) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1666 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1667 | # Gather vendor OFP with tshark |
| 1668 | main.ONOS1.tsharkGrep( "OFP 86 Vendor", |
| 1669 | tsharkOfpOutput ) |
| 1670 | main.ONOS1.tsharkGrep( "TCP 74 ", |
| 1671 | tsharkTcpOutput ) |
| 1672 | |
| 1673 | # NOTE: Remove all iptables rule quickly ( flush ) |
| 1674 | # Before removal, obtain TestON timestamp at which |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1675 | # removal took place |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1676 | # ( ensuring nodes are configured via ptp ) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1677 | # sudo iptables -F |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1678 | |
| 1679 | t0System = time.time() * 1000 |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1680 | main.ONOS1.handle.sendline( |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1681 | "sudo iptables -F" ) |
andrewonlab | b54b85b | 2014-10-28 18:43:57 -0400 | [diff] [blame] | 1682 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1683 | # Counter to track loop count |
| 1684 | counterLoop = 0 |
| 1685 | counterAvail1 = 0 |
| 1686 | counterAvail2 = 0 |
| 1687 | counterAvail3 = 0 |
| 1688 | onos1Dev = False |
| 1689 | onos2Dev = False |
| 1690 | onos3Dev = False |
| 1691 | while counterLoop < 60: |
| 1692 | # Continue to check devices for all device |
| 1693 | # availability. When all devices in all 3 |
| 1694 | # ONOS instances indicate that devices are available |
| 1695 | # obtain graph event timestamp for t1. |
| 1696 | deviceStrObj1 = main.ONOS1cli.devices() |
| 1697 | deviceStrObj2 = main.ONOS2cli.devices() |
| 1698 | deviceStrObj3 = main.ONOS3cli.devices() |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1699 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1700 | deviceJson1 = json.loads( deviceStrObj1 ) |
| 1701 | deviceJson2 = json.loads( deviceStrObj2 ) |
| 1702 | deviceJson3 = json.loads( deviceStrObj3 ) |
| 1703 | |
| 1704 | for device1 in deviceJson1: |
| 1705 | if device1[ 'available' ]: |
| 1706 | counterAvail1 += 1 |
| 1707 | if counterAvail1 == int( numSw ): |
| 1708 | onos1Dev = True |
| 1709 | main.log.info( "All devices have been " + |
| 1710 | "discovered on ONOS1" ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1711 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1712 | counterAvail1 = 0 |
| 1713 | for device2 in deviceJson2: |
| 1714 | if device2[ 'available' ]: |
| 1715 | counterAvail2 += 1 |
| 1716 | if counterAvail2 == int( numSw ): |
| 1717 | onos2Dev = True |
| 1718 | main.log.info( "All devices have been " + |
| 1719 | "discovered on ONOS2" ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1720 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1721 | counterAvail2 = 0 |
| 1722 | for device3 in deviceJson3: |
| 1723 | if device3[ 'available' ]: |
| 1724 | counterAvail3 += 1 |
| 1725 | if counterAvail3 == int( numSw ): |
| 1726 | onos3Dev = True |
| 1727 | main.log.info( "All devices have been " + |
| 1728 | "discovered on ONOS3" ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1729 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1730 | counterAvail3 = 0 |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1731 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1732 | if onos1Dev and onos2Dev and onos3Dev: |
| 1733 | main.log.info( "All devices have been discovered " + |
| 1734 | "on all ONOS instances" ) |
| 1735 | jsonStrTopologyMetrics1 =\ |
| 1736 | main.ONOS1cli.topologyEventsMetrics() |
| 1737 | jsonStrTopologyMetrics2 =\ |
| 1738 | main.ONOS2cli.topologyEventsMetrics() |
| 1739 | jsonStrTopologyMetrics3 =\ |
| 1740 | main.ONOS3cli.topologyEventsMetrics() |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1741 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1742 | # Exit while loop if all devices discovered |
| 1743 | break |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1744 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1745 | counterLoop += 1 |
| 1746 | # Give some time in between CLI calls |
| 1747 | #( will not affect measurement ) |
| 1748 | time.sleep( 3 ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1749 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1750 | main.ONOS1.tsharkStop() |
andrewonlab | 53b641c | 2014-10-31 19:44:44 -0400 | [diff] [blame] | 1751 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1752 | os.system( "scp " + ONOSUser + "@" + ONOS1Ip + ":" + |
| 1753 | tsharkOfpOutput + " /tmp/" ) |
| 1754 | os.system( "scp " + ONOSUser + "@" + ONOS1Ip + ":" + |
| 1755 | tsharkTcpOutput + " /tmp/" ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1756 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1757 | # TODO: Automate OFP output analysis |
| 1758 | # Debug mode - print out packets captured at runtime |
| 1759 | if debugMode == 'on': |
| 1760 | ofpFile = open( tsharkOfpOutput, 'r' ) |
| 1761 | main.log.info( "Tshark OFP Vendor output: " ) |
| 1762 | for line in ofpFile: |
| 1763 | tsharkOfpResultList.append( line ) |
| 1764 | main.log.info( line ) |
| 1765 | ofpFile.close() |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1766 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1767 | tcpFile = open( tsharkTcpOutput, 'r' ) |
| 1768 | main.log.info( "Tshark TCP 74 output: " ) |
| 1769 | for line in tcpFile: |
| 1770 | tsharkTcpResultList.append( line ) |
| 1771 | main.log.info( line ) |
| 1772 | tcpFile.close() |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1773 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1774 | jsonObj1 = json.loads( jsonStrTopologyMetrics1 ) |
| 1775 | jsonObj2 = json.loads( jsonStrTopologyMetrics2 ) |
| 1776 | jsonObj3 = json.loads( jsonStrTopologyMetrics3 ) |
| 1777 | |
| 1778 | graphTimestamp1 = \ |
| 1779 | jsonObj1[ graphTimestamp ][ 'value' ] |
| 1780 | graphTimestamp2 = \ |
| 1781 | jsonObj2[ graphTimestamp ][ 'value' ] |
| 1782 | graphTimestamp3 = \ |
| 1783 | jsonObj3[ graphTimestamp ][ 'value' ] |
| 1784 | |
| 1785 | graphLat1 = int( graphTimestamp1 ) - int( t0System ) |
| 1786 | graphLat2 = int( graphTimestamp2 ) - int( t0System ) |
| 1787 | graphLat3 = int( graphTimestamp3 ) - int( t0System ) |
| 1788 | |
| 1789 | avgGraphLat = \ |
| 1790 | ( int( graphLat1 ) + |
| 1791 | int( graphLat2 ) + |
| 1792 | int( graphLat3 ) ) / 3 |
| 1793 | |
| 1794 | if avgGraphLat > swDiscThresholdMin \ |
| 1795 | and avgGraphLat < swDiscThresholdMax: |
| 1796 | swDiscoveryLatList.append( |
| 1797 | avgGraphLat ) |
andrewonlab | e5bcef9 | 2014-11-06 17:53:20 -0500 | [diff] [blame] | 1798 | else: |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1799 | main.log.info( "100 Switch discovery latency " + |
| 1800 | "exceeded the threshold." ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1801 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1802 | # END ITERATION FOR LOOP |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1803 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1804 | swLatMin = min( swDiscoveryLatList ) |
| 1805 | swLatMax = max( swDiscoveryLatList ) |
| 1806 | swLatAvg = sum( swDiscoveryLatList ) /\ |
| 1807 | len( swDiscoveryLatList ) |
andrewonlab | 16ce485 | 2014-10-30 13:41:09 -0400 | [diff] [blame] | 1808 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1809 | main.log.report( "100 Switch discovery lat " + |
| 1810 | "Min: " + str( swLatMin ) + " ms" + |
| 1811 | "Max: " + str( swLatMax ) + " ms" + |
| 1812 | "Avg: " + str( swLatAvg ) + " ms" ) |
| 1813 | |
| 1814 | def CASE6( self, main ): |
| 1815 | """ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1816 | Increase number of nodes and initiate CLI |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1817 | """ |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1818 | import time |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1819 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1820 | ONOS1Ip = main.params[ 'CTRL' ][ 'ip1' ] |
| 1821 | ONOS2Ip = main.params[ 'CTRL' ][ 'ip2' ] |
| 1822 | ONOS3Ip = main.params[ 'CTRL' ][ 'ip3' ] |
| 1823 | ONOS4Ip = main.params[ 'CTRL' ][ 'ip4' ] |
| 1824 | ONOS5Ip = main.params[ 'CTRL' ][ 'ip5' ] |
| 1825 | ONOS6Ip = main.params[ 'CTRL' ][ 'ip6' ] |
| 1826 | ONOS7Ip = main.params[ 'CTRL' ][ 'ip7' ] |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1827 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1828 | cellName = main.params[ 'ENV' ][ 'cellName' ] |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1829 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1830 | global clusterCount |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1831 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1832 | # Cluster size increased everytime the case is defined |
| 1833 | clusterCount += 2 |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1834 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1835 | main.log.report( "Increasing cluster size to " + |
| 1836 | str( clusterCount ) ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1837 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1838 | installResult = main.FALSE |
| 1839 | if clusterCount == 3: |
| 1840 | main.log.info( "Installing nodes 2 and 3" ) |
| 1841 | node2Result = \ |
| 1842 | main.ONOSbench.onosInstall( node=ONOS2Ip ) |
| 1843 | node3Result = \ |
| 1844 | main.ONOSbench.onosInstall( node=ONOS3Ip ) |
| 1845 | installResult = node2Result and node3Result |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1846 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1847 | time.sleep( 5 ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1848 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1849 | main.ONOS2cli.startOnosCli( ONOS2Ip ) |
| 1850 | main.ONOS3cli.startOnosCli( ONOS3Ip ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1851 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1852 | elif clusterCount == 5: |
| 1853 | main.log.info( "Installing nodes 4 and 5" ) |
| 1854 | node4Result = \ |
| 1855 | main.ONOSbench.onosInstall( node=ONOS4Ip ) |
| 1856 | node5Result = \ |
| 1857 | main.ONOSbench.onosInstall( node=ONOS5Ip ) |
| 1858 | installResult = node4Result and node5Result |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1859 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1860 | time.sleep( 5 ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1861 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1862 | main.ONOS4cli.startOnosCli( ONOS4Ip ) |
| 1863 | main.ONOS5cli.startOnosCli( ONOS5Ip ) |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1864 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1865 | elif clusterCount == 7: |
andrewonlab | 6763069 | 2015-01-29 20:16:01 -0500 | [diff] [blame^] | 1866 | main.log.info( "Installing nodes 6 and 7" ) |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1867 | node6Result = \ |
| 1868 | main.ONOSbench.onosInstall( node=ONOS6Ip ) |
| 1869 | node7Result = \ |
| 1870 | main.ONOSbench.onosInstall( node=ONOS7Ip ) |
| 1871 | installResult = node6Result and node7Result |
andrewonlab | a57a304 | 2015-01-23 13:53:05 -0500 | [diff] [blame] | 1872 | |
andrewonlab | 79244cc | 2015-01-26 01:11:49 -0500 | [diff] [blame] | 1873 | time.sleep( 5 ) |
| 1874 | |
| 1875 | main.ONOS6cli.startOnosCli( ONOS6Ip ) |
| 1876 | main.ONOS7cli.startOnosCli( ONOS7Ip ) |