From: zhaomeijuan <meijuanx.zhao@intel.com>
To: dts@dpdk.org
Cc: zhaomeijuan <meijuanx.zhao@intel.com>
Subject: [dts] [PATCH V1] tests/sriov_kvm
Date: Tue, 14 May 2019 15:17:59 +0000 [thread overview]
Message-ID: <20190514151759.24268-1-meijuanx.zhao@intel.com> (raw)
change code structure to cut running time
resume vlan status after set vlan everytime
Signed-off-by: zhaomeijuan <meijuanx.zhao@intel.com>
---
tests/TestSuite_sriov_kvm.py | 69 ++++++++++--------------------------
1 file changed, 19 insertions(+), 50 deletions(-)
diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py
index 43ed1b5..eadeb05 100644
--- a/tests/TestSuite_sriov_kvm.py
+++ b/tests/TestSuite_sriov_kvm.py
@@ -51,15 +51,16 @@ class TestSriovKvm(TestCase):
else:
self.vf_assign_method = 'vfio-pci'
self.dut.send_expect('modprobe vfio-pci', '#')
-
- def set_up(self):
self.setup_2vm_2pf_env_flag = 0
-
self.setup_2vm_2vf_env_flag = 0
self.setup_2vm_prerequisite_flag = 0
-
self.setup_4vm_4vf_env_flag = 0
self.setup_4vm_prerequisite_flag = 0
+ self.setup_2vm_2vf_env()
+
+ def set_up(self):
+
+ self.setup_two_vm_common_prerequisite()
def get_stats(self, dut, portid, rx_tx):
"""
@@ -637,13 +638,9 @@ class TestSriovKvm(TestCase):
self.setup_2vm_prerequisite_flag = 1
def destroy_two_vm_common_prerequisite(self):
- self.vm0_testpmd.execute_cmd('stop')
- self.vm0_testpmd.execute_cmd('quit', '# ')
self.vm0_testpmd = None
self.vm0_dut_ports = None
- self.vm1_testpmd.execute_cmd('stop')
- self.vm1_testpmd.execute_cmd('quit', '# ')
self.vm0_testpmd = None
self.vm1_dut_ports = None
@@ -667,8 +664,9 @@ class TestSriovKvm(TestCase):
self.destroy_2vm_2pf_env()
def test_two_vms_intervm_communication(self):
- self.setup_2vm_2vf_env()
-
+ if self.setup_2vm_prerequisite_flag == 1:
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ self.vm1_testpmd.execute_cmd('quit', '# ')
self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
self.vm1_dut_ports = self.vm_dut_1.get_ports('any')
port_id_0 = 0
@@ -712,9 +710,6 @@ class TestSriovKvm(TestCase):
return ret_stats
def test_two_vms_pool_mirror(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
-
port_id_0 = 0
packet_num = 10
@@ -733,9 +728,6 @@ class TestSriovKvm(TestCase):
self.reset_port_mirror_rule(port_id_0, rule_id)
def test_two_vms_uplink_mirror(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
-
port_id_0 = 0
packet_num = 10
@@ -754,9 +746,6 @@ class TestSriovKvm(TestCase):
self.reset_port_mirror_rule(port_id_0, rule_id)
def test_two_vms_downlink_mirror(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
-
self.vm0_testpmd.execute_cmd('stop')
self.vm1_testpmd.execute_cmd('stop')
@@ -781,8 +770,6 @@ class TestSriovKvm(TestCase):
self.reset_port_mirror_rule(port_id_0, rule_id)
def test_two_vms_vlan_mirror(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
self.vm1_testpmd.execute_cmd('vlan set strip on 0')
port_id_0 = 0
vlan_id = 0
@@ -809,12 +796,11 @@ class TestSriovKvm(TestCase):
self.verify(vm1_ret_stats['RX-packets'] == packet_num and
vm1_ret_stats['TX-packets'] == packet_num,
"Vlan mirror failed between VM0 and VM1!")
-
+ self.host_testpmd.execute_cmd(
+ 'rx_vlan rm %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
self.reset_port_mirror_rule(port_id_0, rule_id)
def test_two_vms_vlan_and_pool_mirror(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
self.vm0_testpmd.execute_cmd('vlan set strip on 0')
self.vm1_testpmd.execute_cmd('vlan set strip on 0')
port_id_0 = 0
@@ -857,13 +843,11 @@ class TestSriovKvm(TestCase):
self.verify(self.vm0_testpmd.check_tx_bytes(vm0_ret_stats['RX-packets'], 10 * packet_num),
"Vlan mirror failed between VM0 and VM1 when set vlan and pool mirror!")
-
+ self.host_testpmd.execute_cmd(
+ 'rx_vlan rm %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
self.reset_port_all_mirror_rule(port_id_0)
def test_two_vms_uplink_and_downlink_mirror(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
-
self.vm0_testpmd.execute_cmd('stop')
self.vm1_testpmd.execute_cmd('stop')
@@ -909,8 +893,6 @@ class TestSriovKvm(TestCase):
self.reset_port_all_mirror_rule(port_id_0)
def test_two_vms_vlan_and_pool_and_uplink_and_downlink(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
self.vm0_testpmd.execute_cmd('vlan set strip on 0')
self.vm1_testpmd.execute_cmd('vlan set strip on 0')
self.vm0_testpmd.execute_cmd('stop')
@@ -990,13 +972,11 @@ class TestSriovKvm(TestCase):
vm1_ret_stats['RX-packets'] == 2 * packet_num,
"Vlan and downlink mirror failed between VM0 and VM1 " +
"when set vlan, pool, uplink and downlink mirror!")
-
+ self.host_testpmd.execute_cmd("rx_vlan rm %d port %d vf %s" %
+ (vlan_id, port_id_0, vf_mask))
self.reset_port_all_mirror_rule(port_id_0)
def test_two_vms_add_multi_exact_mac_on_vf(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
-
port_id_0 = 0
vf_num = 0
packet_num = 10
@@ -1031,8 +1011,6 @@ class TestSriovKvm(TestCase):
if self.nic.startswith('fortville'):
self.dut.logger.warning("NIC is [%s], skip this case" %self.nic)
return
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
port_id_0 = 0
vf_mac = "00:11:22:33:44:55"
@@ -1081,8 +1059,6 @@ class TestSriovKvm(TestCase):
if self.nic.startswith('fortville'):
self.dut.logger.warning("NIC is [%s], skip this case" %self.nic)
return
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
port_id_0 = 0
packet_num = 10
@@ -1113,8 +1089,6 @@ class TestSriovKvm(TestCase):
if self.nic.startswith('fortville'):
self.dut.logger.warning("NIC is [%s], skip this case" %self.nic)
return
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
port_id_0 = 0
vf_mac = "00:55:44:33:22:11"
@@ -1152,8 +1126,6 @@ class TestSriovKvm(TestCase):
if self.nic.startswith('fortville'):
self.dut.logger.warning("NIC is [%s], skip this case" %self.nic)
return
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
port_id_0 = 0
packet_num = 10
@@ -1188,8 +1160,6 @@ class TestSriovKvm(TestCase):
if self.nic.startswith('fortville'):
self.dut.logger.warning("NIC is [%s], skip this case" %self.nic)
return
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
self.vm0_testpmd.execute_cmd("stop")
self.vm0_testpmd.execute_cmd("set fwd mac")
@@ -1227,8 +1197,6 @@ class TestSriovKvm(TestCase):
if self.nic.startswith('fortville'):
self.dut.logger.warning("NIC is [%s], skip this case" %self.nic)
return
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
port_id_0 = 0
vf_mac = "FF:FF:FF:FF:FF:FF"
@@ -1262,8 +1230,6 @@ class TestSriovKvm(TestCase):
"when enable or pause TX queues on VF!")
def test_two_vms_negative_input_commands(self):
- self.setup_2vm_2vf_env()
- self.setup_two_vm_common_prerequisite()
for command in ["set port 0 vf 65 tx on",
"set port 2 vf -1 tx off",
"set port 0 vf 0 rx oneee",
@@ -1291,6 +1257,11 @@ class TestSriovKvm(TestCase):
error, "Execute command '%s' successfully, it should be failed!" % command)
def tear_down(self):
+ self.vm0_testpmd.execute_cmd('quit', '# ')
+ self.vm1_testpmd.execute_cmd('quit', '# ')
+ time.sleep(1)
+
+ def tear_down_all(self):
if self.setup_2vm_prerequisite_flag == 1:
self.destroy_two_vm_common_prerequisite()
if self.setup_2vm_2vf_env_flag == 1:
@@ -1303,8 +1274,6 @@ class TestSriovKvm(TestCase):
self.destroy_four_vm_common_prerequisite()
if self.setup_4vm_4vf_env_flag == 1:
self.destroy_4vm_4vf_env()
-
- def tear_down_all(self):
if getattr(self, 'vm0', None):
self.vm0.stop()
if getattr(self, 'vm1', None):
--
2.17.1
next reply other threads:[~2019-05-14 7:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-14 15:17 zhaomeijuan [this message]
2019-05-23 6:16 ` Tu, Lijuan
[not found] <20190514151908.24314-1-meijuanx.zhao@intel.com>
2019-05-14 7:20 ` Zhang, YanX A
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=20190514151759.24268-1-meijuanx.zhao@intel.com \
--to=meijuanx.zhao@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).