blob: 6a7c259fc3c6b3e423c4a85f32c6dd84056887b7 [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
57 main.step("Building ONOS branch: " + gitBranch)
58 stepResult = main.ONOSbench.cleanInstall(skipTest=True)
59 utilities.assert_equals(expect=main.TRUE,
60 actual=stepResult,
61 onpass="Successfully build onos.",
62 onfail="Failed to build onos. Exiting test...")
Chiyu Chengec63bde2016-11-17 18:11:36 -080063 if not stepResult:
64 main.exit()
YPZhangfebf7302016-05-24 16:45:56 -070065
66 else:
67 main.log.warn("Skipped pulling onos and Skipped building ONOS")
Chiyu Chengec63bde2016-11-17 18:11:36 -080068 main.onosIp = main.ONOSbench.getOnosIps()
YPZhangfebf7302016-05-24 16:45:56 -070069 main.apps = main.params['ENV']['cellApps']
70 main.BENCHUser = main.params['BENCH']['user']
71 main.BENCHIp = main.params['BENCH']['ip1']
72 main.MN1Ip = main.params['MN']['ip1']
73 main.maxNodes = int(main.params['max'])
74 main.skipMvn = main.params['TEST']['skipCleanInstall']
75 main.cellName = main.params['ENV']['cellName']
76 main.scale = (main.params['SCALE']).split(",")
YPZhangfebf7302016-05-24 16:45:56 -070077 main.timeout = int(main.params['SLEEP']['timeout'])
78 main.startUpSleep = int(main.params['SLEEP']['startup'])
79 main.installSleep = int(main.params['SLEEP']['install'])
80 main.verifySleep = int(main.params['SLEEP']['verify'])
YPZhang2b9b26d2016-06-20 16:18:29 -070081 main.setMasterSleep = int(main.params['SLEEP']['setmaster'])
YPZhangfebf7302016-05-24 16:45:56 -070082 main.verifyAttempts = int(main.params['ATTEMPTS']['verify'])
You Wang0b9039d2017-01-12 16:51:29 -080083 main.maxInvalidRun = int(main.params['ATTEMPTS']['maxInvalidRun'])
YPZhangfebf7302016-05-24 16:45:56 -070084 main.sampleSize = int(main.params['TEST']['sampleSize'])
85 main.warmUp = int(main.params['TEST']['warmUp'])
YPZhangfebf7302016-05-24 16:45:56 -070086 main.ingress = main.params['TEST']['ingress']
87 main.egress = main.params['TEST']['egress']
88 main.debug = main.params['TEST']['debug']
YPZhange6ef82a2016-07-05 16:48:15 -070089 main.flowObj = main.params['TEST']['flowObj']
Chiyu Cheng1976db52016-10-21 15:57:30 -070090 main.deviceCount = int(main.params['TEST']['deviceCount'])
91 main.end1 = main.params['TEST']['end1']
92 main.end2 = main.params['TEST']['end2']
Chiyu Chengec63bde2016-11-17 18:11:36 -080093 main.searchTerm = main.params['SEARCHTERM']
YPZhange6ef82a2016-07-05 16:48:15 -070094 if main.flowObj == "True":
95 main.flowObj = True
96 main.dbFileName = main.params['DATABASE']['dbFlowObj']
YPZhang3b5a78f2016-07-14 10:43:33 -070097 main.intentsList = (main.params['TEST']['FObjintents']).split(",")
YPZhange6ef82a2016-07-05 16:48:15 -070098 else:
99 main.flowObj = False
100 main.dbFileName = main.params['DATABASE']['dbName']
YPZhang3b5a78f2016-07-14 10:43:33 -0700101 main.intentsList = (main.params['TEST']['intents']).split(",")
YPZhange6ef82a2016-07-05 16:48:15 -0700102
YPZhangfebf7302016-05-24 16:45:56 -0700103 for i in range(0, len(main.intentsList)):
104 main.intentsList[i] = int(main.intentsList[i])
105 # Create DataBase file
106 main.log.info("Create Database file " + main.dbFileName)
107 resultsDB = open(main.dbFileName, "w+")
108 resultsDB.close()
Chiyu Chengec63bde2016-11-17 18:11:36 -0800109 file1 = main.params[ "DEPENDENCY" ][ "FILE1" ]
110 main.dependencyPath = os.path.dirname( os.getcwd() ) + main.params[ "DEPENDENCY" ][ "PATH" ]
111 main.intentRerouteLatFuncs = imp.load_source(file1, main.dependencyPath + file1 + ".py")
112
113 main.record = 0
YPZhangfebf7302016-05-24 16:45:56 -0700114
115 def CASE1( self, main ):
116 '''
117 clean up test environment and set up
118 '''
cameron@onlab.us78b89652015-07-08 15:21:03 -0700119 import time
120
YPZhangfebf7302016-05-24 16:45:56 -0700121 main.log.info("Get ONOS cluster IP")
122 print(main.scale)
123 main.numCtrls = int(main.scale[0])
124 main.ONOSip = []
125 main.maxNumBatch = 0
126 main.AllONOSip = main.ONOSbench.getOnosIps()
127 for i in range(main.numCtrls):
128 main.ONOSip.append(main.AllONOSip[i])
129 main.log.info(main.ONOSip)
130 main.CLIs = []
131 main.log.info("Creating list of ONOS cli handles")
132 for i in range(main.numCtrls):
133 main.CLIs.append(getattr(main, 'ONOS%scli' % (i + 1)))
cameron@onlab.us78b89652015-07-08 15:21:03 -0700134
YPZhangfebf7302016-05-24 16:45:56 -0700135 if not main.CLIs:
136 main.log.error("Failed to create the list of ONOS cli handles")
137 main.cleanup()
138 main.exit()
cameron@onlab.us78b89652015-07-08 15:21:03 -0700139
YPZhangfebf7302016-05-24 16:45:56 -0700140 main.commit = main.ONOSbench.getVersion(report=True)
141 main.commit = main.commit.split(" ")[1]
142 main.log.info("Starting up %s node(s) ONOS cluster" % main.numCtrls)
143 main.log.info("Safety check, killing all ONOS processes" +
144 " before initiating environment setup")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700145
YPZhangfebf7302016-05-24 16:45:56 -0700146 for i in range(main.numCtrls):
You Wangb98a9fa2017-02-15 17:27:42 -0800147 main.ONOSbench.onosStop(main.ONOSip[i])
148 main.ONOSbench.onosKill(main.ONOSip[i])
cameron@onlab.us78b89652015-07-08 15:21:03 -0700149
YPZhangfebf7302016-05-24 16:45:56 -0700150 main.log.info("NODE COUNT = %s" % main.numCtrls)
YPZhangfebf7302016-05-24 16:45:56 -0700151 main.ONOSbench.createCellFile(main.ONOSbench.ip_address,
152 main.cellName,
153 main.MN1Ip,
154 main.apps,
Devin Lim461f0872017-06-05 16:49:33 -0700155 main.ONOSip,
156 main.ONOScli1.user_name)
YPZhangfebf7302016-05-24 16:45:56 -0700157 main.step("Apply cell to environment")
158 cellResult = main.ONOSbench.setCell(main.cellName)
159 verifyResult = main.ONOSbench.verifyCell()
160 stepResult = cellResult and verifyResult
161 utilities.assert_equals(expect=main.TRUE,
162 actual=stepResult,
163 onpass="Successfully applied cell to " + \
164 "environment",
165 onfail="Failed to apply cell to environment ")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700166
YPZhangfebf7302016-05-24 16:45:56 -0700167 main.step("Creating ONOS package")
Jon Hallbd60ea02016-08-23 10:03:59 -0700168 packageResult = main.ONOSbench.buckBuild()
YPZhangfebf7302016-05-24 16:45:56 -0700169 stepResult = packageResult
170 utilities.assert_equals(expect=main.TRUE,
171 actual=stepResult,
172 onpass="Successfully created ONOS package",
173 onfail="Failed to create ONOS package")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700174
YPZhangfebf7302016-05-24 16:45:56 -0700175 main.step("Uninstall ONOS package on all Nodes")
176 uninstallResult = main.TRUE
177 for i in range(int(main.numCtrls)):
178 main.log.info("Uninstalling package on ONOS Node IP: " + main.ONOSip[i])
179 u_result = main.ONOSbench.onosUninstall(main.ONOSip[i])
180 utilities.assert_equals(expect=main.TRUE, actual=u_result,
181 onpass="Test step PASS",
182 onfail="Test step FAIL")
183 uninstallResult = (uninstallResult and u_result)
Jon Hall4ba53f02015-07-29 13:07:41 -0700184
YPZhangfebf7302016-05-24 16:45:56 -0700185 main.step("Install ONOS package on all Nodes")
186 installResult = main.TRUE
187 for i in range(int(main.numCtrls)):
188 main.log.info("Installing package on ONOS Node IP: " + main.ONOSip[i])
189 i_result = main.ONOSbench.onosInstall(node=main.ONOSip[i])
190 utilities.assert_equals(expect=main.TRUE, actual=i_result,
191 onpass="Test step PASS",
192 onfail="Test step FAIL")
193 installResult = installResult and i_result
cameron@onlab.us78b89652015-07-08 15:21:03 -0700194
You Wangf5de25b2017-01-06 15:13:01 -0800195 main.step( "Set up ONOS secure SSH" )
196 secureSshResult = main.TRUE
197 for i in range( int( main.numCtrls ) ):
198 secureSshResult = secureSshResult and main.ONOSbench.onosSecureSSH( node=main.ONOSip[i] )
199 utilities.assert_equals( expect=main.TRUE, actual=secureSshResult,
200 onpass="Test step PASS",
201 onfail="Test step FAIL" )
202
Chiyu Chengec63bde2016-11-17 18:11:36 -0800203 main.step( "Starting ONOS service" )
204 stopResult = main.TRUE
205 startResult = main.TRUE
206 onosIsUp = main.TRUE
Chiyu Chengef109502016-11-21 15:51:38 -0800207
Chiyu Chengec63bde2016-11-17 18:11:36 -0800208 for i in range( main.numCtrls ):
209 onosIsUp = onosIsUp and main.ONOSbench.isup( main.ONOSip[ i ] )
210 if onosIsUp == main.TRUE:
211 main.log.report( "ONOS instance is up and ready" )
212 else:
213 main.log.report( "ONOS instance may not be up, stop and " +
214 "start ONOS again " )
215
216 for i in range( main.numCtrls ):
217 stopResult = stopResult and \
218 main.ONOSbench.onosStop( main.ONOSip[ i ] )
219 for i in range( main.numCtrls ):
220 startResult = startResult and \
221 main.ONOSbench.onosStart( main.ONOSip[ i ] )
222 stepResult = onosIsUp and stopResult and startResult
223 utilities.assert_equals( expect=main.TRUE, actual=stepResult,
224 onpass="Test step PASS",
225 onfail="Test step FAIL" )
You Wangf5de25b2017-01-06 15:13:01 -0800226
You Wang0b9039d2017-01-12 16:51:29 -0800227 time.sleep(main.startUpSleep)
YPZhangfebf7302016-05-24 16:45:56 -0700228 main.step("Start ONOS CLI on all nodes")
229 cliResult = main.TRUE
Jon Hall6509dbf2016-06-21 17:01:17 -0700230 main.step(" Start ONOS cli using thread ")
YPZhangfebf7302016-05-24 16:45:56 -0700231 startCliResult = main.TRUE
232 pool = []
233 main.threadID = 0
234 for i in range(int(main.numCtrls)):
235 t = main.Thread(target=main.CLIs[i].startOnosCli,
236 threadID=main.threadID,
237 name="startOnosCli",
238 args=[main.ONOSip[i]],
239 kwargs={"onosStartTimeout": main.timeout})
240 pool.append(t)
241 t.start()
242 main.threadID = main.threadID + 1
243 for t in pool:
244 t.join()
245 startCliResult = startCliResult and t.result
246 time.sleep(main.startUpSleep)
Jon Hall4ba53f02015-07-29 13:07:41 -0700247
YPZhangfebf7302016-05-24 16:45:56 -0700248 # configure apps
Chiyu Cheng1976db52016-10-21 15:57:30 -0700249 main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "deviceCount", value=main.deviceCount)
YPZhangfebf7302016-05-24 16:45:56 -0700250 main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "topoShape", value="reroute")
251 main.CLIs[0].setCfg("org.onosproject.provider.nil.NullProviders", "enabled", value="true")
YPZhange6ef82a2016-07-05 16:48:15 -0700252 if main.flowObj:
253 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
254 "useFlowObjectives", value="true")
You Wang106d0fa2017-05-15 17:22:15 -0700255 main.CLIs[0].setCfg("org.onosproject.net.intent.impl.compiler.IntentConfigurableRegistrator",
256 "defaultFlowObjectiveCompiler",
257 value='org.onosproject.net.intent.impl.compiler.LinkCollectionIntentObjectiveCompiler')
Chiyu Chengec63bde2016-11-17 18:11:36 -0800258 time.sleep( main.startUpSleep )
259 for i in range( int( main.numCtrls ) ):
260 main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.topology" )
261 main.CLIs[i].logSet( "DEBUG", "org.onosproject.metrics.intent" )
YPZhangfebf7302016-05-24 16:45:56 -0700262 # Balance Master
263 main.CLIs[0].balanceMasters()
You Wang0b9039d2017-01-12 16:51:29 -0800264 time.sleep( main.setMasterSleep )
YPZhangfebf7302016-05-24 16:45:56 -0700265 if len(main.ONOSip) > 1:
Chiyu Cheng1976db52016-10-21 15:57:30 -0700266 main.CLIs[0].deviceRole(main.end1[ 'name' ], main.ONOSip[0])
267 main.CLIs[0].deviceRole(main.end2[ 'name' ], main.ONOSip[0])
YPZhang2b9b26d2016-06-20 16:18:29 -0700268 time.sleep( main.setMasterSleep )
cameron@onlab.us78b89652015-07-08 15:21:03 -0700269
270 def CASE2( self, main ):
cameron@onlab.us78b89652015-07-08 15:21:03 -0700271 import time
272 import numpy
273 import datetime
YPZhangfebf7302016-05-24 16:45:56 -0700274 import json
275 # from scipy import stats
cameron@onlab.us78b89652015-07-08 15:21:03 -0700276
YPZhangfebf7302016-05-24 16:45:56 -0700277 print(main.intentsList)
278 for batchSize in main.intentsList:
You Wang0b9039d2017-01-12 16:51:29 -0800279 main.batchSize = batchSize
YPZhangfebf7302016-05-24 16:45:56 -0700280 main.log.report("Intent Batch size: " + str(batchSize) + "\n ")
You Wang6d301d42017-04-21 10:49:33 -0700281 firstLocalLatencies = []
282 lastLocalLatencies = []
283 firstGlobalLatencies = []
284 lastGlobalLatencies = []
285 main.startLine = {}
Chiyu Chengec63bde2016-11-17 18:11:36 -0800286 main.validRun = 0
287 main.invalidRun = 0
You Wang0b9039d2017-01-12 16:51:29 -0800288 while main.validRun <= main.warmUp + main.sampleSize and main.invalidRun <= main.maxInvalidRun:
Chiyu Chengec63bde2016-11-17 18:11:36 -0800289 if main.validRun >= main.warmUp:
YPZhangfebf7302016-05-24 16:45:56 -0700290 main.log.info("================================================")
You Wang6d301d42017-04-21 10:49:33 -0700291 main.log.info("Valid iteration: {} ".format( main.validRun - main.warmUp))
Chiyu Chengec63bde2016-11-17 18:11:36 -0800292 main.log.info("Total iteration: {}".format( main.validRun + main.invalidRun))
YPZhangfebf7302016-05-24 16:45:56 -0700293 main.log.info("================================================")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700294 else:
YPZhangfebf7302016-05-24 16:45:56 -0700295 main.log.info("====================Warm Up=====================")
cameron@onlab.us78b89652015-07-08 15:21:03 -0700296
YPZhangfebf7302016-05-24 16:45:56 -0700297 # push intents
You Wang0b9039d2017-01-12 16:51:29 -0800298 main.CLIs[0].pushTestIntents(main.ingress, main.egress, main.batchSize,
YPZhangfebf7302016-05-24 16:45:56 -0700299 offset=1, options="-i", timeout=main.timeout)
cameron@onlab.us78b89652015-07-08 15:21:03 -0700300
You Wang6d301d42017-04-21 10:49:33 -0700301 # check links, flows and intents
302 main.intentRerouteLatFuncs.sanityCheck( main, main.deviceCount * 2, batchSize * (main.deviceCount - 1 ), main.batchSize )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800303 if not main.verify:
You Wang6d301d42017-04-21 10:49:33 -0700304 main.log.warn( "Sanity check failed, skipping this iteration..." )
305 continue
306
307 # Insert one line in karaf.log before link down
308 for i in range( main.numCtrls ):
309 main.CLIs[ i ].log( "\'Scale: {}, Batch:{}, Iteration: {}\'".format( main.numCtrls, batchSize, main.validRun + main.invalidRun ) )
310
311 # bring link down
Chiyu Cheng1976db52016-10-21 15:57:30 -0700312 main.CLIs[0].link( main.end1[ 'port' ], main.end2[ 'port' ], "down",
YPZhangfebf7302016-05-24 16:45:56 -0700313 timeout=main.timeout, showResponse=False)
You Wang6d301d42017-04-21 10:49:33 -0700314
315 # check links, flows and intents
316 main.intentRerouteLatFuncs.sanityCheck( main, (main.deviceCount - 1) * 2, batchSize * main.deviceCount, main.batchSize )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800317 if not main.verify:
You Wang6d301d42017-04-21 10:49:33 -0700318 main.log.warn( "Sanity check failed, skipping this iteration..." )
319 continue
320
321 # Get timestamp of last LINK_REMOVED event as separator between iterations
322 skip = False
Chiyu Chengec63bde2016-11-17 18:11:36 -0800323 for i in range( main.numCtrls ):
You Wang6d301d42017-04-21 10:49:33 -0700324 logNum = main.intentRerouteLatFuncs.getLogNum( main, i )
325 timestamp = str( main.CLIs[ i ].getTimeStampFromLog( "last", "LINK_REMOVED", "time = ", " ", logNum=logNum ) )
326 if timestamp == main.ERROR:
327 # Try again in case that the log number just increased
328 logNum = main.intentRerouteLatFuncs.getLogNum( main, i )
329 timestamp = str( main.CLIs[ i ].getTimeStampFromLog( "last", "LINK_REMOVED", "time = ", " ", logNum=logNum ) )
330 if timestamp == main.ERROR:
331 main.log.warn( "Cannot find the event we want in the log, skipping this iteration..." )
332 main.intentRerouteLatFuncs.bringBackTopology( main )
333 if main.validRun >= main.warmUp:
334 main.invalidRun += 1
335 else:
336 main.validRun += 1
337 skip = True
338 break
339 else:
340 main.startLine[ i ] = timestamp
341 main.log.info( "Timestamp of last LINK_REMOVED event on node {} is {}".format( i+1, main.startLine[ i ] ) )
342 if skip: continue
343
344 # calculate values
345 topologyTimestamps = main.intentRerouteLatFuncs.getTopologyTimestamps( main )
346 intentTimestamps = main.intentRerouteLatFuncs.getIntentTimestamps( main )
347 if intentTimestamps == main.ERROR or topologyTimestamps == main.ERROR:
348 main.log.info( "Got invalid timestamp, skipping this iteration..." )
349 main.intentRerouteLatFuncs.bringBackTopology( main )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800350 if main.validRun >= main.warmUp:
351 main.invalidRun += 1
YPZhang8742d2e2016-06-16 15:31:58 -0700352 else:
Chiyu Chengec63bde2016-11-17 18:11:36 -0800353 main.validRun += 1
YPZhangfebf7302016-05-24 16:45:56 -0700354 continue
Chiyu Chengec63bde2016-11-17 18:11:36 -0800355 else:
You Wang6d301d42017-04-21 10:49:33 -0700356 main.log.info( "Got valid timestamps" )
357
358 firstLocalLatnecy, lastLocalLatnecy, firstGlobalLatency, lastGlobalLatnecy = main.intentRerouteLatFuncs.calculateLatency( main, topologyTimestamps, intentTimestamps )
359 if firstLocalLatnecy < 0:
360 main.log.info( "Got negative latency, skipping this iteration..." )
361 main.intentRerouteLatFuncs.bringBackTopology( main )
362 if main.validRun >= main.warmUp:
363 main.invalidRun += 1
364 else:
365 main.validRun += 1
366 continue
367 else:
368 main.log.info( "Got valid latencies" )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800369 main.validRun += 1
YPZhangfebf7302016-05-24 16:45:56 -0700370
You Wang6d301d42017-04-21 10:49:33 -0700371 firstLocalLatencies.append( firstLocalLatnecy )
372 lastLocalLatencies.append( lastLocalLatnecy )
373 firstGlobalLatencies.append( firstGlobalLatency )
374 lastGlobalLatencies.append( lastGlobalLatnecy )
375
376 # bring up link and withdraw intents
Chiyu Cheng1976db52016-10-21 15:57:30 -0700377 main.CLIs[0].link( main.end1[ 'port' ], main.end2[ 'port' ], "up",
YPZhangfebf7302016-05-24 16:45:56 -0700378 timeout=main.timeout)
You Wang6d301d42017-04-21 10:49:33 -0700379 main.CLIs[0].pushTestIntents(main.ingress, main.egress, batchSize,
380 offset=1, options="-w", timeout=main.timeout)
381 main.CLIs[0].purgeWithdrawnIntents()
382
383 # check links, flows and intents
384 main.intentRerouteLatFuncs.sanityCheck( main, main.deviceCount * 2, 0, 0 )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800385 if not main.verify:
YPZhangfebf7302016-05-24 16:45:56 -0700386 continue
387
You Wang6d301d42017-04-21 10:49:33 -0700388 aveLocalLatency = numpy.average( lastLocalLatencies )
389 aveGlobalLatency = numpy.average( lastGlobalLatencies )
390 stdLocalLatency = numpy.std( lastLocalLatencies )
391 stdGlobalLatency = numpy.std( lastGlobalLatencies )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800392
393 main.log.report( "Scale: " + str( main.numCtrls ) + " \tIntent batch: " + str( batchSize ) )
You Wang6d301d42017-04-21 10:49:33 -0700394 main.log.report( "Local latency average:................" + str( aveLocalLatency ) )
395 main.log.report( "Global latency average:................" + str( aveGlobalLatency ) )
396 main.log.report( "Local latency std:................" + str( stdLocalLatency ) )
397 main.log.report( "Global latency std:................" + str( stdGlobalLatency ) )
Chiyu Chengec63bde2016-11-17 18:11:36 -0800398 main.log.report( "________________________________________________________" )
cameron@onlab.us78b89652015-07-08 15:21:03 -0700399
You Wang6d301d42017-04-21 10:49:33 -0700400 if not ( numpy.isnan( aveLocalLatency ) or numpy.isnan( aveGlobalLatency ) ):
YPZhang8742d2e2016-06-16 15:31:58 -0700401 # check if got NaN for result
You Wang6d301d42017-04-21 10:49:33 -0700402 resultsDB = open( main.dbFileName, "a" )
403 resultsDB.write( "'" + main.commit + "'," )
404 resultsDB.write( str( main.numCtrls ) + "," )
405 resultsDB.write( str( batchSize ) + "," )
406 resultsDB.write( str( aveLocalLatency ) + "," )
407 resultsDB.write( str( stdLocalLatency ) + "\n" )
YPZhang8742d2e2016-06-16 15:31:58 -0700408 resultsDB.close()
You Wang6d301d42017-04-21 10:49:33 -0700409 del main.scale[ 0 ]