osmo-gsm-tester/src/osmo_gsm_tester/obj/rfemu_gnuradio_zmq.py

67 lines
2.3 KiB
Python
Raw Normal View History

4g: Introduce ZMQ GnuRadio stream broker srsENB currently creates 1 zmq stream (1 tx, 1 rx) for each cell (2 if MIMO is enabled). Each cell transceives on a given EARFCN (and several cells can transmit on same EARFCN). However, for handover test purposes, we want to join all cells operating on the same EARFCN to transceive on the same ZMQ conn, so that an srsUE can interact with them at the same time (same as if the medium was shared). Furthermore, we want to set different gains on each of those paths before merging them in order to emulate RF conditions like handover. In order to do so, a new element called the Broker is introduced, which is placed in between ENBs and UEs ZMQ conenctions, multiplexing the connections on the ENB side towards the UE side. A separate process for the broker is run remotely (ENB run host) which listens on a ctrl socket for commands. An internal Broker class is used in osmo-gsm-tester to interact with the remote script, for instance to configure the ports, start and stop the remote process, send commands to it, etc. On each ENB, when the rfemu "gnuradio_zmq" rfemu implementation is selected in configuration, it will configure its zmq connections and the UE ones to go over the Broker. As a result, that means the UE zmq port configuration is expected to be different than when no broker is in used, since there's the multiplexing per EARFCN in between. In this commit, only 1 ENB is supported, but multi-enb support is planned in the future. The handover test passes in the docker setup with this config: """ OSMO_GSM_TESTER_OPTS="-T -l dbg -s 4g:srsue-rftype@zmq+srsenb-rftype@zmq+" \ "mod-enb-nprb@6+mod-enb-ncells@2+mod-enb-cells-2ca+suite-4g@10,2+" \ "mod-enb-meas-enable -t =handover.py" """ and in resources.conf (or scenario), added: """ enb: ... cell_list: - dl_rfemu: type: gnuradio_zmq - dl_rfemu: type: gnuradio_zmq """ Note that since the broker is used, there's not need for mod-srsue-ncarriers@2 since the broker is joining the 2 enb cells into 1 stream on the UE side. Change-Id: I6282cda400558dcb356276786d91e6388524c5b1
2020-10-05 17:23:38 +00:00
# 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 <pespin@sysmocom.de>
#
# 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
from .rfemu import RFemulation
from .gnuradio_zmq_broker import GrBroker
4g: Introduce ZMQ GnuRadio stream broker srsENB currently creates 1 zmq stream (1 tx, 1 rx) for each cell (2 if MIMO is enabled). Each cell transceives on a given EARFCN (and several cells can transmit on same EARFCN). However, for handover test purposes, we want to join all cells operating on the same EARFCN to transceive on the same ZMQ conn, so that an srsUE can interact with them at the same time (same as if the medium was shared). Furthermore, we want to set different gains on each of those paths before merging them in order to emulate RF conditions like handover. In order to do so, a new element called the Broker is introduced, which is placed in between ENBs and UEs ZMQ conenctions, multiplexing the connections on the ENB side towards the UE side. A separate process for the broker is run remotely (ENB run host) which listens on a ctrl socket for commands. An internal Broker class is used in osmo-gsm-tester to interact with the remote script, for instance to configure the ports, start and stop the remote process, send commands to it, etc. On each ENB, when the rfemu "gnuradio_zmq" rfemu implementation is selected in configuration, it will configure its zmq connections and the UE ones to go over the Broker. As a result, that means the UE zmq port configuration is expected to be different than when no broker is in used, since there's the multiplexing per EARFCN in between. In this commit, only 1 ENB is supported, but multi-enb support is planned in the future. The handover test passes in the docker setup with this config: """ OSMO_GSM_TESTER_OPTS="-T -l dbg -s 4g:srsue-rftype@zmq+srsenb-rftype@zmq+" \ "mod-enb-nprb@6+mod-enb-ncells@2+mod-enb-cells-2ca+suite-4g@10,2+" \ "mod-enb-meas-enable -t =handover.py" """ and in resources.conf (or scenario), added: """ enb: ... cell_list: - dl_rfemu: type: gnuradio_zmq - dl_rfemu: type: gnuradio_zmq """ Note that since the broker is used, there's not need for mod-srsue-ncarriers@2 since the broker is joining the 2 enb cells into 1 stream on the UE side. Change-Id: I6282cda400558dcb356276786d91e6388524c5b1
2020-10-05 17:23:38 +00:00
class RFemulationGnuradioZmq(RFemulation):
##############
# PROTECTED
##############
def __init__(self, conf):
super().__init__(conf, 'gnuradio_zmq')
self.broker = None
self.ctrl_port = 5005
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!')
self.set_name('%s_%s_%d' % (self.name(), self.enb.name(), self.cell_id))
self.testenv = self.enb.testenv
self.configure()
def __del__(self):
if self.broker:
self.broker.unref()
self.broker = None
self.enb = None
self.testenv = None
def configure(self):
self.broker = GrBroker.ref()
#############################
# PUBLIC (test API included)
#############################
def set_attenuation(self, db):
for cell in self.enb.gen_conf['enb']['cell_list']:
if int(cell['cell_id']) == self.cell_id:
# convert negative dB to amplitude
amp = pow(10, -db/20.0)
self.broker.cmd_set_relative_gain_on_local_port(cell['zmq_enb_peer_port'], amp)
4g: Introduce ZMQ GnuRadio stream broker srsENB currently creates 1 zmq stream (1 tx, 1 rx) for each cell (2 if MIMO is enabled). Each cell transceives on a given EARFCN (and several cells can transmit on same EARFCN). However, for handover test purposes, we want to join all cells operating on the same EARFCN to transceive on the same ZMQ conn, so that an srsUE can interact with them at the same time (same as if the medium was shared). Furthermore, we want to set different gains on each of those paths before merging them in order to emulate RF conditions like handover. In order to do so, a new element called the Broker is introduced, which is placed in between ENBs and UEs ZMQ conenctions, multiplexing the connections on the ENB side towards the UE side. A separate process for the broker is run remotely (ENB run host) which listens on a ctrl socket for commands. An internal Broker class is used in osmo-gsm-tester to interact with the remote script, for instance to configure the ports, start and stop the remote process, send commands to it, etc. On each ENB, when the rfemu "gnuradio_zmq" rfemu implementation is selected in configuration, it will configure its zmq connections and the UE ones to go over the Broker. As a result, that means the UE zmq port configuration is expected to be different than when no broker is in used, since there's the multiplexing per EARFCN in between. In this commit, only 1 ENB is supported, but multi-enb support is planned in the future. The handover test passes in the docker setup with this config: """ OSMO_GSM_TESTER_OPTS="-T -l dbg -s 4g:srsue-rftype@zmq+srsenb-rftype@zmq+" \ "mod-enb-nprb@6+mod-enb-ncells@2+mod-enb-cells-2ca+suite-4g@10,2+" \ "mod-enb-meas-enable -t =handover.py" """ and in resources.conf (or scenario), added: """ enb: ... cell_list: - dl_rfemu: type: gnuradio_zmq - dl_rfemu: type: gnuradio_zmq """ Note that since the broker is used, there's not need for mod-srsue-ncarriers@2 since the broker is joining the 2 enb cells into 1 stream on the UE side. Change-Id: I6282cda400558dcb356276786d91e6388524c5b1
2020-10-05 17:23:38 +00:00
break
def get_max_attenuation(self):
return 200
4g: Introduce ZMQ GnuRadio stream broker srsENB currently creates 1 zmq stream (1 tx, 1 rx) for each cell (2 if MIMO is enabled). Each cell transceives on a given EARFCN (and several cells can transmit on same EARFCN). However, for handover test purposes, we want to join all cells operating on the same EARFCN to transceive on the same ZMQ conn, so that an srsUE can interact with them at the same time (same as if the medium was shared). Furthermore, we want to set different gains on each of those paths before merging them in order to emulate RF conditions like handover. In order to do so, a new element called the Broker is introduced, which is placed in between ENBs and UEs ZMQ conenctions, multiplexing the connections on the ENB side towards the UE side. A separate process for the broker is run remotely (ENB run host) which listens on a ctrl socket for commands. An internal Broker class is used in osmo-gsm-tester to interact with the remote script, for instance to configure the ports, start and stop the remote process, send commands to it, etc. On each ENB, when the rfemu "gnuradio_zmq" rfemu implementation is selected in configuration, it will configure its zmq connections and the UE ones to go over the Broker. As a result, that means the UE zmq port configuration is expected to be different than when no broker is in used, since there's the multiplexing per EARFCN in between. In this commit, only 1 ENB is supported, but multi-enb support is planned in the future. The handover test passes in the docker setup with this config: """ OSMO_GSM_TESTER_OPTS="-T -l dbg -s 4g:srsue-rftype@zmq+srsenb-rftype@zmq+" \ "mod-enb-nprb@6+mod-enb-ncells@2+mod-enb-cells-2ca+suite-4g@10,2+" \ "mod-enb-meas-enable -t =handover.py" """ and in resources.conf (or scenario), added: """ enb: ... cell_list: - dl_rfemu: type: gnuradio_zmq - dl_rfemu: type: gnuradio_zmq """ Note that since the broker is used, there's not need for mod-srsue-ncarriers@2 since the broker is joining the 2 enb cells into 1 stream on the UE side. Change-Id: I6282cda400558dcb356276786d91e6388524c5b1
2020-10-05 17:23:38 +00:00
# vim: expandtab tabstop=4 shiftwidth=4