Change in osmo-gsm-tester[master]: bts_osmotrx: Add support to run osmo-trx on LimeNet-micro

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.org
Wed Nov 27 08:02:11 UTC 2019


pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/16231 )

Change subject: bts_osmotrx: Add support to run osmo-trx on LimeNet-micro
......................................................................

bts_osmotrx: Add support to run osmo-trx on LimeNet-micro

bts_osmotrx will check if target host can run the inst, and otherwise
run osmo-trx-lms already present in the system (installed by other
means). This way same class can be used both ways, since the only real
difference between the 2 scenarios is:
* copying inst vs not copying it.
* Running binary from inst vs running it from PATH.

This commit does not provide a mechanism to make sure the osmo-trx or its
dependencies are up-to-date in the target system. A solution for that
will be provided separately.

Related: SYS#4663
Change-Id: I6bd76f6d7e0cb2b6f7bdde971b6515846048a341
---
M example/resources.conf.prod
A example/scenarios/trx-lms-limenet-micro.conf
M src/osmo_gsm_tester/bts_osmotrx.py
3 files changed, 61 insertions(+), 23 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved



diff --git a/example/resources.conf.prod b/example/resources.conf.prod
index e5911f1..6de4e2e 100644
--- a/example/resources.conf.prod
+++ b/example/resources.conf.prod
@@ -65,6 +65,20 @@
     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
   ipa_unit_id: 7
diff --git a/example/scenarios/trx-lms-limenet-micro.conf b/example/scenarios/trx-lms-limenet-micro.conf
new file mode 100644
index 0000000..2e2c1cc
--- /dev/null
+++ b/example/scenarios/trx-lms-limenet-micro.conf
@@ -0,0 +1,4 @@
+resources:
+  bts:
+  - label: LimeNET-Micro
+    type: osmo-bts-trx
diff --git a/src/osmo_gsm_tester/bts_osmotrx.py b/src/osmo_gsm_tester/bts_osmotrx.py
index f1fbdd1..9110d8a 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:

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/16231
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: I6bd76f6d7e0cb2b6f7bdde971b6515846048a341
Gerrit-Change-Number: 16231
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191127/4c34a041/attachment.htm>


More information about the gerrit-log mailing list