aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester
diff options
context:
space:
mode:
authorAndre Puschmann <andre@softwareradiosystems.com>2020-06-19 15:47:32 +0200
committerAndre Puschmann <andre@softwareradiosystems.com>2020-07-01 10:52:09 +0200
commitf14ff812ced98d6be55f6ebbb39056c103ccc81d (patch)
treed5bc5dca97f24b7cc62c6986e48aa9830172bbad /src/osmo_gsm_tester
parent20087ad8c46cbee43d83e25623dea39fcc30a074 (diff)
{ms,enb}_srs: add method to read kpi from a test run
this method uses the kpi_analyzer module for analyzing stdout, CSV metrics and the logfile (if present). if the module can't be loaded, no KPI will be added. Change-Id: I28226a375f9ac4e08424c488062ae6a74a19af92
Diffstat (limited to 'src/osmo_gsm_tester')
-rw-r--r--src/osmo_gsm_tester/obj/enb_srs.py7
-rw-r--r--src/osmo_gsm_tester/obj/ms_srs.py6
-rw-r--r--src/osmo_gsm_tester/obj/srslte_common.py45
3 files changed, 56 insertions, 2 deletions
diff --git a/src/osmo_gsm_tester/obj/enb_srs.py b/src/osmo_gsm_tester/obj/enb_srs.py
index 0bf4f8b..fe1ea4e 100644
--- a/src/osmo_gsm_tester/obj/enb_srs.py
+++ b/src/osmo_gsm_tester/obj/enb_srs.py
@@ -23,6 +23,7 @@ import pprint
from ..core import log, util, config, template, process, remote
from . import enb
from . import rfemu
+from .srslte_common import srslte_common
from ..core import schema
@@ -36,7 +37,7 @@ def on_register_schemas():
def rf_type_valid(rf_type_str):
return rf_type_str in ('zmq', 'uhd', 'soapy', 'bladerf')
-class srsENB(enb.eNodeB):
+class srsENB(enb.eNodeB, srslte_common):
REMOTE_DIR = '/osmo-gsm-tester-srsenb'
BINFILE = 'srsenb'
@@ -68,6 +69,7 @@ class srsENB(enb.eNodeB):
self.remote_log_file = None
self.remote_pcap_file = None
self.enable_pcap = False
+ self.metrics_file = None
self.testenv = testenv
self._additional_args = []
if not rf_type_valid(conf.get('rf_dev_type', None)):
@@ -89,6 +91,9 @@ class srsENB(enb.eNodeB):
except Exception as e:
self.log(repr(e))
+ # Collect KPIs for each TC
+ self.testenv.test().set_kpis(self.get_kpis())
+
def start(self, epc):
self.log('Starting srsENB')
self._epc = epc
diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index 9f77bb6..ebd066d 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -26,6 +26,7 @@ from ..core import schema
from .run_node import RunNode
from ..core.event_loop import MainLoop
from .ms import MS
+from .srslte_common import srslte_common
def rf_type_valid(rf_type_str):
return rf_type_str in ('zmq', 'uhd', 'soapy', 'bladerf')
@@ -64,7 +65,7 @@ def num_prb2symbol_sz(num_prb):
def num_prb2base_srate(num_prb):
return num_prb2symbol_sz(num_prb) * 15 * 1000
-class srsUE(MS):
+class srsUE(MS, srslte_common):
REMOTE_DIR = '/osmo-gsm-tester-srsue'
BINFILE = 'srsue'
@@ -120,6 +121,9 @@ class srsUE(MS):
except Exception as e:
self.log(repr(e))
+ # Collect KPIs for each TC
+ self.testenv.test().set_kpis(self.get_kpis())
+
def scp_back_metrics(self, raiseException=True):
''' Copy back metrics only if they have not been copied back yet '''
if not self.have_metrics_file:
diff --git a/src/osmo_gsm_tester/obj/srslte_common.py b/src/osmo_gsm_tester/obj/srslte_common.py
new file mode 100644
index 0000000..33f12d4
--- /dev/null
+++ b/src/osmo_gsm_tester/obj/srslte_common.py
@@ -0,0 +1,45 @@
+# osmo_gsm_tester: common methods shared among srsLTE components
+#
+# Copyright (C) 2020 by Software Radio Systems Ltd
+#
+# Author: Andre Puschmann <andre@softwareradiosystems.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+from ..core import log
+
+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
+
+ def get_kpis(self):
+ ''' Use the srsLTE KPI analyzer module (part of srsLTE.git) if available to collect KPIs '''
+ 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:
+ kpis["log_" + self.name()] = analyzer.get_kpi_from_logfile(self.log_file)
+ if self.process.get_output_file('stdout') is not None:
+ kpis["stdout_" + self.name()] = analyzer.get_kpi_from_stdout(self.process.get_output_file('stdout'))
+ if self.metrics_file is not None:
+ kpis["csv_" + self.name()] = analyzer.get_kpi_from_csv(self.metrics_file)
+ except ImportError:
+ self.log("Can't load KPI analyzer module.")
+
+ return kpis