test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts][PATCH V1 1/2] tests/kernelpf_iavf: modify script VLAN filter enable requires a port VLAN is assigned
@ 2022-06-01  6:22 Li, WeiyuanX
  2022-06-01  6:22 ` [dts][PATCH V1 2/2] tests/vf_vlan: " Li, WeiyuanX
  0 siblings, 1 reply; 3+ messages in thread
From: Li, WeiyuanX @ 2022-06-01  6:22 UTC (permalink / raw)
  To: dts, yuan.peng; +Cc: Weiyuan Li

From: Weiyuan Li <weiyuanx.li@intel.com>

1. Modify script VLAN filter enable requires a port VLAN is assigned.
2. tcpdump timeout, increase the '-nn' to skip the DNS reverse domain name resolution operation.
3. Add failure processing repair sometimes failed to execute command 'ip link set'.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_kernelpf_iavf.py | 41 ++++++++++++++++++++++----------
 1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/tests/TestSuite_kernelpf_iavf.py b/tests/TestSuite_kernelpf_iavf.py
index bb20e687..9391b4b0 100644
--- a/tests/TestSuite_kernelpf_iavf.py
+++ b/tests/TestSuite_kernelpf_iavf.py
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2019 Intel Corporation
+# Copyright(c) 2022 Intel Corporation
 #
 
 """
@@ -206,13 +206,24 @@ class TestKernelpfIavf(TestCase):
         self.vm_testpmd.execute_cmd("stop")
         self.vm_testpmd.execute_cmd("set fwd txonly")
         self.tester.send_expect("rm -f tcpdump.pcap", "#")
-        self.tester.send_expect("tcpdump -i %s 2>tcpdump.out &" % self.tester_intf, "#")
+        self.tester.send_expect(
+            "tcpdump -nn -i %s 2>tcpdump.out &" % self.tester_intf, "#"
+        )
         self.vm_testpmd.execute_cmd("start")
         time.sleep(1)
         self.vm_testpmd.execute_cmd("stop")
         self.tester.send_expect("killall tcpdump", "#")
         time.sleep(1)
-        cap_packet = self.tester.send_expect("cat tcpdump.out", "#", 30)
+        retry_times = 10
+        while retry_times:
+            with open("/root/tcpdump.out", "r") as files:
+                for fl in files:
+                    if "packet" in fl:
+                        break
+            retry_times -= 1
+        cap_packet = self.tester.send_expect(
+            "cat tcpdump.out | grep 'packet'", "# ", 30
+        )
         stats = self.vm_testpmd.get_pmd_stats(0)
         cap_tcp_num = re.findall("(\d+) packets", cap_packet)
         nums = sum(map(int, cap_tcp_num))
@@ -355,9 +366,13 @@ class TestKernelpfIavf(TestCase):
         vf can receive packet with right vlan id, can't receive wrong vlan id packet
         """
         random_vlan = random.randint(1, MAX_VLAN)
-        self.dut.send_expect(
+        out = self.dut.send_expect(
             "ip link set %s vf 0 vlan %s" % (self.host_intf, random_vlan), "# "
         )
+        if "Resource temporarily unavailable" in out:
+            self.dut.send_expect(
+                "ip link set %s vf 0 vlan %s" % (self.host_intf, random_vlan), "# "
+            )
         out = self.dut.send_expect("ip link show %s" % self.host_intf, "# ")
         self.verify("vlan %d" % random_vlan in out, "Failed to add pvid on VF0")
 
@@ -380,14 +395,17 @@ class TestKernelpfIavf(TestCase):
         self.verify(len(receive_pkt) == 1, "tester received wrong vlan packet!!!")
 
         # remove vlan
-        self.vm_testpmd.execute_cmd("stop")
-        self.vm_testpmd.execute_cmd("port stop all")
+        self.vm_testpmd.quit()
         self.dut.send_expect("ip link set %s vf 0 vlan 0" % self.host_intf, "# ")
         out = self.dut.send_expect("ip link show %s" % self.host_intf, "# ")
         self.verify("vlan %d" % random_vlan not in out, "Failed to remove pvid on VF0")
         # send packet without vlan
-        self.vm_testpmd.execute_cmd("port reset 0")
-        self.vm_testpmd.execute_cmd("port start all")
+        self.vm_testpmd.start_testpmd("all")
+        self.vm_testpmd.execute_cmd("set fwd mac")
+        self.vm_testpmd.execute_cmd("set verbose 1")
+        self.vm_testpmd.execute_cmd("vlan set filter on 0")
+        self.vm_testpmd.execute_cmd("vlan set strip on 0")
+        self.vm_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm_testpmd.execute_cmd("start")
         out = self.send_and_getout(vlan=0, pkt_type="UDP")
         self.verify(self.vf_mac in out, "Not received packet without vlan!!!")
@@ -429,6 +447,7 @@ class TestKernelpfIavf(TestCase):
         self.vm_testpmd.execute_cmd("set verbose 1")
         self.vm_testpmd.execute_cmd("vlan set filter on 0")
         self.vm_testpmd.execute_cmd("vlan set strip on 0")
+        self.vm_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm_testpmd.execute_cmd("start")
         # send packet without vlan, vf can receive packet
         out = self.send_and_getout(pkt_type="UDP")
@@ -543,6 +562,7 @@ class TestKernelpfIavf(TestCase):
         self.vm_testpmd.execute_cmd("port start all")
         self.vm_testpmd.execute_cmd("set fwd mac")
         self.vm_testpmd.execute_cmd("set verbose 1")
+        self.vm_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm_testpmd.execute_cmd("start")
 
         # error vlan id
@@ -1050,10 +1070,7 @@ class TestKernelpfIavf(TestCase):
         self.scapy_send_packet(self.vf_mac, self.tester_intf, vlan_flags=True, count=10)
         out = self.vm_dut.get_session_output()
         packets = len(re.findall("received 1 packets", out))
-        if self.kdriver == "i40e" and self.driver_version < "2.13.10":
-            self.verify(packets == 10, "Not receive expected packet")
-        else:
-            self.verify(packets == 0, "Receive expected packet")
+        self.verify(packets == 10, "Receive expected packet")
 
         # send 10 untagged packets, and check 10 untagged packets received
         self.scapy_send_packet(self.vf_mac, self.tester_intf, count=10)
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dts][PATCH V1 2/2] tests/vf_vlan: modify script VLAN filter enable requires a port VLAN is assigned
  2022-06-01  6:22 [dts][PATCH V1 1/2] tests/kernelpf_iavf: modify script VLAN filter enable requires a port VLAN is assigned Li, WeiyuanX
@ 2022-06-01  6:22 ` Li, WeiyuanX
  0 siblings, 0 replies; 3+ messages in thread
