test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter
@ 2019-09-27 17:34 Jianwei Mei
  2019-09-27 17:34 ` [dts] [PATCH V1 2/6] framework/config.py: deal with " Jianwei Mei
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Jianwei Mei @ 2019-09-27 17:34 UTC (permalink / raw)
  To: dts; +Cc: zhaoyan.chen, lihongx.ma, meijx

From: meijx <jianweix.mei@intel.com>

add new parameter to configure dut cores for testsuite.

Signed-off-by: meijx <jianweix.mei@intel.com>
---
 conf/crbs.cfg | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/conf/crbs.cfg b/conf/crbs.cfg
index 5c28ab2..5209555 100644
--- a/conf/crbs.cfg
+++ b/conf/crbs.cfg
@@ -10,6 +10,7 @@
 #  pktgen_group: packet generator group name
 #  channels: Board channel number
 #  bypass_core0: Whether by pass core0
+#  dut_cores: DUT core list, eg: 1,2,3,4,5,18-22
 [DUT IP1]
 dut_ip=xxx.xxx.xxx.xxx
 dut_user=root
@@ -22,6 +23,7 @@ ixia_group=
 pktgen_group=
 channels=4
 bypass_core0=True
+dut_cores=
 [DUT IP2]
 dut_ip=yyy.yyy.yyy.yyy
 dut_user=root
@@ -34,3 +36,4 @@ ixia_group=
 pktgen_group=
 channels=4
 bypass_core0=True
+dut_cores=
\ No newline at end of file
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dts] [PATCH V1 2/6] framework/config.py: deal with dut_cores parameter
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
@ 2019-09-27 17:34 ` Jianwei Mei
  2019-10-08  2:22   ` Chen, Zhaoyan
  2019-09-27 17:34 ` [dts] [PATCH V1 3/6] framework/crb.py: only scan configured ports from ports.cfg and overwrite kill all Jianwei Mei
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Jianwei Mei @ 2019-09-27 17:34 UTC (permalink / raw)
  To: dts; +Cc: zhaoyan.chen, lihongx.ma, meijx

From: meijx <jianweix.mei@intel.com>

deal with new parameter in config.py

Signed-off-by: meijx <jianweix.mei@intel.com>
---
 framework/config.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/framework/config.py b/framework/config.py
index abb1469..7a8ca48 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -266,7 +266,7 @@ class CrbsConf(UserConf):
                'pass': '', 'tester IP': '', 'tester pass': '',
                IXIA: None, 'memory channels': 4,
                PKTGEN: None,
-               'bypass core0': True}
+               'bypass core0': True, 'dut_cores': ''}
 
     def __init__(self, crbs_conf=CRBCONF):
         self.config_file = crbs_conf
@@ -322,6 +322,8 @@ class CrbsConf(UserConf):
                     crb['board'] = value
                 elif key == 'dut_arch':
                     crb['dut arch'] = value
+                elif key == 'dut_cores':
+                    crb['dut_cores'] = value
 
             self.crbs_cfg.append(crb)
         return self.crbs_cfg
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dts] [PATCH V1 3/6] framework/crb.py: only scan configured ports from ports.cfg and overwrite kill all
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
  2019-09-27 17:34 ` [dts] [PATCH V1 2/6] framework/config.py: deal with " Jianwei Mei
@ 2019-09-27 17:34 ` Jianwei Mei
  2019-10-08  2:22   ` Chen, Zhaoyan
  2019-09-27 17:34 ` [dts] [PATCH V1 4/6] framework/dut.py: add function create_eal_parameters Jianwei Mei
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Jianwei Mei @ 2019-09-27 17:34 UTC (permalink / raw)
  To: dts; +Cc: zhaoyan.chen, lihongx.ma, meijx

From: meijx <jianweix.mei@intel.com>

only scan configured ports when dts start pretreatment ENV and overwrite kill all.

Signed-off-by: meijx <jianweix.mei@intel.com>
---
 framework/crb.py | 106 ++++++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 85 insertions(+), 21 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index 6e5f56f..91f2946 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -35,6 +35,7 @@ import os
 from settings import TIMEOUT, IXIA
 from ssh_connection import SSHConnection
 from logger import getLogger
+from config import PortConf, PORTCONF
 
 """
 CRB (customer reference board) basic functions and handlers
@@ -278,6 +279,37 @@ class Crb(object):
         pattern = re.compile(rexp)
         match = pattern.findall(out)
         self.pci_devices_info = []
+
+        obj_str = str(self)
+        if 'VirtDut' in obj_str:
+            # there is no port.cfg in VM, so need to scan all pci in VM.
+            pass
+        else:
+            # only scan configured pcis
+            portconf = PortConf(PORTCONF)
+            portconf.load_ports_config(self.crb['IP'])
+            configed_pcis = portconf.get_ports_config()
+            if configed_pcis:
+                if 'tester' in str(self):
+                    tester_pci_in_cfg = []
+                    for item in configed_pcis.values():
+                        for pci_info in match:
+                            if item['peer'] == pci_info[0]:
+                                tester_pci_in_cfg.append(pci_info)
+                    match = tester_pci_in_cfg[:]
+                else:
+                    dut_pci_in_cfg = []
+                    for key in configed_pcis.keys():
+                        for pci_info in match:
+                            if key == pci_info[0]:
+                                dut_pci_in_cfg.append(pci_info)
+                    match = dut_pci_in_cfg[:]
+                # keep the original pci sequence
+                match = sorted(match)
+            else:
+                # INVALID CONFIG FOR NO PCI ADDRESS!!! eg: port.cfg for freeBSD
+                pass
+
         for i in range(len(match)):
             #check if device is cavium and check its linkspeed, append only if it is 10G
             if "177d:" in match[i][1]:
@@ -434,31 +466,63 @@ class Crb(object):
             f.write(contents)
         self.session.copy_file_to(fileName, password=self.get_password())
 
-    def kill_all(self, alt_session=True):
+    def get_dpdk_pids(self, prefix_list, alt_session):
         """
