test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Tu, Lijuan" <lijuan.tu@intel.com>
To: "Ma, LihongX" <lihongx.ma@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Cc: "Ma, LihongX" <lihongx.ma@intel.com>
Subject: Re: [dts] [PATCH V1] tests/vf_port_start_stop: use Packet to send pkt
Date: Tue, 22 Oct 2019 09:06:33 +0000	[thread overview]
Message-ID: <8CE3E05A3F976642AAB0F4675D0AD20E0BB44EE2@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1571102684-10923-1-git-send-email-lihongx.ma@intel.com>

Applied, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of lihong
> Sent: Tuesday, October 15, 2019 9:25 AM
> To: dts@dpdk.org
> Cc: Ma, LihongX <lihongx.ma@intel.com>
> Subject: [dts] [PATCH V1] tests/vf_port_start_stop: use Packet to send pkt
> 
> Signed-off-by: lihong <lihongx.ma@intel.com>
> ---
>  tests/TestSuite_vf_port_start_stop.py | 44 +++++++++++------------------------
>  1 file changed, 14 insertions(+), 30 deletions(-)
> 
> diff --git a/tests/TestSuite_vf_port_start_stop.py
> b/tests/TestSuite_vf_port_start_stop.py
> index dcd799b..945c671 100644
> --- a/tests/TestSuite_vf_port_start_stop.py
> +++ b/tests/TestSuite_vf_port_start_stop.py
> @@ -6,11 +6,7 @@ import time
>  from virt_common import VM
>  from test_case import TestCase
>  from pmd_output import PmdOutput
> -from utils import RED, GREEN
> -from net_device import NetDevice
> -from crb import Crb
> -from scapy.all import *
> -from scapy.layers.sctp import SCTP, SCTPChunkData
> +from packet import Packet
>  VM_CORES_MASK = 'all'
> 
>  class TestVfPortStartStop(TestCase):
> @@ -22,10 +18,8 @@ class TestVfPortStartStop(TestCase):
>          self.dut_ports = self.dut.get_ports(self.nic)
>          self.verify(len(self.dut_ports) >= 1, "Insufficient ports")
>          self.vm0 = None
> -        self.filename = "/tmp/vf.pcap"
>          self.tester_tx_port = self.tester.get_local_port(self.dut_ports[0])
>          self.tester_tintf = self.tester.get_interface(self.tester_tx_port)
> -        self.send_pks_session = None
>          # set vf assign method and vf driver
>          self.vf_driver = self.get_suite_cfg()['vf_driver']
>          if self.vf_driver is None:
> @@ -40,6 +34,8 @@ class TestVfPortStartStop(TestCase):
>      def set_up(self):
> 
>          self.setup_1pf_2vf_1vm_env_flag = 0
> +        self.send_pks_session = None
> +        self.pkts = Packet()
> 
>      def send_and_verify(self, dst_mac, testpmd):
>          """
> @@ -50,33 +46,23 @@ class TestVfPortStartStop(TestCase):
>          src_mac = self.tester.get_mac(self.tester_tx_port)
>          if src_mac == 'N/A':
>              src_mac = "02:00:00:00:01"
> -        self.send_pkts(self.filename, dst_mac, src_mac)
> +        self.send_pkts(dst_mac, src_mac)
>          time.sleep(1)
>          self.check_port_start_stop(testpmd)
> -        self.tester.send_expect('killall -s INT scapy', '# ')
> -        self.tester.destroy_session(self.send_pks_session)
> -        self.send_pks_session = None
> 
> -    def send_pkts(self, filename, dst_mac, src_mac):
> +    def send_pkts(self, dst_mac, src_mac):
>          """
>          Generates a valid PCAP file with the given configuration.
>          """
> -        def_pkts = {'IP/UDP': Ether(dst="%s" % dst_mac, src="%s" %
> src_mac)/IP(src="127.0.0.2")/UDP()/("X"*46),
> -                    'IP/TCP': Ether(dst="%s" % dst_mac, src="%s" %
> src_mac)/IP(src="127.0.0.2")/TCP()/("X"*46),
> -                    'IP/SCTP': Ether(dst="%s" % dst_mac, src="%s" %
> src_mac)/IP(src="127.0.0.2")/SCTP()/("X"*48),
> -                    'IPv6/UDP': Ether(dst="%s" % dst_mac, src="%s" %
> src_mac)/IPv6(src="::2")/UDP()/("X"*46),
> -                    'IPv6/TCP': Ether(dst="%s" % dst_mac, src="%s" %
> src_mac)/IPv6(src="::2")/TCP()/("X"*46),}
> +        def_pkts = {'IP/UDP': 'Ether(dst="%s",
> src="%s")/IP(src="127.0.0.2")/UDP()/("X"*46)' % (dst_mac, src_mac),
> +                    'IP/TCP': 'Ether(dst="%s",
> src="%s")/IP(src="127.0.0.2")/TCP()/("X"*46)' % (dst_mac, src_mac),
> +                    'IP/SCTP': 'Ether(dst="%s",
> src="%s")/IP(src="127.0.0.2")/SCTP()/("X"*48)' % (dst_mac, src_mac),
> +                    'IPv6/UDP': 'Ether(dst="%s",
> src="%s")/IPv6(src="::2")/UDP()/("X"*46)' % (dst_mac, src_mac),
> +                    'IPv6/TCP': 'Ether(dst="%s",
> src="%s")/IPv6(src="::2")/TCP()/("X"*46)' % (dst_mac, src_mac),}
> 
> -        pkts = []
>          for key in def_pkts.keys():
> -            pkts.append(def_pkts[key])
> -        wrpcap(filename, pkts)
> -
> -        sendp_fmt = "sendp(pk, iface='%s', loop=1)" % (self.tester_tintf)
> -        self.send_pks_session = self.tester.create_session("scapy1")
> -        self.send_pks_session.send_expect("scapy", ">>>")
> -        self.send_pks_session.send_expect("pk=rdpcap('%s')" % filename,
> ">>>")
> -        self.send_pks_session.send_command(sendp_fmt)
> +            self.pkts.append_pkt(def_pkts[key])
> +        self.send_pks_session = self.pkts.send_pkt_bg(self.tester,
> self.tester_tintf)
> 
>      def testpmd_reset_status(self, testpmd):
>          """
> @@ -195,15 +181,13 @@ class TestVfPortStartStop(TestCase):
> 
>      def tear_down(self):
> 
> +        if self.send_pks_session:
> +            self.pkts.stop_send_pkt_bg(self.tester, self.send_pks_session)
>          if self.setup_1pf_2vf_1vm_env_flag == 1:
>              self.destroy_1pf_2vf_1vm_env()
> 
>      def tear_down_all(self):
> 
> -        if self.send_pks_session:
> -            self.tester.send_expect('killall -s INT scapy', '# ')
> -            self.tester.destroy_session(self.send_pks_session)
> -
>          if getattr(self, 'vm0', None):
>              self.vm0.stop()
> 
> --
> 2.7.4


      parent reply	other threads:[~2019-10-22  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  1:24 lihong
2019-10-15  8:59 ` Zhang, YanX A
2019-10-22  9:06 ` 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=8CE3E05A3F976642AAB0F4675D0AD20E0BB44EE2@SHSMSX101.ccr.corp.intel.com \
    --to=lijuan.tu@intel.com \
    --cc=dts@dpdk.org \
    --cc=lihongx.ma@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).