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

69 lines
2.3 KiB
Python
Raw Normal View History

# osmo_gsm_tester: class defining a RF emulation object
#
# 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 abc import ABCMeta, abstractmethod
from ..core import log
from ..core.event_loop import MainLoop
class RFemulation(log.Origin, metaclass=ABCMeta):
##############
# PROTECTED
##############
def __init__(self, conf, name):
"""Base constructor. Must be called by subclass."""
super().__init__(log.C_RUN, name)
self.conf = conf
#############################
# PUBLIC (test API included)
#############################
@abstractmethod
def set_attenuation(self, db):
"""Set attenuation in dB on the configured channel"""
pass
@abstractmethod
def get_max_attenuation(self):
"""Get maximum channel attenuation"""
pass
def get_instance_by_type(rfemu_type, rfemu_opt):
"""Allocate a RFemulation child class based on type. Opts are passed to the newly created object."""
if rfemu_type == 'amarisoftctl':
from .rfemu_amarisoftctrl import RFemulationAmarisoftCtrl
obj = RFemulationAmarisoftCtrl
elif rfemu_type == 'minicircuits':
from .rfemu_minicircuits import RFemulationMinicircuitsHTTP
obj = RFemulationMinicircuitsHTTP
elif rfemu_type == 'srsenb_stdin':
from .rfemu_srsenb_stdin import RFemulationSrsStdin
obj = RFemulationSrsStdin
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
elif rfemu_type == 'gnuradio_zmq':
from .rfemu_gnuradio_zmq import RFemulationGnuradioZmq
obj = RFemulationGnuradioZmq
else:
raise log.Error('RFemulation type not supported:', rfemu_type)
return obj(rfemu_opt)
# vim: expandtab tabstop=4 shiftwidth=4