Change in osmo-gsm-tester[master]: Introduce RFemu stdin implementation for srsENB

2020-10-13 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456 )

Change subject: Introduce RFemu stdin implementation for srsENB
..

Introduce RFemu stdin implementation for srsENB

Change-Id: I5487dec3691cbf424306369f94f337ed34a10c70
---
M src/osmo_gsm_tester/obj/enb_srs.py
M src/osmo_gsm_tester/obj/rfemu.py
A src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py
M sysmocom/defaults.conf
4 files changed, 64 insertions(+), 0 deletions(-)

Approvals:
  pespin: Verified
  srs_andre: Looks good to me, approved



diff --git a/src/osmo_gsm_tester/obj/enb_srs.py 
b/src/osmo_gsm_tester/obj/enb_srs.py
index 63e5d7c..9d7eca3 100644
--- a/src/osmo_gsm_tester/obj/enb_srs.py
+++ b/src/osmo_gsm_tester/obj/enb_srs.py
@@ -259,6 +259,10 @@
 rfemu_cfg = cell_list[cell].get('dl_rfemu', None)
 if rfemu_cfg is None:
 raise log.Error('rfemu attribute not found in cell_list item!')
+if rfemu_cfg['type'] == 'srsenb_stdin':
+# These fields are required so the rfemu class can interact with 
us:
+ config.overlay(rfemu_cfg, dict(enb=self,
+
cell_id=cell_list[cell]['cell_id']))

 rfemu_obj = rfemu.get_instance_by_type(rfemu_cfg['type'], rfemu_cfg)
 return rfemu_obj
diff --git a/src/osmo_gsm_tester/obj/rfemu.py b/src/osmo_gsm_tester/obj/rfemu.py
index ac34ee1..ec8ed68 100644
--- a/src/osmo_gsm_tester/obj/rfemu.py
+++ b/src/osmo_gsm_tester/obj/rfemu.py
@@ -52,6 +52,9 @@
 elif rfemu_type == 'minicircuits':
 from .rfemu_minicircuits import RFemulationMinicircuitsHTTP
 obj = RFemulationMinicircuitsHTTP
+elif rfemu_type == 'srsenb_stdin':
+from .rfemu_srsenb_stdin import RFemulationSrsStdin
+obj = RFemulationSrsStdin
 else:
 raise log.Error('RFemulation type not supported:', rfemu_type)

diff --git a/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py 
b/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py
new file mode 100644
index 000..ca23020
--- /dev/null
+++ b/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py
@@ -0,0 +1,52 @@
+# osmo_gsm_tester: class defining a RF emulation object implemented using SRS 
ENB stdin interface
+#
+# Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH
+#
+# Author: Pau Espin Pedrol 
+#
+# 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 .
+
+import json
+
+from ..core import log
+from .rfemu import RFemulation
+
+class RFemulationSrsStdin(RFemulation):
+##
+# PROTECTED
+##
+def __init__(self, conf):
+super().__init__(conf, 'srsenb_stdin')
+self.cell_id = int(conf.get('cell_id'))
+if self.cell_id is None:
+raise log.Error('No "cell_id" attribute provided in rfemu conf!')
+self.enb = conf.get('enb')
+if self.enb is None:
+raise log.Error('No "srsenb" attribute provided in rfemu conf!')
+
+def __del__(self):
+self.enb = None
+
+#
+# PUBLIC (test API included)
+#
+def set_attenuation(self, db):
+msg_str = 'cell_gain %d %f' % (self.cell_id, db)
+self.dbg('sending stdin msg: "%s"' % msg_str)
+self.enb.process.stdin_write(msg_str + '\n')
+
+def get_max_attenuation(self):
+return 200 # maximum cell_gain value in srs. Is this correct value?
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/sysmocom/defaults.conf b/sysmocom/defaults.conf
index ed0b575..419c3a4 100644
--- a/sysmocom/defaults.conf
+++ b/sysmocom/defaults.conf
@@ -148,6 +148,11 @@
   tx_gain: 80
   rx_gain: 40
   log_all_level: warning
+  cell_list:
+   - dl_rfemu:
+   type: srsenb_stdin
+   - dl_rfemu:
+   type: srsenb_stdin

 amarisoftenb:
   num_prb: 100

--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456
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: I5487dec3691cbf424306369f94f337ed34a10c70
Gerrit-Change-Number: 20456
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: srs_andre 
Gerrit-MessageType: merged


Change in osmo-gsm-tester[master]: Introduce RFemu stdin implementation for srsENB

2020-10-13 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456 )

Change subject: Introduce RFemu stdin implementation for srsENB
..


Patch Set 3: Verified+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456
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: I5487dec3691cbf424306369f94f337ed34a10c70
Gerrit-Change-Number: 20456
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: srs_andre 
Gerrit-Comment-Date: Tue, 13 Oct 2020 18:54:04 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-gsm-tester[master]: Introduce RFemu stdin implementation for srsENB

2020-10-12 Thread srs_andre
srs_andre has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456 )

