<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  pespin: Verified
  srs_andre: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Introduce RFemu stdin implementation for srsENB<br><br>Change-Id: I5487dec3691cbf424306369f94f337ed34a10c70<br>---<br>M src/osmo_gsm_tester/obj/enb_srs.py<br>M src/osmo_gsm_tester/obj/rfemu.py<br>A src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py<br>M sysmocom/defaults.conf<br>4 files changed, 64 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo_gsm_tester/obj/enb_srs.py b/src/osmo_gsm_tester/obj/enb_srs.py</span><br><span>index 63e5d7c..9d7eca3 100644</span><br><span>--- a/src/osmo_gsm_tester/obj/enb_srs.py</span><br><span>+++ b/src/osmo_gsm_tester/obj/enb_srs.py</span><br><span>@@ -259,6 +259,10 @@</span><br><span>         rfemu_cfg = cell_list[cell].get('dl_rfemu', None)</span><br><span>         if rfemu_cfg is None:</span><br><span>             raise log.Error('rfemu attribute not found in cell_list item!')</span><br><span style="color: hsl(120, 100%, 40%);">+        if rfemu_cfg['type'] == 'srsenb_stdin':</span><br><span style="color: hsl(120, 100%, 40%);">+            # These fields are required so the rfemu class can interact with us:</span><br><span style="color: hsl(120, 100%, 40%);">+             config.overlay(rfemu_cfg, dict(enb=self,</span><br><span style="color: hsl(120, 100%, 40%);">+                                            cell_id=cell_list[cell]['cell_id']))</span><br><span> </span><br><span>         rfemu_obj = rfemu.get_instance_by_type(rfemu_cfg['type'], rfemu_cfg)</span><br><span>         return rfemu_obj</span><br><span>diff --git a/src/osmo_gsm_tester/obj/rfemu.py b/src/osmo_gsm_tester/obj/rfemu.py</span><br><span>index ac34ee1..ec8ed68 100644</span><br><span>--- a/src/osmo_gsm_tester/obj/rfemu.py</span><br><span>+++ b/src/osmo_gsm_tester/obj/rfemu.py</span><br><span>@@ -52,6 +52,9 @@</span><br><span>     elif rfemu_type == 'minicircuits':</span><br><span>         from .rfemu_minicircuits import RFemulationMinicircuitsHTTP</span><br><span>         obj = RFemulationMinicircuitsHTTP</span><br><span style="color: hsl(120, 100%, 40%);">+    elif rfemu_type == 'srsenb_stdin':</span><br><span style="color: hsl(120, 100%, 40%);">+        from .rfemu_srsenb_stdin import RFemulationSrsStdin</span><br><span style="color: hsl(120, 100%, 40%);">+        obj = RFemulationSrsStdin</span><br><span>     else:</span><br><span>         raise log.Error('RFemulation type not supported:', rfemu_type)</span><br><span> </span><br><span>diff --git a/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py b/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py</span><br><span>new file mode 100644</span><br><span>index 0000000..ca23020</span><br><span>--- /dev/null</span><br><span>+++ b/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py</span><br><span>@@ -0,0 +1,52 @@</span><br><span style="color: hsl(120, 100%, 40%);">+# osmo_gsm_tester: class defining a RF emulation object implemented using SRS ENB stdin interface</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# Author: Pau Espin Pedrol <pespin@sysmocom.de></span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# This program is free software: you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+# it under the terms of the GNU General Public License as</span><br><span style="color: hsl(120, 100%, 40%);">+# published by the Free Software Foundation, either version 3 of the</span><br><span style="color: hsl(120, 100%, 40%);">+# License, or (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+# but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+# GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+#</span><br><span style="color: hsl(120, 100%, 40%);">+# You should have received a copy of the GNU General Public License</span><br><span style="color: hsl(120, 100%, 40%);">+# along with this program.  If not, see <http://www.gnu.org/licenses/>.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+import json</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+from ..core import log</span><br><span style="color: hsl(120, 100%, 40%);">+from .rfemu import RFemulation</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+class RFemulationSrsStdin(RFemulation):</span><br><span style="color: hsl(120, 100%, 40%);">+##############</span><br><span style="color: hsl(120, 100%, 40%);">+# PROTECTED</span><br><span style="color: hsl(120, 100%, 40%);">+##############</span><br><span style="color: hsl(120, 100%, 40%);">+    def __init__(self, conf):</span><br><span style="color: hsl(120, 100%, 40%);">+        super().__init__(conf, 'srsenb_stdin')</span><br><span style="color: hsl(120, 100%, 40%);">+        self.cell_id = int(conf.get('cell_id'))</span><br><span style="color: hsl(120, 100%, 40%);">+        if self.cell_id is None:</span><br><span style="color: hsl(120, 100%, 40%);">+            raise log.Error('No "cell_id" attribute provided in rfemu conf!')</span><br><span style="color: hsl(120, 100%, 40%);">+        self.enb = conf.get('enb')</span><br><span style="color: hsl(120, 100%, 40%);">+        if self.enb is None:</span><br><span style="color: hsl(120, 100%, 40%);">+            raise log.Error('No "srsenb" attribute provided in rfemu conf!')</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    def __del__(self):</span><br><span style="color: hsl(120, 100%, 40%);">+        self.enb = None</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#############################</span><br><span style="color: hsl(120, 100%, 40%);">+# PUBLIC (test API included)</span><br><span style="color: hsl(120, 100%, 40%);">+#############################</span><br><span style="color: hsl(120, 100%, 40%);">+    def set_attenuation(self, db):</span><br><span style="color: hsl(120, 100%, 40%);">+        msg_str = 'cell_gain %d %f' % (self.cell_id, db)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.dbg('sending stdin msg: "%s"' % msg_str)</span><br><span style="color: hsl(120, 100%, 40%);">+        self.enb.process.stdin_write(msg_str + '\n')</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    def get_max_attenuation(self):</span><br><span style="color: hsl(120, 100%, 40%);">+        return 200 # maximum cell_gain value in srs. Is this correct value?</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+# vim: expandtab tabstop=4 shiftwidth=4</span><br><span>diff --git a/sysmocom/defaults.conf b/sysmocom/defaults.conf</span><br><span>index ed0b575..419c3a4 100644</span><br><span>--- a/sysmocom/defaults.conf</span><br><span>+++ b/sysmocom/defaults.conf</span><br><span>@@ -148,6 +148,11 @@</span><br><span>   tx_gain: 80</span><br><span>   rx_gain: 40</span><br><span>   log_all_level: warning</span><br><span style="color: hsl(120, 100%, 40%);">+  cell_list:</span><br><span style="color: hsl(120, 100%, 40%);">+   - dl_rfemu:</span><br><span style="color: hsl(120, 100%, 40%);">+       type: srsenb_stdin</span><br><span style="color: hsl(120, 100%, 40%);">+   - dl_rfemu:</span><br><span style="color: hsl(120, 100%, 40%);">+       type: srsenb_stdin</span><br><span> </span><br><span> amarisoftenb:</span><br><span>   num_prb: 100</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456">change 20456</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-gsm-tester </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I5487dec3691cbf424306369f94f337ed34a10c70 </div>
<div style="display:none"> Gerrit-Change-Number: 20456 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: srs_andre <andre@softwareradiosystems.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>