Fix whitespace issues
Change-Id: I7c96843996f4847f9e15022f1dc6cd85e8a092f7
diff --git a/TestON/tests/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
index 81cbf16..439efff 100644
--- a/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPFswitchLat/SCPFswitchLat.py
@@ -37,11 +37,11 @@
testONpath = os.getcwd() #testON/bin
user = main.params[ 'CTRL' ][ 'user' ]
- # -- INIT SECTION, ONLY RUNS ONCE -- #
- if init == False:
+ # -- INIT SECTION, ONLY RUNS ONCE -- #
+ if init == False:
init = True
global clusterCount #number of nodes running
- global scale
+ global scale
global commit
global timeToPost
global runNum
@@ -66,7 +66,7 @@
clusterCount = 0
main.ONOSIp = main.ONOSbench.getOnosIps()
- scale = (main.params[ 'SCALE' ]).split(",")
+ scale = (main.params[ 'SCALE' ]).split(",")
clusterCount = int(scale[0])
#mvn clean install, for debugging set param 'skipCleanInstall' to yes to speed up test
@@ -84,10 +84,10 @@
pullResult = main.TRUE
main.log.info( "Skipped git checkout and pull" )
- main.log.step("Grabbing commit number")
+ main.log.step("Grabbing commit number")
commit = main.ONOSbench.getVersion() ####
commit = (commit.split(" "))[1]
-
+
temp = testONpath.replace("bin","") + "tests/SCPFswitchLat/Dependency/"
main.ONOSbench.copyMininetFile("topo-perf-1sw.py", temp, user, "localhost" )
#main.ONOSbench.handle.expect(":~")
@@ -96,19 +96,19 @@
print switchEventResultPath
fSwitchLog = open(switchEventResultPath, "w+")
fSwitchLog.write("")
- fSwitchLog.close()
+ fSwitchLog.close()
# -- END OF INIT SECTION --#
- main.log.step("Adjusting scale")
+ main.log.step("Adjusting scale")
clusterCount = int(scale[0])
- scale.remove(scale[0])
-
- #kill off all onos processes
+ scale.remove(scale[0])
+
+ #kill off all onos processes
main.log.step("Safety check, killing all ONOS processes before initiating enviornment setup")
for node in range(main.maxNodes):
main.ONOSbench.onosDie(main.ONOSIp[node])
-
+
#Uninstall everywhere
main.log.step( "Cleaning Enviornment..." )
for i in range(main.maxNodes):
@@ -118,24 +118,24 @@
time.sleep(10)
main.ONOSbench.handle.sendline(" ")
main.ONOSbench.handle.expect(":~")
-
+
#construct the cell file
main.log.info("Creating cell file")
cellIp = []
for node in range (clusterCount):
cellIp.append(main.ONOSIp[node])
-
+
main.ONOSbench.createCellFile(main.ONOSbench.ip_address, cellName, MN1Ip, str(Apps), cellIp)
main.step( "Set Cell" )
main.ONOSbench.setCell(cellName)
main.step( "Creating ONOS package" )
- packageResult = main.ONOSbench.onosPackage()
+ packageResult = main.ONOSbench.onosPackage()
main.step( "verify cells" )
verifyCellResult = main.ONOSbench.verifyCell()
-
+
main.step('Starting mininet topology ')
main.Mininet1.startNet()
@@ -151,7 +151,7 @@
main.ONOSbench.handle.expect(":~")
print main.ONOSbench.handle.before
if "nodes=" in main.ONOSbench.handle.before:
- break
+ break
for node in range(clusterCount):
for i in range( 2 ):
@@ -164,26 +164,26 @@
main.log.info("Startup sequence complete")
#time.sleep(20)
-
+
main.step('Start onos cli')
- for i in range(0,clusterCount):
+ for i in range(0,clusterCount):
cli1 = CLIs[i].startOnosCli(main.ONOSIp[i])
main.step( 'Configuring application parameters' )
-
+
configName = 'org.onosproject.net.topology.impl.DefaultTopologyProvider'
configParam = 'maxEvents 1'
main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
configParam = 'maxBatchMs 0'
main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
configParam = 'maxIdleMs 0'
- main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
+ main.ONOSbench.onosCfgSet( main.ONOSIp[0], configName, configParam )
def CASE2(self, main):
print "Cluster size: " + str(clusterCount)
"""
Assign s3 to ONOSbench and measure latency
-
+
There are 4 levels of latency measurements to this test:
1 ) End-to-end measurement: Complete end-to-end measurement
from TCP ( SYN/ACK ) handshake to Graph change
@@ -207,7 +207,7 @@
ONOSUser = main.params['CTRL']['user']
numIter = main.params['TEST']['numIter']
iterIgnore = int(main.params['TEST']['iterIgnore'])
-
+
deviceTimestampKey = main.params['JSON']['deviceTimestamp']
graphTimestampKey = main.params['JSON']['graphTimestamp']
@@ -218,7 +218,7 @@
thresholdObj = thresholdStr.split(',')
thresholdMin = int(thresholdObj[0])
thresholdMax = int(thresholdObj[1])
-
+
# Look for 'role-request' messages,
# which replaces the 'vendor' messages previously seen
# on OVS 2.0.1
@@ -238,7 +238,7 @@
# TCP Syn/Ack -> Feature Reply latency collection for each node
tcpToFeatureLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
# Feature Reply -> Role Request latency collection for each node
- featureToRoleRequestLatNodeIter = numpy.zeros((clusterCount,
+ featureToRoleRequestLatNodeIter = numpy.zeros((clusterCount,
int(numIter)))
# Role Request -> Role Reply latency collection for each node
roleRequestToRoleReplyLatNodeIter = numpy.zeros((clusterCount,
@@ -250,7 +250,7 @@
deviceToGraphLatNodeIter = numpy.zeros((clusterCount,
int(numIter)))
endToEndLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
-
+
# Switch disconnect measurement lists
# Mininet Fin / Ack -> Mininet Ack
finAckTransactionLatNodeIter = numpy.zeros((clusterCount,
@@ -262,7 +262,7 @@
deviceToGraphDiscLatNodeIter = numpy.zeros((clusterCount,
int(numIter)))
endToEndDiscLatNodeIter = numpy.zeros((clusterCount, int(numIter)))
-
+
assertion = main.TRUE
localTime = time.strftime('%x %X')
localTime = localTime.replace('/', '')
@@ -276,7 +276,7 @@
main.log.report('Latency of adding one switch to controller')
main.log.report('First ' + str(iterIgnore) + ' iterations ignored' + ' for jvm warmup time')
main.log.report('Total iterations of test: ' + str(numIter))
-
+
for i in range(0, int(numIter)):
main.log.info('Starting tshark capture')
main.ONOSbench.tsharkGrep(tsharkTcpString, tsharkTcpOutput)
@@ -285,23 +285,23 @@
main.ONOSbench.tsharkGrep(tsharkFeatureReply, tsharkFeatureOutput)
time.sleep(10)
-
+
main.log.info('Assigning s3 to controller')
main.Mininet1.assignSwController(sw='s3',
ip=main.ONOSIp[0])
-
+
jsonStr = []
- for node in range (0, clusterCount):
+ for node in range (0, clusterCount):
metricsSwUp = CLIs[node].topologyEventsMetrics()
jsonStr.append(metricsSwUp)
-
+
time.sleep(10)
main.log.info('Stopping all Tshark processes')
main.ONOSbench.tsharkStop()
-
+
time.sleep(5)
-
+
'''
main.log.info('Copying over tshark files')
os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] +
@@ -321,7 +321,7 @@
tempText = tcpFile.readline()
tempText = tempText.split(' ')
main.log.info('Object read in from TCP capture: ' + str(tempText))
-
+
if len(tempText) > 1:
t0Tcp = float(tempText[1]) * 1000.0
else:
@@ -329,7 +329,7 @@
t0Tcp = 0
assertion = main.FALSE
tcpFile.close()
-
+
# Get Role reply output
ofFile = open(tsharkOfOutput, 'r')
lineOfp = ''
@@ -350,7 +350,7 @@
t0Ofp = 0
assertion = main.FALSE
ofFile.close()
-
+
# Get role request output
roleFile = open(tsharkRoleOutput, 'r')
tempText = roleFile.readline()
@@ -378,7 +378,7 @@
elif tempText[2] != ' ' and float(tempText[2]) > 1400000000.0:
temp = tempText[2]
else:
- temp = 0
+ temp = 0
featureTimestamp = float(temp) * 1000.0
else:
main.log.error('Tshark output file for feature reply' +
@@ -397,33 +397,33 @@
deviceTimestamp = jsonObj[deviceTimestampKey]['value']
else:
main.log.error( "Unexpected JSON object" )
- # If we could not obtain the JSON object,
+ # If we could not obtain the JSON object,
# set the timestamps to 0, which will be
# excluded from the measurement later on
# (realized as invalid)
graphTimestamp = 0
deviceTimestamp = 0
-
+
endToEnd = int(graphTimestamp) - int(t0Tcp)
-
+
# Below are measurement breakdowns of the end-to-end
- # measurement.
+ # measurement.
tcpToFeature = int(featureTimestamp) - int(t0Tcp)
featureToRole = int(roleTimestamp) - int(featureTimestamp)
roleToOfp = float(t0Ofp) - float(roleTimestamp)
ofpToDevice = float(deviceTimestamp) - float(t0Ofp)
- # Timestamps gathered from ONOS are millisecond
+ # Timestamps gathered from ONOS are millisecond
# precision. They are returned as integers, thus no
# need to be more precise than 'int'. However,
- # the processing seems to be mostly under 1 ms,
- # thus this may be a problem point to handle any
+ # the processing seems to be mostly under 1 ms,
+ # thus this may be a problem point to handle any
# submillisecond output that we are unsure of.
# For now, this will be treated as 0 ms if less than 1 ms
deviceToGraph = int(graphTimestamp) - int(deviceTimestamp)
-
+
if endToEnd >= thresholdMin and\
endToEnd < thresholdMax and i >= iterIgnore:
- endToEndLatNodeIter[node][i] = endToEnd
+ endToEndLatNodeIter[node][i] = endToEnd
main.log.info("ONOS "+str(nodeNum)+ " end-to-end: "+
str(endToEnd) + " ms")
else:
@@ -431,10 +431,10 @@
"measurement ignored due to excess in "+
"threshold or premature iteration: ")
main.log.info(str(endToEnd))
-
+
if tcpToFeature >= thresholdMin and\
tcpToFeature < thresholdMax and i >= iterIgnore:
- tcpToFeatureLatNodeIter[node][i] = tcpToFeature
+ tcpToFeatureLatNodeIter[node][i] = tcpToFeature
main.log.info("ONOS "+str(nodeNum)+ " tcp-to-feature: "+
str(tcpToFeature) + " ms")
else:
@@ -445,7 +445,7 @@
if featureToRole >= thresholdMin and\
featureToRole < thresholdMax and i >= iterIgnore:
- featureToRoleRequestLatNodeIter[node][i] = featureToRole
+ featureToRoleRequestLatNodeIter[node][i] = featureToRole
main.log.info("ONOS "+str(nodeNum)+ " feature-to-role: "+
str(featureToRole) + " ms")
else:
@@ -464,10 +464,10 @@
"measurement ignored due to excess in "+
"threshold or premature iteration: ")
main.log.info(str(roleToOfp))
-
+
if ofpToDevice >= thresholdMin and\
ofpToDevice < thresholdMax and i >= iterIgnore:
- roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice
+ roleReplyToDeviceLatNodeIter[node][i] = ofpToDevice
main.log.info("ONOS "+str(nodeNum)+ " reply-to-device: "+
str(ofpToDevice) + " ms")
else:
@@ -489,26 +489,26 @@
"was set to 0 ms because of precision "+
"uncertainty. ")
else:
- main.log.info("ONOS "+str(nodeNum)+
+ main.log.info("ONOS "+str(nodeNum)+
" device-to-graph "+
"measurement ignored due to excess in "+
"threshold or premature iteration: ")
- main.log.info(str(deviceToGraph))
-
+ main.log.info(str(deviceToGraph))
+
# ********************
time.sleep(5)
-
+
# Get device id to remove
deviceIdJsonStr = main.ONOS1cli.devices()
-
+
main.log.info( "Device obj obtained: " + str(deviceIdJsonStr) )
deviceId = json.loads(deviceIdJsonStr)
deviceList = []
for device in deviceId:
deviceList.append(device['id'])
-
- # Measure switch down metrics
+
+ # Measure switch down metrics
# TCP FIN/ACK -> TCP FIN
# TCP FIN -> Device Event
# Device Event -> Graph Event
@@ -516,53 +516,53 @@
# The -A 1 grep option allows us to grab 1 extra line after the
# last tshark output grepped originally
- main.ONOSbench.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput,
+ main.ONOSbench.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput,
grepOptions = '-A 1' )
-
+
time.sleep( 5 )
removeJsonList = []
main.step('Remove switch from controller')
main.Mininet1.deleteSwController('s3')
- firstDevice = deviceList[0]
+ firstDevice = deviceList[0]
time.sleep( 5 )
-
+
# We need to get metrics before removing
# device from the store below.
for node in range(0, clusterCount):
metricsSwDown = CLIs[node].topologyEventsMetrics
jsonStr = metricsSwDown()
- removeJsonList.append( json.loads(jsonStr) )
-
+ removeJsonList.append( json.loads(jsonStr) )
+
main.ONOSbench.tsharkStop()
-
+
main.log.info( "Removing device " +str(firstDevice)+
" from ONOS" )
-
+
#if deviceId:
main.ONOS1cli.deviceRemove(firstDevice)
#main.log.info('Copying over tshark files')
#os.system('scp ' + ONOSUser + '@' + main.ONOSIp[0] + ':' + tsharkFinAckOutput + ' /tmp/')
-
+
time.sleep( 10 )
finAckOutputList = []
with open(tsharkFinAckOutput, 'r') as f:
tempLine = f.readlines()
main.log.info('Object read in from FinAck capture: ' +
"\n".join(tempLine))
-
+
index = 1
for line in tempLine:
obj = line.split(' ')
-
- # There are at least 3 objects in field (valid
+
+ # There are at least 3 objects in field (valid
# tshark output is lengthy)
if len(obj) > 2:
# If first index of object is like an epoch time
if obj[1] != ' ' and float(obj[1]) > 1400000000.0:
- temp = obj[1]
+ temp = obj[1]
elif obj[2] != ' 'and float(obj[2]) > 1400000000.0:
temp = obj[2]
elif obj[3] != ' 'and float(obj[3]) > 1400000000.0:
@@ -582,13 +582,13 @@
tFinAck = 0
tAck = 0
assertion = main.FALSE
-
+
index += 1
# with open() as f takes care of closing file
time.sleep(5)
-
+
for node in range(0, clusterCount):
nodeNum = node+1
jsonObj = removeJsonList[node]
@@ -599,26 +599,26 @@
main.log.info("Device timestamp: "+str(deviceTimestamp))
else:
main.log.error( "Unexpected JSON object" )
- # If we could not obtain the JSON object,
+ # If we could not obtain the JSON object,
# set the timestamps to 0, which will be
# excluded from the measurement later on
# (realized as invalid)
graphTimestamp = 0
deviceTimestamp = 0
-
+
finAckTransaction = float(tAck) - float(tFinAck)
ackToDevice = float(deviceTimestamp) - float(tAck)
deviceToGraph = float(graphTimestamp) - float(deviceTimestamp)
endToEndDisc = int(graphTimestamp) - int(tFinAck)
-
+
if endToEndDisc >= thresholdMin and\
endToEndDisc < thresholdMax and i >= iterIgnore:
endToEndDiscLatNodeIter[node][i] = endToEndDisc
- main.log.info("ONOS "+str(nodeNum) +
+ main.log.info("ONOS "+str(nodeNum) +
"end-to-end disconnection: "+
str(endToEndDisc) + " ms" )
else:
- main.log.info("ONOS " + str(nodeNum) +
+ main.log.info("ONOS " + str(nodeNum) +
" end-to-end disconnection "+
"measurement ignored due to excess in "+
"threshold or premature iteration: ")
@@ -626,7 +626,7 @@
if finAckTransaction >= thresholdMin and\
finAckTransaction < thresholdMax and i >= iterIgnore:
- finAckTransactionLatNodeIter[node][i] = finAckTransaction
+ finAckTransactionLatNodeIter[node][i] = finAckTransaction
main.log.info("ONOS "+str(nodeNum)+
" fin/ack transaction: "+
str(finAckTransaction) + " ms")
@@ -674,12 +674,12 @@
roleToOfpList = []
ofpToDeviceList = []
deviceToGraphList = []
-
+
finAckTransactionList = []
ackToDeviceList = []
deviceToGraphDiscList = []
endToEndDiscList = []
-
+
# LatNodeIter 2d arrays contain all iteration latency
# for each node of the current scale cluster size
# Switch connection measurements
@@ -704,7 +704,7 @@
for item in roleReplyToDeviceLatNodeIter[node]:
if item >= 0.0:
ofpToDeviceList.append(item)
-
+
for item in featureToRoleRequestLatNodeIter[node]:
if item > 0.0:
featureToRoleList.append(item)
@@ -717,7 +717,7 @@
for item in endToEndDiscLatNodeIter[node]:
if item > 0.0:
endToEndDiscList.append(item)
-
+
for item in finAckTransactionLatNodeIter[node]:
if item > 0.0:
finAckTransactionList.append(item)
@@ -738,13 +738,13 @@
featureToRoleAvg = round(numpy.mean(featureToRoleList), 2)
featureToRoleStdDev = round(numpy.std(featureToRoleList), 2)
-
+
roleToOfpAvg = round(numpy.mean(roleToOfpList), 2)
roleToOfpStdDev = round(numpy.std(roleToOfpList), 2)
ofpToDeviceAvg = round(numpy.mean(ofpToDeviceList), 2)
ofpToDeviceStdDev = round(numpy.std(ofpToDeviceList), 2)
-
+
deviceToGraphAvg = round(numpy.mean(deviceToGraphList), 2)
deviceToGraphStdDev = round(numpy.std(deviceToGraphList), 2)
@@ -753,55 +753,55 @@
finAckAvg = round(numpy.mean(finAckTransactionList), 2)
finAckStdDev = round(numpy.std(finAckTransactionList), 2)
-
+
ackToDeviceAvg = round(numpy.mean(ackToDeviceList), 2)
ackToDeviceStdDev = round(numpy.std(ackToDeviceList), 2)
-
+
deviceToGraphDiscAvg = round(numpy.mean(deviceToGraphDiscList), 2)
deviceToGraphDiscStdDev = round(numpy.std(deviceToGraphDiscList), 2)
main.log.report(' - Node ' + str(node + 1) + ' Summary - ')
main.log.report(' - Switch Connection Statistics - ')
-
+
main.log.report(' End-to-end Avg: ' + str(endToEndAvg) +
' ms' + ' End-to-end Std dev: ' +
str(endToEndStdDev) + ' ms')
-
+
main.log.report(' Tcp-to-feature-reply Avg: ' +
str(tcpToFeatureAvg) + ' ms')
main.log.report(' Tcp-to-feature-reply Std dev: '+
str(tcpToFeatureStdDev) + ' ms')
-
+
main.log.report(' Feature-reply-to-role-request Avg: ' +
str(featureToRoleAvg) + ' ms')
main.log.report(' Feature-reply-to-role-request Std Dev: ' +
str(featureToRoleStdDev) + ' ms')
-
+
main.log.report(' Role-request-to-role-reply Avg: ' +
str(roleToOfpAvg) +' ms')
main.log.report(' Role-request-to-role-reply Std dev: ' +
str(roleToOfpStdDev) + ' ms')
-
+
main.log.report(' Role-reply-to-device Avg: ' +
str(ofpToDeviceAvg) +' ms')
main.log.report(' Role-reply-to-device Std dev: ' +
str(ofpToDeviceStdDev) + ' ms')
-
+
main.log.report(' Device-to-graph Avg: ' +
str(deviceToGraphAvg) + ' ms')
main.log.report( 'Device-to-graph Std dev: ' +
str(deviceToGraphStdDev) + ' ms')
-
+
main.log.report(' - Switch Disconnection Statistics - ')
- main.log.report(' End-to-end switch disconnect Avg: ' +
+ main.log.report(' End-to-end switch disconnect Avg: ' +
str(endToEndDiscAvg) + ' ms')
main.log.report(' End-to-end switch disconnect Std dev: ' +
str(endToEndDiscStdDev) + ' ms')
main.log.report(' Fin/Ack-to-Ack Avg: ' + str(finAckAvg) + ' ms')
main.log.report(' Fin/Ack-to-Ack Std dev: ' +
str(finAckStdDev) + ' ms')
-
- main.log.report(' Ack-to-device Avg: ' + str(ackToDeviceAvg) +
+
+ main.log.report(' Ack-to-device Avg: ' + str(ackToDeviceAvg) +
' ms')
main.log.report(' Ack-to-device Std dev: ' + str(ackToDeviceStdDev) +
' ms')
@@ -815,8 +815,8 @@
dbCmdList.append(
"INSERT INTO switch_latency_details VALUES('" +
timeToPost + "','switch_latency_results'," +
- jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" +
- str(node + 1) + "'," +
+ jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" +
+ str(node + 1) + "'," +
str(endToEndAvg) + ',' +
str(tcpToFeatureAvg) + ',' +
str(featureToRoleAvg) + ',' +
@@ -826,7 +826,7 @@
str(endToEndDiscAvg) + ',' +
str(finAckAvg) + ',' +
str(ackToDeviceAvg) + ',' +
- str(deviceToGraphDiscAvg) +
+ str(deviceToGraphDiscAvg) +
');')
if debugMode == 'on':
@@ -836,13 +836,13 @@
for line in dbCmdList:
if line:
fResult.write(line + '\n')
- main.log.report(line)
+ main.log.report(line)
fResult.close()
-
+
assertion = main.TRUE
-
+
utilities.assert_equals(expect=main.TRUE, actual=assertion,
- onpass='Switch latency test successful',
+ onpass='Switch latency test successful',
onfail='Switch latency test failed')
main.Mininet1.stopNet()