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 | """ |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 21 | """ |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 22 | SCPFswitchLat |
| 23 | Test Switch add/remove latency |
| 24 | calculate package latency between switch and ONOS |
| 25 | Switch UP: |
| 26 | TCP -- Feature Reply -- Role Request -- Role Reply -- Device -- Graph |
| 27 | Siwtch Down: |
| 28 | Openflow FIN/ACK -- ACK -- Device -- Graph |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 29 | """ |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 30 | class SCPFswitchLat: |
| 31 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 32 | def __init__( self ): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 33 | self.default = '' |
| 34 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 35 | def CASE0( self, main ): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 36 | import os |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 37 | import imp |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 38 | """ |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 39 | - GIT |
| 40 | - BUILDING ONOS |
| 41 | Pull specific ONOS branch, then Build ONOS ono ONOS Bench. |
| 42 | This step is usually skipped. Because in a Jenkins driven automated |
| 43 | test env. We want Jenkins jobs to pull&build for flexibility to handle |
| 44 | different versions of ONOS. |
| 45 | - Construct tests variables |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 46 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 47 | try: |
| 48 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 49 | main.testSetUp = ONOSSetup() |
| 50 | except ImportError: |
| 51 | main.log.error( "ONOSSetup not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 52 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 53 | main.testSetUp.envSetupDescription() |
| 54 | stepResult = main.FALSE |
| 55 | try: |
| 56 | # The dictionary to record different type of wrongs |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 57 | main.wrong = { 'totalWrong': 0, 'skipDown': 0, 'TsharkValueIncorrect': 0, |
| 58 | 'TypeError': 0, 'decodeJasonError': 0, |
| 59 | 'checkResultIncorrect': 0 } |
| 60 | main.maxWrong = int( main.params[ 'TEST' ][ 'MaxWrong' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 61 | main.resultRange = main.params[ 'TEST' ][ 'ResultRange' ] |
| 62 | main.searchTerm = main.params[ 'TEST' ][ 'SearchTerm' ] |
| 63 | main.MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 64 | main.dependencyPath = main.testOnDirectory + \ |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 65 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 66 | main.topoName = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 67 | main.dependencyFunc = main.params[ 'DEPENDENCY' ][ 'function' ] |
| 68 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 69 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 70 | main.scale = ( main.params[ 'SCALE' ] ).split( "," ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 71 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 72 | main.ofPackage = main.params[ 'TSHARK' ] |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame^] | 73 | main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ] |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 74 | main.defaultTopoCfg = main.params[ 'CFG' ][ 'defaultTopo' ] |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 75 | main.tsharkResultPath = main.params[ 'TEST' ][ 'tsharkResultPath' ] |
| 76 | main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] ) |
| 77 | main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] ) |
| 78 | main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ] |
| 79 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 80 | main.measurementSleep = int( main.params[ 'SLEEP' ][ 'measure' ] ) |
| 81 | main.deleteSwSleep = int( main.params[ 'SLEEP' ][ 'deleteSW' ] ) |
| 82 | main.maxScale = int( main.params[ 'max' ] ) |
| 83 | main.timeout = int( main.params[ 'TIMEOUT' ][ 'timeout' ] ) |
| 84 | main.MNSleep = int( main.params[ 'SLEEP' ][ 'mininet' ] ) |
| 85 | main.device = main.params[ 'TEST' ][ 'device' ] |
| 86 | stepResult = main.testSetUp.envSetup() |
| 87 | main.log.info( "Create Database file " + main.dbFileName ) |
| 88 | resultsDB = open( main.dbFileName, "w+" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 89 | resultsDB.close() |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 90 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 91 | main.switchFunc = imp.load_source( main.dependencyFunc, |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 92 | main.dependencyPath + |
| 93 | main.dependencyFunc + |
| 94 | ".py" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 95 | except Exception as e: |
| 96 | main.testSetUp.envSetupException( e ) |
Jon Hall | aa1d9b8 | 2020-07-30 13:49:42 -0700 | [diff] [blame] | 97 | main.testSetUp.envSetupConclusion( stepResult ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 98 | main.commit = main.commit.split( " " )[ 1 ] |
You Wang | 0e4ca9e | 2017-08-04 16:40:33 -0700 | [diff] [blame] | 99 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 100 | def CASE1( self, main ): |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 101 | # Clean up test environment and set up |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 102 | import time |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 103 | try: |
| 104 | from tests.dependencies.utils import Utils |
| 105 | except ImportError: |
| 106 | main.log.error( "Utils not found exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 107 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 108 | try: |
| 109 | main.Utils |
| 110 | except ( NameError, AttributeError ): |
| 111 | main.Utils = Utils() |
| 112 | main.maxNumBatch = 0 |
You Wang | a0f6ff6 | 2018-01-11 15:46:30 -0800 | [diff] [blame] | 113 | main.testSetUp.ONOSSetUp( main.Cluster, True, |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 114 | cellName=main.cellName, killRemoveMax=False ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 115 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 116 | main.log.info( "Configure apps" ) |
| 117 | main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg, |
| 118 | "maxEvents 1" ) |
| 119 | main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg, |
| 120 | "maxBatchMs 0" ) |
| 121 | main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg, |
| 122 | "maxIdleMs 0" ) |
| 123 | main.Cluster.command( "logSet", |
| 124 | args=[ "DEBUG", "org.onosproject.metrics.topology" ], |
| 125 | specificDriver=2 ) |
| 126 | time.sleep( 1 ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 127 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 128 | main.log.info( "Copy topology file to Mininet" ) |
| 129 | main.ONOSbench.copyMininetFile( main.topoName, |
| 130 | main.dependencyPath, |
| 131 | main.Mininet1.user_name, |
| 132 | main.Mininet1.ip_address ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 133 | main.Utils.mininetCleanup( main.Mininet1 ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 134 | time.sleep( main.MNSleep ) |
| 135 | main.log.info( "Start new mininet topology" ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 136 | main.Mininet1.startNet() |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 137 | main.log.info( "Assign switch to controller to ONOS node 1" ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 138 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 139 | time.sleep( 2 ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 140 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 141 | def CASE2( self, main ): |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 142 | import time |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 143 | import json |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 144 | import numpy |
| 145 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 146 | resultDict = { 'up': {}, 'down': {} } |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 147 | for i in range( 1, main.Cluster.numCtrls + 1 ): |
| 148 | resultDict[ 'up' ][ 'node' + str( i ) ] = {} |
| 149 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ] = {} |
| 150 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ] = {} |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 151 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] = [] # TCP to Feature |
Devin Lim | f70bb3a | 2018-04-13 19:15:51 -0700 | [diff] [blame] | 152 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_D' ] = [] # Feature to Device |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 153 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] = [] # Device to Graph |
| 154 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] = [] # TCP to Graph |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 155 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 156 | for i in range( 1, main.Cluster.numCtrls + 1 ): |
| 157 | resultDict[ 'down' ][ 'node' + str( i ) ] = {} |
| 158 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ] = {} |
| 159 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ] = {} |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 160 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] = [] # Fin_ack to ACK |
| 161 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] = [] # Ack to Device |
| 162 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] = [] # Device to Graph |
| 163 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] = [] # fin_ack to Graph |
You Wang | 51f903b | 2017-08-04 16:22:48 -0700 | [diff] [blame] | 164 | for i in range( 0, main.sampleSize + main.warmUp ): |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 165 | main.log.info( "************************************************************" ) |
You Wang | 51f903b | 2017-08-04 16:22:48 -0700 | [diff] [blame] | 166 | main.log.info( "************************ Iteration: {} **********************" .format( str( i + 1 ) ) ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 167 | if i < main.warmUp: |
| 168 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame^] | 169 | "up", resultDict, True, main.tsharkInterface ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 170 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame^] | 171 | "down", resultDict, True, main.tsharkInterface ) |
You Wang | a3649ee | 2018-04-19 16:57:18 -0700 | [diff] [blame] | 172 | main.log.debug( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 173 | main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" ) |
You Wang | a3649ee | 2018-04-19 16:57:18 -0700 | [diff] [blame] | 174 | main.log.debug( "After devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) ) |
Devin Lim | aa256a7 | 2017-10-13 13:40:30 -0700 | [diff] [blame] | 175 | while main.Cluster.active( 0 ).CLI.devices() != "[]": |
| 176 | main.log.error( "DEVICE NOT REMOVED !!!!!") |
| 177 | main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 178 | else: |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 179 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame^] | 180 | "up", resultDict, False, main.tsharkInterface ) |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 181 | main.switchFunc.captureOfPack( main, main.device, main.ofPackage, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame^] | 182 | "down", resultDict, False, main.tsharkInterface ) |
You Wang | a3649ee | 2018-04-19 16:57:18 -0700 | [diff] [blame] | 183 | main.log.debug( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 184 | main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" ) |
You Wang | a3649ee | 2018-04-19 16:57:18 -0700 | [diff] [blame] | 185 | main.log.debug("After devices : " + str(main.Cluster.active(0).CLI.devices())) |
Devin Lim | aa256a7 | 2017-10-13 13:40:30 -0700 | [diff] [blame] | 186 | while main.Cluster.active( 0 ).CLI.devices() != "[]": |
| 187 | main.log.error( "DEVICE NOT REMOVED !!!!!") |
| 188 | main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" ) |
chengchiyu | 08303a0 | 2016-09-08 17:40:26 -0700 | [diff] [blame] | 189 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 190 | # Dictionary for result |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 191 | maxDict = {} |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 192 | maxDict[ 'down' ] = {} |
| 193 | maxDict[ 'up' ] = {} |
| 194 | maxDict[ 'down' ][ 'max' ] = 0 |
| 195 | maxDict[ 'up' ][ 'max' ] = 0 |
| 196 | maxDict[ 'down' ][ 'node' ] = 0 |
| 197 | maxDict[ 'up' ][ 'node' ] = 0 |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 198 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 199 | for i in range( 1, main.Cluster.numCtrls + 1 ): |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 200 | # calculate average and std for result, and grep the max End to End data |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 201 | EtoEtemp = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] ) |
| 202 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] = EtoEtemp |
| 203 | if maxDict[ 'up' ][ 'max' ] < EtoEtemp: |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 204 | # get max End to End latency |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 205 | maxDict[ 'up' ][ 'max' ] = EtoEtemp |
| 206 | maxDict[ 'up' ][ 'node' ] = i |
| 207 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'T_F' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] ) |
Devin Lim | f70bb3a | 2018-04-13 19:15:51 -0700 | [diff] [blame] | 208 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'F_D' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_D' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 209 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 210 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 211 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] ) |
| 212 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'T_F' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] ) |
Devin Lim | f70bb3a | 2018-04-13 19:15:51 -0700 | [diff] [blame] | 213 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'F_D' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_D' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 214 | resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 215 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 216 | # calculate average and std for result, and grep the max End to End data |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 217 | EtoEtemp = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] ) |
| 218 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] = EtoEtemp |
| 219 | if maxDict[ 'down' ][ 'max' ] < EtoEtemp: |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 220 | # get max End to End latency |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 221 | maxDict[ 'down' ][ 'max' ] = EtoEtemp |
| 222 | maxDict[ 'down' ][ 'node' ] = i |
| 223 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'FA_A' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] ) |
| 224 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'A_D' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] ) |
| 225 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 226 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 227 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] ) |
| 228 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'FA_A' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] ) |
| 229 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'A_D' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] ) |
| 230 | resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 231 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 232 | main.log.report( "=====node{} Summary:=====".format( str( i ) ) ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 233 | main.log.report( "=============Switch up=======" ) |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 234 | main.log.report( "End to End average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] ) ) ) |
| 235 | main.log.report( "End to End Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] ) ) ) |
| 236 | main.log.report( "TCP to Feature average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'T_F' ] ) ) ) |
| 237 | main.log.report( "TCP to Feature Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'T_F' ] ) ) ) |
| 238 | main.log.report( "Feature to Device average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'F_D' ] ) ) ) |
| 239 | main.log.report( "Feature to Device Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'F_D' ] ) ) ) |
| 240 | main.log.report( "Device to Graph average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] ) ) ) |
| 241 | main.log.report( "Device to Graph Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] ) ) ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 242 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 243 | main.log.report( "=============Switch down=======" ) |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 244 | main.log.report( "End to End average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] ) ) ) |
| 245 | main.log.report( "End to End Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] ) ) ) |
| 246 | main.log.report( "Fin_ACK to ACK average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'FA_A' ] ) ) ) |
| 247 | main.log.report( "Fin_ACK to ACK Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'FA_A' ] ) ) ) |
| 248 | main.log.report( "ACK to Device average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'A_D' ] ) ) ) |
| 249 | main.log.report( "ACK to Device Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'A_D' ] ) ) ) |
| 250 | main.log.report( "Device to Graph average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] ) ) ) |
| 251 | main.log.report( "Device to Graph Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] ) ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 252 | |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 253 | # Check if any result is abnormal |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 254 | # Switch-up |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 255 | result = resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 256 | threshold = float( main.params[ 'ALARM' ][ 'maxSwitchUpAvg' ].split( ',' )[ main.cycle - 1 ] ) |
| 257 | if result > threshold: |
| 258 | main.log.alarm( "{}-node switch-up avg: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 259 | result = resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 260 | threshold = float( main.params[ 'ALARM' ][ 'maxSwitchUpStd' ].split( ',' )[ main.cycle - 1 ] ) |
| 261 | if result > threshold: |
| 262 | main.log.alarm( "{}-node switch-up std: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
| 263 | # Switch-down |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 264 | result = resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 265 | threshold = float( main.params[ 'ALARM' ][ 'maxSwitchDownAvg' ].split( ',' )[ main.cycle - 1 ] ) |
| 266 | if result > threshold: |
| 267 | main.log.alarm( "{}-node switch-down avg: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
You Wang | 28cb855 | 2019-02-19 16:11:52 -0800 | [diff] [blame] | 268 | result = resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 269 | threshold = float( main.params[ 'ALARM' ][ 'maxSwitchDownStd' ].split( ',' )[ main.cycle - 1 ] ) |
| 270 | if result > threshold: |
| 271 | main.log.alarm( "{}-node switch-down std: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 272 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 273 | with open( main.dbFileName, "a" ) as dbFile: |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 274 | # Scale number |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 275 | temp = str( main.Cluster.numCtrls ) |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 276 | temp += ",'baremetal1'" |
| 277 | # put result |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 278 | temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] ) |
| 279 | temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'T_F' ] ) |
Devin Lim | f70bb3a | 2018-04-13 19:15:51 -0700 | [diff] [blame] | 280 | temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'F_D' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 281 | temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'D_G' ] ) |
cameron@onlab.us | 21106ea | 2015-07-23 15:32:51 -0700 | [diff] [blame] | 282 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 283 | temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] ) |
| 284 | temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'FA_A' ] ) |
| 285 | temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'A_D' ] ) |
| 286 | temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'D_G' ] ) |
chengchiyu | c6f4cc0 | 2016-08-24 14:04:20 -0700 | [diff] [blame] | 287 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 288 | temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] ) |
| 289 | temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] ) |
chengchiyu | c6f4cc0 | 2016-08-24 14:04:20 -0700 | [diff] [blame] | 290 | |
YPZhang | 38fb119 | 2016-08-11 11:03:38 -0700 | [diff] [blame] | 291 | temp += "\n" |
| 292 | dbFile.write( temp ) |
| 293 | dbFile.close() |