From: Li, WeiyuanX @ 2022-06-01  6:22 UTC (permalink / raw)
  To: dts, yuan.peng; +Cc: Weiyuan Li

From: Weiyuan Li <weiyuanx.li@intel.com>

Modify script VLAN filter enable requires a port VLAN is assigned.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---
 tests/TestSuite_vf_vlan.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index e73ad479..9b396a51 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2020 Intel Corporation
+# Copyright(c) 2022 Intel Corporation
 #
 
 import random
@@ -222,14 +222,20 @@ class TestVfVlan(TestCase):
 
         # remove vlan
         self.vm0_testpmd.execute_cmd("stop")
-        self.vm0_testpmd.execute_cmd("port stop all")
+        # self.vm0_testpmd.execute_cmd("port stop all")
+        self.vm0_testpmd.quit()
+
         self.dut.send_expect("ip link set %s vf 0 vlan 0" % self.host_intf0, "# ")
         out = self.dut.send_expect("ip link show %s" % self.host_intf0, "# ")
         self.verify("vlan %d" % random_vlan not in out, "Failed to remove pvid on VF0")
 
         # send packet with vlan
-        self.vm0_testpmd.execute_cmd("port reset 0", "testpmd> ", 120)
-        self.vm0_testpmd.execute_cmd("port start all")
+        self.vm0_testpmd.start_testpmd("all")
+        self.vm0_testpmd.execute_cmd("set fwd mac")
+        self.vm0_testpmd.execute_cmd("set verbose 1")
+        self.vm0_testpmd.execute_cmd("vlan set filter on 0")
+        self.vm0_testpmd.execute_cmd("vlan set strip on 0")
+        self.vm0_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm0_testpmd.execute_cmd("start")
 
         out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
@@ -305,6 +311,7 @@ class TestVfVlan(TestCase):
         self.vm0_testpmd.execute_cmd("vlan set strip on 0")
         self.vm0_testpmd.execute_cmd("vlan set filter on 0")
         self.vm0_testpmd.execute_cmd("set promisc all off")
+        self.vm0_testpmd.execute_cmd("vx_vlan add 10 0")
         self.vm0_testpmd.execute_cmd("start")
 
         # send packet without vlan
