Change in osmo-gsm-tester[master]: Add handlers to run process under a specific netns on a remote host

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
Tue Feb 11 13:47:59 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17124 )


Change subject: Add handlers to run process under a specific netns on a remote host
......................................................................

Add handlers to run process under a specific netns on a remote host

It will be used later to run iiperf3-cli connected to srsue on another host.

Change-Id: I8d223fc302df42446f5876ba020cfbea94be09b9
---
M src/osmo_gsm_tester/process.py
M src/osmo_gsm_tester/remote.py
2 files changed, 10 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-tester refs/changes/24/17124/1

diff --git a/src/osmo_gsm_tester/process.py b/src/osmo_gsm_tester/process.py
index 3880630..2735c6a 100644
--- a/src/osmo_gsm_tester/process.py
+++ b/src/osmo_gsm_tester/process.py
@@ -396,6 +396,12 @@
         kill_cmd = ('kill', '-%d' % int(sig), str(self.process_obj.pid))
         run_local_netns_sync(self.run_dir, self.name()+"-kill"+str(sig), self.netns, kill_cmd)
 
+class RemoteNetNSProcess(RemoteProcess):
+    NETNS_EXEC_BIN = 'osmo-gsm-tester_netns_exec.sh'
+    def __init__(self, name, run_dir, remote_user, remote_host, remote_cwd, netns, popen_args, **popen_kwargs):
+        args = ['sudo', self.NETNS_EXEC_BIN, self.netns] + list(popen_args)
+        super().__init__(name, run_dir, remote_user, remote_host, remote_cwd, args, **popen_kwargs)
+        self.netns = netns
 
 def run_local_sync(run_dir, name, popen_args):
     run_dir =run_dir.new_dir(name)
diff --git a/src/osmo_gsm_tester/remote.py b/src/osmo_gsm_tester/remote.py
index 6be0a5e..771f2b8 100644
--- a/src/osmo_gsm_tester/remote.py
+++ b/src/osmo_gsm_tester/remote.py
@@ -93,6 +93,10 @@
         args = (remote_wrapper_script,) + popen_args
         return self.RemoteProcess(name, args, remote_env, **popen_kwargs)
 
+    def RemoteNetNSProcess(self, name, netns, popen_args, **popen_kwargs):
+        run_dir = self.run_dir.new_dir(name)
+        return self.RemoteNetNSProcess(name, run_dir, self.user(), self.host(), self.cwd(), netns, popen_args, **popen_kwargs)
+
     def run_remote_sync(self, name, popen_args):
         proc = self.RemoteProcess(name, popen_args, remote_env=self.remote_env)
         proc.launch_sync()

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/17124
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: I8d223fc302df42446f5876ba020cfbea94be09b9
Gerrit-Change-Number: 17124
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/20200211/3aeb2538/attachment.htm>


More information about the gerrit-log mailing list