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