From: Lijuan Tu <lijuanx.a.tu@intel.com>
To: dts@dpdk.org, qian.q.xu@intel.com
Cc: Lijuan Tu <lijuanx.a.tu@intel.com>
Subject: [dts] [PATCH]tests sriov_kvm: test vlan mirror with random vlan id.
Date: Thu, 16 Jun 2016 16:13:48 +0800 [thread overview]
Message-ID: <1466064828-15998-1-git-send-email-lijuanx.a.tu@intel.com> (raw)
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
next reply other threads:[~2016-06-16 8:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-16 8:13 Lijuan Tu [this message]
2016-06-21 8:57 ` Liu, Yong
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=1466064828-15998-1-git-send-email-lijuanx.a.tu@intel.com \
--to=lijuanx.a.tu@intel.com \
--cc=dts@dpdk.org \
--cc=qian.q.xu@intel.com \
/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).