aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester
diff options
context:
space:
mode:
authorAndre Puschmann <andre@softwareradiosystems.com>2020-06-18 10:05:31 +0200
committerAndre Puschmann <andre@softwareradiosystems.com>2020-06-23 16:41:00 +0200
commit7c1c8d62e8ca2e3baa9f4c51d9aca746f9dc567c (patch)
treeba2266ec7d1237d753f802f664be0db8b4a5da95 /src/osmo_gsm_tester
parentd5a58d0d619d29f1a50001ab534ca19272a62efb (diff)
ms_srs: fix scp-back-metrics routine
every call to verify_metrics would copy back metrics again. see log here: 23:29:22.149299 run srsue(pid=31521): Terminating (SIGINT) 23:29:22.368263 run srsue(pid=31521): Terminated: ok {rc=0} 23:29:28.401035 run scp-back-metrics(pid=32265): Launched 23:29:29.423083 run scp-back-metrics(pid=32265): Terminated: ok {rc=0} 23:29:29.490275 run scp-back-metrics(pid=32271): Launched 23:29:30.513852 run scp-back-metrics(pid=32271): Terminated: ok {rc=0} 23:29:30.550862 run scp-back-metrics(pid=32277): Launched 23:29:31.573962 run scp-back-metrics(pid=32277): Terminated: ok {rc=0} this patch only copies back metrics only once. also make sure that, similar to logs, metrics are always copied back at the end of the run even if they are not used for metrics checking. this is needed to run the plotting script. Change-Id: Ie7c156a5b2c8768bf90ff8e86515976e0d454c25
Diffstat (limited to 'src/osmo_gsm_tester')
-rw-r--r--src/osmo_gsm_tester/obj/ms_srs.py38
1 files changed, 27 insertions, 11 deletions
diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index cf2e166..57721ac 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -81,6 +81,7 @@ class srsUE(MS):
self.log_file = None
self.pcap_file = None
self.metrics_file = None
+ self.have_metrics_file = False
self.process = None
self.rem_host = None
self.remote_inst = None
@@ -107,6 +108,7 @@ class srsUE(MS):
self.sleep_after_stop()
# copy back files (may not exist, for instance if there was an early error of process):
+ self.scp_back_metrics(raiseException=False)
try:
self.rem_host.scpfrom('scp-back-log', self.remote_log_file, self.log_file)
except Exception as e:
@@ -117,6 +119,29 @@ class srsUE(MS):
except Exception as e:
self.log(repr(e))
+ 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:
+ # file is not properly flushed until the process has stopped.
+ if self.running():
+ self.stop()
+
+ # only SCP back if not running locally
+ if not self._run_node.is_local():
+ try:
+ self.rem_host.scpfrom('scp-back-metrics', self.remote_metrics_file, self.metrics_file)
+ except Exception as e:
+ if raiseException:
+ self.err('Failed copying back metrics file from remote host')
+ raise e
+ else:
+ # only log error
+ self.log(repr(e))
+ # make sure to only call it once
+ self.have_metrics_file = True
+ else:
+ self.dbg('Metrics have already been copied back')
+
def netns(self):
return "srsue1"
@@ -362,17 +387,8 @@ class srsUE(MS):
raise log.Error('counter %s not implemented!' % counter_name)
def verify_metric(self, value, operation='avg', metric='dl_brate', criterion='gt', window=1):
- # file is not properly flushed until the process has stopped.
- if self.running():
- self.stop()
-
- if not self._run_node.is_local():
- try:
- self.rem_host.scpfrom('scp-back-metrics', self.remote_metrics_file, self.metrics_file)
- except Exception as e:
- self.err('Failed copying back metrics file from remote host')
- raise e
-
+ # copy back metrics if we have not already done so
+ self.scp_back_metrics(self)
metrics = srsUEMetrics(self.metrics_file)
return metrics.verify(value, operation, metric, criterion, window)