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 submitted this change and it was merged. Change subject: Add OsmoPcu class ...................................................................... Add OsmoPcu class Change-Id: I04d8ed5e02b090d07e91669df44ce354bc6ee749 --- A src/osmo_gsm_tester/pcu_osmo.py M src/osmo_gsm_tester/templates/osmo-pcu.cfg.tmpl 2 files changed, 94 insertions(+), 0 deletions(-) Approvals: Neels Hofmeyr: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo_gsm_tester/pcu_osmo.py b/src/osmo_gsm_tester/pcu_osmo.py new file mode 100644 index 0000000..23c93eb --- /dev/null +++ b/src/osmo_gsm_tester/pcu_osmo.py @@ -0,0 +1,88 @@ +# osmo_gsm_tester: specifics for running an osmo-pcu +# +# Copyright (C) 2016-2017 by sysmocom - s.f.m.c. GmbH +# +# Author: Pau Espin Pedrol <pespin at 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/>. + +import os +import pprint +import tempfile +from . import log, config, util, template, process, event_loop + +class OsmoPcu(log.Origin): + suite_run = None + run_dir = None + inst = None + env = None + + BIN_PCU = 'osmo-pcu' + PCU_OSMO_CFG = 'osmo-pcu.cfg' + + def __init__(self, suite_run, bts, conf): + super().__init__(log.C_RUN, OsmoPcu.BIN_PCU) + self.suite_run = suite_run + self.bts = bts + self.conf = conf + self.env = {} + + 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('osmo-pcu'))) + 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.launch_process(OsmoPcu.BIN_PCU, '-r', '1', + '-c', os.path.abspath(self.config_file), + '-i', self.bts.bsc.addr()) + self.suite_run.poll() + + def launch_process(self, binary_name, *args): + 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) + proc.launch() + return proc + + def configure(self): + self.config_file = self.run_dir.new_file(OsmoPcu.PCU_OSMO_CFG) + self.dbg(config_file=self.config_file) + + values = dict(osmo_pcu=config.get_defaults('osmo_pcu')) + config.overlay(values, self.suite_run.config()) + config.overlay(values, { + 'osmo_pcu': { + 'pcu_socket_path': self.bts.pcu_socket_path(), + } + }) + config.overlay(values, { 'osmo_pcu': self.conf }) + + self.dbg('OSMO-PCU CONFIG:\n' + pprint.pformat(values)) + + with open(self.config_file, 'w') as f: + r = template.render(OsmoPcu.PCU_OSMO_CFG, values) + self.dbg(r) + f.write(r) + +# vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/osmo_gsm_tester/templates/osmo-pcu.cfg.tmpl b/src/osmo_gsm_tester/templates/osmo-pcu.cfg.tmpl index b88e6e7..02382c2 100644 --- a/src/osmo_gsm_tester/templates/osmo-pcu.cfg.tmpl +++ b/src/osmo_gsm_tester/templates/osmo-pcu.cfg.tmpl @@ -1,4 +1,10 @@ +log stderr + logging color 1 + logging print extended-timestamp 1 + logging print category 1 + logging level all debug pcu + pcu-socket ${osmo_pcu.pcu_socket_path} flow-control-interval 10 cs 2 alloc-algorithm dynamic -- To view, visit https://gerrit.osmocom.org/5004 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I04d8ed5e02b090d07e91669df44ce354bc6ee749 Gerrit-PatchSet: 3 Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de> Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>