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/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/16173 ) Change subject: WIP ...................................................................... WIP Change-Id: I15da34c9467e46ae92adbce5f671b344bea5ee5a --- M example/resources.conf.prod M src/osmo_gsm_tester/bts_osmotrx.py M src/osmo_gsm_tester/process.py M src/osmo_gsm_tester/resource.py 4 files changed, 71 insertions(+), 26 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/73/16173/1 diff --git a/example/resources.conf.prod b/example/resources.conf.prod index 0bf9f45..826ed4f 100644 --- a/example/resources.conf.prod +++ b/example/resources.conf.prod @@ -62,6 +62,22 @@ trx_ip: 10.42.42.117 clock_reference: external dev_args: "LimeSDR-USB,serial=00090706024F0A22" + channels: + - rx_path: "LNAW" + +- label: LimeNET-Micro + type: osmo-bts-trx + ipa_unit_id: 15 + addr: 10.42.42.53 + band: GSM-1800 + ciphers: [a5_0, a5_1] + osmo_trx: + type: lms + launch_trx: true + remote_user: pi + trx_ip: 10.42.42.123 + clock_reference: external + dev_args: "LimeNET-Micro,serial=005839AF25B352" - label: sysmoCell 5000 type: osmo-bts-trx diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py index 554a236..0578259 100644 --- a/src/osmo_gsm_tester/bts_osmotrx.py +++ b/src/osmo_gsm_tester/bts_osmotrx.py @@ -295,35 +295,55 @@ os.chmod(wrapper_script, st.st_mode | stat.S_IEXEC) return wrapper_script + def inst_compatible_for_remote(self): + proc = process.run_remote_sync(self.run_dir, self.remote_user, self.listen_ip, 'uname-m', ('uname', '-m')) + if "x86_64" in (proc.get_stdout() or ''): + return True + return False + + def start_remotely(self, keepalive): + # Run remotely through ssh. We need to run osmo-trx under a wrapper + # script since osmo-trx ignores SIGHUP and will keep running after + # we close local ssh session. The wrapper script catches SIGHUP and + # sends SIGINT to it. + remote_run_dir = util.Dir(OsmoTrx.REMOTE_DIR) + remote_config_file = remote_run_dir.child(OsmoTrx.CONF_OSMO_TRX) + + have_inst = self.inst_compatible_for_remote() + if have_inst: + self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-trx'))) + + # if self.inst is None, we still want to copy config file, create remote run dir, etc. + 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) + + wrapper_script = self.generate_wrapper_script() + remote_wrapper_script = remote_run_dir.child(OsmoTrx.WRAPPER_SCRIPT) + process.scp(self.run_dir, self.remote_user, self.listen_ip, 'scp-wrapper-to-remote', wrapper_script, remote_wrapper_script) + + if have_inst: + 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_wrapper_script, remote_binary, '-C', remote_config_file) + else: # Use whatever is available i nremote system PATH: + args = (remote_wrapper_script, self.binary_name(), '-C', remote_config_file) + + self.proc_trx = self.launch_process_remote(self.binary_name(), args, remote_cwd=remote_run_dir, keepalive=keepalive) + ############## # PUBLIC (test API included) ############## def start(self, keepalive=False): self.configure() + if self.remote_user: + self.start_remotely(keepalive) + return + # Run locally if ssh user is not set self.inst = util.Dir(os.path.abspath(self.suite_run.trial.get_inst('osmo-trx'))) - 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: - # Run remotely through ssh. We need to run osmo-trx under a wrapper - # script since osmo-trx ignores SIGHUP and will keep running after - # we close local ssh session. The wrapper script catches SIGHUP and - # sends SIGINT to it. - wrapper_script = self.generate_wrapper_script() - 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_wrapper_script = remote_run_dir.child(OsmoTrx.WRAPPER_SCRIPT) - 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()) - process.scp(self.run_dir, self.remote_user, self.listen_ip, 'scp-wrapper-to-remote', wrapper_script, remote_wrapper_script) - - args = ('LD_LIBRARY_PATH=%s' % remote_lib, remote_wrapper_script, remote_binary, '-C', remote_config_file) - self.proc_trx = self.launch_process_remote(self.binary_name(), args, remote_cwd=remote_run_dir, keepalive=keepalive) + 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)) def trx_ready(self): if not self.proc_trx or not self.proc_trx.is_running: @@ -344,7 +364,7 @@ def __init__(self, suite_run, conf): super().__init__(suite_run, conf) - self.conf['osmo_trx']['channels'][0]['rx_path'] = 'LNAW' + #self.conf['osmo_trx']['channels'][0]['rx_path'] = 'LNAW' def binary_name(self): return OsmoTrxLMS.BIN_TRX diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py index b73673f..06da3bf 100644 --- a/src/osmo_gsm_tester/process.py +++ b/src/osmo_gsm_tester/process.py @@ -399,26 +399,33 @@ run_dir =run_dir.new_dir(name) proc = Process(name, run_dir, popen_args) proc.launch_sync() + return proc def run_local_netns_sync(run_dir, name, netns, popen_args): run_dir =run_dir.new_dir(name) proc = NetNSProcess(name, run_dir, netns, popen_args) proc.launch_sync() + return proc def run_remote_sync(run_dir, remote_user, remote_addr, name, popen_args, remote_cwd=None): run_dir = run_dir.new_dir(name) proc = RemoteProcess(name, run_dir, remote_user, remote_addr, remote_cwd, popen_args) proc.launch_sync() + return proc def scp(run_dir, remote_user, remote_addr, name, local_path, remote_path): run_local_sync(run_dir, name, ('scp', '-r', local_path, '%s@%s:%s' % (remote_user, remote_addr, remote_path))) +# If no inst binaries copying is required (eg. because binary+libs is already available in distro), inst can be None. def copy_inst_ssh(run_dir, inst, remote_dir, remote_user, remote_addr, remote_rundir_append, cfg_file_name): - remote_inst = Dir(remote_dir.child(os.path.basename(str(inst)))) remote_dir_str = str(remote_dir) run_remote_sync(run_dir, remote_user, remote_addr, 'rm-remote-dir', ('test', '!', '-d', remote_dir_str, '||', 'rm', '-rf', remote_dir_str)) run_remote_sync(run_dir, remote_user, remote_addr, 'mk-remote-dir', ('mkdir', '-p', remote_dir_str)) - scp(run_dir, remote_user, remote_addr, 'scp-inst-to-remote', str(inst), remote_dir_str) + if inst is not None: + remote_inst = Dir(remote_dir.child(os.path.basename(str(inst)))) + scp(run_dir, remote_user, remote_addr, 'scp-inst-to-remote', str(inst), remote_dir_str) + else: + remote_inst = None remote_run_dir = remote_dir.child(remote_rundir_append) run_remote_sync(run_dir, remote_user, remote_addr, 'mk-remote-run-dir', ('mkdir', '-p', remote_run_dir)) diff --git a/src/osmo_gsm_tester/resource.py b/src/osmo_gsm_tester/resource.py index 1b18076..992734d 100644 --- a/src/osmo_gsm_tester/resource.py +++ b/src/osmo_gsm_tester/resource.py @@ -76,6 +76,8 @@ 'bts[].osmo_trx.dev_args': schema.STR, 'bts[].osmo_trx.multi_arfcn': schema.BOOL_STR, 'bts[].osmo_trx.max_trxd_version': schema.UINT, + 'bts[].osmo_trx.channels[].rx_path': schema.STR, + 'bts[].osmo_trx.channels[].tx_path': schema.STR, 'arfcn[].arfcn': schema.INT, 'arfcn[].band': schema.BAND, 'modem[].type': schema.STR, -- To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/16173 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-gsm-tester Gerrit-Branch: master Gerrit-Change-Id: I15da34c9467e46ae92adbce5f671b344bea5ee5a Gerrit-Change-Number: 16173 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pespin at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191122/2154fea2/attachment.htm>