Merge remote-tracking branch 'origin/dev' into feature/2257-router-routes-cannot-be-represented-in-config-file
This commit is contained in:
@@ -21,7 +21,13 @@ class PacketCapture:
|
||||
The PCAPs are logged to: <simulation output directory>/<hostname>/<hostname>_<ip address>_pcap.log
|
||||
"""
|
||||
|
||||
def __init__(self, hostname: str, ip_address: Optional[str] = None, interface_num: Optional[int] = None):
|
||||
def __init__(
|
||||
self,
|
||||
hostname: str,
|
||||
ip_address: Optional[str] = None,
|
||||
port_num: Optional[int] = None,
|
||||
port_name: Optional[str] = None,
|
||||
):
|
||||
"""
|
||||
Initialize the PacketCapture process.
|
||||
|
||||
@@ -32,9 +38,12 @@ class PacketCapture:
|
||||
"The hostname for which PCAP logs are being recorded."
|
||||
self.ip_address: str = ip_address
|
||||
"The IP address associated with the PCAP logs."
|
||||
self.interface_num = interface_num
|
||||
self.port_num = port_num
|
||||
"The interface num on the Node."
|
||||
|
||||
self.port_name = port_name
|
||||
"The interface name on the Node."
|
||||
|
||||
self.inbound_logger = None
|
||||
self.outbound_logger = None
|
||||
|
||||
@@ -79,10 +88,12 @@ class PacketCapture:
|
||||
|
||||
def _get_logger_name(self, outbound: bool = False) -> str:
|
||||
"""Get PCAP the logger name."""
|
||||
if self.port_name:
|
||||
return f"{self.hostname}_{self.port_name}_{'outbound' if outbound else 'inbound'}_pcap"
|
||||
if self.ip_address:
|
||||
return f"{self.hostname}_{self.ip_address}_{'outbound' if outbound else 'inbound'}_pcap"
|
||||
if self.interface_num:
|
||||
return f"{self.hostname}_port-{self.interface_num}_{'outbound' if outbound else 'inbound'}_pcap"
|
||||
if self.port_num:
|
||||
return f"{self.hostname}_port-{self.port_num}_{'outbound' if outbound else 'inbound'}_pcap"
|
||||
return f"{self.hostname}_{'outbound' if outbound else 'inbound'}_pcap"
|
||||
|
||||
def _get_log_path(self, outbound: bool = False) -> Path:
|
||||
|
||||
Reference in New Issue
Block a user