blob: ab64f2305d3e4b75ec9ae984f1dd5b634f885044 [file] [log] [blame]
YPZhangfebf7302016-05-24 16:45:56 -07001# SCPFintentRerouteLat
2"""
3SCPFintentRerouteLat
4 - Test Intent Reroute Latency
5 - Test Algorithm:
6 1. Start Null Provider reroute Topology
7 2. Using Push-test-intents to push batch size intents from switch 1 to switch 7
8 3. Cut the link between switch 3 and switch 4 (the path will reroute to switch 8)
9 4. Get the topology time stamp
10 5. Get Intent reroute(Installed) time stamp from each nodes
11 6. Use the latest intent time stamp subtract topology time stamp
12 - This test will run 5 warm up by default, warm up iteration can be setup in Param file
13 - The intent batch size will default set to 1, 100, and 1000, also can be set in Param file
14 - The unit of the latency result is milliseconds
15"""
cameron@onlab.us78b89652015-07-08 15:21:03 -070016
Chiyu Chengec63bde2016-11-17 18:11:36 -080017
cameron@onlab.us78b89652015-07-08 15:21:03 -070018class SCPFintentRerouteLat:
YPZhangfebf7302016-05-24 16:45:56 -070019 def __init__(self):
cameron@onlab.us78b89652015-07-08 15:21:03 -070020 self.default = ''
21
YPZhangfebf7302016-05-24 16:45:56 -070022 def CASE0( self, main ):
Chiyu Chengec63bde2016-11-17 18:11:36 -080023 import imp
24 import os
YPZhangfebf7302016-05-24 16:45:56 -070025 '''
26 - GIT
27 - BUILDING ONOS
28 Pull specific ONOS branch, then Build ONOS ono ONOS Bench.
29 This step is usually skipped. Because in a Jenkins driven automated
30 test env. We want Jenkins jobs to pull&build for flexibility to handle
31 different versions of ONOS.
32 - Construct tests variables
33 '''
34 gitPull = main.params['GIT']['gitPull']
35 gitBranch = main.params['GIT']['gitBranch']
cameron@onlab.us78b89652015-07-08 15:21:03 -070036
YPZhangfebf7302016-05-24 16:45:56 -070037 main.case("Pull onos branch and build onos on Teststation.")
38
39 if gitPull == 'True':
40 main.step("Git Checkout ONOS branch: " + gitBranch)
41 stepResult = main.ONOSbench.gitCheckout(branch=gitBranch)
42 utilities.assert_equals(expect=main.TRUE,
43 actual=stepResult,
44 onpass="Successfully checkout onos branch.",
45 onfail="Failed to checkout onos branch. Exiting test...")
Chiyu Chengec63bde2016-11-17 18:11:36 -080046 if not stepResult:
47 main.exit()
YPZhangfebf7302016-05-24 16:45:56 -070048
49 main.step("Git Pull on ONOS branch:" + gitBranch)
50 stepResult = main.ONOSbench.gitPull()
51 utilities.assert_equals(expect=main.TRUE,
52 actual=stepResult,
53 onpass="Successfully pull onos. ",
54 onfail="Failed to pull onos. Exiting test ...")
55 if not stepResult: main.exit()
56
YPZhangfebf7302016-05-24 16:45:56 -070057 else:
58 main.log.warn("Skipped pulling onos and Skipped building ONOS")
Chiyu Chengec63bde2016-11-17 18:11:36 -080059 main.onosIp = main.ONOSbench.getOnosIps()
YPZhangfebf7302016-05-24 16:45:56 -070060 main.apps = main.params['ENV']['cellApps']
61 main.BENCHUser = main.params['BENCH']['user']
62 main.BENCHIp = main.params['BENCH']['ip1']
63 main.MN1Ip = main.params['MN']['ip1']
64 main.maxNodes = int(main.params['max'])
YPZhangfebf7302016-05-24 16:45:56 -070065 main.cellName = main.params['ENV']['cellName']
66 main.scale = (main.params['SCALE']).split(",")
YPZhangfebf7302016-05-24 16:45:56 -070067 main.timeout = int(main.params['SLEEP']['timeout'])
68 main.startUpSleep = int(main.params['SLEEP']['startup'])
69 main.installSleep = int(main.params['SLEEP']['install'])
70 main.verifySleep = int(main.params['SLEEP']['verify'])
YPZhang2b9b26d2016-06-20 16:18:29 -070071 main.setMasterSleep = int(main.params['SLEEP']['setmaster'])
YPZhangfebf7302016-05-24 16:45:56 -070072 main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
You Wang0b9039d2017-01-12 16:51:29 -080073 main.maxInvalidRun = int(main.params['ATTEMPTS']['maxInvalidRun'])
YPZhangfebf7302016-05-24 16:45:56 -070074 main.sampleSize = int(main.params['TEST']['sampleSize'])
75 main.warmUp = int(main.params['TEST']['warmUp'])
YPZhangfebf7302016-05-24 16:45:56 -070076 main.ingress = main.params['TEST']['ingress']
77 main.egress = main.params['TEST']['egress']
78 main.debug = main.params['TEST']['debug']
YPZhange6ef82a2016-07-05 16:48:15 -070079 main.flowObj = main.params['TEST']['flowObj']
Chiyu Cheng1976db52016-10-21 15:57:30 -070080 main.deviceCount = int(main.params['TEST']['deviceCount'])
81 main.end1 = main.params['TEST']['end1']
82 main.end2 = main.params['TEST']['end2']
Chiyu Chengec63bde2016-11-17 18:11:36 -080083 main.searchTerm = main.params['SEARCHTERM']
YPZhange6ef82a2016-07-05 16:48:15 -070084 if main.flowObj == "True":
85 main.flowObj = True
86 main.dbFileName = main.params['DATABASE']['dbFlowObj']
YPZhang3b5a78f2016-07-14 10:43:33 -070087 main.intentsList = (main.params['TEST']['FObjintents']).split(",")
YPZhange6ef82a2016-07-05 16:48:15 -070088 else:
89 main.flowObj = False
90 main.dbFileName = main.params['DATABASE']['dbName']
YPZhang3b5a78f2016-07-14 10:43:33 -070091 main.intentsList = (main.params['TEST']['intents']).split(",")
YPZhange6ef82a2016-07-05 16:48:15 -070092
YPZhangfebf7302016-05-24 16:45:56 -070093 for i in range(0, len(main.intentsList)):
94 main.intentsList[i] = int(main.intentsList[i])
95 # Create DataBase file
96 main.log.info("Create Database file " + main.dbFileName)
97 resultsDB = open(main.dbFileName, "w+")
98 resultsDB.close()
Chiyu Chengec63bde2016-11-17 18:11:36 -080099 file1 = main.params[ "DEPENDENCY" ][ "FILE1" ]
100 main.dependencyPath = os.path.dirname( os.getcwd() ) + main.params[ "DEPENDENCY" ][ "PATH" ]
101 main.intentRerouteLatFuncs = imp.load_source(file1, main.dependencyPath + file1 + ".py")
102
103 main.record = 0
YPZhangfebf7302016-05-24 16:45:56 -0700104
105 def CASE1( self, main ):
106 '''
107 clean up test environment and set up
108 '''
cameron@onlab.us78b89652015-07-08 15:21:03 -0700109 import time
110
YPZhangfebf7302016-05-24 16:45:56 -0700111 main.log.info("Get ONOS cluster IP")
112 print(main.scale)
113 main.numCtrls = int(main.scale[0])
114 main.ONOSip = []
115 main.maxNumBatch = 0
116 main.AllONOSip = main.ONOSbench.getOnosIps()
117 for i in range(main.numCtrls):
118 main.ONOSip.append(main.AllONOSip[i])
119 main.log.info(main.ONOSip)
120 main.CLIs = []
121 main.log.info("Creating list of ONOS cli handles")
122 for i in range(main.numCtrls):
Devin Lim28706842017-06-08 10:23:48 -0700123 main.CLIs.append(getattr(main, 'ONOScli%s' % (i + 1)))
cameron@onlab.us78b89652015-07-08 15:21:03 -0700124
YPZhangfebf7302016-05-24 16:45:56 -0700125 if not main.CLIs:
126 main.log.error("Failed to create the list of ONOS cli handles")
127 main.cleanup()
128 main.exit()
cameron@onlab.us78b89652015-07-08 15:21:03 -0700129
YPZhangfebf7302016-05-24 16:45:56 -0700130 main.commit = main.ONOSbench.getVersion(report=True)
131 main.commit = main.commit.split(" ")[1]
132 main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls)
133 main.log.info("Safety check, killing all ONOS processes" +
134 " before initiating environment setup")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700135
YPZhangfebf7302016-05-24 16:45:56 -0700136 for i in range(main.numCtrls):
You Wangb98a9fa2017-02-15 17:27:42 -0800137 main.ONOSbench.onosStop(main.ONOSip[i])
138 main.ONOSbench.onosKill(main.ONOSip[i])
cameron@onlab.us78b89652015-07-08 15:21:03 -0700139
YPZhangfebf7302016-05-24 16:45:56 -0700140 main.log.info("NODE COUNT = %s" % main.numCtrls)
YPZhangfebf7302016-05-24 16:45:56 -0700141 main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
142 main.cellName,
143 main.MN1Ip,
144 main.apps,
Devin Lim461f0872017-06-05 16:49:33 -0700145 main.ONOSip,
146 main.ONOScli1.user_name)
YPZhangfebf7302016-05-24 16:45:56 -0700147 main.step("Apply cell to environment")
148 cellResult = main.ONOSbench.setCell(main.cellName)
149 verifyResult = main.ONOSbench.verifyCell()
150 stepResult = cellResult and verifyResult
151 utilities.assert_equals(expect=main.TRUE,
152 actual=stepResult,
153 onpass="Successfully applied cell to " + \
154 "environment",
155 onfail="Failed to apply cell to environment ")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700156
YPZhangfebf7302016-05-24 16:45:56 -0700157 main.step("Creating ONOS package")
Jon Hallbd60ea02016-08-23 10:03:59 -0700158 packageResult = main.ONOSbench.buckBuild()
YPZhangfebf7302016-05-24 16:45:56 -0700159 stepResult = packageResult
160 utilities.assert_equals(expect=main.TRUE,
161 actual=stepResult,
162 onpass="Successfully created ONOS package",
163 onfail="Failed to create ONOS package")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700164
YPZhangfebf7302016-05-24 16:45:56 -0700165 main.step("Uninstall ONOS package on all Nodes")
166 uninstallResult = main.TRUE
167 for i in range(int(main.numCtrls)):
168 main.log.info("Uninstalling package on ONOS Node IP: " + main.ONOSip[i])
169 u_result = main.ONOSbench.onosUninstall(main.ONOSip[i])
170 utilities.assert_equals(expect=main.TRUE, actual=u_result,
171 onpass="Test step PASS",
172 onfail="Test step FAIL")
173 uninstallResult = (uninstallResult and u_result)
Jon Hall4ba53f02015-07-29 13:07:41 -0700174
YPZhangfebf7302016-05-24 16:45:56 -0700175 main.step("Install ONOS package on all Nodes")
176 installResult = main.TRUE
177 for i in range(int(main.numCtrls)):
178 main.log.info("Installing package on ONOS Node IP: " + main.ONOSip[i])
179 i_result = main.ONOSbench.onosInstall(node=main.ONOSip[i])
180 utilities.assert_equals(expect=main.TRUE, actual=i_result,
181 onpass="Test step PASS",
182 onfail="Test step FAIL")
183 installResult = installResult and i_result
cameron@onlab.us78b89652015-07-08 15:21:03 -0700184
You Wangf5de25b2017-01-06 15:13:01 -0800185 main.step( "Set up ONOS secure SSH" )
186 secureSshResult = main.TRUE
187 for i in range( int( main.numCtrls ) ):
188 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
189 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
190 onpass="Test step PASS",
191 onfail="Test step FAIL" )
192
Chiyu Chengec63bde2016-11-17 18:11:36 -0800193 main.step( "Starting ONOS service" )
194 stopResult = main.TRUE
195 startResult = main.TRUE
196 onosIsUp = main.TRUE
Chiyu Chengef109502016-11-21 15:51:38 -0800197
Chiyu Chengec63bde2016-11-17 18:11:36 -0800198 for i in range( main.numCtrls ):
199 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
200 if onosIsUp == main.TRUE:
201 main.log.report( "ONOS instance is up and ready" )
202 else:
203 main.log.report( "ONOS instance may not be up, stop and " +
204 "start ONOS again " )
205
206 for i in range( main.numCtrls ):
207 stopResult = stopResult and \
208 main.ONOSbench.onosStop( main.ONOSip[ i ] )
209 for i in range( main.numCtrls ):
210 startResult = startResult and \
211 main.ONOSbench.onosStart( main.ONOSip[ i ] )
212 stepResult = onosIsUp and stopResult and startResult
213 utilities.assert_equals( expect=main.TRUE, actual=stepResult,
214 onpass="Test step PASS",
215 onfail="Test step FAIL" )
You Wangf5de25b2017-01-06 15:13:01 -0800216
You Wang0b9039d2017-01-12 16:51:29 -0800217 time.sleep(main.startUpSleep)
YPZhangfebf7302016-05-24 16:45:56 -0700218 main.step("Start ONOS CLI on all nodes")
219 cliResult = main.TRUE
Jon Hall6509dbf2016-06-21 17:01:17 -0700220 main.step(" Start ONOS cli using thread ")
YPZhangfebf7302016-05-24 16:45:56 -0700221 startCliResult = main.TRUE
222 pool = []
223 main.threadID = 0
224 for i in range(int(main.numCtrls)):
225 t = main.Thread(target=main.CLIs[i].startOnosCli,
226 threadID=main.threadID,
227 name="startOnosCli",
228 args=[main.ONOSip[i]],
229 kwargs={"onosStartTimeout": main.timeout})
230 pool.append(t)
231 t.start()
232 main.threadID = main.threadID + 1
233 for t in pool:
234 t.join()
235 startCliResult = startCliResult and t.result
236 time.sleep(main.startUpSleep)
Jon Hall4ba53f02015-07-29 13:07:41 -0700237
YPZhangfebf7302016-05-24 16:45:56 -0700238 # configure apps
Chiyu Cheng1976db52016-10-21 15:57:30 -0700239 main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
YPZhangfebf7302016-05-24 16:45:56 -0700240 main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "topoShape", value="reroute")
241 main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
YPZhange6ef82a2016-07-05 16:48:15 -0700242 if main.flowObj:
243 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
244 "useFlowObjectives", value="true")
You Wang106d0fa2017-05-15 17:22:15 -0700245 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
246 "defaultFlowObjectiveCompiler",
247 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
Chiyu Chengec63bde2016-11-17 18:11:36 -0800248 time.sleep( main.startUpSleep )
249 for i in range( int( main.numCtrls ) ):
250 main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.topology" )
251 main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.intent" )
YPZhangfebf7302016-05-24 16:45:56 -0700252 # Balance Master
253 main.CLIs[0].balanceMasters()
You Wang0b9039d2017-01-12 16:51:29 -0800254 time.sleep( main.setMasterSleep )
YPZhangfebf7302016-05-24 16:45:56 -0700255 if len(main.ONOSip) > 1:
Chiyu Cheng1976db52016-10-21 15:57:30 -0700256 main.CLIs[0].deviceRole(main.end1[ 'name' ], main.ONOSip[0])
257 main.CLIs[0].deviceRole(main.end2[ 'name' ], main.ONOSip[0])
YPZhang2b9b26d2016-06-20 16:18:29 -0700258 time.sleep( main.setMasterSleep )
cameron@onlab.us78b89652015-07-08 15:21:03 -0700259
260 def CASE2( self, main ):
cameron@onlab.us78b89652015-07-08 15:21:03 -0700261 import time
262 import numpy
263 import datetime
YPZhangfebf7302016-05-24 16:45:56 -0700264 import json
265 # from scipy import stats
cameron@onlab.us78b89652015-07-08 15:21:03 -0700266
YPZhangfebf7302016-05-24 16:45:56 -0700267 print(main.intentsList)
268 for batchSize in main.intentsList:
You Wang0b9039d2017-01-12 16:51:29 -0800269 main.batchSize = batchSize
YPZhangfebf7302016-05-24 16:45:56 -0700270 main.log.report("Intent Batch size: " + str(batchSize) + "\n ")
You Wang6d301d42017-04-21 10:49:33 -0700271 firstLocalLatencies = []
272 lastLocalLatencies = []
273 firstGlobalLatencies = []
274 lastGlobalLatencies = []
275 main.startLine = {}
Chiyu Chengec63bde2016-11-17 18:11:36 -0800276 main.validRun = 0
277 main.invalidRun = 0
You Wang0b9039d2017-01-12 16:51:29 -0800278 while main.validRun <= main.warmUp + main.sampleSize and main.invalidRun <= main.maxInvalidRun:
Chiyu Chengec63bde2016-11-17 18:11:36 -0800279 if main.validRun >= main.warmUp:
YPZhangfebf7302016-05-24 16:45:56 -0700280 main.log.info("================================================")
You Wang6d301d42017-04-21 10:49:33 -0700281 main.log.info("Valid iteration: {} ".format( main.validRun - main.warmUp))
Chiyu Chengec63bde2016-11-17 18:11:36 -0800282 main.log.info("Total iteration: {}".format( main.validRun + main.invalidRun))
YPZhangfebf7302016-05-24 16:45:56 -0700283 main.log.info("================================================")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700284 else:
YPZhangfebf7302016-05-24 16:45:56 -0700285 main.log.info("====================Warm Up=====================")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700286
YPZhangfebf7302016-05-24 16:45:56 -0700287 # push intents
You Wang0b9039d2017-01-12 16:51:29 -0800288 main.CLIs[0].pushTestIntents(main.ingress, main.egress, main.batchSize,
YPZhangfebf7302016-05-24 16:45:56 -0700289 offset=1, options="-i", timeout=main.timeout)
cameron@onlab.us78b89652015-07-08 15:21:03 -0700290
You Wang6d301d42017-04-21 10:49:33 -0700291 # check links, flows and intents
292 main.intentRerouteLatFuncs.sanityCheck( main, main.deviceCount * 2, batchSize * (main.deviceCount - 1 ), main.batchSize )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800293 if not main.verify:
You Wang6d301d42017-04-21 10:49:33 -0700294 main.log.warn( "Sanity check failed, skipping this iteration..." )
295 continue
296
297 # Insert one line in karaf.log before link down
298 for i in range( main.numCtrls ):
299 main.CLIs[ i ].log( "\'Scale: {}, Batch:{}, Iteration: {}\'".format( main.numCtrls, batchSize, main.validRun + main.invalidRun ) )
300
301 # bring link down
Chiyu Cheng1976db52016-10-21 15:57:30 -0700302 main.CLIs[0].link( main.end1[ 'port' ], main.end2[ 'port' ], "down",
YPZhangfebf7302016-05-24 16:45:56 -0700303 timeout=main.timeout, showResponse=False)
You Wang6d301d42017-04-21 10:49:33 -0700304
305 # check links, flows and intents
306 main.intentRerouteLatFuncs.sanityCheck( main, (main.deviceCount - 1) * 2, batchSize * main.deviceCount, main.batchSize )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800307 if not main.verify:
You Wang6d301d42017-04-21 10:49:33 -0700308 main.log.warn( "Sanity check failed, skipping this iteration..." )
309 continue
310
311 # Get timestamp of last LINK_REMOVED event as separator between iterations
312 skip = False
Chiyu Chengec63bde2016-11-17 18:11:36 -0800313 for i in range( main.numCtrls ):
You Wang6d301d42017-04-21 10:49:33 -0700314 logNum = main.intentRerouteLatFuncs.getLogNum( main, i )
315 timestamp = str( main.CLIs[ i ].getTimeStampFromLog( "last", "LINK_REMOVED", "time = ", " ", logNum=logNum ) )
316 if timestamp == main.ERROR:
317 # Try again in case that the log number just increased
318 logNum = main.intentRerouteLatFuncs.getLogNum( main, i )
319 timestamp = str( main.CLIs[ i ].getTimeStampFromLog( "last", "LINK_REMOVED", "time = ", " ", logNum=logNum ) )
320 if timestamp == main.ERROR:
321 main.log.warn( "Cannot find the event we want in the log, skipping this iteration..." )
322 main.intentRerouteLatFuncs.bringBackTopology( main )
323 if main.validRun >= main.warmUp:
324 main.invalidRun += 1
325 else:
326 main.validRun += 1
327 skip = True
328 break
329 else:
330 main.startLine[ i ] = timestamp
331 main.log.info( "Timestamp of last LINK_REMOVED event on node {} is {}".format( i+1, main.startLine[ i ] ) )
332 if skip: continue
333
334 # calculate values
335 topologyTimestamps = main.intentRerouteLatFuncs.getTopologyTimestamps( main )
336 intentTimestamps = main.intentRerouteLatFuncs.getIntentTimestamps( main )
337 if intentTimestamps == main.ERROR or topologyTimestamps == main.ERROR:
338 main.log.info( "Got invalid timestamp, skipping this iteration..." )
339 main.intentRerouteLatFuncs.bringBackTopology( main )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800340 if main.validRun >= main.warmUp:
341 main.invalidRun += 1
YPZhang8742d2e2016-06-16 15:31:58 -0700342 else:
Chiyu Chengec63bde2016-11-17 18:11:36 -0800343 main.validRun += 1
YPZhangfebf7302016-05-24 16:45:56 -0700344 continue
Chiyu Chengec63bde2016-11-17 18:11:36 -0800345 else:
You Wang6d301d42017-04-21 10:49:33 -0700346 main.log.info( "Got valid timestamps" )
347
348 firstLocalLatnecy, lastLocalLatnecy, firstGlobalLatency, lastGlobalLatnecy = main.intentRerouteLatFuncs.calculateLatency( main, topologyTimestamps, intentTimestamps )
349 if firstLocalLatnecy < 0:
350 main.log.info( "Got negative latency, skipping this iteration..." )
351 main.intentRerouteLatFuncs.bringBackTopology( main )
352 if main.validRun >= main.warmUp:
353 main.invalidRun += 1
354 else:
355 main.validRun += 1
356 continue
357 else:
358 main.log.info( "Got valid latencies" )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800359 main.validRun += 1
YPZhangfebf7302016-05-24 16:45:56 -0700360
You Wang6d301d42017-04-21 10:49:33 -0700361 firstLocalLatencies.append( firstLocalLatnecy )
362 lastLocalLatencies.append( lastLocalLatnecy )
363 firstGlobalLatencies.append( firstGlobalLatency )
364 lastGlobalLatencies.append( lastGlobalLatnecy )
365
366 # bring up link and withdraw intents
Chiyu Cheng1976db52016-10-21 15:57:30 -0700367 main.CLIs[0].link( main.end1[ 'port' ], main.end2[ 'port' ], "up",
YPZhangfebf7302016-05-24 16:45:56 -0700368 timeout=main.timeout)
You Wang6d301d42017-04-21 10:49:33 -0700369 main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
370 offset=1, options="-w", timeout=main.timeout)
371 main.CLIs[0].purgeWithdrawnIntents()
372
373 # check links, flows and intents
374 main.intentRerouteLatFuncs.sanityCheck( main, main.deviceCount * 2, 0, 0 )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800375 if not main.verify:
YPZhangfebf7302016-05-24 16:45:56 -0700376 continue
377
You Wang6d301d42017-04-21 10:49:33 -0700378 aveLocalLatency = numpy.average( lastLocalLatencies )
379 aveGlobalLatency = numpy.average( lastGlobalLatencies )
380 stdLocalLatency = numpy.std( lastLocalLatencies )
381 stdGlobalLatency = numpy.std( lastGlobalLatencies )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800382
383 main.log.report( "Scale: " + str( main.numCtrls ) + " \tIntent batch: " + str( batchSize ) )
You Wang6d301d42017-04-21 10:49:33 -0700384 main.log.report( "Local latency average:................" + str( aveLocalLatency ) )
385 main.log.report( "Global latency average:................" + str( aveGlobalLatency ) )
386 main.log.report( "Local latency std:................" + str( stdLocalLatency ) )
387 main.log.report( "Global latency std:................" + str( stdGlobalLatency ) )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800388 main.log.report( "________________________________________________________" )
cameron@onlab.us78b89652015-07-08 15:21:03 -0700389
You Wang6d301d42017-04-21 10:49:33 -0700390 if not ( numpy.isnan( aveLocalLatency ) or numpy.isnan( aveGlobalLatency ) ):
YPZhang8742d2e2016-06-16 15:31:58 -0700391 # check if got NaN for result
You Wang6d301d42017-04-21 10:49:33 -0700392 resultsDB = open( main.dbFileName, "a" )
393 resultsDB.write( "'" + main.commit + "'," )
394 resultsDB.write( str( main.numCtrls ) + "," )
395 resultsDB.write( str( batchSize ) + "," )
396 resultsDB.write( str( aveLocalLatency ) + "," )
397 resultsDB.write( str( stdLocalLatency ) + "\n" )
YPZhang8742d2e2016-06-16 15:31:58 -0700398 resultsDB.close()
You Wang6d301d42017-04-21 10:49:33 -0700399 del main.scale[ 0 ]