test suite reviews and discussions
 help / color / mirror / Atom feed
From: "Jiajia, SunX" <sunx.jiajia@intel.com>
To: "Xu, HuilongX" <huilongx.xu@intel.com>, "dts@dpdk.org" <dts@dpdk.org>
Subject: Re: [dts] [‘dts-v1’ 7/9] add some pmd functions for tester to code the testpmd cases
Date: Mon, 18 May 2015 09:20:57 +0000	[thread overview]
Message-ID: <F21F274FCF2C0948830A3ED00345297734853E@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <DF2A19295B96364286FEB7F3DDA27A460110F128@SHSMSX101.ccr.corp.intel.com>



> -----Original Message-----
> From: Xu, HuilongX
> Sent: Monday, May 18, 2015 4:29 PM
> To: Jiajia, SunX; dts@dpdk.org
> Subject: RE: [dts] [‘dts-v1’ 7/9] add some pmd functions for tester to
> code the testpmd cases
> 
> Hi Jiajia,
> I have a comments at " def execute_cmd(self, pmd_cmd, expected='testpmd>
> ', timeout=TIMEOUT "
> Would you check it, thanks  a lot
> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of sjiajiax
> Sent: Monday, May 18, 2015 1:07 PM
> To: dts@dpdk.org
> Subject: [dts] [‘dts-v1’ 7/9] add some pmd functions for tester to code
> the testpmd cases
> 
> Signed-off-by: sjiajiax <sunx.jiajia@intel.com>
> ---
>  framework/pmd_output.py | 104
> +++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 102 insertions(+), 2 deletions(-)
> 
> diff --git a/framework/pmd_output.py b/framework/pmd_output.py
> index 97274a5..642062f 100644
> --- a/framework/pmd_output.py
> +++ b/framework/pmd_output.py
> @@ -32,6 +32,7 @@
>  import os
>  import re
>  import dts
> +from settings import TIMEOUT
> 
> 
>  class PmdOutput():
> @@ -42,6 +43,7 @@ class PmdOutput():
> 
>      def __init__(self, dut):
>          self.dut = dut
> +        self.dut.testpmd = self
>          self.rx_pkts_prefix = "RX-packets:"
>          self.rx_missed_prefix = "RX-missed:"
>          self.rx_bytes_prefix = "RX-bytes:"
> @@ -87,10 +89,108 @@ class PmdOutput():
>          return self.command
> 
>      def start_testpmd(self, cores, param='', eal_param='', socket=0):
> +        if "--txqflags" not in param:
> +            param += "  --txqflags=0"
> +        if socket == 0:
> +            corelist = '0-3'
> +        elif socket == 1:
> +            corelist = '10-13'
> +        else:
> +            corelist = '0-3'
>          core_list = self.dut.get_core_list(cores, socket)
>          self.coremask = dts.create_mask(core_list)
> -        command = "./%s/app/testpmd -c %s -n %d %s -- -i %s" \
> -            % (self.dut.target, self.coremask,
> self.dut.get_memory_channels(), eal_param, param)
> +        command = "taskset -c %s ./%s/app/testpmd -c %s -n %d %s -- -
> i %s" \
> +            % (corelist, self.dut.target, self.coremask,
> self.dut.get_memory_channels(), eal_param, param)
>          out = self.dut.send_expect(command, "testpmd> ", 120)
>          self.command = command
>          return out
> 
>      maybe we need delete parameter "verify=False" in function
> execute_cmd,
>      when we used execute_cmd for exec testpmd cmdline, the parameter
> only False.

Yes, I agree it.

