From: yufengmx <yufengx.mo@intel.com>
To: dts@dpdk.org
Cc: yufengmx <yufengx.mo@intel.com>
Subject: [dts] [PATCH V1 1/1] tests/dcf_lifecycle: enhance packet rx checking
Date: Thu, 13 Aug 2020 16:25:47 +0800 [thread overview]
Message-ID: <20200813082547.2686-2-yufengx.mo@intel.com> (raw)
In-Reply-To: <20200813082547.2686-1-yufengx.mo@intel.com>
filter broadcast packet in RX side then count the RX number.
Signed-off-by: yufengmx <yufengx.mo@intel.com>
---
tests/TestSuite_dcf_lifecycle.py | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/tests/TestSuite_dcf_lifecycle.py b/tests/TestSuite_dcf_lifecycle.py
index 9be071c..6be7b24 100644
--- a/tests/TestSuite_dcf_lifecycle.py
+++ b/tests/TestSuite_dcf_lifecycle.py
@@ -426,14 +426,28 @@ class TestDcfLifeCycle(TestCase):
cmd = 'clear port stats all'
self.vf_pmd2_con([cmd, "testpmd> ", 15])
- def check_vf_pmd2_stats(self, traffic, portid=0, is_traffic_valid=True):
+ def parse_pmd2_verbose_pkt_count(self, portid, vf_id=0):
+ if not self.vf_pmd2_session:
+ return 0
+ output = self.vf_pmd2_session.session.get_session_before(15)
+ pat = 'dst={dst}'.format(**self.get_mac_layer(portid, vf_id=vf_id).get('ether'))
+ result = re.findall(pat, output)
+ return len(result) if result else 0
+
+ def check_vf_pmd2_stats(self, traffic, verbose_parser,
+ portid=0, is_traffic_valid=True):
pmd = PmdOutput(self.dut, session=self.vf_pmd2_session)
info = pmd.get_pmd_stats(portid) or {}
ori_pkt = info.get('RX-packets') or 0
traffic()
+ verbose_pkt = verbose_parser()
info = pmd.get_pmd_stats(portid) or {}
rx_pkt = info.get('RX-packets') or 0
check_pkt = rx_pkt - ori_pkt
+ if verbose_pkt != check_pkt:
+ msg = 'received packets contain un-expected packet'
+ self.logger.warning(msg)
+ check_pkt = verbose_pkt
if is_traffic_valid:
msg = f"port {portid} should receive packets, but no traffic happen"
self.verify(check_pkt and check_pkt > 0, msg)
@@ -451,12 +465,13 @@ class TestDcfLifeCycle(TestCase):
def check_vf_pmd2_traffic(self, func_name, topo=None, flag=False):
dut_port_id, vf_id = topo if topo else [0, 1]
pkt = self.config_stream(dut_port_id, vf_id)
- traffic = partial(self.send_packet_by_scapy, pkt, dut_port_id, 1)
+ traffic = partial(self.send_packet_by_scapy, pkt, dut_port_id, vf_id)
+ verbose_parser = partial(self.parse_pmd2_verbose_pkt_count, dut_port_id, vf_id)
self.vf_pmd2_clear_port_stats()
- self.check_vf_pmd2_stats(traffic)
+ self.check_vf_pmd2_stats(traffic, verbose_parser)
status_change_func = getattr(self, func_name)
status_change_func()
- self.check_vf_pmd2_stats(traffic, is_traffic_valid=flag)
+ self.check_vf_pmd2_stats(traffic, verbose_parser, is_traffic_valid=flag)
def run_test_pre(self, pmd_opitons):
pri_pmd_option = pmd_opitons[0]
--
2.21.0
next prev parent reply other threads:[~2020-08-13 8:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 8:25 [dts] [PATCH V1 0/1] " yufengmx
2020-08-13 8:25 ` yufengmx [this message]
2020-08-21 2:57 ` [dts] [PATCH V1 1/1] " Tu, Lijuan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200813082547.2686-2-yufengx.mo@intel.com \
--to=yufengx.mo@intel.com \
--cc=dts@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).