* [dts] [PATCH v2 4/6] tests vf_vlan: add VF vlan test plan
2016-01-19 1:38 [dts] [PATCH v2 1/6] framework tester: NIC object get from net_device module Yong Liu
2016-01-19 1:38 ` [dts] [PATCH v2 2/6] framework packet: only sniff coming packet when tcpdump support Yong Liu
2016-01-19 1:38 ` [dts] [PATCH v2 3/6] framework pmd_output: support quit command of testpmd Yong Liu
@ 2016-01-19 1:38 ` Yong Liu
2016-01-19 1:38 ` [dts] [PATCH v2 5/6] tests vf_vlan: add test suite for VF vlan validation Yong Liu
2016-01-19 1:38 ` [dts] [PATCH v2 6/6] conf vf_vlan: add configuration file for VF vlan Yong Liu
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2016-01-19 1:38 UTC (permalink / raw)
To: dts
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/test_plans/vf_vlan_test_plan.rst b/test_plans/vf_vlan_test_plan.rst
new file mode 100644
index 0000000..d49270a
--- /dev/null
+++ b/test_plans/vf_vlan_test_plan.rst
@@ -0,0 +1,193 @@
+.. Copyright (c) <2015>, Intel Corporation
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+The support of VLAN offload features by VF device consists in:
+
+- the filtering of received VLAN packets
+- VLAN header stripping by hardware in received [VLAN] packets
+- VLAN header insertion by hardware in transmitted packets
+
+Prerequisites
+=============
+1. Create VF device from PF devices.
+ ./dpdk_nic_bind.py --st
+ 0000:87:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+ 0000:87:00.1 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f1 drv=i40e unused=
+
+ echo 1 > /sys/bus/pci/devices/0000\:87\:00.0/sriov_numvfs
+ echo 1 > /sys/bus/pci/devices/0000\:87\:00.1/sriov_numvfs
+
+ ./dpdk_nic_bind.py --st
+
+ 0000:87:00.0 'Ethernet Controller X710 for 10GbE SFP+' if=ens259f0 drv=i40e unused=
+ 0000:87:02.0 'XL710/X710 Virtual Function' unused=
+ 0000:87:0a.0 'XL710/X710 Virtual Function' unused=
+
+2. Detach VFs from the host, bind them to pci-stub driver,
+
+ /sbin/modprobe pci-stub
+
+ using `lspci -nn|grep -i ethernet` got VF device id, for example "8086 154c",
+
+ echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+ echo 0000:87:02.0 > /sys/bus/pci/devices/0000:87:02.0/driver/unbind
+ echo 0000:87:02.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+ echo "8086 154c" > /sys/bus/pci/drivers/pci-stub/new_id
+ echo 0000:87:0a.0 > /sys/bus/pci/devices/0000:87:0a.0/driver/unbind
+ echo 0000:87:0a.0 > /sys/bus/pci/drivers/pci-stub/bind
+
+3. Passthrough VFs 87:02.0 & 87:02.1 to vm0 and start vm0,
+
+ /usr/bin/qemu-system-x86_64 -name vm0 -enable-kvm \
+ -cpu host -smp 4 -m 2048 -drive file=/home/image/sriov-fc20-1.img -vnc :1 \
+ -device pci-assign,host=87:02.0,id=pt_0 \
+ -device pci-assign,host=87:0a.0,id=pt_1
+
+4. Login vm0 and them bind VF devices to igb_uio driver.
+
+ ./tools/dpdk_nic_bind.py --bind=igb_uio 00:04.0 00:05.0
+
+5. Start testpmd, set it in rxonly mode and enable verbose output
+ testpmd -c 0x0f -n 4 -w 00:04.0 -w 00:05.0 -- -i --portmask=0x3 --txqflags=0
+ testpmd> set fwd rxonly
+ testpmd> set verbose 1
+ testpmd> start
+
+Test Case 1: Add port based vlan on VF
+======================================
+Linux network configration tool only set pvid on VF devices.
+
+1. Add pvid on VF0 from PF device
+ ip link set $PF_INTF vf 0 vlan 2
+
+2. Send packet with same vlan id and check VF can receive
+
+3. Send packet without vlan and check VF can't receive
+
+4. Send packet with wrong and check Vf can't receive
+
+5. Check pf device show correct pvid setting
+ ip link show ens259f0
+ ...
+ vf 0 MAC 00:00:00:00:00:00, vlan 1, spoof checking on, link-state auto
+
+Test Case 2: Remove port based vlan on VF
+=========================================
+1. Remove added vlan from PF device
+ ip link set $PF_INTF vf 0 vlan 0
+
+2. Restart testpmd and send packet without vlan and check VF can receive
+
+3. Set packet with vlan id 0 and check VF can receive
+
+4. Set packet with random id 1-4095 and check VF can't receive
+
+Test Case 3: VF port based vlan tx
+==================================
+1. Add pvid on VF0 from PF device
+ ip link set $PF_INTF vf 0 vlan 2
+
+2. Start testpmd with mac forward mode
+ testpmd> set fwd mac
+ testpmd> start
+
+3. Send packet from tester port1 and check packet recevied by tester port0
+ Check port1 recevied packet with configured vlan 2
+
+Test Case 3: VF tagged vlan tx
+===============================
+1. Start testpmd with full-featured tx code path and with mac forward mode
+ testpmd -c f -n 3 -- -i --txqflags=0x0
+ testpmd> set fwd mac
+ testpmd> start
+
+2. Add tx vlan offload on VF0, take care the first param is port
+ testpmd> tx_vlan 0 1
+
+3. Send packet from tester port1 and check packet recevied by tester port0
+ Check port- recevied packet with configured vlan 1
+
+4. rerun with step2-3 with random vlan and max vlan 4095
+
+Test case4: VF tagged vlan rx
+=============================
+1. Make sure port based vlan disabled on VF0 and VF1
+2. Start testpmd with rxonly mode
+ testpmd> set fwd rxonly
+ testpmd> set verbose 1
+ testpmd> start
+
+3. Send packet without vlan and check packet received
+
+4. Send packet with vlan 0 and check packet received
+
+5. Add vlan on VF0 from VF driver
+ testpmd> rx_vlan add 1 0
+
+6. Send packet with vlan0/1 and check packet received
+
+7. rerun with step5-6 with random vlan and max vlan 4095
+
+8. Remove vlan on VF0
+ rx_vlan rm 1 0
+
+9. Send packet with vlan 0 and check packet received
+
+10. Send packet without vlan and check packet received
+
+11. Send packe with vlan 1 and check packet can't recevied
+
+Test case5: VF Vlan strip test
+==============================
+1. Start testpmd with mac forward mode
+ testpmd> set fwd mac
+ testpmd> set verbose 1
+ testpmd> start
+
+2. Add tagged vlan 1 on VF0
+ testpmd> rx_vlan add 1 0
+
+3. Disable VF0 vlan strip and sniff packet on tester port1
+ testpmd> vlan set strip off 0
+
+4. set packet from tester port0 with vlan 1 and check sniffed packet has vlan
+
+5. enable vlan strip on VF0 and sniff packet on tester port1
+ testpmd> vlan set strip on 0
+
+6. send packet from tester port0 with vlan 1 and check sniffed packet without vlan
+
+7. send packet from tester port0 with vlan 0 and check sniffed packet without vlan
+
+8. rerun with step 2-8 with random vlan and max vlan 4095
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dts] [PATCH v2 5/6] tests vf_vlan: add test suite for VF vlan validation
2016-01-19 1:38 [dts] [PATCH v2 1/6] framework tester: NIC object get from net_device module Yong Liu
` (2 preceding siblings ...)
2016-01-19 1:38 ` [dts] [PATCH v2 4/6] tests vf_vlan: add VF vlan test plan Yong Liu
@ 2016-01-19 1:38 ` Yong Liu
2016-01-19 1:38 ` [dts] [PATCH v2 6/6] conf vf_vlan: add configuration file for VF vlan Yong Liu
4 siblings, 0 replies; 6+ messages in thread
From: Yong Liu @ 2016-01-19 1:38 UTC (permalink / raw)
To: dts
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
new file mode 100644
index 0000000..6bde6ca
--- /dev/null
+++ b/tests/TestSuite_vf_vlan.py
@@ -0,0 +1,377 @@
+# <COPYRIGHT_TAG>
+
+import re
+import time
+
+import dts
+from qemu_kvm import QEMUKvm
+from test_case import TestCase
+from pmd_output import PmdOutput
+from packet import Packet, sniff_packets, load_sniff_packets
+from settings import get_nic_name
+import random
+
+VM_CORES_MASK = 'all'
+MAX_VLAN = 4095
+
+
+class TestVfVlan(TestCase):
+
+ def set_up_all(self):
+
+ self.dut_ports = self.dut.get_ports(self.nic)
+ self.verify(len(self.dut_ports) > 1, "Insufficient ports")
+ self.vm0 = None
+ self.env_done = False
+
+ def set_up(self):
+ self.setup_vm_env()
+
+ def bind_nic_driver(self, ports, driver=""):
+ # modprobe vfio driver
+ if driver == "vfio-pci":
+ for port in ports:
+ netdev = self.dut.ports_info[port]['port']
+ driver = netdev.get_nic_driver()
+ if driver != 'vfio-pci':
+ netdev.bind_driver(driver='vfio-pci')
+
+ elif driver == "igb_uio":
+ # igb_uio should insmod as default, no need to check
+ for port in ports:
+ netdev = self.dut.ports_info[port]['port']
+ driver = netdev.get_nic_driver()
+ if driver != 'igb_uio':
+ netdev.bind_driver(driver='igb_uio')
+ else:
+ for port in ports:
+ netdev = self.dut.ports_info[port]['port']
+ driver_now = netdev.get_nic_driver()
+ if driver == "":
+ driver = netdev.default_driver
+ if driver != driver_now:
+ netdev.bind_driver(driver=driver)
+
+ def setup_vm_env(self, driver='default'):
+ """
+ Create testing environment with 2VFs generated from 2PFs
+ """
+ if self.env_done:
+ return
+
+ # bind to default driver
+ self.bind_nic_driver(self.dut_ports[:2], driver="")
+
+ self.used_dut_port_0 = self.dut_ports[0]
+ self.host_intf0 = self.dut.ports_info[self.used_dut_port_0]['intf']
+ tester_port = self.tester.get_local_port(self.used_dut_port_0)
+ self.tester_intf0 = self.tester.get_interface(tester_port)
+
+ self.dut.generate_sriov_vfs_by_port(
+ self.used_dut_port_0, 1, driver=driver)
+ self.sriov_vfs_port_0 = self.dut.ports_info[
+ self.used_dut_port_0]['vfs_port']
+ self.vf0_mac = "00:10:00:00:00:00"
+ self.dut.send_expect("ip link set %s vf 0 mac %s" %
+ (self.host_intf0, self.vf0_mac), "# ")
+
+ self.used_dut_port_1 = self.dut_ports[1]
+ self.host_intf1 = self.dut.ports_info[self.used_dut_port_1]['intf']
+ self.dut.generate_sriov_vfs_by_port(
+ self.used_dut_port_1, 1, driver=driver)
+ self.sriov_vfs_port_1 = self.dut.ports_info[
+ self.used_dut_port_1]['vfs_port']
+ tester_port = self.tester.get_local_port(self.used_dut_port_1)
+ self.tester_intf1 = self.tester.get_interface(tester_port)
+
+ self.vf1_mac = "00:20:00:00:00:00"
+ self.dut.send_expect("ip link set %s vf 0 mac %s" %
+ (self.host_intf1, self.vf1_mac), "# ")
+
+ try:
+
+ for port in self.sriov_vfs_port_0:
+ port.bind_driver('pci-stub')
+
+ for port in self.sriov_vfs_port_1:
+ port.bind_driver('pci-stub')
+
+ time.sleep(1)
+ vf0_prop = {'opt_host': self.sriov_vfs_port_0[0].pci}
+ vf1_prop = {'opt_host': self.sriov_vfs_port_1[0].pci}
+
+ # set up VM0 ENV
+ self.vm0 = QEMUKvm(self.dut, 'vm0', 'vf_vlan')
+ self.vm0.set_vm_device(driver='pci-assign', **vf0_prop)
+ self.vm0.set_vm_device(driver='pci-assign', **vf1_prop)
+ self.vm_dut_0 = self.vm0.start()
+ if self.vm_dut_0 is None:
+ raise Exception("Set up VM0 ENV failed!")
+
+ except Exception as e:
+ self.destroy_vm_env()
+ raise Exception(e)
+
+ self.env_done = True
+
+ def destroy_vm_env(self):
+ if getattr(self, 'vm0', None):
+ self.vm_dut_0.kill_all()
+ self.vm0_testpmd = None
+ self.vm0_dut_ports = None
+ # destroy vm0
+ self.vm0.stop()
+ self.vm0 = None
+
+ if getattr(self, 'used_dut_port_0', None):
+ self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_0)
+ port = self.dut.ports_info[self.used_dut_port_0]['port']
+ self.used_dut_port_0 = None
+
+ if getattr(self, 'used_dut_port_1', None):
+ self.dut.destroy_sriov_vfs_by_port(self.used_dut_port_1)
+ port = self.dut.ports_info[self.used_dut_port_1]['port']
+ self.used_dut_port_1 = None
+
+ self.bind_nic_driver(self.dut_ports[:2], driver="igb_uio")
+
+ self.env_done = False
+
+ def test_pvid_vf_tx(self):
+ """
+ Add port based vlan on vf device and check vlan tx work
+ """
+ random_vlan = random.randint(1, MAX_VLAN)
+
+ self.dut.send_expect(
+ "ip link set %s vf 0 vlan %d" % (self.host_intf0, random_vlan), "# ")
+ out = self.dut.send_expect("ip link show %s" % self.host_intf0, "# ")
+ self.verify("vlan %d" %
+ random_vlan in out, "Failed to add pvid on VF0")
+
+ 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)
+ self.vm0_testpmd.execute_cmd('set fwd mac')
+ self.vm0_testpmd.execute_cmd('start')
+
+ pkt = Packet(pkt_type='UDP')
+ pkt.config_layer('ether', {'dst': self.vf1_mac})
+ inst = sniff_packets(self.tester_intf0, timeout=5)
+ pkt.send_pkt(tx_port=self.tester_intf1)
+ pkts = load_sniff_packets(inst)
+
+ self.verify(len(pkts), "Not receive expected packet")
+ self.vm0_testpmd.quit()
+
+ # disable pvid
+ self.dut.send_expect(
+ "ip link set %s vf 0 vlan 0" % (self.host_intf0), "# ")
+
+ def send_and_getout(self, vlan=0, pkt_type="UDP"):
+
+ if pkt_type == "UDP":
+ pkt = Packet(pkt_type='UDP')
+ pkt.config_layer('ether', {'dst': self.vf0_mac})
+ elif pkt_type == "VLAN_UDP":
+ pkt = Packet(pkt_type='VLAN_UDP')
+ pkt.config_layer('dot1q', {'vlan': vlan})
+ pkt.config_layer('ether', {'dst': self.vf0_mac})
+
+ pkt.send_pkt(tx_port=self.tester_intf0)
+ out = self.vm_dut_0.get_session_output(timeout=2)
+
+ return out
+
+ def test_add_pvid_vf(self):
+ random_vlan = random.randint(1, MAX_VLAN)
+
+ self.dut.send_expect(
+ "ip link set %s vf 0 vlan %d" % (self.host_intf0, random_vlan), "# ")
+ out = self.dut.send_expect("ip link show %s" % self.host_intf0, "# ")
+ self.verify("vlan %d" %
+ random_vlan in out, "Failed to add pvid on VF0")
+
+ # start testpmd in VM
+ 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)
+ self.vm0_testpmd.execute_cmd('set fwd rxonly')
+ self.vm0_testpmd.execute_cmd('set verbose 1')
+ self.vm0_testpmd.execute_cmd('start')
+
+ out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
+ self.verify("received" in out, "Failed to received vlan packet!!!")
+
+ # send packet without vlan
+ out = self.send_and_getout(pkt_type="UDP")
+ self.verify("received" not in out, "Received packet without vlan!!!")
+
+ # send packet with vlan not matched
+ wrong_vlan = (random_vlan + 1) % 4096
+ out = self.send_and_getout(vlan=wrong_vlan, pkt_type="VLAN_UDP")
+ self.verify(
+ "received" not in out, "Received pacekt with wrong vlan!!!")
+
+ # remove vlan
+ self.dut.send_expect(
+ "ip link set %s vf 0 vlan 0" % self.host_intf0, "# ")
+
+ # send packet with vlan
+ out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
+ self.verify(
+ "received" not in out, "Received vlan packet without pvid!!!")
+
+ # send packe with vlan 0
+ out = self.send_and_getout(vlan=0, pkt_type="VLAN_UDP")
+ self.verify(
+ "received" in out, "Not recevied packet with vlan 0!!!")
+
+ # send packet without vlan
+ out = self.send_and_getout(vlan=0, pkt_type="UDP")
+ self.verify("received" in out, "Not received packet without vlan!!!")
+
+ self.vm0_testpmd.quit()
+
+ # disable pvid
+ self.dut.send_expect(
+ "ip link set %s vf 0 vlan 0" % (self.host_intf0), "# ")
+
+ def tx_and_check(self, tx_vlan=1):
+ inst = sniff_packets(self.tester_intf0, timeout=5)
+ self.vm0_testpmd.execute_cmd('set burst 1')
+ self.vm0_testpmd.execute_cmd('start tx_first')
+
+ # strip sniffered vlans
+ pkts = load_sniff_packets(inst)
+ vlans = []
+ for pkt in pkts:
+ vlan = pkt.strip_element_dot1q("vlan")
+ vlans.append(vlan)
+
+ self.verify(
+ tx_vlan in vlans, "Tx packet with vlan not received!!!")
+
+ def test_vf_vlan_tx(self):
+ random_vlan = random.randint(1, MAX_VLAN)
+ tx_vlans = [1, random_vlan, MAX_VLAN]
+ # start testpmd in VM
+ 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)
+ self.vm0_testpmd.execute_cmd('set verbose 1')
+
+ for tx_vlan in tx_vlans:
+ self.vm0_testpmd.execute_cmd('tx_vlan set 0 %d' % tx_vlan)
+ self.tx_and_check(tx_vlan=tx_vlan)
+
+ self.vm0_testpmd.quit()
+
+ def test_vf_vlan_rx(self):
+ random_vlan = random.randint(1, MAX_VLAN - 1)
+ rx_vlans = [1, random_vlan, MAX_VLAN]
+ # start testpmd in VM
+ 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)
+ self.vm0_testpmd.execute_cmd('set fwd rxonly')
+ self.vm0_testpmd.execute_cmd('set verbose 1')
+ self.vm0_testpmd.execute_cmd('vlan set strip off 0')
+ self.vm0_testpmd.execute_cmd('start')
+
+ # send packet without vlan
+ out = self.send_and_getout(vlan=0, pkt_type="UDP")
+ self.verify(
+ "received 1 packets" in out, "Not received normal packet as default!!!")
+
+ # 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!!!")
+
+ for rx_vlan in rx_vlans:
+ self.vm0_testpmd.execute_cmd('rx_vlan add %d 0' % rx_vlan)
+ # send packet with same vlan
+ out = self.send_and_getout(vlan=rx_vlan, pkt_type="VLAN_UDP")
+ vlan_hex = hex(rx_vlan)
+ self.verify("VLAN tci=%s" %
+ vlan_hex in out, "Not received expected vlan packet!!!")
+
+ pkt = Packet(pkt_type='VLAN_UDP')
+ if rx_vlan == MAX_VLAN:
+ continue
+ wrong_vlan = (rx_vlan + 1) % 4096
+
+ # send packet with wrong vlan
+ out = self.send_and_getout(vlan=wrong_vlan, pkt_type="VLAN_UDP")
+ self.verify(
+ "received 1 packets" not in out, "Received filtered vlan packet!!!")
+
+ for rx_vlan in rx_vlans:
+ self.vm0_testpmd.execute_cmd('rx_vlan rm 0 %d' % random_vlan)
+
+ # 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!!!")
+
+ # send packet without vlan
+ out = self.send_and_getout(pkt_type="UDP")
+ self.verify("received 1 packets" in out,
+ "Not received normal packet after remove vlan filter!!!")
+
+ # send packet with vlan
+ out = self.send_and_getout(vlan=random_vlan, pkt_type="VLAN_UDP")
+ self.verify(
+ "received 1 packets" in out, "Not received vlan packet without vlan filter!!!")
+
+ self.vm0_testpmd.quit()
+
+ def test_vf_vlan_strip(self):
+ random_vlan = random.randint(1, MAX_VLAN - 1)
+ rx_vlans = [1, random_vlan, MAX_VLAN]
+ # start testpmd in VM
+ 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)
+ self.vm0_testpmd.execute_cmd('set fwd rxonly')
+ self.vm0_testpmd.execute_cmd('set verbose 1')
+ self.vm0_testpmd.execute_cmd('vlan set strip on 0')
+ self.vm0_testpmd.execute_cmd('start')
+
+ for rx_vlan in rx_vlans:
+ self.vm0_testpmd.execute_cmd('rx_vlan add %d 0' % rx_vlan)
+ out = self.send_and_getout(vlan=rx_vlan, pkt_type="VLAN_UDP")
+ # enable strip, vlan will be in mbuf
+ vlan_hex = hex(rx_vlan)
+ self.verify("VLAN tci=%s" %
+ vlan_hex in out, "Failed to strip vlan packet!!!")
+
+ self.vm0_testpmd.execute_cmd('vlan set strip off 0')
+
+ out = self.send_and_getout(vlan=rx_vlan, pkt_type="VLAN_UDP")
+ self.verify(
+ "received 1 packets" in out, "Not received vlan packet as expected!!!")
+ nic_type = self.vm_dut_0.ports_info[0]['type']
+ nic_name = get_nic_name(nic_type)
+ if nic_name in ['fvl10g_vf']:
+ self.verify("VLAN tci=%s" %
+ vlan_hex in out, "Failed to disable strip vlan!!!")
+ else:
+ self.verify(
+ "VLAN tci=0x0" in out, "Failed to disable strip vlan!!!")
+
+ self.vm0_testpmd.quit()
+
+ def tear_down(self):
+ self.vm_dut_0.kill_all()
+ pass
+
+ def tear_down_all(self):
+ self.destroy_vm_env()
+ pass
--
1.9.3
^ permalink raw reply [flat|nested] 6+ messages in thread