blob: 22d3f616a0e90774eb837943364712464431ce16 [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.us484ef832015-05-29 16:08:27 -04005def checkOnosLog( nodeIp, option='',
andrew@onlab.us9da18f22015-05-28 21:10:24 -04006 outputType=0):
7 """
andrew@onlab.us484ef832015-05-29 16:08:27 -04008 Listens to the log for any Errors and Exceptions.
andrew@onlab.us9da18f22015-05-28 21:10:24 -04009
10 Runs 'onos-check-logs <option>'
andrew@onlab.us484ef832015-05-29 16:08:27 -040011 This script only returns if there are any errors
12 or exceptions
13
andrew@onlab.us9da18f22015-05-28 21:10:24 -040014 outputType
15 0: Return output of log
16 1: Return (#Errors, #Exceptions, #Warn)
17
18 """
andrew@onlab.us9da18f22015-05-28 21:10:24 -040019 if not isinstance( option, basestring ):
20 main.log.error( 'Incorrect grep format specified' )
21 return main.FALSE
22
23 try:
andrew@onlab.us484ef832015-05-29 16:08:27 -040024 main.log.info( 'Starting Onos-log listening for '+
25 str(option) )
26 cmd = 'onos-check-logs ' + str(nodeIp) + ' old'
andrew@onlab.us9da18f22015-05-28 21:10:24 -040027 if outputType == 0:
andrew@onlab.us484ef832015-05-29 16:08:27 -040028 main.ONOSbench.handle.sendline( cmd )
29 main.ONOSbench.handle.expect( cmd )
30 main.ONOSbench.handle.expect('\$')
31 logResult = main.ONOSbench.handle.before
andrew@onlab.us9da18f22015-05-28 21:10:24 -040032 return logResult
33 elif outputType == 1:
34 # Important in assertion criteria
35 # to determine how much warn / error is
36 # acceptable
37 return 'Implement option 1'
38 else:
39 main.log.error( 'Incorrect outputType specified' )
40 return main.FALSE
41
42 except Exception:
43 main.log.exception( self.name + ': Uncaught exception' )
44 main.cleanup()
45 main.exit()
46
47def setLogLevel( level ):
48 """
49 Set the log level of onos
50 """
51 main.log.info( 'setLogLevel implement me' )
52
andrew@onlab.us484ef832015-05-29 16:08:27 -040053def getLogReport( nodeIp, searchTerms ):
54 """
55 Refer to CLI driver for 'logReport'
56 """
57 main.log.info( 'getLogReport - implement me!' )