Pau Espin Pedrol has submitted this change and it was merged. Change subject: osmo-trx: Add cfg template ......................................................................
osmo-trx: Add cfg template Since commit 3da1f8352e337fb032bf7a58c2909d3ba918e237, osmo-trx requires a cfg file to start successfully. Change-Id: I8f0e0d0a9fa849f41c3cccc4059431f62f956eac --- M src/osmo_gsm_tester/bts_osmotrx.py A src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl 2 files changed, 43 insertions(+), 3 deletions(-) Approvals: Pau Espin Pedrol: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py index ea644f1..ba7258e 100644 --- a/src/osmo_gsm_tester/bts_osmotrx.py +++ b/src/osmo_gsm_tester/bts_osmotrx.py @@ -122,7 +122,7 @@ self.configure() if self.launch_trx_enabled(): - self.trx = OsmoTrx(self.suite_run, self.trx_remote_ip(), self.remote_addr()) + self.trx = OsmoTrx(self.suite_run, self.conf, self.trx_remote_ip(), self.remote_addr()) self.trx.start() self.log('Waiting for osmo-trx to start up...') event_loop.wait(self, self.trx.trx_ready) @@ -146,20 +146,45 @@ proc_trx = None BIN_TRX = 'osmo-trx' + CONF_OSMO_TRX = 'osmo-trx.cfg' - def __init__(self, suite_run, listen_ip, bts_ip): + def __init__(self, suite_run, conf, listen_ip, bts_ip): super().__init__(log.C_RUN, OsmoTrx.BIN_TRX) self.suite_run = suite_run + self.conf = conf self.env = {} self.listen_ip = listen_ip self.bts_ip = bts_ip + 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 }) + + self.dbg('OSMO-TRX CONFIG:\n' + pprint.pformat(values)) + + with open(self.config_file, 'w') as f: + r = template.render(OsmoTrx.CONF_OSMO_TRX, values) + self.dbg(r) + f.write(r) + def start(self): 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(OsmoTrx.BIN_TRX))) lib = self.inst.child('lib') self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) } - self.proc_trx = self.launch_process(OsmoTrx.BIN_TRX, '-x', '-j', self.listen_ip, '-i', self.bts_ip) + self.proc_trx = self.launch_process(OsmoTrx.BIN_TRX, '-x', + '-j', self.listen_ip, '-i', self.bts_ip, + '-C', os.path.abspath(self.config_file)) def launch_process(self, binary_name, *args): binary = os.path.abspath(self.inst.child('bin', binary_name)) diff --git a/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl new file mode 100644 index 0000000..a197c59 --- /dev/null +++ b/src/osmo_gsm_tester/templates/osmo-trx.cfg.tmpl @@ -0,0 +1,15 @@ +! +! OsmoHLR example configuration +! +log stderr + logging filter all 1 + logging color 1 + logging print category 1 + logging timestamp 1 + logging print extended-timestamp 1 + logging level all info +! +line vty + bind ${osmo_trx.bind_ip} +ctrl + bind ${osmo_trx.bind_ip} -- To view, visit https://gerrit.osmocom.org/7074 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8f0e0d0a9fa849f41c3cccc4059431f62f956eac Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>