blob: b4558b59a04172f77dc164d04e305eaed44e54c7 [file] [log] [blame]
andrew@onlab.us9da18f22015-05-28 21:10:24 -04001
andrew@onlab.us9da18f22015-05-28 21:10:24 -04002def __init__( self ):
3 self.ip = '127.0.0.1'
4
andrew@onlab.usd2d36fc2015-05-29 14:27:54 -04005def getOnosLog( nodeIp, option='grep \'ERROR\' \| \'WARN\'',
andrew@onlab.us9da18f22015-05-28 21:10:24 -04006 outputType=0):
7 """
8 Specify grep command to listen for in onos log
9
10 Runs 'onos-check-logs <option>'
11
12 outputType
13 0: Return output of log
14 1: Return (#Errors, #Exceptions, #Warn)
15
16 """
17 main.log.info( 'Starting Onos-log listening for '+str(option) )
18 if not isinstance( option, basestring ):
19 main.log.error( 'Incorrect grep format specified' )
20 return main.FALSE
21
22 try:
23 cmd = 'onos-check-logs ' + str(nodeIp) + ' | ' + option
24 if outputType == 0:
25 logResult = main.ONOSnode[0].handle.sendline( cmd )
26 return logResult
27 elif outputType == 1:
28 # Important in assertion criteria
29 # to determine how much warn / error is
30 # acceptable
31 return 'Implement option 1'
32 else:
33 main.log.error( 'Incorrect outputType specified' )
34 return main.FALSE
35
36 except Exception:
37 main.log.exception( self.name + ': Uncaught exception' )
38 main.cleanup()
39 main.exit()
40
41def setLogLevel( level ):
42 """
43 Set the log level of onos
44 """
45 main.log.info( 'setLogLevel implement me' )
46
47