andrew@onlab.us | 9da18f2 | 2015-05-28 21:10:24 -0400 | [diff] [blame] | 1 | |
andrew@onlab.us | 9da18f2 | 2015-05-28 21:10:24 -0400 | [diff] [blame] | 2 | def __init__( self ): |
| 3 | self.ip = '127.0.0.1' |
| 4 | |
andrew@onlab.us | d2d36fc | 2015-05-29 14:27:54 -0400 | [diff] [blame^] | 5 | def getOnosLog( nodeIp, option='grep \'ERROR\' \| \'WARN\'', |
andrew@onlab.us | 9da18f2 | 2015-05-28 21:10:24 -0400 | [diff] [blame] | 6 | 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 | |
| 41 | def setLogLevel( level ): |
| 42 | """ |
| 43 | Set the log level of onos |
| 44 | """ |
| 45 | main.log.info( 'setLogLevel implement me' ) |
| 46 | |
| 47 | |