* [dts] [PATCH 0/9] optimize overall execution process
@ 2016-08-04 5:38 Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 1/9] framework dts: optimize " Marvin Liu
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts
This patch set will try to decouple of each module in DTS. Most of cases
execution logic will be handled in test_case module. Add support for global
settings.
Marvin Liu (9):
framework dts: optimize execution process
framework config: add concept for dut board
framework dut: remove dependency on dts module
framework rst: add class to handle RST report
framework settings: support global setting load and save
framework test_result: add class to handle result
framework test_case: add test case handle logic
framework utils: move shared function from dts module
tests: remove dependencies of dts module
framework/config.py | 4 +-
framework/crb.py | 1 -
framework/debugger.py | 16 +-
framework/dts.py | 599 +++++----------------
framework/dut.py | 40 +-
framework/etgen.py | 20 +-
framework/plotting.py | 9 +-
framework/pmd_output.py | 4 +-
framework/project_dpdk.py | 48 +-
framework/qemu_libvirt.py | 8 +-
framework/rst.py | 200 +++----
framework/settings.py | 92 +++-
framework/test_case.py | 258 ++++++++-
framework/test_result.py | 63 ++-
framework/tester.py | 4 +-
framework/utils.py | 30 ++
framework/virt_base.py | 16 +-
framework/virt_dut.py | 8 +-
framework/virt_scene.py | 29 +-
tests/TestSuite_blacklist.py | 6 +-
tests/TestSuite_checksum_offload.py | 12 +-
tests/TestSuite_cloud_filter.py | 1 -
tests/TestSuite_cmdline.py | 5 +-
tests/TestSuite_coremask.py | 8 +-
tests/TestSuite_dual_vlan.py | 6 +-
tests/TestSuite_dynamic_config.py | 40 +-
tests/TestSuite_fdir.py | 52 +-
tests/TestSuite_fm10k_perf.py | 38 +-
.../TestSuite_fortville_rss_granularity_config.py | 116 ++--
tests/TestSuite_generic_filter.py | 12 +-
tests/TestSuite_hello_world.py | 6 +-
tests/TestSuite_ieee1588.py | 4 +-
tests/TestSuite_ip_pipeline.py | 8 +-
tests/TestSuite_ipfrag.py | 22 +-
tests/TestSuite_ipv4_reassembly.py | 6 +-
tests/TestSuite_jumboframes.py | 8 +-
tests/TestSuite_kni.py | 50 +-
tests/TestSuite_l2fwd.py | 25 +-
tests/TestSuite_l3fwd.py | 61 ++-
tests/TestSuite_l3fwd_em.py | 16 +-
tests/TestSuite_link_flowctrl.py | 4 +-
tests/TestSuite_link_status_interrupt.py | 22 +-
tests/TestSuite_mac_filter.py | 18 +-
tests/TestSuite_multiprocess.py | 26 +-
tests/TestSuite_netmap_compat.py | 4 +-
tests/TestSuite_nvgre.py | 26 +-
tests/TestSuite_pmd.py | 38 +-
tests/TestSuite_pmd_bonded.py | 10 +-
tests/TestSuite_pmdpcap.py | 6 +-
tests/TestSuite_pmdrss_hash.py | 14 +-
tests/TestSuite_pmdrssreta.py | 12 +-
tests/TestSuite_queue_start_stop.py | 1 -
tests/TestSuite_quota_watermark.py | 22 +-
tests/TestSuite_rxtx_callbacks.py | 4 +-
tests/TestSuite_scatter.py | 1 -
tests/TestSuite_short_live.py | 1 -
tests/TestSuite_shutdown_api.py | 37 +-
tests/TestSuite_skeleton.py | 4 +-
tests/TestSuite_sriov_kvm.py | 1 -
tests/TestSuite_sriov_live_migration.py | 6 +-
tests/TestSuite_timer.py | 6 +-
tests/TestSuite_tso.py | 24 +-
tests/TestSuite_uni_pkt.py | 8 +-
tests/TestSuite_unit_tests_eal.py | 4 +-
tests/TestSuite_unit_tests_pmd_perf.py | 8 +-
tests/TestSuite_userspace_ethtool.py | 8 +-
tests/TestSuite_vf_jumboframe.py | 4 +-
tests/TestSuite_vf_macfilter.py | 1 -
tests/TestSuite_vf_offload.py | 6 +-
tests/TestSuite_vf_packet_rxtx.py | 1 -
tests/TestSuite_vf_port_start_stop.py | 1 -
tests/TestSuite_vf_rss.py | 7 +-
tests/TestSuite_vf_to_vf_nic_bridge.py | 10 +-
tests/TestSuite_vf_vlan.py | 1 -
tests/TestSuite_vhost_cuse_one_copy_one_vm.py | 14 +-
tests/TestSuite_vhost_user_live_migration.py | 1 -
tests/TestSuite_vhost_user_one_copy_one_vm.py | 14 +-
tests/TestSuite_virtio_iperf.py | 24 +-
tests/TestSuite_vlan.py | 8 +-
tests/TestSuite_vm_power_manager.py | 26 +-
tests/TestSuite_vmdq.py | 24 +-
tests/TestSuite_vxlan.py | 28 +-
tests/TestSuite_vxlan_sample.py | 42 +-
83 files changed, 1261 insertions(+), 1217 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 1/9] framework dts: optimize execution process
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 2/9] framework config: add concept for dut board Marvin Liu
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Optimize overall execution process, decouple depencies between framework
modules. Detail information as listed.
1. Remove most of global variables
2. Move suite/case exception handler to test_case module
3. Save global setting in enviornment which can share easily
4. Move result object to test_case module
5. Remove scenario for all VF functions covered by separated suite
6. Move some shared functions to utils and setting module
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/dts.py b/framework/dts.py
index d7e7927..6077a04 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -1,6 +1,6 @@
# BSD LICENSE
#
-# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -43,129 +43,79 @@ import copy # copy module for duplicate variable
import rst # rst file support
import sys # system module
-from settings import FOLDERS, NICS, LOG_NAME_SEP
+import settings # dts settings
from tester import Tester
from dut import Dut
from serializer import Serializer
-from exception import VerifyFailure
from test_case import TestCase
from test_result import Result
from stats_reporter import StatsReporter
from excel_reporter import ExcelReporter
-from utils import *
+import utils
from exception import TimeoutException, ConfigParseException, VerifyFailure
from logger import getLogger
import logger
import debugger
-from virt_scene import VirtScene
from config import CrbsConf
-from checkCase import *
+from checkCase import parse_file, check_case_skip, check_case_support
+from utils import get_subclasses, copy_instance_attr
import sys
reload(sys)
sys.setdefaultencoding('UTF8')
-PROJECT_MODULE_PREFIX = 'project_'
-debug_mode = False
-debug_case = False
config = None
-table = None
-results_table_rows = []
-results_table_header = []
-performance_only = False
-functional_only = False
-nic = None
-rx_mode = None
requested_tests = None
-dut = None
-duts = []
-virtduts = []
-tester = None
result = None
excel_report = None
-stats = None
+stats_report = None
log_handler = None
-module = None
-Package = ''
-Patches = []
-drivername = ""
-interrupttypr = ""
-dts_commands = []
-
-
-def report(text, frame=False, annex=False):
- """
- Save report text into rst file.
- """
- if frame:
- rst.write_frame(text, annex)
- else:
- rst.write_text(text, annex)
-
-
-def close_all_sessions():
- """
- Close session to DUT and tester.
- """
- # close all nics
- for dutobj in duts:
- if getattr(dutobj, 'ports_info', None) and dutobj.ports_info:
- for port_info in dutobj.ports_info:
- netdev = port_info['port']
- netdev.close()
- # close all session
- dutobj.close()
- if tester is not None:
- tester.close()
- log_handler.info("DTS ended")
-
-
-def get_crb_os(crb):
- if 'OS' in crb:
- return crb['OS']
-
- return 'linux'
def dts_parse_param(section):
"""
Parse execution file parameters.
"""
- global performance_only
- global functional_only
- global paramDict
- global drivername
- performance_only = False
- functional_only = False
+ # default value
+ performance = False
+ functional = False
# Set parameters
parameters = config.get(section, 'parameters').split(':')
drivername = config.get(section, 'drivername').split('=')[-1]
+
+ settings.save_global_setting(settings.HOST_DRIVER_SETTING, drivername)
+
paramDict = dict()
for param in parameters:
(key, _, value) = param.partition('=')
paramDict[key] = value
if 'perf' in paramDict and paramDict['perf'] == 'true':
- performance_only = True
+ performance = True
if 'func' in paramDict and paramDict['func'] == 'true':
- functional_only = True
+ functional = True
- if not functional_only and not performance_only:
- functional_only = True
+ if 'nic_type' not in paramDict:
+ paramDict['nic_type'] = 'any'
+
+ settings.save_global_setting(settings.HOST_NIC_SETTING, paramDict['nic_type'])
+
+ # save perf/funtion setting in enviornment
+ if performance:
+ settings.save_global_setting(settings.PERF_SETTING, 'yes')
+ else:
+ settings.save_global_setting(settings.PERF_SETTING, 'no')
+
+ if functional:
+ settings.save_global_setting(settings.FUNC_SETTING, 'yes')
+ else:
+ settings.save_global_setting(settings.FUNC_SETTING, 'no')
def dts_parse_config(section):
"""
Parse execution file configuration.
"""
- try:
- scenario = config.get(section, 'scenario')
- except:
- scenario = ''
-
- global nic
- global rx_mode
-
duts = [dut_.strip() for dut_ in config.get(section,
'crbs').split(',')]
targets = [target.strip()
@@ -175,30 +125,31 @@ def dts_parse_config(section):
try:
rx_mode = config.get(section, 'rx_mode').strip()
except:
- rx_mode = None
+ rx_mode = 'default'
+
+ settings.save_global_setting(settings.DPDK_RXMODE_SETTING, rx_mode)
for suite in test_suites:
if suite == '':
test_suites.remove(suite)
- nic = [_.strip() for _ in paramDict['nic_type'].split(',')][0]
-
- return duts, targets, test_suites, nic, scenario
+ return duts, targets, test_suites
def dts_parse_commands(commands):
"""
Parse command information from dts arguments
"""
+ dts_commands = []
+
if commands is None:
- return
+ return dts_commands
args_format = {"shell": 0,
"crb": 1,
"stage": 2,
"check": 3,
"max_num": 4}
- global dts_commands
cmd_fmt = r"\[(.*)\]"
for command in commands:
@@ -234,12 +185,13 @@ def dts_parse_commands(commands):
dts_commands.append(dts_command)
+ return dts_commands
+
-def dts_run_commands(crb):
+def dts_run_commands(crb, dts_commands):
"""
Run dts input commands
"""
- global dts_commands
for dts_command in dts_commands:
command = dts_command['command']
if crb.NAME == dts_command['host']:
@@ -255,8 +207,8 @@ def get_project_obj(project_name, super_class, crbInst, serializer):
"""
Load project module and return crb instance.
"""
- global PROJECT_MODULE_PREFIX
project_obj = None
+ PROJECT_MODULE_PREFIX = 'project_'
try:
project_module = __import__(PROJECT_MODULE_PREFIX + project_name)
@@ -271,12 +223,10 @@ def get_project_obj(project_name, super_class, crbInst, serializer):
return project_obj
-def dts_log_testsuite(test_suite, log_handler, test_classname):
+def dts_log_testsuite(duts, tester, suite_obj, log_handler, test_classname):
"""
Change to SUITE self logger handler.
"""
- test_suite.logger = getLogger(test_classname)
- test_suite.logger.config_suite(test_classname)
log_handler.config_suite(test_classname, 'dts')
tester.logger.config_suite(test_classname, 'tester')
@@ -284,10 +234,6 @@ def dts_log_testsuite(test_suite, log_handler, test_classname):
dutobj.logger.config_suite(test_classname, 'dut')
dutobj.test_classname = test_classname
- if len(virtduts):
- for crb in virtduts:
- crb.logger.config_suite(test_classname, 'virtdut')
-
try:
if tester.it_uses_external_generator():
getattr(tester, 'ixia_packet_gen')
@@ -296,7 +242,7 @@ def dts_log_testsuite(test_suite, log_handler, test_classname):
pass
-def dts_log_execution(log_handler):
+def dts_log_execution(duts, tester, log_handler):
"""
Change to DTS default logger handler.
"""
@@ -304,11 +250,8 @@ def dts_log_execution(log_handler):
tester.logger.config_execution('tester')
for dutobj in duts:
- dutobj.logger.config_execution('dut' + LOG_NAME_SEP + '%s' % dutobj.crb['My IP'])
+ dutobj.logger.config_execution('dut' + settings.LOG_NAME_SEP + '%s' % dutobj.crb['My IP'])
- if len(virtduts):
- for crb in virtduts:
- crb.logger.config_execution('virtdut')
try:
if tester.it_uses_external_generator():
getattr(tester, 'ixia_packet_gen')
@@ -317,14 +260,13 @@ def dts_log_execution(log_handler):
pass
-def dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, nic, virttype):
+def dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, serializer, virttype):
"""
Create dts dut/tester instance and initialize them.
"""
- global dut
- global duts
- global tester
- serializer.set_serialized_filename(FOLDERS['Output'] +
+ duts = []
+
+ serializer.set_serialized_filename(settings.FOLDERS['Output'] +
'/.%s.cache' % crbInsts[0]['IP'])
serializer.load_from_file()
@@ -338,44 +280,47 @@ def dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, nic, virt
dutobj = get_project_obj(project, Dut, dutInst, serializer)
duts.append(dutobj)
- dut = duts[0]
-
- dts_log_execution(log_handler)
+ dts_log_execution(duts, tester, log_handler)
tester.duts = duts
show_speedup_options_messages(read_cache, skip_setup)
tester.set_speedup_options(read_cache, skip_setup)
- tester.set_test_types(func_tests=functional_only, perf_tests=performance_only)
tester.init_ext_gen()
+ nic = settings.load_global_setting(settings.HOST_NIC_SETTING)
for dutobj in duts:
dutobj.tester = tester
dutobj.set_virttype(virttype)
dutobj.set_speedup_options(read_cache, skip_setup)
dutobj.set_directory(base_dir)
+ # save execution nic setting
dutobj.set_nic_type(nic)
- dutobj.set_test_types(func_tests=functional_only, perf_tests=performance_only)
+
+ return duts, tester
-def dts_crbs_exit():
+def dts_crbs_exit(duts, tester):
"""
Call dut and tester exit function after execution finished
"""
- dut.crb_exit()
+ for dutobj in duts:
+ dutobj.crb_exit()
+
tester.crb_exit()
-def dts_run_prerequisties(pkgName, patch):
+def dts_run_prerequisties(duts, tester, pkgName, patch, dts_commands, serializer):
"""
Run dts prerequisties function.
"""
try:
- dts_run_commands(tester)
- tester.prerequisites(performance_only)
- dts_run_commands(tester)
+ dts_run_commands(tester, dts_commands)
+ tester.prerequisites()
+ dts_run_commands(tester, dts_commands)
for dutobj in duts:
- dutobj.prerequisites(pkgName, patch)
- dts_run_commands(dutobj)
+ dutobj.set_package(pkgName, patch)
+ dutobj.prerequisites()
+ dts_run_commands(dutobj, dts_commands)
serializer.save_to_file()
except Exception as ex:
@@ -386,37 +331,22 @@ def dts_run_prerequisties(pkgName, patch):
return False
-def dts_run_target(crbInsts, targets, test_suites, nic, scenario):
+def dts_run_target(duts, tester, targets, test_suites):
"""
Run each target in execution targets.
"""
- global drivername
- if scenario != '':
- scene = VirtScene(dut, tester, scenario)
- else:
- scene = None
-
- if scene:
- scene.load_config()
- scene.create_scene()
-
for target in targets:
log_handler.info("\nTARGET " + target)
result.target = target
try:
- if scene:
- scene.set_target(target)
- # skip set_target when host has been setup by scenario
- if not scene.host_bound:
- dut.set_target(target, bind_dev=False)
+ drivername = settings.load_global_setting(settings.HOST_DRIVER_SETTING)
+ if drivername == "":
+ for dutobj in duts:
+ dutobj.set_target(target, bind_dev=False)
else:
- if drivername == "":
- for dutobj in duts:
- dutobj.set_target(target, bind_dev=False)
- else:
- for dutobj in duts:
- dutobj.set_target(target)
+ for dutobj in duts:
+ dutobj.set_target(target)
except AssertionError as ex:
log_handler.error(" TARGET ERROR: " + str(ex))
result.add_failed_target(result.dut, target, str(ex))
@@ -426,15 +356,7 @@ def dts_run_target(crbInsts, targets, test_suites, nic, scenario):
result.add_failed_target(result.dut, target, str(ex))
continue
- if 'nic_type' not in paramDict:
- paramDict['nic_type'] = 'any'
- nic = 'any'
-
- dts_run_suite(crbInsts, test_suites, target, nic, scene)
-
- if scene:
- scene.destroy_scene()
- scene = None
+ dts_run_suite(duts, tester, test_suites, target)
tester.restore_interfaces()
@@ -443,44 +365,36 @@ def dts_run_target(crbInsts, targets, test_suites, nic, scenario):
dutobj.restore_interfaces()
-def dts_run_suite(crbInsts, test_suites, target, nic, scene):
+def dts_run_suite(duts, tester, test_suites, target):
"""
Run each suite in test suite list.
"""
try:
- for test_suite in test_suites:
- # prepare rst report file
- result.test_suite = test_suite
- rst.generate_results_rst(crbInsts[0]['name'], target, nic, test_suite, performance_only)
- test_module = __import__('TestSuite_' + test_suite)
- global module
- module = test_module
- for test_classname, test_class in get_subclasses(test_module, TestCase):
-
- if scene and scene.vm_dut_enable:
- global virtduts
- virtduts = scene.get_vm_duts()
- tester.dut = virtduts[0]
- tester.duts = virtduts
- test_suite = test_class(virtduts, tester, target, test_suite)
- else:
- test_suite = test_class(duts, tester, target, test_suite)
- result.nic = test_suite.nic
-
- dts_log_testsuite(test_suite, log_handler, test_classname)
+ for suite_name in test_suites:
+ result.test_suite = suite_name
+ suite_module = __import__('TestSuite_' + suite_name)
+ for test_classname, test_class in get_subclasses(suite_module, TestCase):
+
+ suite_obj = test_class(duts, tester, target, suite_name)
+ suite_obj.set_requested_cases(requested_tests)
+ suite_obj.set_check_inst(check=check_case_inst, support=support_case_inst)
+ result.nic = suite_obj.nic
+
+ dts_log_testsuite(duts, tester, suite_obj, log_handler, test_classname)
log_handler.info("\nTEST SUITE : " + test_classname)
- log_handler.info("NIC : " + nic)
- if execute_test_setup_all(test_suite):
- execute_all_test_cases(test_suite)
- execute_test_tear_down_all(test_suite)
- else:
- test_cases_as_blocked(test_suite)
+ log_handler.info("NIC : " + result.nic)
- log_handler.info("\nTEST SUITE ENDED: " + test_classname)
- dts_log_execution(log_handler)
+ if suite_obj.execute_setup_all():
+ suite_obj.execute_test_cases()
+ suite_obj.execute_tear_downall()
+
+ # save suite cases result
+ result.copy_suite(suite_obj.get_result())
+ save_all_results()
- dut.kill_all()
+ log_handler.info("\nTEST SUITE ENDED: " + test_classname)
+ dts_log_execution(duts, tester, log_handler)
except VerifyFailure:
log_handler.error(" !!! DEBUG IT: " + traceback.format_exc())
except KeyboardInterrupt:
@@ -488,7 +402,7 @@ def dts_run_suite(crbInsts, test_suites, target, nic, scene):
except Exception as e:
log_handler.error(str(e))
finally:
- execute_test_tear_down_all(test_suite)
+ suite_obj.execute_tear_downall()
def run_all(config_file, pkgName, git, patch, skip_setup,
@@ -500,29 +414,25 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
"""
global config
- global serializer
- global nic
global requested_tests
global result
global excel_report
- global stats
+ global stats_report
global log_handler
- global debug_mode
- global debug_case
- global Package
- global Patches
- global scenario
global check_case_inst
global support_case_inst
+
# save global variable
- Package = pkgName
- Patches = patch
+ serializer = Serializer()
+
+ # load check/support case lists
check_case = parse_file()
check_case.set_filter_case()
check_case.set_support_case()
+
# prepare the output folder
if output_dir == '':
- output_dir = FOLDERS['Output']
+ output_dir = settings.FOLDERS['Output']
if not os.path.exists(output_dir):
os.mkdir(output_dir)
@@ -532,9 +442,9 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
# enable debug mode
if debug is True:
- debug_mode = True
+ setting.set_local_variable(settings.DEBUG_SETTING, 'yes')
if debugcase is True:
- debug_case = True
+ setting.set_local_variable(settings.DEBUG_CASE_SETTING, 'yes')
# init log_handler handler
if verbose is True:
@@ -554,20 +464,17 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
raise ConfigParseException(config_file)
# parse commands
- dts_parse_commands(commands)
-
- # register exit action
- atexit.register(close_all_sessions)
+ dts_commands = dts_parse_commands(commands)
os.environ["TERM"] = "dumb"
- serializer = Serializer()
-
- # excel report and statistics file
- result = Result()
+ # change rst output folder
rst.path2Result = output_dir
+
+ # report objects
excel_report = ExcelReporter(output_dir + '/test_results.xls')
- stats = StatsReporter(output_dir + '/statistics.txt')
+ stats_report = StatsReporter(output_dir + '/statistics.txt')
+ result = Result()
crbInsts = []
crbs_conf = CrbsConf()
@@ -578,7 +485,7 @@ 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
- dutIPs, targets, test_suites, nics, scenario = dts_parse_config(section)
+ dutIPs, targets, test_suites = dts_parse_config(section)
for dutIP in dutIPs:
log_handler.info("\nDUT " + dutIP)
@@ -597,262 +504,26 @@ def run_all(config_file, pkgName, git, patch, skip_setup,
result.dut = dutIPs[0]
# init dut, tester crb
- dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, nics, virttype)
+ duts, tester = dts_crbs_init(crbInsts, skip_setup, read_cache, project, base_dir, serializer, virttype)
- check_case_inst = check_case_skip(dut)
- support_case_inst = check_case_support(dut)
+ # register exit action
+ atexit.register(close_all_sessions, duts, tester)
+
+ check_case_inst = check_case_skip(duts[0])
+ support_case_inst = check_case_support(duts[0])
# Run DUT prerequisites
- if dts_run_prerequisties(pkgName, patch) is False:
- dts_crbs_exit()
+ if dts_run_prerequisties(duts, tester, pkgName, patch, dts_commands, serializer) is False:
+ dts_crbs_exit(duts, tester)
continue
- dts_run_target(crbInsts, targets, test_suites, nics, scenario)
+ dts_run_target(duts, tester, targets, test_suites)
- dts_crbs_exit()
+ dts_crbs_exit(duts, tester)
save_all_results()
-def test_cases_as_blocked(test_suite):
- """
- Save result as test case blocked.
- """
- if functional_only:
- for test_case in get_functional_test_cases(test_suite):
- result.test_case = test_case.__name__
- result.test_case_blocked('set_up_all failed')
- if performance_only:
- for test_case in get_performance_test_cases(test_suite):
- result.test_case = test_case.__name__
- result.test_case_blocked('set_up_all failed')
-
-
-def get_subclasses(module, clazz):
- """
- Get module attribute name and attribute.
- """
- for subclazz_name, subclazz in inspect.getmembers(module):
- if hasattr(subclazz, '__bases__') and clazz in subclazz.__bases__:
- yield (subclazz_name, subclazz)
-
-
-def copy_instance_attr(from_inst, to_inst):
- for key in from_inst.__dict__.keys():
- to_inst.__dict__[key] = from_inst.__dict__[key]
-
-
-def get_functional_test_cases(test_suite):
- """
- Get all functional test cases.
- """
- return get_test_cases(test_suite, r'test_(?!perf_)')
-
-
-def get_performance_test_cases(test_suite):
- """
- Get all performance test cases.
- """
- return get_test_cases(test_suite, r'test_perf_')
-
-
-def has_it_been_requested(test_case, test_name_regex):
- """
- Check whether test case has been requested for validation.
- """
- name_matches = re.match(test_name_regex, test_case.__name__)
-
- if requested_tests is not None:
- return name_matches and test_case.__name__ in requested_tests
-
- return name_matches
-
-
-def get_test_cases(test_suite, test_name_regex):
- """
- Return case list which name matched regex.
- """
- for test_case_name in dir(test_suite):
- test_case = getattr(test_suite, test_case_name)
- if callable(test_case) and has_it_been_requested(test_case, test_name_regex):
- yield test_case
-
-
-def execute_test_setup_all(test_case):
- """
- Execute suite setup_all function before cases.
- """
- try:
- # clear all previous output
- test_case.dut.get_session_output(timeout=0.1)
- test_case.tester.get_session_output(timeout=0.1)
- test_case.set_up_all()
- return True
- except Exception:
- log_handler.error('set_up_all failed:\n' + traceback.format_exc())
- return False
-
-
-def execute_all_test_cases(test_suite):
- """
- Execute all test cases in one suite.
- """
- if functional_only:
- for test_case in get_functional_test_cases(test_suite):
- execute_test_case(test_suite, test_case)
- if performance_only:
- for test_case in get_performance_test_cases(test_suite):
- execute_test_case(test_suite, test_case)
-
-
-def execute_test_case(test_suite, test_case):
- """
- Execute specified test case in specified suite. If any exception occured in
- validation process, save the result and tear down this case.
- """
- global debug_mode
- global debug_case
- global module
- result.test_case = test_case.__name__
- rst.write_title("Test Case: " + test_case.__name__)
- if check_case_inst.case_skip(test_case.__name__[len("test_"):]):
- log_handler.info('Test Case %s Result SKIPED:' % test_case.__name__)
- rst.write_result("N/A")
- result.test_case_skip(check_case_inst.comments)
- save_all_results()
- return
-
- if not support_case_inst.case_support(test_case.__name__[len("test_"):]):
- log_handler.info('Test Case %s Result SKIPED:' % test_case.__name__)
- rst.write_result("N/A")
- result.test_case_skip(support_case_inst.comments)
- save_all_results()
- return
-
- if performance_only:
- rst.write_annex_title("Annex: " + test_case.__name__)
- try:
- log_handler.info('Test Case %s Begin' % test_case.__name__)
- test_suite.running_case = test_case.__name__
- # clear all previous output
- test_suite.dut.get_session_output(timeout=0.1)
- test_suite.tester.get_session_output(timeout=0.1)
- # run set_up function for each case
- test_suite.set_up()
- # prepare debugger re-run case environment
- if debug_mode or debug_case:
- debugger.AliveSuite = test_suite
- debugger.AliveModule = module
- debugger.AliveCase = test_case.__name__
- if debug_case:
- debugger.keyboard_handle(signal.SIGINT, None)
- else:
- test_case()
-
- result.test_case_passed()
-
- if dut.want_perf_tests:
- log_handler.info('Test Case %s Result FINISHED:' % test_case.__name__)
- else:
- rst.write_result("PASS")
- log_handler.info('Test Case %s Result PASSED:' % test_case.__name__)
-
- except VerifyFailure as v:
- result.test_case_failed(str(v))
- rst.write_result("FAIL")
- log_handler.error('Test Case %s Result FAILED: ' % (test_case.__name__) + str(v))
- except KeyboardInterrupt:
- result.test_case_blocked("Skipped")
- log_handler.error('Test Case %s SKIPED: ' % (test_case.__name__))
- raise KeyboardInterrupt("Stop DCTS")
- except TimeoutException as e:
- rst.write_result("FAIL")
- msg = str(e)
- result.test_case_failed(msg)
- log_handler.error('Test Case %s Result FAILED: ' % (test_case.__name__) + msg)
- log_handler.error('%s' % (e.get_output()))
- except Exception:
- trace = traceback.format_exc()
- result.test_case_failed(trace)
- log_handler.error('Test Case %s Result ERROR: ' % (test_case.__name__) + trace)
- finally:
- test_suite.tear_down()
- save_all_results()
-
-
-def execute_test_tear_down_all(test_case):
- """
- execute suite tear_down_all function
- """
- try:
- test_case.tear_down_all()
- except Exception:
- log_handler.error('tear_down_all failed:\n' + traceback.format_exc())
-
- dut.kill_all()
- tester.kill_all()
-
-
-def results_table_add_header(header):
- """
- Add the title of result table.
- Usage:
- results_table_add_header(header)
- results_table_add_row(row)
- results_table_print()
- """
- global table, results_table_header, results_table_rows
-
- results_table_rows = []
- results_table_rows.append([])
- table = texttable.Texttable(max_width=150)
- results_table_header = header
-
-
-def results_table_add_row(row):
- """
- Add one row to result table.
- """
- results_table_rows.append(row)
-
-
-def results_table_print():
- """
- Show off result table.
- """
- table.add_rows(results_table_rows)
- table.header(results_table_header)
-
- alignments = []
- # all header align to left
- for _ in results_table_header:
- alignments.append("l")
- table.set_cols_align(alignments)
-
- out = table.draw()
- rst.write_text('\n' + out + '\n\n')
- log_handler.info('\n' + out)
-
-
-def results_plot_print(image, width=90):
- """
- Includes an image in the report file.
- The image name argument must include the path. <path>/<image name>
- """
- rst.include_image(image, width)
-
-
-def create_mask(indexes):
- """
- Convert index to hex mask.
- """
- val = 0
- for index in indexes:
- val |= 1 << int(index)
-
- return hex(val).rstrip("L")
-
-
def show_speedup_options_messages(read_cache, skip_setup):
if read_cache:
log_handler.info('CACHE: All configuration will be read from cache.')
@@ -870,23 +541,21 @@ def save_all_results():
Save all result to files.
"""
excel_report.save(result)
- stats.save(result)
+ stats_report.save(result)
-def accepted_nic(pci_id):
+def close_all_sessions(duts, tester):
"""
- Return True if the pci_id is a known NIC card in the settings file and if
- it is selected in the execution file, otherwise it returns False.
+ Close session to DUT and tester.
"""
- global nic
- if pci_id not in NICS.values():
- return False
-
- if nic is 'any':
- return True
-
- else:
- if pci_id == NICS[nic]:
- return True
-
- return False
+ # close all nics
+ for dutobj in duts:
+ if getattr(dutobj, 'ports_info', None) and dutobj.ports_info:
+ for port_info in dutobj.ports_info:
+ netdev = port_info['port']
+ netdev.close()
+ # close all session
+ dutobj.close()
+ if tester is not None:
+ tester.close()
+ log_handler.info("DTS ended")
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 2/9] framework config: add concept for dut board
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 1/9] framework dts: optimize " Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 3/9] framework dut: remove dependency on dts module Marvin Liu
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/config.py b/framework/config.py
index 8d564a6..6c3a3b0 100644
--- a/framework/config.py
+++ b/framework/config.py
@@ -187,7 +187,7 @@ class PortConf(UserConf):
class CrbsConf(UserConf):
- DEF_CRB = {'IP': '', 'name': 'CrownPassCRB1', 'user': '',
+ DEF_CRB = {'IP': '', 'board': 'default', 'user': '',
'pass': '', 'tester IP': '', 'tester pass': '',
IXIA: None, 'memory channels': 4,
'bypass core0': True}
@@ -236,6 +236,8 @@ class CrbsConf(UserConf):
crb['bypass core0'] = True
else:
crb['bypass core0'] = False
+ elif key == 'board':
+ crb['board'] = value
self.crbs_cfg.append(crb)
return self.crbs_cfg
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 3/9] framework dut: remove dependency on dts module
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 1/9] framework dts: optimize " Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 2/9] framework config: add concept for dut board Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 4/9] framework rst: add class to handle RST report Marvin Liu
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/crb.py b/framework/crb.py
index 066bb3f..44ddc42 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -30,7 +30,6 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
-import dts
import re
import os
from settings import TIMEOUT, IXIA
diff --git a/framework/debugger.py b/framework/debugger.py
index f776327..b6f00b8 100644
--- a/framework/debugger.py
+++ b/framework/debugger.py
@@ -27,9 +27,9 @@ import os
import signal
import code
import time
-import dts
import imp
-import dts
+from settings import load_global_setting, DEBUG_SETTING
+from utils import get_subclasses, copy_instance_attr
from test_case import TestCase
@@ -90,20 +90,20 @@ def rerun_command():
target = AliveSuite.__dict__['target']
suite = AliveSuite.__dict__['suite']
- for test_classname, test_class in dts.get_subclasses(new_module, TestCase):
+ for test_classname, test_class in get_subclasses(new_module, TestCase):
suite_obj = test_class(duts, tester, target, suite)
# copy all element from previous suite to reloaded suite
- dts.copy_instance_attr(AliveSuite, suite_obj)
+ copy_instance_attr(AliveSuite, suite_obj)
# re-run specified test case
- for case in dts.get_test_cases(suite_obj, r'%s' % AliveCase):
+ for case in suite_obj._get_test_cases(suite_obj, r'%s' % AliveCase):
if callable(case):
case()
def exit_command():
"""
- Exit dts framework.
+ Exit framework.
"""
global debug_cmd
debug_cmd = 'exit'
@@ -163,7 +163,7 @@ def ignore_keyintr():
"""
Temporary disable interrupt handler.
"""
- if dts.debug_mode is False:
+ if load_global_setting(DEBUG_SETTING) != 'yes':
return
global debug_cmd
@@ -179,7 +179,7 @@ def aware_keyintr():
"""
Reenable interrupt handler.
"""
- if dts.debug_mode is False:
+ if load_global_setting(DEBUG_SETTING) != 'yes':
return
return signal.signal(signal.SIGINT, keyboard_handle)
diff --git a/framework/dut.py b/framework/dut.py
index 2f4e53a..88c4679 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -32,7 +32,6 @@
import os
import re
import time
-import dts
import settings
from config import PortConf
from settings import NICS, LOG_NAME_SEP
@@ -307,9 +306,9 @@ class Dut(Crb):
arch_huge_pages = hugepages if hugepages > 0 else 512
if total_huge_pages != arch_huge_pages:
- # before all hugepage average distribution by all socket,
- # but sometimes create mbuf pool on socket 0 failed when setup testpmd,
- # so set all huge page on socket 0
+ # before all hugepage average distribution by all socket,
+ # but sometimes create mbuf pool on socket 0 failed when setup testpmd,
+ # so set all huge page on socket 0
if force_socket:
self.set_huge_pages(arch_huge_pages, 0)
else:
@@ -362,7 +361,7 @@ class Dut(Crb):
current_nic = 0
for (pci_bus, pci_id) in self.pci_devices_info:
- if dts.accepted_nic(pci_id):
+ if settings.accepted_nic(pci_id):
if self.is_ssh_session_port(pci_bus):
continue
@@ -385,7 +384,7 @@ class Dut(Crb):
current_nic = 0
for (pci_bus, pci_id) in self.pci_devices_info:
- if dts.accepted_nic(pci_id):
+ if settings.accepted_nic(pci_id):
if self.is_ssh_session_port(pci_bus):
continue
@@ -408,9 +407,6 @@ class Dut(Crb):
ports = []
candidates = []
- if perf is None:
- perf = self.want_perf_tests
-
nictypes = []
if nic_type == 'any':
for portid in range(len(self.ports_info)):
@@ -508,17 +504,17 @@ class Dut(Crb):
def lcore_table_print(self, horizontal=False):
if not horizontal:
- dts.results_table_add_header(['Socket', 'Core', 'Thread'])
+ result_table = ResultTable(['Socket', 'Core', 'Thread'])
for lcore in self.cores:
- dts.results_table_add_row([lcore['socket'], lcore['core'], lcore['thread']])
- dts.results_table_print()
+ result_table.add_row([lcore['socket'], lcore['core'], lcore['thread']])
+ result_table.table_print()
else:
- dts.results_table_add_header(['X'] + [''] * len(self.cores))
- dts.results_table_add_row(['Thread'] + [n['thread'] for n in self.cores])
- dts.results_table_add_row(['Core'] + [n['core'] for n in self.cores])
- dts.results_table_add_row(['Socket'] + [n['socket'] for n in self.cores])
- dts.results_table_print()
+ result_table = ResultTable(['X'] + [''] * len(self.cores))
+ result_table.add_row(['Thread'] + [n['thread'] for n in self.cores])
+ result_table.add_row(['Core'] + [n['core'] for n in self.cores])
+ result_table.add_row(['Socket'] + [n['socket'] for n in self.cores])
+ result_table.table_print()
def get_memory_channels(self):
n = self.crb['memory channels']
@@ -556,7 +552,7 @@ class Dut(Crb):
if self.ports_info:
self.rescan_ports_uncached()
self.save_serializer_ports()
-
+
def rescan_ports_uncached(self):
"""
rescan ports and update port's mac adress, intf, ipv6 address.
@@ -652,7 +648,7 @@ class Dut(Crb):
intf = port.get_interface_name()
self.logger.info("DUT cached: [%s %s] %s" % (port_info['pci'],
- port_info['type'], intf))
+ port_info['type'], intf))
port_info['port'] = port
@@ -675,7 +671,7 @@ class Dut(Crb):
for (pci_bus, pci_id) in self.pci_devices_info:
if self.check_ports_available(pci_bus, pci_id) is False:
self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id,
- skipped))
+ skipped))
continue
addr_array = pci_bus.split(':')
@@ -721,7 +717,7 @@ class Dut(Crb):
for (pci_bus, pci_id) in self.pci_devices_info:
- if not dts.accepted_nic(pci_id):
+ if not settings.accepted_nic(pci_id):
self.logger.info("DUT: [%s %s] %s" % (pci_bus, pci_id,
skipped))
continue
@@ -836,8 +832,6 @@ class Dut(Crb):
if port_cfg['numa'] != port['numa']:
self.logger.warning("CONFIGURED NUMA NOT SAME AS SCANNED!!!")
port['numa'] = port_cfg['numa']
-
-
def map_available_ports(self):
"""
diff --git a/framework/etgen.py b/framework/etgen.py
index 79dc505..a3ed9a0 100644
--- a/framework/etgen.py
+++ b/framework/etgen.py
@@ -32,18 +32,20 @@
import re
import string
import time
-import dts
from config import IxiaConf
from ssh_connection import SSHConnection
from settings import SCAPY2IXIA
from logger import getLogger
from exception import VerifyFailure
+from utils import create_mask
class SoftwarePacketGenerator():
+
"""
Software WindRiver packet generator for performance measurement.
"""
+
def __init__(self, tester):
self.tester = tester
@@ -86,7 +88,7 @@ class SoftwarePacketGenerator():
pcap_cmd += " -s %d:%s" % (port_map[tx_port], pcap_file)
# Selected 2 for -n to optimize results on Burage
- cores_mask = dts.create_mask(self.tester.get_core_list("all"))
+ cores_mask = create_mask(self.tester.get_core_list("all"))
self.tester.send_expect("./pktgen -n 2 -c %s --proc-type auto --socket-mem 256,256 -- -P -m \"%s\" %s"
% (cores_mask, map_cmd, pcap_cmd), "Pktgen >", 100)
@@ -156,10 +158,10 @@ class IxiaPacketGenerator(SSHConnection):
self.ixiaVersion = ixiaPorts[ixiaRef]["Version"]
self.ports = ixiaPorts[ixiaRef]["Ports"]
- if ixiaPorts[ixiaRef].has_key('force100g'):
+ if ixiaPorts[ixiaRef].has_key('force100g'):
self.enable100g = ixiaPorts[ixiaRef]['force100g']
else:
- self.enable100g = 'disable'
+ self.enable100g = 'disable'
self.logger.info(self.ixiaVersion)
self.logger.info(self.ports)
@@ -416,8 +418,8 @@ class IxiaPacketGenerator(SSHConnection):
for item in pList:
self.add_tcl_cmd("port setFactoryDefaults chasId %d %d" % (
item['card'], item['port']))
- #if the line rate is 100G and we need this port work in 100G mode,
- #we need to add some configure to make it so.
+ # if the line rate is 100G and we need this port work in 100G mode,
+ # we need to add some configure to make it so.
if int(self.get_line_rate(self.chasId, item).strip()) == 100000 and self.enable100g == 'enable':
self.add_tcl_cmd("port config -ieeeL1Defaults 0")
self.add_tcl_cmd("port config -autonegotiate false")
@@ -818,11 +820,11 @@ class IxiaPacketGenerator(SSHConnection):
Returns the number of packets captured by IXIA on a previously set
port. Call self.stat_get_stat_all_stats(port) before.
"""
- if self._stat_cget_value('framesReceived') !=0:
+ if self._stat_cget_value('framesReceived') != 0:
return self._stat_cget_value('framesReceived')
else:
- #if the packet size is large than 1518, this line will avoid return
- #a wrong number
+ # if the packet size is large than 1518, this line will avoid return
+ # a wrong number
return self._stat_cget_value('oversize')
def get_flow_control_frames(self):
diff --git a/framework/plotting.py b/framework/plotting.py
index a9f5d2c..9e0ae54 100644
--- a/framework/plotting.py
+++ b/framework/plotting.py
@@ -30,12 +30,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
-import dts
import shutil
from plotgraph import Plot2DGraph
from docutils.parsers.rst.directives import path
from rst import path2Result
import plotgraph
+import utils
+from exception import VerifyFailure
"""
@@ -94,7 +95,7 @@ class Plotting(object):
self.plots_path = path
except Exception as e:
- raise dts.VerifyFailure("Plot Error: " + str(e))
+ raise VerifyFailure("Plot Error: " + str(e))
def clear_all_plots(self, crb, target):
shutil.rmtree(self.plots_path, True)
@@ -105,7 +106,7 @@ class Plotting(object):
for yseries in ydata:
if len(xdata) != len(yseries):
- print dts.RED("The number of items in X axis (%s) and Y axis (%s) does not match." % (xdata, ydata))
+ print utils.RED("The number of items in X axis (%s) and Y axis (%s) does not match." % (xdata, ydata))
return ''
image_path = "%s/%s.%s" % (self.plots_path, image_filename,
@@ -204,7 +205,7 @@ class Plotting(object):
pgraph.titleYOffset = 0.96
pgraph.titleXOffset = 0.35
- if True == addHline:
+ if addHline:
pgraph.horizontalLine = True
pgraph.hLineName = hLine['name']
pgraph.hLine = hLine['value']
diff --git a/framework/pmd_output.py b/framework/pmd_output.py
index f8e6088..d982c89 100644
--- a/framework/pmd_output.py
+++ b/framework/pmd_output.py
@@ -31,8 +31,8 @@
import os
import re
-import dts
from settings import TIMEOUT
+from utils import create_mask
class PmdOutput():
@@ -110,7 +110,7 @@ class PmdOutput():
core_list = self.dut.get_core_list(self.default_cores)
else:
core_list = self.dut.get_core_list(cores, socket=socket)
- self.coremask = dts.create_mask(core_list)
+ 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)
out = self.dut.send_expect(command, "testpmd> ", 120)
diff --git a/framework/project_dpdk.py b/framework/project_dpdk.py
index 4e44793..a8d44af 100644
--- a/framework/project_dpdk.py
+++ b/framework/project_dpdk.py
@@ -31,9 +31,9 @@
import os
import re
-import dts
-from settings import NICS
+from settings import NICS, load_global_setting, accepted_nic
+from settings import DPDK_RXMODE_SETTING, HOST_DRIVER_SETTING
from ssh_connection import SSHConnection
from crb import Crb
from dut import Dut
@@ -71,10 +71,11 @@ class DPDKdut(Dut):
self.set_rxtx_mode()
- #Enable MLNX driver before installing dpdk
- if dts.drivername == DRIVERS['ConnectX4']:
+ # Enable MLNX driver before installing dpdk
+ drivername = load_global_setting(HOST_DRIVER_SETTING)
+ if drivername == DRIVERS['ConnectX4']:
self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_MLX5_PMD=n/"
- + "CONFIG_RTE_LIBRTE_MLX5_PMD=y/' config/common_base" , "# ", 30)
+ + "CONFIG_RTE_LIBRTE_MLX5_PMD=y/' config/common_base", "# ", 30)
if not self.skip_setup:
self.build_install_dpdk(target)
@@ -83,7 +84,7 @@ class DPDKdut(Dut):
self.setup_modules(target)
if bind_dev and self.get_os_type() == 'linux':
- self.bind_interfaces_linux(dts.drivername)
+ self.bind_interfaces_linux(drivername)
self.extra_nic_setup()
def setup_modules(self, target):
@@ -94,7 +95,8 @@ class DPDKdut(Dut):
setup_modules(target)
def setup_modules_linux(self, target):
- if dts.drivername == "vfio-pci":
+ drivername = load_global_setting(HOST_DRIVER_SETTING)
+ if drivername == "vfio-pci":
self.send_expect("rmmod vfio_pci", "#", 70)
self.send_expect("rmmod vfio_iommu_type1", "#", 70)
self.send_expect("rmmod vfio", "#", 70)
@@ -119,7 +121,7 @@ class DPDKdut(Dut):
binding_list = ''
for (pci_bus, pci_id) in self.pci_devices_info:
- if dts.accepted_nic(pci_id):
+ if accepted_nic(pci_id):
binding_list += '%s,' % (pci_bus)
self.send_expect("kldunload if_ixgbe.ko", "#")
@@ -133,11 +135,8 @@ class DPDKdut(Dut):
Set default RX/TX PMD function, now only take effect on ixgbe.
"""
[arch, machine, env, toolchain] = self.target.split('-')
- if dts.rx_mode is None:
- mode = 'default'
- else:
- mode = dts.rx_mode
+ mode = load_global_setting(DPDK_RXMODE_SETTING)
if mode == 'scalar':
self.send_expect("sed -i -e 's/CONFIG_RTE_IXGBE_INC_VECTOR=.*$/"
+ "CONFIG_RTE_IXGBE_INC_VECTOR=n/' config/common_%s" % env, "# ", 30)
@@ -154,6 +153,10 @@ class DPDKdut(Dut):
self.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC=.*$/"
+ "CONFIG_RTE_LIBRTE_IXGBE_RX_ALLOW_BULK_ALLOC=y/' config/common_%s" % env, "# ", 30)
+ def set_package(self, pkg_name="", patch_list=[]):
+ self.package = pkg_name
+ self.patches = patch_list
+
def build_install_dpdk(self, target, extra_options=''):
"""
Build DPDK source code with specified target.
@@ -203,9 +206,9 @@ class DPDKdut(Dut):
assert ("Error" not in out), "Compilation error..."
assert ("No rule to make" not in out), "No rule to make error..."
- def prepare_package(self, pkgName, patch):
+ def prepare_package(self):
if not self.skip_setup:
- assert (os.path.isfile(pkgName) is True), "Invalid package"
+ assert (os.path.isfile(self.package) is True), "Invalid package"
p_dir, _ = os.path.split(self.base_dir)
# ToDo: make this configurable
@@ -217,11 +220,11 @@ class DPDKdut(Dut):
raise ValueError("Directiry %s or %s does not exist,"
"please check params -d"
% (p_dir, dst_dir))
- self.session.copy_file_to(pkgName, dst_dir)
+ self.session.copy_file_to(self.package, dst_dir)
# put patches to p_dir/patches/
- if (patch is not None):
- for p in patch:
+ if (self.patches is not None):
+ for p in self.patches:
self.session.copy_file_to('dep/' + p, dst_dir)
self.kill_all()
@@ -234,7 +237,7 @@ class DPDKdut(Dut):
# unpack dpdk
out = self.send_expect("tar zxf %s%s -C %s" %
- (dst_dir, pkgName.split('/')[-1], p_dir),
+ (dst_dir, self.package.split('/')[-1], p_dir),
"# ", 20, verify=True)
if out == -1:
raise ValueError("Extract dpdk package to %s failure,"
@@ -248,17 +251,17 @@ class DPDKdut(Dut):
raise ValueError("dpdk dir %s mismatch, please check params -d"
% self.base_dir)
- if (patch is not None):
- for p in patch:
+ if (self.patches is not None):
+ for p in self.patches:
out = self.send_expect("patch -d %s -p1 < %s" %
(self.base_dir, dst_dir + p), "# ")
assert "****" not in out
- def prerequisites(self, pkgName, patch):
+ def prerequisites(self):
"""
Copy DPDK package to DUT and apply patch files.
"""
- self.prepare_package(pkgName, patch)
+ self.prepare_package()
self.dut_prerequisites()
self.stage = "post-init"
@@ -275,7 +278,6 @@ class DPDKdut(Dut):
Bind the interfaces to the selected driver. nics_to_bind can be None
to bind all interfaces or an array with the port indexes
"""
-
binding_list = '--bind=%s ' % driver
current_nic = 0
diff --git a/framework/qemu_libvirt.py b/framework/qemu_libvirt.py
index de69d8f..ed8e0e6 100644
--- a/framework/qemu_libvirt.py
+++ b/framework/qemu_libvirt.py
@@ -33,7 +33,7 @@ import time
import re
import os
-import dts
+import utils
from dut import Dut
from ssh_connection import SSHConnection
from virt_base import VirtBase
@@ -326,12 +326,12 @@ class LibvirtKvm(VirtBase):
'managed': 'yes'})
if 'pf_idx' not in options.keys():
- print dts.RED("Missing device index for device option!!!")
+ print utils.RED("Missing device index for device option!!!")
return False
pf = int(options['pf_idx'])
if pf > len(self.host_dut.ports_info):
- print dts.RED("PF device index over size!!!")
+ print utils.RED("PF device index over size!!!")
return False
pci_addr = self.host_dut.ports_info[pf]['pci']
@@ -360,7 +360,7 @@ class LibvirtKvm(VirtBase):
pci_map['guestpci'] = options['guestpci']
self.pci_maps.append(pci_map)
else:
- print dts.RED('Host device pass-through need guestpci option!!!')
+ print utils.RED('Host device pass-through need guestpci option!!!')
def add_vm_net(self, **options):
"""
diff --git a/framework/tester.py b/framework/tester.py
index 2781376..2d99daa 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -36,7 +36,7 @@ Interface for bulk traffic generators.
import re
import subprocess
from time import sleep
-from settings import NICS
+from settings import NICS, load_global_setting, PERF_SETTING
from crb import Crb
from net_device import GetNicObj
from etgen import IxiaPacketGenerator, SoftwarePacketGenerator
@@ -111,7 +111,7 @@ class Tester(Crb):
"""
Check whether IXIA generator is ready for performance test.
"""
- return self.want_perf_tests and self.has_external_traffic_generator()
+ return load_global_setting(PERF_SETTING) == 'yes' and self.has_external_traffic_generator()
def tester_prerequisites(self):
"""
diff --git a/framework/virt_base.py b/framework/virt_base.py
index 5cd2854..e6a6d08 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -33,7 +33,7 @@ import traceback
from random import randint
from itertools import imap
-import dts
+import utils
import exception
from dut import Dut
from config import VirtConf
@@ -167,9 +167,9 @@ class VirtBase(object):
for option in value:
param_func(**option)
else:
- print dts.RED("Virt %s function not callable!!!" % key)
+ print utils.RED("Virt %s function not callable!!!" % key)
except AttributeError:
- print dts.RED("Virt %s function not implemented!!!" % key)
+ print utils.RED("Virt %s function not implemented!!!" % key)
except Exception:
raise exception.VirtConfigParamException(key)
@@ -252,9 +252,9 @@ class VirtBase(object):
except Exception as vm_except:
if self.handle_exception(vm_except):
- print dts.RED("Handled expection " + str(type(vm_except)))
+ print utils.RED("Handled expection " + str(type(vm_except)))
else:
- print dts.RED("Unhandled expection " + str(type(vm_except)))
+ print utils.RED("Unhandled expection " + str(type(vm_except)))
if callable(self.callback):
self.callback()
@@ -273,9 +273,9 @@ class VirtBase(object):
vm_dut = self.instantiate_vm_dut(set_target, cpu_topo, bind_dev=False)
except Exception as vm_except:
if self.handle_exception(vm_except):
- print dts.RED("Handled expection " + str(type(vm_except)))
+ print utils.RED("Handled expection " + str(type(vm_except)))
else:
- print dts.RED("Unhandled expection " + str(type(vm_except)))
+ print utils.RED("Unhandled expection " + str(type(vm_except)))
return None
@@ -372,7 +372,7 @@ class VirtBase(object):
try:
# setting up dpdk in vm, must call at last
- vm_dut.prerequisites(dts.Package, dts.Patches)
+ vm_dut.prerequisites(self.host_dut.package, self.host_dut.patches)
if set_target:
target = self.host_dut.target
vm_dut.set_target(target, bind_dev)
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 0010e08..e13c48c 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -32,7 +32,7 @@
import os
import re
import time
-import dts
+import utils
import settings
from config import PortConf
from settings import NICS, LOG_NAME_SEP, get_netdev
@@ -110,7 +110,7 @@ class VirtDut(DPDKdut):
for key in self.ports_cfg.keys():
index = int(key)
if index >= port_num:
- print dts.RED("Can not found [%d ]port info" % index)
+ print utils.RED("Can not found [%d ]port info" % index)
continue
if 'peer' in self.ports_cfg[key].keys():
@@ -210,7 +210,7 @@ class VirtDut(DPDKdut):
total_phycores = socks * cores
# cores should match cpu_topo
if total != len(cpuinfo):
- print dts.RED("Core number not matched!!!")
+ print utils.RED("Core number not matched!!!")
else:
for core in range(total):
thread = core / total_phycores
@@ -378,7 +378,7 @@ class VirtDut(DPDKdut):
vfs = remoteport.get_sriov_vfs_pci()
# if hostpci is vf of tester port
if hostpci == remotepci or hostpci in vfs:
- print dts.RED("Skip ping from same PF device")
+ print utils.RED("Skip ping from same PF device")
continue
ipv6 = self.get_ipv6_address(vmPort)
diff --git a/framework/virt_scene.py b/framework/virt_scene.py
index 896d86b..fd7497d 100644
--- a/framework/virt_scene.py
+++ b/framework/virt_scene.py
@@ -30,7 +30,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import time
-import dts
+import utils
from settings import CONFIG_ROOT_PATH, get_netdev
from config import VirtConf
@@ -38,6 +38,7 @@ from config import VIRTCONF
from exception import *
from qemu_kvm import QEMUKvm
from pmd_output import PmdOutput
+from utils import create_mask
# scenario module for handling scenario
# 1. load configurations
@@ -136,11 +137,11 @@ class VirtScene(object):
def prepare_host(self, **opts):
if 'dpdk' not in opts.keys():
- print dts.RED("Scenario host parameter request dpdk option!!!")
+ print utils.RED("Scenario host parameter request dpdk option!!!")
raise VirtConfigParamException('host')
if 'cores' not in opts.keys():
- print dts.RED("Scenario host parameter request cores option!!!")
+ print utils.RED("Scenario host parameter request cores option!!!")
raise VirtConfigParamException('host')
if 'target' in opts.keys():
@@ -171,7 +172,7 @@ class VirtScene(object):
if int(cpu) not in self.host_dut.virt_pool.cores:
cpus.remove(cpu)
# create core mask for reserver cores
- core_mask = dts.create_mask(cpus)
+ core_mask = create_mask(cpus)
# reserve those skipped cores
self.host_dut.virt_pool.reserve_cpu(core_mask)
@@ -284,7 +285,7 @@ class VirtScene(object):
if 'mac' in param.keys():
pf_net.set_vf_mac_addr(vf_idx, param['mac'])
else:
- print dts.RED("Invalid vf device config, request pf_dev")
+ print utils.RED("Invalid vf device config, request pf_dev")
return vf_param
@@ -302,17 +303,17 @@ class VirtScene(object):
if 'vf_num' in opts.keys():
vf_num = int(opts['vf_num'])
else:
- print dts.RED("No vf_num for port %d, assum one VF" % port)
+ print utils.RED("No vf_num for port %d, assum one VF" % port)
vf_num = 1
if 'driver' in opts.keys():
driver = opts['driver']
try:
- print dts.GREEN("create vf %d %d %s" % (port, vf_num, driver))
+ print utils.GREEN("create vf %d %d %s" % (port, vf_num, driver))
self.host_dut.generate_sriov_vfs_by_port(port, vf_num, driver)
self.reset_pf_cmds(port)
except:
- print dts.RED("Failed to create vf as requested!!!")
+ print utils.RED("Failed to create vf as requested!!!")
raise VirtDeviceCreateException
def handle_dev_destroy(self, **opts):
@@ -320,10 +321,10 @@ class VirtScene(object):
port = int(opts['pf_idx'])
try:
- print dts.GREEN("destroy vfs on port %d" % port)
+ print utils.GREEN("destroy vfs on port %d" % port)
self.host_dut.destroy_sriov_vfs_by_port(port)
except:
- print dts.RED("Failed to destroy vf as requested!!!")
+ print utils.RED("Failed to destroy vf as requested!!!")
def reg_prevm_cmds(self, command):
"""
@@ -343,7 +344,7 @@ class VirtScene(object):
def run_pre_cmds(self):
for cmd in self.pre_cmds:
if cmd['type'] == 'vm':
- print dts.RED("Can't run vm command when vm not ready")
+ print utils.RED("Can't run vm command when vm not ready")
elif cmd['type'] == 'host':
crb = self.host_dut
elif cmd['type'] == 'tester':
@@ -370,7 +371,7 @@ class VirtScene(object):
verify=verify)
if type(ret) is int and ret != 0:
- print dts.RED("Failed to run command %s" % cmd['command'])
+ print utils.RED("Failed to run command %s" % cmd['command'])
raise VirtVmOperationException
def reg_postvm_cmds(self, command):
@@ -417,7 +418,7 @@ class VirtScene(object):
verify=verify)
if type(ret) is int and ret != 0:
- print dts.RED("Failed to run command %s" % cmd['command'])
+ print utils.RED("Failed to run command %s" % cmd['command'])
raise VirtVmOperationException
def merge_params(self, vm, params):
@@ -467,7 +468,7 @@ class VirtScene(object):
self.vms.append(vm_info)
except Exception as e:
- print dts.RED("Failure for %s" % str(e))
+ print utils.RED("Failure for %s" % str(e))
def get_vm_duts(self):
duts = []
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 4/9] framework rst: add class to handle RST report
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (2 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 3/9] framework dut: remove dependency on dts module Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 5/9] framework settings: support global setting load and save Marvin Liu
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Each suite will generate its own rst report. So add new class to support
that.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/rst.py b/framework/rst.py
index 9b8eb69..ef1825c 100644
--- a/framework/rst.py
+++ b/framework/rst.py
@@ -30,9 +30,9 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os
-import dts
import shutil
import re
+from exception import VerifyFailure
"""
Generate Rst Test Result Report
@@ -54,108 +54,108 @@ Result:
path2Plan = 'test_plans'
path2Result = 'output'
-rstName = ""
-rstAnnexName = ""
-
-
-def generate_results_rst(crbName, target, nic, suite, perf=False):
- """
- copy desc from #Name#_test_plan.rst to TestResult_#Name#.rst
- """
- global rstName, rstAnnexName
-
- try:
- path = [path2Result, crbName, target, nic]
- # ensure the level folder exist
- for node in range(0, len(path)):
- if not os.path.exists('/'.join(path[:node + 1])):
- for level in range(node, len(path)):
- os.mkdir('/'.join(path[:level + 1]))
- break
-
- rstName = "%s/TestResult_%s.rst" % ('/'.join(path), suite)
- rstReport = open(rstName, 'w')
-
- if perf is True:
- rstAnnexName = "%s/TestResult_%s_Annex.rst" % ('/'.join(path), suite)
- rstAnnexReport = open(rstAnnexName, 'w')
-
- f = open("%s/%s_test_plan.rst" % (path2Plan, suite), 'r')
- for line in f:
- if line[:13] == "Prerequisites":
- break
- rstReport.write(line)
- if perf is True:
- rstAnnexReport.write(line)
- f.close()
-
- rstReport.close()
-
- except Exception as e:
- raise dts.VerifyFailure("RST Error: " + str(e))
-
-
-def clear_all_rst(crbName, target):
- path = [path2Result, crbName, target]
- shutil.rmtree('/'.join(path), True)
-
-
-def write_title(text):
- """
- write case title Test Case: #Name#
- -----------------
- """
- line = "\n%s\n" % text
- with open(rstName, "a") as f:
- f.write(line)
- f.write('-' * len(line) + '\n')
-
-def write_annex_title(text):
- """
- write annex to test case title Annex to #Name#
- -----------------
- """
- line = "\n%s\n" % text
- with open(rstAnnexName, "a") as f:
- f.write(line)
- f.write('-' * len(line) + '\n')
+class RstReport(object):
-def write_text(text, annex=False):
+ def __init__(self, crbName, target, nic, suite, perf=False):
+ """
+ copy desc from #Name#_test_plan.rst to TestResult_#Name#.rst
+ """
+ try:
+ path = [path2Result, crbName, target, nic]
+ # ensure the level folder exist
+ for node in range(0, len(path)):
+ if not os.path.exists('/'.join(path[:node + 1])):
+ for level in range(node, len(path)):
+ os.mkdir('/'.join(path[:level + 1]))
+ break
- rstFile = rstAnnexName if annex else rstName
+ self.rstName = "%s/TestResult_%s.rst" % ('/'.join(path), suite)
+ rstReport = open(self.rstName, 'w')
- with open(rstFile, "a") as f:
- f.write(text)
-
-
-def write_frame(text, annex=False):
- write_text("\n::\n\n", annex)
- parts = re.findall(r'\S+', text)
- text = ""
- length = 0
-
- for part in parts:
- if length + len(part) > 75:
- text = text + "\n" + " " + part
- length = len(part)
+ if perf is True:
+ self.rstAnnexName = "%s/TestResult_%s_Annex.rst" % (
+ '/'.join(path), suite)
+ rstAnnexReport = open(self.rstAnnexName, 'w')
+
+ f = open("%s/%s_test_plan.rst" % (path2Plan, suite), 'r')
+ for line in f:
+ if line[:13] == "Prerequisites":
+ break
+ rstReport.write(line)
+ if perf is True:
+ rstAnnexReport.write(line)
+ f.close()
+
+ rstReport.close()
+
+ except Exception as e:
+ raise VerifyFailure("RST Error: " + str(e))
+
+ def clear_all_rst(self, crbName, target):
+ path = [path2Result, crbName, target]
+ shutil.rmtree('/'.join(path), True)
+
+ def write_title(self, text):
+ """
+ write case title Test Case: #Name#
+ -----------------
+ """
+ line = "\n%s\n" % text
+ with open(self.rstName, "a") as f:
+ f.write(line)
+ f.write('-' * len(line) + '\n')
+
+ def write_annex_title(self, text):
+ """
+ write annex to test case title Annex to #Name#
+ -----------------
+ """
+ line = "\n%s\n" % text
+ with open(self.rstAnnexName, "a") as f:
+ f.write(line)
+ f.write('-' * len(line) + '\n')
+
+ def write_text(self, text, annex=False):
+ rstFile = self.rstAnnexName if annex else self.rstName
+
+ with open(rstFile, "a") as f:
+ f.write(text)
+
+ def write_frame(self, text, annex=False):
+ self.write_text("\n::\n\n", annex)
+ parts = re.findall(r'\S+', text)
+ text = ""
+ length = 0
+
+ for part in parts:
+ if length + len(part) > 75:
+ text = text + "\n" + " " + part
+ length = len(part)
+ else:
+ length = length + len(part)
+ text = text + " " + part
+ self.write_text(text, annex)
+ self.write_text("\n\n", annex)
+
+ def write_result(self, result):
+ with open(self.rstName, "a") as f:
+ f.write("\nResult: " + result + "\n")
+
+ def include_image(self, image, width=90):
+ """
+ Includes an image in the RST file.
+ The argument must include path, name and extension.
+ """
+ with open(self.rstName, "a") as f:
+ f.write(".. image:: %s\n :width: %d%%\n\n" % (image, width))
+
+ def report(self, text, frame=False, annex=False):
+ """
+ Save report text into rst file.
+ """
+ if frame:
+ self.write_frame(text, annex)
else:
- length = length + len(part)
- text = text + " " + part
- write_text(text, annex)
- write_text("\n\n", annex)
-
-
-def write_result(result):
- with open(rstName, "a") as f:
- f.write("\nResult: " + result + "\n")
-
-
-def include_image(image, width=90):
- """
- Includes an image in the RST file.
- The argument must include path, name and extension.
- """
- with open(rstName, "a") as f:
- f.write(".. image:: %s\n :width: %d%%\n\n" % (image, width))
+ self.write_text(text, annex)
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 5/9] framework settings: support global setting load and save
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (3 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 4/9] framework rst: add class to handle RST report Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 6/9] framework test_result: add class to handle result Marvin Liu
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Support save/load global settings. At most times, setting retrieved from
configuration file or input command, load in running module like dut
object and test suite object.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/settings.py b/framework/settings.py
index 57eacf2..0e18a15 100644
--- a/framework/settings.py
+++ b/framework/settings.py
@@ -31,6 +31,7 @@
"""
Folders for framework running enviornment.
"""
+import os
import re
import socket
@@ -60,8 +61,8 @@ NICS = {
'twinpond': '8086:1528',
'twinville': '8086:1512',
'sageville': '8086:1563',
- 'sagepond' : '8086:15ad',
- 'sagepond_vf':'8086:15a8',
+ 'sagepond': '8086:15ad',
+ 'sagepond_vf': '8086:15a8',
'hartwell': '8086:10d3',
'82545EM': '8086:100f',
'82540EM': '8086:100e',
@@ -78,13 +79,13 @@ NICS = {
'fortville_spirit': '8086:1583',
'fortville_spirit_single': '8086:1584',
'redrockcanyou': '8086:15a4',
- 'fortpark':'8086:374c',
- 'fortpark_TLV':'8086:37d0',
- 'fortpark_TLV_vf':'8086:37cd',
- 'fvl10g_vf':'8086:154c',
+ 'fortpark': '8086:374c',
+ 'fortpark_TLV': '8086:37d0',
+ 'fortpark_TLV_vf': '8086:37cd',
+ 'fvl10g_vf': '8086:154c',
'atwood': '8086:15d5',
- 'ConnectX3':'15b3:1003',
- 'ConnectX4':'15b3:1013',
+ 'ConnectX3': '15b3:1003',
+ 'ConnectX4': '15b3:1013',
'boulderrapid': '8086:15d0',
}
@@ -102,7 +103,7 @@ DRIVERS = {
'twinpond': 'ixgbe',
'twinville': 'ixgbe',
'sageville': 'ixgbe',
- 'sagepond' : 'ixgbe',
+ 'sagepond': 'ixgbe',
'sagepond_vf': 'ixgbevf',
'hartwell': 'igb',
'82545EM': 'igb',
@@ -120,13 +121,13 @@ DRIVERS = {
'fortville_spirit': 'i40e',
'fortville_spirit_single': 'i40e',
'redrockcanyou': 'fm10k',
- 'fortpark':'i40e',
- 'fortpark_TLV':'i40e',
- 'fortpark_TLV_vf':'i40evf',
- 'fvl10g_vf':'i40evf',
+ 'fortpark': 'i40e',
+ 'fortpark_TLV': 'i40e',
+ 'fortpark_TLV_vf': 'i40evf',
+ 'fvl10g_vf': 'i40evf',
'atwood': 'fm10k',
- 'ConnectX3':'mlx4_core',
- 'ConnectX4':'mlx5_core',
+ 'ConnectX3': 'mlx4_core',
+ 'ConnectX4': 'mlx5_core',
'boulderrapid': 'fm10k',
}
@@ -180,6 +181,18 @@ The log name seperater.
"""
LOG_NAME_SEP = '.'
+"""
+DTS global environment variable
+"""
+DTS_ENV_PAT = r"DTS_*"
+PERF_SETTING = "DTS_PERF_ONLY"
+FUNC_SETTING = "DTS_FUNC_ONLY"
+HOST_DRIVER_SETTING = "DTS_HOST_DRIVER"
+HOST_NIC_SETTING = "DTS_HOST_NIC"
+DEBUG_SETTING = "DTS_DEBUG_ENABLE"
+DEBUG_CASE_SETTING = "DTS_DEBUGCASE_ENABLE"
+DPDK_RXMODE_SETTING = "DTS_DPDK_RXMODE"
+
def get_nic_name(type):
"""
@@ -214,6 +227,7 @@ def get_netdev(crb, pci):
return None
+
def get_host_ip(address):
ip_reg = r'\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}'
m = re.match(ip_reg, address)
@@ -221,8 +235,54 @@ def get_host_ip(address):
return address
else:
try:
- result=socket.gethostbyaddr(address)
+ result = socket.gethostbyaddr(address)
return result[2][0]
except:
print "couldn't look up %s" % address
return ''
+
+
+def save_global_setting(key, value):
+ """
+ Save DTS global setting
+ """
+ if re.match(DTS_ENV_PAT, key):
+ env_key = key
+ else:
+ env_key = "DTS_" + key
+
+ os.environ[env_key] = value
+
+
+def load_global_setting(key):
+ """
+ Load DTS global setting
+ """
+ if re.match(DTS_ENV_PAT, key):
+ env_key = key
+ else:
+ env_key = "DTS_" + key
+
+ if env_key in os.environ.keys():
+ return os.environ[env_key]
+ else:
+ return ''
+
+
+def accepted_nic(pci_id):
+ """
+ Return True if the pci_id is a known NIC card in the settings file and if
+ it is selected in the execution file, otherwise it returns False.
+ """
+ nic = load_global_setting(HOST_NIC_SETTING)
+ if pci_id not in settings.NICS.values():
+ return False
+
+ if nic is 'any':
+ return True
+
+ else:
+ if pci_id == settings.NICS[nic]:
+ return True
+
+ return False
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 6/9] framework test_result: add class to handle result
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (4 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 5/9] framework settings: support global setting load and save Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 7/9] framework test_case: add test case handle logic Marvin Liu
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Each suite will own itselves table result and remove table handle
function in dts module.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/test_result.py b/framework/test_result.py
index 9cef34c..e5a2b4e 100644
--- a/framework/test_result.py
+++ b/framework/test_result.py
@@ -32,6 +32,7 @@
"""
Generic result container and reporters
"""
+import texttable # text format
class Result(object):
@@ -151,13 +152,16 @@ class Result(object):
self.__test_result = result
self.__message = message
+ def copy_suite(self, suite_result):
+ self.__current_suites()[self.__test_suite + 1] = suite_result.__current_cases()
+
def test_case_passed(self):
"""
Set last test case added as PASSED
"""
self.__set_test_case_result(result='PASSED', message='')
- def test_case_skip(self,message):
+ def test_case_skip(self, message):
"""
set last test case add as N/A
"""
@@ -290,3 +294,60 @@ class Result(object):
message = property(__get_message)
nic = property(__get_nic, __set_nic)
internals = property(__get_internals)
+
+
+class ResultTable(object):
+
+ def __init__(self, header):
+ """
+ Add the title of result table.
+ Usage:
+ rt = ResultTable(header)
+ rt.add_row(row)
+ rt.table_print()
+ """
+ self.results_table_rows = []
+ self.results_table_rows.append([])
+ self.table = texttable.Texttable(max_width=150)
+ self.results_table_header = header
+ self.logger = None
+ self.rst = None
+
+ def set_rst(self, rst):
+ self.rst = rst
+
+ def set_logger(self, logger):
+ self.logger = logger
+
+ def add_row(self, row):
+ """
+ Add one row to result table.
+ """
+ self.results_table_rows.append(row)
+
+ def table_print(self):
+ """
+ Show off result table.
+ """
+ self.table.add_rows(self.results_table_rows)
+ self.table.header(self.results_table_header)
+
+ alignments = []
+ # all header align to left
+ for _ in self.results_table_header:
+ alignments.append("l")
+ self.table.set_cols_align(alignments)
+
+ out = self.table.draw()
+ if self.rst:
+ self.rst.write_text('\n' + out + '\n\n')
+ if self.logger:
+ self.logger.info('\n' + out)
+
+###############################################################################
+###############################################################################
+if __name__ == "__main__":
+ rt = ResultTable(header=['name', 'age'])
+ rt.add_row(['Jane', '30'])
+ rt.add_row(['Mark', '32'])
+ rt.table_print()
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 7/9] framework test_case: add test case handle logic
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (5 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 6/9] framework test_result: add class to handle result Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 8/9] framework utils: move shared function from dts module Marvin Liu
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Suite or cases issue will be handled in suite module, create suite owned
result table and rst object. Move most of execution logic from dts to
suite module.
Suite self logger also handled in test_case module. Add function to
support case filter and return test result.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/test_case.py b/framework/test_case.py
index 6695d68..b603b48 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -32,20 +32,37 @@
"""
A base class for creating DTF test cases.
"""
+import re
+import debugger
+import traceback
+import signal
-import dts
-from exception import VerifyFailure
-from settings import DRIVERS, NICS, get_nic_name
+from exception import VerifyFailure, TimeoutException
+from settings import DRIVERS, NICS, get_nic_name, load_global_setting
+from settings import PERF_SETTING, FUNC_SETTING, DEBUG_SETTING, DEBUG_CASE_SETTING, HOST_DRIVER_SETTING
+from rst import RstReport
+from test_result import ResultTable, Result
+from logger import getLogger
class TestCase(object):
- def __init__(self, duts, tester, target, suite):
+ def __init__(self, duts, tester, target, suitename):
+ self.suite_name = suitename
self.dut = duts[0]
self.duts = duts
self.tester = tester
self.target = target
- self.suite = suite
+
+ # get log handler
+ class_name = self.__class__.__name__
+ print class_name
+ self.logger = getLogger(class_name)
+ self.logger.config_suite(class_name)
+ # local variable
+ self._requested_tests = None
+
+ # covert netdevice to codename
self.nics = []
for portid in range(len(self.dut.ports_info)):
nic_type = self.dut.ports_info[portid]['type']
@@ -54,7 +71,42 @@ class TestCase(object):
self.nic = self.nics[0]
else:
self.nic = ''
- self.kdriver = self.get_nic_driver(self.nic)
+ self.kdriver = self._get_nic_driver(self.nic)
+
+ # result object for save suite result
+ self._suite_result = Result()
+ self._suite_result.dut = self.dut.crb['IP']
+ self._suite_result.target = target
+ self._suite_result.nic = self.nic
+ self._suite_result.test_suite = self.suite_name
+ if self._suite_result is None:
+ raise ValueError("Result object should not None")
+
+ # load running enviornment
+ if load_global_setting(PERF_SETTING) == "yes":
+ self._enable_perf = True
+ else:
+ self._enable_perf = False
+
+ if load_global_setting(FUNC_SETTING) == "yes":
+ self._enable_func = True
+ else:
+ self._enable_func = False
+
+ if load_global_setting(DEBUG_SETTING) == "yes":
+ self._enable_debug = True
+ else:
+ self._enable_debug = False
+
+ if load_global_setting(DEBUG_CASE_SETTING) == "yes":
+ self._debug_case = True
+ else:
+ self._debug_case = False
+
+ self.drivername = load_global_setting(HOST_DRIVER_SETTING)
+
+ # create rst format report for this suite
+ self._rst_obj = RstReport('rst_report', target, self.nic, self.suite_name, self._enable_perf)
def set_up_all(self):
pass
@@ -72,18 +124,194 @@ class TestCase(object):
if not passed:
raise VerifyFailure(description)
- def get_nic_driver(self, nic_name):
+ def _get_nic_driver(self, nic_name):
if nic_name in DRIVERS.keys():
return DRIVERS[nic_name]
return "Unknown"
- def get_nic_name(self, pci_id):
- for nic_name, pci in NICS.items():
- if pci_id == pci:
- return nic_name
+ def set_check_inst(self, check=None, support=None):
+ self._check_inst = check
+ self._support_inst = support
+
+ def rst_report(self, *args, **kwargs):
+ self._rst_obj.report(*args, **kwargs)
+
+ def result_table_create(self, header):
+ self._result_table = ResultTable(self.table_header)
+ self._result_table.set_rst(self._rst_obj)
+ self._result_table.set_logger(self.logger)
+
+ def result_table_add(self, row):
+ self._result_table.add_row(row)
+
+ def result_table_print(self):
+ self._result_table.table_print()
+
+ def result_table_getrows(self):
+ return self._result_table.results_table_rows
+
+ def _get_functional_cases(self):
+ """
+ Get all functional test cases.
+ """
+ return self._get_test_cases(self, r'test_(?!perf_)')
+
+ def _get_performance_cases(self):
+ """
+ Get all performance test cases.
+ """
+ return self._get_test_cases(r'test_perf_')
+
+ def _has_it_been_requested(self, test_case, test_name_regex):
+ """
+ Check whether test case has been requested for validation.
+ """
+ name_matches = re.match(test_name_regex, test_case.__name__)
+
+ if self._requested_tests is not None:
+ return name_matches and test_case.__name__ in self._requested_tests
+
+ return name_matches
+
+ def set_requested_cases(self, case_list):
+ """
+ Pass down input cases list for check
+ """
+ self._requested_tests = case_list
+
+ def _get_test_cases(self, test_name_regex):
+ """
+ Return case list which name matched regex.
+ """
+ for test_case_name in dir(self):
+ test_case = getattr(self, test_case_name)
+ if callable(test_case) and self._has_it_been_requested(test_case, test_name_regex):
+ yield test_case
+
+ def execute_setup_all(self):
+ """
+ Execute suite setup_all function before cases.
+ """
+ # clear all previous output
+ for dutobj in self.duts:
+ dutobj.get_session_output(timeout=0.1)
+ self.tester.get_session_output(timeout=0.1)
+
+ try:
+ self.set_up_all()
+ return True
+ except Exception:
+ self.logger.error('set_up_all failed:\n' + traceback.format_exc())
+ # record all cases blocked
+ if self._enable_func:
+ for case_obj in self._get_functional_cases():
+ self._suite_result.test_case = case_obj.__name__
+ self._suite_result.test_case_blocked('set_up_all failed')
+ if self._enable_perf:
+ for case_obj in self._get_performance_cases():
+ self._suite_result.test_case = case_obj.__name__
+ self._suite_result.test_case_blocked('set_up_all failed')
+ return False
+
+ def _execute_test_case(self, case_obj):
+ """
+ Execute specified test case in specified suite. If any exception occured in
+ validation process, save the result and tear down this case.
+ """
+ case_name = case_obj.__name__
+ self._suite_result.test_case = case_obj.__name__
+
+ self._rst_obj.write_title("Test Case: " + case_name)
+
+ if self._check_inst is not None:
+ if self._check_inst.case_skip(case_name[len("test_"):]):
+ self.logger.info('Test Case %s Result SKIPED:' % case_name)
+ self._rst_obj.write_result("N/A")
+ self._suite_result.test_case_skip(check_case_inst.comments)
+ return
+
+ if self._support_inst is not None:
+ if not self._support_inst.case_support(case_name[len("test_"):]):
+ self.logger.info('Test Case %s Result SKIPED:' % case_name)
+ self._rst_obj.write_result("N/A")
+ self._suite_result.test_case_skip(support_case_inst.comments)
+ return
+
+ if self._enable_perf:
+ self._rst_obj.write_annex_title("Annex: " + case_name)
+ try:
+ self.logger.info('Test Case %s Begin' % case_name)
+
+ self.running_case = case_name
+ # clean session
+ for dutobj in self.duts:
+ dutobj.get_session_output(timeout=0.1)
+ self.tester.get_session_output(timeout=0.1)
+ # run set_up function for each case
+ self.set_up()
+ # prepare debugger re-run case environment
+ if self._enable_debug or self._debug_case:
+ debugger.AliveSuite = self
+ debugger.AliveModule = __import__('TestSuite_' + self.suite_name)
+ debugger.AliveCase = case_name
+ if self._debug_case:
+ debugger.keyboard_handle(signal.SIGINT, None)
+ else:
+ case_obj()
+
+ self._suite_result.test_case_passed()
+
+ self._rst_obj.write_result("PASS")
+ self.logger.info('Test Case %s Result PASSED:' % case_name)
+
+ except VerifyFailure as v:
+ self._suite_result.test_case_failed(str(v))
+ self_rst_obj.write_result("FAIL")
+ self.logger.error('Test Case %s Result FAILED: ' % (case_name) + str(v))
+ except KeyboardInterrupt:
+ self._suite_result.test_case_blocked("Skipped")
+ self.logger.error('Test Case %s SKIPED: ' % (case_name))
+ raise KeyboardInterrupt("Stop DCTS")
+ except TimeoutException as e:
+ self._rst_obj.write_result("FAIL")
+ msg = str(e)
+ self._suite_result.test_case_failed(msg)
+ self.logger.error('Test Case %s Result FAILED: ' % (case_name) + msg)
+ self.logger.error('%s' % (e.get_output()))
+ except Exception:
+ trace = traceback.format_exc()
+ self._suite_result.test_case_failed(trace)
+ self.logger.error('Test Case %s Result ERROR: ' % (case_name) + trace)
+ finally:
+ self.tear_down()
+
+ def execute_test_cases(self):
+ """
+ Execute all test cases in one suite.
+ """
+ if load_global_setting(FUNC_SETTING) == 'yes':
+ for case_obj in self._get_functional_cases():
+ self._execute_test_case(case_obj)
+ if load_global_setting(PERF_SETTING) == 'yes':
+ for case_obj in self._get_performance_cases():
+ self._execute_test_case(case_obj)
+
+ def get_result(self):
+ return self._suite_result
+
+ def execute_tear_downall(self):
+ """
+ execute suite tear_down_all function
+ """
+ try:
+ self.tear_down_all()
+ except Exception:
+ self.logger.error('tear_down_all failed:\n' + traceback.format_exc())
- raise ValueError(nic_name)
+ for dutobj in self.duts:
+ dutobj.kill_all()
+ self.tester.kill_all()
def wirespeed(self, nic, frame_size, num_ports):
"""
@@ -91,10 +319,10 @@ class TestCase(object):
"""
bitrate = 1000.0 # 1Gb ('.0' forces to operate as float)
if self.nic == "any" or self.nic == "cfg":
- driver = dts.get_nic_driver(self.dut.ports_info[0]['type'])
- nic = self.get_nic_name(self.dut.ports_info[0]['type'])
+ driver = self._get_nic_driver(self.dut.ports_info[0]['type'])
+ nic = get_nic_name(self.dut.ports_info[0]['type'])
else:
- driver = self.get_nic_driver(self.nic)
+ driver = self._get_nic_driver(self.nic)
nic = self.nic
if driver == "ixgbe":
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 8/9] framework utils: move shared function from dts module
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (6 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 7/9] framework test_case: add test case handle logic Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 9/9] tests: remove dependencies of " Marvin Liu
2016-08-04 6:07 ` [dts] [PATCH 0/9] optimize overall execution process Liu, Yong
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Some functions need shared with all modules in dts, remove them from dts
module to utils module. This will help on the decouple of each module.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/utils.py b/framework/utils.py
index 48bba0e..edfeeca 100644
--- a/framework/utils.py
+++ b/framework/utils.py
@@ -31,6 +31,10 @@
import json # json format
import re
+import os
+import inspect
+
+DTS_ENV_PAT = r"DTS_*"
def RED(text):
@@ -99,6 +103,7 @@ def remove_old_rsa_key(crb, ip):
(ip.strip(), rsa_key_path)
crb.send_expect(remove_rsa_key_cmd, "# ")
+
def human_read_number(num):
if num > 1000000:
num /= 1000000
@@ -108,3 +113,28 @@ def human_read_number(num):
return str(num) + "K"
else:
return str(num)
+
+
+def get_subclasses(module, clazz):
+ """
+ Get module attribute name and attribute.
+ """
+ for subclazz_name, subclazz in inspect.getmembers(module):
+ if hasattr(subclazz, '__bases__') and clazz in subclazz.__bases__:
+ yield (subclazz_name, subclazz)
+
+
+def copy_instance_attr(from_inst, to_inst):
+ for key in from_inst.__dict__.keys():
+ to_inst.__dict__[key] = from_inst.__dict__[key]
+
+
+def create_mask(indexes):
+ """
+ Convert index to hex mask.
+ """
+ val = 0
+ for index in indexes:
+ val |= 1 << int(index)
+
+ return hex(val).rstrip("L")
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dts] [PATCH 9/9] tests: remove dependencies of dts module
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (7 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 8/9] framework utils: move shared function from dts module Marvin Liu
@ 2016-08-04 5:38 ` Marvin Liu
2016-08-04 6:07 ` [dts] [PATCH 0/9] optimize overall execution process Liu, Yong
9 siblings, 0 replies; 11+ messages in thread
From: Marvin Liu @ 2016-08-04 5:38 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Remove dts module from every suite. Suites now only have dependencies on
some basic modules.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/tests/TestSuite_blacklist.py b/tests/TestSuite_blacklist.py
index 06dbf87..dd47ede 100644
--- a/tests/TestSuite_blacklist.py
+++ b/tests/TestSuite_blacklist.py
@@ -33,7 +33,7 @@
DPDK Test suite.
Test device blacklisting.
"""
-import dts
+import utils
from test_case import TestCase
from pmd_output import PmdOutput
@@ -78,7 +78,7 @@ class TestBlackList(TestCase):
regexp_blacklisted_port = self.regexp_blacklisted_port % (int(pci.split(':')[0], 16), pci.split(':')[1])
else:
regexp_blacklisted_port = self.regexp_blacklisted_port % self.dut.ports_info[port]['pci']
- matching_ports = dts.regexp(output, regexp_blacklisted_port, True)
+ matching_ports = utils.regexp(output, regexp_blacklisted_port, True)
if blacklisted:
self.verify(len(matching_ports) == 1,
"Blacklisted port is being initialized")
@@ -92,7 +92,7 @@ class TestBlackList(TestCase):
"""
out = self.pmdout.start_testpmd("Default")
rexp = r"Link"
- match_status = dts.regexp(out, rexp, True)
+ match_status = utils.regexp(out, rexp, True)
self.check_blacklisted_ports(out, self.ports)
diff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py
index 7dc8ddc..7a05b6d 100644
--- a/tests/TestSuite_checksum_offload.py
+++ b/tests/TestSuite_checksum_offload.py
@@ -36,10 +36,10 @@ Test support of RX/TX Checksum Offload Features by Poll Mode Drivers.
"""
-import dts
import string
import re
import rst
+import utils
from test_case import TestCase
from pmd_output import PmdOutput
@@ -56,7 +56,7 @@ class TestChecksumOffload(TestCase):
# Verify that enough ports are available
self.verify(len(self.dut_ports) >= 1, "Insufficient ports for testing")
self.pmdout = PmdOutput(self.dut)
- self.portMask = dts.create_mask([self.dut_ports[0]])
+ self.portMask = utils.create_mask([self.dut_ports[0]])
self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
def set_up(self):
@@ -272,7 +272,7 @@ class TestChecksumOffload(TestCase):
result.append(Pps[str(size)])
result.append(Pct[str(size)])
- dts.results_table_add_row(result)
+ self.result_table_add(result)
def test_perf_checksum_throughtput(self):
"""
@@ -293,7 +293,7 @@ class TestChecksumOffload(TestCase):
del pkts['IP/SCTP']
lcore = "1S/2C/1T"
- portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
for mode in ["sw", "hw"]:
self.logger.info("%s performance" % mode)
rst.write_text(mode + " Performance" + '\r\n')
@@ -301,7 +301,7 @@ class TestChecksumOffload(TestCase):
for size in sizes:
tblheader.append("%sB mpps" % str(size))
tblheader.append("%sB %% " % str(size))
- dts.results_table_add_header(tblheader)
+ self.result_table_create(tblheader)
self.pmdout.start_testpmd(
lcore, "--portmask=%s" % self.portMask, socket=self.ports_socket)
@@ -321,7 +321,7 @@ class TestChecksumOffload(TestCase):
self.dut.send_expect("stop", "testpmd> ")
self.dut.send_expect("quit", "#", 10)
- dts.results_table_print()
+ self.result_table_print()
def tear_down(self):
"""
diff --git a/tests/TestSuite_cloud_filter.py b/tests/TestSuite_cloud_filter.py
index 7348aea..3df9678 100644
--- a/tests/TestSuite_cloud_filter.py
+++ b/tests/TestSuite_cloud_filter.py
@@ -5,7 +5,6 @@ Test Cloud Filters features in DPDK.
"""
-import dts
import string
import re
import time
diff --git a/tests/TestSuite_cmdline.py b/tests/TestSuite_cmdline.py
index 13b0e63..e4e1be9 100644
--- a/tests/TestSuite_cmdline.py
+++ b/tests/TestSuite_cmdline.py
@@ -34,8 +34,7 @@ DPDK Test suite.
Test cmdline.
"""
-import dts
-
+import utils
from test_case import TestCase
@@ -57,7 +56,7 @@ class TestCmdline(TestCase):
# Run cmdline app
cores = self.dut.get_core_list('1S/1C/1T')
- coreMask = dts.create_mask(cores)
+ coreMask = utils.create_mask(cores)
self.dut.send_expect("./examples/cmdline/build/app/cmdline -n 1 -c " + coreMask, "> ", 10)
def set_up(self):
diff --git a/tests/TestSuite_coremask.py b/tests/TestSuite_coremask.py
index 4f6f4bd..0d3feff 100644
--- a/tests/TestSuite_coremask.py
+++ b/tests/TestSuite_coremask.py
@@ -7,7 +7,7 @@ Test coremask parsing in DPDK.
"""
-import dts
+import utils
from exception import VerifyFailure
from test_case import TestCase
@@ -35,7 +35,7 @@ class TestCoremask(TestCase):
Coremask Prerequisites.
"""
- self.port_mask = dts.create_mask(self.dut.get_ports(self.nic))
+ self.port_mask = utils.create_mask(self.dut.get_ports(self.nic))
self.mem_channel = self.dut.get_memory_channels()
self.all_cores = self.dut.get_core_list("all")
@@ -53,7 +53,7 @@ class TestCoremask(TestCase):
for core in self.all_cores:
- core_mask = dts.create_mask([core])
+ core_mask = utils.create_mask([core])
command = command_line % (self.target, core_mask,
self.mem_channel)
@@ -73,7 +73,7 @@ class TestCoremask(TestCase):
Check coremask parsing for all the cores at once.
"""
- core_mask = dts.create_mask(self.all_cores)
+ core_mask = utils.create_mask(self.all_cores)
command = command_line % (self.target, core_mask, self.mem_channel)
diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py
index 1089b7f..81e370a 100644
--- a/tests/TestSuite_dual_vlan.py
+++ b/tests/TestSuite_dual_vlan.py
@@ -37,7 +37,7 @@ Test the support of Dual VLAN Offload Features by Poll Mode Drivers.
"""
-import dts
+import utils
import random
import re
@@ -90,12 +90,12 @@ class TestDualVlan(TestCase):
self.ports_socket = self.dut.get_numa_id(ports[0])
cores = self.dut.get_core_list('1S/2C/2T')
- coreMask = dts.create_mask(cores)
+ coreMask = utils.create_mask(cores)
ports = self.dut.get_ports(self.nic)
valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
- portMask = dts.create_mask(valports[:2])
+ portMask = utils.create_mask(valports[:2])
dutRxPortId = valports[0]
dutTxPortId = valports[1]
diff --git a/tests/TestSuite_dynamic_config.py b/tests/TestSuite_dynamic_config.py
index 7df02b7..fa4b932 100644
--- a/tests/TestSuite_dynamic_config.py
+++ b/tests/TestSuite_dynamic_config.py
@@ -36,7 +36,7 @@ Test the dynamic driver configuration feature.
"""
-import dts
+import utils
from test_case import TestCase
@@ -71,8 +71,8 @@ class TestDynamicConfig(TestCase):
# Prepare cores and ports
cores = self.dut.get_core_list('1S/2C/2T')
- coreMask = dts.create_mask(cores)
- portMask = dts.create_mask(self.dut_ports[:2])
+ coreMask = utils.create_mask(cores)
+ portMask = utils.create_mask(self.dut_ports[:2])
# launch app
cmd = "./%s/build/app/test-pmd/testpmd -c %s -n 3 -- -i --rxpt=0 \
@@ -87,7 +87,7 @@ class TestDynamicConfig(TestCase):
self.dest = self.dut.get_mac_address(self.dut_ports[0])
mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
- ret = dts.regexp(out, mac_scanner)
+ ret = utils.regexp(out, mac_scanner)
self.verify(ret is not None, "MAC address not found")
self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
@@ -124,14 +124,14 @@ class TestDynamicConfig(TestCase):
# get the current rx statistic
out = self.dut.send_expect("clear port stats all" , "testpmd> ")
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# send one packet with different MAC address than the portid
self.dynamic_config_send_packet(portid)
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
@@ -142,7 +142,7 @@ class TestDynamicConfig(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
@@ -158,20 +158,20 @@ class TestDynamicConfig(TestCase):
self.dut.send_expect("set promisc all off", "testpmd> ")
out = self.dut.send_expect(
"show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.dynamic_config_send_packet(portid)
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect(
"show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.verify(int(cur_rxpkt) == int(
pre_rxpkt), "1st packet increasment error")
self.dynamic_config_send_packet(portid, self.dest)
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect(
"show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.verify(int(cur_rxpkt) == int(
pre_rxpkt) + 1, "2nd packet increasment error")
else:
@@ -180,7 +180,7 @@ class TestDynamicConfig(TestCase):
# get the current rx statistic
out = self.dut.send_expect(
"show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# send one packet with different MAC address than the portid
self.dynamic_config_send_packet(portid)
@@ -188,7 +188,7 @@ class TestDynamicConfig(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect(
"show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(
@@ -200,7 +200,7 @@ class TestDynamicConfig(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect(
"show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(
@@ -221,7 +221,7 @@ class TestDynamicConfig(TestCase):
self.dynamic_config_send_packet(self.dut_ports[0],"ff:ff:ff:ff:ff:ff")
out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.verify(int(cur_rxpkt) == 1, "not received broadcast packet")
self.dut.send_expect("clear port stats all", "testpmd> ")
@@ -229,7 +229,7 @@ class TestDynamicConfig(TestCase):
self.dynamic_config_send_packet(self.dut_ports[0])
out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.verify(int(cur_rxpkt) == 0, "disable promisc, received a dst mac not match packet")
def test_dynamic_config_allmulticast(self):
@@ -247,7 +247,7 @@ class TestDynamicConfig(TestCase):
self.dynamic_config_send_packet(self.dut_ports[0],"01:00:00:33:00:01")
out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.verify(int(cur_rxpkt) == 1, "enable allmulti switch, not received allmulti packet")
self.dut.send_expect("clear port stats all", "testpmd> ")
@@ -256,7 +256,7 @@ class TestDynamicConfig(TestCase):
self.dynamic_config_send_packet(self.dut_ports[0],"01:00:00:33:00:01")
out = self.dut.send_expect("show port stats %d" % self.dut_ports[1], "testpmd> ")
- cur_rxpkt = dts.regexp(out, "TX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "TX-packets: ([0-9]+)")
self.verify(int(cur_rxpkt) == 0, "disable allmulti switch, received allmulti packet")
def test_dynamic_config_enable_promiscuous(self):
@@ -270,14 +270,14 @@ class TestDynamicConfig(TestCase):
# get the current rx statistic
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# send one packet with different MAC address than the portid
self.dynamic_config_send_packet(portid)
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
@@ -288,7 +288,7 @@ class TestDynamicConfig(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the pakcet increasment
self.verify(int(cur_rxpkt) == int(pre_rxpkt)
diff --git a/tests/TestSuite_fdir.py b/tests/TestSuite_fdir.py
index 537ab1f..40c9783 100644
--- a/tests/TestSuite_fdir.py
+++ b/tests/TestSuite_fdir.py
@@ -41,7 +41,7 @@ import string
from time import sleep
from scapy.utils import struct, socket, PcapWriter
-import dts
+import utils
from etgen import IxiaPacketGenerator
from test_case import TestCase
from settings import HEADER_SIZE
@@ -98,19 +98,19 @@ class TestFdir(TestCase, IxiaPacketGenerator):
if m:
m.groups()
if (self.queue == int(m.group(2))):
- print dts.GREEN("Pass: queue id is " + m.group(2))
+ print utils.GREEN("Pass: queue id is " + m.group(2))
self.verify(1, "Pass")
else:
- print dts.RED("Fail: queue id is " + m.group(2))
+ print utils.RED("Fail: queue id is " + m.group(2))
self.verify(0, "Fail")
print out
else:
print "not match"
if (-1 == self.queue):
- print dts.GREEN("Pass: fdir should not match ")
+ print utils.GREEN("Pass: fdir should not match ")
self.verify(1, "Pass")
else:
- print dts.RED("Fail")
+ print utils.RED("Fail")
self.verify(0, "Fail")
print out
print "**************Print sub-case result****************"
@@ -140,11 +140,11 @@ class TestFdir(TestCase, IxiaPacketGenerator):
self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
# Verify that enough threads are available
- self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
+ self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
cores = self.dut.get_core_list("1S/5C/1T")
self.verify(cores is not None, "Insufficient cores for speed testing")
- self.coreMask = dts.create_mask(cores)
- self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ self.coreMask = utils.create_mask(cores)
+ self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
self.dut_rx_port = self.tester.get_local_port(self.dut_ports[0])
self.dut_rx_interface = self.tester.get_interface(self.dut_rx_port)
@@ -239,7 +239,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
"""
self.dut.kill_all()
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -315,10 +315,10 @@ class TestFdir(TestCase, IxiaPacketGenerator):
self.dut.kill_all()
if self.nic in ["niantic"]:
# Niantic ipv6 only support signature mode
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV"]:
# Fortville ipv6 support perfect mode
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -386,7 +386,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
def test_fdir_noflexword_drop_ipv4(self):
# drop command testing
self.dut.kill_all()
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -464,7 +464,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
# drop command testing
self.dut.kill_all()
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -521,7 +521,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
self.dut.kill_all()
# fwd testing with flexword
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -600,10 +600,10 @@ class TestFdir(TestCase, IxiaPacketGenerator):
# fwd testing with flexword
if self.nic in ["niantic"]:
# Niantic ipv6 only support signature mode
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=signature" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
elif self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV"]:
# fortville ipv6 support perfect mode
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -670,7 +670,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
def test_fdir_flexword_drop_ipv4(self):
# drop testing with flexword
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -728,7 +728,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
# Niantic is not support in drop ipv6
if (self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV"]):
# drop testing with flexword
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=4 --txq=4 --nb-cores=4 --nb-ports=1 --pkt-filter-mode=perfect" % (self.target, self.coreMask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -771,7 +771,7 @@ class TestFdir(TestCase, IxiaPacketGenerator):
self.dut.kill_all()
- self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=8 --txq=8 --nb-cores=16 --nb-ports=2 --pkt-filter-mode=perfect" % (self.target, self.all_cores_mask, dts.create_mask([self.dut_ports[0]])), "testpmd>", 120)
+ self.dut.send_expect("./%s/app/testpmd -c %s -n 4 -- -i --portmask=%s --disable-rss --rxq=8 --txq=8 --nb-cores=16 --nb-ports=2 --pkt-filter-mode=perfect" % (self.target, self.all_cores_mask, utils.create_mask([self.dut_ports[0]])), "testpmd>", 120)
self.dut.send_expect("set verbose 1", "testpmd>")
self.dut.send_expect("set fwd rxonly", "testpmd>")
@@ -855,8 +855,8 @@ class TestFdir(TestCase, IxiaPacketGenerator):
else:
self.queues = 1
- core_mask = dts.create_mask(core_list)
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ core_mask = utils.create_mask(core_list)
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
if test_type == "fdir_disable":
command_line = "./%s/app/testpmd -c 0xff00ff -n %d -- -i --rxq=2 --txq=2 --rxd=512 --txd=512 --burst=32 --rxfreet=64 --txfreet=64 --mbcache=256 \
@@ -869,8 +869,8 @@ class TestFdir(TestCase, IxiaPacketGenerator):
info = "Executing PMD using %s\n" % test_cycle['cores']
self.logger.info(info)
- dts.report(info, annex=True)
- dts.report(command_line + "\n\n", frame=True, annex=True)
+ self.rst_report(info, annex=True)
+ self.rst_report(command_line + "\n\n", frame=True, annex=True)
out = self.dut.send_expect(command_line, "testpmd> ", 100)
print out
@@ -932,16 +932,16 @@ class TestFdir(TestCase, IxiaPacketGenerator):
frame_size] > 0, "No traffic detected")
# Print results
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
for frame_size in self.frame_sizes:
table_row = [frame_size]
for test_cycle in self.test_cycles:
table_row.append(test_cycle['Mpps'][frame_size])
table_row.append(test_cycle['pct'][frame_size])
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def ip(self, port, frag, src, proto, tos, dst, chksum, len, version, flags, ihl, ttl, id, options=None):
"""
diff --git a/tests/TestSuite_fm10k_perf.py b/tests/TestSuite_fm10k_perf.py
index c092950..a76aba4 100644
--- a/tests/TestSuite_fm10k_perf.py
+++ b/tests/TestSuite_fm10k_perf.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Layer-3 forwarding test script.
"""
-import dts
+import utils
import string
import re
from test_case import TestCase
@@ -288,7 +288,7 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate", "latency_max(us)", "latency_min(us)", "latency_avg(us)"]
self.l3fwd_test_results['header'] = header_row
- dts.results_table_add_header(header_row)
+ utils.result_table_create(header_row)
self.l3fwd_test_results['data'] = []
mac = ["02:00:00:00:00:00", "02:00:00:00:00:01"]
@@ -303,9 +303,9 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,',')))
self.tester.scapy_execute()
- dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size),
+ self.rst_report("Flows for 2 ports, %d frame size.\n" % (frame_size),
annex=True)
- dts.report("%s" % string.join(flows, '\n'),
+ self.rst_report("%s" % string.join(flows, '\n'),
frame=True, annex=True)
@@ -327,7 +327,7 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key])
self.logger.info("%s\n" % str(corelist))
- coreMask[key] = dts.create_mask(set(corelist))
+ coreMask[key] = utils.create_mask(set(corelist))
# measure by two different mode
#methods = TestFM10kL3fwd.methods
@@ -343,15 +343,15 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
mode, cores, frame_size)
self.logger.info(info)
- dts.report(info, annex=True)
+ self.rst_report(info, annex=True)
subtitle.append(cores)
cmdline = rtCmdLines[cores] % (TestFM10kL3fwd.path + "l3fwd_" + mode, coreMask[cores],
- self.dut.get_memory_channels(), dts.create_mask(valports[:2]))
+ self.dut.get_memory_channels(), utils.create_mask(valports[:2]))
if frame_size > 1518:
cmdline = cmdline + " --max-pkt-len %d" % frame_size
- dts.report(cmdline + "\n", frame=True, annex=True)
+ self.rst_report(cmdline + "\n", frame=True, annex=True)
out = self.dut.send_expect(cmdline, "L3FWD:", 120)
@@ -386,16 +386,16 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
for latency in latencys:
if latency['max'] > 0:
data_row = [frame_size, mode, cores, str(pps), str(pct), str(latency['max']/1000), str(latency['min']/1000), str(latency['average']/1000)]
- dts.results_table_add_row(data_row)
+ utils.result_table_add(data_row)
self.l3fwd_test_results['data'].append(data_row)
- dts.results_table_print()
+ self.result_table_print()
def perf_rfc2544(self):
header_row = ["Frame", "mode", "S/C/T", "tx_pkts(1min)", "LR_rx_pkts(1min)", "LR_loss_pkts(1min)", "% zero_loss_rate(0.01%loss)"]
self.l3fwd_test_results['header'] = header_row
- dts.results_table_add_header(header_row)
+ self.result_table_create(header_row)
self.l3fwd_test_results['data'] = []
for frame_size in TestFM10kL3fwd.frame_sizes:
@@ -409,9 +409,9 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,',')))
self.tester.scapy_execute()
- dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size),
+ self.rst_report("Flows for 2 ports, %d frame size.\n" % (frame_size),
annex=True)
- dts.report("%s" % string.join(flows, '\n'),
+ self.rst_report("%s" % string.join(flows, '\n'),
frame=True, annex=True)
@@ -433,7 +433,7 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key])
self.logger.info("%s\n" % str(corelist))
- coreMask[key] = dts.create_mask(set(corelist))
+ coreMask[key] = utils.create_mask(set(corelist))
# measure by two different mode
for mode in TestFM10kL3fwd.methods:
@@ -449,16 +449,16 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
mode, cores, frame_size)
self.logger.info(info)
- dts.report(info, annex=True)
+ self.rst_report(info, annex=True)
subtitle.append(cores)
cmdline = rtCmdLines[cores] % (TestFM10kL3fwd.path + "l3fwd_" + mode, coreMask[cores],
- self.dut.get_memory_channels(), dts.create_mask(valports[:2]))
+ self.dut.get_memory_channels(), utils.create_mask(valports[:2]))
if frame_size > 1518:
cmdline = cmdline + " --max-pkt-len %d" % frame_size
- dts.report(cmdline + "\n", frame=True, annex=True)
+ self.rst_report(cmdline + "\n", frame=True, annex=True)
out = self.dut.send_expect(cmdline, "L3FWD:", 120)
@@ -486,14 +486,14 @@ class TestFM10kL3fwd(TestCase, IxiaPacketGenerator):
loss_pkts = human_read_number(loss_pkts)
data_row = [frame_size, mode, cores, str(tx_pkts), str(rx_pkts), loss_pkts, zero_loss_rate]
- dts.results_table_add_row(data_row)
+ self.result_table_add(data_row)
self.l3fwd_test_results['data'].append(data_row)
else:
pass
index += 1
- dts.results_table_print()
+ self.result_table_print()
def test_perf_rfc2544_vec(self):
# add setting for scatter
diff --git a/tests/TestSuite_fortville_rss_granularity_config.py b/tests/TestSuite_fortville_rss_granularity_config.py
index 6773573..dd06f06 100644
--- a/tests/TestSuite_fortville_rss_granularity_config.py
+++ b/tests/TestSuite_fortville_rss_granularity_config.py
@@ -50,7 +50,7 @@ Support 4*10G, 1*40G and 2*40G NICs.
import time
import random
import re
-import dts
+import utils
import dut
testQueues = [16]
@@ -177,7 +177,7 @@ class TestFortvilleRssGranularityConfig(TestCase):
global reta_num
#append the the hash value and queue id into table
- dts.results_table_add_header(
+ self.result_table_create(
['packet index', 'hash value', 'hash index', 'queue id'])
i = 0
@@ -186,7 +186,7 @@ class TestFortvilleRssGranularityConfig(TestCase):
# compute the hash result of five tuple into the 7 LSBs value.
hash_index = int(tmp_reta_line["RSS hash"], 16) % reta_num
- dts.results_table_add_row(
+ self.result_table_add(
[i, tmp_reta_line["RSS hash"], hash_index, tmp_reta_line["queue"]])
i = i + 1
@@ -238,29 +238,30 @@ class TestFortvilleRssGranularityConfig(TestCase):
self.send_packet(itf, "ipv4-tcp")
self.dut.send_expect("quit", "# ", 30)
- dts.results_table_print()
- self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!")
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
- if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])):
+ if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])):
+ elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are different, rss_granularity_config failed!")
@@ -313,29 +314,30 @@ class TestFortvilleRssGranularityConfig(TestCase):
self.send_packet(itf, "ipv4-udp")
self.dut.send_expect("quit", "# ", 30)
- dts.results_table_print()
- self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!")
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
#check the results
- if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])):
+ if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])):
+ elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are different, rss_granularity_config failed!")
@@ -388,29 +390,30 @@ class TestFortvilleRssGranularityConfig(TestCase):
self.send_packet(itf, "ipv6-tcp")
self.dut.send_expect("quit", "# ", 30)
- dts.results_table_print()
- self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!")
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
#check the results
- if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])):
+ if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])):
+ elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are different, rss_granularity_config failed!")
@@ -463,29 +466,30 @@ class TestFortvilleRssGranularityConfig(TestCase):
self.send_packet(itf, "ipv6-udp")
self.dut.send_expect("quit", "# ", 30)
- dts.results_table_print()
- self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!")
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
#check the results
- if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])):
+ if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[2][1]==result_rows[3][1])or(result_rows[2][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[1][1]==result_rows[5][1])or(result_rows[1][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[2][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[2][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[2][1]==result_rows[5][1])or(result_rows[2][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[3][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[3][1]==result_rows[5][1])or(result_rows[3][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[4][3])):
+ elif ((result_rows[1][1]!=result_rows[4][1])or(result_rows[1][3]!=result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are different, rss_granularity_config failed!")
@@ -532,20 +536,21 @@ class TestFortvilleRssGranularityConfig(TestCase):
self.dut.send_expect("quit", "# ", 30)
- dts.results_table_print()
- self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!")
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
#check the results
- if ((dts.results_table_rows[1][1]!=dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[2][3])):
+ if ((result_rows[1][1]!=result_rows[2][1])or(result_rows[1][3]!=result_rows[2][3])):
flag = 0
self.verify(flag, "The two hash values are different, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[3][3])):
+ elif ((result_rows[1][1]==result_rows[3][1])or(result_rows[1][3]==result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[4][3])):
+ elif ((result_rows[1][1]==result_rows[4][1])or(result_rows[1][3]==result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[3][1]==dts.results_table_rows[4][1])or(dts.results_table_rows[3][3]==dts.results_table_rows[4][3])):
+ elif ((result_rows[3][1]==result_rows[4][1])or(result_rows[3][3]==result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
@@ -584,32 +589,33 @@ class TestFortvilleRssGranularityConfig(TestCase):
#set hash input set by testpmd on dut, enable src-ipv4 & dst-ipv4
self.dut.send_expect("set_hash_input_set 0 ipv4-other src-ipv4 add", "testpmd> ")
self.dut.send_expect("set_hash_input_set 0 ipv4-other dst-ipv4 add", "testpmd> ")
- self.send_packet(itf, "ipv4-other")
+ self.send_packet(itf, "ipv4-other")
#set hash input set by testpmd on dut, enable src-ipv4, dst-ipv4, gre-key-len 3
self.dut.send_expect("global_config 0 gre-key-len 3", "testpmd> ")
- self.dut.send_expect("set_hash_input_set 0 ipv4-other gre-key add", "testpmd> ")
+ self.dut.send_expect("set_hash_input_set 0 ipv4-other gre-key add", "testpmd> ")
self.send_packet(itf, "ipv4-other")
- #set hash input set by testpmd on dut, enable src-ipv4, dst-ipv4, gre-key-len 4
+ #set hash input set by testpmd on dut, enable src-ipv4, dst-ipv4, gre-key-len 4
self.dut.send_expect("global_config 0 gre-key-len 4", "testpmd> ")
- self.send_packet(itf, "ipv4-other")
+ self.send_packet(itf, "ipv4-other")
self.dut.send_expect("quit", "# ", 30)
- dts.results_table_print()
- self.verify(len(dts.results_table_rows) > 1, "There is no data in the table, testcase failed!")
+ self.result_table_print()
+ result_rows = self.result_table_getrows()
+ self.verify(len(result_rows) > 1, "There is no data in the table, testcase failed!")
#check the results
- if ((dts.results_table_rows[1][1]==dts.results_table_rows[2][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[2][3])):
+ if ((result_rows[1][1]==result_rows[2][1])or(result_rows[1][3]==result_rows[2][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]!=dts.results_table_rows[3][1])or(dts.results_table_rows[1][3]!=dts.results_table_rows[3][3])):
+ elif ((result_rows[1][1]!=result_rows[3][1])or(result_rows[1][3]!=result_rows[3][3])):
flag = 0
self.verify(flag, "The two hash values are different, rss_granularity_config failed!")
- elif ((dts.results_table_rows[1][1]==dts.results_table_rows[4][1])or(dts.results_table_rows[1][3]==dts.results_table_rows[4][3])):
+ elif ((result_rows[1][1]==result_rows[4][1])or(result_rows[1][3]==result_rows[4][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
- elif ((dts.results_table_rows[4][1]==dts.results_table_rows[5][1])or(dts.results_table_rows[4][3]==dts.results_table_rows[5][3])):
+ elif ((result_rows[4][1]==result_rows[5][1])or(result_rows[4][3]==result_rows[5][3])):
flag = 0
self.verify(flag, "The two hash values are the same, rss_granularity_config failed!")
diff --git a/tests/TestSuite_generic_filter.py b/tests/TestSuite_generic_filter.py
index 9f6676c..c42ec5a 100644
--- a/tests/TestSuite_generic_filter.py
+++ b/tests/TestSuite_generic_filter.py
@@ -36,7 +36,7 @@ Test the support of VLAN Offload Features by Poll Mode Drivers.
"""
-import dts
+import utils
import time
import re
@@ -67,7 +67,7 @@ class TestGeneric_filter(TestCase):
global valports
valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
global portMask
- portMask = dts.create_mask(valports[:2])
+ portMask = utils.create_mask(valports[:2])
self.pmdout = PmdOutput(self.dut)
self.ethertype_filter = "off"
@@ -769,7 +769,7 @@ class TestGeneric_filter(TestCase):
"ethertype": 'Ether(dst="%s")/ARP(pdst="192.168.1.1")' % tx_mac,
"5tuple": 'flows.append(Ether(dst="%s")/IP(src="2.2.2.4",dst="2.2.2.5")/TCP(sport=1,dport=1,flags=0)/("X"*%d))',
}
- dts.results_table_add_header(
+ self.result_table_create(
['pack_size', "filter_type", "enable", "disable", "perf_compare"])
for key in test_type.keys():
if "5tuple" != key:
@@ -789,7 +789,7 @@ class TestGeneric_filter(TestCase):
_, pps = self.tester.traffic_generator_throughput(
tgen_input)
pps_lists.append(pps)
- dts.results_table_add_row(
+ self.result_table_add(
["defult", key, pps_lists[0], pps_lists[1], (pps_lists[0] - pps_lists[1]) / float(pps_lists[1])])
# this is a TCP/IP package, need test different payload_size
if ("5tuple" == key) and ("niantic" == self.nic):
@@ -816,9 +816,9 @@ class TestGeneric_filter(TestCase):
_, pps = self.tester.traffic_generator_throughput(
tgen_input)
pps_lists.append(pps)
- dts.results_table_add_row(
+ self.result_table_add(
[package_size, key, pps_lists[0], pps_lists[1], (pps_lists[0] - pps_lists[1]) / float(pps_lists[1])])
- dts.results_table_print()
+ self.result_table_print()
def tear_down(self):
"""
diff --git a/tests/TestSuite_hello_world.py b/tests/TestSuite_hello_world.py
index 255a8aa..1c5934c 100644
--- a/tests/TestSuite_hello_world.py
+++ b/tests/TestSuite_hello_world.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test HelloWorld example.
"""
-import dts
+import utils
from test_case import TestCase
class TestHelloWorld(TestCase):
@@ -65,7 +65,7 @@ class TestHelloWorld(TestCase):
# get the mask for the first core
cores = self.dut.get_core_list('1S/1C/1T')
- coreMask = dts.create_mask(cores)
+ coreMask = utils.create_mask(cores)
cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask
out = self.dut.send_expect(cmdline, "# ", 30)
self.verify("hello from core %s" % cores[0] in out, "EAL not started on core%s" % cores[0])
@@ -78,7 +78,7 @@ class TestHelloWorld(TestCase):
# get the maximun logical core number
cores = self.dut.get_core_list('all')
- coreMask = dts.create_mask(cores)
+ coreMask = utils.create_mask(cores)
cmdline = "./examples/helloworld/build/app/helloworld -n 1 -c " + coreMask
out = self.dut.send_expect(cmdline, "# ", 50)
diff --git a/tests/TestSuite_ieee1588.py b/tests/TestSuite_ieee1588.py
index bfbb23b..58d9a10 100644
--- a/tests/TestSuite_ieee1588.py
+++ b/tests/TestSuite_ieee1588.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test support of IEEE1588 Precise Time Protocol.
"""
-import dts
+import utils
import time
import re
from test_case import TestCase
@@ -100,7 +100,7 @@ class TestIeee1588(TestCase):
out = self.dut.get_session_output()
self.dut.send_expect("stop", "testpmd> ")
- text = dts.regexp(out, "(.*) by hardware")
+ text = utils.regexp(out, "(.*) by hardware")
self.verify("IEEE1588 PTP V2 SYNC" in text, "Not filtered " + text)
pattern_rx = re.compile("RX timestamp value (\d+) s (\d+) ns")
diff --git a/tests/TestSuite_ip_pipeline.py b/tests/TestSuite_ip_pipeline.py
index 46fdc8d..90dba31 100644
--- a/tests/TestSuite_ip_pipeline.py
+++ b/tests/TestSuite_ip_pipeline.py
@@ -39,7 +39,7 @@ from scapy.utils import struct, socket, PcapWriter
from settings import HEADER_SIZE
from test_case import TestCase
from time import sleep
-import dts
+import utils
class TestIPPipeline(TestCase):
@@ -304,7 +304,7 @@ class TestIPPipeline(TestCase):
out = self.dut.build_dpdk_apps("./examples/ip_pipeline")
self.verify("Error" not in out, "Compilation error")
- self.ports_mask = dts.create_mask(
+ self.ports_mask = utils.create_mask(
[self.dut_ports[0], self.dut_ports[1]])
self.coremask = "0x3e" # IP Pipeline app requires FIVE cores
@@ -336,7 +336,7 @@ class TestIPPipeline(TestCase):
for frames_number in TestIPPipeline.number_of_frames:
for inter in TestIPPipeline.inter:
- print dts.BLUE(
+ print utils.BLUE(
"\tNumber of frames %d, interval %.1f" % (frames_number,
inter))
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
@@ -370,7 +370,7 @@ class TestIPPipeline(TestCase):
self.create_pcap_file(pcap_file, frame_size, 100, True)
self.tester.session.copy_file_to(pcap_file)
- print dts.BLUE("\tFrame size %d, interval %.1f" % (frame_size,
+ print utils.BLUE("\tFrame size %d, interval %.1f" % (frame_size,
inter))
stats = self.send_and_sniff_pcap_file(pcap_file, frames_number,
diff --git a/tests/TestSuite_ipfrag.py b/tests/TestSuite_ipfrag.py
index c2623b6..b2684f1 100644
--- a/tests/TestSuite_ipfrag.py
+++ b/tests/TestSuite_ipfrag.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test IPv4 fragmentation features in DPDK.
"""
-import dts
+import utils
import string
import re
import time
@@ -127,8 +127,8 @@ l3fwd_ipv4_route_array[] = {\\\n"
Perform functional fragmentation checks.
"""
- coremask = dts.create_mask(cores)
- portmask = dts.create_mask([P0, P1])
+ coremask = utils.create_mask(cores)
+ portmask = utils.create_mask([P0, P1])
numPortThread = len([P0, P1]) / len(cores)
result = True
errString = ''
@@ -185,8 +185,8 @@ l3fwd_ipv4_route_array[] = {\\\n"
"""
Perform functional fragmentation checks.
"""
- coremask = dts.create_mask(cores)
- portmask = dts.create_mask([P0, P1])
+ coremask = utils.create_mask(cores)
+ portmask = utils.create_mask([P0, P1])
numPortThread = len([P0, P1]) / len(cores)
result = True
errString = ''
@@ -308,11 +308,11 @@ l3fwd_ipv4_route_array[] = {\\\n"
Pct = dict()
if int(lcore[0]) == 1:
- core_mask = dts.create_mask(self.dut.get_core_list(lcore, socket=self.ports_socket))
+ core_mask = utils.create_mask(self.dut.get_core_list(lcore, socket=self.ports_socket))
else:
- core_mask = dts.create_mask(self.dut.get_core_list(lcore))
+ core_mask = utils.create_mask(self.dut.get_core_list(lcore))
- portmask = dts.create_mask([P0, P1])
+ portmask = utils.create_mask([P0, P1])
self.dut.send_expect("examples/ip_fragmentation/build/ip_fragmentation -c %s -n %d -- -p %s -q %s" % (
core_mask, self.dut.get_memory_channels(), portmask, num_pthreads), "IP_FRAG:", 120)
@@ -350,7 +350,7 @@ l3fwd_ipv4_route_array[] = {\\\n"
result.append(Pps[str(size)])
result.append(Pct[str(size)])
- dts.results_table_add_row(result)
+ self.result_table_add(result)
self.dut.send_expect("^C", "#")
@@ -368,7 +368,7 @@ l3fwd_ipv4_route_array[] = {\\\n"
tblheader.append("%dB Mpps" % size)
tblheader.append("%d" % size)
- dts.results_table_add_header(tblheader)
+ self.result_table_create(tblheader)
lcores = [("1S/1C/1T", 2), ("1S/1C/2T", 2), ("1S/2C/1T", 2), ("2S/1C/1T", 2)]
index = 1
@@ -376,7 +376,7 @@ l3fwd_ipv4_route_array[] = {\\\n"
self.benchmark(index, lcore, numThr, sizes)
index += 1
- dts.results_table_print()
+ self.result_table_print()
self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P0)), "#")
self.tester.send_expect("ifconfig %s mtu 1500" % self.tester.get_interface(self.tester.get_local_port(P1)), "#")
diff --git a/tests/TestSuite_ipv4_reassembly.py b/tests/TestSuite_ipv4_reassembly.py
index 7935478..a1e15a2 100644
--- a/tests/TestSuite_ipv4_reassembly.py
+++ b/tests/TestSuite_ipv4_reassembly.py
@@ -13,7 +13,7 @@ from scapy.utils import struct, socket, PcapWriter
from scapy.layers.inet import Ether, IP, TCP, fragment
from scapy.route import *
-import dts
+import utils
from test_case import TestCase
@@ -43,7 +43,7 @@ class IpReassemblyTestConfig(object):
def cpu_config(self):
self.core_list = self.test_case.dut.get_core_list('1S/1C/1T')
- self.core_mask = dts.create_mask(self.core_list)
+ self.core_mask = utils.create_mask(self.core_list)
self.memory_channels = self.test_case.dut.get_memory_channels()
def ports_config(self):
@@ -51,7 +51,7 @@ class IpReassemblyTestConfig(object):
dut_port = dut_ports[0]
tester_port = self.test_case.tester.get_local_port(dut_port)
self.tester_iface = self.test_case.tester.get_interface(tester_port)
- self.dut_port_mask = dts.create_mask([dut_port])
+ self.dut_port_mask = utils.create_mask([dut_port])
self.queue_config = '({},{},{})'.format(dut_port, '0', self.core_list[0])
def example_app_config(self):
diff --git a/tests/TestSuite_jumboframes.py b/tests/TestSuite_jumboframes.py
index 95b2540..58f2e17 100644
--- a/tests/TestSuite_jumboframes.py
+++ b/tests/TestSuite_jumboframes.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test the support of Jumbo Frames by Poll Mode Drivers
"""
-import dts
+import utils
import re
from time import sleep
from test_case import TestCase
@@ -115,9 +115,9 @@ class TestJumboframes(TestCase):
self.tx_port = self.dut_ports[0]
cores = self.dut.get_core_list("1S/2C/1T")
- self.coremask = dts.create_mask(cores)
+ self.coremask = utils.create_mask(cores)
- self.port_mask = dts.create_mask([self.rx_port, self.tx_port])
+ self.port_mask = utils.create_mask([self.rx_port, self.tx_port])
if self.kdriver == "fm10k":
netobj = self.dut.ports_info[self.tx_port]['port']
@@ -158,7 +158,7 @@ class TestJumboframes(TestCase):
"""
# RRC has no ability to set the max pkt len to hardware
if self.kdriver == "fm10k":
- print dts.RED("fm10k not support this case\n")
+ print utils.RED("fm10k not support this case\n")
return
self.pmdout.start_testpmd("Default", "--max-pkt-len=%d --port-topology=loop" % (ETHER_STANDARD_MTU))
self.dut.send_expect("set fwd mac", "testpmd> ")
diff --git a/tests/TestSuite_kni.py b/tests/TestSuite_kni.py
index d1cd986..18bd768 100644
--- a/tests/TestSuite_kni.py
+++ b/tests/TestSuite_kni.py
@@ -36,7 +36,7 @@ DPDK Test suite.
Test Kernel NIC Interface.
"""
-import dts
+import utils
import re
import time
from random import randint
@@ -288,7 +288,7 @@ class TestKni(TestCase):
self.dut.kill_all()
out = self.dut.send_expect("rmmod rte_kni", "# ", 10)
self.verify("in use" not in out, "Error unloading KNI module: " + out)
- if dts.drivername == "igb_uio":
+ if self.drivername == "igb_uio":
self.dut.send_expect("rmmod igb_uio", "# ", 5)
self.dut.send_expect(
'insmod ./%s/kmod/igb_uio.ko' % (self.target), "# ", 20)
@@ -298,8 +298,8 @@ class TestKni(TestCase):
self.verify("Error" not in out, "Error loading KNI module: " + out)
- port_mask = dts.create_mask(self.config['ports'])
- core_mask = dts.create_mask(
+ port_mask = utils.create_mask(self.config['ports'])
+ core_mask = utils.create_mask(
self.config['rx_cores'] + self.config['tx_cores'] + self.config['kernel_cores'])
config_param = self.build_config_param()
@@ -311,7 +311,7 @@ class TestKni(TestCase):
time.sleep(5)
if kthread_mode == 'single':
- kthread_mask = dts.create_mask(self.config['kernel_cores'])
+ kthread_mask = utils.create_mask(self.config['kernel_cores'])
out = self.dut.send_expect(
"taskset -p %s `pgrep -fl kni_single | awk '{print $1}'`" % kthread_mask, "#")
self.verify(
@@ -438,7 +438,7 @@ class TestKni(TestCase):
dut_ports = self.dut.get_ports(self.nic)
self.dut.restore_interfaces()
allPort = self.dut.ports_info
- if dts.drivername in ["igb_uio"]:
+ if self.drivername in ["igb_uio"]:
self.dut.send_expect(
"insmod ./" + self.target + "/kmod/igb_uio.ko", "#")
for port in range(0, len(allPort)):
@@ -824,7 +824,7 @@ class TestKni(TestCase):
for size in packet_sizes_loopback:
header.append('%d (pps)' % size)
- dts.results_table_add_header(header)
+ self.result_table_create(header)
# Execute the permutations of the test
for step in loopback_performance_steps:
@@ -834,7 +834,7 @@ class TestKni(TestCase):
total_cores = len(self.config['tx_cores'] + self.config[
'rx_cores'] + self.config['kernel_cores'])
if total_cores > self.dut_physical_cores():
- print dts.RED("Skiping step %s (%d cores needed, got %d)" %
+ print utils.RED("Skiping step %s (%d cores needed, got %d)" %
(step['config'], total_cores,
self.dut_physical_cores())
)
@@ -873,17 +873,17 @@ class TestKni(TestCase):
ports_number = len(self.config['ports'])
results_row = [step['lo_mode'], step['kthread_mode'], ports_number,
self.stripped_config_param()] + pps_results
- dts.results_table_add_row(results_row)
+ self.result_table_add(results_row)
self.dut.kill_all()
- dts.results_table_print()
+ self.result_table_print()
def test_perf_bridge(self):
"""
KNI performance bridge mode.
"""
- dts.results_table_add_header(bridge_perf_results_header)
+ self.result_table_create(bridge_perf_results_header)
self.tester.scapy_append('srcmac="00:00:00:00:00:01"')
self.tester.scapy_append(
@@ -897,7 +897,7 @@ class TestKni(TestCase):
total_cores = len(self.config['tx_cores'] + self.config[
'rx_cores'] + self.config['kernel_cores'])
if total_cores > self.dut_physical_cores():
- print dts.RED("Skiping step %s (%d cores needed, got %d)" %
+ print utils.RED("Skiping step %s (%d cores needed, got %d)" %
(step['config'], total_cores,
self.dut_physical_cores())
)
@@ -943,18 +943,18 @@ class TestKni(TestCase):
results_row = [step['kthread_mode'], step['flows'],
self.stripped_config_param(), (float(pps) / 10 ** 6)]
- dts.results_table_add_row(results_row)
+ self.result_table_add(results_row)
self.dut.send_expect("ifconfig br_kni down", "# ")
self.dut.send_expect("brctl delbr \"br_kni\"", "# ", 10)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_bridge_without_kni(self):
"""
Bridge mode performance without KNI.
"""
- dts.results_table_add_header(bridge_perf_no_kni_results_header)
+ self.result_table_create(bridge_perf_no_kni_results_header)
self.dut.kill_all()
@@ -998,7 +998,7 @@ class TestKni(TestCase):
tgenInput.append((rx_port, tx_port, "kni.pcap"))
_, pps = self.tester.traffic_generator_throughput(tgenInput)
- dts.results_table_add_row([flows, float(pps) / 10 ** 6])
+ self.result_table_add([flows, float(pps) / 10 ** 6])
self.dut.send_expect("ifconfig br1 down", "# ")
self.dut.send_expect("brctl delbr \"br1\"", "# ", 30)
@@ -1006,7 +1006,7 @@ class TestKni(TestCase):
for port in white_list:
self.dut.send_expect(
"./tools/dpdk-devbind.py -b igb_uio %s" % (port), "# ")
- dts.results_table_print()
+ self.result_table_print()
def test_perf_routing(self):
"""
@@ -1018,7 +1018,7 @@ class TestKni(TestCase):
for size in packet_sizes_routing:
header.append("%d Mpps" % size)
- dts.results_table_add_header(header)
+ self.result_table_create(header)
self.dut.send_expect("echo 1 > /proc/sys/net/ipv4/ip_forward", "# ")
@@ -1103,9 +1103,9 @@ class TestKni(TestCase):
_, pps = self.tester.traffic_generator_throughput(tgen_input)
resutls_row.append(float(pps) / 10 ** 6)
- dts.results_table_add_row(resutls_row)
+ self.result_table_add(resutls_row)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_routing_without_kni(self):
"""
@@ -1117,7 +1117,7 @@ class TestKni(TestCase):
for size in packet_sizes_routing:
header.append("%d Mpps" % size)
- dts.results_table_add_header(header)
+ self.result_table_create(header)
self.dut.kill_all()
self.dut.send_expect("rmmod rte_kni", "# ", 20)
@@ -1176,7 +1176,7 @@ class TestKni(TestCase):
# Get throughput with 1 port
_, pps = self.tester.traffic_generator_throughput(tgen_input)
one_port_resutls_row.append(float(pps) / 10 ** 6)
- dts.results_table_add_row(one_port_resutls_row)
+ self.result_table_add(one_port_resutls_row)
# Prepare test with 'ports_without_kni' ports
self.tester.scapy_append('flows = []')
@@ -1195,13 +1195,13 @@ class TestKni(TestCase):
# Get throughput with 'ports_without_kni' ports
_, pps = self.tester.traffic_generator_throughput(tgen_input)
two_port_resutls_row.append(float(pps) / 10 ** 6)
- dts.results_table_add_row(two_port_resutls_row)
+ self.result_table_add(two_port_resutls_row)
- dts.results_table_print()
+ self.result_table_print()
for port in white_list:
self.dut.send_expect(
- "./tools/dpdk-devbind.py -b %s %s" % (dts.drivername, port), "# ")
+ "./tools/dpdk-devbind.py -b %s %s" % (self.drivername, port), "# ")
def tear_down(self):
"""
diff --git a/tests/TestSuite_l2fwd.py b/tests/TestSuite_l2fwd.py
index 10a86ca..23815cd 100644
--- a/tests/TestSuite_l2fwd.py
+++ b/tests/TestSuite_l2fwd.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test Layer-2 Forwarding support
"""
-import dts
+import utils
from test_case import TestCase
from settings import HEADER_SIZE
@@ -77,7 +77,7 @@ class TestL2fwd(TestCase):
self.table_header.append("%d queues Mpps" % queue['queues'])
self.table_header.append("% linerate")
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
def set_up(self):
"""
@@ -94,7 +94,7 @@ class TestL2fwd(TestCase):
Check port forwarding.
"""
# the cases use the first two ports
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
self.dut.send_expect("./examples/l2fwd/build/app/l2fwd -n 1 -c f -- -q 8 -p %s &" % port_mask, "L2FWD: entering main loop", 60)
@@ -124,9 +124,9 @@ class TestL2fwd(TestCase):
Check port forwarding.
"""
# the cases use the first two ports
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
- core_mask = dts.create_mask(self.dut.get_core_list(self.core_config,
+ core_mask = utils.create_mask(self.dut.get_core_list(self.core_config,
socket=self.ports_socket))
for queues in self.test_queues:
@@ -154,8 +154,8 @@ class TestL2fwd(TestCase):
for port in xrange(self.number_of_ports):
ports.append(self.dut_ports[port])
- port_mask = dts.create_mask(ports)
- core_mask = dts.create_mask(self.dut.get_core_list(self.core_config,
+ port_mask = utils.create_mask(ports)
+ core_mask = utils.create_mask(self.dut.get_core_list(self.core_config,
socket=self.ports_socket))
for frame_size in self.frame_sizes:
@@ -180,14 +180,15 @@ class TestL2fwd(TestCase):
(self.dut.get_memory_channels(), core_mask,
str(queues['queues']), port_mask)
- self.dut.send_expect(command_line, "memory mapped", 60)
+# self.dut.send_expect(command_line, "memory mapped", 60)
+ self.dut.send_expect(command_line, "L2FWD: entering main loop", 60)
info = "Executing l2fwd using %s queues, frame size %d and %s setup.\n" % \
(queues['queues'], frame_size, self.core_config)
self.logger.info(info)
- dts.report(info, annex=True)
- dts.report(command_line + "\n\n", frame=True, annex=True)
+ self.rst_report(info, annex=True)
+ self.rst_report(command_line + "\n\n", frame=True, annex=True)
_, pps = self.tester.traffic_generator_throughput(tgen_input)
Mpps = pps / 1000000.0
queues['Mpps'][frame_size] = Mpps
@@ -212,9 +213,9 @@ class TestL2fwd(TestCase):
results_row.append(queue['Mpps'][frame_size])
results_row.append(queue['pct'][frame_size])
- dts.results_table_add_row(results_row)
+ self.result_table_add(results_row)
- dts.results_table_print()
+ self.result_table_print()
def tear_down(self):
"""
diff --git a/tests/TestSuite_l3fwd.py b/tests/TestSuite_l3fwd.py
index f6fce26..43af04d 100644
--- a/tests/TestSuite_l3fwd.py
+++ b/tests/TestSuite_l3fwd.py
@@ -34,14 +34,13 @@ DPDK Test suite.
Layer-3 forwarding test script.
"""
-import dts
+import utils
import string
import re
from test_case import TestCase
from exception import VerifyFailure
from settings import HEADER_SIZE
from etgen import IxiaPacketGenerator
-from utils import *
class TestL3fwd(TestCase,IxiaPacketGenerator):
@@ -152,9 +151,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
pat = re.compile("P([0123])")
# Update config file and rebuild to get best perf on FVL
- self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_CONFIG=n/CONFIG_RTE_PCI_CONFIG=y/' ./config/common_base", "#", 20)
- self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_EXTENDED_TAG=.*$/CONFIG_RTE_PCI_EXTENDED_TAG=\"on\"/' ./config/common_base", "#", 20)
- self.dut.build_install_dpdk(self.target)
+# self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_CONFIG=n/CONFIG_RTE_PCI_CONFIG=y/' ./config/common_base", "#", 20)
+# self.dut.send_expect("sed -i -e 's/CONFIG_RTE_PCI_EXTENDED_TAG=.*$/CONFIG_RTE_PCI_EXTENDED_TAG=\"on\"/' ./config/common_base", "#", 20)
+# self.dut.build_install_dpdk(self.target)
# Prepare long prefix match table, replace P(x) port pattern
@@ -252,7 +251,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
self.logger.debug("%s\n" % str(corelist))
- core_mask = dts.create_mask(set(corelist))
+ core_mask = utils.create_mask(set(corelist))
# First, measure by two different methods
for method in TestL3fwd.methods:
@@ -260,11 +259,11 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
method_command_line = command_line % (TestL3fwd.path + "l3fwd_" + method,
core_mask,
self.dut.get_memory_channels(),
- dts.create_mask(valports[:4]))
+ utils.create_mask(valports[:4]))
if frame_size > 1518:
method_command_line = method_command_line + " --enable-jumbo --max-pkt-len %d" % frame_size
- dts.report(method_command_line + "\n", frame=True, annex=True)
+ self.rst_report(method_command_line + "\n", frame=True, annex=True)
out = self.dut.send_expect(method_command_line, "L3FWD:", 120)
@@ -300,7 +299,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
data_row.append(pct[method])
# generate report table
- dts.results_table_add_row(data_row)
+ self.result_table_add(data_row)
self.l3fwd_test_results['data'].append(data_row)
def set_up(self):
@@ -325,7 +324,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
header_row.append('%s Mpps' % method)
header_row.append('% linerate')
- dts.results_table_add_header(header_row)
+ self.result_table_create(header_row)
self.l3fwd_test_results['header'] = header_row
self.l3fwd_test_results['data'] = []
@@ -342,9 +341,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
self.tester.scapy_execute()
- dts.report("Flows for 4 ports, %d frame size.\n" % (frame_size),
+ self.rst_report("Flows for 4 ports, %d frame size.\n" % (frame_size),
annex=True)
- dts.report("%s" % string.join(flows, '\n'),
+ self.rst_report("%s" % string.join(flows, '\n'),
frame=True, annex=True)
# Get the number of sockets of the board
@@ -358,7 +357,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
if number_sockets >= int(test_case[1].split('/')[0][0]):
self.get_throughput(frame_size, *test_case)
- dts.results_table_print()
+ self.result_table_print()
def no_test_perf_l3fwd_2ports(self):
"""
@@ -367,7 +366,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate", "latency_max(us)", "latency_min(us)", "latency_avg(us)"]
self.l3fwd_test_results['header'] = header_row
- dts.results_table_add_header(header_row)
+ self.result_table_create(header_row)
self.l3fwd_test_results['data'] = []
for frame_size in TestL3fwd.frame_sizes:
@@ -381,9 +380,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,',')))
self.tester.scapy_execute()
- dts.report("Flows for 2 ports, %d frame size.\n" % (frame_size),
+ self.rst_report("Flows for 2 ports, %d frame size.\n" % (frame_size),
annex=True)
- dts.report("%s" % string.join(flows, '\n'),
+ self.rst_report("%s" % string.join(flows, '\n'),
frame=True, annex=True)
@@ -408,7 +407,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
rtCmdLines[cmdline_pat[1]] = pat.sub(self.repl, rtCmdLines[cmdline_pat[1]])
self.logger.info("%s\n" % str(corelist))
- coreMask[cmdline_pat[1]] = dts.create_mask(set(corelist))
+ coreMask[cmdline_pat[1]] = utils.create_mask(set(corelist))
# measure by two different mode
for mode in TestL3fwd.methods:
@@ -422,15 +421,15 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
mode, cores, frame_size)
self.logger.info(info)
- dts.report(info, annex=True)
+ self.rst_report(info, annex=True)
subtitle.append(cores)
cmdline = rtCmdLines[cores] % (TestL3fwd.path + "l3fwd_" + mode, coreMask[cores],
- self.dut.get_memory_channels(), dts.create_mask(valports[:2]))
+ self.dut.get_memory_channels(), utils.create_mask(valports[:2]))
if frame_size > 1518:
cmdline = cmdline + " --enable-jumbo --max-pkt-len %d" % frame_size
- dts.report(cmdline + "\n", frame=True, annex=True)
+ self.rst_report(cmdline + "\n", frame=True, annex=True)
out = self.dut.send_expect(cmdline, "L3FWD:", 120)
@@ -463,10 +462,10 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
for latency in latencys:
data_row = [frame_size, mode, cores, str(pps), str(pct), str(latency['max']), str(latency['min']), str(latency['average'])]
- dts.results_table_add_row(data_row)
+ self.result_table_add(data_row)
self.l3fwd_test_results['data'].append(data_row)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_rfc2544(self):
@@ -474,7 +473,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
ports_num = len(ports)
header_row = ["Frame_size(byte)", "mode", "S/C/T", "zero_loss_throughput(Mpps)", " % zero_loss_rate"]# "LR_tx_pkts(1min)", "LR_rx_pkts(1min)", "LR_loss_pkts(1min)", "% zero_loss_rate", "zero_loss_throughput(Mpps)"]
self.l3fwd_test_results['header'] = header_row
- dts.results_table_add_header(header_row)
+ self.result_table_create(header_row)
self.l3fwd_test_results['data'] = []
for frame_size in TestL3fwd.frame_sizes:
@@ -488,9 +487,9 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
self.tester.scapy_append('wrpcap("dst%d.pcap", [%s])' %(valports[_port],string.join(flows,',')))
self.tester.scapy_execute()
- dts.report("Flows for %d ports, %d frame size.\n" % (ports_num, frame_size),
+ self.rst_report("Flows for %d ports, %d frame size.\n" % (ports_num, frame_size),
annex=True)
- dts.report("%s" % string.join(flows, '\n'),
+ self.rst_report("%s" % string.join(flows, '\n'),
frame=True, annex=True)
# Prepare the command line
@@ -523,7 +522,7 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
rtCmdLines[cmdline_pat[1]] = pat.sub(self.repl, rtCmdLines[cmdline_pat[1]])
self.logger.info("%s\n" % str(corelist))
- coreMask[cmdline_pat[1]] = dts.create_mask(set(corelist))
+ coreMask[cmdline_pat[1]] = utils.create_mask(set(corelist))
# measure by two different mode
for mode in TestL3fwd.methods:
@@ -539,15 +538,15 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
mode, ports_num, cores, frame_size)
self.logger.info(info)
- dts.report(info, annex=True)
+ self.rst_report(info, annex=True)
subtitle.append(cores)
cmdline = rtCmdLines[cores] % (TestL3fwd.path + "l3fwd_" + mode, coreMask[cores],
- self.dut.get_memory_channels(), dts.create_mask(valports[:ports_num]))
+ self.dut.get_memory_channels(), utils.create_mask(valports[:ports_num]))
if frame_size > 1518:
cmdline = cmdline + " --enable-jumbo --max-pkt-len %d" % frame_size
- dts.report(cmdline + "\n", frame=True, annex=True)
+ self.rst_report(cmdline + "\n", frame=True, annex=True)
out = self.dut.send_expect(cmdline, "L3FWD:", 120)
@@ -578,14 +577,14 @@ class TestL3fwd(TestCase,IxiaPacketGenerator):
#data_row = [frame_size, mode, cores, tx_pkts, rx_pkts, loss_pkts, zero_loss_rate, zero_loss_throughput]
data_row = [frame_size, mode, cores, zero_loss_throughput, zero_loss_rate]
- dts.results_table_add_row(data_row)
+ self.result_table_add(data_row)
self.l3fwd_test_results['data'].append(data_row)
else:
pass
index += 1
- dts.results_table_print()
+ self.result_table_print()
def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id):
self.add_tcl_cmd("protocol config -name ip")
diff --git a/tests/TestSuite_l3fwd_em.py b/tests/TestSuite_l3fwd_em.py
index 18e48a8..c8f0b18 100644
--- a/tests/TestSuite_l3fwd_em.py
+++ b/tests/TestSuite_l3fwd_em.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Layer-3 forwarding exact-match test script.
"""
-import dts
+import utils
import string
import re
from test_case import TestCase
@@ -157,7 +157,7 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator):
header_row = ["Frame", "mode", "S/C/T", "Mpps", "% linerate"]
self.l3fwd_test_results['header'] = header_row
- dts.results_table_add_header(header_row)
+ self.result_table_create(header_row)
self.l3fwd_test_results['data'] = []
for frame_size in TestL3fwdEM.frame_sizes:
@@ -197,7 +197,7 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator):
rtCmdLines[key] = pat.sub(self.repl, rtCmdLines[key])
self.logger.info("%s\n" % str(corelist))
- coreMask[key] = dts.create_mask(set(corelist))
+ coreMask[key] = utils.create_mask(set(corelist))
# measure by two different mode
for mode in TestL3fwdEM.methods:
@@ -211,13 +211,13 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator):
mode, cores, frame_size)
self.logger.info(info)
- dts.report(info, annex=True)
+ self.rst_report(info, annex=True)
subtitle.append(cores)
cmdline = rtCmdLines[cores] % (TestL3fwdEM.path + "l3fwd", coreMask[cores],
- self.dut.get_memory_channels(), dts.create_mask(valports[:2]))
+ self.dut.get_memory_channels(), utils.create_mask(valports[:2]))
- dts.report(cmdline + "\n", frame=True, annex=True)
+ self.rst_report(cmdline + "\n", frame=True, annex=True)
out = self.dut.send_expect(cmdline, "L3FWD: entering main loop", 120)
@@ -252,10 +252,10 @@ class TestL3fwdEM(TestCase,IxiaPacketGenerator):
# Stop l3fwd
self.dut.send_expect("^C", "#")
data_row = [frame_size, mode, cores, str(pps), str(pct)]
- dts.results_table_add_row(data_row)
+ self.result_table_add(data_row)
self.l3fwd_test_results['data'].append(data_row)
- dts.results_table_print()
+ self.result_table_print()
def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id):
diff --git a/tests/TestSuite_link_flowctrl.py b/tests/TestSuite_link_flowctrl.py
index 11c1795..d9bedc6 100644
--- a/tests/TestSuite_link_flowctrl.py
+++ b/tests/TestSuite_link_flowctrl.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test for Ethernet Link Flow Control Features by Poll Mode Drivers
"""
-import dts
+import utils
import re
from time import sleep
@@ -72,7 +72,7 @@ class TestLinkFlowctrl(TestCase):
self.tx_port = self.dutPorts[1]
- self.portMask = dts.create_mask([self.rx_port, self.tx_port])
+ self.portMask = utils.create_mask([self.rx_port, self.tx_port])
self.memChannels = self.dut.get_memory_channels()
self.pmdout = PmdOutput(self.dut)
diff --git a/tests/TestSuite_link_status_interrupt.py b/tests/TestSuite_link_status_interrupt.py
index bf73ba4..b00fa88 100644
--- a/tests/TestSuite_link_status_interrupt.py
+++ b/tests/TestSuite_link_status_interrupt.py
@@ -12,7 +12,7 @@ Link Status Detection
# is left here for legacy reasons.
-import dts
+import utils
import re
testPorts = []
@@ -95,17 +95,17 @@ class TestLinkStatusInterrupt(TestCase):
"""
memChannel = self.dut.get_memory_channels()
- portMask = dts.create_mask(testPorts)
- if dts.drivername in ["igb_uio"]:
+ portMask = utils.create_mask(testPorts)
+ if self.drivername in ["igb_uio"]:
cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s -- -q 2 -p %s" % (
memChannel, portMask)
- elif dts.drivername in ["vfio-pci"]:
+ elif self.drivername in ["vfio-pci"]:
cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s --vfio-intr=intx -- -q 2 -p %s" % (
memChannel, portMask)
else:
print "unknow driver"
for n in range(len(intr_mode)):
- if dts.drivername in ["igb_uio"]:
+ if self.drivername in ["igb_uio"]:
self.dut.send_expect("rmmod igb_uio", "# ")
self.dut.send_expect(
"insmod %s/kmod/igb_uio.ko %s" % (self.target, intr_mode[n]), "# ")
@@ -131,17 +131,17 @@ class TestLinkStatusInterrupt(TestCase):
"""
memChannel = self.dut.get_memory_channels()
- portMask = dts.create_mask(testPorts)
- if dts.drivername in ["igb_uio"]:
+ portMask = utils.create_mask(testPorts)
+ if self.drivername in ["igb_uio"]:
cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s -- -q 2 -p %s" % (
memChannel, portMask)
- elif dts.drivername in ["vfio-pci"]:
+ elif self.drivername in ["vfio-pci"]:
cmdline = "./examples/link_status_interrupt/build/link_status_interrupt -c f -n %s --vfio-intr=intx -- -q 2 -p %s " % (
memChannel, portMask)
else:
print "unknow driver"
for n in range(1, len(intr_mode)):
- if dts.drivername in ["igb_uio"]:
+ if self.drivername in ["igb_uio"]:
self.dut.send_expect("rmmod igb_uio", "# ")
self.dut.send_expect(
"insmod %s/kmod/igb_uio.ko %s" % (self.target, intr_mode[n]), "# ")
@@ -178,7 +178,7 @@ class TestLinkStatusInterrupt(TestCase):
"""
Recovery.
"""
- if dts.drivername in ["igb_uio"]:
+ if self.drivername in ["igb_uio"]:
self.dut.send_expect("^C", "# ")
self.dut.send_expect("rmmod igb_uio", "# ")
self.dut.send_expect(
@@ -187,7 +187,7 @@ class TestLinkStatusInterrupt(TestCase):
"dmesg -c | grep '\<Use MSIX interrupt by default\>'", "# ")
self.verify(
'Use MSIX interrupt by default' in out, "Fail to recovery default igb_uio")
- elif dts.drivername in ["vfio-pci"]:
+ elif self.drivername in ["vfio-pci"]:
self.verify(Ture, "not need run this case, when used vfio driver")
else:
print "unknow driver"
diff --git a/tests/TestSuite_mac_filter.py b/tests/TestSuite_mac_filter.py
index d3ef667..1c58b87 100644
--- a/tests/TestSuite_mac_filter.py
+++ b/tests/TestSuite_mac_filter.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test the support of Whitelist Features by Poll Mode Drivers
"""
-import dts
+import utils
import time
from test_case import TestCase
from pmd_output import PmdOutput
@@ -54,7 +54,7 @@ class TestWhitelist(TestCase):
self.dutPorts = self.dut.get_ports()
# Verify that enough ports are available
self.verify(len(self.dutPorts) >= 1, "Insufficient ports")
- portMask = dts.create_mask(self.dutPorts[:1])
+ portMask = utils.create_mask(self.dutPorts[:1])
self.pmdout = PmdOutput(self.dut)
self.pmdout.start_testpmd("Default", "--portmask=%s" % portMask)
@@ -68,11 +68,11 @@ class TestWhitelist(TestCase):
self.dest = self.dut.get_mac_address(self.dutPorts[0])
mac_scanner = r"MAC address: (([\dA-F]{2}:){5}[\dA-F]{2})"
- ret = dts.regexp(out, mac_scanner)
+ ret = utils.regexp(out, mac_scanner)
self.verify(ret is not None, "MAC address not found")
self.verify(cmp(ret.lower(), self.dest) == 0, "MAC address wrong")
- self.max_mac_addr = dts.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
+ self.max_mac_addr = utils.regexp(out, "Maximum number of MAC addresses: ([0-9]+)")
def set_up(self):
"""
@@ -103,12 +103,12 @@ class TestWhitelist(TestCase):
self.dut.send_expect("clear port stats all", "testpmd> ")
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- pre_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ pre_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# send one packet with the portid MAC address
self.whitelist_send_packet(portid, self.dest)
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the packet increase
self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
"Packet has not been received on default address")
@@ -118,7 +118,7 @@ class TestWhitelist(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the packet DO NOT increase
self.verify(int(cur_rxpkt) == int(pre_rxpkt),
@@ -131,7 +131,7 @@ class TestWhitelist(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the packet increase
self.verify(int(cur_rxpkt) == int(pre_rxpkt) + self.frames_to_send,
@@ -145,7 +145,7 @@ class TestWhitelist(TestCase):
pre_rxpkt = cur_rxpkt
out = self.dut.send_expect("show port stats %d" % portid, "testpmd> ")
- cur_rxpkt = dts.regexp(out, "RX-packets: ([0-9]+)")
+ cur_rxpkt = utils.regexp(out, "RX-packets: ([0-9]+)")
# check the packet increase
self.verify(int(cur_rxpkt) == int(pre_rxpkt),
diff --git a/tests/TestSuite_multiprocess.py b/tests/TestSuite_multiprocess.py
index 97d3092..b305437 100644
--- a/tests/TestSuite_multiprocess.py
+++ b/tests/TestSuite_multiprocess.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Multi-process Test.
"""
-import dts
+import utils
import time
from etgen import IxiaPacketGenerator
executions = []
@@ -84,7 +84,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
"""
# Send message from secondary to primary
cores = self.dut.get_core_list('1S/2C/1T')
- coremask = dts.create_mask(cores)
+ coremask = utils.create_mask(cores)
self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), "Finished Process Init", 100)
time.sleep(20)
coremask = hex(int(coremask, 16) * 0x10000).rstrip("L")
@@ -97,7 +97,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
self.verify("Received 'hello_primary'" in out, "Message not received on primary process")
# Send message from primary to secondary
cores = self.dut.get_core_list('1S/2C/1T')
- coremask = dts.create_mask(cores)
+ coremask = utils.create_mask(cores)
self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary " % (self.target, coremask), "Finished Process Init", 100)
time.sleep(20)
coremask = hex(int(coremask, 16) * 0x10000).rstrip("L")
@@ -116,7 +116,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
"""
cores = self.dut.get_core_list('1S/2C/1T')
- coremask = dts.create_mask(cores)
+ coremask = utils.create_mask(cores)
self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=primary" % (self.target, coremask), "Finished Process Init", 100)
time.sleep(20)
coremask = hex(int(coremask, 16) * 0x10000).rstrip("L")
@@ -140,7 +140,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
# Send message from secondary to primary (auto process type)
cores = self.dut.get_core_list('1S/2C/1T')
- coremask = dts.create_mask(cores)
+ coremask = utils.create_mask(cores)
out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto " % (self.target, coremask), "Finished Process Init", 100)
self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly")
time.sleep(20)
@@ -157,7 +157,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
# Send message from primary to secondary (auto process type)
cores = self.dut.get_core_list('1S/2C/1T')
- coremask = dts.create_mask(cores)
+ coremask = utils.create_mask(cores)
out = self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s --proc-type=auto" % (self.target, coremask), "Finished Process Init", 100)
self.verify("EAL: Auto-detected process type: PRIMARY" in out, "The type of process (PRIMARY) was not detected properly")
time.sleep(20)
@@ -178,7 +178,7 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
"""
cores = self.dut.get_core_list('1S/2C/1T')
- coremask = dts.create_mask(cores)
+ coremask = utils.create_mask(cores)
self.session_secondary.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s -m 64" % (self.target, coremask), "Finished Process Init", 100)
coremask = hex(int(coremask, 16) * 0x10000).rstrip("L")
out = self.dut.send_expect("./examples/multi_process/simple_mp/simple_mp/%s/simple_mp -n 1 -c %s" % (self.target, coremask), "# ", 100)
@@ -216,15 +216,15 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
for execution in validExecutions:
coreList = self.dut.get_core_list(execution['cores'])
- coreMask = dts.create_mask(self.dut.get_core_list('1S/1C/1T'))
- portMask = dts.create_mask([dutPorts[0], dutPorts[1]])
+ coreMask = utils.create_mask(self.dut.get_core_list('1S/1C/1T'))
+ portMask = utils.create_mask([dutPorts[0], dutPorts[1]])
self.dut.send_expect("./examples/multi_process/client_server_mp/mp_server/client_server_mp/mp_server/%s/mp_server -n %d -c %s -- -p %s -n %d" % (self.target, self.dut.get_memory_channels(), "0xA0", portMask, execution['nprocs']), "Finished Process Init", 20)
self.dut.send_expect("^Z", "\r\n")
self.dut.send_expect("bg", "# ")
for n in range(execution['nprocs']):
time.sleep(5)
- coreMask = dts.create_mask([coreList[n]])
+ coreMask = utils.create_mask([coreList[n]])
self.dut.send_expect("./examples/multi_process/client_server_mp/mp_client/client_server_mp/mp_client/%s/mp_client -n %d -c %s --proc-type=secondary -- -n %d" % (self.target, self.dut.get_memory_channels(), coreMask, n), "Finished Process Init")
self.dut.send_expect("^Z", "\r\n")
self.dut.send_expect("bg", "# ")
@@ -239,12 +239,12 @@ class TestMultiprocess(TestCase, IxiaPacketGenerator):
for n in range(len(executions)):
self.verify(executions[n]['pps'] is not 0, "No traffic detected")
- dts.results_table_add_header(['Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)'])
+ self.result_table_create(['Server threads', 'Server Cores/Threads', 'Num-procs', 'Sockets/Cores/Threads', 'Num Ports', 'Frame Size', '%-age Line Rate', 'Packet Rate(mpps)'])
for execution in validExecutions:
- dts.results_table_add_row([1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000)])
+ self.result_table_add([1, '1S/1C/1T', execution['nprocs'], execution['cores'], 2, 64, execution['pps'] / float(100000000 / (8 * 84)), execution['pps'] / float(1000000)])
- dts.results_table_print()
+ self.result_table_print()
def ip(self, port, frag, src, proto, tos, dst, chksum, len, options, version, flags, ihl, ttl, id):
self.add_tcl_cmd("protocol config -name ip")
diff --git a/tests/TestSuite_netmap_compat.py b/tests/TestSuite_netmap_compat.py
index 0787136..5225a27 100644
--- a/tests/TestSuite_netmap_compat.py
+++ b/tests/TestSuite_netmap_compat.py
@@ -35,7 +35,7 @@ DPDK Test suite.
Test Netmap_compat.
"""
-import dts
+import utils
import string
import time
import re
@@ -54,7 +54,7 @@ class TestNetmapCompat(TestCase):
self.dut_ports = self.dut.get_ports(self.nic)
self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
cores = self.dut.get_core_list("1S/4C/1T")
- self.coremask = dts.create_mask(cores)
+ self.coremask = utils.create_mask(cores)
self.path = "./examples/netmap_compat/build/bridge"
diff --git a/tests/TestSuite_nvgre.py b/tests/TestSuite_nvgre.py
index 1da551b..8397f66 100644
--- a/tests/TestSuite_nvgre.py
+++ b/tests/TestSuite_nvgre.py
@@ -5,7 +5,7 @@ Test NVGRE features in DPDK.
"""
-import dts
+import utils
import string
import re
import time
@@ -352,16 +352,16 @@ class TestNvgre(TestCase):
self.verify(self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "fortpark_TLV", "sageville", "sagepond"], "NVGRE Only supported by Fortville and Sageville")
# Based on h/w type, choose how many ports to use
ports = self.dut.get_ports(self.nic)
- self.portmask = dts.create_mask(self.dut.get_ports(self.nic))
+ self.portmask = utils.create_mask(self.dut.get_ports(self.nic))
# Verify that enough ports are available
self.verify(len(ports) >= 2, "Insufficient ports for testing")
# Verify that enough threads are available
- self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
+ self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
cores = self.dut.get_core_list("1S/5C/1T")
self.verify(cores is not None, "Insufficient cores for speed testing")
- self.coremask = dts.create_mask(cores)
+ self.coremask = utils.create_mask(cores)
# start testpmd
self.pmdout = PmdOutput(self.dut)
@@ -703,9 +703,9 @@ class TestNvgre(TestCase):
self.nvgre_checksum(outer_vlan=1, inner_l4_invalid=1, inner_l4_type='SCTP')
def test_perf_nvgre_tunnelfilter_performance_2ports(self):
- dts.results_table_add_header(self.tunnel_header)
+ self.result_table_create(self.tunnel_header)
core_list = self.dut.get_core_list('1S/%dC/1T' % (self.tunnel_multiqueue * 2), socket=self.ports_socket)
- core_mask = dts.create_mask(core_list)
+ core_mask = utils.create_mask(core_list)
command_line = "./%s/app/testpmd -c %s -n %d -- -i --disable-rss --coremask=%s --rxq=4 --txq=4 --portmask=%s" % (self.target,
self.all_cores_mask,
@@ -787,9 +787,9 @@ class TestNvgre(TestCase):
perf_config['recvqueue'], perf_config['Mpps'],
perf_config['pct']]
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_nvgre_checksum_performance_2ports(self):
config = NvgreTestConfig(self)
@@ -809,7 +809,7 @@ class TestNvgre(TestCase):
self.tester.get_local_port(self.dut_port),
"nvgre.pcap"))
- all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
+ all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
# socket/core/thread
for test_cycle in self.test_cycles:
@@ -822,7 +822,7 @@ class TestNvgre(TestCase):
else:
core_list = self.dut.get_core_list(core_config)
- core_mask = dts.create_mask(core_list)
+ core_mask = utils.create_mask(core_list)
command_line = "./%s/app/testpmd -c %s -n %d -- -i \
--disable-rss --coremask=%s --portmask=%s" % (self.target,
@@ -852,7 +852,7 @@ class TestNvgre(TestCase):
self.dut.send_expect("quit", "# ", 10)
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
# save the results
for cal in self.cal_type:
@@ -861,9 +861,9 @@ class TestNvgre(TestCase):
table_row.append(test_cycle['Mpps'][cal['Type']])
table_row.append(test_cycle['pct'][cal['Type']])
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def set_up(self):
"""
diff --git a/tests/TestSuite_pmd.py b/tests/TestSuite_pmd.py
index d078487..7b9e6b5 100644
--- a/tests/TestSuite_pmd.py
+++ b/tests/TestSuite_pmd.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test userland 10Gb PMD
"""
-import dts
+import utils
import re
import time
from test_case import TestCase
@@ -88,7 +88,7 @@ class TestPmd(TestCase,IxiaPacketGenerator):
"""
PMD Performance Benchmarking with 4 ports.
"""
- all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
+ all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
# prepare traffic generator input
self.verify(len(self.dut_ports) >= 4,
@@ -120,17 +120,17 @@ class TestPmd(TestCase,IxiaPacketGenerator):
else:
queues = 1
- core_mask = dts.create_mask(core_list)
- port_mask = dts.create_mask(self.dut.get_ports())
+ core_mask = utils.create_mask(core_list)
+ port_mask = utils.create_mask(self.dut.get_ports())
self.pmdout.start_testpmd(core_config, " --rxq=%d --txq=%d --portmask=%s --rss-ip --txrst=32 --txfreet=32 --txd=128 --txqflags=0xf01" % (queues, queues, port_mask), socket=self.ports_socket)
command_line = self.pmdout.get_pmd_cmd()
info = "Executing PMD (mac fwd) using %s\n" % test_cycle['cores']
- dts.report(info, annex=True)
+ self.rst_report(info, annex=True)
self.logger.info(info)
- dts.report(command_line + "\n\n", frame=True, annex=True)
+ self.rst_report(command_line + "\n\n", frame=True, annex=True)
# self.dut.send_expect("set fwd mac", "testpmd> ", 100)
self.dut.send_expect("start", "testpmd> ")
@@ -162,7 +162,7 @@ class TestPmd(TestCase,IxiaPacketGenerator):
frame_size] is not 0, "No traffic detected")
# Print results
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
for frame_size in self.frame_sizes:
table_row = [frame_size]
@@ -172,16 +172,16 @@ class TestPmd(TestCase,IxiaPacketGenerator):
table_row.append(test_cycle['Mpps'][frame_size])
table_row.append(test_cycle['pct'][frame_size])
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_pmd_performance_2ports(self):
"""
PMD Performance Benchmarking with 2 ports.
"""
- all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
+ all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
# prepare traffic generator input
tgen_input = []
@@ -204,8 +204,8 @@ class TestPmd(TestCase,IxiaPacketGenerator):
else:
queues = 1
- core_mask = dts.create_mask(core_list)
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ core_mask = utils.create_mask(core_list)
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
#self.pmdout.start_testpmd("all", "--coremask=%s --rxq=%d --txq=%d --portmask=%s" % (core_mask, queues, queues, port_mask))
self.pmdout.start_testpmd(core_config, " --rxq=%d --txq=%d --portmask=%s --rss-ip --txrst=32 --txfreet=32 --txd=128" % (queues, queues, port_mask), socket=self.ports_socket)
@@ -213,8 +213,8 @@ class TestPmd(TestCase,IxiaPacketGenerator):
info = "Executing PMD using %s\n" % test_cycle['cores']
self.logger.info(info)
- dts.report(info, annex=True)
- dts.report(command_line + "\n\n", frame=True, annex=True)
+ self.rst_report(info, annex=True)
+ self.rst_report(command_line + "\n\n", frame=True, annex=True)
self.dut.send_expect("start", "testpmd> ")
for frame_size in self.frame_sizes:
@@ -244,7 +244,7 @@ class TestPmd(TestCase,IxiaPacketGenerator):
frame_size] > 0, "No traffic detected")
# Print results
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
for frame_size in self.frame_sizes:
table_row = [frame_size]
for test_cycle in self.test_cycles:
@@ -252,9 +252,9 @@ class TestPmd(TestCase,IxiaPacketGenerator):
table_row.append(test_cycle['Mpps'][frame_size])
table_row.append(test_cycle['pct'][frame_size])
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def test_checksum_checking(self):
"""
@@ -263,7 +263,7 @@ class TestPmd(TestCase,IxiaPacketGenerator):
self.dut.kill_all()
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
for rxfreet_value in self.rxfreet_values:
@@ -290,7 +290,7 @@ class TestPmd(TestCase,IxiaPacketGenerator):
self.dut.kill_all()
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
self.pmdout.start_testpmd("1S/2C/1T", "--portmask=%s" % port_mask, socket=self.ports_socket)
self.dut.send_expect("start", "testpmd> ")
diff --git a/tests/TestSuite_pmd_bonded.py b/tests/TestSuite_pmd_bonded.py
index fd15c1d..8b8b8ee 100644
--- a/tests/TestSuite_pmd_bonded.py
+++ b/tests/TestSuite_pmd_bonded.py
@@ -43,7 +43,7 @@ import random
from socket import htons, htonl
from functools import wraps
-import dts
+import utils
from test_case import TestCase
from exception import TimeoutException
from settings import TIMEOUT
@@ -498,7 +498,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
Add the ports into the bonding device as slaves.
"""
if len(slave_port) <= 0:
- dts.RED("No port exist when add slave to bonded device")
+ utils.RED("No port exist when add slave to bonded device")
for slave_id in slave_port:
self.__send_expect("add bonding slave %d %d" % (slave_id, bond_port), "testpmd> ")
@@ -515,7 +515,7 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
Remove the specified slave port from the bonding device.
"""
if len(slave_port) <= 0:
- dts.RED("No port exist when remove slave from bonded device")
+ utils.RED("No port exist when remove slave from bonded device")
for slave_id in slave_port:
self.dut.send_expect("remove bonding slave %d %d" % (int(slave_id), bond_port), "testpmd> ")
out = self.get_info_from_bond_config("Slaves: \[", "\d*( \d*)*", bond_port)
@@ -794,13 +794,13 @@ UDP(sport=srcport, dport=destport)/Raw(load="\x50"*%s)], iface="%s", count=%d)'
self.dut_ports = self.dut.get_ports()
- self.port_mask = dts.create_mask(self.dut_ports)
+ self.port_mask = utils.create_mask(self.dut_ports)
self.verify(len(self.dut_ports) >= 4, "Insufficient ports")
self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
- self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
+ self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
self.pmdout = PmdOutput(self.dut)
diff --git a/tests/TestSuite_pmdpcap.py b/tests/TestSuite_pmdpcap.py
index 41e2cfe..a080dd0 100644
--- a/tests/TestSuite_pmdpcap.py
+++ b/tests/TestSuite_pmdpcap.py
@@ -32,7 +32,7 @@
'''
'''
from test_case import TestCase
-import dts
+import utils
from time import sleep
from scapy.all import *
@@ -116,7 +116,7 @@ class TestPmdPcap(TestCase):
out_pcap = '/tmp/out_pmdpcap.pcap'
two_cores = self.dut.get_core_list("1S/2C/1T")
- core_mask = dts.create_mask(two_cores)
+ core_mask = utils.create_mask(two_cores)
self.create_pcap_file(in_pcap, TestPmdPcap.pcap_file_sizes[0])
self.dut.session.copy_file_to(in_pcap)
@@ -147,7 +147,7 @@ class TestPmdPcap(TestCase):
out_pcap2 = '/tmp/out2_pmdpcap.pcap'
four_cores = self.dut.get_core_list("1S/4C/1T")
- core_mask = dts.create_mask(four_cores)
+ core_mask = utils.create_mask(four_cores)
self.create_pcap_file(in_pcap1, TestPmdPcap.pcap_file_sizes[0])
self.dut.session.copy_file_to(in_pcap1)
diff --git a/tests/TestSuite_pmdrss_hash.py b/tests/TestSuite_pmdrss_hash.py
index 0cb703b..0bd6396 100644
--- a/tests/TestSuite_pmdrss_hash.py
+++ b/tests/TestSuite_pmdrss_hash.py
@@ -39,7 +39,7 @@ Support 4*10G, 1*40G and 2*40G NICs.
import time
import random
import re
-import dts
+import utils
testQueues = [16]
reta_entries = []
@@ -184,7 +184,7 @@ class TestPmdrssHash(TestCase):
global reta_lines
global reta_num
result = []
- dts.results_table_add_header(
+ self.result_table_create(
['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass '])
i = 0
@@ -200,11 +200,11 @@ class TestPmdrssHash(TestCase):
else:
status = "fail"
result.insert(i, 1)
- dts.results_table_add_row(
+ self.result_table_add(
[i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
i = i + 1
- dts.results_table_print()
+ self.result_table_print()
reta_lines = []
self.verify(sum(result) == 0, "the reta update function failed!")
@@ -384,7 +384,7 @@ class TestPmdrssHash(TestCase):
global reta_lines
global reta_num
result = []
- dts.results_table_add_header(
+ self.result_table_create(
['packet index', 'RSS hash', 'hash index', 'queue id', 'actual queue id', 'pass '])
i = 0
@@ -402,11 +402,11 @@ class TestPmdrssHash(TestCase):
result.insert((i - 1) / 2, 1)
pre_RSS_hash = tmp_reta_line["RSS hash"]
- dts.results_table_add_row(
+ self.result_table_add(
[i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
i = i + 1
- dts.results_table_print()
+ self.result_table_print()
reta_lines = []
self.verify(
sum(result) == 0, "the symmetric RSS hash function failed!")
diff --git a/tests/TestSuite_pmdrssreta.py b/tests/TestSuite_pmdrssreta.py
index 653f8c0..10af47f 100644
--- a/tests/TestSuite_pmdrssreta.py
+++ b/tests/TestSuite_pmdrssreta.py
@@ -36,7 +36,7 @@ Test RSS reta (redirection table) update function.
import time
import random
import re
-import dts
+import utils
testQueues = [16]
reta_entries = []
reta_lines = []
@@ -142,7 +142,7 @@ class TestPmdrssreta(TestCase):
global reta_lines
result = []
- dts.results_table_add_header(
+ self.result_table_create(
['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass '])
i = 0
@@ -160,11 +160,11 @@ class TestPmdrssreta(TestCase):
else:
status = "fail"
result.insert(i, 1)
- dts.results_table_add_row(
+ self.result_table_add(
[i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
i = i + 1
- dts.results_table_print()
+ self.result_table_print()
reta_lines = []
self.verify(sum(result) == 0, "the reta update function failed!")
@@ -244,8 +244,8 @@ class TestPmdrssreta(TestCase):
m = pattern.search(out)
if m is not None:
size = m.group(1)
- print dts.GREEN("******************")
- print dts.GREEN("NIC %s hash size %d and expected %d" % (self.nic, int(size), nic_rss_key_size[self.nic]))
+ print utils.GREEN("******************")
+ print utils.GREEN("NIC %s hash size %d and expected %d" % (self.nic, int(size), nic_rss_key_size[self.nic]))
if (nic_rss_key_size[self.nic] == int(size)):
self.verify(True, "pass")
else:
diff --git a/tests/TestSuite_queue_start_stop.py b/tests/TestSuite_queue_start_stop.py
index 360ed85..d1df66b 100644
--- a/tests/TestSuite_queue_start_stop.py
+++ b/tests/TestSuite_queue_start_stop.py
@@ -38,7 +38,6 @@ Test queue start stop Feature
"""
-import dts
import time
import re
import os
diff --git a/tests/TestSuite_quota_watermark.py b/tests/TestSuite_quota_watermark.py
index 6811714..94957e2 100644
--- a/tests/TestSuite_quota_watermark.py
+++ b/tests/TestSuite_quota_watermark.py
@@ -36,7 +36,7 @@ Quota & Watermark example app test cases.
"""
import time
-import dts
+import utils
from test_case import TestCase
from etgen import IxiaPacketGenerator
from packet import Packet, sniff_packets, load_sniff_packets
@@ -86,9 +86,9 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator):
"""
Adds the table header and some info about the executed test
"""
- dts.report('Core mask: %s' % core_mask)
- dts.report('Port mask: %s' % port_mask)
- dts.results_table_add_header([
+ self.rst_report('Core mask: %s' % core_mask)
+ self.rst_report('Port mask: %s' % port_mask)
+ self.result_table_create([
'Ring size',
'Quota',
'Low water-mark',
@@ -228,7 +228,7 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator):
ports_config['dut_rx'] = dut_rx_port
ports_config['dut_tx'] = dut_tx_port
ports_config[
- 'dut_port_mask'] = dts.create_mask([ports_config['dut_tx'],
+ 'dut_port_mask'] = utils.create_mask([ports_config['dut_tx'],
ports_config['dut_rx']])
ports_config['tester_rx'] = self.tester.get_local_port(
ports_config['dut_rx'])
@@ -297,7 +297,7 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator):
self.num_of_frames = test_config['frames_to_sent']
test_stats = self.tester.traffic_generator_throughput(tgen_input)
- dts.results_table_add_row([ring_size, quota, low_watermark, high_watermark] +
+ self.result_table_add([ring_size, quota, low_watermark, high_watermark] +
test_stats)
def check_packets_transfer(self, tx_port, rx_port, tgen_input, pkt_cnt=1):
@@ -435,7 +435,7 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator):
cores_one_socket = self.dut.get_core_list('1S/4C/1T')
core_config = {
'cores': cores_one_socket,
- 'mask': dts.create_mask(cores_one_socket)
+ 'mask': utils.create_mask(cores_one_socket)
}
self.func_iterate_through_qw_ring_sizes(ports_config, core_config)
@@ -453,13 +453,13 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator):
cores_one_socket = self.dut.get_core_list('1S/4C/1T')
core_config = {
'cores': cores_one_socket,
- 'mask': dts.create_mask(cores_one_socket)
+ 'mask': utils.create_mask(cores_one_socket)
}
self.add_report_headers( core_config['mask'],
ports_config['dut_port_mask'])
self.iterate_through_qw_ring_sizes(ports_config, core_config)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_quota_watermark_two_sockets(self):
"""
@@ -474,9 +474,9 @@ class TestQuotaWatermark(TestCase, IxiaPacketGenerator):
cores_two_sockets = self.dut.get_core_list('2S/4C/1T')
core_config = {
'cores': cores_two_sockets,
- 'mask': dts.create_mask(cores_two_sockets)
+ 'mask': utils.create_mask(cores_two_sockets)
}
self.add_report_headers( core_config['mask'], ports_config['dut_port_mask'])
self.iterate_through_qw_ring_sizes(ports_config, core_config)
- dts.results_table_print()
+ self.result_table_print()
diff --git a/tests/TestSuite_rxtx_callbacks.py b/tests/TestSuite_rxtx_callbacks.py
index e8446b7..be79e56 100644
--- a/tests/TestSuite_rxtx_callbacks.py
+++ b/tests/TestSuite_rxtx_callbacks.py
@@ -34,7 +34,7 @@
DPDK Test suite.
Test Rxtx_Callbacks.
"""
-import dts
+import utils
import string
import time
from test_case import TestCase
@@ -56,7 +56,7 @@ class TestRxtxCallbacks(TestCase):
self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
cores = self.dut.get_core_list("1S/2C/1T")
- self.coremask = dts.create_mask(cores)
+ utils.create_mask(cores)
self.mac = self.dut.get_mac_address(self.dut_ports[0])
self.path = "./examples/rxtx_callbacks/build/rxtx_callbacks"
diff --git a/tests/TestSuite_scatter.py b/tests/TestSuite_scatter.py
index 9a3a10a..0f382b7 100644
--- a/tests/TestSuite_scatter.py
+++ b/tests/TestSuite_scatter.py
@@ -33,7 +33,6 @@
DPDK Test suite.
Test Scattered Packets.
"""
-import dts
from test_case import TestCase
from pmd_output import PmdOutput
from packet import Packet, sniff_packets, load_sniff_packets, strip_pktload
diff --git a/tests/TestSuite_short_live.py b/tests/TestSuite_short_live.py
index 15ba444..320951f 100644
--- a/tests/TestSuite_short_live.py
+++ b/tests/TestSuite_short_live.py
@@ -38,7 +38,6 @@ Test short live dpdk app Feature
"""
-import dts
import time
import re
import os
diff --git a/tests/TestSuite_shutdown_api.py b/tests/TestSuite_shutdown_api.py
index f03734a..a195f9e 100644
--- a/tests/TestSuite_shutdown_api.py
+++ b/tests/TestSuite_shutdown_api.py
@@ -36,13 +36,14 @@ Test Shutdown API Feature
"""
-import dts
+import utils
import time
import re
import os
from test_case import TestCase
from pmd_output import PmdOutput
from settings import HEADER_SIZE
+from exception import VerifyFailure
#
#
@@ -183,7 +184,7 @@ class TestShutdownApi(TestCase):
"""
Stop and Restar.
"""
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("set fwd mac", "testpmd>")
self.dut.send_expect("start", "testpmd> ")
@@ -204,7 +205,7 @@ class TestShutdownApi(TestCase):
"""
ports = [self.ports[0]]
- portmask = dts.create_mask(ports)
+ portmask = utils.create_mask(ports)
self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % portmask, socket = self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
@@ -215,7 +216,7 @@ class TestShutdownApi(TestCase):
try:
self.check_forwarding(ports)
- except dts.VerifyFailure as e:
+ except VerifyFailure as e:
print 'promiscuous mode is working correctly'
except Exception as e:
print " !!! DEBUG IT: " + e.message
@@ -238,8 +239,8 @@ class TestShutdownApi(TestCase):
"""
testcorelist = self.dut.get_core_list("1S/8C/1T", socket=self.ports_socket)
- self.pmdout.start_testpmd(testcorelist, "--portmask=%s --port-topology=loop" % dts.create_mask([self.ports[0]]), socket=self.ports_socket)
- fwdcoremask = dts.create_mask(testcorelist[-3:])
+ self.pmdout.start_testpmd(testcorelist, "--portmask=%s --port-topology=loop" % utils.create_mask([self.ports[0]]), socket=self.ports_socket)
+ fwdcoremask = utils.create_mask(testcorelist[-3:])
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("port config all rxq 2", "testpmd> ")
@@ -258,7 +259,7 @@ class TestShutdownApi(TestCase):
"""
Reconfigure All Ports With The Same Configurations (CRC)
"""
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("port config all crc-strip on", "testpmd> ")
@@ -276,10 +277,10 @@ class TestShutdownApi(TestCase):
Change Link Speed.
"""
if self.kdriver == "fm10k":
- print dts.RED("RRC not support\n")
+ print utils.RED("RRC not support\n")
return
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
out = self.tester.send_expect(
"ethtool %s" % self.tester.get_interface(self.tester.get_local_port(self.ports[0])), "# ")
@@ -322,11 +323,11 @@ class TestShutdownApi(TestCase):
Enable/Disable Jumbo Frames.
"""
if self.kdriver == "fm10k":
- print dts.RED("RRC not support\n")
+ print utils.RED("RRC not support\n")
return
jumbo_size = 2048
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("vlan set strip off all", "testpmd> ")
self.dut.send_expect("port config all max-pkt-len %d" % jumbo_size, "testpmd> ")
@@ -365,7 +366,7 @@ class TestShutdownApi(TestCase):
"""
Enable/Disable RSS.
"""
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("port config rss ip", "testpmd> ")
@@ -378,7 +379,7 @@ class TestShutdownApi(TestCase):
"""
Change numbers of rxd and txd.
"""
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("port config all rxd 1024", "testpmd> ")
@@ -397,7 +398,7 @@ class TestShutdownApi(TestCase):
"""
Change the Number of rxd/txd.
"""
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("port config all rxd 1024", "testpmd> ")
@@ -427,7 +428,7 @@ class TestShutdownApi(TestCase):
"""
Change RX/TX thresholds
"""
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("port stop all", "testpmd> ", 100)
self.dut.send_expect("port config all txfreet 32", "testpmd> ")
@@ -463,7 +464,7 @@ class TestShutdownApi(TestCase):
"""
stress_iterations = 10
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
tgenInput = []
for port in self.ports:
@@ -485,10 +486,10 @@ class TestShutdownApi(TestCase):
port link stats test
"""
if self.kdriver == "fm10k":
- print dts.RED("RRC not support\n")
+ print utils.RED("RRC not support\n")
return
- self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % dts.create_mask(self.ports), socket=self.ports_socket)
+ self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % utils.create_mask(self.ports), socket=self.ports_socket)
self.dut.send_expect("set fwd mac", "testpmd>")
self.dut.send_expect("start", "testpmd>")
diff --git a/tests/TestSuite_skeleton.py b/tests/TestSuite_skeleton.py
index c6fc231..a5cc591 100644
--- a/tests/TestSuite_skeleton.py
+++ b/tests/TestSuite_skeleton.py
@@ -34,7 +34,7 @@
DPDK Test suite.
Test Skeleton.
"""
-import dts
+import utils
import string
import time
from test_case import TestCase
@@ -56,7 +56,7 @@ class TestSkeleton(TestCase):
self.verify(len(self.dut_ports) >= 2, "Insufficient ports")
cores = self.dut.get_core_list("1S/2C/1T")
- self.coremask = dts.create_mask(cores)
+ self.coremask = utils.create_mask(cores)
self.mac = self.dut.get_mac_address(self.dut_ports[0])
self.path = "./examples/skeleton/build/basicfwd"
diff --git a/tests/TestSuite_sriov_kvm.py b/tests/TestSuite_sriov_kvm.py
index cd3d9c3..41af4dd 100644
--- a/tests/TestSuite_sriov_kvm.py
+++ b/tests/TestSuite_sriov_kvm.py
@@ -12,7 +12,6 @@ import re
import pdb
import time
-import dts
from qemu_kvm import QEMUKvm
from test_case import TestCase
diff --git a/tests/TestSuite_sriov_live_migration.py b/tests/TestSuite_sriov_live_migration.py
index 7a75c59..754ad2f 100644
--- a/tests/TestSuite_sriov_live_migration.py
+++ b/tests/TestSuite_sriov_live_migration.py
@@ -3,7 +3,7 @@
import re
import time
-import dts
+import utils
from qemu_kvm import QEMUKvm
from test_case import TestCase
from exception import VirtDutInitException
@@ -268,12 +268,12 @@ class TestVhostUserLiveMigration(TestCase):
if getattr(self, 'host_vf', None):
self.duts[0].destroy_sriov_vfs_by_port(self.dut_port)
- self.bind_nic_driver(self.duts[0], [self.dut_port], dts.drivername)
+ self.bind_nic_driver(self.duts[0], [self.dut_port], self.drivername)
self.host_vf = None
if getattr(self, 'backup_vf', None):
self.duts[1].destroy_sriov_vfs_by_port(self.backup_port)
- self.bind_nic_driver(self.duts[1], [self.backup_port], dts.drivername)
+ self.bind_nic_driver(self.duts[1], [self.backup_port], self.drivername)
self.backup_vf= None
# # after vm stopped, stop vhost-switch
diff --git a/tests/TestSuite_timer.py b/tests/TestSuite_timer.py
index 765770d..c6f2234 100644
--- a/tests/TestSuite_timer.py
+++ b/tests/TestSuite_timer.py
@@ -34,7 +34,7 @@ DPDK Test suite.
Test Timer.
"""
-import dts
+import utils
import re
import time
@@ -69,7 +69,7 @@ class TestTimer(TestCase):
# get the mask for the first core
cores = self.dut.get_core_list('1S/1C/1T')
- coreMask = dts.create_mask(cores)
+ coreMask = utils.create_mask(cores)
# run timer on the background
cmdline = "./examples/timer/build/app/timer -n 1 -c " + coreMask + " &"
@@ -80,7 +80,7 @@ class TestTimer(TestCase):
self.dut.send_expect("killall timer", "# ", 5)
# verify timer0
- dts.regexp(out, r'timer0_cb\(\) on lcore (\d+)')
+ utils.regexp(out, r'timer0_cb\(\) on lcore (\d+)')
pat = re.compile(r'timer0_cb\(\) on lcore (\d+)')
match = pat.findall(out)
self.verify(match or match[0] == 0, "timer0 error")
diff --git a/tests/TestSuite_tso.py b/tests/TestSuite_tso.py
index 32db524..00f7539 100644
--- a/tests/TestSuite_tso.py
+++ b/tests/TestSuite_tso.py
@@ -37,7 +37,7 @@ Tests for TSO.
"""
-import dts
+import utils
import time
import re
from test_case import TestCase
@@ -65,8 +65,8 @@ class TestTSO(TestCase):
self.verify(len(self.dut_ports) >= 2, "Insufficient ports for testing")
# Verify that enough threads are available
- self.all_cores_mask = dts.create_mask(self.dut.get_core_list("all"))
- self.portMask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ self.all_cores_mask = utils.create_mask(self.dut.get_core_list("all"))
+ self.portMask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])
self.frame_sizes = [128, 1458]
@@ -87,7 +87,7 @@ class TestTSO(TestCase):
self.blacklist = ""
- # self.coreMask = dts.create_mask(cores)
+ # self.coreMask = utils.create_mask(cores)
self.headers_size = HEADER_SIZE['eth'] + HEADER_SIZE[
'ip'] + HEADER_SIZE['tcp']
@@ -150,7 +150,7 @@ class TestTSO(TestCase):
mac = self.dut.get_mac_address(self.dut_ports[0])
cores = self.dut.get_core_list("1S/2C/2T")
self.verify(cores is not None, "Insufficient cores for speed testing")
- self.coreMask = dts.create_mask(cores)
+ self.coreMask = utils.create_mask(cores)
padding = self.frame_sizes[0] - self.headers_size
@@ -216,7 +216,7 @@ class TestTSO(TestCase):
cores = self.dut.get_core_list("1S/2C/2T")
self.verify(cores is not None, "Insufficient cores for speed testing")
- self.coreMask = dts.create_mask(cores)
+ self.coreMask = utils.create_mask(cores)
padding = self.frame_sizes[0] - self.headers_size
@@ -281,7 +281,7 @@ class TestTSO(TestCase):
for test_cycle in self.test_cycles:
core_config = test_cycle['cores']
cores = self.dut.get_core_list(core_config, socket=self.ports_socket)
- self.coreMask = dts.create_mask(cores)
+ self.coreMask = utils.create_mask(cores)
if len(cores) > 2:
queues = len(cores) / 2
else:
@@ -291,8 +291,8 @@ class TestTSO(TestCase):
info = "Executing PMD using %s\n" % test_cycle['cores']
self.logger.info(info)
- dts.report(info, annex=True)
- dts.report(command_line + "\n\n", frame=True, annex=True)
+ self.rst_report(info, annex=True)
+ self.rst_report(command_line + "\n\n", frame=True, annex=True)
self.dut.send_expect(command_line, "testpmd> ", 120)
self.dut.send_expect("csum set ip hw %d" % self.dut_ports[0], "testpmd> ", 120)
@@ -340,13 +340,13 @@ class TestTSO(TestCase):
frame_size] > 0, "No traffic detected")
# Print results
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
for frame_size in self.frame_sizes:
table_row = [frame_size]
for test_cycle in self.test_cycles:
table_row.append(test_cycle['Mpps'][frame_size])
table_row.append(test_cycle['pct'][frame_size])
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
diff --git a/tests/TestSuite_uni_pkt.py b/tests/TestSuite_uni_pkt.py
index 429546a..22ae9c7 100644
--- a/tests/TestSuite_uni_pkt.py
+++ b/tests/TestSuite_uni_pkt.py
@@ -43,7 +43,7 @@ translate the offloaded packet types into these 7 fields of information, for
user applications
"""
-import dts
+import utils
from test_case import TestCase
from exception import VerifyFailure
from packet import Packet
@@ -85,9 +85,9 @@ class TestUniPacket(TestCase):
out = self.dut.get_session_output(timeout=2)
for pkt_layer_name in pkt_names:
if pkt_layer_name not in out:
- print dts.RED("Fail to detect %s" % pkt_layer_name)
+ print utils.RED("Fail to detect %s" % pkt_layer_name)
raise VerifyFailure("Failed to detect %s" % pkt_layer_name)
- print dts.GREEN("Detected %s successfully" % pkt_type)
+ print utils.GREEN("Detected %s successfully" % pkt_type)
def test_l2pkt_detect(self):
"""
@@ -107,7 +107,7 @@ class TestUniPacket(TestCase):
pkt.send_pkt(tx_port=self.tester_iface)
out = self.dut.get_session_output(timeout=2)
if pkt_name in out:
- print dts.GREEN("Detected L2 %s successfully" % l2_type)
+ print utils.GREEN("Detected L2 %s successfully" % l2_type)
else:
raise VerifyFailure("Failed to detect L2 %s" % l2_type)
diff --git a/tests/TestSuite_unit_tests_eal.py b/tests/TestSuite_unit_tests_eal.py
index 663e961..e8ea20b 100644
--- a/tests/TestSuite_unit_tests_eal.py
+++ b/tests/TestSuite_unit_tests_eal.py
@@ -7,7 +7,7 @@ EAL autotest.
"""
-import dts
+import utils
from test_case import TestCase
@@ -185,7 +185,7 @@ class TestUnitTestsEal(TestCase):
self.dut.send_expect("./app/test/test -n 1 -c ffff", "R.*T.*E.*>.*>", self.start_test_time)
out = self.dut.send_expect('memory_autotest', "RTE>>", self.run_cmd_time * 5)
regexp = "phys:0x[0-9a-f]*, len:([0-9a-f]*), virt:0x[0-9a-f]*, socket_id:[0-9]*"
- match = dts.regexp(out, regexp)
+ match = utils.regexp(out, regexp)
size = int(match, 16)
self.verify(size > 0, "bad size")
self.dut.send_expect("quit", "# ")
diff --git a/tests/TestSuite_unit_tests_pmd_perf.py b/tests/TestSuite_unit_tests_pmd_perf.py
index 3be47f9..695c8de 100644
--- a/tests/TestSuite_unit_tests_pmd_perf.py
+++ b/tests/TestSuite_unit_tests_pmd_perf.py
@@ -35,7 +35,7 @@ DPDK Test suite.
This TestSuite runs the unit tests included in DPDK for pmd performance.
"""
-import dts
+import utils
import re
from test_case import TestCase
@@ -108,7 +108,7 @@ class TestUnitTestsPmdPerf(TestCase):
self.table_header = ['Mode']
self.table_header += self.anchors
- dts.results_table_add_header(self.table_header)
+ self.result_table_create(self.table_header)
print self.table_header
for mode in self.rxtx_modes:
@@ -129,9 +129,9 @@ class TestUnitTestsPmdPerf(TestCase):
table_row.append(result.group(1))
self.dut.send_expect("quit", "# ")
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def tear_down(self):
"""
diff --git a/tests/TestSuite_userspace_ethtool.py b/tests/TestSuite_userspace_ethtool.py
index 2346e3b..ced7e96 100644
--- a/tests/TestSuite_userspace_ethtool.py
+++ b/tests/TestSuite_userspace_ethtool.py
@@ -35,7 +35,7 @@ Test support of userspace ethtool feature
"""
import os
-import dts
+import utils
import time
import re
from test_case import TestCase
@@ -170,7 +170,7 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
port = m.group(1)
driver = m.group(2)
version = m.group(3)
- print dts.GREEN("Detect port %s with %s driver\n" % (port, driver))
+ print utils.GREEN("Detect port %s with %s driver\n" % (port, driver))
# ethtool doesn't support port disconnect by tools of linux
# only detect physical link disconnect status
@@ -296,8 +296,8 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
md5 = self.strip_md5(portsinfo[index]['eeprom_file'])
self.resize_linux_eeprom_file( portsinfo[index]['eeprom_file'], portsinfo[index]['ethtool_eeprom'])
md5_ref = self.strip_md5(portsinfo[index]['ethtool_eeprom'])
- print dts.GREEN("Reference eeprom md5 %s" % md5)
- print dts.GREEN("Reference eeprom md5_ref %s" % md5_ref)
+ print utils.GREEN("Reference eeprom md5 %s" % md5)
+ print utils.GREEN("Reference eeprom md5_ref %s" % md5_ref)
self.verify(md5 == md5_ref, "Dumped eeprom not same as linux dumped")
def test_ring_parameter(self):
diff --git a/tests/TestSuite_vf_jumboframe.py b/tests/TestSuite_vf_jumboframe.py
index bac4a29..d32990a 100644
--- a/tests/TestSuite_vf_jumboframe.py
+++ b/tests/TestSuite_vf_jumboframe.py
@@ -3,7 +3,7 @@
import re
import time
-import dts
+import utils
from qemu_kvm import QEMUKvm
from test_case import TestCase
from pmd_output import PmdOutput
@@ -29,7 +29,7 @@ class TestVfJumboFrame(TestCase):
self.port = self.dut_ports[0]
self.vm_port = 0
cores = self.dut.get_core_list("1S/1C/1T")
- self.port_mask = dts.create_mask([self.port])
+ self.port_mask = utils.create_mask([self.port])
# enable tester mtu
tester_port = self.tester.get_local_port(self.port)
diff --git a/tests/TestSuite_vf_macfilter.py b/tests/TestSuite_vf_macfilter.py
index 061f7ab..1fce394 100644
--- a/tests/TestSuite_vf_macfilter.py
+++ b/tests/TestSuite_vf_macfilter.py
@@ -3,7 +3,6 @@
import re
import time
-import dts
from qemu_kvm import QEMUKvm
from test_case import TestCase
from pmd_output import PmdOutput
diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py
index 78fa5a6..6a4ab52 100644
--- a/tests/TestSuite_vf_offload.py
+++ b/tests/TestSuite_vf_offload.py
@@ -3,7 +3,7 @@
import re
import time
-import dts
+import utils
from qemu_kvm import QEMUKvm
from test_case import TestCase
from pmd_output import PmdOutput
@@ -23,7 +23,7 @@ class TestVfOffload(TestCase):
self.setup_2pf_2vf_1vm_env_flag = 0
self.setup_2pf_2vf_1vm_env(driver='')
self.vm0_dut_ports = self.vm_dut_0.get_ports('any')
- self.portMask = dts.create_mask([self.vm0_dut_ports[0]])
+ self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
self.vm0_testpmd = PmdOutput(self.vm_dut_0)
def set_up(self):
@@ -329,7 +329,7 @@ class TestVfOffload(TestCase):
self.tester.send_expect("ethtool -K %s rx off tx off tso off gso off gro off lro off" % tx_interface, "# ")
self.tester.send_expect("ip l set %s up" % tx_interface, "# ")
- self.portMask = dts.create_mask([self.vm0_dut_ports[0]])
+ self.portMask = utils.create_mask([self.vm0_dut_ports[0]])
self.vm0_testpmd.start_testpmd(VM_CORES_MASK, "--portmask=%s " %
(self.portMask) + "--enable-rx-cksum " +
"--txqflags=0 " +
diff --git a/tests/TestSuite_vf_packet_rxtx.py b/tests/TestSuite_vf_packet_rxtx.py
index 2f9dfc1..25b03eb 100644
--- a/tests/TestSuite_vf_packet_rxtx.py
+++ b/tests/TestSuite_vf_packet_rxtx.py
@@ -3,7 +3,6 @@
import re
import time
-import dts
from qemu_kvm import QEMUKvm
from test_case import TestCase
from pmd_output import PmdOutput
diff --git a/tests/TestSuite_vf_port_start_stop.py b/tests/TestSuite_vf_port_start_stop.py
index 7657879..35309c4 100644
--- a/tests/TestSuite_vf_port_start_stop.py
+++ b/tests/TestSuite_vf_port_start_stop.py
@@ -3,7 +3,6 @@
import re
import time
-import dts
from qemu_kvm import QEMUKvm
from test_case import TestCase
from pmd_output import PmdOutput
diff --git a/tests/TestSuite_vf_rss.py b/tests/TestSuite_vf_rss.py
index cb2ffc9..21c717b 100644
--- a/tests/TestSuite_vf_rss.py
+++ b/tests/TestSuite_vf_rss.py
@@ -36,7 +36,6 @@ Test RSS reta (redirection table) update function.
import time
import random
import re
-import dts
testQueues = [4]
reta_entries = []
reta_lines = []
@@ -182,7 +181,7 @@ class TestVfRss(TestCase):
global reta_lines
result = []
- dts.results_table_add_header(
+ self.result_table_create(
['packet index', 'hash value', 'hash index', 'queue id', 'actual queue id', 'pass '])
i = 0
@@ -200,11 +199,11 @@ class TestVfRss(TestCase):
else:
status = "fail"
result.insert(i, 1)
- dts.results_table_add_row(
+ self.result_table_add(
[i, tmp_reta_line["RSS hash"], hash_index, reta_entries[hash_index], tmp_reta_line["queue"], status])
i = i + 1
- dts.results_table_print()
+ self.result_table_print()
reta_lines = []
self.verify(sum(result) == 0, "the reta update function failed!")
diff --git a/tests/TestSuite_vf_to_vf_nic_bridge.py b/tests/TestSuite_vf_to_vf_nic_bridge.py
index 9c5548b..065038a 100644
--- a/tests/TestSuite_vf_to_vf_nic_bridge.py
+++ b/tests/TestSuite_vf_to_vf_nic_bridge.py
@@ -34,7 +34,7 @@ Test vf to vf nic bridge
"""
import re
-import dts
+import utils
import time
import pdb
@@ -82,7 +82,7 @@ class TestVF2VFBridge(TestCase):
if self.vm0_dut is None:
raise Exception('Set up VM0 failed')
except Exception as e:
- print dts.RED(str(e))
+ print utils.RED(str(e))
self.vm1 = QEMUKvm(self.dut, 'vm1', 'vf_to_vf_bridge')
self.vm1.set_vm_device(driver='pci-assign', **vf1_prop)
@@ -91,7 +91,7 @@ class TestVF2VFBridge(TestCase):
if self.vm1_dut is None:
raise Exception('Set up VM1 failed')
except Exception as e:
- print dts.RED(str(e))
+ print utils.RED(str(e))
def clear_vf_to_vf_env(self):
if self.vm0 is not None:
@@ -210,7 +210,7 @@ class TestVF2VFBridge(TestCase):
recv_info = recv_pattern.search(recv_tcpdump)
recv_str = recv_info.group(0).split(' ')[0]
recv_number = int(recv_str, 10)
- self.vm0_dut.bind_interfaces_linux(dts.drivername)
+ self.vm0_dut.bind_interfaces_linux(self.drivername)
self.verify(recv_number is SEND_PACKET, 'Rx port recv error: %d' % recv_number)
@@ -236,7 +236,7 @@ class TestVF2VFBridge(TestCase):
self.vm1_dut.send_expect('scapy', '>>> ', 10)
self.vm1_dut.send_expect('sendp([%s], iface="%s", count=%d)' % (pkt_content, vf1_intf, SEND_PACKET), '>>> ', 30)
self.vm1_dut.send_expect('quit()', '# ', 10)
- self.vm1_dut.bind_interfaces_linux(dts.drivername)
+ self.vm1_dut.bind_interfaces_linux(self.drivername)
recv_num = self.vm0_pmd.get_pmd_stats(0)['RX-packets']
self.vm0_pmd.execute_cmd('stop')
self.vm0_pmd.execute_cmd('quit', '# ')
diff --git a/tests/TestSuite_vf_vlan.py b/tests/TestSuite_vf_vlan.py
index fc1527c..f106cac 100644
--- a/tests/TestSuite_vf_vlan.py
+++ b/tests/TestSuite_vf_vlan.py
@@ -3,7 +3,6 @@
import re
import time
-import dts
from qemu_kvm import QEMUKvm
from test_case import TestCase
from pmd_output import PmdOutput
diff --git a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
index e7d71e9..415ab0d 100644
--- a/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
+++ b/tests/TestSuite_vhost_cuse_one_copy_one_vm.py
@@ -35,7 +35,7 @@ DPDK Test suite.
Vhost Cuse one-copy sample test suite.
"""
import os
-import dts
+import utils
import string
import re
import time
@@ -147,7 +147,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
#
# Launch the vhost sample with different parameters
#
- self.coremask = dts.create_mask(self.cores)
+ self.coremask = utils.create_mask(self.cores)
self.vhostapp_testcmd = self.vhost_test % (
self.coremask, self.memory_channel, self.jumbo, self.zero_copy, self.vm2vm)
# Clean and prepare the vhost cuse modules
@@ -172,7 +172,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
else:
print "Launch vhost sample finished"
except Exception as e:
- print dts.RED("Failed to launch vhost sample: %s" % str(e))
+ print utils.RED("Failed to launch vhost sample: %s" % str(e))
def start_onevm(self):
#
@@ -195,7 +195,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
if self.vm_dut is None:
raise Exception("Set up VM ENV failed")
except Exception as e:
- print dts.RED("Failure for %s" % str(e))
+ print utils.RED("Failure for %s" % str(e))
return True
@@ -317,7 +317,7 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
return (txRate,recvRate)
def send_verify(self, case, frame_sizes, vlan_id1=0, vlan_id2=0):
- dts.results_table_add_header(self.header_row)
+ self.result_table_create(self.header_row)
for frame_size in frame_sizes:
info = "Running test %s, and %d frame size." % (case, frame_size)
self.logger.info(info)
@@ -341,8 +341,8 @@ class TestVhostCuseOneCopyOneVm(TestCase, IxiaPacketGenerator):
sendpkt /= 1000000.0
pct = sendpkt * 100 / recvpkt
data_row = [frame_size, str(recvpkt), str(sendpkt), str(pct)]
- dts.results_table_add_row(data_row)
- dts.results_table_print()
+ self.result_table_add(data_row)
+ self.result_table_print()
def test_perf_cuse_one_vm_legacy_fwd(self):
#
diff --git a/tests/TestSuite_vhost_user_live_migration.py b/tests/TestSuite_vhost_user_live_migration.py
index 95e2fb3..2650952 100644
--- a/tests/TestSuite_vhost_user_live_migration.py
+++ b/tests/TestSuite_vhost_user_live_migration.py
@@ -3,7 +3,6 @@
import re
import time
-import dts
from qemu_kvm import QEMUKvm
from test_case import TestCase
from exception import VirtDutInitException
diff --git a/tests/TestSuite_vhost_user_one_copy_one_vm.py b/tests/TestSuite_vhost_user_one_copy_one_vm.py
index 24d68b7..f9e9430 100644
--- a/tests/TestSuite_vhost_user_one_copy_one_vm.py
+++ b/tests/TestSuite_vhost_user_one_copy_one_vm.py
@@ -35,7 +35,7 @@ DPDK Test suite.
Vhost user one-copy sample test suite.
"""
import os
-import dts
+import utils
import string
import re
import time
@@ -139,7 +139,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
#
# Launch the vhost sample with different parameters
#
- self.coremask = dts.create_mask(self.cores)
+ self.coremask = utils.create_mask(self.cores)
self.vhostapp_testcmd = self.vhost_test % (
self.coremask, self.memory_channel, self.jumbo, self.zero_copy, self.vm2vm)
self.dut.send_expect(self.vhostapp_testcmd, "# ", 40)
@@ -155,7 +155,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
else:
print "Launch vhost sample finished"
except Exception as e:
- print dts.RED("Failed to launch vhost sample: %s" % str(e))
+ print utils.RED("Failed to launch vhost sample: %s" % str(e))
def start_onevm(self):
#
@@ -177,7 +177,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
if self.vm_dut is None:
raise Exception("Set up VM ENV failed")
except Exception as e:
- print dts.RED("Failure for %s" % str(e))
+ print utils.RED("Failure for %s" % str(e))
return True
@@ -299,7 +299,7 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
return (txRate,recvRate)
def send_verify(self, case, frame_sizes, vlan_id1=0, vlan_id2=0):
- dts.results_table_add_header(self.header_row)
+ self.result_table_create(self.header_row)
for frame_size in frame_sizes:
info = "Running test %s, and %d frame size." % (case, frame_size)
self.logger.info(info)
@@ -323,8 +323,8 @@ class TestVhostUserOneCopyOneVm(TestCase, IxiaPacketGenerator):
sendpkt /= 1000000.0
pct = sendpkt * 100 / recvpkt
data_row = [frame_size, str(recvpkt), str(sendpkt), str(pct)]
- dts.results_table_add_row(data_row)
- dts.results_table_print()
+ self.result_table_add(data_row)
+ self.result_table_print()
def test_perf_user_one_vm_legacy_fwd(self):
#
diff --git a/tests/TestSuite_virtio_iperf.py b/tests/TestSuite_virtio_iperf.py
index 7f7e427..a0bd6e9 100644
--- a/tests/TestSuite_virtio_iperf.py
+++ b/tests/TestSuite_virtio_iperf.py
@@ -33,8 +33,9 @@ DPDK Test suite
Test DPDK vhost + virtio scenarios
"""
import re
-import dts
+import utils
import time
+import os
from test_case import TestCase
from qemu_kvm import QEMUKvm
@@ -56,7 +57,7 @@ class TestVirtioIperf(TestCase):
netdev = self.dut.ports_info[self.phy_function]['port']
self.socket = netdev.get_nic_socket()
self.cores = self.dut.get_core_list("1S/3C/1T", socket=self.socket)
- self.coremask = dts.create_mask(self.cores)
+ self.coremask = utils.create_mask(self.cores)
def set_up(self):
pass
@@ -124,11 +125,10 @@ class TestVirtioIperf(TestCase):
fp = open("./iperf_client.log")
fmsg = fp.read()
iperfdata = re.compile('[\d+]*.[\d+] [M|G]bits/sec').findall(fmsg)
- dts.results_table_add_header(['Data', 'Unit'])
+ self.result_table_create(['Data', 'Unit'])
for data in iperfdata:
- dts.results_table_add_row([data.split()[0], data.split()[1]])
- dts.results_table_print()
- import os
+ self.results_table_add([data.split()[0], data.split()[1]])
+ self.result_table_print()
os.popen("rm -rf ./iperf_client.log")
def test_perf_vhost_legacy_virtio_iperf(self):
@@ -148,7 +148,7 @@ class TestVirtioIperf(TestCase):
self.dut_execut_cmd('modprobe cuse')
self.dut_execut_cmd('insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko')
self.dut_execut_cmd('insmod ./lib/librte_vhost/eventfd_link/eventfd_link.ko')
- self.dut.bind_interfaces_linux(dts.drivername)
+ self.dut.bind_interfaces_linux(self.drivername)
self.launch_vhost_switch(self.coremask, 4, 0, 1)
self.vm1 = QEMUKvm(self.dut, 'vm0', 'virtio_iperf')
@@ -164,7 +164,7 @@ class TestVirtioIperf(TestCase):
if self.vm1_dut is None:
raise Exception('VM1 start failed')
except Exception as e0:
- print dts.RED('VM1 already exist, powerdown it first')
+ print utils.RED('VM1 already exist, powerdown it first')
self.vm1_dut.restore_interfaces()
self.vm2 = QEMUKvm(self.dut, 'vm1', 'virtio_iperf')
@@ -180,7 +180,7 @@ class TestVirtioIperf(TestCase):
if self.vm2_dut is None:
raise Exception('VM2 start failed')
except Exception as e1:
- print dts.RED('VM2 already exist, powerdown it first')
+ print utils.RED('VM2 already exist, powerdown it first')
self.vm2_dut.restore_interfaces()
#self.start_iperf_server()
@@ -228,7 +228,7 @@ class TestVirtioIperf(TestCase):
#self.dut_execut_cmd('modprobe cuse')
self.dut_execut_cmd('insmod ./x86_64-native-linuxapp-gcc/kmod/igb_uio.ko')
self.dut_execut_cmd('insmod ./lib/librte_vhost/eventfd_link/eventfd_link.ko')
- self.dut.bind_interfaces_linux(dts.drivername)
+ self.dut.bind_interfaces_linux(self.drivername)
self.launch_vhost_switch(self.coremask, 4, 0, 1)
self.vm1 = QEMUKvm(self.dut, 'vm0', 'virtio_iperf')
@@ -242,7 +242,7 @@ class TestVirtioIperf(TestCase):
if self.vm1_dut is None:
raise Exception('VM1 start failed')
except Exception as e0:
- print dts.RED('VM1 already exist, powerdown it first')
+ print utils.RED('VM1 already exist, powerdown it first')
self.vm1_dut.restore_interfaces()
self.vm2 = QEMUKvm(self.dut, 'vm1', 'virtio_iperf')
@@ -256,7 +256,7 @@ class TestVirtioIperf(TestCase):
if self.vm2_dut is None:
raise Exception('VM2 start failed')
except Exception as e1:
- print dts.RED('VM2 already exist, powerdown it first')
+ print utils.RED('VM2 already exist, powerdown it first')
self.vm2_dut.restore_interfaces()
diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py
index 70a9813..9bed8da 100644
--- a/tests/TestSuite_vlan.py
+++ b/tests/TestSuite_vlan.py
@@ -37,7 +37,7 @@ Test the support of VLAN Offload Features by Poll Mode Drivers.
"""
-import dts
+import utils
import time
@@ -67,7 +67,7 @@ class TestVlan(TestCase):
valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
dutRxPortId = valports[0]
dutTxPortId = valports[0]
- portMask = dts.create_mask(valports[:1])
+ portMask = utils.create_mask(valports[:1])
self.pmdout = PmdOutput(self.dut)
self.pmdout.start_testpmd("Default", "--portmask=%s --port-topology=loop" % portMask)
@@ -133,7 +133,7 @@ class TestVlan(TestCase):
"""
if self.kdriver == "fm10k":
- print dts.RED("fm10k not support this case\n")
+ print utils.RED("fm10k not support this case\n")
return
self.dut.send_expect("rx_vlan add %d %s" % (self.vlan, dutRxPortId), "testpmd> ")
self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ")
@@ -178,7 +178,7 @@ class TestVlan(TestCase):
def test_vlan_strip_config_off(self):
if self.kdriver == "fm10k":
- print dts.RED("fm10k not support this case\n")
+ print utils.RED("fm10k not support this case\n")
return
self.dut.send_expect("vlan set strip off %s" % dutRxPortId, "testpmd> ", 20)
self.dut.send_expect("rx_vlan add %d %s" % (self.vlan, dutRxPortId), "testpmd> ", 20)
diff --git a/tests/TestSuite_vm_power_manager.py b/tests/TestSuite_vm_power_manager.py
index f58fb45..e9d25b3 100644
--- a/tests/TestSuite_vm_power_manager.py
+++ b/tests/TestSuite_vm_power_manager.py
@@ -35,7 +35,7 @@ VM power manager test suite.
"""
import re
-import dts
+import utils
from test_case import TestCase
from etgen import IxiaPacketGenerator
from settings import HEADER_SIZE
@@ -158,7 +158,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
self.vm_dut.send_expect(
"set_cpu_freq %d down" % vcpu, "vmpower\(guest\)>")
cur_freq = self.get_cpu_frequency(self.vcpu_map[vcpu])
- print dts.GREEN("After freqency down, freq is %d\n" % cur_freq)
+ print utils.GREEN("After freqency down, freq is %d\n" % cur_freq)
self.verify(
ori_freq > cur_freq, "Cpu freqenecy can not scale down")
ori_freq = cur_freq
@@ -187,7 +187,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
self.vm_dut.send_expect(
"set_cpu_freq %d up" % vcpu, "vmpower\(guest\)>")
cur_freq = self.get_cpu_frequency(self.vcpu_map[vcpu])
- print dts.GREEN("After freqency up, freq is %d\n" % cur_freq)
+ print utils.GREEN("After freqency up, freq is %d\n" % cur_freq)
self.verify(
cur_freq > ori_freq, "Cpu freqenecy can not scale up")
ori_freq = cur_freq
@@ -216,7 +216,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
max_freq = int(out)
self.verify(freq == max_freq, "Cpu max frequency not correct")
- print dts.GREEN("After freqency max, freq is %d\n" % max_freq)
+ print utils.GREEN("After freqency max, freq is %d\n" % max_freq)
self.vm_dut.send_expect("quit", "# ")
def test_vm_power_managment_freqmin(self):
@@ -241,7 +241,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
min_freq = int(out)
self.verify(freq == min_freq, "Cpu min frequency not correct")
- print dts.GREEN("After freqency min, freq is %d\n" % min_freq)
+ print utils.GREEN("After freqency min, freq is %d\n" % min_freq)
self.vm_dut.send_expect("quit", "# ")
def test_vm_power_multivms(self):
@@ -281,7 +281,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
# check host core has correct mapped
cpu_idx = 0
for cpu in cpus:
- mask = dts.create_mask([cpu])
+ mask = utils.create_mask([cpu])
cpu_map = '[%d]: Physical CPU Mask %s' % (cpu_idx, mask)
self.verify(cpu_map in vm_info, "Faile to map host cpu %s" % cpu)
cpu_idx += 1
@@ -305,7 +305,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
latency_header = ['Frame Size', 'Max latency', 'Min lantecy',
'Avg latency']
- dts.results_table_add_header(latency_header)
+ self.result_table_create(latency_header)
rx_port = self.dut_ports[0]
tx_port = self.dut_ports[1]
@@ -341,9 +341,9 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
print latency
table_row = [frame_size, latency['max'], latency['min'],
latency['average']]
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
self.vm_dut.kill_all()
@@ -353,7 +353,7 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
"""
latency_header = ['Tx linerate%', 'Rx linerate%', 'Cpu freq']
- dts.results_table_add_header(latency_header)
+ self.result_table_create(latency_header)
rx_port = self.dut_ports[0]
tx_port = self.dut_ports[1]
@@ -398,15 +398,15 @@ class TestVmPowerManager(TestCase, IxiaPacketGenerator):
wirespeed = self.wirespeed(self.nic, self.def_framesize, 1)
pct = pps * 100 / wirespeed
table_row = [rate, pct, freq]
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
self.vm_dut.kill_all()
def get_freq_in_transmission(self):
self.cur_freq = self.get_cpu_frequency(self.vcpu_map[1])
- print dts.GREEN("Current cpu frequency %d" % self.cur_freq)
+ print utils.GREEN("Current cpu frequency %d" % self.cur_freq)
def get_max_freq(self, core_num):
freq_path = "cat /sys/devices/system/cpu/cpu%d/cpufreq/" + \
diff --git a/tests/TestSuite_vmdq.py b/tests/TestSuite_vmdq.py
index 8c5fa57..10cb8e6 100644
--- a/tests/TestSuite_vmdq.py
+++ b/tests/TestSuite_vmdq.py
@@ -7,7 +7,7 @@ Tests for vmdq.
"""
-import dts
+import utils
import re
from etgen import IxiaPacketGenerator
from test_case import TestCase
@@ -62,7 +62,7 @@ class TestVmdq(TestCase, IxiaPacketGenerator):
minimum = 1000000
maximun = 0
- # Need to use Python re package because dts.regexp only handles 1 group,
+ # Need to use Python re package because utils.regexp only handles 1 group,
# we need 4.
scanner = re.compile(
"^Pool [0-9]+: ([0-9]+) ([0-9]+) ([0-9]+) ([0-9]+)$")
@@ -91,9 +91,9 @@ class TestVmdq(TestCase, IxiaPacketGenerator):
self.dut_ports = self.dut.get_ports(self.nic)
core_list = self.dut.get_core_list("1S/4C/1T", socket=self.ports_socket)
- core_mask = dts.create_mask(core_list)
+ core_mask = utils.create_mask(core_list)
- port_mask = dts.create_mask([self.dut_ports[0], self.dut_ports[1]])
+ port_mask = utils.create_mask([self.dut_ports[0], self.dut_ports[1]])
# Run the application
out = self.dut.send_expect("./examples/vmdq/build/vmdq_app -n 4 -c %s -- -p %s --nb-pools %s&" %
(core_mask, port_mask, str(npools)), "reading queues", 120)
@@ -153,13 +153,13 @@ class TestVmdq(TestCase, IxiaPacketGenerator):
frame_sizes = [64, 128, 256, 512, 1024, 1280, 1518]
for config in self.core_configs:
- print dts.BLUE(config["cores"])
+ print utils.BLUE(config["cores"])
self.dut.kill_all()
core_config = config['cores']
core_list = self.dut.get_core_list(core_config,socket=self.ports_socket)
- core_mask = dts.create_mask(core_list)
- portmask = dts.create_mask(self.dut.get_ports())
+ core_mask = utils.create_mask(core_list)
+ portmask = utils.create_mask(self.dut.get_ports())
if self.nic in ("niantic", "springfountain"):
self.queues = 64
self.dut.send_expect(
@@ -184,14 +184,14 @@ class TestVmdq(TestCase, IxiaPacketGenerator):
tx_port = self.tester.get_local_port(self.dut_ports[0])
rx_port = self.tester.get_local_port(self.dut_ports[1])
- print dts.GREEN("Waiting for application to initialize")
+ print utils.GREEN("Waiting for application to initialize")
sleep(5)
for frame_size in frame_sizes:
TestVmdq.current_frame_size = frame_size
- print dts.BLUE(str(frame_size))
+ print utils.BLUE(str(frame_size))
self.tester.scapy_append('dstmac="%s"' % self.destmac_port0)
tx_mac = self.tester.get_mac(tx_port)
@@ -226,14 +226,14 @@ class TestVmdq(TestCase, IxiaPacketGenerator):
self.core_configs[n]['mpps'][size] is not 0, "No traffic detected")
# Print results
- dts.results_table_add_header(
+ self.result_table_create(
['Frame size'] + [n['cores'] for n in self.core_configs])
for size in frame_sizes:
- dts.results_table_add_row(
+ self.result_table_add(
[size] + [n['mpps'][size] for n in self.core_configs])
- dts.results_table_print()
+ self.result_table_print()
# Override etgen.dot1q function
def dot1q(self, port, prio, id, vlan, type):
diff --git a/tests/TestSuite_vxlan.py b/tests/TestSuite_vxlan.py
index c1d0200..a334761 100644
--- a/tests/TestSuite_vxlan.py
+++ b/tests/TestSuite_vxlan.py
@@ -5,7 +5,7 @@ Test VXLAN behaviour in DPDK.
"""
-import dts
+import utils
import string
import re
import time
@@ -271,14 +271,14 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
global valports
valports = [_ for _ in ports if self.tester.get_local_port(_) != -1]
- self.portMask = dts.create_mask(valports[:2])
+ self.portMask = utils.create_mask(valports[:2])
# Verify that enough threads are available
netdev = self.dut.ports_info[ports[0]]['port']
self.ports_socket = netdev.socket
cores = self.dut.get_core_list("1S/5C/1T", socket=self.ports_socket)
self.verify(cores is not None, "Insufficient cores for speed testing")
- self.coremask = dts.create_mask(cores)
+ self.coremask = utils.create_mask(cores)
# start testpmd
self.pmdout = PmdOutput(self.dut)
@@ -837,7 +837,7 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
recv_queue = perf_config['recvqueue']
# there's known bug that if enable vxlan, rss will be disabled
if tun_filter == "None" and recv_queue == 'Multi':
- print dts.RED("RSS and Tunel filter can't enable in the same time")
+ print utils.RED("RSS and Tunel filter can't enable in the same time")
else:
self.enable_vxlan(dut_port)
@@ -913,11 +913,11 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
wrpcap(dest_pcap, pkts)
def test_perf_vxlan_tunnelfilter_performance_2ports(self):
- dts.results_table_add_header(self.tunnel_header)
+ self.result_table_create(self.tunnel_header)
core_list = self.dut.get_core_list(
'1S/%dC/1T' % (self.tunnel_multiqueue * 2 + 1),
socket=self.ports_socket)
- core_mask = dts.create_mask(core_list)
+ core_mask = utils.create_mask(core_list)
pmd_temp = "./%(TARGET)s/app/testpmd -c %(COREMASK)s -n " + \
"%(CHANNEL)d -- -i --disable-rss --rxq=2 --txq=2" + \
@@ -926,7 +926,7 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
for perf_config in self.tunnel_perf:
tun_filter = perf_config['tunnel_filter']
recv_queue = perf_config['recvqueue']
- print dts.GREEN("Measure tunnel performance of [%s %s %s]"
+ print utils.GREEN("Measure tunnel performance of [%s %s %s]"
% (perf_config['Packet'], tun_filter, recv_queue))
if tun_filter == "None" and recv_queue == "Multi":
@@ -991,12 +991,12 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
table_row = [perf_config['Packet'], tun_filter, recv_queue,
perf_config['Mpps'], perf_config['pct']]
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def test_perf_vxlan_checksum_performance_2ports(self):
- dts.results_table_add_header(self.chksum_header)
+ self.result_table_create(self.chksum_header)
vxlan = VxlanTestConfig(self, payload_size=self.vxlan_payload)
vxlan.outer_mac_dst = self.dut.get_mac_address(self.dut_port)
vxlan.pcap_file = "vxlan1.pcap"
@@ -1013,13 +1013,13 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
core_list = self.dut.get_core_list(
'1S/%dC/1T' % (self.tunnel_multiqueue * 2 + 1),
socket=self.ports_socket)
- core_mask = dts.create_mask(core_list)
+ core_mask = utils.create_mask(core_list)
tgen_dut = self.tester.get_local_port(self.dut_port)
tgen_tester = self.tester.get_local_port(self.recv_port)
for cal in self.cal_type:
recv_queue = cal['recvqueue']
- print dts.GREEN("Measure checksum performance of [%s %s %s]"
+ print utils.GREEN("Measure checksum performance of [%s %s %s]"
% (cal['Type'], recv_queue, cal['csum']))
# configure flows
@@ -1091,9 +1091,9 @@ class TestVxlan(TestCase, IxiaPacketGenerator):
"Queue %d no traffic" % queue)
table_row = [cal['Type'], recv_queue, cal['Mpps'], cal['pct']]
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
- dts.results_table_print()
+ self.result_table_print()
def enable_vxlan(self, port):
self.dut.send_expect("rx_vxlan_port add %d %d"
diff --git a/tests/TestSuite_vxlan_sample.py b/tests/TestSuite_vxlan_sample.py
index 189bc38..1dbb727 100644
--- a/tests/TestSuite_vxlan_sample.py
+++ b/tests/TestSuite_vxlan_sample.py
@@ -36,7 +36,7 @@ Vxlan sample test suite.
"""
import os
-import dts
+import utils
import string
import re
import time
@@ -154,7 +154,7 @@ class TestVxlanSample(TestCase):
Run before each test case.
"""
# create coremask
- self.coremask = dts.create_mask(self.cores)
+ self.coremask = utils.create_mask(self.cores)
if "2VM" not in self.running_case:
vm_num = 1
@@ -220,7 +220,7 @@ class TestVxlanSample(TestCase):
if self.vm_dut is None:
raise Exception("Set up VM ENV failed!")
except Exception as e:
- print dts.RED("Failure for %s" % str(e))
+ print utils.RED("Failure for %s" % str(e))
# create another vm
if vm_num == 2:
@@ -331,10 +331,10 @@ class TestVxlanSample(TestCase):
self.verify(ord(payload[i]) == 88, "Check udp data failed")
except:
case_pass = False
- print dts.RED("Failure in checking packet payload")
+ print utils.RED("Failure in checking packet payload")
if case_pass:
- print dts.GREEN("Check normal udp packet forward pass on "
+ print utils.GREEN("Check normal udp packet forward pass on "
"virtIO port %d" % vf_id)
if pkt_type == "vxlan_udp_decap":
@@ -353,7 +353,7 @@ class TestVxlanSample(TestCase):
vxlan_pkt.send_pcap(tester_iface)
time.sleep(5)
- # transfer capture pcap to dts server
+ # transfer capture pcap to server
pkts = self.transfer_capture_file()
# check packet number and payload
self.verify(len(pkts) >= 1, "Failed to capture packets")
@@ -366,10 +366,10 @@ class TestVxlanSample(TestCase):
self.verify(ord(payload[i]) == 88, "Check udp data failed")
except:
case_pass = False
- print dts.RED("Failure in checking packet payload")
+ print utils.RED("Failure in checking packet payload")
if case_pass:
- print dts.GREEN("Check vxlan packet decap pass on virtIO port"
+ print utils.GREEN("Check vxlan packet decap pass on virtIO port"
" %d" % vf_id)
if pkt_type == "vxlan_udp":
@@ -388,7 +388,7 @@ class TestVxlanSample(TestCase):
vxlan_pkt.send_pcap(tester_iface)
time.sleep(5)
- # transfer capture pcap to dts server
+ # transfer capture pcap to server
pkts = self.transfer_capture_file()
# check packet number and payload
self.verify(len(pkts) >= 1, "Failed to capture packets")
@@ -400,10 +400,10 @@ class TestVxlanSample(TestCase):
self.verify(ord(payload[i]) == 88, "Check udp data failed")
except:
case_pass = False
- print dts.RED("Failure in checking packet payload")
+ print utils.RED("Failure in checking packet payload")
if case_pass:
- print dts.GREEN("Check vxlan packet decap and encap pass on "
+ print utils.GREEN("Check vxlan packet decap and encap pass on "
"virtIO port %d" % vf_id)
if pkt_type == "vxlan_udp_chksum":
@@ -423,7 +423,7 @@ class TestVxlanSample(TestCase):
vxlan_pkt = VxlanTestConfig(self, **params)
vxlan_pkt.create_pcap()
chksums_ref = vxlan_pkt.get_chksums()
- print dts.GREEN("Checksum reference: %s" % chksums_ref)
+ print utils.GREEN("Checksum reference: %s" % chksums_ref)
params['inner_ip_invalid'] = 1
params['inner_l4_invalid'] = 1
@@ -436,21 +436,21 @@ class TestVxlanSample(TestCase):
self.start_capture(tester_iface, pkt_smac=self.pf_mac)
vxlan_pkt.send_pcap(tester_iface)
time.sleep(5)
- # transfer capture pcap to dts server
+ # transfer capture pcap to server
pkts = self.transfer_capture_file()
# check packet number and payload
self.verify(len(pkts) >= 1, "Failed to capture packets")
self.verify(pkts[0].haslayer(Vxlan) == 1,
"Packet not encapsulated")
chksums = vxlan_pkt.get_chksums(pcap='vxlan_cap.pcap')
- print dts.GREEN("Checksum : %s" % chksums)
+ print utils.GREEN("Checksum : %s" % chksums)
for key in chksums_ref:
if 'inner' in key: # only check inner packet chksum
self.verify(chksums[key] == chksums_ref[key],
"%s not matched to %s"
% (key, chksums_ref[key]))
- print dts.GREEN("%s checksum pass" % params['inner_l4_type'])
+ print utils.GREEN("%s checksum pass" % params['inner_l4_type'])
if pkt_type == "vxlan_tcp_tso":
# create vxlan packet pf mac + vni=1000 + inner virtIO port0 mac +
@@ -470,7 +470,7 @@ class TestVxlanSample(TestCase):
vxlan_pkt.send_pcap(tester_iface)
time.sleep(5)
- # transfer capture pcap to dts server
+ # transfer capture pcap to server
pkts = self.transfer_capture_file()
# check packet number and payload
self.verify(len(pkts) == 4, "Failed to capture tso packets")
@@ -485,11 +485,11 @@ class TestVxlanSample(TestCase):
length += len(payload)
except:
case_pass = False
- print dts.RED("Failure in checking tso payload")
+ print utils.RED("Failure in checking tso payload")
self.verify(length == 892, "Total tcp payload size not match")
if case_pass:
- print dts.GREEN("Vxlan packet tso pass on virtIO port %d"
+ print utils.GREEN("Vxlan packet tso pass on virtIO port %d"
% vf_id)
def test_perf_vxlan_sample(self):
@@ -501,7 +501,7 @@ class TestVxlanSample(TestCase):
HEADER_SIZE['ip'] - HEADER_SIZE['udp'] + 4
vxlansample_header = ['Type', 'Queue', 'Mpps', '% linerate']
- dts.results_table_add_header(vxlansample_header)
+ self.result_table_create(vxlansample_header)
for perf_cfg in self.perf_cfg:
func = perf_cfg['Func']
if func is 'Decap':
@@ -592,11 +592,11 @@ class TestVxlanSample(TestCase):
table_row = [perf_cfg['Func'], perf_cfg['VirtIO'],
perf_cfg['Mpps'], perf_cfg['pct']]
- dts.results_table_add_row(table_row)
+ self.result_table_add(table_row)
self.tear_down()
- dts.results_table_print()
+ self.result_table_print()
def combine_pcap(self, dest_pcap, src_pcap):
pkts = rdpcap(dest_pcap)
--
1.9.3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dts] [PATCH 0/9] optimize overall execution process
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
` (8 preceding siblings ...)
2016-08-04 5:38 ` [dts] [PATCH 9/9] tests: remove dependencies of " Marvin Liu
@ 2016-08-04 6:07 ` Liu, Yong
9 siblings, 0 replies; 11+ messages in thread
From: Liu, Yong @ 2016-08-04 6:07 UTC (permalink / raw)
To: dts
This patch set is so huge, merged into next branch. Wait for regression
team's report.
On 08/04/2016 01:38 PM, Marvin Liu wrote:
> This patch set will try to decouple of each module in DTS. Most of cases
> execution logic will be handled in test_case module. Add support for global
> settings.
>
> Marvin Liu (9):
> framework dts: optimize execution process
> framework config: add concept for dut board
> framework dut: remove dependency on dts module
> framework rst: add class to handle RST report
> framework settings: support global setting load and save
> framework test_result: add class to handle result
> framework test_case: add test case handle logic
> framework utils: move shared function from dts module
> tests: remove dependencies of dts module
>
> framework/config.py | 4 +-
> framework/crb.py | 1 -
> framework/debugger.py | 16 +-
> framework/dts.py | 599 +++++----------------
> framework/dut.py | 40 +-
> framework/etgen.py | 20 +-
> framework/plotting.py | 9 +-
> framework/pmd_output.py | 4 +-
> framework/project_dpdk.py | 48 +-
> framework/qemu_libvirt.py | 8 +-
> framework/rst.py | 200 +++----
> framework/settings.py | 92 +++-
> framework/test_case.py | 258 ++++++++-
> framework/test_result.py | 63 ++-
> framework/tester.py | 4 +-
> framework/utils.py | 30 ++
> framework/virt_base.py | 16 +-
> framework/virt_dut.py | 8 +-
> framework/virt_scene.py | 29 +-
> tests/TestSuite_blacklist.py | 6 +-
> tests/TestSuite_checksum_offload.py | 12 +-
> tests/TestSuite_cloud_filter.py | 1 -
> tests/TestSuite_cmdline.py | 5 +-
> tests/TestSuite_coremask.py | 8 +-
> tests/TestSuite_dual_vlan.py | 6 +-
> tests/TestSuite_dynamic_config.py | 40 +-
> tests/TestSuite_fdir.py | 52 +-
> tests/TestSuite_fm10k_perf.py | 38 +-
> .../TestSuite_fortville_rss_granularity_config.py | 116 ++--
> tests/TestSuite_generic_filter.py | 12 +-
> tests/TestSuite_hello_world.py | 6 +-
> tests/TestSuite_ieee1588.py | 4 +-
> tests/TestSuite_ip_pipeline.py | 8 +-
> tests/TestSuite_ipfrag.py | 22 +-
> tests/TestSuite_ipv4_reassembly.py | 6 +-
> tests/TestSuite_jumboframes.py | 8 +-
> tests/TestSuite_kni.py | 50 +-
> tests/TestSuite_l2fwd.py | 25 +-
> tests/TestSuite_l3fwd.py | 61 ++-
> tests/TestSuite_l3fwd_em.py | 16 +-
> tests/TestSuite_link_flowctrl.py | 4 +-
> tests/TestSuite_link_status_interrupt.py | 22 +-
> tests/TestSuite_mac_filter.py | 18 +-
> tests/TestSuite_multiprocess.py | 26 +-
> tests/TestSuite_netmap_compat.py | 4 +-
> tests/TestSuite_nvgre.py | 26 +-
> tests/TestSuite_pmd.py | 38 +-
> tests/TestSuite_pmd_bonded.py | 10 +-
> tests/TestSuite_pmdpcap.py | 6 +-
> tests/TestSuite_pmdrss_hash.py | 14 +-
> tests/TestSuite_pmdrssreta.py | 12 +-
> tests/TestSuite_queue_start_stop.py | 1 -
> tests/TestSuite_quota_watermark.py | 22 +-
> tests/TestSuite_rxtx_callbacks.py | 4 +-
> tests/TestSuite_scatter.py | 1 -
> tests/TestSuite_short_live.py | 1 -
> tests/TestSuite_shutdown_api.py | 37 +-
> tests/TestSuite_skeleton.py | 4 +-
> tests/TestSuite_sriov_kvm.py | 1 -
> tests/TestSuite_sriov_live_migration.py | 6 +-
> tests/TestSuite_timer.py | 6 +-
> tests/TestSuite_tso.py | 24 +-
> tests/TestSuite_uni_pkt.py | 8 +-
> tests/TestSuite_unit_tests_eal.py | 4 +-
> tests/TestSuite_unit_tests_pmd_perf.py | 8 +-
> tests/TestSuite_userspace_ethtool.py | 8 +-
> tests/TestSuite_vf_jumboframe.py | 4 +-
> tests/TestSuite_vf_macfilter.py | 1 -
> tests/TestSuite_vf_offload.py | 6 +-
> tests/TestSuite_vf_packet_rxtx.py | 1 -
> tests/TestSuite_vf_port_start_stop.py | 1 -
> tests/TestSuite_vf_rss.py | 7 +-
> tests/TestSuite_vf_to_vf_nic_bridge.py | 10 +-
> tests/TestSuite_vf_vlan.py | 1 -
> tests/TestSuite_vhost_cuse_one_copy_one_vm.py | 14 +-
> tests/TestSuite_vhost_user_live_migration.py | 1 -
> tests/TestSuite_vhost_user_one_copy_one_vm.py | 14 +-
> tests/TestSuite_virtio_iperf.py | 24 +-
> tests/TestSuite_vlan.py | 8 +-
> tests/TestSuite_vm_power_manager.py | 26 +-
> tests/TestSuite_vmdq.py | 24 +-
> tests/TestSuite_vxlan.py | 28 +-
> tests/TestSuite_vxlan_sample.py | 42 +-
> 83 files changed, 1261 insertions(+), 1217 deletions(-)
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-08-04 6:04 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04 5:38 [dts] [PATCH 0/9] optimize overall execution process Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 1/9] framework dts: optimize " Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 2/9] framework config: add concept for dut board Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 3/9] framework dut: remove dependency on dts module Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 4/9] framework rst: add class to handle RST report Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 5/9] framework settings: support global setting load and save Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 6/9] framework test_result: add class to handle result Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 7/9] framework test_case: add test case handle logic Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 8/9] framework utils: move shared function from dts module Marvin Liu
2016-08-04 5:38 ` [dts] [PATCH 9/9] tests: remove dependencies of " Marvin Liu
2016-08-04 6:07 ` [dts] [PATCH 0/9] optimize overall execution process Liu, Yong
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).