Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,18 @@ def setUp(self):
DHCPTest.setUp(self)
self.packets_send_duration = self.test_params["packets_send_duration"]
self.client_packets_per_sec = self.test_params["client_packets_per_sec"]
self.count_file = self.test_params.get("count_file")

def client_send_packet_stress(self):
if not self.count_file:
self.count_file = "/tmp/dhcp_stress_test_{}".format(self.packet_type)
# Start tcpdump on each receive-port interface individually to avoid
# issues with '-i any' cooked capture (SLL/SLLv2), deep BPF offsets
# (udp[249:2]), and grep-based interface filtering.
log_files = []
tcpdump_procs = []
for idx in self.receive_port_indices:
log_file = "/tmp/dhcp_stress_{}_{}.log".format(self.packet_type, idx)
log_file = "{}_eth{}.log".format(self.count_file, idx)
log_files.append(log_file)
# Match only the DHCP message-type under test so background/other-type
# DHCP traffic cannot inflate the relayed-packet count. message-type
Expand Down Expand Up @@ -119,7 +122,7 @@ def client_send_packet_stress(self):
# File already removed or never created; nothing to clean up
pass

with open("/tmp/dhcp_stress_test_{}".format(self.packet_type), "w") as count_fh:
with open(self.count_file, "w") as count_fh:
count_fh.write("{}\n".format(total_count))

def runTest(self):
Expand Down
4 changes: 3 additions & 1 deletion tests/dhcp_relay/test_dhcp_relay_stress.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pytest
import time
import logging
import uuid
import ptf.packet as scapy

from tests.common.fixtures.ptfhost_utils import copy_ptftests_directory # noqa F401
Expand Down Expand Up @@ -180,7 +181,8 @@ def test_dhcp_relay_stress(ptfhost, ptfadapter, dut_dhcp_relay_data, validate_du
"relay_agent": relay_agent,
"kvm_support": True
}
count_file = '/tmp/dhcp_stress_test_{}'.format(dhcp_type)
count_file = '/tmp/dhcp_stress_test_{}_{}'.format(dhcp_type, uuid.uuid4().hex)
params["count_file"] = count_file

def _check_count_file_exists():
command = 'ls {} > /dev/null 2>&1 && echo exists || echo missing'.format(count_file)
Expand Down