* [dts] [PATCH v2 1/4] framework: add new module for load port configuration file
2015-02-04 6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
@ 2015-02-04 6:43 ` Yong Liu
2015-02-04 6:47 ` Qiu, Michael
2015-02-04 6:43 ` [dts] [PATCH v2 2/4] framework: execuction file support port config nic_type Yong Liu
` (4 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Yong Liu @ 2015-02-04 6:43 UTC (permalink / raw)
To: dts
Config module will load port configuration and parse port parameter.
Port configuration will be used in the process of setting up DUT.
User can assign port mac, numa or tester peer pci address of DUT port.
Signed-off-by: Marvinliu <yong.liu@intel.com>
---
conf/ports.cfg | 9 +++++
framework/config.py | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 105 insertions(+)
create mode 100644 conf/ports.cfg
create mode 100755 framework/config.py
diff --git a/conf/ports.cfg b/conf/ports.cfg
new file mode 100644
index 0000000..55e26d8
--- /dev/null
+++ b/conf/ports.cfg
@@ -0,0 +1,9 @@
+# DUT Port Configuration
+# [DUT IP]
+# ports=
+# pci=Pci BDF,intf=Kernel interface;
+# pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa
+[DUT IP]
+ports =
+ pci=XX:XX.X,intf=eth0
+ pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
diff --git a/framework/config.py b/framework/config.py
new file mode 100755
index 0000000..dc4f944
--- /dev/null
+++ b/framework/config.py
@@ -0,0 +1,96 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+Generic port and crbs configuration file load function
+"""
+
+import ConfigParser # config parse module
+import argparse # prase arguments module
+
+portconf = "../conf/ports.cfg"
+crbconf = "../conf/crbs.cfg"
+
+
+class UserConf():
+
+ def __init__(self, port_conf=portconf, crb_conf=crbconf):
+ self.port_config = port_conf
+ self.crb_config = crb_conf
+ self.ports_cfg = {}
+ try:
+ self.port_conf = ConfigParser.SafeConfigParser()
+ self.port_conf.read(self.port_config)
+ except Exception as e:
+ print "FAILED LOADING PORT CONFIG!!!"
+
+ def load_ports_config(self, crbIP):
+ ports = []
+ for crb in self.port_conf.sections():
+ if crb != crbIP:
+ continue
+ ports = [port.strip()
+ for port in self.port_conf.get(crb, 'ports').split(';')]
+
+ for port in ports:
+ port_cfg = self.parse_port_param(port)
+ if 'pci' not in port_cfg:
+ print "INVALID CONFIG FOR NO PCI ADDRESS!!!"
+ keys = port_cfg.keys()
+ keys.remove('pci')
+ self.ports_cfg[port_cfg['pci']] = {key: port_cfg[key] for key in keys}
+
+ def check_port_available(self, pci_addr):
+ if pci_addr in self.ports_cfg.keys():
+ return True
+ else:
+ return False
+
+ def parse_port_param(self, port):
+ portDict = dict()
+
+ for param in port.split(','):
+ (key, _, value) = param.partition('=')
+ if key == 'numa':
+ portDict[key] = int(value)
+ else:
+ portDict[key] = value
+ return portDict
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(description="Load DTS configuration files")
+ parser.add_argument("-p", "--portconf", default=portconf)
+ parser.add_argument("-c", "--crbconf", default=crbconf)
+ args = parser.parse_args()
+ conf = UserConf()
+ conf.load_ports_config('192.168.1.1')
+ conf.check_port_available('0000:86:00.0')
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dts] [PATCH v2 1/4] framework: add new module for load port configuration file
2015-02-04 6:43 ` [dts] [PATCH v2 1/4] framework: add new module for load " Yong Liu
@ 2015-02-04 6:47 ` Qiu, Michael
0 siblings, 0 replies; 11+ messages in thread
From: Qiu, Michael @ 2015-02-04 6:47 UTC (permalink / raw)
To: Liu, Yong, dts
On 2/4/2015 2:44 PM, Yong Liu wrote:
> Config module will load port configuration and parse port parameter.
> Port configuration will be used in the process of setting up DUT.
> User can assign port mac, numa or tester peer pci address of DUT port.
>
> Signed-off-by: Marvinliu <yong.liu@intel.com>
> ---
> conf/ports.cfg | 9 +++++
> framework/config.py | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 105 insertions(+)
> create mode 100644 conf/ports.cfg
> create mode 100755 framework/config.py
>
> diff --git a/conf/ports.cfg b/conf/ports.cfg
> new file mode 100644
> index 0000000..55e26d8
> --- /dev/null
> +++ b/conf/ports.cfg
> @@ -0,0 +1,9 @@
> +# DUT Port Configuration
> +# [DUT IP]
> +# ports=
> +# pci=Pci BDF,intf=Kernel interface;
> +# pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa
> +[DUT IP]
> +ports =
> + pci=XX:XX.X,intf=eth0
> + pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
> diff --git a/framework/config.py b/framework/config.py
> new file mode 100755
> index 0000000..dc4f944
> --- /dev/null
> +++ b/framework/config.py
> @@ -0,0 +1,96 @@
> +# BSD LICENSE
> +#
> +# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
> +# All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions
> +# are met:
> +#
> +# * Redistributions of source code must retain the above copyright
> +# notice, this list of conditions and the following disclaimer.
> +# * Redistributions in binary form must reproduce the above copyright
> +# notice, this list of conditions and the following disclaimer in
> +# the documentation and/or other materials provided with the
> +# distribution.
> +# * Neither the name of Intel Corporation nor the names of its
> +# contributors may be used to endorse or promote products derived
> +# from this software without specific prior written permission.
> +#
> +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
> +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
> +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
> +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
> +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
> +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +
> +"""
> +Generic port and crbs configuration file load function
> +"""
> +
> +import ConfigParser # config parse module
> +import argparse # prase arguments module
> +
> +portconf = "../conf/ports.cfg"
> +crbconf = "../conf/crbs.cfg"
> +
> +
> +class UserConf():
> +
> + def __init__(self, port_conf=portconf, crb_conf=crbconf):
> + self.port_config = port_conf
> + self.crb_config = crb_conf
> + self.ports_cfg = {}
> + try:
> + self.port_conf = ConfigParser.SafeConfigParser()
> + self.port_conf.read(self.port_config)
> + except Exception as e:
> + print "FAILED LOADING PORT CONFIG!!!"
> +
> + def load_ports_config(self, crbIP):
> + ports = []
> + for crb in self.port_conf.sections():
> + if crb != crbIP:
> + continue
> + ports = [port.strip()
> + for port in self.port_conf.get(crb, 'ports').split(';')]
> +
> + for port in ports:
> + port_cfg = self.parse_port_param(port)
> + if 'pci' not in port_cfg:
> + print "INVALID CONFIG FOR NO PCI ADDRESS!!!"
> + keys = port_cfg.keys()
> + keys.remove('pci')
> + self.ports_cfg[port_cfg['pci']] = {key: port_cfg[key] for key in keys}
> +
> + def check_port_available(self, pci_addr):
> + if pci_addr in self.ports_cfg.keys():
> + return True
> + else:
> + return False
> +
> + def parse_port_param(self, port):
> + portDict = dict()
> +
> + for param in port.split(','):
> + (key, _, value) = param.partition('=')
> + if key == 'numa':
> + portDict[key] = int(value)
> + else:
> + portDict[key] = value
> + return portDict
> +
> +
> +if __name__ == '__main__':
> + parser = argparse.ArgumentParser(description="Load DTS configuration files")
> + parser.add_argument("-p", "--portconf", default=portconf)
> + parser.add_argument("-c", "--crbconf", default=crbconf)
> + args = parser.parse_args()
> + conf = UserConf()
> + conf.load_ports_config('192.168.1.1')
> + conf.check_port_available('0000:86:00.0')
Acked-by: Michael Qiu <michael.qiu@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH v2 2/4] framework: execuction file support port config nic_type
2015-02-04 6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
2015-02-04 6:43 ` [dts] [PATCH v2 1/4] framework: add new module for load " Yong Liu
@ 2015-02-04 6:43 ` Yong Liu
2015-02-04 7:07 ` Qiu, Michael
2015-02-04 6:43 ` [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence Yong Liu
` (3 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Yong Liu @ 2015-02-04 6:43 UTC (permalink / raw)
To: dts
DTS support new function that get linux driver with pci device id.
DTS sample execution configuration support configured DUT port.
One execution section support only one DUT.
Signed-off-by: Marvinliu <yong.liu@intel.com>
---
execution.cfg | 2 +-
framework/dts.py | 62 +++++++++++++++++++++++++++++++++-----------------------
2 files changed, 38 insertions(+), 26 deletions(-)
diff --git a/execution.cfg b/execution.cfg
index 18781ee..a67d7b3 100644
--- a/execution.cfg
+++ b/execution.cfg
@@ -19,7 +19,7 @@ test_suites=
pmd_bonded
targets=
x86_64-native-linuxapp-gcc
-parameters=nic_type=niantic:func=true
+parameters=nic_type=cfg:func=true
[Execution2]
crbs=<Performance CRB IP Address>
diff --git a/framework/dts.py b/framework/dts.py
index 712ed54..9ba23fe 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -42,7 +42,7 @@ import rst # rst file support
from crbs import crbs
from tester import Tester
from dut import Dut
-from settings import NICS
+from settings import NICS, DRIVERS
from serializer import Serializer
from exception import VerifyFailure
from test_case import TestCase
@@ -131,6 +131,18 @@ def close_crb_sessions():
log_handler.info("DTF ended")
+def get_nic_driver(pci_id):
+ """
+ Return linux driver for specified pci device
+ """
+ driverlist = dict(zip(NICS.values(), DRIVERS.keys()))
+ try:
+ driver = DRIVERS[driverlist[pci_id]]
+ except Exception as e:
+ driver = None
+ return driver
+
+
def accepted_nic(pci_id):
"""
Return True if the pci_id is a known NIC card in the settings file and if
@@ -201,7 +213,7 @@ def dts_parse_config(section):
nics = [_.strip() for _ in paramDict['nic_type'].split(',')]
- return duts, targets, test_suites, nics
+ return duts[0], targets, test_suites, nics
def get_project_obj(project_name, super_class, crbInst, serializer):
@@ -255,7 +267,7 @@ def dts_log_execution(log_handler):
pass
-def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir):
+def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
"""
Create dts dut/tester instance and initialize them.
"""
@@ -270,6 +282,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir):
tester.dut = dut
dut.set_speedup_options(read_cache, skip_setup)
dut.set_directory(base_dir)
+ dut.set_nic_types(nics)
tester.set_speedup_options(read_cache, skip_setup)
show_speedup_options_messages(read_cache, skip_setup)
dut.set_test_types(func_tests=functional_only, perf_tests=performance_only)
@@ -426,36 +439,35 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
dts_parse_param(section)
# verify if the delimiter is good if the lists are vertical
- duts, targets, test_suites, nics = dts_parse_config(section)
+ dutIP, targets, test_suites, nics = dts_parse_config(section)
- for dutIP in duts:
- log_handler.info("\nDUT " + dutIP)
+ log_handler.info("\nDUT " + dutIP)
- # look up in crbs - to find the matching IP
- crbInst = None
- for crb in crbs:
- if crb['IP'] == dutIP:
- crbInst = crb
- break
+ # look up in crbs - to find the matching IP
+ crbInst = None
+ for crb in crbs:
+ if crb['IP'] == dutIP:
+ crbInst = crb
+ break
- # only run on the dut in known crbs
- if crbInst is None:
- log_handler.error(" SKIP UNKNOWN CRB")
- continue
+ # only run on the dut in known crbs
+ if crbInst is None:
+ log_handler.error(" SKIP UNKNOWN CRB")
+ continue
- result.dut = dutIP
+ result.dut = dutIP
- # init dut, tester crb
- dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir)
+ # init dut, tester crb
+ dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics)
- # Run DUT prerequisites
- if dts_run_prerequisties(pkgName, patch) is False:
- dts_crbs_exit()
- continue
+ # Run DUT prerequisites
+ if dts_run_prerequisties(pkgName, patch) is False:
+ dts_crbs_exit()
+ continue
- dts_run_target(crbInst, targets, test_suites, nics)
+ dts_run_target(crbInst, targets, test_suites, nics)
- dts_crbs_exit()
+ dts_crbs_exit()
save_all_results()
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dts] [PATCH v2 2/4] framework: execuction file support port config nic_type
2015-02-04 6:43 ` [dts] [PATCH v2 2/4] framework: execuction file support port config nic_type Yong Liu
@ 2015-02-04 7:07 ` Qiu, Michael
0 siblings, 0 replies; 11+ messages in thread
From: Qiu, Michael @ 2015-02-04 7:07 UTC (permalink / raw)
To: Liu, Yong, dts
On 2/4/2015 2:44 PM, Yong Liu wrote:
> DTS support new function that get linux driver with pci device id.
> DTS sample execution configuration support configured DUT port.
> One execution section support only one DUT.
>
> Signed-off-by: Marvinliu <yong.liu@intel.com>
> ---
> execution.cfg | 2 +-
> framework/dts.py | 62 +++++++++++++++++++++++++++++++++-----------------------
> 2 files changed, 38 insertions(+), 26 deletions(-)
>
> diff --git a/execution.cfg b/execution.cfg
> index 18781ee..a67d7b3 100644
> --- a/execution.cfg
> +++ b/execution.cfg
> @@ -19,7 +19,7 @@ test_suites=
> pmd_bonded
> targets=
> x86_64-native-linuxapp-gcc
> -parameters=nic_type=niantic:func=true
> +parameters=nic_type=cfg:func=true
>
> [Execution2]
> crbs=<Performance CRB IP Address>
> diff --git a/framework/dts.py b/framework/dts.py
> index 712ed54..9ba23fe 100644
> --- a/framework/dts.py
> +++ b/framework/dts.py
> @@ -42,7 +42,7 @@ import rst # rst file support
> from crbs import crbs
> from tester import Tester
> from dut import Dut
> -from settings import NICS
> +from settings import NICS, DRIVERS
> from serializer import Serializer
> from exception import VerifyFailure
> from test_case import TestCase
> @@ -131,6 +131,18 @@ def close_crb_sessions():
> log_handler.info("DTF ended")
>
>
> +def get_nic_driver(pci_id):
> + """
> + Return linux driver for specified pci device
> + """
> + driverlist = dict(zip(NICS.values(), DRIVERS.keys()))
> + try:
> + driver = DRIVERS[driverlist[pci_id]]
> + except Exception as e:
> + driver = None
> + return driver
> +
> +
> def accepted_nic(pci_id):
> """
> Return True if the pci_id is a known NIC card in the settings file and if
> @@ -201,7 +213,7 @@ def dts_parse_config(section):
>
> nics = [_.strip() for _ in paramDict['nic_type'].split(',')]
>
> - return duts, targets, test_suites, nics
> + return duts[0], targets, test_suites, nics
>
>
> def get_project_obj(project_name, super_class, crbInst, serializer):
> @@ -255,7 +267,7 @@ def dts_log_execution(log_handler):
> pass
>
>
> -def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir):
> +def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics):
> """
> Create dts dut/tester instance and initialize them.
> """
> @@ -270,6 +282,7 @@ def dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir):
> tester.dut = dut
> dut.set_speedup_options(read_cache, skip_setup)
> dut.set_directory(base_dir)
> + dut.set_nic_types(nics)
> tester.set_speedup_options(read_cache, skip_setup)
> show_speedup_options_messages(read_cache, skip_setup)
> dut.set_test_types(func_tests=functional_only, perf_tests=performance_only)
> @@ -426,36 +439,35 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
> dts_parse_param(section)
>
> # verify if the delimiter is good if the lists are vertical
> - duts, targets, test_suites, nics = dts_parse_config(section)
> + dutIP, targets, test_suites, nics = dts_parse_config(section)
>
> - for dutIP in duts:
> - log_handler.info("\nDUT " + dutIP)
> + log_handler.info("\nDUT " + dutIP)
>
> - # look up in crbs - to find the matching IP
> - crbInst = None
> - for crb in crbs:
> - if crb['IP'] == dutIP:
> - crbInst = crb
> - break
> + # look up in crbs - to find the matching IP
> + crbInst = None
> + for crb in crbs:
> + if crb['IP'] == dutIP:
> + crbInst = crb
> + break
>
> - # only run on the dut in known crbs
> - if crbInst is None:
> - log_handler.error(" SKIP UNKNOWN CRB")
> - continue
> + # only run on the dut in known crbs
> + if crbInst is None:
> + log_handler.error(" SKIP UNKNOWN CRB")
> + continue
>
> - result.dut = dutIP
> + result.dut = dutIP
>
> - # init dut, tester crb
> - dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir)
> + # init dut, tester crb
> + dts_crbs_init(crbInst, skip_setup, read_cache, project, base_dir, nics)
>
> - # Run DUT prerequisites
> - if dts_run_prerequisties(pkgName, patch) is False:
> - dts_crbs_exit()
> - continue
> + # Run DUT prerequisites
> + if dts_run_prerequisties(pkgName, patch) is False:
> + dts_crbs_exit()
> + continue
>
> - dts_run_target(crbInst, targets, test_suites, nics)
> + dts_run_target(crbInst, targets, test_suites, nics)
>
> - dts_crbs_exit()
> + dts_crbs_exit()
>
> save_all_results()
>
Acked-by: Michael Qiu <michael.qiu@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence
2015-02-04 6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
2015-02-04 6:43 ` [dts] [PATCH v2 1/4] framework: add new module for load " Yong Liu
2015-02-04 6:43 ` [dts] [PATCH v2 2/4] framework: execuction file support port config nic_type Yong Liu
@ 2015-02-04 6:43 ` Yong Liu
2015-02-04 6:59 ` Qiu, Michael
2015-02-04 6:43 ` [dts] [PATCH v2 4/4] suites: remove nic type check from testsuites Yong Liu
` (2 subsequent siblings)
5 siblings, 1 reply; 11+ messages in thread
From: Yong Liu @ 2015-02-04 6:43 UTC (permalink / raw)
To: dts
DUT port initialization sequence: scan,restore,rescan,load config
Test port initialization sequence: modprobe, interface up
Separate restore interface function from DUT and Tester.
Signed-off-by: Marvinliu <yong.liu@intel.com>
---
framework/crb.py | 66 ++++-------------
framework/dut.py | 172 ++++++++++++++++++++++++++++++--------------
framework/project_dpdk.py | 22 +++---
framework/ssh_connection.py | 2 +-
framework/tester.py | 32 ++++++++-
5 files changed, 175 insertions(+), 119 deletions(-)
diff --git a/framework/crb.py b/framework/crb.py
index d41f51b..fa03757 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -133,56 +133,6 @@ class Crb(object):
"""
self.send_expect("ip link set %s %s" % (eth, status), "# ")
- def restore_interfaces(self):
- """
- Restore Linux interfaces.
- """
- if dts.drivername == "vfio-pci":
- self.send_expect("rmmod vfio_iommu_type1", "# ", 10)
- self.send_expect("rmmod vfio_pci", "# ", 10)
- self.send_expect("rmmod vfio", "# ", 10)
- else:
- out = self.send_expect("lsmod | grep igb_uio", "#")
- if "igb_uio" in out:
- self.send_expect("rmmod -f igb_uio", "# ", 10)
- self.send_expect("modprobe igb", "# ", 20)
- self.send_expect("modprobe ixgbe", "# ", 20)
- self.send_expect("modprobe e1000e", "# ", 20)
- self.send_expect("modprobe e1000", "# ", 20)
- self.send_expect("modprobe virtio_net", "# ", 20)
-
- try:
- for (pci_bus, pci_id) in self.pci_devices_info:
- """
- Check if driver is already bound before binding it.
- """
- if pci_id in ('8086:10fb', '8086:151c', '8086:1528', '8086:1512', '8086:154a'):
- if not os.path.exists("/sys/bus/pci/drivers/ixgbe/"+"0000:"+pci_bus):
- self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/ixgbe/bind" % pci_bus, "# ")
- elif pci_id in ('8086:10e8', '8086:150e', '8086:1521', '8086:10c9', '8086:1526', '8086:1533'):
- if not os.path.exists("/sys/bus/pci/drivers/igb/"+"0000:"+pci_bus):
- self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/igb/bind" % pci_bus, "# ")
- elif pci_id in('8086:10d3', '8086:10b9'):
- if not os.path.exists("/sys/bus/pci/drivers/e1000e/"+"0000:"+pci_bus):
- self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/e1000e/bind" % pci_bus, "# ")
- elif pci_id in ('8086:153a', '8086:153b', '8086:155a', '8086:1559'):
- if not os.path.exists("/sys/bus/pci/drivers/e1000e/"+"0000:"+pci_bus):
- self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/e1000e/bind" % pci_bus, "# ")
- elif pci_id in ('8086:100f', '8086:100e'):
- if not os.path.exists("/sys/bus/pci/drivers/e1000/"+"0000:"+pci_bus):
- self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/e1000/bind" % pci_bus, "# ")
- elif pci_id in ('1af4:1000'):
- self.send_expect("echo 0000%s > /sys/bus/pci/drivers/virtio-pci/bind" % pci_bus, "# ")
- else:
- continue
-
- addr_array = pci_bus.split(':')
- itf = self.get_interface_name(addr_array[0], addr_array[1])
- self.send_expect("ifconfig %s up" % itf, "# ")
-
- except Exception as e:
- self.logger.error(" !!! Restore ITF: " + e.message)
-
def pci_devices_information(self):
"""
Scan CRB pci device information and save it into cache file.
@@ -206,7 +156,7 @@ class Crb(object):
Look for the NIC's information (PCI Id and card type).
"""
out = self.send_expect("lspci -nn | grep -i eth", "# ")
- rexp = r"([\da-f]{2}:[\da-f]{2}.\d{1}) Ethernet .* Intel Corporation .*?([\da-f]{4}:[\da-f]{4})"
+ rexp = r"([\da-f]{2}:[\da-f]{2}.\d{1}) Ethernet .*?([\da-f]{4}:[\da-f]{4})"
pattern = re.compile(rexp)
match = pattern.findall(out)
self.pci_devices_info = []
@@ -276,6 +226,20 @@ class Crb(object):
match = pattern.findall(out)
return match[0]
+ def get_device_numa(self, bus_id, devfun_id):
+ """
+ Get numa id of specified pci device
+ """
+ numa = self.send_expect("cat /sys/bus/pci/devices/0000\:%s\:%s/numa_node" %
+ (bus_id, devfun_id), "# ")
+
+ try:
+ numa = int(numa)
+ except ValueError:
+ numa = -1
+ self.logger.warning("NUMA not available")
+ return numa
+
def get_ipv6_addr(self, intf):
"""
Get ipv6 address of specified pci device.
diff --git a/framework/dut.py b/framework/dut.py
index 9879335..cddc248 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -33,6 +33,7 @@ import os
import re
import time
import dts
+from config import UserConf
from settings import NICS
from ssh_connection import SSHConnection
from crb import Crb
@@ -70,6 +71,7 @@ class Dut(Crb):
self.cores = []
self.architecture = None
self.ports_info = None
+ self.conf = UserConf()
def change_config_option(self, target, parameter, value):
"""
@@ -78,6 +80,14 @@ class Dut(Crb):
self.send_expect("sed -i 's/%s=.*$/%s=%s/' config/defconfig_%s" %
(parameter, parameter, value, target), "# ")
+ def set_nic_types(self, nics):
+ """
+ Set CRB NICS ready to validated.
+ """
+ self.nics = nics
+ if 'cfg' in nics:
+ self.conf.load_ports_config(self.get_ip_address())
+
def set_toolchain(self, target):
"""
This looks at the current target and instantiates an attribute to
@@ -144,8 +154,14 @@ class Dut(Crb):
self.init_core_list()
self.pci_devices_information()
- self.restore_interfaces()
+ # scan ports before restore interface
self.scan_ports()
+ # restore dut ports to kernel
+ self.restore_interfaces()
+ # rescan ports after interface up
+ self.rescan_ports()
+ # load port infor from config file
+ self.load_portconf()
self.mount_procfs()
def restore_interfaces(self):
@@ -167,11 +183,27 @@ class Dut(Crb):
"""
Restore Linux interfaces.
"""
- Crb.restore_interfaces(self)
-
- if self.ports_info is not None:
- for port in self.ports_info:
- self.admin_ports_linux(port['intf'], 'up')
+ for port in self.ports_info:
+ pci_bus = port['pci']
+ pci_id = port['type']
+ # get device driver
+ driver = dts.get_nic_driver(pci_id)
+ if driver is not None:
+ # unbind device driver
+ addr_array = pci_bus.split(':')
+ bus_id = addr_array[0]
+ devfun_id = addr_array[1]
+
+ self.send_expect('echo 0000:%s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind'
+ % (pci_bus, bus_id, devfun_id), '# ')
+ # bind to linux kernel driver
+ self.send_expect('modprobe %s' % driver, '# ')
+ self.send_expect('echo 0000:%s > /sys/bus/pci/drivers/%s/bind'
+ % (pci_bus, driver), '# ')
+ itf = self.get_interface_name(addr_array[0], addr_array[1])
+ self.send_expect("ifconfig %s up" % itf, "# ")
+ else:
+ self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" % (pci_bus, pci_id))
def setup_memory(self, hugepages=-1):
"""
@@ -259,7 +291,7 @@ class Dut(Crb):
self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# ', 30)
- def get_ports(self, nic_type, perf=None, socket=None):
+ def get_ports(self, nic_type='any', perf=None, socket=None):
"""
Return DUT port list with the filter of NIC type, whether run IXIA
performance test, whether request specified socket.
@@ -301,7 +333,7 @@ class Dut(Crb):
else:
return ports
- def get_ports_performance(self, nic_type, perf=None, socket=None,
+ def get_ports_performance(self, nic_type='any', perf=None, socket=None,
force_same_socket=True,
force_different_nic=True):
"""
@@ -339,6 +371,15 @@ class Dut(Crb):
return biggest_set
+ def get_peer_pci(self, port_num):
+ """
+ return the peer pci address of dut port
+ """
+ if 'peer' not in self.ports_info[port_num]:
+ return None
+ else:
+ return self.ports_info[port_num]['peer']
+
def get_mac_address(self, port_num):
"""
return the port mac on dut
@@ -381,6 +422,55 @@ class Dut(Crb):
else:
return 1
+ def check_ports_available(self, pci_bus, pci_id):
+ """
+ Check that whether auto scanned ports ready to use
+ """
+ pci_addr = "%s:%s" % (pci_bus, pci_id)
+ codenames = []
+ for nic in self.nics:
+ if nic == 'any':
+ return True
+ elif nic == 'cfg':
+ if self.conf.check_port_available(pci_bus) is True:
+ return True
+ elif nic not in NICS.keys():
+ self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic)
+ else:
+ codenames.append(NICS[nic])
+
+ if pci_id in codenames:
+ return True
+
+ return False
+
+ def rescan_ports(self):
+ unknow_interface = dts.RED('Skipped: unknow_interface')
+
+ for port_info in self.ports_info:
+ pci_bus = port_info['pci']
+ addr_array = pci_bus.split(':')
+ bus_id = addr_array[0]
+ devfun_id = addr_array[1]
+ intf = self.get_interface_name(bus_id, devfun_id)
+ if "No such file" in intf:
+ self.logger.info("DUT: [0000:%s] %s" % (pci_bus, unknow_interface))
+ out = self.send_expect("ip link show %s" % intf, "# ")
+ if "DOWN" in out:
+ self.send_expect("ip link set %s up" % intf, "# ")
+ time.sleep(5)
+ macaddr = self.get_mac_addr(intf, bus_id, devfun_id)
+ out = self.send_expect("ip -family inet6 address show dev %s | awk '/inet6/ { print $2 }'"
+ % intf, "# ")
+ ipv6 = out.split('/')[0]
+ # Unconnected ports don't have IPv6
+ if ":" not in ipv6:
+ ipv6 = "Not connected"
+
+ port_info['mac'] = macaddr
+ port_info['intf'] = intf
+ port_info['ipv6'] = ipv6
+
def scan_ports(self):
"""
Scan ports information or just read it from cache file.
@@ -411,8 +501,7 @@ class Dut(Crb):
unknow_interface = dts.RED('Skipped: unknow_interface')
for (pci_bus, pci_id) in self.pci_devices_info:
-
- if not dts.accepted_nic(pci_id):
+ if self.check_ports_available(pci_bus, pci_id) is False:
self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_id,
skipped))
continue
@@ -420,50 +509,10 @@ class Dut(Crb):
addr_array = pci_bus.split(':')
bus_id = addr_array[0]
devfun_id = addr_array[1]
- self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/igb_uio/unbind" % pci_bus, "# ")
- if pci_id == '8086:10fb':
- self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/ixgbe/bind" % pci_bus, "# ")
- intf = self.get_interface_name(bus_id, devfun_id)
-
- out = self.send_expect("ip link show %s" % intf, "# ")
- if "DOWN" in out:
- self.send_expect("ip link set %s up" % intf, "# ")
- """
- I217 and I218 requires more time to acquire V6 address.
- """
- time.sleep(25)
-
- self.logger.info("DUT: [000:%s %s] %s" % (pci_bus,
- pci_id,
- intf))
-
- if "No such file" in intf:
- self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_id,
- unknow_interface))
- continue
-
- macaddr = self.get_mac_addr(intf, bus_id, devfun_id)
-
- out = self.send_expect("ip -family inet6 address show dev %s | awk '/inet6/ { print $2 }'"
- % intf, "# ")
- ipv6 = out.split('/')[0]
-
- # Unconnected ports don't have IPv6
- if ":" not in ipv6:
- ipv6 = "Not connected"
-
- numa = self.send_expect("cat /sys/bus/pci/devices/0000\:%s\:%s/numa_node" %
- (bus_id, devfun_id), "# ")
-
- try:
- numa = int(numa)
- except ValueError:
- numa = -1
- self.logger.warning("NUMA not available")
+ numa = self.get_device_numa(bus_id, devfun_id)
# store the port info to port mapping
- self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'intf':
- intf, 'mac': macaddr, 'ipv6': ipv6, 'numa': numa})
+ self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'numa': numa})
def scan_ports_uncached_freebsd(self):
"""
@@ -505,3 +554,22 @@ class Dut(Crb):
# store the port info to port mapping
self.ports_info.append({'pci': pci_str, 'type': pci_id, 'intf':
intf, 'mac': macaddr, 'ipv6': ipv6, 'numa': -1})
+
+ def load_portconf(self):
+ """
+ Load port configurations for ports_info. If manually configured infor
+ not same as auto scanned, still use infor in configuration file.
+ """
+ for port in self.ports_info:
+ pci_bus = port['pci']
+ if pci_bus in self.conf.ports_cfg:
+ port_cfg = self.conf.ports_cfg[pci_bus]
+ port_cfg['source'] = 'cfg'
+ else:
+ port_cfg = {}
+
+ for key in ['intf', 'mac', 'numa', 'peer']:
+ if key in port_cfg:
+ if key in port and port_cfg[key] != port[key]:
+ self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
+ port[key] = port_cfg[key]
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 3577eb7..8cb144f 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -236,13 +236,10 @@ class DPDKdut(Dut):
binding_list = '--bind=%s ' % driver
current_nic = 0
- for (pci_bus, pci_id) in self.pci_devices_info:
- if dts.accepted_nic(pci_id):
-
- if nics_to_bind is None or current_nic in nics_to_bind:
- binding_list += '%s ' % (pci_bus)
-
- current_nic += 1
+ for port_info in self.ports_info:
+ if nics_to_bind is None or current_nic in nics_to_bind:
+ binding_list += '%s ' % (port_info['pci'])
+ current_nic += 1
self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# ')
@@ -254,13 +251,10 @@ class DPDKdut(Dut):
binding_list = '-u '
current_nic = 0
- for (pci_bus, pci_id) in self.pci_devices_info:
- if dts.accepted_nic(pci_id):
-
- if nics_to_bind is None or current_nic in nics_to_bind:
- binding_list += '%s ' % (pci_bus)
-
- current_nic += 1
+ for port_info in self.ports_info:
+ if nics_to_bind is None or current_nic in nics_to_bind:
+ binding_list += '%s ' % (port_info['pci'])
+ current_nic += 1
self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# ', 30)
diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
index 4306162..25f249a 100644
--- a/framework/ssh_connection.py
+++ b/framework/ssh_connection.py
@@ -40,7 +40,7 @@ class SSHConnection(object):
Implement send_expect/copy function upper SSHPexpet module.
"""
- def __init__(self, host, session_name, password = ''):
+ def __init__(self, host, session_name, password=''):
self.session = SSHPexpect(host, USERNAME, password)
self.name = session_name
diff --git a/framework/tester.py b/framework/tester.py
index 0ebe29a..437d8c4 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -133,7 +133,7 @@ class Tester(Crb):
self.restore_interfaces()
self.scan_ports()
self.map_available_ports()
- if self.ports_map == None or len(self.ports_map) == 0:
+ if self.ports_map is None or len(self.ports_map) == 0:
raise ValueError("ports_map should not be empty, please check all links")
def get_local_port(self, remotePort):
@@ -179,6 +179,24 @@ class Tester(Crb):
else:
return 'down'
+ def restore_interfaces(self):
+ """
+ Restore Linux interfaces.
+ """
+ self.send_expect("modprobe igb", "# ", 20)
+ self.send_expect("modprobe ixgbe", "# ", 20)
+ self.send_expect("modprobe e1000e", "# ", 20)
+ self.send_expect("modprobe e1000", "# ", 20)
+
+ try:
+ for (pci_bus, pci_id) in self.pci_devices_info:
+ addr_array = pci_bus.split(':')
+ itf = self.get_interface_name(addr_array[0], addr_array[1])
+ self.send_expect("ifconfig %s up" % itf, "# ")
+
+ except Exception as e:
+ self.logger.error(" !!! Restore ITF: " + e.message)
+
def scan_ports(self):
"""
Scan all ports on tester and save port's pci/mac/interface.
@@ -262,6 +280,18 @@ class Tester(Crb):
hits = [False] * len(self.ports_info)
for dutPort in range(nrPorts):
+ peer = self.dut.get_peer_pci(dutPort)
+ if peer is not None:
+ for localPort in range(len(self.ports_info)):
+ if self.ports_info[localPort]['pci'] == peer:
+ hits[localPort] = True
+ self.ports_map[dutPort] = localPort
+ break
+ if self.ports_map[dutPort] == -1:
+ self.logger.error("CONFIGURED TESTER PORT CANNOT FOUND!!!")
+ else:
+ continue # skip ping6 map
+
for localPort in range(len(self.ports_info)):
if hits[localPort]:
continue
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence
2015-02-04 6:43 ` [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence Yong Liu
@ 2015-02-04 6:59 ` Qiu, Michael
0 siblings, 0 replies; 11+ messages in thread
From: Qiu, Michael @ 2015-02-04 6:59 UTC (permalink / raw)
To: Liu, Yong, dts
On 2/4/2015 2:44 PM, Yong Liu wrote:
> DUT port initialization sequence: scan,restore,rescan,load config
> Test port initialization sequence: modprobe, interface up
> Separate restore interface function from DUT and Tester.
>
> Signed-off-by: Marvinliu <yong.liu@intel.com>
> ---
> framework/crb.py | 66 ++++-------------
> framework/dut.py | 172 ++++++++++++++++++++++++++++++--------------
> framework/project_dpdk.py | 22 +++---
> framework/ssh_connection.py | 2 +-
> framework/tester.py | 32 ++++++++-
> 5 files changed, 175 insertions(+), 119 deletions(-)
>
> diff --git a/framework/crb.py b/framework/crb.py
> index d41f51b..fa03757 100644
> --- a/framework/crb.py
> +++ b/framework/crb.py
> @@ -133,56 +133,6 @@ class Crb(object):
> """
> self.send_expect("ip link set %s %s" % (eth, status), "# ")
>
> - def restore_interfaces(self):
> - """
> - Restore Linux interfaces.
> - """
> - if dts.drivername == "vfio-pci":
> - self.send_expect("rmmod vfio_iommu_type1", "# ", 10)
> - self.send_expect("rmmod vfio_pci", "# ", 10)
> - self.send_expect("rmmod vfio", "# ", 10)
> - else:
> - out = self.send_expect("lsmod | grep igb_uio", "#")
> - if "igb_uio" in out:
> - self.send_expect("rmmod -f igb_uio", "# ", 10)
> - self.send_expect("modprobe igb", "# ", 20)
> - self.send_expect("modprobe ixgbe", "# ", 20)
> - self.send_expect("modprobe e1000e", "# ", 20)
> - self.send_expect("modprobe e1000", "# ", 20)
> - self.send_expect("modprobe virtio_net", "# ", 20)
> -
> - try:
> - for (pci_bus, pci_id) in self.pci_devices_info:
> - """
> - Check if driver is already bound before binding it.
> - """
> - if pci_id in ('8086:10fb', '8086:151c', '8086:1528', '8086:1512', '8086:154a'):
> - if not os.path.exists("/sys/bus/pci/drivers/ixgbe/"+"0000:"+pci_bus):
> - self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/ixgbe/bind" % pci_bus, "# ")
> - elif pci_id in ('8086:10e8', '8086:150e', '8086:1521', '8086:10c9', '8086:1526', '8086:1533'):
> - if not os.path.exists("/sys/bus/pci/drivers/igb/"+"0000:"+pci_bus):
> - self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/igb/bind" % pci_bus, "# ")
> - elif pci_id in('8086:10d3', '8086:10b9'):
> - if not os.path.exists("/sys/bus/pci/drivers/e1000e/"+"0000:"+pci_bus):
> - self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/e1000e/bind" % pci_bus, "# ")
> - elif pci_id in ('8086:153a', '8086:153b', '8086:155a', '8086:1559'):
> - if not os.path.exists("/sys/bus/pci/drivers/e1000e/"+"0000:"+pci_bus):
> - self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/e1000e/bind" % pci_bus, "# ")
> - elif pci_id in ('8086:100f', '8086:100e'):
> - if not os.path.exists("/sys/bus/pci/drivers/e1000/"+"0000:"+pci_bus):
> - self.send_expect("echo -n 0000:%s > /sys/bus/pci/drivers/e1000/bind" % pci_bus, "# ")
> - elif pci_id in ('1af4:1000'):
> - self.send_expect("echo 0000%s > /sys/bus/pci/drivers/virtio-pci/bind" % pci_bus, "# ")
> - else:
> - continue
> -
> - addr_array = pci_bus.split(':')
> - itf = self.get_interface_name(addr_array[0], addr_array[1])
> - self.send_expect("ifconfig %s up" % itf, "# ")
> -
> - except Exception as e:
> - self.logger.error(" !!! Restore ITF: " + e.message)
> -
> def pci_devices_information(self):
> """
> Scan CRB pci device information and save it into cache file.
> @@ -206,7 +156,7 @@ class Crb(object):
> Look for the NIC's information (PCI Id and card type).
> """
> out = self.send_expect("lspci -nn | grep -i eth", "# ")
> - rexp = r"([\da-f]{2}:[\da-f]{2}.\d{1}) Ethernet .* Intel Corporation .*?([\da-f]{4}:[\da-f]{4})"
> + rexp = r"([\da-f]{2}:[\da-f]{2}.\d{1}) Ethernet .*?([\da-f]{4}:[\da-f]{4})"
> pattern = re.compile(rexp)
> match = pattern.findall(out)
> self.pci_devices_info = []
> @@ -276,6 +226,20 @@ class Crb(object):
> match = pattern.findall(out)
> return match[0]
>
> + def get_device_numa(self, bus_id, devfun_id):
> + """
> + Get numa id of specified pci device
> + """
> + numa = self.send_expect("cat /sys/bus/pci/devices/0000\:%s\:%s/numa_node" %
> + (bus_id, devfun_id), "# ")
> +
> + try:
> + numa = int(numa)
> + except ValueError:
> + numa = -1
> + self.logger.warning("NUMA not available")
> + return numa
> +
> def get_ipv6_addr(self, intf):
> """
> Get ipv6 address of specified pci device.
> diff --git a/framework/dut.py b/framework/dut.py
> index 9879335..cddc248 100644
> --- a/framework/dut.py
> +++ b/framework/dut.py
> @@ -33,6 +33,7 @@ import os
> import re
> import time
> import dts
> +from config import UserConf
> from settings import NICS
> from ssh_connection import SSHConnection
> from crb import Crb
> @@ -70,6 +71,7 @@ class Dut(Crb):
> self.cores = []
> self.architecture = None
> self.ports_info = None
> + self.conf = UserConf()
>
> def change_config_option(self, target, parameter, value):
> """
> @@ -78,6 +80,14 @@ class Dut(Crb):
> self.send_expect("sed -i 's/%s=.*$/%s=%s/' config/defconfig_%s" %
> (parameter, parameter, value, target), "# ")
>
> + def set_nic_types(self, nics):
> + """
> + Set CRB NICS ready to validated.
> + """
> + self.nics = nics
> + if 'cfg' in nics:
> + self.conf.load_ports_config(self.get_ip_address())
> +
> def set_toolchain(self, target):
> """
> This looks at the current target and instantiates an attribute to
> @@ -144,8 +154,14 @@ class Dut(Crb):
>
> self.init_core_list()
> self.pci_devices_information()
> - self.restore_interfaces()
> + # scan ports before restore interface
> self.scan_ports()
> + # restore dut ports to kernel
> + self.restore_interfaces()
> + # rescan ports after interface up
> + self.rescan_ports()
> + # load port infor from config file
> + self.load_portconf()
> self.mount_procfs()
>
> def restore_interfaces(self):
> @@ -167,11 +183,27 @@ class Dut(Crb):
> """
> Restore Linux interfaces.
> """
> - Crb.restore_interfaces(self)
> -
> - if self.ports_info is not None:
> - for port in self.ports_info:
> - self.admin_ports_linux(port['intf'], 'up')
> + for port in self.ports_info:
> + pci_bus = port['pci']
> + pci_id = port['type']
> + # get device driver
> + driver = dts.get_nic_driver(pci_id)
> + if driver is not None:
> + # unbind device driver
> + addr_array = pci_bus.split(':')
> + bus_id = addr_array[0]
> + devfun_id = addr_array[1]
> +
> + self.send_expect('echo 0000:%s > /sys/bus/pci/devices/0000\:%s\:%s/driver/unbind'
> + % (pci_bus, bus_id, devfun_id), '# ')
> + # bind to linux kernel driver
> + self.send_expect('modprobe %s' % driver, '# ')
> + self.send_expect('echo 0000:%s > /sys/bus/pci/drivers/%s/bind'
> + % (pci_bus, driver), '# ')
> + itf = self.get_interface_name(addr_array[0], addr_array[1])
> + self.send_expect("ifconfig %s up" % itf, "# ")
> + else:
> + self.logger.info("NOT FOUND DRIVER FOR PORT (%s|%s)!!!" % (pci_bus, pci_id))
>
> def setup_memory(self, hugepages=-1):
> """
> @@ -259,7 +291,7 @@ class Dut(Crb):
>
> self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# ', 30)
>
> - def get_ports(self, nic_type, perf=None, socket=None):
> + def get_ports(self, nic_type='any', perf=None, socket=None):
> """
> Return DUT port list with the filter of NIC type, whether run IXIA
> performance test, whether request specified socket.
> @@ -301,7 +333,7 @@ class Dut(Crb):
> else:
> return ports
>
> - def get_ports_performance(self, nic_type, perf=None, socket=None,
> + def get_ports_performance(self, nic_type='any', perf=None, socket=None,
> force_same_socket=True,
> force_different_nic=True):
> """
> @@ -339,6 +371,15 @@ class Dut(Crb):
>
> return biggest_set
>
> + def get_peer_pci(self, port_num):
> + """
> + return the peer pci address of dut port
> + """
> + if 'peer' not in self.ports_info[port_num]:
> + return None
> + else:
> + return self.ports_info[port_num]['peer']
> +
> def get_mac_address(self, port_num):
> """
> return the port mac on dut
> @@ -381,6 +422,55 @@ class Dut(Crb):
> else:
> return 1
>
> + def check_ports_available(self, pci_bus, pci_id):
> + """
> + Check that whether auto scanned ports ready to use
> + """
> + pci_addr = "%s:%s" % (pci_bus, pci_id)
> + codenames = []
> + for nic in self.nics:
> + if nic == 'any':
> + return True
> + elif nic == 'cfg':
> + if self.conf.check_port_available(pci_bus) is True:
> + return True
> + elif nic not in NICS.keys():
> + self.logger.warning("NOT SUPPORTED NIC TYPE: %s" % nic)
> + else:
> + codenames.append(NICS[nic])
> +
> + if pci_id in codenames:
> + return True
> +
> + return False
> +
> + def rescan_ports(self):
> + unknow_interface = dts.RED('Skipped: unknow_interface')
> +
> + for port_info in self.ports_info:
> + pci_bus = port_info['pci']
> + addr_array = pci_bus.split(':')
> + bus_id = addr_array[0]
> + devfun_id = addr_array[1]
> + intf = self.get_interface_name(bus_id, devfun_id)
> + if "No such file" in intf:
> + self.logger.info("DUT: [0000:%s] %s" % (pci_bus, unknow_interface))
> + out = self.send_expect("ip link show %s" % intf, "# ")
> + if "DOWN" in out:
> + self.send_expect("ip link set %s up" % intf, "# ")
> + time.sleep(5)
> + macaddr = self.get_mac_addr(intf, bus_id, devfun_id)
> + out = self.send_expect("ip -family inet6 address show dev %s | awk '/inet6/ { print $2 }'"
> + % intf, "# ")
> + ipv6 = out.split('/')[0]
> + # Unconnected ports don't have IPv6
> + if ":" not in ipv6:
> + ipv6 = "Not connected"
> +
> + port_info['mac'] = macaddr
> + port_info['intf'] = intf
> + port_info['ipv6'] = ipv6
> +
> def scan_ports(self):
> """
> Scan ports information or just read it from cache file.
> @@ -411,8 +501,7 @@ class Dut(Crb):
> unknow_interface = dts.RED('Skipped: unknow_interface')
>
> for (pci_bus, pci_id) in self.pci_devices_info:
> -
> - if not dts.accepted_nic(pci_id):
> + if self.check_ports_available(pci_bus, pci_id) is False:
> self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_id,
> skipped))
> continue
> @@ -420,50 +509,10 @@ class Dut(Crb):
> addr_array = pci_bus.split(':')
> bus_id = addr_array[0]
> devfun_id = addr_array[1]
> - self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/igb_uio/unbind" % pci_bus, "# ")
> - if pci_id == '8086:10fb':
> - self.send_expect("echo 0000:%s > /sys/bus/pci/drivers/ixgbe/bind" % pci_bus, "# ")
> - intf = self.get_interface_name(bus_id, devfun_id)
> -
> - out = self.send_expect("ip link show %s" % intf, "# ")
> - if "DOWN" in out:
> - self.send_expect("ip link set %s up" % intf, "# ")
> - """
> - I217 and I218 requires more time to acquire V6 address.
> - """
> - time.sleep(25)
> -
> - self.logger.info("DUT: [000:%s %s] %s" % (pci_bus,
> - pci_id,
> - intf))
> -
> - if "No such file" in intf:
> - self.logger.info("DUT: [000:%s %s] %s" % (pci_bus, pci_id,
> - unknow_interface))
> - continue
> -
> - macaddr = self.get_mac_addr(intf, bus_id, devfun_id)
> -
> - out = self.send_expect("ip -family inet6 address show dev %s | awk '/inet6/ { print $2 }'"
> - % intf, "# ")
> - ipv6 = out.split('/')[0]
> -
> - # Unconnected ports don't have IPv6
> - if ":" not in ipv6:
> - ipv6 = "Not connected"
> -
> - numa = self.send_expect("cat /sys/bus/pci/devices/0000\:%s\:%s/numa_node" %
> - (bus_id, devfun_id), "# ")
> -
> - try:
> - numa = int(numa)
> - except ValueError:
> - numa = -1
> - self.logger.warning("NUMA not available")
>
> + numa = self.get_device_numa(bus_id, devfun_id)
> # store the port info to port mapping
> - self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'intf':
> - intf, 'mac': macaddr, 'ipv6': ipv6, 'numa': numa})
> + self.ports_info.append({'pci': pci_bus, 'type': pci_id, 'numa': numa})
>
> def scan_ports_uncached_freebsd(self):
> """
> @@ -505,3 +554,22 @@ class Dut(Crb):
> # store the port info to port mapping
> self.ports_info.append({'pci': pci_str, 'type': pci_id, 'intf':
> intf, 'mac': macaddr, 'ipv6': ipv6, 'numa': -1})
> +
> + def load_portconf(self):
> + """
> + Load port configurations for ports_info. If manually configured infor
> + not same as auto scanned, still use infor in configuration file.
> + """
> + for port in self.ports_info:
> + pci_bus = port['pci']
> + if pci_bus in self.conf.ports_cfg:
> + port_cfg = self.conf.ports_cfg[pci_bus]
> + port_cfg['source'] = 'cfg'
> + else:
> + port_cfg = {}
> +
> + for key in ['intf', 'mac', 'numa', 'peer']:
> + if key in port_cfg:
> + if key in port and port_cfg[key] != port[key]:
> + self.logger.warning("CONGGURED %s NOT SAME AS SCANNED!!!" % (key.upper()))
> + port[key] = port_cfg[key]
> diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
> index 3577eb7..8cb144f 100644
> --- a/framework/project_dpdk.py
> +++ b/framework/project_dpdk.py
> @@ -236,13 +236,10 @@ class DPDKdut(Dut):
> binding_list = '--bind=%s ' % driver
>
> current_nic = 0
> - for (pci_bus, pci_id) in self.pci_devices_info:
> - if dts.accepted_nic(pci_id):
> -
> - if nics_to_bind is None or current_nic in nics_to_bind:
> - binding_list += '%s ' % (pci_bus)
> -
> - current_nic += 1
> + for port_info in self.ports_info:
> + if nics_to_bind is None or current_nic in nics_to_bind:
> + binding_list += '%s ' % (port_info['pci'])
> + current_nic += 1
>
> self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# ')
>
> @@ -254,13 +251,10 @@ class DPDKdut(Dut):
> binding_list = '-u '
>
> current_nic = 0
> - for (pci_bus, pci_id) in self.pci_devices_info:
> - if dts.accepted_nic(pci_id):
> -
> - if nics_to_bind is None or current_nic in nics_to_bind:
> - binding_list += '%s ' % (pci_bus)
> -
> - current_nic += 1
> + for port_info in self.ports_info:
> + if nics_to_bind is None or current_nic in nics_to_bind:
> + binding_list += '%s ' % (port_info['pci'])
> + current_nic += 1
>
> self.send_expect('tools/dpdk_nic_bind.py %s' % binding_list, '# ', 30)
>
> diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py
> index 4306162..25f249a 100644
> --- a/framework/ssh_connection.py
> +++ b/framework/ssh_connection.py
> @@ -40,7 +40,7 @@ class SSHConnection(object):
> Implement send_expect/copy function upper SSHPexpet module.
> """
>
> - def __init__(self, host, session_name, password = ''):
> + def __init__(self, host, session_name, password=''):
> self.session = SSHPexpect(host, USERNAME, password)
> self.name = session_name
>
> diff --git a/framework/tester.py b/framework/tester.py
> index 0ebe29a..437d8c4 100644
> --- a/framework/tester.py
> +++ b/framework/tester.py
> @@ -133,7 +133,7 @@ class Tester(Crb):
> self.restore_interfaces()
> self.scan_ports()
> self.map_available_ports()
> - if self.ports_map == None or len(self.ports_map) == 0:
> + if self.ports_map is None or len(self.ports_map) == 0:
> raise ValueError("ports_map should not be empty, please check all links")
>
> def get_local_port(self, remotePort):
> @@ -179,6 +179,24 @@ class Tester(Crb):
> else:
> return 'down'
>
> + def restore_interfaces(self):
> + """
> + Restore Linux interfaces.
> + """
> + self.send_expect("modprobe igb", "# ", 20)
> + self.send_expect("modprobe ixgbe", "# ", 20)
> + self.send_expect("modprobe e1000e", "# ", 20)
> + self.send_expect("modprobe e1000", "# ", 20)
> +
> + try:
> + for (pci_bus, pci_id) in self.pci_devices_info:
> + addr_array = pci_bus.split(':')
> + itf = self.get_interface_name(addr_array[0], addr_array[1])
> + self.send_expect("ifconfig %s up" % itf, "# ")
> +
> + except Exception as e:
> + self.logger.error(" !!! Restore ITF: " + e.message)
> +
> def scan_ports(self):
> """
> Scan all ports on tester and save port's pci/mac/interface.
> @@ -262,6 +280,18 @@ class Tester(Crb):
> hits = [False] * len(self.ports_info)
>
> for dutPort in range(nrPorts):
> + peer = self.dut.get_peer_pci(dutPort)
> + if peer is not None:
> + for localPort in range(len(self.ports_info)):
> + if self.ports_info[localPort]['pci'] == peer:
> + hits[localPort] = True
> + self.ports_map[dutPort] = localPort
> + break
> + if self.ports_map[dutPort] == -1:
> + self.logger.error("CONFIGURED TESTER PORT CANNOT FOUND!!!")
> + else:
> + continue # skip ping6 map
> +
> for localPort in range(len(self.ports_info)):
> if hits[localPort]:
> continue
Acked-by: Michael Qiu <michael.qiu@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH v2 4/4] suites: remove nic type check from testsuites
2015-02-04 6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
` (2 preceding siblings ...)
2015-02-04 6:43 ` [dts] [PATCH v2 3/4] framework: reorganize DUT and Tester port initialize sequence Yong Liu
@ 2015-02-04 6:43 ` Yong Liu
2015-02-04 6:50 ` Qiu, Michael
2015-02-05 1:32 ` [dts] [PATCH v2 0/4] Support additional port configuration file Liu, Yong
2015-02-05 2:18 ` [dts] [PATCH] framework: add port config pci bus id check suites: seperated checksum_offload function and performance port requirements Yong Liu
5 siblings, 1 reply; 11+ messages in thread
From: Yong Liu @ 2015-02-04 6:43 UTC (permalink / raw)
To: dts
For all nic in execution file will be used for validation. There's
no need to check nic type in test suites.
Signed-off-by: Marvinliu <yong.liu@intel.com>
---
tests/TestSuite_blacklist.py | 2 +-
tests/TestSuite_checksum_offload.py | 2 +-
tests/TestSuite_fdir.py | 16 ++++++++--------
tests/TestSuite_ieee1588.py | 6 +++---
tests/TestSuite_ip_pipeline.py | 2 +-
tests/TestSuite_ipfrag.py | 2 +-
tests/TestSuite_jumboframes.py | 2 +-
tests/TestSuite_l2fwd.py | 2 +-
tests/TestSuite_l3fwd.py | 6 +++---
tests/TestSuite_link_flowctrl.py | 2 +-
tests/TestSuite_multiprocess.py | 2 +-
tests/TestSuite_pmd.py | 4 ++--
tests/TestSuite_pmd_bonded.py | 2 +-
tests/TestSuite_vlan.py | 3 +--
tests/TestSuite_whitelist.py | 2 +-
15 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/tests/TestSuite_blacklist.py b/tests/TestSuite_blacklist.py
index 65c1ec6..8e9debd 100644
--- a/tests/TestSuite_blacklist.py
+++ b/tests/TestSuite_blacklist.py
@@ -54,7 +54,7 @@ class TestBlacklist(TestCase):
Two Ports
"""
- self.ports = self.dut.get_ports(self.nic)
+ self.ports = self.dut.get_ports()
self.verify(len(self.ports) >= 2, "Insufficient ports for testing")
[arch, machine, self.env, toolchain] = self.target.split('-')
diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
index 1ebac0f..05438b2 100644
--- a/tests/TestSuite_checksum_offload.py
+++ b/tests/TestSuite_checksum_offload.py
@@ -54,7 +54,7 @@ class TestChecksumOffload(TestCase):
Checksum offload prerequisites.
"""
# Based on h/w type, choose how many ports to use
- self.dut_ports = self.dut.get_ports_performance(self.nic)
+ self.dut_ports = self.dut.get_ports_performance()
# Verify that enough ports are available
self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
diff --git a/tests/TestSuite_fdir.py b/tests/TestSuite_fdir.py
index a9f7fa3..1c8d8f7 100644
--- a/tests/TestSuite_fdir.py
+++ b/tests/TestSuite_fdir.py
@@ -48,7 +48,7 @@ class TestFdir(TestCase):
"""
Run at the start of each test suite.
"""
- ports = self.dut.get_ports(self.nic)
+ ports = self.dut.get_ports()
self.verify(len(ports) >= 2, "Not enough ports available")
self.pmdout = PmdOutput(self.dut)
@@ -81,7 +81,7 @@ class TestFdir(TestCase):
Setting memory reserved for FDir filters.
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
self.pmdout.start_testpmd("all", "--rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K")
out = self.dut.send_expect("show port fdir %s" % dutPorts[0], "testpmd>")
@@ -111,7 +111,7 @@ class TestFdir(TestCase):
- Send the ``p_udp`` packet with Scapy on the traffic generator and check that FDir information is printed
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
localPort = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(localPort)
@@ -173,7 +173,7 @@ class TestFdir(TestCase):
- Send the packet and validate the filter function.
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
localPort = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(localPort)
@@ -230,7 +230,7 @@ class TestFdir(TestCase):
- Send the packet and validate the perfect filter function.
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
localPort = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(localPort)
@@ -261,7 +261,7 @@ class TestFdir(TestCase):
fields, or parts of fields are used in the matching process.
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
localPort = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(localPort)
@@ -306,7 +306,7 @@ class TestFdir(TestCase):
to the bytes at offset 36 and 37, as the offset is in 2-byte units
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
localPort = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(localPort)
@@ -335,7 +335,7 @@ class TestFdir(TestCase):
FDir VLAN field filtering
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
localPort = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(localPort)
diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py
index c6fdd61..bf48188 100644
--- a/tests/TestSuite_ieee1588.py
+++ b/tests/TestSuite_ieee1588.py
@@ -52,7 +52,7 @@ class TestIeee1588(TestCase):
IEEE1588 Prerequisites
"""
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
self.verify(len(dutPorts) > 0, "No ports found for " + self.nic)
# Change the config file to support IEEE1588 and recompile the package.
@@ -82,7 +82,7 @@ class TestIeee1588(TestCase):
time.sleep(1) # Allow the output from the "start" command to finish before looking for a regexp in expect
# use the first port on that self.nic
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
port = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(port)
@@ -125,7 +125,7 @@ class TestIeee1588(TestCase):
time.sleep(3)
# use the first port on that self.nic
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
port = self.tester.get_local_port(dutPorts[0])
itf = self.tester.get_interface(port)
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index 7da393e..46fdc8d 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -297,7 +297,7 @@ class TestIPPipeline(TestCase):
"I217LM": 1,
"I218V": 1,
"I218LM": 1}
- self.dut_ports = self.dut.get_ports(self.nic)
+ self.dut_ports = self.dut.get_ports()
self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
"Insufficient ports for speed testing")
diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py
index 1f08c85..22a24a6 100644
--- a/tests/TestSuite_ipfrag.py
+++ b/tests/TestSuite_ipfrag.py
@@ -81,7 +81,7 @@ class TestIpfrag(TestCase):
"""
# Based on h/w type, choose how many ports to use
- ports = self.dut.get_ports(self.nic)
+ ports = self.dut.get_ports()
print ports
# Verify that enough ports are available
diff --git a/tests/TestSuite_jumboframes.py b/tests/TestSuite_jumboframes.py
index 2b862af..83b3427 100644
--- a/tests/TestSuite_jumboframes.py
+++ b/tests/TestSuite_jumboframes.py
@@ -113,7 +113,7 @@ class TestJumboframes(TestCase):
Prerequisite steps for each test suit.
"""
- self.dut_ports = self.dut.get_ports(self.nic)
+ self.dut_ports = self.dut.get_ports()
self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
self.rx_port = self.dut_ports[0]
self.tx_port = self.dut_ports[1]
diff --git a/tests/TestSuite_l2fwd.py b/tests/TestSuite_l2fwd.py
index b75163c..5c79cbf 100644
--- a/tests/TestSuite_l2fwd.py
+++ b/tests/TestSuite_l2fwd.py
@@ -83,7 +83,7 @@ class TestL2fwd(TestCase):
self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
HEADER_SIZE['udp']
- self.dut_ports = self.dut.get_ports_performance(self.nic)
+ self.dut_ports = self.dut.get_ports_performance()
self.verify(len(self.dut_ports) >= self.number_of_ports,
"Not enough ports for " + self.nic)
diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py
index f590a52..65fa6f7 100644
--- a/tests/TestSuite_l3fwd.py
+++ b/tests/TestSuite_l3fwd.py
@@ -309,9 +309,9 @@ class TestL3fwd(TestCase):
L3fwd Prerequisites
"""
# Based on h/w type, choose how many ports to use
- ports = self.dut.get_ports(self.nic, socket=1)
+ ports = self.dut.get_ports(socket=1)
if not ports:
- ports = self.dut.get_ports(self.nic, socket=0)
+ ports = self.dut.get_ports(socket=0)
# Verify that enough ports are available
self.verify(len(ports) >= 2, "Insufficient ports for speed testing")
@@ -473,7 +473,7 @@ class TestL3fwd(TestCase):
"""
# Based on h/w type, choose how many ports to use
- ports = self.dut.get_ports(self.nic)
+ ports = self.dut.get_ports()
# Verify that enough ports are available
self.verify(len(ports) >= 4, "Insufficient ports for speed testing")
diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py
index 3c195c9..e52f95a 100644
--- a/tests/TestSuite_link_flowctrl.py
+++ b/tests/TestSuite_link_flowctrl.py
@@ -64,7 +64,7 @@ class TestLinkFlowctrl(TestCase):
Link flow control Prerequisites
"""
- self.dutPorts = self.dut.get_ports(self.nic)
+ self.dutPorts = self.dut.get_ports()
self.verify(len(self.dutPorts) > 1, "Insuficient ports")
self.rx_port = self.dutPorts[0]
diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index 2c8eeba..4ef5313 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -191,7 +191,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
"""
self.dut.kill_all()
self.dut.send_expect("fg", "# ")
- dutPorts = self.dut.get_ports(self.nic)
+ dutPorts = self.dut.get_ports()
txPort = self.tester.get_local_port(dutPorts[0])
rxPort = self.tester.get_local_port(dutPorts[1])
mac = self.tester.get_mac(txPort)
diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index b88352f..c5b7e3b 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -108,7 +108,7 @@ class TestPmd(TestCase):
"NIC Unsupported: " + str(self.nic))
# Based on h/w type, choose how many ports to use
- self.dut_ports = self.dut.get_ports(self.nic)
+ self.dut_ports = self.dut.get_ports()
# Verify that enough ports are available
self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
@@ -166,7 +166,7 @@ class TestPmd(TestCase):
queues = 1
core_mask = dts.create_mask(core_list)
- port_mask = dts.create_mask(self.dut.get_ports(self.nic))
+ port_mask = dts.create_mask(self.dut.get_ports())
self.pmdout.start_testpmd("all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask))
diff --git a/tests/TestSuite_pmd_bonded.py b/tests/TestSuite_pmd_bonded.py
index e8e61dd..fd15c1d 100644
--- a/tests/TestSuite_pmd_bonded.py
+++ b/tests/TestSuite_pmd_bonded.py
@@ -792,7 +792,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
self.ip_head_size = 20
self.udp_header_size = 8
- self.dut_ports = self.dut.get_ports(self.nic)
+ self.dut_ports = self.dut.get_ports()
self.port_mask = dts.create_mask(self.dut_ports)
diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py
index e9813f3..66dc4f3 100644
--- a/tests/TestSuite_vlan.py
+++ b/tests/TestSuite_vlan.py
@@ -53,12 +53,11 @@ class TestVlan(TestCase):
"""
# Based on h/w type, choose how many ports to use
- ports = self.dut.get_ports(self.nic)
+ ports = self.dut.get_ports()
# Verify that enough ports are available
self.verify(len(ports) >= 2, "Insufficient ports")
- ports = self.dut.get_ports(self.nic)
global valports
valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
diff --git a/tests/TestSuite_whitelist.py b/tests/TestSuite_whitelist.py
index a32251d..aedae40 100644
--- a/tests/TestSuite_whitelist.py
+++ b/tests/TestSuite_whitelist.py
@@ -55,7 +55,7 @@ class TestWhitelist(TestCase):
self.frames_to_send = 1
# Based on h/w type, choose how many ports to use
- self.dutPorts = self.dut.get_ports(self.nic)
+ self.dutPorts = self.dut.get_ports()
# Verify that enough ports are available
self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dts] [PATCH v2 4/4] suites: remove nic type check from testsuites
2015-02-04 6:43 ` [dts] [PATCH v2 4/4] suites: remove nic type check from testsuites Yong Liu
@ 2015-02-04 6:50 ` Qiu, Michael
0 siblings, 0 replies; 11+ messages in thread
From: Qiu, Michael @ 2015-02-04 6:50 UTC (permalink / raw)
To: Liu, Yong, dts
On 2/4/2015 2:44 PM, Yong Liu wrote:
> For all nic in execution file will be used for validation. There's
> no need to check nic type in test suites.
>
> Signed-off-by: Marvinliu <yong.liu@intel.com>
> ---
> tests/TestSuite_blacklist.py | 2 +-
> tests/TestSuite_checksum_offload.py | 2 +-
> tests/TestSuite_fdir.py | 16 ++++++++--------
> tests/TestSuite_ieee1588.py | 6 +++---
> tests/TestSuite_ip_pipeline.py | 2 +-
> tests/TestSuite_ipfrag.py | 2 +-
> tests/TestSuite_jumboframes.py | 2 +-
> tests/TestSuite_l2fwd.py | 2 +-
> tests/TestSuite_l3fwd.py | 6 +++---
> tests/TestSuite_link_flowctrl.py | 2 +-
> tests/TestSuite_multiprocess.py | 2 +-
> tests/TestSuite_pmd.py | 4 ++--
> tests/TestSuite_pmd_bonded.py | 2 +-
> tests/TestSuite_vlan.py | 3 +--
> tests/TestSuite_whitelist.py | 2 +-
> 15 files changed, 27 insertions(+), 28 deletions(-)
>
> diff --git a/tests/TestSuite_blacklist.py b/tests/TestSuite_blacklist.py
> index 65c1ec6..8e9debd 100644
> --- a/tests/TestSuite_blacklist.py
> +++ b/tests/TestSuite_blacklist.py
> @@ -54,7 +54,7 @@ class TestBlacklist(TestCase):
> Two Ports
> """
>
> - self.ports = self.dut.get_ports(self.nic)
> + self.ports = self.dut.get_ports()
> self.verify(len(self.ports) >= 2, "Insufficient ports for testing")
> [arch, machine, self.env, toolchain] = self.target.split('-')
>
> diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
> index 1ebac0f..05438b2 100644
> --- a/tests/TestSuite_checksum_offload.py
> +++ b/tests/TestSuite_checksum_offload.py
> @@ -54,7 +54,7 @@ class TestChecksumOffload(TestCase):
> Checksum offload prerequisites.
> """
> # Based on h/w type, choose how many ports to use
> - self.dut_ports = self.dut.get_ports_performance(self.nic)
> + self.dut_ports = self.dut.get_ports_performance()
>
> # Verify that enough ports are available
> self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
> diff --git a/tests/TestSuite_fdir.py b/tests/TestSuite_fdir.py
> index a9f7fa3..1c8d8f7 100644
> --- a/tests/TestSuite_fdir.py
> +++ b/tests/TestSuite_fdir.py
> @@ -48,7 +48,7 @@ class TestFdir(TestCase):
> """
> Run at the start of each test suite.
> """
> - ports = self.dut.get_ports(self.nic)
> + ports = self.dut.get_ports()
> self.verify(len(ports) >= 2, "Not enough ports available")
>
> self.pmdout = PmdOutput(self.dut)
> @@ -81,7 +81,7 @@ class TestFdir(TestCase):
> Setting memory reserved for FDir filters.
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
>
> self.pmdout.start_testpmd("all", "--rxq=2 --txq=2 --disable-rss --pkt-filter-mode=perfect --pkt-filter-size=64K")
> out = self.dut.send_expect("show port fdir %s" % dutPorts[0], "testpmd>")
> @@ -111,7 +111,7 @@ class TestFdir(TestCase):
> - Send the ``p_udp`` packet with Scapy on the traffic generator and check that FDir information is printed
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> localPort = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(localPort)
>
> @@ -173,7 +173,7 @@ class TestFdir(TestCase):
> - Send the packet and validate the filter function.
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> localPort = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(localPort)
>
> @@ -230,7 +230,7 @@ class TestFdir(TestCase):
> - Send the packet and validate the perfect filter function.
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> localPort = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(localPort)
>
> @@ -261,7 +261,7 @@ class TestFdir(TestCase):
> fields, or parts of fields are used in the matching process.
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> localPort = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(localPort)
>
> @@ -306,7 +306,7 @@ class TestFdir(TestCase):
> to the bytes at offset 36 and 37, as the offset is in 2-byte units
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> localPort = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(localPort)
>
> @@ -335,7 +335,7 @@ class TestFdir(TestCase):
> FDir VLAN field filtering
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> localPort = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(localPort)
>
> diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py
> index c6fdd61..bf48188 100644
> --- a/tests/TestSuite_ieee1588.py
> +++ b/tests/TestSuite_ieee1588.py
> @@ -52,7 +52,7 @@ class TestIeee1588(TestCase):
> IEEE1588 Prerequisites
> """
>
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> self.verify(len(dutPorts) > 0, "No ports found for " + self.nic)
>
> # Change the config file to support IEEE1588 and recompile the package.
> @@ -82,7 +82,7 @@ class TestIeee1588(TestCase):
> time.sleep(1) # Allow the output from the "start" command to finish before looking for a regexp in expect
>
> # use the first port on that self.nic
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> port = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(port)
>
> @@ -125,7 +125,7 @@ class TestIeee1588(TestCase):
> time.sleep(3)
>
> # use the first port on that self.nic
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> port = self.tester.get_local_port(dutPorts[0])
> itf = self.tester.get_interface(port)
>
> diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
> index 7da393e..46fdc8d 100644
> --- a/tests/TestSuite_ip_pipeline.py
> +++ b/tests/TestSuite_ip_pipeline.py
> @@ -297,7 +297,7 @@ class TestIPPipeline(TestCase):
> "I217LM": 1,
> "I218V": 1,
> "I218LM": 1}
> - self.dut_ports = self.dut.get_ports(self.nic)
> + self.dut_ports = self.dut.get_ports()
> self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> "Insufficient ports for speed testing")
>
> diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py
> index 1f08c85..22a24a6 100644
> --- a/tests/TestSuite_ipfrag.py
> +++ b/tests/TestSuite_ipfrag.py
> @@ -81,7 +81,7 @@ class TestIpfrag(TestCase):
> """
>
> # Based on h/w type, choose how many ports to use
> - ports = self.dut.get_ports(self.nic)
> + ports = self.dut.get_ports()
> print ports
>
> # Verify that enough ports are available
> diff --git a/tests/TestSuite_jumboframes.py b/tests/TestSuite_jumboframes.py
> index 2b862af..83b3427 100644
> --- a/tests/TestSuite_jumboframes.py
> +++ b/tests/TestSuite_jumboframes.py
> @@ -113,7 +113,7 @@ class TestJumboframes(TestCase):
> Prerequisite steps for each test suit.
> """
>
> - self.dut_ports = self.dut.get_ports(self.nic)
> + self.dut_ports = self.dut.get_ports()
> self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
> self.rx_port = self.dut_ports[0]
> self.tx_port = self.dut_ports[1]
> diff --git a/tests/TestSuite_l2fwd.py b/tests/TestSuite_l2fwd.py
> index b75163c..5c79cbf 100644
> --- a/tests/TestSuite_l2fwd.py
> +++ b/tests/TestSuite_l2fwd.py
> @@ -83,7 +83,7 @@ class TestL2fwd(TestCase):
> self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE['ip'] + \
> HEADER_SIZE['udp']
>
> - self.dut_ports = self.dut.get_ports_performance(self.nic)
> + self.dut_ports = self.dut.get_ports_performance()
>
> self.verify(len(self.dut_ports) >= self.number_of_ports,
> "Not enough ports for " + self.nic)
> diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py
> index f590a52..65fa6f7 100644
> --- a/tests/TestSuite_l3fwd.py
> +++ b/tests/TestSuite_l3fwd.py
> @@ -309,9 +309,9 @@ class TestL3fwd(TestCase):
> L3fwd Prerequisites
> """
> # Based on h/w type, choose how many ports to use
> - ports = self.dut.get_ports(self.nic, socket=1)
> + ports = self.dut.get_ports(socket=1)
> if not ports:
> - ports = self.dut.get_ports(self.nic, socket=0)
> + ports = self.dut.get_ports(socket=0)
>
> # Verify that enough ports are available
> self.verify(len(ports) >= 2, "Insufficient ports for speed testing")
> @@ -473,7 +473,7 @@ class TestL3fwd(TestCase):
> """
>
> # Based on h/w type, choose how many ports to use
> - ports = self.dut.get_ports(self.nic)
> + ports = self.dut.get_ports()
> # Verify that enough ports are available
> self.verify(len(ports) >= 4, "Insufficient ports for speed testing")
>
> diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py
> index 3c195c9..e52f95a 100644
> --- a/tests/TestSuite_link_flowctrl.py
> +++ b/tests/TestSuite_link_flowctrl.py
> @@ -64,7 +64,7 @@ class TestLinkFlowctrl(TestCase):
> Link flow control Prerequisites
> """
>
> - self.dutPorts = self.dut.get_ports(self.nic)
> + self.dutPorts = self.dut.get_ports()
> self.verify(len(self.dutPorts) > 1, "Insuficient ports")
>
> self.rx_port = self.dutPorts[0]
> diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
> index 2c8eeba..4ef5313 100644
> --- a/tests/TestSuite_multiprocess.py
> +++ b/tests/TestSuite_multiprocess.py
> @@ -191,7 +191,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
> """
> self.dut.kill_all()
> self.dut.send_expect("fg", "# ")
> - dutPorts = self.dut.get_ports(self.nic)
> + dutPorts = self.dut.get_ports()
> txPort = self.tester.get_local_port(dutPorts[0])
> rxPort = self.tester.get_local_port(dutPorts[1])
> mac = self.tester.get_mac(txPort)
> diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
> index b88352f..c5b7e3b 100644
> --- a/tests/TestSuite_pmd.py
> +++ b/tests/TestSuite_pmd.py
> @@ -108,7 +108,7 @@ class TestPmd(TestCase):
> "NIC Unsupported: " + str(self.nic))
>
> # Based on h/w type, choose how many ports to use
> - self.dut_ports = self.dut.get_ports(self.nic)
> + self.dut_ports = self.dut.get_ports()
>
> # Verify that enough ports are available
> self.verify(len(self.dut_ports) >= self.needed_ports[self.nic],
> @@ -166,7 +166,7 @@ class TestPmd(TestCase):
> queues = 1
>
> core_mask = dts.create_mask(core_list)
> - port_mask = dts.create_mask(self.dut.get_ports(self.nic))
> + port_mask = dts.create_mask(self.dut.get_ports())
>
> self.pmdout.start_testpmd("all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask))
>
> diff --git a/tests/TestSuite_pmd_bonded.py b/tests/TestSuite_pmd_bonded.py
> index e8e61dd..fd15c1d 100644
> --- a/tests/TestSuite_pmd_bonded.py
> +++ b/tests/TestSuite_pmd_bonded.py
> @@ -792,7 +792,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
> self.ip_head_size = 20
> self.udp_header_size = 8
>
> - self.dut_ports = self.dut.get_ports(self.nic)
> + self.dut_ports = self.dut.get_ports()
>
> self.port_mask = dts.create_mask(self.dut_ports)
>
> diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py
> index e9813f3..66dc4f3 100644
> --- a/tests/TestSuite_vlan.py
> +++ b/tests/TestSuite_vlan.py
> @@ -53,12 +53,11 @@ class TestVlan(TestCase):
> """
>
> # Based on h/w type, choose how many ports to use
> - ports = self.dut.get_ports(self.nic)
> + ports = self.dut.get_ports()
>
> # Verify that enough ports are available
> self.verify(len(ports) >= 2, "Insufficient ports")
>
> - ports = self.dut.get_ports(self.nic)
> global valports
> valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
>
> diff --git a/tests/TestSuite_whitelist.py b/tests/TestSuite_whitelist.py
> index a32251d..aedae40 100644
> --- a/tests/TestSuite_whitelist.py
> +++ b/tests/TestSuite_whitelist.py
> @@ -55,7 +55,7 @@ class TestWhitelist(TestCase):
> self.frames_to_send = 1
>
> # Based on h/w type, choose how many ports to use
> - self.dutPorts = self.dut.get_ports(self.nic)
> + self.dutPorts = self.dut.get_ports()
>
> # Verify that enough ports are available
> self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
Acked-by: Michael Qiu <michael.qiu@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dts] [PATCH v2 0/4] Support additional port configuration file
2015-02-04 6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
` (3 preceding siblings ...)
2015-02-04 6:43 ` [dts] [PATCH v2 4/4] suites: remove nic type check from testsuites Yong Liu
@ 2015-02-05 1:32 ` Liu, Yong
2015-02-05 2:18 ` [dts] [PATCH] framework: add port config pci bus id check suites: seperated checksum_offload function and performance port requirements Yong Liu
5 siblings, 0 replies; 11+ messages in thread
From: Liu, Yong @ 2015-02-05 1:32 UTC (permalink / raw)
To: dts
Applied in next branch, will be merged into master branch after fully tested.
> -----Original Message-----
> From: Liu, Yong
> Sent: Wednesday, February 04, 2015 2:44 PM
> To: dts@dpdk.org
> Cc: Liu, Yong
> Subject: [PATCH v2 0/4] Support additional port configuration file
>
> This patch set will implement new module to support additional port config
> file. In port config file, users can specified NICs' macaddress, interface,
> numa id or peer tester pci device. Thus will support users deploy their
> own
> NIC validation even their NICs not supported in kernel.
>
> In this patch set, DUT and Tester port initialize sequence will also be
> reorganized. Now DUT port initialization sequence will be
> scan,restore,rescan,
> check with port config. Tester port initialization will only make sure all
> interface up.
>
> This patch now only support Linux OS, will implement in FreeBSD later.
>
> v2 changes:
> * Uniform load port conf function.
> * Inform user that NIC driver not found in DTS.
> * Fix bug port numa not cover to integer.
>
> Yong Liu (4):
> framework: add new module for load port configuration file
> framework: execuction file support port config nic_type
> framework: reorganize DUT and Tester port initialize sequence
> suites: remove nic type check from testsuites
>
> conf/ports.cfg | 9 ++
> execution.cfg | 2 +-
> framework/config.py | 96 ++++++++++++++++++++
> framework/crb.py | 66 ++++----------
> framework/dts.py | 62 +++++++------
> framework/dut.py | 172 +++++++++++++++++++++++++------
> -----
> framework/project_dpdk.py | 22 ++---
> framework/ssh_connection.py | 2 +-
> framework/tester.py | 32 ++++++-
> tests/TestSuite_blacklist.py | 2 +-
> tests/TestSuite_checksum_offload.py | 2 +-
> tests/TestSuite_fdir.py | 16 ++--
> tests/TestSuite_ieee1588.py | 6 +-
> tests/TestSuite_ip_pipeline.py | 2 +-
> tests/TestSuite_ipfrag.py | 2 +-
> tests/TestSuite_jumboframes.py | 2 +-
> tests/TestSuite_l2fwd.py | 2 +-
> tests/TestSuite_l3fwd.py | 6 +-
> tests/TestSuite_link_flowctrl.py | 2 +-
> tests/TestSuite_multiprocess.py | 2 +-
> tests/TestSuite_pmd.py | 4 +-
> tests/TestSuite_pmd_bonded.py | 2 +-
> tests/TestSuite_vlan.py | 3 +-
> tests/TestSuite_whitelist.py | 2 +-
> 24 files changed, 345 insertions(+), 173 deletions(-)
> create mode 100644 conf/ports.cfg
> create mode 100755 framework/config.py
>
> --
> 1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH] framework: add port config pci bus id check suites: seperated checksum_offload function and performance port requirements
2015-02-04 6:43 [dts] [PATCH v2 0/4] Support additional port configuration file Yong Liu
` (4 preceding siblings ...)
2015-02-05 1:32 ` [dts] [PATCH v2 0/4] Support additional port configuration file Liu, Yong
@ 2015-02-05 2:18 ` Yong Liu
5 siblings, 0 replies; 11+ messages in thread
From: Yong Liu @ 2015-02-05 2:18 UTC (permalink / raw)
To: dts
Signed-off-by: Marvinliu <yong.liu@intel.com>
---
conf/ports.cfg | 2 +-
framework/config.py | 16 ++++++++++++++--
framework/dut.py | 5 +++--
tests/TestSuite_checksum_offload.py | 6 +++++-
4 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/conf/ports.cfg b/conf/ports.cfg
index 55e26d8..eb2cb34 100644
--- a/conf/ports.cfg
+++ b/conf/ports.cfg
@@ -5,5 +5,5 @@
# pci=Pci BDF,mac=Mac address,peer=Tester Pci BDF,numa=Port Numa
[DUT IP]
ports =
- pci=XX:XX.X,intf=eth0
+ pci=XX:XX.X,intf=eth0;
pci=YY:YY.Y,mac=XX:XX:XX:XX:XX:XX,peer=ZZ:ZZ.Z,numa=0
diff --git a/framework/config.py b/framework/config.py
index dc4f944..af014a8 100755
--- a/framework/config.py
+++ b/framework/config.py
@@ -33,6 +33,7 @@
Generic port and crbs configuration file load function
"""
+import re
import ConfigParser # config parse module
import argparse # prase arguments module
@@ -46,6 +47,7 @@ class UserConf():
self.port_config = port_conf
self.crb_config = crb_conf
self.ports_cfg = {}
+ self.pci_regex = "([\da-f]{2}:[\da-f]{2}.\d{1})$"
try:
self.port_conf = ConfigParser.SafeConfigParser()
self.port_conf.read(self.port_config)
@@ -61,20 +63,30 @@ class UserConf():
for port in self.port_conf.get(crb, 'ports').split(';')]
for port in ports:
- port_cfg = self.parse_port_param(port)
+ port_cfg = self.__parse_port_param(port)
+ # check pci BDF validity
if 'pci' not in port_cfg:
+ print "NOT FOUND CONFIG FOR NO PCI ADDRESS!!!"
+ continue
+ m = re.match(self.pci_regex, port_cfg['pci'])
+ if m is None:
print "INVALID CONFIG FOR NO PCI ADDRESS!!!"
+ continue
+
keys = port_cfg.keys()
keys.remove('pci')
self.ports_cfg[port_cfg['pci']] = {key: port_cfg[key] for key in keys}
+ def get_ports_config(self):
+ return self.ports_cfg
+
def check_port_available(self, pci_addr):
if pci_addr in self.ports_cfg.keys():
return True
else:
return False
- def parse_port_param(self, port):
+ def __parse_port_param(self, port):
portDict = dict()
for param in port.split(','):
diff --git a/framework/dut.py b/framework/dut.py
index cddc248..e095d86 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -562,8 +562,9 @@ class Dut(Crb):
"""
for port in self.ports_info:
pci_bus = port['pci']
- if pci_bus in self.conf.ports_cfg:
- port_cfg = self.conf.ports_cfg[pci_bus]
+ ports_cfg = self.conf.get_ports_config()
+ if pci_bus in ports_cfg:
+ port_cfg = ports_cfg[pci_bus]
port_cfg['source'] = 'cfg'
else:
port_cfg = {}
diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
index 05438b2..e353aaa 100644
--- a/tests/TestSuite_checksum_offload.py
+++ b/tests/TestSuite_checksum_offload.py
@@ -54,7 +54,7 @@ class TestChecksumOffload(TestCase):
Checksum offload prerequisites.
"""
# Based on h/w type, choose how many ports to use
- self.dut_ports = self.dut.get_ports_performance()
+ self.dut_ports = self.dut.get_ports()
# Verify that enough ports are available
self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
@@ -297,6 +297,10 @@ class TestChecksumOffload(TestCase):
"""
Test checksum offload performance.
"""
+ self.dut_ports = self.dut.get_ports_performance()
+ # Verify that enough ports are available
+ self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
+
# sizes = [64, 128, 256, 512, 1024]
sizes = [64, 128]
pkts = {
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread