From: "Mo, YufengX" <yufengx.mo@intel.com>
To: "Zeng, XiaoxiaoX" <xiaoxiaox.zeng@intel.com>,
"dts@dpdk.org" <dts@dpdk.org>
Cc: "Zeng, XiaoxiaoX" <xiaoxiaox.zeng@intel.com>
Subject: Re: [dts] [PATCH V1.2] tests/sriov_kvm:complete case and fix bugs
Date: Thu, 26 Sep 2019 02:50:25 +0000 [thread overview]
Message-ID: <B8B15C44A3F2C044966E545C7B7371153E84DA51@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20190925174918.19030-1-xiaoxiaox.zeng@intel.com>
Hi,zeng xiaoxiao
Weather test case fail or pass, tear_down will be executed at the end of a test case.
When some your new test cases fail, reset_port_all_mirror_rule will be executed twice.
BRs
Yufen, Mo
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Xiaoxiao Zeng
> Sent: Thursday, September 26, 2019 1:49 AM
> To: dts@dpdk.org
> Cc: Zeng, XiaoxiaoX <xiaoxiaox.zeng@intel.com>
> Subject: [dts] [PATCH V1.2] tests/sriov_kvm:complete case and fix bugs
>
> *.complete cases according to sriov_kvm_test_plan.
> *.expand setup_two_vm_common_prerequisite() to suit different fwd mode.
> *.add try...except to avoid env can't reset when case failed.
> *.add reset pf mirror rule in tear_down().
>
> Signed-off-by: Xiaoxiao Zeng <xiaoxiaox.zeng@intel.com>
> ---
> tests/TestSuite_sriov_kvm.py | 368 ++++++++++++++++++++++-------------
> 1 file changed, 238 insertions(+), 130 deletions(-)
>
> diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py
> index 3518f8f..b7be21c 100644
> --- a/tests/TestSuite_sriov_kvm.py
> +++ b/tests/TestSuite_sriov_kvm.py
> @@ -11,6 +11,7 @@ Test userland 10Gb PMD.
> import re
> import pdb
> import time
> +import random
>
> from virt_common import VM
> from test_case import TestCase
> @@ -622,22 +623,32 @@ class TestSriovKvm(TestCase):
> for rule_id in self.port_mirror_ref[port][:]:
> self.reset_port_mirror_rule(port, rule_id)
>
> - def setup_two_vm_common_prerequisite(self):
> - 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 promisc all off')
> - self.vm0_testpmd.execute_cmd('start')
> + def setup_two_vm_common_prerequisite(self, fwd0="rxonly", fwd1="mac"):
>
> - self.vm1_dut_ports = self.vm_dut_1.get_ports('any')
> - self.vm1_testpmd = PmdOutput(self.vm_dut_1)
> - self.vm1_testpmd.start_testpmd(VM_CORES_MASK)
> - self.vm1_testpmd.execute_cmd('set fwd mac')
> - self.vm1_testpmd.execute_cmd('set promisc all off')
> - self.vm1_testpmd.execute_cmd('start')
> + if self.setup_2vm_prerequisite_flag == 1:
> + self.vm0_testpmd.execute_cmd('stop')
> + self.vm0_testpmd.execute_cmd('set fwd %s' % fwd0)
> + self.vm0_testpmd.execute_cmd('start')
>
> - self.setup_2vm_prerequisite_flag = 1
> + self.vm1_testpmd.execute_cmd('stop')
> + self.vm1_testpmd.execute_cmd('set fwd %s' % fwd1)
> + self.vm1_testpmd.execute_cmd('start')
> + else:
> + 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 %s' % fwd0)
> + self.vm0_testpmd.execute_cmd('set promisc all off')
> + self.vm0_testpmd.execute_cmd('start')
> +
> + self.vm1_dut_ports = self.vm_dut_1.get_ports('any')
> + self.vm1_testpmd = PmdOutput(self.vm_dut_1)
> + self.vm1_testpmd.start_testpmd(VM_CORES_MASK)
> + self.vm1_testpmd.execute_cmd('set fwd %s' % fwd1)
> + self.vm1_testpmd.execute_cmd('set promisc all off')
> + self.vm1_testpmd.execute_cmd('start')
> +
> + self.setup_2vm_prerequisite_flag = 1
>
> def destroy_two_vm_common_prerequisite(self):
> self.vm0_testpmd = None
> @@ -713,78 +724,154 @@ class TestSriovKvm(TestCase):
> ret_stats[key] = end_stats[key] - start_stats[key]
> return ret_stats
>
> - def test_two_vms_pool_mirror(self):
> + def test_two_vms_pool_up_mirrors(self):
> + """
> + Test Case2: Mirror Traffic between 2VMs with Pool up mirroring
> + """
> port_id_0 = 0
> packet_num = 10
>
> + # set Pool up mirror rule
> rule_id = self.set_port_pool_mirror(port_id_0, '0x1 dst-pool 1 on')
> +
> + # get vm1 port stats
> vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # send 10 packets
> self.send_packet(
> self.vm_dut_0, self.vm0_dut_ports, port_id_0, count=packet_num)
> +
> + # get vm1 port stats
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
>
> - self.verify(vm1_ret_stats['RX-packets'] == packet_num and
> - vm1_ret_stats['TX-packets'] == packet_num,
> - "Pool mirror failed between VM0 and VM1!")
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == packet_num and vm1_ret_stats['TX-packets'] == packet_num, "failed")
> + except:
> + self.reset_port_mirror_rule(port_id_0, rule_id)
> + raise ("Pool mirror failed between VM0 and VM1!")
>
> - self.reset_port_mirror_rule(port_id_0, rule_id)
> + def test_two_vms_pool_down_mirrors(self):
> + """
> + Test Case3: Mirror Traffic between 2VMs with Pool down mirroring
> + """
> + port_id_0 = 0
> + mirror_name = "pool-mirror-down"
> + packet_num = 32
> +
> + # set up common 2VM prerequisites
> + self.setup_two_vm_common_prerequisite(fwd0="mac", fwd1="rxonly")
> +
> + # set Pool down mirror rule
> + rule_id = self.set_port_mirror_rule(port_id_0, mirror_name, '0x1 dst-pool 1 on')
> +
> + # get vm port stats
> + vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # send packets
> + self.vm0_testpmd.execute_cmd('stop')
> + self.vm0_testpmd.execute_cmd('start tx_first')
> +
> + # get vm port stats
> + vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # verify vm1 receive packets
> + vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> + vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == vm0_ret_stats['TX-packets'] and vm1_ret_stats['RX-packets'] == packet_num, "failed")
> + except:
> + self.reset_port_mirror_rule(port_id_0, rule_id)
> + raise ("Pool mirror failed between VM0 and VM1!")
>
> def test_two_vms_uplink_mirror(self):
> + """
> + Test Case4: Mirror Traffic between 2VMs with Uplink mirroring
> + """
> port_id_0 = 0
> packet_num = 10
>
> + # set uplink mirror rule
> rule_id = self.set_port_uplink_mirror(port_id_0, 'dst-pool 1 on')
> +
> + # get vm1 port stats
> vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # send packets
> self.send_packet(
> self.vm_dut_0, self.vm0_dut_ports, port_id_0, count=packet_num)
> +
> + # get vm1 port stats
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> -
> - self.verify(vm1_ret_stats['RX-packets'] == packet_num and
> - vm1_ret_stats['TX-packets'] == packet_num,
> - "Uplink mirror failed between VM0 and VM1!")
> -
> - self.reset_port_mirror_rule(port_id_0, rule_id)
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == packet_num and vm1_ret_stats['TX-packets'] == packet_num, "failed")
> + except:
> + self.reset_port_mirror_rule(port_id_0, rule_id)
> + raise ("Uplink mirror failed between VM0 and VM1!")
>
> def test_two_vms_downlink_mirror(self):
> - self.vm0_testpmd.execute_cmd('stop')
> - self.vm1_testpmd.execute_cmd('stop')
> -
> + """
> + Test Case5: Mirror Traffic between 2VMs with Downlink mirroring
> + """
> port_id_0 = 0
> + packet_num = 32
>
> + # set downlink mirror rule
> rule_id = self.set_port_downlink_mirror(port_id_0, 'dst-pool 1 on')
>
> - self.vm1_testpmd.execute_cmd('set fwd rxonly')
> - self.vm1_testpmd.execute_cmd('start')
> - vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + # set up common 2VM prerequisites
> + self.setup_two_vm_common_prerequisite(fwd0="mac", fwd1="rxonly")
> +
> + # get vms port stats
> vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # send packets
> + self.vm0_testpmd.execute_cmd('stop')
> self.vm0_testpmd.execute_cmd('start tx_first')
> +
> + # get vms port stats
> vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> -
> - self.verify(self.vm0_testpmd.check_tx_bytes(vm1_ret_stats['RX-packets'], vm0_ret_stats['TX-packets']),
> - "Downlink mirror failed between VM0 and VM1!")
> -
> - self.reset_port_mirror_rule(port_id_0, rule_id)
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == vm0_ret_stats['TX-packets'] and vm1_ret_stats['RX-packets'] == packet_num, "failed")
> + except:
> + self.reset_port_mirror_rule(port_id_0, rule_id)
> + raise ("Pool mirror failed between VM0 and VM1!")
>
> def test_two_vms_vlan_mirror(self):
> - self.vm1_testpmd.execute_cmd('vlan set strip on 0')
> + """
> + Test Case6: Mirror Traffic between 2VMs with Vlan mirroring
> + """
> port_id_0 = 0
> - vlan_id = 0
> + vlan_id = random.randint(1, 4095)
> vf_mask = '0x1'
> packet_num = 10
>
> - 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')
> + # set up common 2VM prerequisites
> + self.setup_two_vm_common_prerequisite(fwd0="mac", fwd1="rxonly")
> +
> + # add rx vlan on VF0
> + self.host_testpmd.execute_cmd('rx_vlan add %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
>
> + # set vlan mirror rule
> + rule_id = self.set_port_vlan_mirror(port_id_0, '%d dst-pool 1 on' % vlan_id)
> +
> + # get vm port stats
> vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # send packets
> ether_ip = {}
> ether_ip['vlan'] = {'vlan': '%d' % vlan_id}
> self.send_packet(
> @@ -793,16 +880,23 @@ class TestSriovKvm(TestCase):
> port_id_0,
> count=packet_num,
> **ether_ip)
> +
> + # get vm port stats
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == packet_num * 2, "failed")
> + except:
> + # reset env.
> + 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)
> + self.host_testpmd.execute_cmd('rx_vlan rm %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
> + raise ("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.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)
> + # reset env.
> + self.host_testpmd.execute_cmd('rx_vlan rm %d port %d vf %s' % (vlan_id, port_id_0, vf_mask))
>
> def test_two_vms_vlan_and_pool_mirror(self):
> self.vm0_testpmd.execute_cmd('vlan set strip on 0')
> @@ -852,133 +946,144 @@ class TestSriovKvm(TestCase):
> self.reset_port_all_mirror_rule(port_id_0)
>
> def test_two_vms_uplink_and_downlink_mirror(self):
> - self.vm0_testpmd.execute_cmd('stop')
> - self.vm1_testpmd.execute_cmd('stop')
> -
> + """
> + Test Case7: Mirror Traffic between 2VMs with up link mirroring & down link mirroring
> + """
> port_id_0 = 0
> packet_num = 10
>
> + # set up common 2VM prerequisites
> + self.setup_two_vm_common_prerequisite(fwd0="mac", fwd1="rxonly")
> +
> + # set mirror rule
> self.set_port_downlink_mirror(port_id_0, 'dst-pool 1 on')
> self.set_port_uplink_mirror(port_id_0, 'dst-pool 1 on')
>
> - self.vm1_testpmd.execute_cmd('set fwd rxonly')
> - self.vm1_testpmd.execute_cmd('start')
> + # get vm1 port stats
> vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> - vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> - self.vm0_testpmd.execute_cmd('start tx_first')
> - vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> - vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> -
> - vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> - vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
>
> - self.verify(vm1_ret_stats['RX-packets'] == vm0_ret_stats['TX-packets'],
> - "Downlink mirror failed between VM0 and VM1 " +
> - "when set uplink and downlink mirror!")
> + # send packets
> + self.send_packet(self.vm_dut_0, self.vm0_dut_ports, port_id_0, count=packet_num)
>
> - self.vm0_testpmd.execute_cmd('stop')
> - self.vm0_testpmd.execute_cmd('set fwd mac')
> - self.vm0_testpmd.execute_cmd('start')
> -
> - vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> - self.send_packet(
> - self.vm_dut_0,
> - self.vm0_dut_ports,
> - port_id_0,
> - count=packet_num)
> + # get vm1 port stats
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> -
> - self.verify(vm1_ret_stats['RX-packets'] == 2 * packet_num,
> - "Uplink and down link mirror failed between VM0 and VM1 " +
> - "when set uplink and downlink mirror!")
> -
> - self.reset_port_all_mirror_rule(port_id_0)
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == packet_num * 2, "failed")
> + except:
> + self.reset_port_all_mirror_rule(port_id_0)
> + raise ("Set uplink and downlink mirror failed!")
>
> def test_two_vms_vlan_and_pool_and_uplink_and_downlink(self):
> - 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')
> - self.vm1_testpmd.execute_cmd('stop')
> -
> + """
> + Test Case8: Mirror Traffic between 2VMs with Vlan & with up link mirroring & down link mirroring
> + """
> port_id_0 = 0
> - vlan_id = 3
> + vlan_id = random.randint(1, 4095)
> vf_mask = '0x2'
> packet_num = 1
> + fail_log = "Vlan and downlink mirror failed between VM0 and VM1 when set vlan, pool, uplink and downlink mirror!"
> +
> + # set up common 2VM prerequisites
> + self.setup_two_vm_common_prerequisite(fwd0="mac", fwd1="rxonly")
>
> + # set mirror rule
> + self.set_port_pool_mirror(port_id_0, '0x1 dst-pool 1 on')
> self.set_port_downlink_mirror(port_id_0, 'dst-pool 1 on')
> - self.set_port_uplink_mirror(port_id_0, 'dst-pool 1 on')
> - self.host_testpmd.execute_cmd("rx_vlan add %d port %d vf %s" %
> - (vlan_id, port_id_0, vf_mask))
> + self.host_testpmd.execute_cmd("rx_vlan add %d port %d vf %s" % (vlan_id, port_id_0, vf_mask))
> self.set_port_vlan_mirror(port_id_0, '%d dst-pool 0 on' % vlan_id)
> - self.set_port_pool_mirror(port_id_0, '0x1 dst-pool 1 on')
>
> - self.vm1_testpmd.execute_cmd('set fwd rxonly')
> - self.vm1_testpmd.execute_cmd('start')
> - vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> - vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> - self.vm0_testpmd.execute_cmd('start tx_first')
> - vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> - vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + if self.nic.startswith('niantic'):
> + self.set_port_uplink_mirror(port_id_0, 'dst-pool 1 on')
>
> - vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> - vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> + # get vm port stats
> + vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
>
> - self.verify(vm1_ret_stats['RX-packets'] == vm0_ret_stats['TX-packets'],
> - "Downlink mirror failed between VM0 and VM1 " +
> - "when set vlan, pool, uplink and downlink mirror!")
> + # send packets
> + self.vm0_testpmd.execute_cmd('stop')
> + self.vm0_testpmd.execute_cmd('set fwd rxonly')
> + self.vm0_testpmd.execute_cmd('start tx_first')
>
> - self.vm0_testpmd.execute_cmd('stop')
> - self.vm0_testpmd.execute_cmd('set fwd mac')
> - self.vm0_testpmd.execute_cmd('start')
> + # get vm port stats
> + vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # verify vm1 receive packets
> + vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> + vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
> + try:
> + self.verify(vm1_ret_stats['RX-packets'] == vm0_ret_stats['TX-packets'], "failed")
> + except:
> + self.reset_port_all_mirror_rule(port_id_0)
> + self.host_testpmd.execute_cmd("rx_vlan rm %d port %d vf %s" % (vlan_id, port_id_0, vf_mask))
> + raise (fail_log)
> +
> + # get vm port stats
> vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> +
> + # send packets
> + ether_ip = {}
> + ether_ip['vlan'] = {'vlan': '%d' % vlan_id}
> self.send_packet(
> - self.vm_dut_0,
> - self.vm0_dut_ports,
> + self.vm_dut_1,
> + self.vm1_dut_ports,
> port_id_0,
> - count=packet_num)
> + count=packet_num,
> + **ether_ip)
> + # get vm port stats
> vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
>
> - self.verify(self.vm0_testpmd.check_tx_bytes(vm0_ret_stats['RX-packets'], packet_num) and
> - self.vm0_testpmd.check_tx_bytes(vm0_ret_stats['TX-packets'], packet_num) and
> - self.vm0_testpmd.check_tx_bytes(vm1_ret_stats['RX-packets'], 2 * packet_num),
> - "Uplink and downlink mirror failed between VM0 and VM1 " +
> - "when set vlan, pool, uplink and downlink mirror!")
> -
> - self.vm0_testpmd.execute_cmd('stop')
> - self.vm0_testpmd.execute_cmd('set fwd mac')
> - self.vm0_testpmd.execute_cmd('start')
> + if self.nic.startswith('niantic'):
> + try:
> + self.verify(vm0_ret_stats['RX-packets'] == packet_num and vm1_ret_stats['RX-packets'] == packet_num, "failed")
> + except:
> + self.reset_port_all_mirror_rule(port_id_0)
> + self.host_testpmd.execute_cmd("rx_vlan rm %d port %d vf %s" % (vlan_id, port_id_0, vf_mask))
> + raise (fail_log)
> + else:
> + try:
> + self.verify(vm0_ret_stats['RX-packets'] == packet_num and vm1_ret_stats['RX-packets'] == 2 * packet_num, "failed")
> + except:
> + self.reset_port_all_mirror_rule(port_id_0)
> + self.host_testpmd.execute_cmd("rx_vlan rm %d port %d vf %s" % (vlan_id, port_id_0, vf_mask))
> + raise (fail_log)
>
> - ether_ip = {}
> - ether_ip['vlan'] = {'vlan': '%d' % vlan_id}
> - vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + # get vm port stats
> vm0_start_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> + vm1_start_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
> + # send packets
> self.send_packet(
> - self.vm_dut_1,
> - self.vm1_dut_ports,
> + self.vm_dut_0,
> + self.vm0_dut_ports,
> port_id_0,
> - count=packet_num,
> - **ether_ip)
> + count=packet_num)
> + # get vm port stats
> vm0_end_stats = self.vm0_testpmd.get_pmd_stats(port_id_0)
> vm1_end_stats = self.vm1_testpmd.get_pmd_stats(port_id_0)
>
> + # verify vm1 receive packets
> vm0_ret_stats = self.calculate_stats(vm0_start_stats, vm0_end_stats)
> vm1_ret_stats = self.calculate_stats(vm1_start_stats, vm1_end_stats)
>
> - self.verify(self.vm0_testpmd.check_tx_bytes(vm0_ret_stats['RX-packets'], packet_num) and
> - self.vm0_testpmd.check_tx_bytes(vm0_ret_stats['TX-packets'], packet_num) and
> - 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)
> + try:
> + self.verify(vm0_ret_stats['RX-packets'] == packet_num and vm0_ret_stats['TX-packets'] == packet_num and
> + vm1_ret_stats['RX-packets'] == packet_num, "failed")
> + except:
> + self.reset_port_all_mirror_rule(port_id_0)
> + self.host_testpmd.execute_cmd("rx_vlan rm %d port %d vf %s" % (vlan_id, port_id_0, vf_mask))
> + raise (fail_log)
> +
> + # reset env.
> + self.host_testpmd.execute_cmd("rx_vlan rm %d port %d vf %s" % (vlan_id, port_id_0, vf_mask))
>
> def test_two_vms_add_multi_exact_mac_on_vf(self):
> port_id_0 = 0
> @@ -1261,8 +1366,11 @@ class TestSriovKvm(TestCase):
> error, "Execute command '%s' successfully, it should be failed!" % command)
>
> def tear_down(self):
> + port_id_0 = 0
> self.vm0_testpmd.execute_cmd('quit', '# ')
> self.vm1_testpmd.execute_cmd('quit', '# ')
> + self.reset_port_all_mirror_rule(port_id_0)
> + self.setup_2vm_prerequisite_flag = 0
> time.sleep(1)
>
> def tear_down_all(self):
> --
> 2.17.0
next prev parent reply other threads:[~2019-09-26 2:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 17:49 Xiaoxiao Zeng
2019-09-26 2:50 ` Mo, YufengX [this message]
2019-09-26 7:06 ` Ma, LihongX
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=B8B15C44A3F2C044966E545C7B7371153E84DA51@shsmsx102.ccr.corp.intel.com \
--to=yufengx.mo@intel.com \
--cc=dts@dpdk.org \
--cc=xiaoxiaox.zeng@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).