Fix counters output and some logging
diff --git a/TestON/drivers/common/cli/emulator/remotemininetdriver.py b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
index 0958531..c740651 100644
--- a/TestON/drivers/common/cli/emulator/remotemininetdriver.py
+++ b/TestON/drivers/common/cli/emulator/remotemininetdriver.py
@@ -91,8 +91,9 @@
elif re.search( "found multiple mininet", outputs ):
return main.ERROR
else:
+ # TODO: Parse for failed pings, give some truncated output
main.log.error( "Error, unexpected output in the ping file" )
- #main.log.warn( outputs )
+ main.log.warn( outputs )
return main.TRUE
def pingLong( self, **pingParams ):
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index c7e25e0..41f5d85 100644
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -280,7 +280,11 @@
lvlStr = "--level=" + level
self.handle.sendline( "" )
- self.handle.expect( "onos>" )
+ i = self.handle.expect( [ "onos>", pexpect.TIMEOUT ] )
+ # TODO: look for bash prompt as well
+ if i == 1:
+ self.handle.sendline( "" )
+ self.handle.expect( "onos>" )
self.handle.sendline( "log:log " + lvlStr + " " + cmdStr )
self.handle.expect( "log:log" )
self.handle.expect( "onos>" )
@@ -289,7 +293,10 @@
if re.search( "Error", response ):
return main.FALSE
return main.TRUE
-
+ except pexpect.TIMEOUT:
+ main.log.exception( self.name + ": TIMEOUT exception found" )
+ main.cleanup()
+ main.exit()
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
@@ -3154,7 +3161,6 @@
else:
main.log.error( self.name + ": setTestAdd did not" +
" match expected output" )
- main.log.debug( self.name + " expected: " + pattern )
main.log.debug( self.name + " actual: " + repr( output ) )
return main.ERROR
except AssertionError:
@@ -3442,42 +3448,31 @@
main.cleanup()
main.exit()
- def counters( self ):
+ def counters( self, jsonFormat=True ):
"""
Command to list the various counters in the system.
returns:
- A dict containing the counters in the system with the counter
- names being the keys and the value of the counters being the
- values OR
+ if jsonFormat, a string of the json object returned by the cli
+ command
+ if not jsonFormat, the normal string output of the cli command
None on error
"""
- #FIXME: JSON FORMAT
try:
counters = {}
cmdStr = "counters"
+ if jsonFormat:
+ cmdStr += " -j"
output = self.sendline( cmdStr )
assert "Error executing command" not in output
main.log.info( self.name + ": " + output )
- for line in output.splitlines():
- match = re.search( "name=(\S+) value=(\d+)", line )
- if match:
- key = match.group( 1 )
- value = int( match.group( 2 ) )
- counters[key] = value
- else:
- main.log.error( self.name + ": counters did not match " +
- "expected output" )
- main.log.debug( self.name + " expected: " + pattern )
- main.log.debug( self.name + " actual: " + repr( output ) )
- return None
- return counters
+ return output
except AssertionError:
main.log.error( "Error in processing 'counters' command: " +
str( output ) )
- return main.ERROR
+ return None
except TypeError:
main.log.exception( self.name + ": Object not as expected" )
- return main.ERROR
+ return None
except pexpect.EOF:
main.log.error( self.name + ": EOF exception found" )
main.log.error( self.name + ": " + self.handle.before )
diff --git a/TestON/drivers/common/cli/onosdriver.py b/TestON/drivers/common/cli/onosdriver.py
index 296527d..7298211 100644
--- a/TestON/drivers/common/cli/onosdriver.py
+++ b/TestON/drivers/common/cli/onosdriver.py
@@ -1520,6 +1520,9 @@
def checkLogs( self, onosIp, restart=False):
"""
runs onos-check-logs on the given onos node
+ If restart is True, use the old version of onos-check-logs which
+ does not print the full stacktrace, but shows the entire log file,
+ including across restarts
returns the response
"""
try: