Change in osmo-gsm-tester[master]: pcap_recorder: Add support to run in netns

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Tue Nov 6 12:07:28 UTC 2018


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/11474 )

Change subject: pcap_recorder: Add support to run in netns
......................................................................

pcap_recorder: Add support to run in netns

Change-Id: Ie1c848254f221f26c59e7f4bd8c079fe3e7bdfc2
---
M src/osmo_gsm_tester/pcap_recorder.py
1 file changed, 10 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, approved
  Harald Welte: Looks good to me, but someone else must approve



diff --git a/src/osmo_gsm_tester/pcap_recorder.py b/src/osmo_gsm_tester/pcap_recorder.py
index 98dea8b..70833d0 100644
--- a/src/osmo_gsm_tester/pcap_recorder.py
+++ b/src/osmo_gsm_tester/pcap_recorder.py
@@ -26,7 +26,7 @@
 
 class PcapRecorder(log.Origin):
 
-    def __init__(self, suite_run, run_dir, iface=None, filters=''):
+    def __init__(self, suite_run, run_dir, iface=None, filters='', netns=None):
         self.iface = iface
         if not self.iface:
             self.iface = "any"
@@ -34,16 +34,20 @@
         super().__init__(log.C_RUN, 'pcap-recorder_%s' % self.iface, filters=self.filters)
         self.suite_run = suite_run
         self.run_dir = run_dir
+        self.netns = netns
         self.start()
 
     def start(self):
         self.dbg('Recording pcap', self.run_dir, self.filters)
         dumpfile = os.path.join(os.path.abspath(self.run_dir), self.name() + ".pcap")
-        self.process = process.Process(self.name(), self.run_dir,
-                                       ('tcpdump', '-n',
-                                       '-i', self.iface,
-                                       '-w', dumpfile,
-                                       self.filters))
+        popen_args = ('tcpdump', '-n',
+                      '-i', self.iface,
+                      '-w', dumpfile,
+                      self.filters)
+        if self.netns:
+            self.process = process.NetNSProcess(self.name(), self.run_dir, self.netns, popen_args)
+        else:
+            self.process = process.Process(self.name(), self.run_dir, popen_args)
         self.suite_run.remember_to_stop(self.process)
         self.process.launch()
 

-- 
To view, visit https://gerrit.osmocom.org/11474
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie1c848254f221f26c59e7f4bd8c079fe3e7bdfc2
Gerrit-Change-Number: 11474
Gerrit-PatchSet: 3
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181106/422dd6a3/attachment.html>


More information about the gerrit-log mailing list