Initial code for log analysis

- we agreed to basically throw away the old log checker (as it is
  unmaintainable)
- now: provide list of analysis to do
  * all checkers in cls_log_analysis, can be unit tested (see also next
    commit)
  * looked up dynamically to simplify adding of new tests + config
  * configured with

      <analysis>
        <services>DESCRIPTION [DESCRIPTION...]</services>
        <service>DESCRIPTION</service>
        ...
      </analysis>

    where DESCRIPTION follows service=func[=options]:
    - service is name of service to check
    - func is function to call, which receives filename
    - option are arbitary options to pass to func
    <services> is whitespace delimited (so can take multiple service
    analysis definitions)
    <service> exists to allow service definitions with whitespace
    changes that would not work in <services>
- I initially planned to check return code, but most softmodems actually
  exit with non-zero return code, so this is still TODO
- Default analyzer (checking for assertions, ...) is always run if a
  service is listed
- checks for file size
- add unit tests
This commit is contained in:
Robert Schmidt
2026-02-17 01:04:00 +01:00
parent 03f56c10e7
commit fe464ec6d0
11 changed files with 257 additions and 32 deletions

View File

@@ -127,7 +127,7 @@ class RANManagement():
return enbDidSync
def TerminateeNB(self, ctx, node, HTML):
def TerminateeNB(self, ctx, node, HTML, to_analyze):
logging.debug('Stopping eNB/gNB on server: ' + node)
lSourcePath = self.eNBSourceCodePath
cmd = cls_cmd.getConnection(node)
@@ -142,6 +142,7 @@ class RANManagement():
if result is not None:
cmd.run('sudo -S killall --signal SIGKILL -r .*-softmodem')
time.sleep(5)
HTML.CreateHtmlTestRowQueue(node, 'OK', ['Undeployment successful'])
# see InitializeeNB()
logfile = f'{lSourcePath}/cmake_targets/enb.log'
@@ -156,13 +157,10 @@ class RANManagement():
return False
logging.debug('\u001B[1m Analyzing xNB logfile \u001B[0m ' + file)
logStatus = self.AnalyzeLogFile_eNB(file, HTML, self.ran_checkers)
if logStatus < 0:
HTML.CreateHtmlTestRow('N/A', 'KO', logStatus)
else:
HTML.CreateHtmlTestRow(self.runtime_stats, 'OK', CONST.ALL_PROCESSES_OK)
return logStatus >= 0
service_desc = {}
service_desc["nr-softmodem"] = {'returncode': 0, 'logfile': file}
success = cls_analysis.AnalyzeServices(HTML, service_desc, to_analyze)
return success
def AnalyzeRTStats(self, HTML, node, ctx, thresholds):
logging.info(f'Analyzing realtime stats from server: {node}')