From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Peng, Yuan" <yuan.peng@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Peng, Yuan" <yuan.peng@intel.com>
Subject: Re: [dts] [PATCH]tests: encapsulate funtion for TestSuite_veb_switch
Date: Tue, 26 Feb 2019 03:14:14 +0000 [thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BA2722A@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1550213520-7242-1-git-send-email-yuan.peng@intel.com>
Applied, thanks
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Peng Yuan
> Sent: Friday, February 15, 2019 2:52 PM
> To: dts@dpdk.org
> Cc: Peng, Yuan <yuan.peng@intel.com>
> Subject: [dts] [PATCH]tests: encapsulate funtion for TestSuite_veb_switch
>
> Encapsulate funtion for TestSuite_veb_switch.py
>
> Signed-off-by: Peng Yuan <yuan.peng@intel.com>
>
> diff --git a/tests/TestSuite_veb_switch.py b/tests/TestSuite_veb_switch.py index
> 0dc570a..0b0089b 100644
> --- a/tests/TestSuite_veb_switch.py
> +++ b/tests/TestSuite_veb_switch.py
> @@ -127,7 +127,30 @@ class TestVEBSwitching(TestCase):
> pkt.config_layer('ether', {'dst': vf_mac})
> pkt.send_pkt(tx_port=itf)
> time.sleep(.5)
> -
> +
> + def count_packet(self, out, mac):
> + """
> + Count packet sum number.
> + """
> + lines = out.split("\r\n")
> + cnt = 0
> + count_pkt = 0
> + # count the packet received from specified mac address.
> + for line in lines:
> + line = line.strip()
> + if len(line) != 0 and line.startswith(("src=",)):
> + for item in line.split(" "):
> + item = item.strip()
> + if(item == ("src=%s" % mac)):
> + cnt = cnt + 1
> + elif(item == "L4_UDP"):
> + cnt = cnt + 1
> + if (cnt == 2):
> + count_pkt = count_pkt + 1
> + cnt = 0
> + print utils.GREEN("The number of UDP packets received by pf is %d." %
> count_pkt)
> + return count_pkt
> +
> # Test cases.
> def set_up_all(self):
> """
> @@ -207,8 +230,8 @@ class TestVEBSwitching(TestCase):
>
> def test_VEB_switching_inter_vfs(self):
> """
> - Kernel PF, then create 2VFs. VFs running dpdk testpmd, send traffic to
> - VF1, and set the packet's DEST MAC to VF2, check if VF2 can receive
> + Kernel PF, then create 2VFs. VFs running dpdk testpmd,
> + send traffic from VF1 to VF2, check if VF2 can receive
> the packets. Check Inter VF-VF MAC switch.
> """
> self.setup_env(driver='default') @@ -234,8 +257,8 @@ class
> TestVEBSwitching(TestCase):
> def test_VEB_switching_inter_vfs_mac_fwd(self):
> """
> Kernel PF, then create 2VFs. VFs running dpdk testpmd, send traffic to
> - VF1, and set the packet's DEST MAC to VF2, check if VF2 can receive
> - the packets. Check Inter VF-VF MAC switch.
> + VF1 with VF1's MAC as packet's DEST MAC, set ether peer address to VF2's
> MAC.
> + Check if VF2 can receive the packets. Check Inter VF-VF MAC switch.
> """
> self.setup_env(driver='default')
> self.dut.send_expect("./%s/app/testpmd -c 0xf -n 4 --socket-mem
> 1024,1024 -w %s --file-prefix=test1 -- -i --eth-peer=0,%s" % (self.target,
> self.sriov_vfs_port[0].pci, self.vf1_mac), "testpmd>", 120) @@ -344,27 +367,12
> @@ class TestVEBSwitching(TestCase):
> out = self.dut.get_session_output(timeout=1)
> self.session_secondary.send_expect("stop", "testpmd>", 2)
> self.dut.send_expect("stop", "testpmd>", 2)
> - lines = out.split("\r\n")
> - cnt = 0
> - count_pkt = 0
> - # count the packet received by pf from vf.
> - for line in lines:
> - line = line.strip()
> - if len(line) != 0 and line.startswith(("src=",)):
> - for item in line.split(" "):
> - item = item.strip()
> - if(item == ("src=%s" % self.vf0_mac)):
> - cnt = cnt + 1
> - elif(item == "L4_UDP"):
> - cnt = cnt + 1
> - if (cnt == 2):
> - count_pkt = count_pkt + 1
> - cnt = 0
> - print utils.GREEN("The number of UDP packets received by pf is %d." %
> count_pkt)
> +
> + count_pkt = self.count_packet(out, self.vf0_mac)
> vf0_tx_stats = self.veb_get_pmd_stats("second", 0, "tx")
> pf_rx_stats = self.veb_get_pmd_stats("first", 0, "rx")
> - self.verify(vf0_tx_stats[0] > 0, "no packet was sent by VF0")
> - self.verify(count_pkt > 0, "no packet was received by PF")
> + self.verify(vf0_tx_stats[0] > 1000, "no packet was sent by VF0")
> + self.verify(count_pkt > 100, "no packet was received by PF")
> self.session_secondary.send_expect("quit", "# ")
> time.sleep(2)
> self.dut.send_expect("quit", "# ") @@ -388,7 +396,7 @@ class
> TestVEBSwitching(TestCase):
>
> vf0_rx_stats = self.veb_get_pmd_stats("second", 0, "rx")
> print utils.GREEN("The number of UDP packets received by vf is %d." %
> vf0_rx_stats[0])
> - self.verify(vf0_rx_stats[0] > 0, "no packet was received by VF0")
> + self.verify(vf0_rx_stats[0] > 100, "no packet was received by
> + VF0")
> self.session_secondary.send_expect("quit", "# ")
> time.sleep(2)
> self.dut.send_expect("quit", "# ")
> --
> 2.5.0
prev parent reply other threads:[~2019-02-26 3:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 6:52 Peng Yuan
2019-02-26 3:14 ` Tu, Lijuan [this message]
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=8CE3E05A3F976642AAB0F4675D0AD20E0BA2722A@SHSMSX101.ccr.corp.intel.com \
--to=lijuan.tu@intel.com \
--cc=dts@dpdk.org \
--cc=yuan.peng@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).