-        Kill all dpdk applications on CRB.
+        get all dpdk applications on CRB.
         """
+        file_directorys = ['/var/run/dpdk/%s/config' % file_prefix for file_prefix in prefix_list]
         pids = []
         pid_reg = r'p(\d+)'
-        cmd = 'lsof -Fp /var/run/dpdk/rte/config'
-        out = self.send_expect(cmd, "# ", 20, alt_session)
-        if len(out):
-            lines = out.split('\r\n')
-            for line in lines:
-                m = re.match(pid_reg, line)
-                if m:
-                    pids.append(m.group(1))
-        for pid in pids:
-            self.send_expect('kill -9 %s' % pid, '# ', 20, alt_session)
-            self.get_session_output(timeout=2)
-
-        cmd = 'lsof -Fp /var/run/dpdk/rte/hugepage_info'
-        out = self.send_expect(cmd, "# ", 20, alt_session)
-        if len(out) and "No such file or directory" not in out:
-            self.logger.warning("There are some dpdk process not free hugepage")
-            self.logger.warning("**************************************")
-            self.logger.warning(out)
-            self.logger.warning("**************************************")
+        for config_file in file_directorys:
+            cmd = 'lsof -Fp %s' % config_file
+            out = self.send_expect(cmd, "# ", 20, alt_session)
+            if len(out):
+                lines = out.split('\r\n')
+                for line in lines:
+                    m = re.match(pid_reg, line)
+                    if m:
+                        pids.append(m.group(1))
+            for pid in pids:
+                self.send_expect('kill -9 %s' % pid, '# ', 20, alt_session)
+                self.get_session_output(timeout=2)
+
+        hugepage_info = ['/var/run/dpdk/%s/hugepage_info' % file_prefix for file_prefix in prefix_list]
+        for hugepage in hugepage_info:
+            cmd = 'lsof -Fp %s' % hugepage
+            out = self.send_expect(cmd, "# ", 20, alt_session)
+            if len(out) and "No such file or directory" not in out:
+                self.logger.warning("There are some dpdk process not free hugepage")
+                self.logger.warning("**************************************")
+                self.logger.warning(out)
+                self.logger.warning("**************************************")
+
+        # remove directory
+        directorys = ['/var/run/dpdk/%s' % file_prefix for file_prefix in prefix_list]
+        for directory in directorys:
+            cmd = 'rm -rf %s' % directory
+            self.send_expect(cmd, "# ", 20, alt_session)
+
+    def kill_all(self, alt_session=True):
+        """
+        Kill all dpdk applications on CRB.
+        """
+        if 'tester' in str(self):
+            self.logger.info('kill_all: called by tester')
+            pass
+        else:
+            if self.prefix_list:
+                self.logger.info('kill_all: called by dut and prefix list has value.')
+                self.get_dpdk_pids(self.prefix_list, alt_session)
+                # init prefix_list
+                self.prefix_list = []
+            else:
+                self.logger.info('kill_all: called by dut and has no prefix list.')
+                session = self.create_session('dut_session')
+                out = session.send_command("ls -l /var/run/dpdk |awk '/^d/ {print $NF}'", timeout=0.5)
+                # the last directory is expect string, eg: [PEXPECT]#
+                if out != '':
+                    dir_list = out.split('\r\n')
+                    self.get_dpdk_pids(dir_list[:-1], alt_session)
 
     def close(self):
         """
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dts] [PATCH V1 4/6] framework/dut.py: add function create_eal_parameters
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
  2019-09-27 17:34 ` [dts] [PATCH V1 2/6] framework/config.py: deal with " Jianwei Mei
  2019-09-27 17:34 ` [dts] [PATCH V1 3/6] framework/crb.py: only scan configured ports from ports.cfg and overwrite kill all Jianwei Mei