@@ -340,7 +347,7 @@ class TestVfVlan(TestCase):
 
         for rx_vlan in rx_vlans:
             self.vm0_testpmd.execute_cmd("rx_vlan rm %d 0" % rx_vlan)
-
+        self.vm0_testpmd.execute_cmd("rx_vlan add 10 0")
         # send packet with vlan 0
         out = self.send_and_getout(vlan=0, pkt_type="VLAN_UDP")
         self.verify("VLAN tci=0x0" in out, "Not received vlan 0 packet as default!!!")
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dts][PATCH V1 2/2] tests/vf_vlan: modify script VLAN filter enable requires a port VLAN is assigned
  2022-06-01 10:03 [dts][PATCH V1 1/2] tests/kernelpf_iavf: " Li, WeiyuanX
@ 2022-06-01 10:03 ` Li, WeiyuanX
  0 siblings, 0 replies; 3+ messages in thread
From: Li, WeiyuanX @ 2022-06-01 10:03 UTC (permalink / raw)
  To: dts, yuan.peng; +Cc: Weiyuan Li

From: Weiyuan Li <weiyuanx.li@intel.com>

Modify script VLAN filter enable requires a port VLAN is assigned.

Signed-off-by: Weiyuan Li <weiyuanx.li@intel.com>
---

v2:
-Add comment restart testpmd after remove VLAN from PF devcie according to test plan modification.
-Modify error command 'vx_vlan' to 'rx_vlan'.

 tests/TestSuite_vf_vlan.py | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index e73ad479..2a4fbeae 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: BSD-3-Clause
-# Copyright(c) 2020 Intel Corporation
+# Copyright(c) 2022 Intel Corporation
 #
 
 import random
@@ -222,14 +222,20 @@ class TestVfVlan(TestCase):
 
         # remove vlan
         self.vm0_testpmd.execute_cmd("stop")
-        self.vm0_testpmd.execute_cmd("port stop all")
+        # self.vm0_testpmd.execute_cmd("port stop all")
+        self.vm0_testpmd.quit()
+
         self.dut.send_expect("ip link set %s vf 0 vlan 0" % self.host_intf0, "# ")
         out = self.dut.send_expect("ip link show %s" % self.host_intf0, "# ")
         self.verify("vlan %d" % random_vlan not in out, "Failed to remove pvid on VF0")
 
         # send packet with vlan
-        self.vm0_testpmd.execute_cmd("port reset 0", "testpmd> ", 120)
-        self.vm0_testpmd.execute_cmd("port start all")
+        self.vm0_testpmd.start_testpmd("all")
+        self.vm0_testpmd.execute_cmd("set fwd mac")
+        self.vm0_testpmd.execute_cmd("set verbose 1")
+        self.vm0_testpmd.execute_cmd("vlan set filter on 0")
+        self.vm0_testpmd.execute_cmd("vlan set strip on 0")
+        self.vm0_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm0_testpmd.execute_cmd("start")
 
         out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
@@ -305,6 +311,7 @@ class TestVfVlan(TestCase):
         self.vm0_testpmd.execute_cmd("vlan set strip on 0")
         self.vm0_testpmd.execute_cmd("vlan set filter on 0")
         self.vm0_testpmd.execute_cmd("set promisc all off")
+        self.vm0_testpmd.execute_cmd("rx_vlan add 10 0")
         self.vm0_testpmd.execute_cmd("start")
 
         # send packet without vlan
@@ -340,7 +347,7 @@ class TestVfVlan(TestCase):
 
         for rx_vlan in rx_vlans:
             self.vm0_testpmd.execute_cmd("rx_vlan rm %d 0" % rx_vlan)
-
+        self.vm0_testpmd.execute_cmd("rx_vlan add 10 0")
         # send packet with vlan 0
         out = self.send_and_getout(vlan=0, pkt_type="VLAN_UDP")
         self.verify("VLAN tci=0x0" in out, "Not received vlan 0 packet as default!!!")
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-01 10:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01  6:22 [dts][PATCH V1 1/2] tests/kernelpf_iavf: modify script VLAN filter enable requires a port VLAN is assigned Li, WeiyuanX
2022-06-01  6:22 ` [dts][PATCH V1 2/2] tests/vf_vlan: " Li, WeiyuanX
2022-06-01 10:03 [dts][PATCH V1 1/2] tests/kernelpf_iavf: " Li, WeiyuanX
2022-06-01 10:03 ` [dts][PATCH V1 2/2] tests/vf_vlan: " Li, WeiyuanX

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).