Change in osmo-gsm-tester[master]: ms_srs: allow + operator when specifying CSV columns

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Tue May 26 13:55:40 UTC 2020


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18473 )

Change subject: ms_srs: allow + operator when specifying CSV columns
......................................................................

ms_srs: allow + operator when specifying CSV columns

this allows to sum dl_brate and ul_brate and perform
the known operations, like max, average, etc. on both
UL and DL bitrate combined

For examples, with this CSV ..

time;cc;pci;earfcn;rsrp;pl;cfo;dl_mcs;dl_snr;dl_turbo;dl_brate;dl_bler;ul_ta;ul_mcs;ul_buff;ul_brate;ul_bler;rf_o;rf_u;rf_l;is_attached
1999;0;1;3400;-67;59;913;27;29;0.50;10432.000000;0;2.6;20;0.0;10848.000000;0;0.0;0.0;0.0;1.0
2998;0;1;3400;-67;59;912;28;29;0.50;2136.000000;0;2.6;20;0.0;1680.000000;0;0.0;0.0;0.0;1.0
3997;0;1;3400;-69;61;909;28;29;0.50;2136.000000;0;2.6;20;0.0;1680.000000;0;0.0;0.0;0.0;1.0

.. one could calculate the average of DL and UL bit rate with:

ue.verify_metric(1e6, operation='avg', metric='dl_brate+ul_brate', criterion='gt', window=test_duration)

and veriy that it's average is greater than 1 Mbit/s

Change-Id: I5c7c80bb107fa6b93b215176e6ebbb5dc8594860
---
M src/osmo_gsm_tester/obj/ms_srs.py
1 file changed, 16 insertions(+), 7 deletions(-)

Approvals:
  pespin: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/obj/ms_srs.py b/src/osmo_gsm_tester/obj/ms_srs.py
index a147ce6..a8e86d3 100644
--- a/src/osmo_gsm_tester/obj/ms_srs.py
+++ b/src/osmo_gsm_tester/obj/ms_srs.py
@@ -378,17 +378,26 @@
             self.err("Error parsing metrics CSV file %s" % self.metrics_file)
             raise error
 
-    def verify(self, value, operation='avg', metric='dl_brate', criterion='gt', window=1):
+    def verify(self, value, operation='avg', metric_str='dl_brate', criterion='gt', window=1):
         if operation not in self.VALID_OPERATIONS:
             raise log.Error('Unknown operation %s not in %r' % (operation, self.VALID_OPERATIONS))
         if criterion not in self.VALID_CRITERION:
             raise log.Error('Unknown operation %s not in %r' % (operation, self.VALID_CRITERION))
         # check if given metric exists in data
-        try:
-            sel_data = self.raw_data[metric]
-        except ValueError as err:
-            print('metric %s not available' % metric)
-            raise err
+        sel_data = numpy.array([])
+        metrics_list = metric_str.split('+') # allow addition operator for columns
+        for metric in metrics_list:
+            try:
+                vec = numpy.array(self.raw_data[metric])
+            except ValueError as err:
+                print('metric %s not available' % metric)
+                raise err
+            if sel_data.size == 0:
+                # Initialize with dimension of first metric vector
+                sel_data = vec
+            else:
+                # Sum them up assuming same array dimension
+                sel_data += vec
 
         if operation == 'avg':
             result = numpy.average(sel_data)
@@ -407,7 +416,7 @@
             success = True
 
         # Convert bitrate in Mbit/s:
-        if metric.find('brate') > 0:
+        if metric_str.find('brate') > 0:
             result /= 1e6
             value /= 1e6
             mbit_str = ' Mbit/s'

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18473
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: I5c7c80bb107fa6b93b215176e6ebbb5dc8594860
Gerrit-Change-Number: 18473
Gerrit-PatchSet: 5
Gerrit-Owner: srs_andre <andre at softwareradiosystems.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200526/a378db1e/attachment.htm>


More information about the gerrit-log mailing list