srslte_common: fix indent in whole file

Change-Id: I8aee79e9d451761dde8f35f84d75483dc4e23040
This commit is contained in:
Andre Puschmann 2020-10-05 20:03:13 +02:00
parent f4fb48af9a
commit 182109db4d
1 changed files with 65 additions and 65 deletions

View File

@ -22,79 +22,79 @@ from ..core.event_loop import MainLoop
class srslte_common(): # don't inherit from log.Origin here but instead use .name() from whoever inherits from us
def __init__(self):
self.log_file = None
self.process = None
self.metrics_file = None
self.stop_sleep_time = 6 # We require at most 5s to stop
self.kpis = None
def __init__(self):
self.log_file = None
self.process = None
self.metrics_file = None
self.stop_sleep_time = 6 # We require at most 5s to stop
self.kpis = None
def sleep_after_stop(self):
# Only sleep once
if self.stop_sleep_time > 0:
MainLoop.sleep(self.stop_sleep_time)
self.stop_sleep_time = 0
def sleep_after_stop(self):
# Only sleep once
if self.stop_sleep_time > 0:
MainLoop.sleep(self.stop_sleep_time)
self.stop_sleep_time = 0
def stop(self):
self.testenv.stop_process(self.process)
self.sleep_after_stop()
def stop(self):
self.testenv.stop_process(self.process)
self.sleep_after_stop()
def get_kpis(self):
''' Return all KPI '''
if self.kpis is None:
self.extract_kpis()
return self.kpis
def get_kpis(self):
''' Return all KPI '''
if self.kpis is None:
self.extract_kpis()
return self.kpis
def get_log_kpis(self):
''' Return KPIs extracted from log '''
if self.kpis is None:
self.extract_kpis()
def get_log_kpis(self):
''' Return KPIs extracted from log '''
if self.kpis is None:
self.extract_kpis()
# Use log KPIs if they exist for this node
if "log_" + self.name() in self.kpis:
log_kpi = self.kpis["log_" + self.name()]
else:
log_kpi = {}
# Use log KPIs if they exist for this node
if "log_" + self.name() in self.kpis:
log_kpi = self.kpis["log_" + self.name()]
else:
log_kpi = {}
# Make sure we have the errors and warnings counter in the dict
if 'total_errors' not in log_kpi:
log_kpi['total_errors'] = 0
if 'total_warnings' not in log_kpi:
log_kpi['total_warnings'] = 0
return log_kpi
# Make sure we have the errors and warnings counter in the dict
if 'total_errors' not in log_kpi:
log_kpi['total_errors'] = 0
if 'total_warnings' not in log_kpi:
log_kpi['total_warnings'] = 0
return log_kpi
def extract_kpis(self):
''' Use the srsLTE KPI analyzer module (part of srsLTE.git) if available to collect KPIs '''
def extract_kpis(self):
''' Use the srsLTE KPI analyzer module (part of srsLTE.git) if available to collect KPIs '''
# Stop application, copy back logs and process them
if self.running():
self.stop()
self.cleanup()
# Stop application, copy back logs and process them
if self.running():
self.stop()
self.cleanup()
self.kpis = {}
try:
# Please make sure the srsLTE scripts folder is included in your PYTHONPATH env variable
from kpi_analyzer import kpi_analyzer
analyzer = kpi_analyzer(self.name())
if self.log_file is not None:
self.kpis["log_" + self.name()] = analyzer.get_kpi_from_logfile(self.log_file)
if self.process.get_output_file('stdout') is not None:
self.kpis["stdout_" + self.name()] = analyzer.get_kpi_from_stdout(self.process.get_output_file('stdout'))
if self.metrics_file is not None:
self.kpis["csv_" + self.name()] = analyzer.get_kpi_from_csv(self.metrics_file)
except ImportError:
self.log("Can't load KPI analyzer module.")
self.kpis = {}
self.kpis = {}
try:
# Please make sure the srsLTE scripts folder is included in your PYTHONPATH env variable
from kpi_analyzer import kpi_analyzer
analyzer = kpi_analyzer(self.name())
if self.log_file is not None:
self.kpis["log_" + self.name()] = analyzer.get_kpi_from_logfile(self.log_file)
if self.process.get_output_file('stdout') is not None:
self.kpis["stdout_" + self.name()] = analyzer.get_kpi_from_stdout(self.process.get_output_file('stdout'))
if self.metrics_file is not None:
self.kpis["csv_" + self.name()] = analyzer.get_kpi_from_csv(self.metrics_file)
except ImportError:
self.log("Can't load KPI analyzer module.")
self.kpis = {}
return self.kpis
return self.kpis
def get_num_phy_errors(self, kpi):
""" Use KPI analyzer to calculate the number PHY errors for either UE or eNB components from parsed KPI vector """
try:
# Same as above, make sure the srsLTE scripts folder is included in your PYTHONPATH env variable
from kpi_analyzer import kpi_analyzer
analyzer = kpi_analyzer(self.name())
return analyzer.get_num_phy_errors(kpi)
except ImportError:
self.log("Can't load KPI analyzer module.")
return 0
def get_num_phy_errors(self, kpi):
""" Use KPI analyzer to calculate the number PHY errors for either UE or eNB components from parsed KPI vector """
try:
# Same as above, make sure the srsLTE scripts folder is included in your PYTHONPATH env variable
from kpi_analyzer import kpi_analyzer
analyzer = kpi_analyzer(self.name())
return analyzer.get_num_phy_errors(kpi)
except ImportError:
self.log("Can't load KPI analyzer module.")
return 0