Merge branch 'master' of https://github.com/opennetworkinglab/ONLabTest
diff --git a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params
new file mode 100644
index 0000000..ab215e9
--- /dev/null
+++ b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.params
@@ -0,0 +1,96 @@
+<PARAMS>
+ <testcases>1,2,3,4,2,3,4,2,3,4,2,3</testcases>
+
+ <ENV>
+ <cellName>topo_perf_test</cellName>
+ <cellFeatures>"org.onosproject.metrics,org.onosproject.openflow"</cellFeatures>
+ </ENV>
+
+ <GIT>
+ #autoPull 'on' or 'off'
+ <autoPull>off</autoPull>
+ <checkout>master</checkout>
+ </GIT>
+
+ <CTRL>
+ <user>sdn</user>
+ <ip1>10.254.1.201</ip1>
+ <port1>6633</port1>
+ <ip2>10.254.1.202</ip2>
+ <port2>6633</port2>
+ <ip3>10.254.1.203</ip3>
+ <port3>6633</port3>
+ <ip4>10.254.1.204</ip4>
+
+ <ip5>10.254.1.205</ip5>
+ <ip6>10.254.1.206</ip6>
+ <ip7>10.254.1.207</ip7>
+ </CTRL>
+
+ <MN>
+ <ip1>10.254.1.200</ip1>
+ <ip2>10.254.1.200</ip2>
+ </MN>
+
+ <BENCH>
+ <ip>10.254.1.200</ip>
+ </BENCH>
+
+ <TSHARK>
+ <ofpPortStatus>OF 1.3 146</ofpPortStatus>
+ <ofpRoleReply>OF 1.3 90 of_role_reply</ofpRoleReply>
+ <featureReply>OF 1.3 98 of_features_reply</featureReply>
+ <roleRequest>OF 1.3 90 of_role_request</roleRequest>
+ <tcpSynAck>TCP 74 6633</tcpSynAck>
+ <finAckSequence>FIN</finAckSequence>
+ </TSHARK>
+
+ <TEST>
+ #'on' or 'off' debug mode.
+ #If on, logging will be more verbose and
+ #tshark pcap will be enabled
+ #pcap file located at /tmp/'capture_name'
+ <debugMode>off</debugMode>
+ <onosLogFile>/opt/onos/log/karaf*</onosLogFile>
+ <mci>off</mci>
+
+ <topoConfigFile>
+ single_topo_event_accumulator.cfg
+ </topoConfigFile>
+ <topoConfigName>
+ org.onlab.onos.net.topology.impl.DefaultTopologyProvider.cfg
+ </topoConfigName>
+
+ #Number of times to iterate each case
+ <numIter>35</numIter>
+ <numSwitch>2</numSwitch>
+ #Number of iterations to ignore initially
+ <iterIgnore>2</iterIgnore>
+
+ <singleSwThreshold>0,1000</singleSwThreshold>
+ <portUpThreshold>0,1000</portUpThreshold>
+ <portDownThreshold>0,1000</portDownThreshold>
+ <linkUpThreshold>0,10000</linkUpThreshold>
+ <linkDownThreshold>0,10000</linkDownThreshold>
+ <swDisc100Threshold>0,10000</swDisc100Threshold>
+
+ <tabletFile>tablets_3node.json</tabletFile>
+ </TEST>
+
+ <DB>
+ <postToDB>on</postToDB>
+ <portEventResultPath>
+ /home/admin/ONLabTest/TestON/tests/TopoPerfNextBM/portEventResultDb.log
+ </portEventResultPath>
+ <switchEventResultPath>
+ /home/admin/ONLabTest/TestON/tests/TopoPerfNextBM/switchEventResultDb.log
+ </switchEventResultPath>
+ </DB>
+
+ <JSON>
+ <deviceTimestamp>topologyDeviceEventTimestamp</deviceTimestamp>
+ <hostTimestamp>topologyHostEventTimestamp</hostTimestamp>
+ <linkTimestamp>topologyLinkEventTimestamp</linkTimestamp>
+ <graphTimestamp>topologyGraphEventTimestamp</graphTimestamp>
+ </JSON>
+</PARAMS>
diff --git a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
index e73c588..8060607 100644
--- a/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
+++ b/TestON/tests/TopoPerfNextBM/TopoPerfNextBM.py
@@ -17,15 +17,34 @@
global clusterCount
global timeToPost
global runNum
+ global jenkinsBuildNumber
import time
+ import os
+
clusterCount = 1
timeToPost = time.strftime('%Y-%m-%d %H:%M:%S')
runNum = time.strftime('%d%H%M%S')
cellName = main.params['ENV']['cellName']
gitPull = main.params['GIT']['autoPull']
checkoutBranch = main.params['GIT']['checkout']
-
+
+ # Get jenkins build number from environment.
+ # This environment variable will only exist when
+ # triggered by a jenkins job
+ try:
+ jenkinsBuildNumber = str(os.environ['BUILD_NUMBER'])
+ main.log.report( 'Jenkins build number: ' +
+ jenkinsBuildNumber )
+ except KeyError:
+ # Jenkins build number is also used in posting to DB
+ # If this test is not triggered by jenkins, give
+ # it the runNum variable instead, ensuring that
+ # the DB post will recognize it as a non-jenkins run
+ jenkinsBuildNumber = str(runNum)
+ main.log.info( 'Job is not run by jenkins. '+
+ 'Build number set to: ' + jenkinsBuildNumber)
+
global CLIs
CLIs = []
global nodes
@@ -159,7 +178,7 @@
import requests
import os
import numpy
-
+
ONOSUser = main.params['CTRL']['user']
defaultSwPort = main.params['CTRL']['port1']
numIter = main.params['TEST']['numIter']
@@ -464,6 +483,8 @@
# Device Event -> Graph Event
# Capture switch down FIN / ACK packets
+ # The -A 1 grep option allows us to grab 1 extra line after the
+ # last tshark output grepped originally
main.ONOS1.tsharkGrep( tsharkFinAckSequence, tsharkFinAckOutput,
grepOptions = '-A 1' )
@@ -721,7 +742,7 @@
dbCmdList.append(
"INSERT INTO switch_latency_tests VALUES('" +
timeToPost + "','switch_latency_results'," +
- runNum + ',' + str(clusterCount) + ",'baremetal" +
+ jenkinsBuildNumber + ',' + str(clusterCount) + ",'baremetal" +
str(node + 1) + "'," + str(endToEndAvg) + ',' +
str(endToEndStdDev) + ',0,0);')
@@ -1061,7 +1082,7 @@
str(portDownLinkAvg) + ' ms')
dbCmdList.append("INSERT INTO port_latency_tests VALUES('" +
- timeToPost + "','port_latency_results'," + runNum +
+ timeToPost + "','port_latency_results'," + jenkinsBuildNumber +
',' + str(clusterCount) + ",'baremetal" + str(node + 1) +
"'," + str(portUpGraphAvg) + ',' + str(portUpStdDev) +
'' + str(portDownGraphAvg) + ',' + str(portDownStdDev) + ');')