blob: 74afcf812488619b3c8150a55b804e84729eef26 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07002Copyright 2015 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003
4Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
5the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
6or 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 Ronquillo23fb2162017-09-15 14:59:57 -070011 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070012
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 Ronquillo23fb2162017-09-15 14:59:57 -070021"""
YPZhang38fb1192016-08-11 11:03:38 -070022 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 Ronquillo23fb2162017-09-15 14:59:57 -070029"""
cameron@onlab.us21106ea2015-07-23 15:32:51 -070030class SCPFswitchLat:
31
Devin Lim142b5342017-07-20 15:22:39 -070032 def __init__( self ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -070033 self.default = ''
34
YPZhang38fb1192016-08-11 11:03:38 -070035 def CASE0( self, main ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -070036 import os
YPZhang38fb1192016-08-11 11:03:38 -070037 import imp
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070038 """
YPZhang38fb1192016-08-11 11:03:38 -070039 - 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 Ronquillo23fb2162017-09-15 14:59:57 -070046 """
Devin Lim58046fa2017-07-05 16:55:00 -070047 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 Lim44075962017-08-11 10:56:37 -070052 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070053 main.testSetUp.envSetupDescription()
54 stepResult = main.FALSE
55 try:
56 # The dictionary to record different type of wrongs
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070057 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 Lim142b5342017-07-20 15:22:39 -070061 main.resultRange = main.params[ 'TEST' ][ 'ResultRange' ]
62 main.searchTerm = main.params[ 'TEST' ][ 'SearchTerm' ]
63 main.MN1Ip = main.params[ 'MN' ][ 'ip1' ]
Devin Lim58046fa2017-07-05 16:55:00 -070064 main.dependencyPath = main.testOnDirectory + \
Devin Lim142b5342017-07-20 15:22:39 -070065 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( "," )
YPZhang38fb1192016-08-11 11:03:38 -070071
Devin Lim142b5342017-07-20 15:22:39 -070072 main.ofPackage = main.params[ 'TSHARK' ]
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070073 main.defaultTopoCfg = main.params[ 'CFG' ][ 'defaultTopo' ]
Devin Lim142b5342017-07-20 15:22:39 -070074 main.tsharkResultPath = main.params[ 'TEST' ][ 'tsharkResultPath' ]
75 main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
76 main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] )
77 main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ]
78 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
79 main.measurementSleep = int( main.params[ 'SLEEP' ][ 'measure' ] )
80 main.deleteSwSleep = int( main.params[ 'SLEEP' ][ 'deleteSW' ] )
81 main.maxScale = int( main.params[ 'max' ] )
82 main.timeout = int( main.params[ 'TIMEOUT' ][ 'timeout' ] )
83 main.MNSleep = int( main.params[ 'SLEEP' ][ 'mininet' ] )
84 main.device = main.params[ 'TEST' ][ 'device' ]
85 stepResult = main.testSetUp.envSetup()
86 main.log.info( "Create Database file " + main.dbFileName )
87 resultsDB = open( main.dbFileName, "w+" )
Devin Lim58046fa2017-07-05 16:55:00 -070088 resultsDB.close()
YPZhang38fb1192016-08-11 11:03:38 -070089
Devin Lim142b5342017-07-20 15:22:39 -070090 main.switchFunc = imp.load_source( main.dependencyFunc,
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070091 main.dependencyPath +
92 main.dependencyFunc +
93 ".py" )
Devin Lim58046fa2017-07-05 16:55:00 -070094 except Exception as e:
95 main.testSetUp.envSetupException( e )
96 main.testSetUp.evnSetupConclusion( stepResult )
97 main.commit = main.commit.split( " " )[ 1 ]
You Wang0e4ca9e2017-08-04 16:40:33 -070098
Devin Lim142b5342017-07-20 15:22:39 -070099 def CASE1( self, main ):
YPZhang38fb1192016-08-11 11:03:38 -0700100 # Clean up test environment and set up
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700101 import time
Devin Lim58046fa2017-07-05 16:55:00 -0700102 try:
103 from tests.dependencies.utils import Utils
104 except ImportError:
105 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700106 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700107 try:
108 main.Utils
109 except ( NameError, AttributeError ):
110 main.Utils = Utils()
111 main.maxNumBatch = 0
You Wanga0f6ff62018-01-11 15:46:30 -0800112 main.testSetUp.ONOSSetUp( main.Cluster, True,
Devin Lim142b5342017-07-20 15:22:39 -0700113 cellName=main.cellName, killRemoveMax=False )
YPZhang38fb1192016-08-11 11:03:38 -0700114
Devin Lim142b5342017-07-20 15:22:39 -0700115 main.log.info( "Configure apps" )
116 main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg,
117 "maxEvents 1" )
118 main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg,
119 "maxBatchMs 0" )
120 main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg,
121 "maxIdleMs 0" )
122 main.Cluster.command( "logSet",
123 args=[ "DEBUG", "org.onosproject.metrics.topology" ],
124 specificDriver=2 )
125 time.sleep( 1 )
YPZhang38fb1192016-08-11 11:03:38 -0700126
Devin Lim142b5342017-07-20 15:22:39 -0700127 main.log.info( "Copy topology file to Mininet" )
128 main.ONOSbench.copyMininetFile( main.topoName,
129 main.dependencyPath,
130 main.Mininet1.user_name,
131 main.Mininet1.ip_address )
Devin Lim58046fa2017-07-05 16:55:00 -0700132 main.Utils.mininetCleanup( main.Mininet1 )
Devin Lim142b5342017-07-20 15:22:39 -0700133 time.sleep( main.MNSleep )
134 main.log.info( "Start new mininet topology" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700135 main.Mininet1.startNet()
Devin Lim142b5342017-07-20 15:22:39 -0700136 main.log.info( "Assign switch to controller to ONOS node 1" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700137
Devin Lim142b5342017-07-20 15:22:39 -0700138 time.sleep( 2 )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700139
Devin Lim142b5342017-07-20 15:22:39 -0700140 def CASE2( self, main ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700141 import time
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700142 import json
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700143 import numpy
144
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700145 resultDict = { 'up': {}, 'down': {} }
Devin Lim142b5342017-07-20 15:22:39 -0700146 for i in range( 1, main.Cluster.numCtrls + 1 ):
147 resultDict[ 'up' ][ 'node' + str( i ) ] = {}
148 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ] = {}
149 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ] = {}
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700150 resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] = [] # TCP to Feature
151 resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_R' ] = [] # Feature to Role
152 resultDict[ 'up' ][ 'node' + str( i ) ][ 'RQ_RR' ] = [] # role request to role reply
153 resultDict[ 'up' ][ 'node' + str( i ) ][ 'RR_D' ] = [] # role reply to Device
154 resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] = [] # Device to Graph
155 resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] = [] # TCP to Graph
Jon Hall4ba53f02015-07-29 13:07:41 -0700156
Devin Lim142b5342017-07-20 15:22:39 -0700157 for i in range( 1, main.Cluster.numCtrls + 1 ):
158 resultDict[ 'down' ][ 'node' + str( i ) ] = {}
159 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ] = {}
160 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ] = {}
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700161 resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] = [] # Fin_ack to ACK
162 resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] = [] # Ack to Device
163 resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] = [] # Device to Graph
164 resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] = [] # fin_ack to Graph
You Wang51f903b2017-08-04 16:22:48 -0700165 for i in range( 0, main.sampleSize + main.warmUp ):
Devin Lim142b5342017-07-20 15:22:39 -0700166 main.log.info( "************************************************************" )
You Wang51f903b2017-08-04 16:22:48 -0700167 main.log.info( "************************ Iteration: {} **********************" .format( str( i + 1 ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700168 if i < main.warmUp:
169 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
170 "up", resultDict, True )
171 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
172 "down", resultDict, True )
Devin Limaa256a72017-10-13 13:40:30 -0700173 main.log.warn( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
Devin Lim142b5342017-07-20 15:22:39 -0700174 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
Devin Limaa256a72017-10-13 13:40:30 -0700175 main.log.warn( "After devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
176 while main.Cluster.active( 0 ).CLI.devices() != "[]":
177 main.log.error( "DEVICE NOT REMOVED !!!!!")
178 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700179 else:
YPZhang38fb1192016-08-11 11:03:38 -0700180 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
181 "up", resultDict, False )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700182 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
183 "down", resultDict, False )
Devin Limaa256a72017-10-13 13:40:30 -0700184 main.log.warn( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
Devin Lim142b5342017-07-20 15:22:39 -0700185 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
Devin Limaa256a72017-10-13 13:40:30 -0700186 main.log.warn("After devices : " + str(main.Cluster.active(0).CLI.devices()))
187 while main.Cluster.active( 0 ).CLI.devices() != "[]":
188 main.log.error( "DEVICE NOT REMOVED !!!!!")
189 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
chengchiyu08303a02016-09-08 17:40:26 -0700190
YPZhang38fb1192016-08-11 11:03:38 -0700191 # Dictionary for result
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -0700192 maxDict = {}
Devin Lim142b5342017-07-20 15:22:39 -0700193 maxDict[ 'down' ] = {}
194 maxDict[ 'up' ] = {}
195 maxDict[ 'down' ][ 'max' ] = 0
196 maxDict[ 'up' ][ 'max' ] = 0
197 maxDict[ 'down' ][ 'node' ] = 0
198 maxDict[ 'up' ][ 'node' ] = 0
Jon Hall4ba53f02015-07-29 13:07:41 -0700199
Devin Lim142b5342017-07-20 15:22:39 -0700200 for i in range( 1, main.Cluster.numCtrls + 1 ):
YPZhang38fb1192016-08-11 11:03:38 -0700201 # calculate average and std for result, and grep the max End to End data
Devin Lim142b5342017-07-20 15:22:39 -0700202 EtoEtemp = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] )
203 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
204 if maxDict[ 'up' ][ 'max' ] < EtoEtemp:
YPZhang38fb1192016-08-11 11:03:38 -0700205 # get max End to End latency
Devin Lim142b5342017-07-20 15:22:39 -0700206 maxDict[ 'up' ][ 'max' ] = EtoEtemp
207 maxDict[ 'up' ][ 'node' ] = i
208 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'T_F' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] )
209 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'F_R' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_R' ] )
210 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'RQ_RR' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RQ_RR' ] )
211 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'RR_D' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RR_D' ] )
212 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -0700213
Devin Lim142b5342017-07-20 15:22:39 -0700214 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] )
215 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'T_F' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] )
216 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'F_R' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_R' ] )
217 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'RQ_RR' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RQ_RR' ] )
218 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'RR_D' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RR_D' ] )
219 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700220
YPZhang38fb1192016-08-11 11:03:38 -0700221 # calculate average and std for result, and grep the max End to End data
Devin Lim142b5342017-07-20 15:22:39 -0700222 EtoEtemp = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] )
223 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
224 if maxDict[ 'down' ][ 'max' ] < EtoEtemp:
YPZhang38fb1192016-08-11 11:03:38 -0700225 # get max End to End latency
Devin Lim142b5342017-07-20 15:22:39 -0700226 maxDict[ 'down' ][ 'max' ] = EtoEtemp
227 maxDict[ 'down' ][ 'node' ] = i
228 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'FA_A' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] )
229 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'A_D' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] )
230 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700231
Devin Lim142b5342017-07-20 15:22:39 -0700232 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] )
233 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'FA_A' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] )
234 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'A_D' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] )
235 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -0700236
Devin Lim142b5342017-07-20 15:22:39 -0700237 main.log.report( "=====node{} Summary:=====".format( str( i ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700238 main.log.report( "=============Switch up=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700239
YPZhang38fb1192016-08-11 11:03:38 -0700240 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700241 "End to End average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700242 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700243 "End to End Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700244
YPZhang38fb1192016-08-11 11:03:38 -0700245 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700246 "TCP to Feature average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'T_F' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700247 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700248 "TCP to Feature Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'T_F' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700249
YPZhang38fb1192016-08-11 11:03:38 -0700250 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700251 "Feature to Role average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'F_R' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700252 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700253 "Feature to Role Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'F_R' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700254
YPZhang38fb1192016-08-11 11:03:38 -0700255 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700256 "Role request to Role reply average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'RQ_RR' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700257 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700258 "Role request to Role reply Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'RQ_RR' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700259
YPZhang38fb1192016-08-11 11:03:38 -0700260 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700261 "Role reply to Device average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'RR_D' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700262 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700263 "Role reply to Device Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'RR_D' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700264
YPZhang38fb1192016-08-11 11:03:38 -0700265 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700266 "Device to Graph average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700267 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700268 "Device to Graph Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700269
YPZhang38fb1192016-08-11 11:03:38 -0700270 main.log.report( "=============Switch down=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700271
YPZhang38fb1192016-08-11 11:03:38 -0700272 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700273 "End to End average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700274 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700275 "End to End Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700276
YPZhang38fb1192016-08-11 11:03:38 -0700277 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700278 "Fin_ACK to ACK average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'FA_A' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700279 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700280 "Fin_ACK to ACK Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'FA_A' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700281
YPZhang38fb1192016-08-11 11:03:38 -0700282 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700283 "ACK to Device average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'A_D' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700284 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700285 "ACK to Device Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'A_D' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700286
YPZhang38fb1192016-08-11 11:03:38 -0700287 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700288 "Device to Graph average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700289 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700290 "Device to Graph Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700291
Devin Lim142b5342017-07-20 15:22:39 -0700292 with open( main.dbFileName, "a" ) as dbFile:
YPZhang38fb1192016-08-11 11:03:38 -0700293 # TODO: Save STD to Database
294 # Scale number
Devin Lim142b5342017-07-20 15:22:39 -0700295 temp = str( main.Cluster.numCtrls )
YPZhang38fb1192016-08-11 11:03:38 -0700296 temp += ",'baremetal1'"
297 # put result
Devin Lim142b5342017-07-20 15:22:39 -0700298 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] )
299 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'T_F' ] )
300 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'F_R' ] )
301 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'RQ_RR' ] )
302 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'RR_D' ] )
303 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'D_G' ] )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700304
Devin Lim142b5342017-07-20 15:22:39 -0700305 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] )
306 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'FA_A' ] )
307 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'A_D' ] )
308 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'D_G' ] )
chengchiyuc6f4cc02016-08-24 14:04:20 -0700309
Devin Lim142b5342017-07-20 15:22:39 -0700310 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] )
311 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] )
chengchiyuc6f4cc02016-08-24 14:04:20 -0700312
YPZhang38fb1192016-08-11 11:03:38 -0700313 temp += "\n"
314 dbFile.write( temp )
315 dbFile.close()