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/11191 Change subject: osmotrx: Allow running osmo-trx from remote host ...................................................................... osmotrx: Allow running osmo-trx from remote host Change-Id: Ia31ac8eb41e02eda28d9f6f56774679300244ee8 --- M example/resources.conf.rnd M src/osmo_gsm_tester/bts_osmotrx.py M src/osmo_gsm_tester/resource.py 3 files changed, 31 insertions(+), 6 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/91/11191/1 diff --git a/example/resources.conf.rnd b/example/resources.conf.rnd index 74b8e3e..2067efc 100644 --- a/example/resources.conf.rnd +++ b/example/resources.conf.rnd @@ -28,6 +28,8 @@ type: uhd launch_trx: true clock_reference: external + remote_user: jenkins + trx_ip: 127.0.0.1 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 e7e3542..3ed596a 100644 --- a/src/osmo_gsm_tester/bts_osmotrx.py +++ b/src/osmo_gsm_tester/bts_osmotrx.py @@ -141,6 +141,7 @@ class OsmoTrx(log.Origin, metaclass=ABCMeta): CONF_OSMO_TRX = 'osmo-trx.cfg' + REMOTE_DIR = '/osmo-gsm-tester-trx/last_run' ############## # PROTECTED @@ -150,8 +151,10 @@ self.suite_run = suite_run self.conf = conf self.env = {} - self.listen_ip = conf.get('trx_ip') - self.bts_ip = conf.get('bts_ip') + self.log("OSMOTRX CONF: %r" % conf) + self.listen_ip = conf.get('osmo_trx', {}).get('trx_ip') + self.bts_ip = conf.get('osmo_trx', {}).get('bts_ip') + self.remote_user = conf.get('osmo_trx', {}).get('remote_user', None) self.run_dir = None self.inst = None self.proc_trx = None @@ -184,7 +187,7 @@ self.dbg(r) f.write(r) - def launch_process(self, keepalive, binary_name, *args): + def launch_process_local(self, keepalive, 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): @@ -196,6 +199,14 @@ proc.launch() return proc + def launch_process_remote(self, name, popen_args, remote_cwd=None, keepalive=False): + run_dir = self.run_dir.new_dir(name) + proc = process.RemoteProcess(name, run_dir, self.remote_user, self.listen_ip, remote_cwd, + popen_args) + self.suite_run.remember_to_stop(proc, keepalive) + proc.launch() + return proc + ############## # PUBLIC (test API included) ############## @@ -203,10 +214,21 @@ 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(), + if not self.remote_user: + # Run locally if ssh user is not set + lib = self.inst.child('lib') + self.env = { 'LD_LIBRARY_PATH': util.prepend_library_path(lib) } + self.proc_trx = self.launch_process_local(keepalive, self.binary_name(), '-C', os.path.abspath(self.config_file)) + else: + remote_run_dir = util.Dir(OsmoTrx.REMOTE_DIR) + self.remote_inst = process.copy_inst_ssh(self.run_dir, self.inst, remote_run_dir, self.remote_user, + self.listen_ip, self.binary_name(), self.config_file) + remote_config_file = remote_run_dir.child(OsmoTrx.CONF_OSMO_TRX) + remote_lib = self.remote_inst.child('lib') + remote_binary = self.remote_inst.child('bin', self.binary_name()) + args = ('LD_LIBRARY_PATH=%s' % remote_lib, remote_binary, '-C', remote_config_file) + self.proc_trx = self.launch_process_remote(self.binary_name(), args, remote_cwd=remote_run_dir, keepalive=keepalive) def trx_ready(self): if not self.proc_trx or not self.proc_trx.is_running: diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index e043d87..3f2ddc7 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -72,6 +72,7 @@ 'bts[].osmo_trx.type': schema.STR, 'bts[].osmo_trx.clock_reference': schema.OSMO_TRX_CLOCK_REF, 'bts[].osmo_trx.trx_ip': schema.IPV4, + 'bts[].osmo_trx.remote_user': schema.STR, 'bts[].osmo_trx.multi_arfcn': schema.BOOL_STR, 'arfcn[].arfcn': schema.INT, 'arfcn[].band': schema.BAND, -- To view, visit https://gerrit.osmocom.org/11191 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: Ia31ac8eb41e02eda28d9f6f56774679300244ee8 Gerrit-Change-Number: 11191 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/20181002/d7d04c9b/attachment.htm>