Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions tests/bgp/test_bgp_update_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@
WAIT_TIMEOUT = 120


def is_tcpdump_running(duthost, cmd):
check_cmd = "ps u -C tcpdump | grep '%s'" % cmd
if cmd in duthost.shell(check_cmd)['stdout']:
return True
return False


@contextlib.contextmanager
def log_bgp_updates(duthost, iface, save_path, ns):
"""Capture bgp packets to file."""
Expand All @@ -58,10 +65,13 @@ def log_bgp_updates(duthost, iface, save_path, ns):
duthost.asic_instance_from_namespace(ns).ns_arg,
start_pcap,
)
start_pcap = "nohup {}{} &".format(
start_pcap_cmd = "nohup {}{} &".format(
duthost.asic_instance_from_namespace(ns).ns_arg, start_pcap
)
duthost.shell(start_pcap)
duthost.shell(start_pcap_cmd)
if not wait_until(WAIT_TIMEOUT, 5, 20, lambda: is_tcpdump_running(duthost, start_pcap),):
pytest.fail("Could not start tcpdump")

try:
yield
finally:
Expand Down