* [dts] [PATCH]tests sriov_kvm: test vlan mirror with random vlan id.
@ 2016-06-16 8:13 Lijuan Tu
2016-06-21 8:57 ` Liu, Yong
0 siblings, 1 reply; 2+ messages in thread
From: Lijuan Tu @ 2016-06-16 8:13 UTC (permalink / raw)
To: dts, qian.q.xu; +Cc: Lijuan Tu
vlan 0 is not a validated vlan id.
validated vlan id is between 1 to 4095
Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
tests/TestSuite_sriov_kvm.py | 57 +++++++++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 25 deletions(-)
diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py
index cc63804..b27ad48 100644
--- a/tests/TestSuite_sriov_kvm.py
+++ b/tests/TestSuite_sriov_kvm.py
@@ -11,6 +11,7 @@ Test userland 10Gb PMD.
import re
import time
from functools import wraps
+import random
import dts
from qemu_kvm import QEMUKvm
@@ -19,6 +20,7 @@ from test_case import TestCase
from pmd_output import PmdOutput
FRAME_SIZE_64 = 64
VM_CORES_MASK = 'all'
+MAX_VLAN = 4095
class TestSriovKvm(TestCase):
@@ -628,6 +630,8 @@ class TestSriovKvm(TestCase):
self.reset_port_mirror_rule(port, rule_id)
def setup_two_vm_common_prerequisite(self):
+ self.host_testpmd.execute_cmd('port stop all')
+ self.host_testpmd.execute_cmd('port start all')
self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
self.vm0_testpmd = PmdOutput(self.vm_dut_0)
self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
@@ -821,36 +825,39 @@ class TestSriovKvm(TestCase):
vlan_id = 0
vf_mask = '0x1'
packet_num = 10
+ random_vlan = random.randint(1, MAX_VLAN - 1)
+ vlan_ids = [0, 1, random_vlan, MAX_VLAN]
- if self.nic.startswith('fortville'):
- vm_testpmd = self.get_vm_testpmd_by_mask(vf_mask)
- vm_testpmd.execute_cmd('rx_vlan add %d %d' % (vlan_id, port_id_0))
- else:
- self.host_testpmd.execute_cmd(
- 'rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
- rule_id = self.set_port_vlan_mirror(port_id_0, '0 dst-pool 1 on')
+ for vlan_id in vlan_ids:
+ if self.nic.startswith('fortville'):
+ vm_testpmd = self.get_vm_testpmd_by_mask(vf_mask)
+ vm_testpmd.execute_cmd('rx_vlan add %d %d' % (vlan_id, port_id_0))
+ else:
+ self.host_testpmd.execute_cmd(
+ 'rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
+ rule_id = self.set_port_vlan_mirror(port_id_0, '%d dst-pool 1 on' % vlan_id)
- vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
- vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
- ether_ip = {}
- ether_ip['dot1q'] = {'vlan': '%d' % vlan_id}
- self.send_packet(
- self.vm_dut_0,
- self.vm0_dut_ports,
- port_id_0,
- count=packet_num,
- **ether_ip)
- vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
- vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
+ vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
+ vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
+ ether_ip = {}
+ ether_ip['dot1q'] = {'vlan': '%d' % vlan_id}
+ self.send_packet(
+ self.vm_dut_0,
+ self.vm0_dut_ports,
+ port_id_0,
+ count=packet_num,
+ **ether_ip)
+ vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
+ vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
- vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
- vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
+ vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
+ vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
- 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.verify(vm1_ret_stats['RX-packets'] == packet_num and
+ vm1_ret_stats['TX-packets'] == packet_num,
+ "Vlan mirror failed between VM0 and VM1!")
- self.reset_port_mirror_rule(port_id_0, rule_id)
+ self.reset_port_mirror_rule(port_id_0, rule_id)
def test_two_vms_vlan_and_pool_mirror(self):
self.setup_2vm_2vf_env()
--
1.9.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dts] [PATCH]tests sriov_kvm: test vlan mirror with random vlan id.
2016-06-16 8:13 [dts] [PATCH]tests sriov_kvm: test vlan mirror with random vlan id Lijuan Tu
@ 2016-06-21 8:57 ` Liu, Yong
0 siblings, 0 replies; 2+ messages in thread
From: Liu, Yong @ 2016-06-21 8:57 UTC (permalink / raw)
To: Lijuan Tu, dts, qian.q.xu
Hi Lijuan,
I failed to applied your patch, please send out new version based on
latest master branch.
On 06/16/2016 04:13 PM, Lijuan Tu wrote:
> vlan 0 is not a validated vlan id.
> validated vlan id is between 1 to 4095
>
> Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
> ---
> tests/TestSuite_sriov_kvm.py | 57 +++++++++++++++++++++++++-------------------
> 1 file changed, 32 insertions(+), 25 deletions(-)
>
> diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py
> index cc63804..b27ad48 100644
> --- a/tests/TestSuite_sriov_kvm.py
> +++ b/tests/TestSuite_sriov_kvm.py
> @@ -11,6 +11,7 @@ Test userland 10Gb PMD.
> import re
> import time
> from functools import wraps
> +import random
>
> import dts
> from qemu_kvm import QEMUKvm
> @@ -19,6 +20,7 @@ from test_case import TestCase
> from pmd_output import PmdOutput
> FRAME_SIZE_64 = 64
> VM_CORES_MASK = 'all'
> +MAX_VLAN = 4095
>
>
> class TestSriovKvm(TestCase):
> @@ -628,6 +630,8 @@ class TestSriovKvm(TestCase):
> self.reset_port_mirror_rule(port, rule_id)
>
> def setup_two_vm_common_prerequisite(self):
> + self.host_testpmd.execute_cmd('port stop all')
> + self.host_testpmd.execute_cmd('port start all')
> self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
> self.vm0_testpmd = PmdOutput(self.vm_dut_0)
> self.vm0_testpmd.start_testpmd(VM_CORES_MASK)
> @@ -821,36 +825,39 @@ class TestSriovKvm(TestCase):
> vlan_id = 0
> vf_mask = '0x1'
> packet_num = 10
> + random_vlan = random.randint(1, MAX_VLAN - 1)
> + vlan_ids = [0, 1, random_vlan, MAX_VLAN]
>
> - if self.nic.startswith('fortville'):
> - vm_testpmd = self.get_vm_testpmd_by_mask(vf_mask)
> - vm_testpmd.execute_cmd('rx_vlan add %d %d' % (vlan_id, port_id_0))
> - else:
> - self.host_testpmd.execute_cmd(
> - 'rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
> - rule_id = self.set_port_vlan_mirror(port_id_0, '0 dst-pool 1 on')
> + for vlan_id in vlan_ids:
> + if self.nic.startswith('fortville'):
> + vm_testpmd = self.get_vm_testpmd_by_mask(vf_mask)
> + vm_testpmd.execute_cmd('rx_vlan add %d %d' % (vlan_id, port_id_0))
> + else:
> + self.host_testpmd.execute_cmd(
> + 'rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
> + rule_id = self.set_port_vlan_mirror(port_id_0, '%d dst-pool 1 on' % vlan_id)
>
> - vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> - vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> - ether_ip = {}
> - ether_ip['dot1q'] = {'vlan': '%d' % vlan_id}
> - self.send_packet(
> - self.vm_dut_0,
> - self.vm0_dut_ports,
> - port_id_0,
> - count=packet_num,
> - **ether_ip)
> - vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> - vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + ether_ip = {}
> + ether_ip['dot1q'] = {'vlan': '%d' % vlan_id}
> + self.send_packet(
> + self.vm_dut_0,
> + self.vm0_dut_ports,
> + port_id_0,
> + count=packet_num,
> + **ether_ip)
> + vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
>
> - vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> - vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> + vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> + vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
>
> - 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.verify(vm1_ret_stats['RX-packets'] == packet_num and
> + vm1_ret_stats['TX-packets'] == packet_num,
> + "Vlan mirror failed between VM0 and VM1!")
>
> - self.reset_port_mirror_rule(port_id_0, rule_id)
> + self.reset_port_mirror_rule(port_id_0, rule_id)
>
> def test_two_vms_vlan_and_pool_mirror(self):
> self.setup_2vm_2vf_env()
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-21 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-16 8:13 [dts] [PATCH]tests sriov_kvm: test vlan mirror with random vlan id Lijuan Tu
2016-06-21 8:57 ` Liu, Yong
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).