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 | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 22 | SCPFportLat test |
| 23 | Test latency for port status change |
| 24 | Up & Down: |
| 25 | PortStatus --- Device --- Link --- Graph |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 26 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 27 | yunpeng@onlab.us |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 28 | """ |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 29 | class SCPFportLat: |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 30 | |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 31 | def __init__( self ): |
| 32 | self.default = '' |
| 33 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 34 | def CASE0( self, main ): |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 35 | import os |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 36 | import imp |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 37 | """ |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 38 | - GIT |
| 39 | - BUILDING ONOS |
| 40 | Pull specific ONOS branch, then Build ONOS ono ONOS Bench. |
| 41 | This step is usually skipped. Because in a Jenkins driven automated |
| 42 | test env. We want Jenkins jobs to pull&build for flexibility to handle |
| 43 | different versions of ONOS. |
| 44 | - Construct tests variables |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 45 | """ |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 46 | try: |
| 47 | from tests.dependencies.ONOSSetup import ONOSSetup |
| 48 | main.testSetUp = ONOSSetup() |
| 49 | except ImportError: |
| 50 | main.log.error( "ONOSSetup not found. exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 51 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 52 | main.testSetUp.envSetupDescription() |
| 53 | stepResult = main.FALSE |
| 54 | try: |
| 55 | main.MN1Ip = main.params[ 'MN' ][ 'ip1' ] |
| 56 | main.dependencyPath = main.testOnDirectory + \ |
| 57 | main.params[ 'DEPENDENCY' ][ 'path' ] |
| 58 | main.dependencyFunc = main.params[ 'DEPENDENCY' ][ 'function' ] |
| 59 | main.topoName = main.params[ 'DEPENDENCY' ][ 'topology' ] |
| 60 | main.cellName = main.params[ 'ENV' ][ 'cellName' ] |
| 61 | main.apps = main.params[ 'ENV' ][ 'cellApps' ] |
| 62 | main.scale = ( main.params[ 'SCALE' ] ).split( "," ) |
| 63 | main.ofportStatus = main.params[ 'TSHARK' ][ 'ofpPortStatus' ] |
| 64 | main.tsharkResultPath = main.params[ 'TSHARK' ][ 'tsharkReusltPath' ] |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame] | 65 | main.tsharkInterface = main.params[ 'TSHARK' ][ 'tsharkInterface' ] |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 66 | main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] ) |
| 67 | main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] ) |
| 68 | main.maxProcessTime = int( main.params[ 'TEST' ][ 'maxProcessTime' ] ) |
| 69 | main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ] |
| 70 | main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] ) |
| 71 | main.measurementSleep = int( main.params[ 'SLEEP' ][ 'measure' ] ) |
| 72 | main.maxScale = int( main.params[ 'max' ] ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 73 | main.defaultTopoCfg = main.params[ 'CFG' ][ 'defaultTopo' ] |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 74 | main.interface = main.params[ 'TEST' ][ 'interface' ] |
| 75 | main.timeout = int( main.params[ 'TIMEOUT' ][ 'timeout' ] ) |
| 76 | main.MNSleep = int( main.params[ 'SLEEP' ][ 'mininet' ] ) |
| 77 | main.device = main.params[ 'TEST' ][ 'device' ] |
| 78 | main.debug = main.params[ 'TEST' ][ 'debug' ] |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 79 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 80 | if main.debug == "True": |
| 81 | main.debug = True |
| 82 | else: |
| 83 | main.debug = False |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 84 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 85 | stepResult = main.testSetUp.envSetup() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 86 | main.log.info( "Create Database file " + main.dbFileName ) |
| 87 | resultsDB = open( main.dbFileName, "w+" ) |
| 88 | resultsDB.close() |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 89 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 90 | main.portFunc = imp.load_source( main.dependencyFunc, |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 91 | main.dependencyPath + |
| 92 | main.dependencyFunc + |
| 93 | ".py" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 94 | except Exception as e: |
| 95 | main.testSetUp.envSetupException( e ) |
Jon Hall | aa1d9b8 | 2020-07-30 13:49:42 -0700 | [diff] [blame] | 96 | main.testSetUp.envSetupConclusion( stepResult ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 97 | main.commit = main.commit.split( " " )[ 1 ] |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 98 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 99 | def CASE1( self, main ): |
| 100 | # Clean up test environment and set up |
| 101 | import time |
You Wang | a0f6ff6 | 2018-01-11 15:46:30 -0800 | [diff] [blame] | 102 | main.testSetUp.ONOSSetUp( main.Cluster, True, |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 103 | cellName=main.cellName, killRemoveMax=False ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 104 | |
| 105 | main.log.info( "Configure apps" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 106 | main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg, |
| 107 | "maxEvents 1" ) |
| 108 | main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg, |
| 109 | "maxBatchMs 0" ) |
| 110 | main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg, |
| 111 | "maxIdleMs 0" ) |
| 112 | time.sleep( 1 ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 113 | main.log.info( "Copy topology file to Mininet" ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 114 | main.ONOSbench.copyMininetFile( main.topoName, |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 115 | main.dependencyPath, |
| 116 | main.Mininet1.user_name, |
| 117 | main.Mininet1.ip_address ) |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 118 | try: |
| 119 | from tests.dependencies.utils import Utils |
| 120 | except ImportError: |
| 121 | main.log.error( "Utils not found exiting the test" ) |
Devin Lim | 4407596 | 2017-08-11 10:56:37 -0700 | [diff] [blame] | 122 | main.cleanAndExit() |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 123 | try: |
| 124 | main.Utils |
| 125 | except ( NameError, AttributeError ): |
| 126 | main.Utils = Utils() |
| 127 | main.Utils.mininetCleanup( main.Mininet1 ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 128 | time.sleep( main.MNSleep ) |
| 129 | main.log.info( "Start new mininet topology" ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 130 | main.Mininet1.startNet() |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 131 | main.log.info( "Assign switch to controller to ONOS node 1" ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 132 | time.sleep( 1 ) |
| 133 | main.Mininet1.assignSwController( sw='s1', |
| 134 | ip=main.Cluster.active( 0 ).ipAddress ) |
| 135 | main.Mininet1.assignSwController( sw='s2', |
| 136 | ip=main.Cluster.active( 0 ).ipAddress ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 137 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 138 | time.sleep( 2 ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 139 | |
| 140 | def CASE2( self, main ): |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 141 | import time |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 142 | import numpy |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 143 | # dictionary for each node and each timestamps |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 144 | resultDict = { 'up': {}, 'down': {} } |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 145 | for d in resultDict: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 146 | for i in range( 1, main.Cluster.numCtrls + 1 ): |
| 147 | resultDict[ d ][ 'node' + str( i ) ] = {} |
| 148 | resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ] = {} |
| 149 | resultDict[ d ][ 'node' + str( i ) ][ 'Std' ] = {} |
| 150 | resultDict[ d ][ 'node' + str( i ) ][ 'EtoE' ] = [] |
| 151 | resultDict[ d ][ 'node' + str( i ) ][ 'PtoD' ] = [] |
| 152 | resultDict[ d ][ 'node' + str( i ) ][ 'DtoL' ] = [] |
| 153 | resultDict[ d ][ 'node' + str( i ) ][ 'LtoG' ] = [] |
You Wang | 51f903b | 2017-08-04 16:22:48 -0700 | [diff] [blame] | 154 | for i in range( 0, main.sampleSize + main.warmUp ): |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 155 | main.log.info( "==========================================" ) |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 156 | main.log.info( "================iteration:{}==============".format( str( i + 1 ) ) ) |
You Wang | 51f903b | 2017-08-04 16:22:48 -0700 | [diff] [blame] | 157 | if i >= main.warmUp: |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 158 | # Portdown iteration |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 159 | main.portFunc.capturePortStatusPack( main, |
| 160 | main.device, |
| 161 | main.interface, |
| 162 | "down", |
| 163 | resultDict, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame] | 164 | False, |
| 165 | main.tsharkInterface ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 166 | time.sleep( 2 ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 167 | # PortUp iteration |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 168 | main.portFunc.capturePortStatusPack( main, |
| 169 | main.device, |
| 170 | main.interface, |
| 171 | "up", |
| 172 | resultDict, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame] | 173 | False, |
| 174 | main.tsharkInterface ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 175 | else: |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 176 | # if warm up, keep old result dictionary |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 177 | main.portFunc.capturePortStatusPack( main, |
| 178 | main.device, |
| 179 | main.interface, |
| 180 | "down", |
| 181 | resultDict, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame] | 182 | True, |
| 183 | main.tsharkInterface ) |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 184 | main.portFunc.capturePortStatusPack( main, |
| 185 | main.device, |
| 186 | main.interface, |
| 187 | "up", |
| 188 | resultDict, |
You Wang | b204392 | 2020-10-28 18:45:24 -0700 | [diff] [blame] | 189 | True, |
| 190 | main.tsharkInterface ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 191 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 192 | # Dictionary for result |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 193 | maxDict = {} |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 194 | maxDict[ 'down' ] = {} |
| 195 | maxDict[ 'up' ] = {} |
| 196 | maxDict[ 'down' ][ 'max' ] = 0 |
| 197 | maxDict[ 'up' ][ 'max' ] = 0 |
| 198 | maxDict[ 'down' ][ 'node' ] = 0 |
| 199 | maxDict[ 'up' ][ 'node' ] = 0 |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 200 | EtoEtemp = 0 |
| 201 | for d in resultDict: |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 202 | for i in range( 1, main.Cluster.numCtrls + 1 ): |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 203 | # 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] | 204 | EtoEtemp = numpy.average( resultDict[ d ][ 'node' + str( i ) ][ 'EtoE' ] ) |
| 205 | resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'EtoE' ] = EtoEtemp |
| 206 | if maxDict[ d ][ 'max' ] < EtoEtemp: |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 207 | # get max End to End latency |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 208 | maxDict[ d ][ 'max' ] = EtoEtemp |
| 209 | maxDict[ d ][ 'node' ] = i |
| 210 | resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'PtoD' ] = numpy.average( resultDict[ d ][ 'node' + str( i ) ][ 'PtoD' ] ) |
| 211 | resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'DtoL' ] = numpy.average( resultDict[ d ][ 'node' + str( i ) ][ 'DtoL' ] ) |
| 212 | resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'LtoG' ] = numpy.average( resultDict[ d ][ 'node' + str( i ) ][ 'LtoG' ] ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 213 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 214 | resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'EtoE' ] = numpy.std( resultDict[ d ][ 'node' + str( i ) ][ 'EtoE' ] ) |
| 215 | resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'PtoD' ] = numpy.std( resultDict[ d ][ 'node' + str( i ) ][ 'PtoD' ] ) |
| 216 | resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'DtoL' ] = numpy.std( resultDict[ d ][ 'node' + str( i ) ][ 'DtoL' ] ) |
| 217 | resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'LtoG' ] = numpy.std( resultDict[ d ][ 'node' + str( i ) ][ 'LtoG' ] ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 218 | |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 219 | main.log.report( "=====node{} Summary:=====".format( str( i ) ) ) |
| 220 | main.log.report( "=============Port {}=======".format( str( d ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 221 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 222 | "End to End average: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'EtoE' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 223 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 224 | "End to End Std: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'EtoE' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 225 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 226 | "Package to Device average: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'PtoD' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 227 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 228 | "Package to Device Std: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'PtoD' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 229 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 230 | "Device to Link average: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'DtoL' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 231 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 232 | "Device to Link Std: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'DtoL' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 233 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 234 | "Link to Grapg average: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Ave' ][ 'LtoG' ] ) ) ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 235 | main.log.report( |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 236 | "Link to Grapg Std: {}".format( str( resultDict[ d ][ 'node' + str( i ) ][ 'Std' ][ 'LtoG' ] ) ) ) |
GlennRC | dc7ab01 | 2015-07-23 15:40:12 -0700 | [diff] [blame] | 237 | |
You Wang | a8e7502 | 2019-02-21 15:38:26 -0800 | [diff] [blame] | 238 | # Check if any result is abnormal |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 239 | # Port-up |
You Wang | a8e7502 | 2019-02-21 15:38:26 -0800 | [diff] [blame] | 240 | result = resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'EtoE' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 241 | threshold = float( main.params[ 'ALARM' ][ 'maxPortUpAvg' ].split( ',' )[ main.cycle - 1 ] ) |
| 242 | if result > threshold: |
| 243 | main.log.alarm( "{}-node port-up avg: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
You Wang | a8e7502 | 2019-02-21 15:38:26 -0800 | [diff] [blame] | 244 | result = resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Std' ][ 'EtoE' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 245 | threshold = float( main.params[ 'ALARM' ][ 'maxPortUpStd' ].split( ',' )[ main.cycle - 1 ] ) |
| 246 | if result > threshold: |
| 247 | main.log.alarm( "{}-node port-up std: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
| 248 | # Port-down |
You Wang | a8e7502 | 2019-02-21 15:38:26 -0800 | [diff] [blame] | 249 | result = resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'EtoE' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 250 | threshold = float( main.params[ 'ALARM' ][ 'maxPortDownAvg' ].split( ',' )[ main.cycle - 1 ] ) |
| 251 | if result > threshold: |
| 252 | main.log.alarm( "{}-node port-down avg: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
You Wang | a8e7502 | 2019-02-21 15:38:26 -0800 | [diff] [blame] | 253 | result = resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Std' ][ 'EtoE' ] |
You Wang | aa7bc72 | 2019-02-21 17:55:39 -0800 | [diff] [blame] | 254 | threshold = float( main.params[ 'ALARM' ][ 'maxPortDownStd' ].split( ',' )[ main.cycle - 1 ] ) |
| 255 | if result > threshold: |
| 256 | main.log.alarm( "{}-node port-down std: {} ms > {} ms".format( main.Cluster.numCtrls, result, threshold ) ) |
You Wang | a8e7502 | 2019-02-21 15:38:26 -0800 | [diff] [blame] | 257 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 258 | with open( main.dbFileName, "a" ) as dbFile: |
| 259 | # Scale number |
Devin Lim | 142b534 | 2017-07-20 15:22:39 -0700 | [diff] [blame] | 260 | temp = str( main.Cluster.numCtrls ) |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 261 | temp += ",'baremetal1'" |
| 262 | # put result |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 263 | temp += "," + str( resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'EtoE' ] ) |
| 264 | temp += "," + str( resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'PtoD' ] ) |
| 265 | temp += "," + str( resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'DtoL' ] ) |
| 266 | temp += "," + str( resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'LtoG' ] ) |
| 267 | temp += "," + str( resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'EtoE' ] ) |
| 268 | temp += "," + str( resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'PtoD' ] ) |
| 269 | temp += "," + str( resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'DtoL' ] ) |
| 270 | temp += "," + str( resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'LtoG' ] ) |
chengchiyu | 074e3ef | 2016-08-24 16:32:32 -0700 | [diff] [blame] | 271 | |
Devin Lim | 58046fa | 2017-07-05 16:55:00 -0700 | [diff] [blame] | 272 | temp += "," + str( resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Std' ][ 'EtoE' ] ) |
| 273 | temp += "," + str( resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Std' ][ 'EtoE' ] ) |
chengchiyu | 074e3ef | 2016-08-24 16:32:32 -0700 | [diff] [blame] | 274 | |
YPZhang | 801d46d | 2016-08-08 13:26:28 -0700 | [diff] [blame] | 275 | temp += "\n" |
| 276 | dbFile.write( temp ) |
| 277 | dbFile.close() |