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/.
Pau Espin Pedrol gerrit-no-reply at lists.osmocom.orgPau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/10667 Change subject: osmo-bts-trx: Big refactor and cleanup of osmo-trx related code ...................................................................... osmo-bts-trx: Big refactor and cleanup of osmo-trx related code * This commit is a preparation for future commits to add support for different osmo-trx devices and backends like osmo-trx-lms. * Drop deprecated osmo-trx-* cmd line params and use VTY cfg to set them. * As number of osmo-trx related osmo-gsm-tester attributes grow, group them togther in an "osmo_trx" dictionary. Change-Id: I77d29413c9e3b600b796627ba366f80c3281b7e1 --- M example/defaults.conf M example/resources.conf.prod M example/resources.conf.rnd M src/osmo_gsm_tester/bts_osmotrx.py M src/osmo_gsm_tester/resource.py M src/osmo_gsm_tester/schema.py M src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl M src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl 8 files changed, 119 insertions(+), 47 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/67/10667/1 diff --git a/example/defaults.conf b/example/defaults.conf index 5bdf257..fc4c324 100644 --- a/example/defaults.conf +++ b/example/defaults.conf @@ -75,3 +75,8 @@ - {} - phys_chan_config: TCH/F # nanobts only supports PDCH in TRX0. - phys_chan_config: TCH/F + +osmo_trx: + type: uhd + launch_trx: true + clock_reference: internal diff --git a/example/resources.conf.prod b/example/resources.conf.prod index 31a737c..41ab009 100644 --- a/example/resources.conf.prod +++ b/example/resources.conf.prod @@ -24,16 +24,21 @@ ipa_unit_id: 6 addr: 10.42.42.50 band: GSM-1800 - launch_trx: true ciphers: [a5_0, a5_1] + osmo_trx: + launch_trx: true + clock_reference: external - label: sysmoCell 5000 type: osmo-bts-trx ipa_unit_id: 7 addr: 10.42.42.51 band: GSM-1800 - trx_remote_ip: 10.42.42.112 ciphers: [a5_0, a5_1] + osmo_trx: + launch_trx: false + clock_reference: external + trx_ip: 10.42.42.112 - label: OCTBTS 3500 type: osmo-bts-octphy diff --git a/example/resources.conf.rnd b/example/resources.conf.rnd index 4e5c173..74b8e3e 100644 --- a/example/resources.conf.rnd +++ b/example/resources.conf.rnd @@ -24,7 +24,10 @@ ipa_unit_id: 6 addr: 10.42.42.50 band: GSM-1800 - launch_trx: true + osmo_trx: + type: uhd + launch_trx: true + clock_reference: external ciphers: [a5_0, a5_1] - label: NanoBTS-ONW-1900 diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py index 1584eb2..1c7349f 100644 --- a/src/osmo_gsm_tester/bts_osmotrx.py +++ b/src/osmo_gsm_tester/bts_osmotrx.py @@ -20,6 +20,7 @@ import os import pprint import tempfile +from abc import ABCMeta, abstractmethod from . import log, config, util, template, process, pcu_osmo, bts_osmo from .event_loop import MainLoop @@ -39,17 +40,15 @@ self.inst = None self.trx = None self.env = {} + self.gen_conf = {} def trx_remote_ip(self): - conf_ip = self.conf.get('trx_remote_ip', None) + conf_ip = self.conf.get('osmo_trx', {}).get('trx_ip', None) if conf_ip is not None: return conf_ip # if 'trx_remote_ip' is not configured, use same IP as BTS return self.remote_addr() - def launch_trx_enabled(self): - return util.str2bool(self.conf.get('launch_trx')) - def launch_process(self, keepalive, binary_name, *args): binary = os.path.abspath(self.inst.child('bin', binary_name)) run_dir = self.run_dir.new_dir(binary_name) @@ -69,17 +68,22 @@ self.dbg(config_file=self.config_file) values = dict(osmo_bts_trx=config.get_defaults('osmo_bts_trx')) + config.overlay(values, dict(osmo_bts_trx=dict(osmo_trx=config.get_defaults('osmo_trx')))) config.overlay(values, self.suite_run.config()) config.overlay(values, { 'osmo_bts_trx': { 'oml_remote_ip': self.bsc.addr(), - 'trx_local_ip': self.remote_addr(), - 'trx_remote_ip': self.trx_remote_ip(), 'pcu_socket_path': self.pcu_socket_path(), + 'osmo_trx': { + 'bts_ip': self.remote_addr(), + 'trx_ip': self.trx_remote_ip(), + 'channels': [{}] # TODO: implement channels for multiTRX + } } }) config.overlay(values, { 'osmo_bts_trx': self.conf }) + self.gen_conf = values self.dbg('OSMO-BTS-TRX CONFIG:\n' + pprint.pformat(values)) with open(self.config_file, 'w') as f: @@ -87,6 +91,12 @@ self.dbg(r) f.write(r) + def launch_trx_enabled(self): + return util.str2bool(self.gen_conf['osmo_bts_trx'].get('osmo_trx', {}).get('launch_trx')) + + def get_osmo_trx_type(self): + return self.gen_conf['osmo_bts_trx'].get('osmo_trx', {}).get('type') + ######################## # PUBLIC - INTERNAL API ######################## @@ -95,6 +105,9 @@ self.dbg(conf=values) return values + def conf_for_osmotrx(self): + return dict(osmo_trx=self.gen_conf['osmo_bts_trx'].get('osmo_trx', {})) + ################### # PUBLIC (test API included) ################### @@ -108,9 +121,9 @@ self.configure() if self.launch_trx_enabled(): - self.trx = OsmoTrx(self.suite_run, self.conf, self.trx_remote_ip(), self.remote_addr()) + self.trx = OsmoTrx.get_instance_by_type(self.get_osmo_trx_type(), self.suite_run, self.conf_for_osmotrx()) self.trx.start(keepalive) - self.log('Waiting for osmo-trx to start up...') + self.log('Waiting for %s to start up...' % self.trx.name()) MainLoop.wait(self, self.trx.trx_ready) self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-bts'))) @@ -124,36 +137,42 @@ '-i', self.bsc.addr()) self.suite_run.poll() -class OsmoTrx(log.Origin): - suite_run = None - run_dir = None - inst = None - env = None - proc_trx = None +class OsmoTrx(log.Origin, metaclass=ABCMeta): - BIN_TRX = 'osmo-trx-uhd' CONF_OSMO_TRX = 'osmo-trx.cfg' - def __init__(self, suite_run, conf, listen_ip, bts_ip): - super().__init__(log.C_RUN, OsmoTrx.BIN_TRX) +############## +# PROTECTED +############## + def __init__(self, suite_run, conf): + super().__init__(log.C_RUN, self.binary_name()) self.suite_run = suite_run self.conf = conf self.env = {} - self.listen_ip = listen_ip - self.bts_ip = bts_ip + self.listen_ip = conf.get('trx_ip') + self.bts_ip = conf.get('bts_ip') + self.run_dir = None + self.inst = None + self.proc_trx = None + + @classmethod + def get_instance_by_type(cls, type, suite_run, conf): + KNOWN_OSMOTRX_TYPES = { + 'uhd': OsmoTrxUHD, + } + osmo_trx_class = KNOWN_OSMOTRX_TYPES.get(type) + return osmo_trx_class(suite_run, conf) + + @abstractmethod + def binary_name(self): + 'Used by base class. Subclass can create different OsmoTRX implementations.' + pass def configure(self): self.config_file = self.run_dir.new_file(OsmoTrx.CONF_OSMO_TRX) self.dbg(config_file=self.config_file) - values = dict(osmo_bts_trx=config.get_defaults('osmo_trx')) - config.overlay(values, self.suite_run.config()) - config.overlay(values, { - 'osmo_trx': { - 'bind_ip' : self.listen_ip, - } - }) - config.overlay(values, { 'osmo_trx': self.conf }) + values = self.conf self.dbg('OSMO-TRX CONFIG:\n' + pprint.pformat(values)) @@ -162,16 +181,6 @@ self.dbg(r) f.write(r) - def start(self, keepalive=False): - 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-trx'))) - lib = self.inst.child('lib') - self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) } - self.proc_trx = self.launch_process(keepalive, OsmoTrx.BIN_TRX, '-x', - '-j', self.listen_ip, '-i', self.bts_ip, - '-C', os.path.abspath(self.config_file)) - def launch_process(self, keepalive, binary_name, *args): binary = os.path.abspath(self.inst.child('bin', binary_name)) run_dir = self.run_dir.new_dir(binary_name) @@ -184,8 +193,30 @@ proc.launch() return proc +############## +# PUBLIC (test API included) +############## + def start(self, keepalive=False): + 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-trx'))) + lib = self.inst.child('lib') + self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) } + self.proc_trx = self.launch_process(keepalive, self.binary_name(), + '-C', os.path.abspath(self.config_file)) + def trx_ready(self): if not self.proc_trx or not self.proc_trx.is_running: return False return '-- Transceiver active with' in (self.proc_trx.get_stdout() or '') + +class OsmoTrxUHD(OsmoTrx): + BIN_TRX = 'osmo-trx-uhd' + + def __init__(self, suite_run, conf): + super().__init__(suite_run, conf) + + def binary_name(self): + return OsmoTrxUHD.BIN_TRX + # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index 15f2711..9ca5665 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -54,8 +54,6 @@ 'bts[].ipa_unit_id': schema.UINT, 'bts[].addr': schema.IPV4, 'bts[].band': schema.BAND, - 'bts[].trx_remote_ip': schema.IPV4, - 'bts[].launch_trx': schema.BOOL_STR, 'bts[].direct_pcu': schema.BOOL_STR, 'bts[].ciphers[]': schema.CIPHER, 'bts[].channel_allocator': schema.CHAN_ALLOCATOR, @@ -70,6 +68,10 @@ 'bts[].trx_list[].power_supply.type': schema.STR, 'bts[].trx_list[].power_supply.device': schema.STR, 'bts[].trx_list[].power_supply.port': schema.STR, + 'bts[].osmo_trx.launch_trx': schema.BOOL_STR, + 'bts[].osmo_trx.type': schema.STR, + 'bts[].osmo_trx.clock_reference': schema.OSMO_TRX_CLOCK_REF, + 'bts[].osmo_trx.trx_ip': schema.IPV4, 'arfcn[].arfcn': schema.INT, 'arfcn[].band': schema.BAND, 'modem[].label': schema.STR, diff --git a/src/osmo_gsm_tester/schema.py b/src/osmo_gsm_tester/schema.py index 174c28f..12cfd7a 100644 --- a/src/osmo_gsm_tester/schema.py +++ b/src/osmo_gsm_tester/schema.py @@ -115,6 +115,11 @@ return raise ValueError('Unknown Codec value: %r' % val) +def osmo_trx_clock_ref(val): + if val in ('internal', 'external', 'gspdo'): + return + raise ValueError('Unknown OsmoTRX clock reference value: %r' % val) + INT = 'int' STR = 'str' UINT = 'uint' @@ -132,6 +137,7 @@ PHY_CHAN = 'chan' CHAN_ALLOCATOR = 'chan_allocator' CODEC = 'codec' +OSMO_TRX_CLOCK_REF = 'osmo_trx_clock_ref' SCHEMA_TYPES = { INT: int, @@ -151,6 +157,7 @@ PHY_CHAN: phy_channel_config, CHAN_ALLOCATOR: channel_allocator, CODEC: codec, + OSMO_TRX_CLOCK_REF: osmo_trx_clock_ref, } def validate(config, schema): diff --git a/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl index d95ca6e..5dba323 100644 --- a/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl +++ b/src/osmo_gsm_tester/templates/osmo-bts-trx.cfg.tmpl @@ -21,8 +21,8 @@ bind ${osmo_bts_trx.addr} ! phy 0 - osmotrx ip local ${osmo_bts_trx.trx_local_ip} - osmotrx ip remote ${osmo_bts_trx.trx_remote_ip} + osmotrx ip local ${osmo_bts_trx.osmo_trx.bts_ip} + osmotrx ip remote ${osmo_bts_trx.osmo_trx.trx_ip} instance 0 osmotrx rx-gain 25 osmotrx tx-attenuation oml diff --git a/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl index a197c59..2f6e830 100644 --- a/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl +++ b/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl @@ -1,15 +1,34 @@ ! -! OsmoHLR example configuration +! OsmoTRX example configuration ! log stderr logging filter all 1 logging color 1 logging print category 1 logging timestamp 1 + logging print file basename logging print extended-timestamp 1 logging level all info ! line vty - bind ${osmo_trx.bind_ip} + bind ${osmo_trx.trx_ip} ctrl - bind ${osmo_trx.bind_ip} + bind ${osmo_trx.trx_ip} +trx + bind-ip ${osmo_trx.trx_ip} + remote-ip ${osmo_trx.bts_ip} + base-port 5700 + egprs disable + tx-sps 4 + rx-sps 4 + clock-ref ${osmo_trx.clock_reference} + rt-prio 18 +%for chan in osmo_trx.channels: + chan ${loop.index} +% if chan.get('tx_path', False): + tx-path ${chan.tx_path} +% endif +% if chan.get('rx_path', False): + rx-path ${chan.rx_path} + %endif +%endfor -- To view, visit https://gerrit.osmocom.org/10667 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: I77d29413c9e3b600b796627ba366f80c3281b7e1 Gerrit-Change-Number: 10667 Gerrit-PatchSet: 1 Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180828/15e35b72/attachment.htm>