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/.
Holger Freyther gerrit-no-reply at lists.osmocom.orgHolger Freyther has uploaded this change for review. ( https://gerrit.osmocom.org/12209 Change subject: ms_driver: Add a virtual bts and make use of it ...................................................................... ms_driver: Add a virtual bts and make use of it It's very close to the osmo-bts-trx but without osmo-trx. Modify the suite to make use of this BTS. Change-Id: I9f5a2501eb4473ccf2287c902ee207c6a45a1bc5 --- M example/defaults.conf M example/resources.conf.prod A src/osmo_gsm_tester/bts_osmovirtual.py M src/osmo_gsm_tester/resource.py A src/osmo_gsm_tester/templates/osmo-bts-virtual.cfg.tmpl M suites/nitb_netreg_mass/suite.conf 6 files changed, 176 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/09/12209/1 diff --git a/example/defaults.conf b/example/defaults.conf index eee17b1..3de5e29 100644 --- a/example/defaults.conf +++ b/example/defaults.conf @@ -84,3 +84,6 @@ type: uhd launch_trx: true clock_reference: internal + +osmo_bts_virtual: + max_trx: 1 diff --git a/example/resources.conf.prod b/example/resources.conf.prod index e786836..c6bc4e9 100644 --- a/example/resources.conf.prod +++ b/example/resources.conf.prod @@ -110,6 +110,13 @@ device: '01:01:4d:98:24' port: '3' +- label: OsmoBTS Virtual + type: osmo-bts-virtual + ipa_unit_id: 11 + addr: 10.42.42.123 + band: GSM-1800 + num_trx: 1 + arfcn: - arfcn: 512 band: GSM-1800 diff --git a/src/osmo_gsm_tester/bts_osmovirtual.py b/src/osmo_gsm_tester/bts_osmovirtual.py new file mode 100644 index 0000000..516d992 --- /dev/null +++ b/src/osmo_gsm_tester/bts_osmovirtual.py @@ -0,0 +1,115 @@ +# osmo_gsm_tester: specifics for running an osmo-bts-virtual +# +# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH +# Copyright (C) 2018 Holger Hans Peter Freyther +# +# Author: Neels Hofmeyr <neels at hofmeyr.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/>. + +import os +import pprint +from . import config, util, template, process, bts_osmo + +class OsmoBtsVirtual(bts_osmo.OsmoBtsMainUnit): +############## +# PROTECTED +############## + + BIN_BTS = 'osmo-bts-virtual' + BIN_PCU = 'osmo-pcu' + + CONF_BTS = 'osmo-bts-virtual.cfg' + + def __init__(self, suite_run, conf): + """Initializes the OsmoBtsVirtual.""" + super().__init__(suite_run, conf, OsmoBtsVirtual.BIN_BTS, 'osmo_bts_virtual') + self.run_dir = None + self.inst = None + self.env = {} + + def launch_process(self, keepalive, binary_name, *args): + """Launches the osmo-bts-virtual process.""" + + binary = os.path.abspath(self.inst.child('bin', binary_name)) + run_dir = self.run_dir.new_dir(binary_name) + if not os.path.isfile(binary): + raise RuntimeError('Binary missing: %r' % binary) + proc = process.Process(binary_name, run_dir, + (binary,) + args, + env=self.env) + self.suite_run.remember_to_stop(proc, keepalive) + proc.launch() + return proc + + def configure(self): + """Builds the configuration for osmo-bts-virtual and writes it to a file.""" + + if self.bsc is None: + raise RuntimeError('BTS needs to be added to a BSC or NITB before it can be configured') + self.config_file = self.run_dir.new_file(OsmoBtsVirtual.CONF_BTS) + self.dbg(config_file=self.config_file) + + values = dict(osmo_bts_virtual=config.get_defaults('osmo_bts_virtual')) + config.overlay(values, self.suite_run.config()) + config.overlay(values, { + 'osmo_bts_virtual': { + 'oml_remote_ip': self.bsc.addr(), + 'pcu_socket_path': self.pcu_socket_path(), + } + }) + config.overlay(values, { 'osmo_bts_virtual': self.conf }) + + self.dbg('OSMO-BTS-VIRTUAL CONFIG:\n' + pprint.pformat(values)) + + with open(self.config_file, 'w') as f: + r = template.render(OsmoBtsVirtual.CONF_BTS, values) + self.dbg(r) + f.write(r) + +######################## +# PUBLIC - INTERNAL API +######################## + def conf_for_bsc(self): + """Returns the configuration for the BSC (including the BSC/NITB IP).""" + values = self.conf_for_bsc_prepare() + self.dbg(conf=values) + return values + +################### +# PUBLIC (test API included) +################### + def start(self, keepalive=False): + """Handles starting/turning-up the osmo-bts-virtual process.""" + if self.bsc is None: + raise RuntimeError('BTS needs to be added to a BSC or NITB before it can be started') + self.suite_run.poll() + + self.log('Starting to connect to', self.bsc) + self.run_dir = util.Dir(self.suite_run.get_test_run_dir().new_dir(self.name())) + self.configure() + + self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-bts'))) + lib = self.inst.child('lib') + if not os.path.isdir(lib): + raise RuntimeError('No lib/ in %r' % self.inst) + self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) } + + self.proc_bts = self.launch_process(keepalive, OsmoBtsVirtual.BIN_BTS, '-r', '1', + '-c', os.path.abspath(self.config_file), + '-i', self.bsc.addr()) + self.suite_run.poll() + +# vim: expandtab tabstop=4 shiftwidth=4 + diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index e71f4cd..4f48dc4 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -29,7 +29,7 @@ from . import schema from . import modem from . import osmo_nitb -from . import bts_sysmo, bts_osmotrx, bts_octphy, bts_nanobts +from . import bts_sysmo, bts_osmotrx, bts_osmovirtual, bts_octphy, bts_nanobts from .util import is_dict, is_list @@ -102,6 +102,7 @@ 'osmo-bts-sysmo': bts_sysmo.SysmoBts, 'osmo-bts-trx': bts_osmotrx.OsmoBtsTrx, 'osmo-bts-octphy': bts_octphy.OsmoBtsOctphy, + 'osmo-bts-virtual': bts_osmovirtual.OsmoBtsVirtual, 'nanobts': bts_nanobts.NanoBts, } diff --git a/src/osmo_gsm_tester/templates/osmo-bts-virtual.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bts-virtual.cfg.tmpl new file mode 100644 index 0000000..be4f50c --- /dev/null +++ b/src/osmo_gsm_tester/templates/osmo-bts-virtual.cfg.tmpl @@ -0,0 +1,48 @@ +! Configuration rendered by osmo-gsm-tester +log stderr + logging color 1 + logging print extended-timestamp 1 + logging print category 1 + logging level abis debug + logging level oml debug + logging level pag debug + logging level rll debug + logging level rr debug + logging level rsl debug + logging level l1c info + logging level l1p error + logging level trx info + ! Level required by ready_for_pcu(): pcu info + logging level pcu info +! +line vty + bind ${osmo_bts_virtual.addr} +ctrl + bind ${osmo_bts_virtual.addr} +! +phy 0 + instance 0 +bts 0 + band ${osmo_bts_virtual.band} + ipa unit-id ${osmo_bts_virtual.ipa_unit_id} 0 + oml remote-ip ${osmo_bts_virtual.oml_remote_ip} + pcu-socket ${osmo_bts_virtual.pcu_socket_path} + gsmtap-sapi bcch + gsmtap-sapi ccch + gsmtap-sapi rach + gsmtap-sapi agch + gsmtap-sapi pch + gsmtap-sapi sdcch + gsmtap-sapi tch/f + gsmtap-sapi tch/h + gsmtap-sapi pacch + gsmtap-sapi pdtch + gsmtap-sapi ptcch + gsmtap-sapi cbch + gsmtap-sapi sacch + trx 0 + power-ramp max-initial 23000 mdBm + power-ramp step-size 2000 mdB + power-ramp step-interval 1 + ms-power-control dsp + phy 0 instance 0 diff --git a/suites/nitb_netreg_mass/suite.conf b/suites/nitb_netreg_mass/suite.conf index bfb23cd..94ec603 100644 --- a/suites/nitb_netreg_mass/suite.conf +++ b/suites/nitb_netreg_mass/suite.conf @@ -2,7 +2,7 @@ ip_address: - times: 1 bts: - - times: 1 + - type: osmo-bts-virtual defaults: timeout: 40s -- To view, visit https://gerrit.osmocom.org/12209 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I9f5a2501eb4473ccf2287c902ee207c6a45a1bc5 Gerrit-Change-Number: 12209 Gerrit-PatchSet: 1 Gerrit-Owner: Holger Freyther <holger at freyther.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181208/72687e83/attachment.htm>