Skip to content

Commit

Permalink
[wol_test] implement tests for wol (sonic-net#14299)
Browse files Browse the repository at this point in the history
  • Loading branch information
w1nda authored and mssonicbld committed Sep 5, 2024
1 parent 6657387 commit ac37f7f
Show file tree
Hide file tree
Showing 3 changed files with 401 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/common/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,7 @@ def capture_and_check_packet_on_dut(
wait_time: the time to wait before stopping the packet capture, default is 1 second
"""
pcap_save_path = "/tmp/func_capture_and_check_packet_on_dut_%s.pcap" % (str(uuid.uuid4()))
cmd_capture_pkts = "sudo nohup tcpdump --immediate-mode -U -i %s -w %s >/dev/null 2>&1 %s & echo $!" \
cmd_capture_pkts = "nohup tcpdump --immediate-mode -U -i %s -w %s >/dev/null 2>&1 %s & echo $!" \
% (interface, pcap_save_path, pkts_filter)
tcpdump_pid = duthost.shell(cmd_capture_pkts)["stdout"]
cmd_check_if_process_running = "ps -p %s | grep %s |grep -v grep | wc -l" % (tcpdump_pid, tcpdump_pid)
Expand Down
13 changes: 13 additions & 0 deletions tests/wol/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest


@pytest.fixture(scope="module")
def get_connected_dut_intf_to_ptf_index(duthost, tbinfo):
disabled_host_interfaces = tbinfo['topo']['properties']['topology'].get('disabled_host_interfaces', [])
connected_ptf_ports_idx = [interface for interface in
tbinfo['topo']['properties']['topology'].get('host_interfaces', [])
if interface not in disabled_host_interfaces]
dut_intf_to_ptf_index = duthost.get_extended_minigraph_facts(tbinfo)['minigraph_ptf_indices']
connected_dut_intf_to_ptf_index = [(k, v) for k, v in dut_intf_to_ptf_index.items() if v in connected_ptf_ports_idx]

yield connected_dut_intf_to_ptf_index
Loading

0 comments on commit ac37f7f

Please sign in to comment.