@ 2019-09-27 17:34 ` Jianwei Mei
  2019-10-08  2:22   ` Chen, Zhaoyan
  2019-09-27 17:34 ` [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd Jianwei Mei
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Jianwei Mei @ 2019-09-27 17:34 UTC (permalink / raw)
  To: dts; +Cc: zhaoyan.chen, lihongx.ma, meijx

From: meijx <jianweix.mei@intel.com>

add new method to create EAL parameters and overwrite self.cores according to configured dut_cores.

Signed-off-by: meijx <jianweix.mei@intel.com>
---
 framework/dut.py | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 155 insertions(+)

diff --git a/framework/dut.py b/framework/dut.py
index a394b34..b30506f 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -75,6 +75,160 @@ class Dut(Crb):
         self.virt_pool = None
         # hypervisor pid list, used for cleanup
         self.virt_pids = []
+        self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime())
+        self.prefix_list = []
+
+    def filter_cores_from_crb_cfg(self):
+        # get core list from crbs.cfg
+        core_list = []
+        all_core_list = [str(core['core']) for core in self.cores]
+        core_list_str = self.crb['dut_cores']
+        if core_list_str == '':
+            core_list = all_core_list
+        split_by_comma = core_list_str.split(',')
+        range_cores = []
+        for item in split_by_comma:
+            if '-' in item:
+                tmp = item.split('-')
+                range_cores.extend([str(i) for i in range(int(tmp[0]), int(tmp[1]) + 1)])
+            else:
+                core_list.append(item)
+        core_list.extend(range_cores)
+
+        abnormal_core_list = []
+        for core in core_list:
+            if core not in all_core_list:
+                abnormal_core_list.append(core)
+
+        if abnormal_core_list:
+            self.logger.info('those %s cores are out of range system, all core list of system are %s' % (abnormal_core_list, all_core_list))
+            raise Exception('configured cores out of range system')
+
+        core_list = [core for core in self.cores if str(core['core']) in core_list]
+        self.cores = core_list
+        self.number_of_cores = len(self.cores)
+
+    def create_eal_parameters(self, fixed_prefix=False, socket=-1, **config):
+        """
+        generate eal parameters character string
+        :param config:
+        :return: eal_str eg:'-c 0xf -w 0000:88:00.0 -w 0000:88:00.1 --file-prefix=dpdk_1112_20190809143420'
+        """
+        default_cores = '1S/2C/1T'
+        blank = ' '
+        os_type = self.get_os_type()
+        if config:
+            # deal with cores
+            if config.has_key('cores'):
+                if config['cores'] == '' or config['cores'] == 'Default':
+                    core_list = self.get_core_list(default_cores)
+                elif type(config['cores']) == list:
+                    core_list = config['cores']
+                else:
+                    core_list = self.get_core_list(config['cores'], socket=socket)
+            else:
+                core_list = self.get_core_list(default_cores)
+
+            # deal with ports
+            w_pci_list = []
+            if config.has_key('ports') and len(config['ports']) != 0:
+                for port in config['ports']:
+                    if type(port) == int:
+                        if config.has_key('port_options') and port in config['port_options'].keys():
+                            port_option = config['port_options'][port]
+                            w_pci_list.append('-w %s,%s' % (self.ports_info[port]['pci'], port_option))
+                        else:
+                            w_pci_list.append('-w %s' % self.ports_info[port]['pci'])
+                    else:
+                        if config.has_key('port_options') and port in config['port_options'].keys():
+                            port_option = config['port_options'][port]
+                            w_pci_list.append('-w %s,%s' % (self.ports_info[config['ports'].index(port)]['pci'], port_option))
+                        else:
+                            w_pci_list = ['-w %s' % pci for pci in config['ports']]
+            w_pci_str = ' '.join(w_pci_list)
+
+            # deal with black ports
+            b_pci_list = []
+            if config.has_key('b_ports') and len(config['b_ports']) != 0:
+                for port in config['b_ports']:
+                    if type(port) == int:
+                        b_pci_list.append('-b %s' % self.ports_info[port]['pci'])
+                    else:
+                        b_pci_list = ['-b %s' % pci for pci in config['b_ports']]
+            b_ports_str = ' '.join(b_pci_list)
+
+            # deal with no-pci
+            if config.has_key('no_pci'):
+                if config['no_pci'] == True:
+                    no_pci = '--no-pci'
+                else:
+                    no_pci = ''
+            else:
+                no_pci = ''
+
+            # deal with file prefix
+            if config.has_key('prefix') and config['prefix'] != '':
+                if fixed_prefix == True:
+                    file_prefix = config['prefix']
+                else:
+                    file_prefix = config['prefix'] + '_' + self.prefix_subfix
+            else:
+                file_prefix = 'dpdk' + '_' + self.prefix_subfix
+            self.prefix_list.append(file_prefix)
+
+            # deal with vdev
+            if config.has_key('vdevs') and len(config['vdevs']) != 0:
+                vdev = '--vdev ' + ' --vdev '.join(config['vdevs'])
+            else:
+                vdev = ''
+
+            if os_type == 'freebsd':
+                eal_str = '-l ' + ','.join(map(str, core_list)) \
+                          + blank + '-n %d' % self.get_memory_channels() \
+                          + blank + w_pci_str \
+                          + blank + b_ports_str \
+                          + blank + no_pci \
+                          + blank + vdev
+            else:
+                eal_str = '-l ' + ','.join(map(str, core_list)) \
+                          + blank + '-n %d' % self.get_memory_channels() \
+                          + blank + w_pci_str \
+                          + blank + b_ports_str \
+                          + blank + '--file-prefix=' + file_prefix \
+                          + blank + no_pci \
+                          + blank + vdev
+        else:
+            # get pci from ports_info
+            pci_list = []
+            if len(self.ports_info) != 0:
+                for port_info in self.ports_info:
+                    pci_list.append('-w %s' % port_info['pci'])
+            self.logger.info(pci_list)
+            pci_str = ' '.join(pci_list)
+            # default cores '1S/2C/1T'
+            core_list = self.get_core_list(default_cores)
+            file_prefix = 'dpdk' + '_' + self.prefix_subfix
+            self.prefix_list.append(file_prefix)
+            if os_type == 'freebsd':
+                eal_str = '-l ' + ','.join(map(str, core_list)) \
+                          + blank + '-n %d' % self.get_memory_channels() \
+                          + blank + pci_str
+            else:
+                eal_str = '-l ' + ','.join(map(str, core_list)) \
+                          + blank + '-n %d' % self.get_memory_channels() \
+                          + blank + pci_str \
+                          + blank + '--file-prefix=' + file_prefix
+
+        return eal_str
+
+    def get_eal_of_prefix(self, prefix=None):
+
+        if prefix:
+            file_prefix = [prefix_name for prefix_name in self.prefix_list if prefix in prefix_name]
+        else:
+            file_prefix = 'dpdk' + '_' + self.prefix_subfix
+
+        return file_prefix
 
     def init_host_session(self, vm_name):
         """
@@ -199,6 +353,7 @@ class Dut(Crb):
             self.send_expect('alias sed=gsed', '# ')
 
         self.init_core_list()
+        self.filter_cores_from_crb_cfg()
         self.pci_devices_information()
         # make sure ipv6 enable before scan
         self.enable_tester_ipv6()
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
                   ` (2 preceding siblings ...)
  2019-09-27 17:34 ` [dts] [PATCH V1 4/6] framework/dut.py: add function create_eal_parameters Jianwei Mei
@ 2019-09-27 17:34 ` Jianwei Mei
  2019-10-08  2:22   ` Chen, Zhaoyan
  2019-09-27 17:34 ` [dts] [PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut Jianwei Mei
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 13+ messages in thread
From: Jianwei Mei @ 2019-09-27 17:34 UTC (permalink / raw)
  To: dts; +Cc: zhaoyan.chen, lihongx.ma, meijx

From: meijx <jianweix.mei@intel.com>

overwrite start_testpmd according to create EAL parameters.

Signed-off-by: meijx <jianweix.mei@intel.com>
---
 framework/pmd_output.py | 79 +++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 70 insertions(+), 9 deletions(-)

diff --git a/framework/pmd_output.py b/framework/pmd_output.py
index 4cb8fed..bcb3865 100644
--- a/framework/pmd_output.py
+++ b/framework/pmd_output.py
@@ -103,17 +103,78 @@ class PmdOutput():
     def get_pmd_cmd(self):
         return self.command
 
-    def start_testpmd(self, cores, param='', eal_param='', socket=0):
+    def split_eal_param(self, eal_param):
+        """
+        split eal param from test suite
+        :param eal_param:
+        :return:
+        """
+        re_w_pci_str = '-w\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s'
+        re_file_prefix_str = '--file-prefix=.+?\s'
+        re_b_pci_str = '-b\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s'
+        eal_param = eal_param + ' '
+        # pci_str_list eg: ['-w   0000:1a:00.0 ', '-w 0000:1a:00.1,queue-num-per-vf=4 ', '-w 0000:aa:bb.1,queue-num-per-vf=4 ']
+        w_pci_str_list = re.findall(re_w_pci_str, eal_param)
+        # file_prefix_str eg: ['--file-prefix=dpdk ']
+        file_prefix_str = re.findall(re_file_prefix_str, eal_param)
+        b_pci_str_list = re.findall(re_b_pci_str, eal_param)
+        has_pci_option = {}
+        pci_list = []
+        if w_pci_str_list:
+            for pci_str in w_pci_str_list:
+                # has pci options
+                if ',' in pci_str:
+                    pci_option = pci_str.split(',')
+                    pci = pci_option[0].split(' ')[-1]
+                    has_pci_option[pci] = pci_option[1].strip()
+                    pci_list.append(pci)
+                else:
+                    pci_list.append(pci_str.split('-w')[-1].strip())
+
+        b_pci_list = []
+        if b_pci_str_list:
+            for b_pci in b_pci_str_list:
+                tmp = b_pci.split('-b')[1].strip()
+                b_pci_list.append(tmp)
+
+        file_prefix = ''
+        if file_prefix_str:
+            tmp = file_prefix_str[0].split('=')
+            file_prefix = tmp[1].strip()
 
-        if type(cores) == list:
-            core_list = cores
-        elif cores == "Default":
-            core_list = self.dut.get_core_list(self.default_cores)
+        other_eal_str = re.sub(re_w_pci_str, '', eal_param)
+        other_eal_str = re.sub(re_b_pci_str, '', other_eal_str)
+        other_eal_str = re.sub(re_file_prefix_str, '', other_eal_str)
+
+        no_pci = False
+        if '--no-pci' in other_eal_str:
+            no_pci = True
+            other_eal_str = other_eal_str.replace('--no-pci','')
+
+        return pci_list, has_pci_option, b_pci_list, file_prefix, no_pci, other_eal_str
+
+    def start_testpmd(self, cores='default', param='', eal_param='', socket=0, fixed_prefix=False, **config):
+        config['cores'] = cores
+        if eal_param == '':
+            # use configured ports
+            config['ports'] = [self.dut.ports_info[i]['pci'] for i in range(len(self.dut.ports_info))]
+            all_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix, socket=socket, **config)
         else:
