[DTS][PATCH V2 4/5] tests/vf_offload: Improve tcpdump_analyse_sniff method
Ke Xu
ke1.xu at intel.com
Wed Dec 28 06:08:49 CET 2022
Use newly added filter_packets method to replace the packet filtering.
Calculate p[Raw].load to fix possible wrongly calculated payload
size when there are paddings.
Signed-off-by: Ke Xu <ke1.xu at intel.com>
---
tests/TestSuite_vf_offload.py | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index bccffb3d..a9d587e9 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -622,17 +622,9 @@ class TestVfOffload(TestCase):
packets and the bytes of packets payload.
"""
packet = Packet()
- pkts = packet.read_pcapfile("tcpdump_{0}.pcap".format(iface), self.tester)
- pkts = [
- p
- for p in pkts
- if len(p.layers()) >= 3
- and p.layers()[1] in {IP, IPv6}
- and p.layers()[2] in {IP, IPv6, UDP, TCP, SCTP, GRE, MPLS}
- and Raw in p
- ]
+ pkts = self.filter_packets(packet.read_pcapfile("tcpdump_{0}.pcap".format(iface), self.tester))
rx_packet_count = len(pkts)
- rx_packet_size = [len(p[Raw]) for p in pkts]
+ rx_packet_size = [len(p[Raw].load) for p in pkts]
return rx_packet_count, rx_packet_size
def tcpdump_command(self, command):
--
2.25.1
More information about the dts
mailing list