Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 1 | """ |
| 2 | Copyright 2015 Open Networking Foundation (ONF) |
| 3 | |
| 4 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 5 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 6 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
| 7 | |
| 8 | TestON is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 2 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | TestON is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
| 20 | """ |
| 21 | |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 22 | # SCPFintentRerouteLat |
| 23 | """ |
| 24 | SCPFintentRerouteLat |
| 25 | - Test Intent Reroute Latency |
| 26 | - Test Algorithm: |
| 27 | 1. Start Null Provider reroute Topology |
| 28 | 2. Using Push-test-intents to push batch size intents from switch 1 to switch 7 |
| 29 | 3. Cut the link between switch 3 and switch 4 (the path will reroute to switch 8) |
| 30 | 4. Get the topology time stamp |
| 31 | 5. Get Intent reroute(Installed) time stamp from each nodes |
| 32 | 6. Use the latest intent time stamp subtract topology time stamp |
| 33 | - This test will run 5 warm up by default, warm up iteration can be setup in Param file |
| 34 | - The intent batch size will default set to 1, 100, and 1000, also can be set in Param file |
| 35 | - The unit of the latency result is milliseconds |
| 36 | """ |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 37 | |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 38 | |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 39 | class SCPFintentRerouteLat: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 40 | def __init__( self ): |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 41 | self.default = '' |
| 42 | |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 43 | def CASE0( self, main ): |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 44 | import imp |
| 45 | import os |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 46 | ''' |
| 47 | - GIT |
| 48 | - BUILDING ONOS |
| 49 | Pull specific ONOS branch, then Build ONOS ono ONOS Bench. |
| 50 | This step is usually skipped. Because in a Jenkins driven automated |
| 51 | test env. We want Jenkins jobs to pull&build for flexibility to handle |
| 52 | different versions of ONOS. |
| 53 | - Construct tests variables |
| 54 | ''' |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 55 | try: |
| 56 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 57 | main.testSetUp = ONOSSetup() |
| 58 | except ImportError: |
| 59 | main.log.error( "ONOSSetup not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 60 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 61 | main.testSetUp.envSetupDescription() |
| 62 | stepResult = main.FALSE |
| 63 | try: |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 64 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 65 | main.BENCHUser = main.params[ 'BENCH' ][ 'user' ] |
| 66 | main.BENCHIp = main.params[ 'BENCH' ][ 'ip1' ] |
| 67 | main.MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 68 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 69 | main.scale = ( main.params[ 'SCALE' ] ).split( "," ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 70 | main.timeout = int( main.params[ 'SLEEP' ][ 'timeout' ] ) |
| 71 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 72 | main.installSleep = int( main.params[ 'SLEEP' ][ 'install' ] ) |
| 73 | main.verifySleep = int( main.params[ 'SLEEP' ][ 'verify' ] ) |
| 74 | main.setMasterSleep = int( main.params[ 'SLEEP' ][ 'setmaster' ] ) |
| 75 | main.verifyAttempts = int( main.params[ 'ATTEMPTS' ][ 'verify' ] ) |
| 76 | main.maxInvalidRun = int( main.params[ 'ATTEMPTS' ][ 'maxInvalidRun' ] ) |
| 77 | main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 78 | main.intentManagerCfg = main.params[ 'CFG' ][ 'intentManager' ] |
| 79 | main.intentConfigRegiCfg = main.params[ 'CFG' ][ 'intentConfigRegi' ] |
| 80 | main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ] |
| 81 | main.linkCollectionIntentCfg = main.params[ 'CFG' ][ 'linkCollectionIntent' ] |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 82 | main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] ) |
| 83 | main.ingress = main.params[ 'TEST' ][ 'ingress' ] |
| 84 | main.egress = main.params[ 'TEST' ][ 'egress' ] |
| 85 | main.debug = main.params[ 'TEST' ][ 'debug' ] |
| 86 | main.flowObj = main.params[ 'TEST' ][ 'flowObj' ] |
| 87 | main.deviceCount = int( main.params[ 'TEST' ][ 'deviceCount' ] ) |
| 88 | main.end1 = main.params[ 'TEST' ][ 'end1' ] |
| 89 | main.end2 = main.params[ 'TEST' ][ 'end2' ] |
| 90 | main.searchTerm = main.params[ 'SEARCHTERM' ] |
| 91 | if main.flowObj == "True": |
| 92 | main.flowObj = True |
| 93 | main.dbFileName = main.params[ 'DATABASE' ][ 'dbFlowObj' ] |
| 94 | main.intentsList = ( main.params[ 'TEST' ][ 'FObjintents' ] ).split( "," ) |
| 95 | else: |
| 96 | main.flowObj = False |
| 97 | main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ] |
| 98 | main.intentsList = ( main.params[ 'TEST' ][ 'intents' ] ).split( "," ) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 99 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 100 | stepResult = main.testSetUp.envSetup() |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 101 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 102 | for i in range( 0, len( main.intentsList ) ): |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 103 | main.intentsList[ i ] = int( main.intentsList[ i ] ) |
| 104 | # Create DataBase file |
| 105 | main.log.info( "Create Database file " + main.dbFileName ) |
| 106 | resultsDB = open( main.dbFileName, "w+" ) |
| 107 | resultsDB.close() |
| 108 | file1 = main.params[ "DEPENDENCY" ][ "FILE1" ] |
| 109 | main.dependencyPath = os.path.dirname( os.getcwd() ) + main.params[ "DEPENDENCY" ][ "PATH" ] |
| 110 | main.intentRerouteLatFuncs = imp.load_source( file1, main.dependencyPath + file1 + ".py" ) |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 111 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 112 | main.record = 0 |
| 113 | except Exception as e: |
| 114 | main.testSetUp.envSetupException( e ) |
| 115 | main.testSetUp.evnSetupConclusion( stepResult ) |
You Wang | 47b9183 | 2017-08-02 11:36:13 -0700 | [diff] [blame] | 116 | main.commit = main.commit.split( " " )[ 1 ] |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 117 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 118 | |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 119 | def CASE1( self, main ): |
| 120 | ''' |
| 121 | clean up test environment and set up |
| 122 | ''' |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 123 | import time |
| 124 | |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 125 | main.maxNumBatch = 0 |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 126 | main.testSetUp.ONOSSetUp( main.MN1Ip, main.Cluster, True, |
| 127 | cellName=main.cellName, killRemoveMax=False ) |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 128 | # configure apps |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 129 | main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "deviceCount", value=main.deviceCount ) |
| 130 | main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "topoShape", value="reroute" ) |
| 131 | main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "enabled", value="true" ) |
| 132 | main.Cluster.active( 0 ).CLI.setCfg( main.intentManagerCfg, "skipReleaseResourcesOnWithdrawal", |
| 133 | value="true" ) |
YPZhang | e6ef82a | 2016-07-05 16:48:15 -0700 | [diff] [blame] | 134 | if main.flowObj: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 135 | main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg, |
| 136 | "useFlowObjectives", value="true" ) |
| 137 | main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg, |
| 138 | "defaultFlowObjectiveCompiler", |
| 139 | value=main.linkCollectionIntentCfg ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 140 | time.sleep( main.startUpSleep ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 141 | for ctrl in main.Cluster.active(): |
| 142 | ctrl.CLI.logSet( "DEBUG", "org.onosproject.metrics.topology" ) |
| 143 | ctrl.CLI.logSet( "DEBUG", "org.onosproject.metrics.intent" ) |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 144 | # Balance Master |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 145 | main.Cluster.active( 0 ).CLI.balanceMasters() |
You Wang | 0b9039d | 2017-01-12 16:51:29 -0800 | [diff] [blame] | 146 | time.sleep( main.setMasterSleep ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 147 | if main.Cluster.numCtrls: |
| 148 | main.Cluster.active( 0 ).CLI.deviceRole( main.end1[ 'name' ], main.Cluster.active( 0 ).ipAddress ) |
| 149 | main.Cluster.active( 0 ).CLI.deviceRole( main.end2[ 'name' ], main.Cluster.active( 0 ).ipAddress ) |
YPZhang | 2b9b26d | 2016-06-20 16:18:29 -0700 | [diff] [blame] | 150 | time.sleep( main.setMasterSleep ) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 151 | |
| 152 | def CASE2( self, main ): |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 153 | import time |
| 154 | import numpy |
| 155 | import datetime |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 156 | import json |
| 157 | # from scipy import stats |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 158 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 159 | print( main.intentsList ) |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 160 | for batchSize in main.intentsList: |
You Wang | 0b9039d | 2017-01-12 16:51:29 -0800 | [diff] [blame] | 161 | main.batchSize = batchSize |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 162 | main.log.report( "Intent Batch size: " + str( batchSize ) + "\n " ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 163 | firstLocalLatencies = [] |
| 164 | lastLocalLatencies = [] |
| 165 | firstGlobalLatencies = [] |
| 166 | lastGlobalLatencies = [] |
| 167 | main.startLine = {} |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 168 | main.validRun = 0 |
| 169 | main.invalidRun = 0 |
You Wang | 0b9039d | 2017-01-12 16:51:29 -0800 | [diff] [blame] | 170 | while main.validRun <= main.warmUp + main.sampleSize and main.invalidRun <= main.maxInvalidRun: |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 171 | if main.validRun >= main.warmUp: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 172 | main.log.info( "================================================" ) |
| 173 | main.log.info( "Valid iteration: {} ".format( main.validRun - main.warmUp ) ) |
| 174 | main.log.info( "Total iteration: {}".format( main.validRun + main.invalidRun ) ) |
| 175 | main.log.info( "================================================" ) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 176 | else: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 177 | main.log.info( "====================Warm Up=====================" ) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 178 | |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 179 | # push intents |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 180 | main.Cluster.active( 0 ).CLI.pushTestIntents( main.ingress, |
| 181 | main.egress, |
| 182 | main.batchSize, |
| 183 | offset=1, |
| 184 | options="-i", |
| 185 | timeout=main.timeout ) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 186 | |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 187 | # check links, flows and intents |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 188 | main.intentRerouteLatFuncs.sanityCheck( main, |
| 189 | main.deviceCount * 2, |
| 190 | batchSize * ( main.deviceCount - 1 ), |
| 191 | main.batchSize ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 192 | if not main.verify: |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 193 | main.log.warn( "Sanity check failed, skipping this iteration..." ) |
| 194 | continue |
| 195 | |
| 196 | # Insert one line in karaf.log before link down |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 197 | main.Cluster.command( "log", |
| 198 | args=[ "\'Scale: {}, Batch:{}, Iteration: {}\'".format( |
| 199 | main.Cluster.numCtrls, batchSize, main.validRun + main.invalidRun ) ], |
| 200 | returnBool=True, specificDriver=2 ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 201 | # bring link down |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 202 | main.Cluster.active( 0 ).CLI.link( main.end1[ 'port' ], main.end2[ 'port' ], "down", |
| 203 | timeout=main.timeout, showResponse=False ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 204 | |
| 205 | # check links, flows and intents |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 206 | main.intentRerouteLatFuncs.sanityCheck( main, |
| 207 | ( main.deviceCount - 1 ) * 2, |
| 208 | batchSize * main.deviceCount, |
| 209 | main.batchSize ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 210 | if not main.verify: |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 211 | main.log.warn( "Sanity check failed, skipping this iteration..." ) |
| 212 | continue |
| 213 | |
| 214 | # Get timestamp of last LINK_REMOVED event as separator between iterations |
| 215 | skip = False |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 216 | for i in range( main.Cluster.numCtrls ): |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 217 | logNum = main.intentRerouteLatFuncs.getLogNum( main, i ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 218 | timestamp = str( main.Cluster.active( i ).CLI.getTimeStampFromLog( "last", |
| 219 | "LINK_REMOVED", |
| 220 | "time = ", " ", |
| 221 | logNum=logNum ) ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 222 | if timestamp == main.ERROR: |
| 223 | # Try again in case that the log number just increased |
| 224 | logNum = main.intentRerouteLatFuncs.getLogNum( main, i ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 225 | timestamp = str( main.Cluster.active( i ).CLI.getTimeStampFromLog( "last", |
| 226 | "LINK_REMOVED", |
| 227 | "time = ", " ", |
| 228 | logNum=logNum ) ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 229 | if timestamp == main.ERROR: |
| 230 | main.log.warn( "Cannot find the event we want in the log, skipping this iteration..." ) |
| 231 | main.intentRerouteLatFuncs.bringBackTopology( main ) |
| 232 | if main.validRun >= main.warmUp: |
| 233 | main.invalidRun += 1 |
| 234 | else: |
| 235 | main.validRun += 1 |
| 236 | skip = True |
| 237 | break |
| 238 | else: |
| 239 | main.startLine[ i ] = timestamp |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 240 | main.log.info( "Timestamp of last LINK_REMOVED event on node {} is {}".format( i + 1, |
| 241 | main.startLine[ i ] ) ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 242 | if skip: continue |
| 243 | |
| 244 | # calculate values |
| 245 | topologyTimestamps = main.intentRerouteLatFuncs.getTopologyTimestamps( main ) |
| 246 | intentTimestamps = main.intentRerouteLatFuncs.getIntentTimestamps( main ) |
| 247 | if intentTimestamps == main.ERROR or topologyTimestamps == main.ERROR: |
| 248 | main.log.info( "Got invalid timestamp, skipping this iteration..." ) |
| 249 | main.intentRerouteLatFuncs.bringBackTopology( main ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 250 | if main.validRun >= main.warmUp: |
| 251 | main.invalidRun += 1 |
YPZhang | 8742d2e | 2016-06-16 15:31:58 -0700 | [diff] [blame] | 252 | else: |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 253 | main.validRun += 1 |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 254 | continue |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 255 | else: |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 256 | main.log.info( "Got valid timestamps" ) |
| 257 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 258 | firstLocalLatnecy, lastLocalLatnecy, firstGlobalLatency, lastGlobalLatnecy \ |
| 259 | = main.intentRerouteLatFuncs.calculateLatency( main, topologyTimestamps, intentTimestamps ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 260 | if firstLocalLatnecy < 0: |
| 261 | main.log.info( "Got negative latency, skipping this iteration..." ) |
| 262 | main.intentRerouteLatFuncs.bringBackTopology( main ) |
| 263 | if main.validRun >= main.warmUp: |
| 264 | main.invalidRun += 1 |
| 265 | else: |
| 266 | main.validRun += 1 |
| 267 | continue |
| 268 | else: |
| 269 | main.log.info( "Got valid latencies" ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 270 | main.validRun += 1 |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 271 | |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 272 | firstLocalLatencies.append( firstLocalLatnecy ) |
| 273 | lastLocalLatencies.append( lastLocalLatnecy ) |
| 274 | firstGlobalLatencies.append( firstGlobalLatency ) |
| 275 | lastGlobalLatencies.append( lastGlobalLatnecy ) |
| 276 | |
| 277 | # bring up link and withdraw intents |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 278 | main.Cluster.active( 0 ).CLI.link( main.end1[ 'port' ], |
| 279 | main.end2[ 'port' ], |
| 280 | "up", |
| 281 | timeout=main.timeout ) |
| 282 | main.Cluster.active( 0 ).CLI.pushTestIntents( main.ingress, |
| 283 | main.egress, |
| 284 | batchSize, |
| 285 | offset=1, |
| 286 | options="-w", |
| 287 | timeout=main.timeout ) |
| 288 | main.Cluster.active( 0 ).CLI.purgeWithdrawnIntents() |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 289 | |
| 290 | # check links, flows and intents |
| 291 | main.intentRerouteLatFuncs.sanityCheck( main, main.deviceCount * 2, 0, 0 ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 292 | if not main.verify: |
YPZhang | febf730 | 2016-05-24 16:45:56 -0700 | [diff] [blame] | 293 | continue |
| 294 | |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 295 | aveLocalLatency = numpy.average( lastLocalLatencies ) |
| 296 | aveGlobalLatency = numpy.average( lastGlobalLatencies ) |
| 297 | stdLocalLatency = numpy.std( lastLocalLatencies ) |
| 298 | stdGlobalLatency = numpy.std( lastGlobalLatencies ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 299 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 300 | main.log.report( "Scale: " + str( main.Cluster.numCtrls ) + " \tIntent batch: " + str( batchSize ) ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 301 | main.log.report( "Local latency average:................" + str( aveLocalLatency ) ) |
| 302 | main.log.report( "Global latency average:................" + str( aveGlobalLatency ) ) |
| 303 | main.log.report( "Local latency std:................" + str( stdLocalLatency ) ) |
| 304 | main.log.report( "Global latency std:................" + str( stdGlobalLatency ) ) |
Chiyu Cheng | ec63bde | 2016-11-17 18:11:36 -0800 | [diff] [blame] | 305 | main.log.report( "________________________________________________________" ) |
cameron@onlab.us | 78b8965 | 2015-07-08 15:21:03 -0700 | [diff] [blame] | 306 | |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 307 | if not ( numpy.isnan( aveLocalLatency ) or numpy.isnan( aveGlobalLatency ) ): |
YPZhang | 8742d2e | 2016-06-16 15:31:58 -0700 | [diff] [blame] | 308 | # check if got NaN for result |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 309 | resultsDB = open( main.dbFileName, "a" ) |
| 310 | resultsDB.write( "'" + main.commit + "'," ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 311 | resultsDB.write( str( main.Cluster.numCtrls ) + "," ) |
You Wang | 6d301d4 | 2017-04-21 10:49:33 -0700 | [diff] [blame] | 312 | resultsDB.write( str( batchSize ) + "," ) |
| 313 | resultsDB.write( str( aveLocalLatency ) + "," ) |
| 314 | resultsDB.write( str( stdLocalLatency ) + "\n" ) |
YPZhang | 8742d2e | 2016-06-16 15:31:58 -0700 | [diff] [blame] | 315 | resultsDB.close() |