-            core_list = self.dut.get_core_list(cores, socket=socket)
-        self.coremask = 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)
+            w_pci_list, port_options, b_pci_list, file_prefix, no_pci, other_eal_str = self.split_eal_param(eal_param)
+            if no_pci:
+                config['no_pci'] = no_pci
+            elif not w_pci_list and not b_pci_list:
+                config['ports'] = [self.dut.ports_info[i]['pci'] for i in range(len(self.dut.ports_info))]
+                config['prefix'] = file_prefix
+            else:
+                config['ports'] = w_pci_list
+                config['port_options'] = port_options
+                config['b_ports'] = b_pci_list
+                config['prefix'] = file_prefix
+            part_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix, socket=socket, **config)
+            all_eal_param = part_eal_param + ' ' + other_eal_str
+
+        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target, all_eal_param, param)
         out = self.session.send_expect(command, "testpmd> ", 120)
         self.command = command
         # wait 10s to ensure links getting up before test start.
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [dts] [PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
                   ` (3 preceding siblings ...)
  2019-09-27 17:34 ` [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd Jianwei Mei
@ 2019-09-27 17:34 ` Jianwei Mei
  2019-10-08  2:22   ` Chen, Zhaoyan
  2019-10-08  2:22 ` [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Chen, Zhaoyan
  2019-10-12  5:30 ` Tu, Lijuan
  6 siblings, 1 reply; 13+ messages in thread
From: Jianwei Mei @ 2019-09-27 17:34 UTC (permalink / raw)
  To: dts; +Cc: zhaoyan.chen, lihongx.ma, meijx

From: meijx <jianweix.mei@intel.com>

add prefix_list for virt dut

Signed-off-by: meijx <jianweix.mei@intel.com>
---
 framework/virt_dut.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index b6f40d8..599ddca 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -73,6 +73,8 @@ class VirtDut(DPDKdut):
         self.ports_info = None
         self.ports_map = []
         self.virttype = virttype
+        self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S", time.localtime())
+        self.prefix_list = []
 
     def init_log(self):
         if hasattr(self.host_dut, "test_classname"):
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd
  2019-09-27 17:34 ` [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd Jianwei Mei
@ 2019-10-08  2:22   ` Chen, Zhaoyan
  0 siblings, 0 replies; 13+ messages in thread
From: Chen, Zhaoyan @ 2019-10-08  2:22 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Ma, LihongX, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: Mei, JianweiX
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX <lihongx.ma@intel.com>;
> Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts][PATCH V1 5/6] framework/pmd_output.py: overwrite function
> start_testpmd
> 
> From: meijx <jianweix.mei@intel.com>
> 
> overwrite start_testpmd according to create EAL parameters.
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  framework/pmd_output.py | 79
> +++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 70 insertions(+), 9 deletions(-)
> 
> diff --git a/framework/pmd_output.py b/framework/pmd_output.py index
> 4cb8fed..bcb3865 100644
> --- a/framework/pmd_output.py
> +++ b/framework/pmd_output.py
> @@ -103,17 +103,78 @@ class PmdOutput():
>      def get_pmd_cmd(self):
>          return self.command
> 
> -    def start_testpmd(self, cores, param='', eal_param='', socket=0):
> +    def split_eal_param(self, eal_param):
> +        """
> +        split eal param from test suite
> +        :param eal_param:
> +        :return:
> +        """
> +        re_w_pci_str = '-w\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s'
> +        re_file_prefix_str = '--file-prefix=.+?\s'
> +        re_b_pci_str = '-b\\s+.+?:.+?:.+?\\..+?[,.*=\d+]?\s'
> +        eal_param = eal_param + ' '
> +        # pci_str_list eg: ['-w   0000:1a:00.0 ', '-w 0000:1a:00.1,queue-num-per-vf=4 ',
> '-w 0000:aa:bb.1,queue-num-per-vf=4 ']
> +        w_pci_str_list = re.findall(re_w_pci_str, eal_param)
> +        # file_prefix_str eg: ['--file-prefix=dpdk ']
> +        file_prefix_str = re.findall(re_file_prefix_str, eal_param)
> +        b_pci_str_list = re.findall(re_b_pci_str, eal_param)
> +        has_pci_option = {}
> +        pci_list = []
> +        if w_pci_str_list:
> +            for pci_str in w_pci_str_list:
> +                # has pci options
> +                if ',' in pci_str:
> +                    pci_option = pci_str.split(',')
> +                    pci = pci_option[0].split(' ')[-1]
> +                    has_pci_option[pci] = pci_option[1].strip()
> +                    pci_list.append(pci)
> +                else:
> +                    pci_list.append(pci_str.split('-w')[-1].strip())
> +
> +        b_pci_list = []
> +        if b_pci_str_list:
> +            for b_pci in b_pci_str_list:
> +                tmp = b_pci.split('-b')[1].strip()
> +                b_pci_list.append(tmp)
> +
> +        file_prefix = ''
> +        if file_prefix_str:
> +            tmp = file_prefix_str[0].split('=')
> +            file_prefix = tmp[1].strip()
> 
> -        if type(cores) == list:
> -            core_list = cores
> -        elif cores == "Default":
> -            core_list = self.dut.get_core_list(self.default_cores)
> +        other_eal_str = re.sub(re_w_pci_str, '', eal_param)
> +        other_eal_str = re.sub(re_b_pci_str, '', other_eal_str)
> +        other_eal_str = re.sub(re_file_prefix_str, '', other_eal_str)
> +
> +        no_pci = False
> +        if '--no-pci' in other_eal_str:
> +            no_pci = True
> +            other_eal_str = other_eal_str.replace('--no-pci','')
> +
> +        return pci_list, has_pci_option, b_pci_list, file_prefix,
> + no_pci, other_eal_str
> +
> +    def start_testpmd(self, cores='default', param='', eal_param='', socket=0,
> fixed_prefix=False, **config):
> +        config['cores'] = cores
> +        if eal_param == '':
> +            # use configured ports
> +            config['ports'] = [self.dut.ports_info[i]['pci'] for i in
> range(len(self.dut.ports_info))]
> +            all_eal_param =
> + self.dut.create_eal_parameters(fixed_prefix=fixed_prefix,
> + socket=socket, **config)
>          else:
> -            core_list = self.dut.get_core_list(cores, socket=socket)
> -        self.coremask = 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)
> +            w_pci_list, port_options, b_pci_list, file_prefix, no_pci, other_eal_str =
> self.split_eal_param(eal_param)
> +            if no_pci:
> +                config['no_pci'] = no_pci
> +            elif not w_pci_list and not b_pci_list:
> +                config['ports'] = [self.dut.ports_info[i]['pci'] for i in
> range(len(self.dut.ports_info))]
> +                config['prefix'] = file_prefix
> +            else:
> +                config['ports'] = w_pci_list
> +                config['port_options'] = port_options
> +                config['b_ports'] = b_pci_list
> +                config['prefix'] = file_prefix
> +            part_eal_param = self.dut.create_eal_parameters(fixed_prefix=fixed_prefix,
> socket=socket, **config)
> +            all_eal_param = part_eal_param + ' ' + other_eal_str
> +
> +        command = "./%s/app/testpmd %s -- -i %s" % (self.dut.target,
> + all_eal_param, param)
>          out = self.session.send_expect(command, "testpmd> ", 120)
>          self.command = command
>          # wait 10s to ensure links getting up before test start.
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut
  2019-09-27 17:34 ` [dts] [PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut Jianwei Mei
@ 2019-10-08  2:22   ` Chen, Zhaoyan
  0 siblings, 0 replies; 13+ messages in thread