> +
> +    def execute_cmd(self, pmd_cmd, expected='testpmd> ',
> timeout=TIMEOUT,
> +                    alt_session=False, verify=False):
> +        return self.dut.send_expect('%s' % pmd_cmd, expected,
> timeout=timeout,
> +                                    alt_session=alt_session,
> verify=verify)
> +
> +    def get_value_from_string(self, key_str, regx_str, string):
> +        """
> +        Get some values from the given string by the regular
> expression.
> +        """
> +        pattern = r"(?<=%s)%s" % (key_str, regx_str)
> +        s = re.compile(pattern)
> +        res = s.search(string)
> +        if type(res).__name__ == 'NoneType':
> +            return ' '
> +        else:
> +            return res.group(0)
> +
> +    def get_detail_from_port_info(self, key_str, regx_str, port):
> +        """
> +        Get the detail info from the output of pmd cmd 'show port info
> <port num>'.
> +        """
> +        out = self.dut.send_expect("show port info %d" % port,
> "testpmd> ")
> +        find_value = self.get_value_from_string(key_str, regx_str, out)
> +        return find_value
> +
> +    def get_port_mac(self, port_id):
> +        """
> +        Get the specified port MAC.
> +        """
> +        return self.get_detail_from_port_info("MAC address: ", "([0-
> 9A-F]{2}:){5}[0-9A-F]{2}", port_id)
> +
> +    def get_port_connect_socket(self, port_id):
> +        """
> +        Get the socket id which the specified port is connectting with.
> +        """
> +        return self.get_detail_from_port_info("Connect to socket: ",
> "\d+", port_id)
> +
> +    def get_port_memory_socket(self, port_id):
> +        """
> +        Get the socket id which the specified port memory is allocated
> on.
> +        """
> +        return self.get_detail_from_port_info("memory allocation on
> the socket: ", "\d+", port_id)
> +
> +    def get_port_link_status(self, port_id):
> +        """
> +        Get the specified port link status now.
> +        """
> +        return self.get_detail_from_port_info("Link status: ", "\d+",
> port_id)
> +
> +    def get_port_link_speed(self, port_id):
> +        """
> +        Get the specified port link speed now.
> +        """
> +        return self.get_detail_from_port_info("Link speed: ", "\d+",
> port_id)
> +
> +    def get_port_link_duplex(self, port_id):
> +        """
> +        Get the specified port link mode, duplex or siplex.
> +        """
> +        return self.get_detail_from_port_info("Link duplex: ", "\S+",
> port_id)
> +
> +    def get_port_promiscuous_mode(self, port_id):
> +        """
> +        Get the promiscuous mode of port.
> +        """
> +        return self.get_detail_from_port_info("Promiscuous mode: ",
> "\S+", port_id)
> +
> +    def get_port_allmulticast_mode(self, port_id):
> +        """
> +        Get the allmulticast mode of port.
> +        """
> +        return self.get_detail_from_port_info("Allmulticast mode: ",
> "\S+", port_id)
> +
> +    def get_port_vlan_offload(self, port_id):
> +        """
> +        Function: get the port vlan settting info.
> +        return value:
> +            'strip':'on'
> +            'filter':'on'
> +            'qinq':'off'
> +        """
> +        vlan_info = {}
> +        vlan_info['strip'] = self.get_detail_from_port_info(
> +            "strip ", '\S+', port_id)
> +        vlan_info['filter'] = self.get_detail_from_port_info(
> +            'filter', '\S+', port_id)
> +        vlan_info['qinq'] = self.get_detail_from_port_info(
> +            'qinq\(extend\) ', '\S+', port_id)
> +        return vlan_info
> --
> 1.9.0


  parent reply	other threads:[~2015-05-18  9:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-18  5:07 [dts] [‘dts-v1’ 0/9] sjiajiax
2015-05-18  5:07 ` [dts] [‘dts-v1’ 1/9] Abstract the NIC device as the single class NetDevice sjiajiax
2015-05-18  7:46   ` Xu, HuilongX
2015-05-18  8:58     ` Jiajia, SunX
2015-05-18  5:07 ` [dts] [‘dts-v1’ 2/9] Optimize ssh connection sjiajiax
2015-05-18  7:06   ` Liu, Yong
2015-05-18  7:43     ` Jiajia, SunX
2015-05-19  0:38       ` Liu, Yong
2015-05-19  7:05         ` Jiajia, SunX
2015-05-18  5:07 ` [dts] [‘dts-v1’ 3/9] Add some params and functions related to the virtual test sjiajiax
2015-05-18  7:26   ` Liu, Yong
2015-05-18  8:08     ` Jiajia, SunX
2015-05-18  7:59   ` Xu, HuilongX
2015-05-18  9:08     ` Jiajia, SunX
2015-05-18  5:07 ` [dts] [‘dts-v1’ 4/9] Add VM class and the virtual DUT class and the virtual resource module sjiajiax
2015-05-18  8:23   ` Xu, HuilongX
2015-05-18 13:57   ` Liu, Yong
2015-05-19  5:46     ` Jiajia, SunX
2015-05-18  5:07 ` [dts] [‘dts-v1’ 5/9] Add qemu-agent-guest for QEMU VM sjiajiax
2015-05-18 14:00   ` Liu, Yong
2015-05-18  5:07 ` [dts] [‘dts-v1’ 6/9] Add a global virtual configure sjiajiax
2015-05-18  6:32   ` Liu, Yong
2015-05-18  6:48     ` Jiajia, SunX
2015-05-18  5:07 ` [dts] [‘dts-v1’ 7/9] add some pmd functions for tester to code the testpmd cases sjiajiax
2015-05-18  8:28   ` Xu, HuilongX
2015-05-18  8:45     ` Liu, Yong
2015-05-18  9:05       ` Jiajia, SunX
2015-05-18  9:20     ` Jiajia, SunX [this message]
2015-05-18  5:07 ` [dts] [‘dts-v1’ 8/9] Add two tar files for ACL testing sjiajiax
2015-05-18 14:02   ` Liu, Yong
2015-05-19  5:49     ` Jiajia, SunX
2015-05-18  5:07 ` [dts] [‘dts-v1’ 9/9] Add a suite to test SRIOV mirror with KVM sjiajiax
2015-05-18  6:29 ` [dts] [‘dts-v1’ 0/9] Liu, Yong
2015-05-18  6:47   ` Jiajia, SunX

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=F21F274FCF2C0948830A3ED00345297734853E@SHSMSX104.ccr.corp.intel.com \
    --to=sunx.jiajia@intel.com \
    --cc=dts@dpdk.org \
    --cc=huilongx.xu@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).