summaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/pcap_recorder.py
AgeCommit message (Collapse)AuthorFilesLines
2019-02-27pyflakes: Remove imports of unused modulesHolger Hans Peter Freyther1-4/+1
Change-Id: I7496030e5857078cd66a36a5e46c9a50217ce6e3
2018-10-31pcap_recorder: Add support to run in netnsPau Espin Pedrol1-6/+10
Change-Id: Ie1c848254f221f26c59e7f4bd8c079fe3e7bdfc2
2018-02-23pcap_recorder: log printing pcap file name as dbgPau Espin Pedrol1-1/+1
The log message is quite long and makes it difficult to read the log even with debug disabled. Change-Id: I593c0ce02bf7a3a9d26cf1fcc7d523a313cb72eb
2017-06-13fix and refactor logging: drop 'with', simplifyNeels Hofmeyr1-4/+3
With the recent fix of the junit report related issues, another issue arose: the 'with log.Origin' was changed to disallow __enter__ing an object twice to fix problems, now still code would fail because it tries to do 'with' on the same object twice. The only reason is to ensure that logging is associated with a given object. Instead of complicating even more, implement differently. Refactor logging to simplify use: drop the 'with Origin' style completely, and instead use the python stack to determine which objects are created by which, and which object to associate a log statement with. The new way: we rely on the convention that each class instance has a local 'self' referencing the object instance. If we need to find an origin as a new object's parent, or to associate a log message with, we traverse each stack frame, fetching the first local 'self' object that is a log.Origin class instance. How to use: Simply call log.log() anywhere, and it finds an Origin object to log for, from the stack. Alternatively call self.log() for any Origin() object to skip the lookup. Create classes as child class of log.Origin and make sure to call super().__init__(category, name). This constructor will magically find a parent Origin on the stack. When an exception happens, we first escalate the exception up through call scopes to where ever it is handled by log.log_exn(). This then finds an Origin object in the traceback's stack frames, no need to nest in 'with' scopes. Hence the 'with log.Origin' now "happens implicitly", we can write pure natural python code, no more hassles with scope ordering. Furthermore, any frame can place additional logging information in a frame by calling log.ctx(). This is automatically inserted in the ancestry associated with a log statement / exception. Change-Id: I5f9b53150f2bb6fa9d63ce27f0806f0ca6a45e90
2017-06-03Re-License under GPLv3-or-later instead of AGPLv3-or-laterHarald Welte1-3/+3
The "Affero" nature makes sense for the Osmocom network components like BSC, SGSN, etc. as they are typically operated to provide a network service. For testing, this doesn't make so much sense as it is difficult to imagine people creating a business out of offering to run test cases on an end-to-end Osmocom GSM network. So let's drop the 'Affero' here. All code is so far developed by sysmocom staff, so as Managing Director of sysmocom I can effect such a license change unilaterally. Change-Id: I8959c2d605854ffdc21cb29c0fe0e715685c4c05
2017-05-15pcap_recorder: use self.filters instead of gen_filterPau Espin Pedrol1-1/+1
Change-Id: I53779d521fbeed7c37bcaeb12be2531e4dbc005c
2017-05-15pcap: pass complete filter string to PcapRecorderNeels Hofmeyr1-10/+3
Composing the filter in gen_filter() is more complex than we need. We pass the address and potentially further filter elements separately, and then gen_filter() has to guess how to combine these. Instead, have just a filter string to use right from the start, so that the caller has full control (and full responsibility). Remove the addr argument, which was only used for filtering. This is my conclusion of looking at the patches with change Ids I62a6ae7bd3a84baceb684c26727d2269c86ed023 (PS 1) and Icbb0f8d2058fa7ebb7f0f731645f9266cacdb120 I62... PS 2 will add the SSH filtering. The name 'filter' is a python built-in, which is why I chose the argument name 'filters' instead. It works with 'filter' as well, but let's try to avoid naming conflicts like that. Change-Id: Iff7ddf51d3bf0189ce07b488a3dcdcfce6907aba
2017-05-15pcap recorder: include vim indenting rules as commentNeels Hofmeyr1-0/+2
Change-Id: Idbc4521053610d55c9c32eff950ed8fa68dda171
2017-05-15cosmetic: rather have an underscore in pcap_recorder.pyNeels Hofmeyr1-0/+59
Change-Id: Ib4886cb3fe0cb9c66d170097b98b4d1eb67cab81