Merge "new startup changes"
diff --git a/TestON/core/teston.py b/TestON/core/teston.py
index 8eea845..e4dbf9d 100644
--- a/TestON/core/teston.py
+++ b/TestON/core/teston.py
@@ -93,6 +93,7 @@
self.Thread = Thread
self.cleanupFlag = False
self.cleanupLock = threading.Lock()
+ self.initiated = False
self.configparser()
verifyOptions(options)
@@ -151,6 +152,7 @@
This method will initialize specified component
'''
global driver_options
+ self.initiated = False
self.log.info("Creating component Handle: "+component)
driver_options = {}
if 'COMPONENTS' in self.componentDictionary[component].keys():
@@ -176,6 +178,7 @@
self.exit()
vars(self)[component] = driverObject
+ self.initiated = True
def run(self):
'''
@@ -353,7 +356,8 @@
try:
if self.cleanupFlag is False: # First thread to run this
self.cleanupFlag = True
- self.logger.testSummary(self)
+ if self.initiated:
+ self.logger.testSummary(self)
for component in self.componentDictionary.keys():
try :
tempObject = vars(self)[component]
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 870293d..2f8bd47 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -2578,14 +2578,6 @@
Optional argument:
* jsonFormat - boolean indicating if you want output in json
"""
- # FIXME: add json output
- # Sample JSON
- # {
- # "electedTime": "13m ago",
- # "epoch": 4,
- # "leader": "10.128.30.17",
- # "topic": "intent-partition-3"
- # },
try:
cmdStr = "onos:leaders"
if jsonFormat:
@@ -2605,6 +2597,63 @@
main.cleanup()
main.exit()
+ def leaderCandidates( self, jsonFormat=True ):
+ """
+ Returns the output of the leaders -c command.
+ Optional argument:
+ * jsonFormat - boolean indicating if you want output in json
+ """
+ try:
+ cmdStr = "onos:leaders -c"
+ if jsonFormat:
+ cmdStr += " -j"
+ output = self.sendline( cmdStr )
+ return output
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
+ def specificLeaderCandidate(self,topic):
+ """
+ Returns a list in format [leader,candidate1,candidate2,...] for a given
+ topic parameter and an empty list if the topic doesn't exist
+ If no leader is elected leader in the returned list will be "none"
+ Returns None if there is a type error processing the json object
+ """
+ try:
+ cmdStr = "onos:leaders -c -j"
+ output = self.sendline( cmdStr )
+ output = json.loads(output)
+ results = []
+ for dict in output:
+ if dict["topic"] == topic:
+ leader = dict["leader"]
+ candidates = re.split(", ",dict["candidates"][1:-1])
+ results.append(leader)
+ results.extend(candidates)
+ return results
+ except TypeError:
+ main.log.exception( self.name + ": Object not as expected" )
+ return None
+ except pexpect.EOF:
+ main.log.error( self.name + ": EOF exception found" )
+ main.log.error( self.name + ": " + self.handle.before )
+ main.cleanup()
+ main.exit()
+ except Exception:
+ main.log.exception( self.name + ": Uncaught exception!" )
+ main.cleanup()
+ main.exit()
+
def pendingMap( self, jsonFormat=True ):
"""
Returns the output of the intent Pending map.
@@ -3511,7 +3560,7 @@
except AssertionError:
main.log.error( "Error in processing 'set-test-get' command: " +
str( output ) )
- return None
+ return None
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
return None
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 8a87a49..37d55fe 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -115,15 +115,13 @@
pwd=self.pwd,
home=self.home )
- self.handle.sendline( "cd " + self.home )
- self.handle.expect( "\$" )
-
if self.handle:
+ self.handle.sendline( "cd " + self.home )
+ self.handle.expect( "\$" )
return self.handle
else:
- main.log.info( "NO ONOS HANDLE" )
+ main.log.info( "Failed to create ONOS handle" )
return main.FALSE
-
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/drivers/component.py b/TestON/drivers/component.py
index f05be55..9199a4e 100644
--- a/TestON/drivers/component.py
+++ b/TestON/drivers/component.py
@@ -45,9 +45,8 @@
return getattr( self.wrapped, name )
except AttributeError as error:
# NOTE: The first time we load a driver module we get this error
- if "'module' object has no attribute '__path__'" in error\
- and self.count == 0:
- self.count += 1
+ if "'module' object has no attribute '__path__'" in error:
+ pass
else:
main.log.error( str(error.__class__) + " " + str(error) )
try:
diff --git a/TestON/tests/SCPFcbench/README b/TestON/tests/SCPFcbench/README
new file mode 100644
index 0000000..755caf1
--- /dev/null
+++ b/TestON/tests/SCPFcbench/README
@@ -0,0 +1,4 @@
+Summary: This is a performance test suite to test onos single instance with Cbench TP mode.
+Pre-requisites: OC1 - is the single onos cell also has cbench pre-installed for all users;
+ this env variable is required on the TestStation. Passwordless login is set
+ from TestStation "admin" root user.
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.params b/TestON/tests/SCPFcbench/SCPFcbench.params
index 8a11b56..3e92294 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.params
+++ b/TestON/tests/SCPFcbench/SCPFcbench.params
@@ -33,6 +33,10 @@
<user>admin</user>
<ip1>localhost</ip1>
</BENCH>
+
+ <CBENCH>
+ <user>sdn</user>
+ </CBENCH>
<JSON>
</JSON>
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.py b/TestON/tests/SCPFcbench/SCPFcbench.py
index 79cdce2..fd15862 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.py
+++ b/TestON/tests/SCPFcbench/SCPFcbench.py
@@ -19,6 +19,8 @@
import time
import os
global init
+ main.case("pre-condition for cbench test.")
+
try:
if type(init) is not bool:
init = False
@@ -30,7 +32,8 @@
gitPull = main.params[ 'GIT' ][ 'autopull' ]
BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
BENCHUser = main.params[ 'BENCH' ][ 'user' ]
- MN1Ip = main.params[ 'MN' ][ 'ip1' ]
+ CBENCHuser = main.params[ 'CBENCH'][ 'user' ]
+ MN1Ip = os.environ[ main.params[ 'MN' ][ 'ip1' ] ]
maxNodes = int(main.params[ 'availableNodes' ])
skipMvn = main.params[ 'TEST' ][ 'skipCleanInstall' ]
cellName = main.params[ 'ENV' ][ 'cellName' ]
@@ -91,7 +94,7 @@
print "Cellname is: "+ cellName + "ONOS IP is: " + str(ONOSIp)
- main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,"drivers,openflow,fwd",ONOSIp[1])
+ main.ONOSbench.createCellFile(BENCHIp,cellName,MN1Ip,"drivers,openflow,fwd",[ONOSIp[1]])
main.step( "Set Cell" )
main.ONOSbench.setCell(cellName)
@@ -106,7 +109,7 @@
main.step( "verify cells" )
verifyCellResult = main.ONOSbench.verifyCell()
- main.log.report( "Initializeing " + str( clusterCount ) + " node cluster." )
+ main.log.report( "Initializing " + str( clusterCount ) + " node cluster." )
for node in range(1, clusterCount + 1):
main.log.info("Starting ONOS " + str(node) + " at IP: " + ONOSIp[node])
main.ONOSbench.onosInstall( ONOSIp[node])
@@ -129,23 +132,31 @@
check = main.ONOSbench.handle.before
if "value=true" in check:
main.log.info("cfg set successful")
+ stepResult = main.TRUE
break
if i == 4:
- main.log.info("Cfg set failed")
+ main.log.info("Cfg set failed")
+ stepResult = main.FALSE
else:
time.sleep(5)
-
+
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully configure onos for cbench test ",
+ onfail="Failed to configure onos for cbench test" )
def CASE2( self, main ):
-
+ main.case("Running Cbench")
+ main.step("Issuing cbench commands and grab returned results")
+ validFlag = False
mode = main.params[ 'TEST' ][ 'mode' ]
if mode != "t":
mode = " "
- runCbench = ( "ssh admin@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
+ runCbench = ( "ssh " + CBENCHuser + "@" + ONOSIp[1] + " cbench -c localhost -p 6633 -m 1000 -l 25 -s 16 -M 100000 -w 15 -D 10000 -" + mode )
main.ONOSbench.handle.sendline(runCbench)
time.sleep(30)
main.ONOSbench.handle.expect(":~")
@@ -154,43 +165,52 @@
output = output.splitlines()
for line in output:
- if "RESULT: " in line:
+ if "RESULT: " in line:
+ validFlag = True
print line
- break
-
- resultLine = line.split(" ")
- for word in resultLine:
- if word == "min/max/avg/stdev":
- resultsIndex = resultLine.index(word)
- print resultsIndex
- break
+ resultLine = line.split(" ")
+ for word in resultLine:
+ if word == "min/max/avg/stdev":
+ resultsIndex = resultLine.index(word)
+ print resultsIndex
+ break
- finalDataString = resultLine[resultsIndex + 2]
- print finalDataString
- finalDataList = finalDataString.split("/")
- avg = finalDataList[2]
- stdev = finalDataList[3]
+ finalDataString = resultLine[resultsIndex + 2]
+ print finalDataString
+ finalDataList = finalDataString.split("/")
+ avg = finalDataList[2]
+ stdev = finalDataList[3]
- main.log.info("Average: \t\t\t" + avg)
- main.log.info("Standard Deviation: \t" + stdev)
+ main.log.info("Average: \t\t\t" + avg)
+ main.log.info("Standard Deviation: \t" + stdev)
+
- if mode == " ":
- mode = "l"
+ commit = main.ONOSbench.getVersion()
+ commit = (commit.split(" "))[1]
- commit = main.ONOSbench.getVersion()
- commit = (commit.split(" "))[1]
+ try:
+ dbFileName="/tmp/CbenchDB"
+ dbfile = open(dbFileName, "w+")
+ temp = "'" + commit + "',"
+ temp += "'" + mode + "',"
+ temp += "'" + avg + "',"
+ temp += "'" + stdev + "'\n"
+ dbfile.write(temp)
+ dbfile.close()
+ main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
+ except IOError:
+ main.log.warn("Error opening " + dbFileName + " to write results.")
+
+ stepResult = main.TRUE
+ break
+ if ( validFlag == False ):
+ main.log.warn("Cbench Test produced no valid results!!!!")
+ stepResult = main.FALSE
- dbfile = open("CbenchDB", "w+")
- temp = "'" + commit + "',"
- temp += "'" + mode + "',"
- temp += "'" + avg + "',"
- temp += "'" + stdev + "'\n"
- dbfile.write(temp)
- dbfile.close()
- main.ONOSbench.logReport(ONOSIp[1], ["ERROR", "WARNING", "EXCEPT"], outputMode="d")
-
-
-
+ utilities.assert_equals( expect=main.TRUE,
+ actual=stepResult,
+ onpass="Successfully tested onos for cbench. ",
+ onfail="Failed to obtain valid onos cbench result!" )
diff --git a/TestON/tests/SCPFcbench/SCPFcbench.topo b/TestON/tests/SCPFcbench/SCPFcbench.topo
index cae9c93..7299023 100644
--- a/TestON/tests/SCPFcbench/SCPFcbench.topo
+++ b/TestON/tests/SCPFcbench/SCPFcbench.topo
@@ -5,25 +5,19 @@
<ONOSbench>
<host>localhost</host>
<user>admin</user>
- <password>onos_test</password>
+ <password></password>
<type>OnosDriver</type>
<connect_order>1</connect_order>
- <COMPONENTS><home>~/onos</home></COMPONENTS>
+ <COMPONENTS>
+ <home>~/onos</home>
+ <nodes>1</nodes>
+ </COMPONENTS>
</ONOSbench>
- <ONOS1cli>
- <host>OCN</host>
- <user>admin</user>
- <password>onos_test</password>
- <type>OnosCliDriver</type>
- <connect_order>2</connect_order>
- <COMPONENTS> </COMPONENTS>
- </ONOS1cli>
-
<ONOS1>
<host>OC1</host>
<user>sdn</user>
- <password>rocks</password>
+ <password></password>
<type>OnosDriver</type>
<connect_order>9</connect_order>
<COMPONENTS> </COMPONENTS>