From: Jiale Song <songx.jiale@intel.com>
To: dts@dpdk.org
Cc: Jiale Song <songx.jiale@intel.com>
Subject: [dts] [PATCH V1 4/4] tests/dual_vlan: add a case to test vlan priority value
Date: Mon, 17 Apr 2023 17:41:55 +0000 [thread overview]
Message-ID: <20230417174155.146540-5-songx.jiale@intel.com> (raw)
In-Reply-To: <20230417174155.146540-1-songx.jiale@intel.com>
add a case to test vlan priority value.
Signed-off-by: Jiale Song <songx.jiale@intel.com>
---
tests/TestSuite_dual_vlan.py | 47 ++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py
index 70395663..59b39eb3 100644
--- a/tests/TestSuite_dual_vlan.py
+++ b/tests/TestSuite_dual_vlan.py
@@ -14,6 +14,7 @@ import re
import time
import framework.utils as utils
+from framework.packet import Packet
from framework.pmd_output import PmdOutput
from framework.test_case import TestCase
@@ -68,6 +69,7 @@ class TestDualVlan(TestCase):
out = self.dut.send_expect("set fwd mac", "testpmd> ")
self.verify("Set mac packet forwarding mode" in out, "set fwd mac error")
+ self.dut.send_expect("set verbose 1", "testpmd> ")
out = self.dut.send_expect("start", "testpmd> ", 120)
# Vlan id
@@ -387,6 +389,25 @@ class TestDualVlan(TestCase):
for line in resultList:
self.verify(line in out, "receive packet is wrong:%s" % out)
+ def send_pkts_get_testpmd_tcpdump_output(
+ self, dut_rx_port, dut_tx_port, pkts, count=1
+ ):
+ tester_tx_port = self.tester.get_local_port(dut_rx_port)
+ tester_tx_port_iface = self.tester.get_interface(tester_tx_port)
+ tester_rx_port = self.tester.get_local_port(dut_tx_port)
+ tester_rx_port_ifac = self.tester.get_interface(tester_rx_port)
+ self.start_tcpdump(tester_rx_port_ifac)
+ self.pkt = Packet()
+ self.pkt.update_pkt(pkts)
+ self.pkt.send_pkt(crb=self.tester, tx_port=tester_tx_port_iface, count=count)
+ time.sleep(1)
+ out = self.pmdout.get_output()
+ port_stats = self.pmdout.execute_cmd("show port stats all")
+ self.pmdout.execute_cmd("clear port stats all")
+ pmd_out = out + port_stats
+ tcpdump_out = self.get_tcpdump_package()
+ return pmd_out, tcpdump_out
+
def set_up(self):
"""
Run before each test case.
@@ -674,6 +695,32 @@ class TestDualVlan(TestCase):
rand = random.randint(0, 15)
self.multimode_test(rand)
+ def test_dual_vlan_priority_rxtx(self):
+ """
+ Test Case: dual vlan priority rx/tx test
+ """
+ mac = self.dut.get_mac_address(dutRxPortId)
+ pkts = [
+ 'Ether(dst="%s",type=0x8100)/Dot1Q(vlan=1,type=0x8100,prio=1)/Dot1Q(vlan=2,type=0x0800,prio=2)/IP(src="196.222.232.221")/("X"*480)'
+ % mac,
+ ]
+ self.mode_config(filter="off", extend="off", strip="off")
+ pmd_output, tcpdump_out = self.send_pkts_get_testpmd_tcpdump_output(
+ dutRxPortId, dutTxPortId, pkts, count=1
+ )
+ receive_pkt = re.findall("(?i)dst=%s" % mac, pmd_output)
+ self.verify(len(receive_pkt) == 1, "Failed error received vlan packet!")
+ tester_pkt = re.findall("vlan\s+\d+, p\s+\d+", tcpdump_out)
+ vlan_prio_1 = re.findall("vlan\s+\d+, p\s+1", tcpdump_out)
+ vlan_prio_2 = re.findall("vlan\s+\d+, p\s+2", tcpdump_out)
+ self.verify(len(tester_pkt) == 2, "Received incorrect vlan packet!")
+ self.verify(
+ len(vlan_prio_1) == 1, "Received incorrect priority 1 vlan packet!!"
+ )
+ self.verify(
+ len(vlan_prio_2) == 1, "Received incorrect priority 2 vlan packet!!!"
+ )
+
def tear_down(self):
"""
Run after each test case.
--
2.25.1
next prev parent reply other threads:[~2023-04-17 9:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-17 17:41 [dts] [PATCH V1 0/4] add " Jiale Song
2023-04-17 17:41 ` [dts] [PATCH V1 1/4] test_plans/kernelpf_iavf: add testing steps " Jiale Song
2023-04-17 17:41 ` [dts] [PATCH V1 2/4] tests/kernelpf_iavf: " Jiale Song
2023-04-17 17:41 ` [dts] [PATCH V1 3/4] test_plans/dual_vlan: add a case " Jiale Song
2023-04-17 17:41 ` Jiale Song [this message]
2023-04-27 7:30 ` [dts] [PATCH V1 4/4] tests/dual_vlan: " Peng, Yuan
2023-04-27 7:38 ` lijuan.tu
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=20230417174155.146540-5-songx.jiale@intel.com \
--to=songx.jiale@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).