From: Chen, Zhaoyan @ 2019-10-08  2:22 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Ma, LihongX, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: Mei, JianweiX
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX <lihongx.ma@intel.com>;
> Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts][PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut
> 
> From: meijx <jianweix.mei@intel.com>
> 
> add prefix_list for virt dut
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  framework/virt_dut.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/framework/virt_dut.py b/framework/virt_dut.py index
> b6f40d8..599ddca 100644
> --- a/framework/virt_dut.py
> +++ b/framework/virt_dut.py
> @@ -73,6 +73,8 @@ class VirtDut(DPDKdut):
>          self.ports_info = None
>          self.ports_map = []
>          self.virttype = virttype
> +        self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S",
> time.localtime())
> +        self.prefix_list = []
> 
>      def init_log(self):
>          if hasattr(self.host_dut, "test_classname"):
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 4/6] framework/dut.py: add function create_eal_parameters
  2019-09-27 17:34 ` [dts] [PATCH V1 4/6] framework/dut.py: add function create_eal_parameters Jianwei Mei
@ 2019-10-08  2:22   ` Chen, Zhaoyan
  0 siblings, 0 replies; 13+ messages in thread
From: Chen, Zhaoyan @ 2019-10-08  2:22 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Ma, LihongX, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: Mei, JianweiX
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX <lihongx.ma@intel.com>;
> Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts][PATCH V1 4/6] framework/dut.py: add function
> create_eal_parameters
> 
> From: meijx <jianweix.mei@intel.com>
> 
> add new method to create EAL parameters and overwrite self.cores according to
> configured dut_cores.
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  framework/dut.py | 155
> +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 155 insertions(+)
> 
> diff --git a/framework/dut.py b/framework/dut.py index a394b34..b30506f
> 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -75,6 +75,160 @@ class Dut(Crb):
>          self.virt_pool = None
>          # hypervisor pid list, used for cleanup
>          self.virt_pids = []
> +        self.prefix_subfix = str(os.getpid()) + '_' + time.strftime("%Y%m%d%H%M%S",
> time.localtime())
> +        self.prefix_list = []
> +
> +    def filter_cores_from_crb_cfg(self):
> +        # get core list from crbs.cfg
> +        core_list = []
> +        all_core_list = [str(core['core']) for core in self.cores]
> +        core_list_str = self.crb['dut_cores']
> +        if core_list_str == '':
> +            core_list = all_core_list
> +        split_by_comma = core_list_str.split(',')
> +        range_cores = []
> +        for item in split_by_comma:
> +            if '-' in item:
> +                tmp = item.split('-')
> +                range_cores.extend([str(i) for i in range(int(tmp[0]), int(tmp[1]) + 1)])
> +            else:
> +                core_list.append(item)
> +        core_list.extend(range_cores)
> +
> +        abnormal_core_list = []
> +        for core in core_list:
> +            if core not in all_core_list:
> +                abnormal_core_list.append(core)
> +
> +        if abnormal_core_list:
> +            self.logger.info('those %s cores are out of range system, all core list of system
> are %s' % (abnormal_core_list, all_core_list))
> +            raise Exception('configured cores out of range system')
> +
> +        core_list = [core for core in self.cores if str(core['core']) in core_list]
> +        self.cores = core_list
> +        self.number_of_cores = len(self.cores)
> +
> +    def create_eal_parameters(self, fixed_prefix=False, socket=-1, **config):
> +        """
> +        generate eal parameters character string
> +        :param config:
> +        :return: eal_str eg:'-c 0xf -w 0000:88:00.0 -w 0000:88:00.1 --file-
> prefix=dpdk_1112_20190809143420'
> +        """
> +        default_cores = '1S/2C/1T'
> +        blank = ' '
> +        os_type = self.get_os_type()
> +        if config:
> +            # deal with cores
> +            if config.has_key('cores'):
> +                if config['cores'] == '' or config['cores'] == 'Default':
> +                    core_list = self.get_core_list(default_cores)
> +                elif type(config['cores']) == list:
> +                    core_list = config['cores']
> +                else:
> +                    core_list = self.get_core_list(config['cores'], socket=socket)
> +            else:
> +                core_list = self.get_core_list(default_cores)
> +
> +            # deal with ports
> +            w_pci_list = []
> +            if config.has_key('ports') and len(config['ports']) != 0:
> +                for port in config['ports']:
> +                    if type(port) == int:
> +                        if config.has_key('port_options') and port in
> config['port_options'].keys():
> +                            port_option = config['port_options'][port]
> +                            w_pci_list.append('-w %s,%s' % (self.ports_info[port]['pci'],
> port_option))
> +                        else:
> +                            w_pci_list.append('-w %s' % self.ports_info[port]['pci'])
> +                    else:
> +                        if config.has_key('port_options') and port in
> config['port_options'].keys():
> +                            port_option = config['port_options'][port]
> +                            w_pci_list.append('-w %s,%s' %
> (self.ports_info[config['ports'].index(port)]['pci'], port_option))
> +                        else:
> +                            w_pci_list = ['-w %s' % pci for pci in config['ports']]
> +            w_pci_str = ' '.join(w_pci_list)
> +
> +            # deal with black ports
> +            b_pci_list = []
> +            if config.has_key('b_ports') and len(config['b_ports']) != 0:
> +                for port in config['b_ports']:
> +                    if type(port) == int:
> +                        b_pci_list.append('-b %s' % self.ports_info[port]['pci'])
> +                    else:
> +                        b_pci_list = ['-b %s' % pci for pci in config['b_ports']]
> +            b_ports_str = ' '.join(b_pci_list)
> +
> +            # deal with no-pci
> +            if config.has_key('no_pci'):
> +                if config['no_pci'] == True:
> +                    no_pci = '--no-pci'
> +                else:
> +                    no_pci = ''
> +            else:
> +                no_pci = ''
> +
> +            # deal with file prefix
> +            if config.has_key('prefix') and config['prefix'] != '':
> +                if fixed_prefix == True:
> +                    file_prefix = config['prefix']
> +                else:
> +                    file_prefix = config['prefix'] + '_' + self.prefix_subfix
> +            else:
> +                file_prefix = 'dpdk' + '_' + self.prefix_subfix
> +            self.prefix_list.append(file_prefix)
> +
> +            # deal with vdev
> +            if config.has_key('vdevs') and len(config['vdevs']) != 0:
> +                vdev = '--vdev ' + ' --vdev '.join(config['vdevs'])
> +            else:
> +                vdev = ''
> +
> +            if os_type == 'freebsd':
> +                eal_str = '-l ' + ','.join(map(str, core_list)) \
> +                          + blank + '-n %d' % self.get_memory_channels() \
> +                          + blank + w_pci_str \
> +                          + blank + b_ports_str \
> +                          + blank + no_pci \
> +                          + blank + vdev
> +            else:
> +                eal_str = '-l ' + ','.join(map(str, core_list)) \
> +                          + blank + '-n %d' % self.get_memory_channels() \
> +                          + blank + w_pci_str \
> +                          + blank + b_ports_str \
> +                          + blank + '--file-prefix=' + file_prefix \
> +                          + blank + no_pci \
> +                          + blank + vdev
> +        else:
> +            # get pci from ports_info
> +            pci_list = []
> +            if len(self.ports_info) != 0:
> +                for port_info in self.ports_info:
> +                    pci_list.append('-w %s' % port_info['pci'])
> +            self.logger.info(pci_list)
> +            pci_str = ' '.join(pci_list)
> +            # default cores '1S/2C/1T'
> +            core_list = self.get_core_list(default_cores)
> +            file_prefix = 'dpdk' + '_' + self.prefix_subfix
> +            self.prefix_list.append(file_prefix)
> +            if os_type == 'freebsd':
> +                eal_str = '-l ' + ','.join(map(str, core_list)) \
> +                          + blank + '-n %d' % self.get_memory_channels() \
> +                          + blank + pci_str
> +            else:
> +                eal_str = '-l ' + ','.join(map(str, core_list)) \
> +                          + blank + '-n %d' % self.get_memory_channels() \
> +                          + blank + pci_str \
> +                          + blank + '--file-prefix=' + file_prefix
> +
> +        return eal_str
> +
> +    def get_eal_of_prefix(self, prefix=None):
> +
> +        if prefix:
> +            file_prefix = [prefix_name for prefix_name in self.prefix_list if prefix in
> prefix_name]
> +        else:
> +            file_prefix = 'dpdk' + '_' + self.prefix_subfix
> +
> +        return file_prefix
> 
>      def init_host_session(self, vm_name):
>          """
> @@ -199,6 +353,7 @@ class Dut(Crb):
>              self.send_expect('alias sed=gsed', '# ')
> 
>          self.init_core_list()
> +        self.filter_cores_from_crb_cfg()
>          self.pci_devices_information()
>          # make sure ipv6 enable before scan
>          self.enable_tester_ipv6()
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 3/6] framework/crb.py: only scan configured ports from ports.cfg and overwrite kill all
  2019-09-27 17:34 ` [dts] [PATCH V1 3/6] framework/crb.py: only scan configured ports from ports.cfg and overwrite kill all Jianwei Mei
@ 2019-10-08  2:22   ` Chen, Zhaoyan
  0 siblings, 0 replies; 13+ messages in thread
From: Chen, Zhaoyan @ 2019-10-08  2:22 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Ma, LihongX, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: Mei, JianweiX
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX <lihongx.ma@intel.com>;
> Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts][PATCH V1 3/6] framework/crb.py: only scan configured ports from
> ports.cfg and overwrite kill all
> 
> From: meijx <jianweix.mei@intel.com>
> 
> only scan configured ports when dts start pretreatment ENV and overwrite kill all.
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  framework/crb.py | 106 ++++++++++++++++++++++++++++++++++++++++++++-
> ----------
>  1 file changed, 85 insertions(+), 21 deletions(-)
> 
> diff --git a/framework/crb.py b/framework/crb.py index 6e5f56f..91f2946 100644
> --- a/framework/crb.py
> +++ b/framework/crb.py
> @@ -35,6 +35,7 @@ import os
>  from settings import TIMEOUT, IXIA
>  from ssh_connection import SSHConnection  from logger import getLogger
> +from config import PortConf, PORTCONF
> 
>  """
>  CRB (customer reference board) basic functions and handlers @@ -278,6 +279,37
> @@ class Crb(object):
>          pattern = re.compile(rexp)
>          match = pattern.findall(out)
>          self.pci_devices_info = []
> +
> +        obj_str = str(self)
> +        if 'VirtDut' in obj_str:
> +            # there is no port.cfg in VM, so need to scan all pci in VM.
> +            pass
> +        else:
> +            # only scan configured pcis
> +            portconf = PortConf(PORTCONF)
> +            portconf.load_ports_config(self.crb['IP'])
> +            configed_pcis = portconf.get_ports_config()
> +            if configed_pcis:
> +                if 'tester' in str(self):
> +                    tester_pci_in_cfg = []
> +                    for item in configed_pcis.values():
> +                        for pci_info in match:
> +                            if item['peer'] == pci_info[0]:
> +                                tester_pci_in_cfg.append(pci_info)
> +                    match = tester_pci_in_cfg[:]
> +                else:
> +                    dut_pci_in_cfg = []
> +                    for key in configed_pcis.keys():
> +                        for pci_info in match:
> +                            if key == pci_info[0]:
> +                                dut_pci_in_cfg.append(pci_info)
> +                    match = dut_pci_in_cfg[:]
> +                # keep the original pci sequence
> +                match = sorted(match)
> +            else:
> +                # INVALID CONFIG FOR NO PCI ADDRESS!!! eg: port.cfg for freeBSD
> +                pass
> +
>          for i in range(len(match)):
>              #check if device is cavium and check its linkspeed, append only if it is 10G
>              if "177d:" in match[i][1]:
> @@ -434,31 +466,63 @@ class Crb(object):
>              f.write(contents)
>          self.session.copy_file_to(fileName, password=self.get_password())
> 
> -    def kill_all(self, alt_session=True):
> +    def get_dpdk_pids(self, prefix_list, alt_session):
>          """
> -        Kill all dpdk applications on CRB.
> +        get all dpdk applications on CRB.
>          """
> +        file_directorys = ['/var/run/dpdk/%s/config' % file_prefix for
> + file_prefix in prefix_list]
>          pids = []
>          pid_reg = r'p(\d+)'
> -        cmd = 'lsof -Fp /var/run/dpdk/rte/config'
> -        out = self.send_expect(cmd, "# ", 20, alt_session)
> -        if len(out):
> -            lines = out.split('\r\n')
> -            for line in lines:
> -                m = re.match(pid_reg, line)
> -                if m:
> -                    pids.append(m.group(1))
> -        for pid in pids:
> -            self.send_expect('kill -9 %s' % pid, '# ', 20, alt_session)
> -            self.get_session_output(timeout=2)
> -
> -        cmd = 'lsof -Fp /var/run/dpdk/rte/hugepage_info'
> -        out = self.send_expect(cmd, "# ", 20, alt_session)
> -        if len(out) and "No such file or directory" not in out:
> -            self.logger.warning("There are some dpdk process not free hugepage")
> -            self.logger.warning("**************************************")
> -            self.logger.warning(out)
> -            self.logger.warning("**************************************")
> +        for config_file in file_directorys:
> +            cmd = 'lsof -Fp %s' % config_file
> +            out = self.send_expect(cmd, "# ", 20, alt_session)
> +            if len(out):
> +                lines = out.split('\r\n')
> +                for line in lines:
> +                    m = re.match(pid_reg, line)
> +                    if m:
> +                        pids.append(m.group(1))
> +            for pid in pids:
> +                self.send_expect('kill -9 %s' % pid, '# ', 20, alt_session)
> +                self.get_session_output(timeout=2)
> +
> +        hugepage_info = ['/var/run/dpdk/%s/hugepage_info' % file_prefix for
> file_prefix in prefix_list]
> +        for hugepage in hugepage_info:
> +            cmd = 'lsof -Fp %s' % hugepage
> +            out = self.send_expect(cmd, "# ", 20, alt_session)
> +            if len(out) and "No such file or directory" not in out:
> +                self.logger.warning("There are some dpdk process not free hugepage")
> +                self.logger.warning("**************************************")
> +                self.logger.warning(out)
> +
> + self.logger.warning("**************************************")
> +
> +        # remove directory
> +        directorys = ['/var/run/dpdk/%s' % file_prefix for file_prefix in prefix_list]
> +        for directory in directorys:
> +            cmd = 'rm -rf %s' % directory
> +            self.send_expect(cmd, "# ", 20, alt_session)
> +
> +    def kill_all(self, alt_session=True):
> +        """
> +        Kill all dpdk applications on CRB.
> +        """
> +        if 'tester' in str(self):
> +            self.logger.info('kill_all: called by tester')
> +            pass
> +        else:
> +            if self.prefix_list:
> +                self.logger.info('kill_all: called by dut and prefix list has value.')
> +                self.get_dpdk_pids(self.prefix_list, alt_session)
> +                # init prefix_list
> +                self.prefix_list = []
> +            else:
> +                self.logger.info('kill_all: called by dut and has no prefix list.')
> +                session = self.create_session('dut_session')
> +                out = session.send_command("ls -l /var/run/dpdk |awk '/^d/ {print $NF}'",
> timeout=0.5)
> +                # the last directory is expect string, eg: [PEXPECT]#
> +                if out != '':
> +                    dir_list = out.split('\r\n')
> +                    self.get_dpdk_pids(dir_list[:-1], alt_session)
> 
>      def close(self):
>          """
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 2/6] framework/config.py: deal with dut_cores parameter
  2019-09-27 17:34 ` [dts] [PATCH V1 2/6] framework/config.py: deal with " Jianwei Mei
@ 2019-10-08  2:22   ` Chen, Zhaoyan
  0 siblings, 0 replies; 13+ messages in thread
From: Chen, Zhaoyan @ 2019-10-08  2:22 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Ma, LihongX, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: Mei, JianweiX
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX <lihongx.ma@intel.com>;
> Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts][PATCH V1 2/6] framework/config.py: deal with dut_cores parameter
> 
> From: meijx <jianweix.mei@intel.com>
> 
> deal with new parameter in config.py
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  framework/config.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/framework/config.py b/framework/config.py index abb1469..7a8ca48
> 100644
> --- a/framework/config.py
> +++ b/framework/config.py
> @@ -266,7 +266,7 @@ class CrbsConf(UserConf):
>                 'pass': '', 'tester IP': '', 'tester pass': '',
>                 IXIA: None, 'memory channels': 4,
>                 PKTGEN: None,
> -               'bypass core0': True}
> +               'bypass core0': True, 'dut_cores': ''}
> 
>      def __init__(self, crbs_conf=CRBCONF):
>          self.config_file = crbs_conf
> @@ -322,6 +322,8 @@ class CrbsConf(UserConf):
>                      crb['board'] = value
>                  elif key == 'dut_arch':
>                      crb['dut arch'] = value
> +                elif key == 'dut_cores':
> +                    crb['dut_cores'] = value
> 
>              self.crbs_cfg.append(crb)
>          return self.crbs_cfg
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
                   ` (4 preceding siblings ...)
  2019-09-27 17:34 ` [dts] [PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut Jianwei Mei
@ 2019-10-08  2:22 ` Chen, Zhaoyan
  2019-10-12  5:30 ` Tu, Lijuan
  6 siblings, 0 replies; 13+ messages in thread
From: Chen, Zhaoyan @ 2019-10-08  2:22 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Ma, LihongX, Chen, Zhaoyan

Acked-by: Chen, Zhaoyan <zhaoyan.chen@intel.com>



Regards,
Zhaoyan Chen


> -----Original Message-----
> From: Mei, JianweiX
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX <lihongx.ma@intel.com>;
> Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts][PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter
> 
> From: meijx <jianweix.mei@intel.com>
> 
> add new parameter to configure dut cores for testsuite.
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  conf/crbs.cfg | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/conf/crbs.cfg b/conf/crbs.cfg index 5c28ab2..5209555 100644
> --- a/conf/crbs.cfg
> +++ b/conf/crbs.cfg
> @@ -10,6 +10,7 @@
>  #  pktgen_group: packet generator group name  #  channels: Board channel number
> #  bypass_core0: Whether by pass core0
> +#  dut_cores: DUT core list, eg: 1,2,3,4,5,18-22
>  [DUT IP1]
>  dut_ip=xxx.xxx.xxx.xxx
>  dut_user=root
> @@ -22,6 +23,7 @@ ixia_group=
>  pktgen_group=
>  channels=4
>  bypass_core0=True
> +dut_cores=
>  [DUT IP2]
>  dut_ip=yyy.yyy.yyy.yyy
>  dut_user=root
> @@ -34,3 +36,4 @@ ixia_group=
>  pktgen_group=
>  channels=4
>  bypass_core0=True
> +dut_cores=
> \ No newline at end of file
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter
  2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
                   ` (5 preceding siblings ...)
  2019-10-08  2:22 ` [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Chen, Zhaoyan
@ 2019-10-12  5:30 ` Tu, Lijuan
  6 siblings, 0 replies; 13+ messages in thread
From: Tu, Lijuan @ 2019-10-12  5:30 UTC (permalink / raw)
  To: Mei, JianweiX, dts; +Cc: Chen, Zhaoyan, Ma, LihongX, Mei, JianweiX

Applied the series, thanks

> -----Original Message-----
> From: dts [mailto:dts-bounces@dpdk.org] On Behalf Of Jianwei Mei
> Sent: Saturday, September 28, 2019 1:35 AM
> To: dts@dpdk.org
> Cc: Chen, Zhaoyan <zhaoyan.chen@intel.com>; Ma, LihongX
> <lihongx.ma@intel.com>; Mei, JianweiX <jianweix.mei@intel.com>
> Subject: [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter
> 
> From: meijx <jianweix.mei@intel.com>
> 
> add new parameter to configure dut cores for testsuite.
> 
> Signed-off-by: meijx <jianweix.mei@intel.com>
> ---
>  conf/crbs.cfg | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/conf/crbs.cfg b/conf/crbs.cfg index 5c28ab2..5209555 100644
> --- a/conf/crbs.cfg
> +++ b/conf/crbs.cfg
> @@ -10,6 +10,7 @@
>  #  pktgen_group: packet generator group name  #  channels: Board channel
> number  #  bypass_core0: Whether by pass core0
> +#  dut_cores: DUT core list, eg: 1,2,3,4,5,18-22
>  [DUT IP1]
>  dut_ip=xxx.xxx.xxx.xxx
>  dut_user=root
> @@ -22,6 +23,7 @@ ixia_group=
>  pktgen_group=
>  channels=4
>  bypass_core0=True
> +dut_cores=
>  [DUT IP2]
>  dut_ip=yyy.yyy.yyy.yyy
>  dut_user=root
> @@ -34,3 +36,4 @@ ixia_group=
>  pktgen_group=
>  channels=4
>  bypass_core0=True
> +dut_cores=
> \ No newline at end of file
> --
> 1.8.3.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-10-12  5:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 17:34 [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Jianwei Mei
2019-09-27 17:34 ` [dts] [PATCH V1 2/6] framework/config.py: deal with " Jianwei Mei
2019-10-08  2:22   ` Chen, Zhaoyan
2019-09-27 17:34 ` [dts] [PATCH V1 3/6] framework/crb.py: only scan configured ports from ports.cfg and overwrite kill all Jianwei Mei
2019-10-08  2:22   ` Chen, Zhaoyan
2019-09-27 17:34 ` [dts] [PATCH V1 4/6] framework/dut.py: add function create_eal_parameters Jianwei Mei
2019-10-08  2:22   ` Chen, Zhaoyan
2019-09-27 17:34 ` [dts] [PATCH V1 5/6] framework/pmd_output.py: overwrite function start_testpmd Jianwei Mei
2019-10-08  2:22   ` Chen, Zhaoyan
2019-09-27 17:34 ` [dts] [PATCH V1 6/6] framework/virt_dut.py: add prefix list for virt dut Jianwei Mei
2019-10-08  2:22   ` Chen, Zhaoyan
2019-10-08  2:22 ` [dts] [PATCH V1 1/6] conf/crbs.cfg:add dut_cores parameter Chen, Zhaoyan
2019-10-12  5:30 ` Tu, Lijuan

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).