Skip to content

Commit 01bad5b

Browse files
filter -> capture_filter to avoid shadowing over Python's filter function
1 parent 76545e2 commit 01bad5b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/validation/create_pcap_file/netsniff.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class NetsniffRecorder:
2222
interface: Network interface to capture traffic on.
2323
interface_index (int): Index of the network interface if not specified by interface.
2424
silent (bool): Whether to run netsniff-ng in silent mode (no stdout) (default: True).
25-
filter (str): Optional filter to apply to the capture. (default: None)
25+
capture_filter (str): Optional filter to apply to the capture. (default: None)
2626
"""
2727

2828
def __init__(
@@ -33,7 +33,7 @@ def __init__(
3333
interface = None,
3434
interface_index: int = 0,
3535
silent: bool = True,
36-
filter: str | None = None,
36+
capture_filter: str | None = None,
3737
):
3838
self.host = host
3939
self.test_name = test_name
@@ -45,7 +45,7 @@ def __init__(
4545
self.interface = self.host.network_interfaces[interface_index].name
4646
self.netsniff_process = None
4747
self.silent = silent
48-
self.filter = filter
48+
self.capture_filter = capture_filter
4949

5050
def start(self, startup_wait=STARTUP_WAIT):
5151
"""
@@ -61,7 +61,7 @@ def start(self, startup_wait=STARTUP_WAIT):
6161
str(self.interface),
6262
"--out",
6363
self.pcap_file,
64-
f"-f \"{self.filter}\"" if self.filter else "",
64+
f"-f \"{self.capture_filter}\"" if self.capture_filter else "",
6565
]
6666
logger.info(f"Running command: {' '.join(cmd)}")
6767
self.netsniff_process = connection.start_process(

tests/validation/mtl_engine/RxTxApp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def prepare_netsniff(
159159
test_name=capture_cfg.get("test_name", "capture"),
160160
pcap_dir=capture_cfg.get("pcap_dir", "/tmp"),
161161
interface=capture_cfg.get("interface"),
162-
filter = capture_filter if capture_filter != "" else None, # Avoid forcing an empty filter
162+
capture_filter = capture_filter if capture_filter != "" else None, # Avoid forcing an empty filter
163163
)
164164
return netsniff
165165
else:

0 commit comments

Comments
 (0)