test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Zhang, YanX A" <yanx.a.zhang@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Zhang, YanX A" <yanx.a.zhang@intel.com>
Subject: Re: [dts] [PATCH V1] tests/TestSuite_vf_to_vf_nic_bridge:Change the way	you distribute
Date: Wed, 7 Aug 2019 06:56:34 +0000	[thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BAFEEF4@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1563531703-152978-1-git-send-email-yanx.a.zhang@intel.com>

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of zhang,yan
> Sent: Friday, July 19, 2019 6:22 PM
> To: dts@dpdk.org
> Cc: Zhang, YanX A <yanx.a.zhang@intel.com>
> Subject: [dts] [PATCH V1] tests/TestSuite_vf_to_vf_nic_bridge:Change the
> way you distribute
> 
> Change the way packets are sent and use testpmd instead of pktgen.
> 
> Signed-off-by: zhang,yan <yanx.a.zhang@intel.com>
> ---
>  tests/TestSuite_vf_to_vf_nic_bridge.py | 116 +++++++------------------
>  1 file changed, 33 insertions(+), 83 deletions(-)
> 
> diff --git a/tests/TestSuite_vf_to_vf_nic_bridge.py
> b/tests/TestSuite_vf_to_vf_nic_bridge.py
> index 15b2ff9..1e7374c 100644
> --- a/tests/TestSuite_vf_to_vf_nic_bridge.py
> +++ b/tests/TestSuite_vf_to_vf_nic_bridge.py
> @@ -125,57 +125,7 @@ class TestVF2VFBridge(TestCase):
>              port.bind_driver()
>              self.pf_port_for_vfs = 0
> 
> -    def generate_pcap_pkt(self, dst, src, load, pktname='flow.pcap'):
> -        """
> -        dst:
> -            server: dst server object
> -             ether: dst mac
> -                ip: dst ip
> -               udp: dst udp protocol
> -               tcp: dst tcp protocal
> -        src:
> -            server: src server object
> -             ether: src mac
> -                ip: src ip
> -               udp: src udp protocol
> -               tcp: src tcp protocal
> -        load:
> -           content: pay load
> -            length: content length
> -        """
> -        context = '[Ether(dst="%s", src="%s")/IP()/Raw(load=%s)]' % \
> -            (str(dst['ether']), str(src['ether']), load['content'])
> -        src['server'].send_expect('scapy', '>>> ', 10)
> -        src['server'].send_expect(
> -            'wrpcap("%s", %s)' % (pktname, context), '>>> ', 10)
> -        src['server'].send_expect('quit()', '#', 10)
> -
> -    def prepare_pktgen(self, vm):
> -        vm.session.copy_file_to('./dep/tgen.tgz')
> -        vm.send_expect("cd /root", "#", 10)
> -        vm.send_expect("tar xvf tgen.tgz", '#', 20)
> -
> -    def send_stream_pktgen(self, vm, pktname='flow.pcap'):
> -        vm.send_expect(
> -            "echo 2048 > /sys/kernel/mm/hugepages/hugepages-
> 2048kB/nr_hugepages", "#", 10)
> -        vm.send_expect(" mount -t hugetlbfs nodedev /mnt/huge/", "#", 10)
> -        vm.send_expect(
> -            "./pktgen -c 0xf -n 2 --proc-type auto -- -P -T -m '1.0' -s 0:%s" %
> -                       pktname, "", 100)
> -        time.sleep(60)
> -        vm.send_expect("set 0 rate 50", "", 20)
> -        time.sleep(5)
> -        vm.send_expect("set 0 count %d" % SEND_PACKET, "", 20)
> -        time.sleep(5)
> -        vm.send_expect("start all", "", 20)
> -        time.sleep(20)
> -
> -    def stop_stream_pktgen(self, vm):
> -        vm.send_expect("stop all", "", 20)
> -        time.sleep(5)
> -        vm.send_expect("quit", "#", 20)
> -
> -    def test_2vf_d2d_pktgen_stream(self):
> +    def test_2vf_d2d_testpmd_stream(self):
>          self.vm0_ports = self.vm0_dut.get_ports('any')
>          self.vm0_pmd = PmdOutput(self.vm0_dut)
>          self.vm0_pmd.start_testpmd('all') @@ -183,60 +133,60 @@ class
> TestVF2VFBridge(TestCase):
>          self.vm0_pmd.execute_cmd("set promisc all off")
>          self.vm0_pmd.execute_cmd('start')
> 
> -        self.vm1_ports = self.vm1_dut.get_ports('any')
> -        self.prepare_pktgen(self.vm1_dut)
> -
> -        dst = {}
> -        dst['server'] = self.vm0_dut
> -        dst['ether'] = self.vm0_dut.ports_info[self.vm0_ports[0]]['mac']
> -        src = {}
> -        src['server'] = self.vm1_dut
> -        src['ether'] = self.vm1_dut.ports_info[self.vm1_ports[0]]['mac']
> -        load = {}
> -        load['content'] = "'X'*46"
> -        self.generate_pcap_pkt(dst, src, load)
> -        self.vm0_pmd.execute_cmd('clear port stats all')
> -        self.send_stream_pktgen(self.vm1_dut)
> +        vm0_mac = self.vm0_dut.ports_info[self.vm0_ports[0]]['mac']
> +
> +        self.vm1_pmd = PmdOutput(self.vm1_dut)
> +        self.vm1_pmd.start_testpmd('all')
> +        self.vm1_pmd.execute_cmd('set fwd mac')
> +        self.vm1_pmd.execute_cmd("set promisc all off")
> +        self.vm1_pmd.execute_cmd('set eth-peer 0 %s' % vm0_mac)
> +        self.vm1_pmd.execute_cmd('set burst 50')
> +        self.vm1_pmd.execute_cmd('start tx_first 2')
> +
>          recv_num = self.vm0_pmd.get_pmd_stats(0)['RX-packets']
>          time.sleep(1)
> -        self.stop_stream_pktgen(self.vm1_dut)
>          self.vm0_pmd.execute_cmd('stop')
>          self.vm0_pmd.execute_cmd('quit', '# ')
> 
> +        self.vm1_pmd.execute_cmd('stop')
> +        self.vm1_pmd.execute_cmd('quit', '# ')
> +
>          self.verify(recv_num is SEND_PACKET,
>                      'Rx port recv error: %d' % recv_num)
> 
> -    def test_2vf_d2k_pktgen_stream(self):
> +    def test_2vf_d2k_testpmd_stream(self):
>          self.vm0_dut.restore_interfaces()
>          self.vm0_ports = self.vm0_dut.get_ports('any')
>          vf0_intf = self.vm0_dut.ports_info[self.vm0_ports[0]]['intf']
> 
>          self.vm1_ports = self.vm1_dut.get_ports('any')
> -        self.prepare_pktgen(self.vm1_dut)
> -
> -        dst = {}
> -        dst['server'] = self.vm0_dut
> -        dst['ether'] = self.vm0_dut.ports_info[self.vm0_ports[0]]['mac']
> -        src = {}
> -        src['server'] = self.vm1_dut
> -        src['ether'] = self.vm1_dut.ports_info[self.vm1_ports[0]]['mac']
> -        load = {}
> -        load['content'] = "'X'*46"
> -        self.generate_pcap_pkt(dst, src, load)
> +
> +        vm0_mac = self.vm0_dut.ports_info[self.vm0_ports[0]]['mac']
> +        filename = "m.pcap"
> +
>          self.vm0_dut.send_expect(
> -            'tcpdump -i %s -s 1000 "ether src %s and ether dst %s"' %
> -                                 (vf0_intf, src['ether'], dst['ether']), 'tcpdump', 30)
> -        self.send_stream_pktgen(self.vm1_dut)
> -        self.stop_stream_pktgen(self.vm1_dut)
> +                'tcpdump -i %s ether dst %s -w %s' % (vf0_intf,
> + vm0_mac, filename), 'tcpdump', 30)
> 
> +        self.vm1_pmd = PmdOutput(self.vm1_dut)
> +        self.vm1_pmd.start_testpmd('all')
> +        self.vm1_pmd.execute_cmd('set fwd mac')
> +        self.vm1_pmd.execute_cmd("set promisc all off")
> +        self.vm1_pmd.execute_cmd('set eth-peer 0 %s' % vm0_mac)
> +        self.vm1_pmd.execute_cmd('set burst 50')
> +        self.vm1_pmd.execute_cmd('start tx_first 2')
> +
> +        time.sleep(1)
>          recv_tcpdump = self.vm0_dut.send_expect('^C', '#', 30)
>          time.sleep(5)
> -        recv_pattern = re.compile("(\d+) packets captured")
> +        recv_pattern = re.compile("(\d+) packet\w{0,1} captured")
>          recv_info = recv_pattern.search(recv_tcpdump)
>          recv_str = recv_info.group(0).split(' ')[0]
>          recv_number = int(recv_str, 10)
>          self.vm0_dut.bind_interfaces_linux(self.drivername)
> 
> +        self.vm1_pmd.execute_cmd('stop')
> +        self.vm1_pmd.execute_cmd('quit', '# ')
> +
>          self.verify(recv_number is SEND_PACKET,
>                      'Rx port recv error: %d' % recv_number)
> 
> --
> 2.17.2


      parent reply	other threads:[~2019-08-07  6:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 10:21 zhang,yan
2019-07-19 10:55 ` Yao, BingX Y
2019-08-07  6:56 ` 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=8CE3E05A3F976642AAB0F4675D0AD20E0BAFEEF4@SHSMSX101.ccr.corp.intel.com \
    --to=lijuan.tu@intel.com \
    --cc=dts@dpdk.org \
    --cc=yanx.a.zhang@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).