Change subject: Introduce RFemu stdin implementation for srsENB
..


Patch Set 2: Code-Review+2

Looks good to me as starting basis. Thanks


--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456
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: I5487dec3691cbf424306369f94f337ed34a10c70
Gerrit-Change-Number: 20456
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: srs_andre 
Gerrit-Comment-Date: Mon, 12 Oct 2020 18:39:02 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-gsm-tester[master]: Introduce RFemu stdin implementation for srsENB

2020-10-05 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456 )


Change subject: Introduce RFemu stdin implementation for srsENB
..

Introduce RFemu stdin implementation for srsENB

Change-Id: I5487dec3691cbf424306369f94f337ed34a10c70
---
M src/osmo_gsm_tester/obj/enb_srs.py
M src/osmo_gsm_tester/obj/rfemu.py
A src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py
M sysmocom/defaults.conf
4 files changed, 64 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester 
refs/changes/56/20456/1

diff --git a/src/osmo_gsm_tester/obj/enb_srs.py 
b/src/osmo_gsm_tester/obj/enb_srs.py
index 68a3a19..9c3dd5a 100644
--- a/src/osmo_gsm_tester/obj/enb_srs.py
+++ b/src/osmo_gsm_tester/obj/enb_srs.py
@@ -251,6 +251,10 @@
 rfemu_cfg = cell_list[cell].get('dl_rfemu', None)
 if rfemu_cfg is None:
 raise log.Error('rfemu attribute not found in cell_list item!')
+if rfemu_cfg['type'] == 'srsenb_stdin':
+# These fields are required so the rfemu class can interact with 
us:
+ config.overlay(rfemu_cfg, dict(enb=self,
+
cell_id=cell_list[cell]['cell_id']))

 rfemu_obj = rfemu.get_instance_by_type(rfemu_cfg['type'], rfemu_cfg)
 return rfemu_obj
diff --git a/src/osmo_gsm_tester/obj/rfemu.py b/src/osmo_gsm_tester/obj/rfemu.py
index ac34ee1..ec8ed68 100644
--- a/src/osmo_gsm_tester/obj/rfemu.py
+++ b/src/osmo_gsm_tester/obj/rfemu.py
@@ -52,6 +52,9 @@
 elif rfemu_type == 'minicircuits':
 from .rfemu_minicircuits import RFemulationMinicircuitsHTTP
 obj = RFemulationMinicircuitsHTTP
+elif rfemu_type == 'srsenb_stdin':
+from .rfemu_srsenb_stdin import RFemulationSrsStdin
+obj = RFemulationSrsStdin
 else:
 raise log.Error('RFemulation type not supported:', rfemu_type)

diff --git a/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py 
b/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py
new file mode 100644
index 000..ca23020
--- /dev/null
+++ b/src/osmo_gsm_tester/obj/rfemu_srsenb_stdin.py
@@ -0,0 +1,52 @@
+# osmo_gsm_tester: class defining a RF emulation object implemented using SRS 
ENB stdin interface
+#
+# Copyright (C) 2020 by sysmocom - s.f.m.c. GmbH
+#
+# Author: Pau Espin Pedrol 
+#
+# 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 .
+
+import json
+
+from ..core import log
+from .rfemu import RFemulation
+
+class RFemulationSrsStdin(RFemulation):
+##
+# PROTECTED
+##
+def __init__(self, conf):
+super().__init__(conf, 'srsenb_stdin')
+self.cell_id = int(conf.get('cell_id'))
+if self.cell_id is None:
+raise log.Error('No "cell_id" attribute provided in rfemu conf!')
+self.enb = conf.get('enb')
+if self.enb is None:
+raise log.Error('No "srsenb" attribute provided in rfemu conf!')
+
+def __del__(self):
+self.enb = None
+
+#
+# PUBLIC (test API included)
+#
+def set_attenuation(self, db):
+msg_str = 'cell_gain %d %f' % (self.cell_id, db)
+self.dbg('sending stdin msg: "%s"' % msg_str)
+self.enb.process.stdin_write(msg_str + '\n')
+
+def get_max_attenuation(self):
+return 200 # maximum cell_gain value in srs. Is this correct value?
+
+# vim: expandtab tabstop=4 shiftwidth=4
diff --git a/sysmocom/defaults.conf b/sysmocom/defaults.conf
index 2f2e317..fb6f8f6 100644
--- a/sysmocom/defaults.conf
+++ b/sysmocom/defaults.conf
@@ -148,6 +148,11 @@
   tx_gain: 80
   rx_gain: 40
   log_all_level: warning
+  cell_list:
+   - dl_rfemu:
+   type: srsenb_stdin
+   - dl_rfemu:
+   type: srsenb_stdin

 amarisoftenb:
   num_prb: 100

--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/20456
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: I5487dec3691cbf424306369f94f337ed34a10c70
Gerrit-Change-Number: 20456
Gerrit-PatchSet: 1
Gerrit-Owner: pespin 
Gerrit-MessageType: newchange