log function now returns int
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 6432e88..fdc511f 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1939,7 +1939,11 @@
ONOSIps = []
try:
- ipFile = open("myIps","r+")
+ if os.path.exists("myIps"):
+ ipFile = open("myIps","r+")
+ else:
+ ipFile = open("myIps","w+")
+
fileONOSIps = ipFile.readlines()
ipFile.close()
@@ -2000,10 +2004,12 @@
- output modes:
"s" - Simple. Quiet output mode that just prints
- the occurances of each search term
+ the occurences of each search term
- "d" - Detailed. Prints occurances as well as the entire
- line for each of the last 5 occurances
+ "d" - Detailed. Prints number of occurences as well as the entire
+ line for each of the last 5 occurences
+
+ - returns total of the number of instances of all search terms
'''
main.log.info("========================== Log Report ===========================\n")
@@ -2015,7 +2021,7 @@
for term in range(len(searchTerms)):
logLines[term][0] = searchTerms[term]
-
+ totalHits = 0
for term in range(len(searchTerms)):
cmd = "onos-ssh " + nodeIp + " cat /opt/onos/log/karaf.log | grep " + searchTerms[term]
self.handle.sendline(cmd)
@@ -2033,7 +2039,8 @@
main.log.info( str(count[0]) + ": " + str(count[1]) )
if term == len(searchTerms)-1:
print("\n")
-
+ totalHits += int(count[1])
+
if outputMode != "s" and outputMode != "S":
outputString = ""
for i in logLines:
@@ -2045,5 +2052,4 @@
main.log.info(outputString)
main.log.info("================================================================\n")
-
-
+ return totalHits