* [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
@ 2021-07-23 17:26 Yan Xia
2021-07-23 9:23 ` Peng, Yuan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Yan Xia @ 2021-07-23 17:26 UTC (permalink / raw)
To: dts; +Cc: Yan Xia
move test_dual_vlan in TestSuite_fortville_rss_granularity_config to TestSuite_generic_flow_api, then modify lengacy command.
Signed-off-by: Yan Xia <yanx.xia@intel.com>
---
tests/TestSuite_generic_flow_api.py | 136 ++++++++++++++++++++++++++++
1 file changed, 136 insertions(+)
diff --git a/tests/TestSuite_generic_flow_api.py b/tests/TestSuite_generic_flow_api.py
index e8171589..c4462a4e 100644
--- a/tests/TestSuite_generic_flow_api.py
+++ b/tests/TestSuite_generic_flow_api.py
@@ -59,6 +59,8 @@ from scapy.utils import rdpcap
MAX_VLAN = 4095
MAX_QUEUE = 15
+testQueues = [16]
+reta_lines = []
MAX_VFQUEUE = 3
MAX_PORT = 65535
MAX_TTL = 255
@@ -642,6 +644,78 @@ class TestGeneric_flow_api(TestCase):
self.pkt_obj.append_pkt(pktstr)
self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf, count=count)
+ def send_packet(self, itf, tran_type, enable=None):
+ """
+ Sends packets for l2_payload.
+ """
+ global reta_lines
+ self.tester.scapy_foreground()
+ self.dut.send_expect("start", "testpmd>")
+ mac = self.dut.get_mac_address(0)
+
+ # send packet with different source and dest ip
+ if tran_type == "l2_payload":
+ if enable == "ovlan":
+ packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/Dot1Q(id=0x8100,vlan=4)/Dot1Q(id=0x8100,vlan=2,type=0xaaaa)/Raw(load="x"*60)], iface="%s")' % (
+ mac, itf, itf)
+ elif enable == "ivlan":
+ packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/Dot1Q(id=0x8100,vlan=1)/Dot1Q(id=0x8100,vlan=3,type=0xaaaa)/Raw(load="x"*60)], iface="%s")' % (
+ mac, itf, itf)
+ else:
+ packet = r'sendp([Ether(dst="%s", src=get_if_hwaddr("%s"))/Dot1Q(id=0x8100,vlan=1)/Dot1Q(id=0x8100,vlan=2,type=0xaaaa)/Raw(load="x"*60)], iface="%s")' % (
+ mac, itf, itf)
+ self.tester.scapy_append(packet)
+ self.tester.scapy_execute()
+ time.sleep(.5)
+ else:
+ print("\ntran_type error!\n")
+
+ out = self.dut.get_session_output(timeout=1)
+ self.dut.send_expect("stop", "testpmd>")
+ lines = out.split("\r\n")
+ reta_line = {}
+ # collect the hash result and the queue id
+ for line in lines:
+ line = line.strip()
+ if len(line) != 0 and line.strip().startswith("port "):
+ reta_line = {}
+ rexp = r"port (\d)/queue (\d{1,2}): received (\d) packets"
+ m = re.match(rexp, line.strip())
+ if m:
+ reta_line["port"] = m.group(1)
+ reta_line["queue"] = m.group(2)
+
+ elif len(line) != 0 and line.startswith(("src=",)):
+ for item in line.split("-"):
+ item = item.strip()
+ if(item.startswith("RSS hash")):
+ name, value = item.split("=", 1)
+
+ reta_line[name.strip()] = value.strip()
+ reta_lines.append(reta_line)
+
+ self.append_result_table()
+
+ def append_result_table(self):
+ """
+ Append the hash value and queue id into table.
+ """
+
+ global reta_lines
+
+ # append the the hash value and queue id into table
+ self.result_table_create(
+ ['packet index', 'hash value', 'hash index', 'queue id'])
+ i = 0
+
+ for tmp_reta_line in reta_lines:
+
+ # compute the hash result of five tuple into the 7 LSBs value.
+ hash_index = int(tmp_reta_line["RSS hash"], 16)
+ self.result_table_add(
+ [i, tmp_reta_line["RSS hash"], hash_index, tmp_reta_line["queue"]])
+ i = i + 1
+
def test_syn_filter(self):
"""
Only supported by ixgbe and igb.
@@ -2351,6 +2425,68 @@ class TestGeneric_flow_api(TestCase):
rule_num = extrapkt_rulenum['rulenum']
self.verify_rulenum(rule_num)
+ def test_dual_vlan(self):
+ """
+ Test with flow type dual vlan(QinQ).
+ """
+ flag = 1
+
+ for queue in testQueues:
+ self.pmdout.start_testpmd(
+ "Default", " --portmask=0x1 --rxq=%d --txq=%d" % (queue, queue))
+
+ self.dut.send_expect("set verbose 8", "testpmd> ")
+ self.dut.send_expect("set fwd rxonly", "testpmd> ")
+
+ self.dut.send_expect("port stop all", "testpmd> ")
+ self.dut.send_expect("vlan set extend on 0", "testpmd> ")
+ self.dut.send_expect(
+ "flow create 0 ingress pattern eth / end actions rss types l2-payload end queues end func toeplitz / end", "testpmd> ")
+ self.dut.send_expect("port start all", "testpmd> ")
+ res = self.pmdout.wait_link_status_up("all")
+ self.verify(res is True, "link is down")
+
+ self.send_packet(self.tester_itf, "l2_payload")
+
+ # set flow rss type s-vlan c-vlan set by testpmd on dut
+ self.dut.send_expect("flow create 0 ingress pattern eth / end actions rss types s-vlan c-vlan end key_len 0 queues end / end", "testpmd> ")
+ self.send_packet(self.tester_itf, "l2_payload")
+
+ self.send_packet(self.tester_itf, "l2_payload", enable="ovlan")
+
+ self.send_packet(self.tester_itf, "l2_payload", enable="ivlan")
+
+ self.dut.send_expect("quit", "# ", 30)
+
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
+
+ # check the results
+ if result_rows[1][1] == result_rows[2][1]:
+ flag = 0
+ self.verify(flag, "The two hash values are same, rss_granularity_config failed!")
+
+ elif result_rows[1][1] == result_rows[3][1]:
+ flag = 0
+ self.verify(flag, "The two hash values are same, rss_granularity_config failed!")
+
+ elif result_rows[1][1] == result_rows[4][1]:
+ flag = 0
+ self.verify(flag, "The two hash values are same, rss_granularity_config failed!")
+
+ elif result_rows[2][1] == result_rows[3][1]:
+ flag = 0
+ self.verify(flag, "The two hash values are same, rss_granularity_config failed!")
+
+ elif result_rows[2][1] == result_rows[4][1]:
+ flag = 0
+ self.verify(flag, "The two hash values are same, rss_granularity_config failed!")
+
+ elif result_rows[3][1] == result_rows[4][3]:
+ flag = 0
+ self.verify(flag, "The two hash values are same, rss_granularity_config failed!")
+
def tear_down(self):
"""
Run after each test case.
--
2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
2021-07-23 17:26 [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan Yan Xia
@ 2021-07-23 9:23 ` Peng, Yuan
2021-07-26 6:59 ` Tu, Lijuan
2021-07-29 11:53 ` Tu, Lijuan
2 siblings, 0 replies; 4+ messages in thread
From: Peng, Yuan @ 2021-07-23 9:23 UTC (permalink / raw)
To: Xia, YanX, dts; +Cc: Xia, YanX
Acked-by Peng, Yuan <yuan.peng@intel.com>
-----Original Message-----
From: dts <dts-bounces@dpdk.org> On Behalf Of Yan Xia
Sent: Saturday, July 24, 2021 1:26 AM
To: dts@dpdk.org
Cc: Xia, YanX <yanx.xia@intel.com>
Subject: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
2021-07-23 17:26 [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan Yan Xia
2021-07-23 9:23 ` Peng, Yuan
@ 2021-07-26 6:59 ` Tu, Lijuan
2021-07-29 11:53 ` Tu, Lijuan
2 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2021-07-26 6:59 UTC (permalink / raw)
To: Xia, YanX, dts, Peng, Yuan; +Cc: Xia, YanX
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Yan Xia
> Sent: 2021年7月24日 1:26
> To: dts@dpdk.org
> Cc: Xia, YanX <yanx.xia@intel.com>
> Subject: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
>
> move test_dual_vlan in TestSuite_fortville_rss_granularity_config to
> TestSuite_generic_flow_api, then modify lengacy command.
Should remove test_dual_vlan from TestSuite_fortville_rss_granularity_config at the same time.
>
> Signed-off-by: Yan Xia <yanx.xia@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
2021-07-23 17:26 [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan Yan Xia
2021-07-23 9:23 ` Peng, Yuan
2021-07-26 6:59 ` Tu, Lijuan
@ 2021-07-29 11:53 ` Tu, Lijuan
2 siblings, 0 replies; 4+ messages in thread
From: Tu, Lijuan @ 2021-07-29 11:53 UTC (permalink / raw)
To: Xia, YanX, dts, Peng, Yuan; +Cc: Xia, YanX
> -----Original Message-----
> From: dts <dts-bounces@dpdk.org> On Behalf Of Yan Xia
> Sent: 2021年7月24日 1:26
> To: dts@dpdk.org
> Cc: Xia, YanX <yanx.xia@intel.com>
> Subject: [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan
>
> move test_dual_vlan in TestSuite_fortville_rss_granularity_config to
> TestSuite_generic_flow_api, then modify lengacy command.
>
> Signed-off-by: Yan Xia <yanx.xia@intel.com>
> ---
> tests/TestSuite_generic_flow_api.py | 136 ++++++++++++++++++++++++++++
> 1 file changed, 136 insertions(+)
>
> diff --git a/tests/TestSuite_generic_flow_api.py
> b/tests/TestSuite_generic_flow_api.py
> index e8171589..c4462a4e 100644
> --- a/tests/TestSuite_generic_flow_api.py
> +++ b/tests/TestSuite_generic_flow_api.py
> @@ -59,6 +59,8 @@ from scapy.utils import rdpcap
>
> MAX_VLAN = 4095
> MAX_QUEUE = 15
> +testQueues = [16]
> +reta_lines = []
> MAX_VFQUEUE = 3
> MAX_PORT = 65535
> MAX_TTL = 255
> @@ -642,6 +644,78 @@ class TestGeneric_flow_api(TestCase):
> self.pkt_obj.append_pkt(pktstr)
> self.pkt_obj.send_pkt(self.tester, tx_port=self.tester_itf, count=count)
>
> + def send_packet(self, itf, tran_type, enable=None):
> + """
> + Sends packets for l2_payload.
> + """
> + global reta_lines
> + self.tester.scapy_foreground()
> + self.dut.send_expect("start", "testpmd>")
> + mac = self.dut.get_mac_address(0)
> +
> + # send packet with different source and dest ip
> + if tran_type == "l2_payload":
> + if enable == "ovlan":
> + packet = r'sendp([Ether(dst="%s",
> src=get_if_hwaddr("%s"))/Dot1Q(id=0x8100,vlan=4)/Dot1Q(id=0x8100,vlan=2,ty
> pe=0xaaaa)/Raw(load="x"*60)], iface="%s")' % (
> + mac, itf, itf)
> + elif enable == "ivlan":
> + packet = r'sendp([Ether(dst="%s",
> src=get_if_hwaddr("%s"))/Dot1Q(id=0x8100,vlan=1)/Dot1Q(id=0x8100,vlan=3,ty
> pe=0xaaaa)/Raw(load="x"*60)], iface="%s")' % (
> + mac, itf, itf)
> + else:
> + packet = r'sendp([Ether(dst="%s",
> src=get_if_hwaddr("%s"))/Dot1Q(id=0x8100,vlan=1)/Dot1Q(id=0x8100,vlan=2,ty
> pe=0xaaaa)/Raw(load="x"*60)], iface="%s")' % (
> + mac, itf, itf)
> + self.tester.scapy_append(packet)
> + self.tester.scapy_execute()
> + time.sleep(.5)
> + else:
> + print("\ntran_type error!\n")
> +
> + out = self.dut.get_session_output(timeout=1)
> + self.dut.send_expect("stop", "testpmd>")
> + lines = out.split("\r\n")
> + reta_line = {}
> + # collect the hash result and the queue id
> + for line in lines:
> + line = line.strip()
> + if len(line) != 0 and line.strip().startswith("port "):
> + reta_line = {}
> + rexp = r"port (\d)/queue (\d{1,2}): received (\d) packets"
> + m = re.match(rexp, line.strip())
> + if m:
> + reta_line["port"] = m.group(1)
> + reta_line["queue"] = m.group(2)
> +
> + elif len(line) != 0 and line.startswith(("src=",)):
> + for item in line.split("-"):
> + item = item.strip()
> + if(item.startswith("RSS hash")):
> + name, value = item.split("=", 1)
> +
> + reta_line[name.strip()] = value.strip()
> + reta_lines.append(reta_line)
> +
> + self.append_result_table()
> +
> + def append_result_table(self):
> + """
> + Append the hash value and queue id into table.
> + """
> +
> + global reta_lines
> +
> + # append the the hash value and queue id into table
> + self.result_table_create(
> + ['packet index', 'hash value', 'hash index', 'queue id'])
> + i = 0
> +
> + for tmp_reta_line in reta_lines:
> +
> + # compute the hash result of five tuple into the 7 LSBs value.
> + hash_index = int(tmp_reta_line["RSS hash"], 16)
> + self.result_table_add(
> + [i, tmp_reta_line["RSS hash"], hash_index, tmp_reta_line["queue"]])
> + i = i + 1
> +
> def test_syn_filter(self):
> """
> Only supported by ixgbe and igb.
> @@ -2351,6 +2425,68 @@ class TestGeneric_flow_api(TestCase):
> rule_num = extrapkt_rulenum['rulenum']
> self.verify_rulenum(rule_num)
>
> + def test_dual_vlan(self):
> + """
> + Test with flow type dual vlan(QinQ).
> + """
> + flag = 1
> +
> + for queue in testQueues:
> + self.pmdout.start_testpmd(
> + "Default", " --portmask=0x1 --rxq=%d --txq=%d" % (queue, queue))
> +
> + self.dut.send_expect("set verbose 8", "testpmd> ")
> + self.dut.send_expect("set fwd rxonly", "testpmd> ")
> +
> + self.dut.send_expect("port stop all", "testpmd> ")
> + self.dut.send_expect("vlan set extend on 0", "testpmd> ")
> + self.dut.send_expect(
> + "flow create 0 ingress pattern eth / end actions rss types l2-payload
> end queues end func toeplitz / end", "testpmd> ")
> + self.dut.send_expect("port start all", "testpmd> ")
> + res = self.pmdout.wait_link_status_up("all")
> + self.verify(res is True, "link is down")
> +
> + self.send_packet(self.tester_itf, "l2_payload")
> +
> + # set flow rss type s-vlan c-vlan set by testpmd on dut
> + self.dut.send_expect("flow create 0 ingress pattern eth / end actions rss
> types s-vlan c-vlan end key_len 0 queues end / end", "testpmd> ")
> + self.send_packet(self.tester_itf, "l2_payload")
> +
> + self.send_packet(self.tester_itf, "l2_payload", enable="ovlan")
> +
> + self.send_packet(self.tester_itf, "l2_payload", enable="ivlan")
> +
> + self.dut.send_expect("quit", "# ", 30)
> +
> + self.result_table_print()
> + result_rows = self.result_table_getrows()
> + self.verify(len(result_rows) > 1, "There is no data in the table, testcase
> failed!")
> +
> + # check the results
> + if result_rows[1][1] == result_rows[2][1]:
> + flag = 0
> + self.verify(flag, "The two hash values are same, rss_granularity_config
> failed!")
> +
> + elif result_rows[1][1] == result_rows[3][1]:
> + flag = 0
> + self.verify(flag, "The two hash values are same, rss_granularity_config
> failed!")
> +
> + elif result_rows[1][1] == result_rows[4][1]:
> + flag = 0
> + self.verify(flag, "The two hash values are same, rss_granularity_config
> failed!")
> +
> + elif result_rows[2][1] == result_rows[3][1]:
> + flag = 0
> + self.verify(flag, "The two hash values are same, rss_granularity_config
> failed!")
> +
> + elif result_rows[2][1] == result_rows[4][1]:
> + flag = 0
> + self.verify(flag, "The two hash values are same, rss_granularity_config
> failed!")
> +
> + elif result_rows[3][1] == result_rows[4][3]:
> + flag = 0
> + self.verify(flag, "The two hash values are same, rss_granularity_config
> failed!")
It might occur " IndexError: list index out of range"
So many verification are using the same message, it is hard to identify what's the matter, it 's very bad to users.
> +
> def tear_down(self):
> """
> Run after each test case.
> --
> 2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-29 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 17:26 [dts] [PATCH V1] tests/generic_flow_api:add test case dual_vlan Yan Xia
2021-07-23 9:23 ` Peng, Yuan
2021-07-26 6:59 ` Tu, Lijuan
2021-07-29 11:53 ` Tu, Lijuan
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).