blob: 66b3dc0fd47ce40423e04641089c11b61b191920 [file] [log] [blame]
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07001"""
2Copyright 2015 Open Networking Foundation (ONF)
3
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
11 (at your option) any later version.
12
13 TestON is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with TestON. If not, see <http://www.gnu.org/licenses/>.
20"""
21
YPZhang38fb1192016-08-11 11:03:38 -070022'''
23 SCPFswitchLat
24 Test Switch add/remove latency
25 calculate package latency between switch and ONOS
26 Switch UP:
27 TCP -- Feature Reply -- Role Request -- Role Reply -- Device -- Graph
28 Siwtch Down:
29 Openflow FIN/ACK -- ACK -- Device -- Graph
30'''
cameron@onlab.us21106ea2015-07-23 15:32:51 -070031
32class SCPFswitchLat:
33
Devin Lim142b5342017-07-20 15:22:39 -070034 def __init__( self ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -070035 self.default = ''
36
YPZhang38fb1192016-08-11 11:03:38 -070037 def CASE0( self, main ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -070038 import os
YPZhang38fb1192016-08-11 11:03:38 -070039 import imp
40 '''
41 - GIT
42 - BUILDING ONOS
43 Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
44 This step is usually skipped. Because in a Jenkins driven automated
45 test env. We want Jenkins jobs to pull&build for flexibility to handle
46 different versions of ONOS.
47 - Construct tests variables
48 '''
Devin Lim58046fa2017-07-05 16:55:00 -070049 try:
50 from tests.dependencies.ONOSSetup import ONOSSetup
51 main.testSetUp = ONOSSetup()
52 except ImportError:
53 main.log.error( "ONOSSetup not found. exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -070054 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -070055 main.testSetUp.envSetupDescription()
56 stepResult = main.FALSE
57 try:
58 # The dictionary to record different type of wrongs
59 main.wrong = { 'totalWrong': 0, 'skipDown' : 0, 'TsharkValueIncorrect': 0,
60 'TypeError' : 0, 'decodeJasonError': 0,
Devin Lim142b5342017-07-20 15:22:39 -070061 'checkResultIncorrect': 0 }
62 main.maxWrong = int( main.params[ 'TEST' ] [ 'MaxWrong' ] )
63 main.resultRange = main.params[ 'TEST' ][ 'ResultRange' ]
64 main.searchTerm = main.params[ 'TEST' ][ 'SearchTerm' ]
65 main.MN1Ip = main.params[ 'MN' ][ 'ip1' ]
Devin Lim58046fa2017-07-05 16:55:00 -070066 main.dependencyPath = main.testOnDirectory + \
Devin Lim142b5342017-07-20 15:22:39 -070067 main.params[ 'DEPENDENCY' ][ 'path' ]
68 main.topoName = main.params[ 'DEPENDENCY' ][ 'topology' ]
69 main.dependencyFunc = main.params[ 'DEPENDENCY' ][ 'function' ]
70 main.cellName = main.params[ 'ENV' ][ 'cellName' ]
71 main.apps = main.params[ 'ENV' ][ 'cellApps' ]
72 main.scale = ( main.params[ 'SCALE' ] ).split( "," )
YPZhang38fb1192016-08-11 11:03:38 -070073
Devin Lim142b5342017-07-20 15:22:39 -070074 main.ofPackage = main.params[ 'TSHARK' ]
75 main.defaultTopoCfg = main.params [ 'CFG' ][ 'defaultTopo' ]
76 main.tsharkResultPath = main.params[ 'TEST' ][ 'tsharkResultPath' ]
77 main.sampleSize = int( main.params[ 'TEST' ][ 'sampleSize' ] )
78 main.warmUp = int( main.params[ 'TEST' ][ 'warmUp' ] )
79 main.dbFileName = main.params[ 'DATABASE' ][ 'dbName' ]
80 main.startUpSleep = int( main.params[ 'SLEEP' ][ 'startup' ] )
81 main.measurementSleep = int( main.params[ 'SLEEP' ][ 'measure' ] )
82 main.deleteSwSleep = int( main.params[ 'SLEEP' ][ 'deleteSW' ] )
83 main.maxScale = int( main.params[ 'max' ] )
84 main.timeout = int( main.params[ 'TIMEOUT' ][ 'timeout' ] )
85 main.MNSleep = int( main.params[ 'SLEEP' ][ 'mininet' ] )
86 main.device = main.params[ 'TEST' ][ 'device' ]
87 stepResult = main.testSetUp.envSetup()
88 main.log.info( "Create Database file " + main.dbFileName )
89 resultsDB = open( main.dbFileName, "w+" )
Devin Lim58046fa2017-07-05 16:55:00 -070090 resultsDB.close()
YPZhang38fb1192016-08-11 11:03:38 -070091
Devin Lim142b5342017-07-20 15:22:39 -070092 main.switchFunc = imp.load_source( main.dependencyFunc,
Devin Lim58046fa2017-07-05 16:55:00 -070093 main.dependencyPath +
94 main.dependencyFunc +
Devin Lim142b5342017-07-20 15:22:39 -070095 ".py" )
Devin Lim58046fa2017-07-05 16:55:00 -070096 except Exception as e:
97 main.testSetUp.envSetupException( e )
98 main.testSetUp.evnSetupConclusion( stepResult )
99 main.commit = main.commit.split( " " )[ 1 ]
You Wang0e4ca9e2017-08-04 16:40:33 -0700100
Devin Lim142b5342017-07-20 15:22:39 -0700101 def CASE1( self, main ):
YPZhang38fb1192016-08-11 11:03:38 -0700102 # Clean up test environment and set up
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700103 import time
Devin Lim58046fa2017-07-05 16:55:00 -0700104 try:
105 from tests.dependencies.utils import Utils
106 except ImportError:
107 main.log.error( "Utils not found exiting the test" )
Devin Lim44075962017-08-11 10:56:37 -0700108 main.cleanAndExit()
Devin Lim58046fa2017-07-05 16:55:00 -0700109 try:
110 main.Utils
111 except ( NameError, AttributeError ):
112 main.Utils = Utils()
113 main.maxNumBatch = 0
Devin Lim142b5342017-07-20 15:22:39 -0700114 main.testSetUp.ONOSSetUp( main.Mininet1, main.Cluster, True,
115 cellName=main.cellName, killRemoveMax=False )
YPZhang38fb1192016-08-11 11:03:38 -0700116
Devin Lim142b5342017-07-20 15:22:39 -0700117 main.log.info( "Configure apps" )
118 main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg,
119 "maxEvents 1" )
120 main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg,
121 "maxBatchMs 0" )
122 main.Cluster.active( 0 ).CLI.setCfg( main.defaultTopoCfg,
123 "maxIdleMs 0" )
124 main.Cluster.command( "logSet",
125 args=[ "DEBUG", "org.onosproject.metrics.topology" ],
126 specificDriver=2 )
127 time.sleep( 1 )
YPZhang38fb1192016-08-11 11:03:38 -0700128
Devin Lim142b5342017-07-20 15:22:39 -0700129 main.log.info( "Copy topology file to Mininet" )
130 main.ONOSbench.copyMininetFile( main.topoName,
131 main.dependencyPath,
132 main.Mininet1.user_name,
133 main.Mininet1.ip_address )
Devin Lim58046fa2017-07-05 16:55:00 -0700134 main.Utils.mininetCleanup( main.Mininet1 )
Devin Lim142b5342017-07-20 15:22:39 -0700135 time.sleep( main.MNSleep )
136 main.log.info( "Start new mininet topology" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700137 main.Mininet1.startNet()
Devin Lim142b5342017-07-20 15:22:39 -0700138 main.log.info( "Assign switch to controller to ONOS node 1" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700139
Devin Lim142b5342017-07-20 15:22:39 -0700140 time.sleep( 2 )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700141
Devin Lim142b5342017-07-20 15:22:39 -0700142 def CASE2( self, main ):
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700143 import time
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700144 import json
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700145 import numpy
146
Devin Lim142b5342017-07-20 15:22:39 -0700147 resultDict = { 'up' : {}, 'down' : {} }
148 for i in range( 1, main.Cluster.numCtrls + 1 ):
149 resultDict[ 'up' ][ 'node' + str( i ) ] = {}
150 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ] = {}
151 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ] = {}
152 resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] = []#TCP to Feature
153 resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_R' ] = []#Feature to Role
154 resultDict[ 'up' ][ 'node' + str( i ) ][ 'RQ_RR' ] = []#role request to role reply
155 resultDict[ 'up' ][ 'node' + str( i ) ][ 'RR_D' ] = []#role reply to Device
156 resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] = []#Device to Graph
157 resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] = []#TCP to Graph
Jon Hall4ba53f02015-07-29 13:07:41 -0700158
Devin Lim142b5342017-07-20 15:22:39 -0700159 for i in range( 1, main.Cluster.numCtrls + 1 ):
160 resultDict[ 'down' ][ 'node' + str( i ) ] = {}
161 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ] = {}
162 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ] = {}
163 resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] = []#Fin_ack to ACK
164 resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] = []#Ack to Device
165 resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] = []#Device to Graph
166 resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] = []#fin_ack to Graph
You Wang51f903b2017-08-04 16:22:48 -0700167 for i in range( 0, main.sampleSize + main.warmUp ):
Devin Lim142b5342017-07-20 15:22:39 -0700168 main.log.info( "************************************************************" )
You Wang51f903b2017-08-04 16:22:48 -0700169 main.log.info( "************************ Iteration: {} **********************" .format( str( i + 1 ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700170 if i < main.warmUp:
171 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
172 "up", resultDict, True )
173 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
174 "down", resultDict, True )
Devin Lim142b5342017-07-20 15:22:39 -0700175 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700176 else:
YPZhang38fb1192016-08-11 11:03:38 -0700177 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
178 "up", resultDict, False )
Devin Lim142b5342017-07-20 15:22:39 -0700179 main.switchFunc.captureOfPack ( main, main.device, main.ofPackage,
YPZhang38fb1192016-08-11 11:03:38 -0700180 "down", resultDict, False )
Devin Lim142b5342017-07-20 15:22:39 -0700181 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
chengchiyu08303a02016-09-08 17:40:26 -0700182
YPZhang38fb1192016-08-11 11:03:38 -0700183 # Dictionary for result
184 maxDict = {}
Devin Lim142b5342017-07-20 15:22:39 -0700185 maxDict[ 'down' ] = {}
186 maxDict[ 'up' ] = {}
187 maxDict[ 'down' ][ 'max' ] = 0
188 maxDict[ 'up' ][ 'max' ] = 0
189 maxDict[ 'down' ][ 'node' ] = 0
190 maxDict[ 'up' ][ 'node' ] = 0
Jon Hall4ba53f02015-07-29 13:07:41 -0700191
Devin Lim142b5342017-07-20 15:22:39 -0700192 for i in range( 1, main.Cluster.numCtrls + 1 ):
YPZhang38fb1192016-08-11 11:03:38 -0700193 # calculate average and std for result, and grep the max End to End data
Devin Lim142b5342017-07-20 15:22:39 -0700194 EtoEtemp = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] )
195 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
196 if maxDict[ 'up' ][ 'max' ] < EtoEtemp:
YPZhang38fb1192016-08-11 11:03:38 -0700197 # get max End to End latency
Devin Lim142b5342017-07-20 15:22:39 -0700198 maxDict[ 'up' ][ 'max' ] = EtoEtemp
199 maxDict[ 'up' ][ 'node' ] = i
200 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'T_F' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] )
201 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'F_R' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_R' ] )
202 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'RQ_RR' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RQ_RR' ] )
203 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'RR_D' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RR_D' ] )
204 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] = numpy.average( resultDict[ 'up' ][ 'node' + str( i ) ][ 'D_G' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -0700205
Devin Lim142b5342017-07-20 15:22:39 -0700206 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'E_E' ] )
207 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'T_F' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'T_F' ] )
208 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'F_R' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'F_R' ] )
209 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'RQ_RR' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RQ_RR' ] )
210 resultDict[ 'up' ][ 'node' + str( i ) ][ 'Std' ][ 'RR_D' ] = numpy.std( resultDict[ 'up' ][ 'node' + str( i ) ][ 'RR_D' ] )
211 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 -0700212
YPZhang38fb1192016-08-11 11:03:38 -0700213 # calculate average and std for result, and grep the max End to End data
Devin Lim142b5342017-07-20 15:22:39 -0700214 EtoEtemp = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] )
215 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] = EtoEtemp
216 if maxDict[ 'down' ][ 'max' ] < EtoEtemp:
YPZhang38fb1192016-08-11 11:03:38 -0700217 # get max End to End latency
Devin Lim142b5342017-07-20 15:22:39 -0700218 maxDict[ 'down' ][ 'max' ] = EtoEtemp
219 maxDict[ 'down' ][ 'node' ] = i
220 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'FA_A' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] )
221 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Ave' ][ 'A_D' ] = numpy.average( resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] )
222 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 -0700223
Devin Lim142b5342017-07-20 15:22:39 -0700224 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'E_E' ] )
225 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'FA_A' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'FA_A' ] )
226 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'A_D' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'A_D' ] )
227 resultDict[ 'down' ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] = numpy.std( resultDict[ 'down' ][ 'node' + str( i ) ][ 'D_G' ] )
Jon Hall4ba53f02015-07-29 13:07:41 -0700228
Devin Lim142b5342017-07-20 15:22:39 -0700229 main.log.report( "=====node{} Summary:=====".format( str( i ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700230 main.log.report( "=============Switch up=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700231
YPZhang38fb1192016-08-11 11:03:38 -0700232 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700233 "End to End average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700234 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700235 "End to End Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700236
YPZhang38fb1192016-08-11 11:03:38 -0700237 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700238 "TCP to Feature average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'T_F' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700239 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700240 "TCP to Feature Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'T_F' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700241
YPZhang38fb1192016-08-11 11:03:38 -0700242 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700243 "Feature to Role average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'F_R' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700244 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700245 "Feature to Role Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'F_R' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700246
YPZhang38fb1192016-08-11 11:03:38 -0700247 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700248 "Role request to Role reply average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'RQ_RR' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700249 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700250 "Role request to Role reply Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'RQ_RR' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700251
YPZhang38fb1192016-08-11 11:03:38 -0700252 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700253 "Role reply to Device average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'RR_D' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700254 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700255 "Role reply to Device Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'RR_D' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700256
YPZhang38fb1192016-08-11 11:03:38 -0700257 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700258 "Device to Graph average: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700259 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700260 "Device to Graph Std: {}".format( str( resultDict[ "up" ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700261
YPZhang38fb1192016-08-11 11:03:38 -0700262 main.log.report( "=============Switch down=======" )
Jon Hall4ba53f02015-07-29 13:07:41 -0700263
YPZhang38fb1192016-08-11 11:03:38 -0700264 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700265 "End to End average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'E_E' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700266 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700267 "End to End Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'E_E' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700268
YPZhang38fb1192016-08-11 11:03:38 -0700269 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700270 "Fin_ACK to ACK average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'FA_A' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700271 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700272 "Fin_ACK to ACK Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'FA_A' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700273
YPZhang38fb1192016-08-11 11:03:38 -0700274 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700275 "ACK to Device average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'A_D' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700276 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700277 "ACK to Device Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'A_D' ] ) ) )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700278
YPZhang38fb1192016-08-11 11:03:38 -0700279 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700280 "Device to Graph average: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Ave' ][ 'D_G' ] ) ) )
YPZhang38fb1192016-08-11 11:03:38 -0700281 main.log.report(
Devin Lim142b5342017-07-20 15:22:39 -0700282 "Device to Graph Std: {}".format( str( resultDict[ "down" ][ 'node' + str( i ) ][ 'Std' ][ 'D_G' ] ) ) )
Jon Hall4ba53f02015-07-29 13:07:41 -0700283
Devin Lim142b5342017-07-20 15:22:39 -0700284 with open( main.dbFileName, "a" ) as dbFile:
YPZhang38fb1192016-08-11 11:03:38 -0700285 # TODO: Save STD to Database
286 # Scale number
Devin Lim142b5342017-07-20 15:22:39 -0700287 temp = str( main.Cluster.numCtrls )
YPZhang38fb1192016-08-11 11:03:38 -0700288 temp += ",'baremetal1'"
289 # put result
Devin Lim142b5342017-07-20 15:22:39 -0700290 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] )
291 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'T_F' ] )
292 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'F_R' ] )
293 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'RQ_RR' ] )
294 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'RR_D' ] )
295 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Ave' ][ 'D_G' ] )
cameron@onlab.us21106ea2015-07-23 15:32:51 -0700296
Devin Lim142b5342017-07-20 15:22:39 -0700297 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'E_E' ] )
298 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'FA_A' ] )
299 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'A_D' ] )
300 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Ave' ][ 'D_G' ] )
chengchiyuc6f4cc02016-08-24 14:04:20 -0700301
Devin Lim142b5342017-07-20 15:22:39 -0700302 temp += "," + str( "%.2f" % resultDict[ 'up' ][ 'node' + str( maxDict[ 'up' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] )
303 temp += "," + str( "%.2f" % resultDict[ 'down' ][ 'node' + str( maxDict[ 'down' ][ 'node' ] ) ][ 'Std' ][ 'E_E' ] )
chengchiyuc6f4cc02016-08-24 14:04:20 -0700304
YPZhang38fb1192016-08-11 11:03:38 -0700305 temp += "\n"
306 dbFile.write( temp )
307 dbFile.close()