summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/README1
-rw-r--r--tools/README.md6
-rw-r--r--tools/collectors/sysmetrics/pidstat.py4
-rw-r--r--tools/functions.py9
-rw-r--r--tools/hugepages.py58
-rw-r--r--tools/load_gen/dummy/dummy.py5
-rw-r--r--tools/module_manager.py5
-rw-r--r--tools/networkcard.py3
-rw-r--r--tools/opnfvdashboard/opnfvdashboard.py14
-rw-r--r--tools/pkt_fwd/pkt_fwd.py3
-rw-r--r--tools/pkt_fwd/testpmd.py12
-rwxr-xr-xtools/pkt_gen/dummy/dummy.py28
-rwxr-xr-xtools/pkt_gen/ixia/ixia.py34
-rwxr-xr-xtools/pkt_gen/ixnet/ixnet.py12
-rw-r--r--tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py93
-rw-r--r--tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py127
-rw-r--r--tools/pkt_gen/testcenter/testcenter.py218
-rw-r--r--tools/pkt_gen/xena/XenaDriver.py21
-rwxr-xr-xtools/pkt_gen/xena/xena.py8
-rw-r--r--tools/pkt_gen/xena/xena_json.py8
-rw-r--r--tools/report/report.jinja5
-rw-r--r--tools/report/report.py5
-rw-r--r--tools/report/report_foot.rst3
-rw-r--r--tools/report/report_rst.jinja9
-rw-r--r--tools/systeminfo.py7
-rw-r--r--tools/tasks.py6
26 files changed, 478 insertions, 226 deletions
diff --git a/tools/README b/tools/README
deleted file mode 100644
index a10c2bb3..00000000
--- a/tools/README
+++ /dev/null
@@ -1 +0,0 @@
-This folder contains various tool sets for vswitch performance
diff --git a/tools/README.md b/tools/README.md
new file mode 100644
index 00000000..dc00eac8
--- /dev/null
+++ b/tools/README.md
@@ -0,0 +1,6 @@
+<!---
+This work is licensed under a Creative Commons Attribution 4.0 International License.
+http://creativecommons.org/licenses/by/4.0
+-->
+
+This folder contains various tool sets for vswitch performance
diff --git a/tools/collectors/sysmetrics/pidstat.py b/tools/collectors/sysmetrics/pidstat.py
index 5106697e..99341ccf 100644
--- a/tools/collectors/sysmetrics/pidstat.py
+++ b/tools/collectors/sysmetrics/pidstat.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -42,8 +42,8 @@ import time
from collections import OrderedDict
from tools import tasks
from tools import systeminfo
-from conf import settings
from tools.collectors.collector import collector
+from conf import settings
_ROOT_DIR = os.path.dirname(os.path.realpath(__file__))
diff --git a/tools/functions.py b/tools/functions.py
index 3bd8cc4d..d00200d9 100644
--- a/tools/functions.py
+++ b/tools/functions.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Intel Corporation.
+# Copyright 2016-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ from conf import settings as S
#
# Support functions
#
-
+# pylint: disable=too-many-branches
def settings_update_paths():
""" Configure paths to OVS, DPDK and QEMU sources and binaries based on
selected vswitch type and src/binary switch. Data are taken from
@@ -74,6 +74,7 @@ def settings_update_paths():
paths['paths']['ovs_etc_tmp'] = S.getValue('PATHS')['vswitch']['ovs_etc_tmp']
tools = {}
+ # pylint: disable=too-many-nested-blocks
for path_class in paths:
for tool in paths[path_class]:
tmp_tool = paths[path_class][tool]
@@ -123,8 +124,8 @@ def settings_update_paths():
tmp_tool = tmp_glob[0]
elif not os.path.exists(tmp_tool):
if tool.endswith('_tmp'):
- logging.getLogger().debug('Temporary path to the {} does not '
- 'exist: {}.'.format(tool, tmp_tool))
+ logging.getLogger().debug('Temporary path to the %s does not '
+ 'exist: %s', tool, tmp_tool)
else:
raise RuntimeError('Path to the {} is not valid: {}'.format(tool, tmp_tool))
diff --git a/tools/hugepages.py b/tools/hugepages.py
index d233f04d..4c91e7d2 100644
--- a/tools/hugepages.py
+++ b/tools/hugepages.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@ from tools import tasks
from conf import settings
_LOGGER = logging.getLogger(__name__)
-_allocated_hugepages = False
+_ALLOCATED_HUGEPAGES = False
#
# hugepage management
#
@@ -37,16 +37,15 @@ def get_hugepage_size():
"""
hugepage_size_re = re.compile(r'^Hugepagesize:\s+(?P<size_hp>\d+)\s+kB',
re.IGNORECASE)
- with open('/proc/meminfo', 'r') as fh:
- data = fh.readlines()
+ with open('/proc/meminfo', 'r') as result_file:
+ data = result_file.readlines()
for line in data:
match = hugepage_size_re.search(line)
if match:
_LOGGER.info('Hugepages size: %s kb', match.group('size_hp'))
return int(match.group('size_hp'))
- else:
- _LOGGER.error('Could not parse for hugepage size')
- return 0
+ _LOGGER.error('Could not parse for hugepage size')
+ return 0
def allocate_hugepages():
@@ -54,19 +53,20 @@ def allocate_hugepages():
"""
hp_size = get_hugepage_size()
if hp_size > 0:
- nr_hp = int(math.ceil(settings.getValue('HUGEPAGE_RAM_ALLOCATION')/hp_size))
- _LOGGER.info('Will allocate %s hugepages.', nr_hp)
-
- nr_hugepages = 'vm.nr_hugepages=' + str(nr_hp)
- try:
- tasks.run_task(['sudo', 'sysctl', nr_hugepages],
- _LOGGER, 'Trying to allocate hugepages..', True)
- except subprocess.CalledProcessError:
- _LOGGER.error('Unable to allocate hugepages.')
- return False
- global _allocated_hugepages
- _allocated_hugepages = True
- return True
+ nr_hp = int(math.ceil(settings.getValue('HUGEPAGE_RAM_ALLOCATION')/hp_size))
+ _LOGGER.info('Will allocate %s hugepages.', nr_hp)
+
+ nr_hugepages = 'vm.nr_hugepages=' + str(nr_hp)
+ try:
+ tasks.run_task(['sudo', 'sysctl', nr_hugepages],
+ _LOGGER, 'Trying to allocate hugepages..', True)
+ except subprocess.CalledProcessError:
+ _LOGGER.error('Unable to allocate hugepages.')
+ return False
+ # pylint: disable=global-statement
+ global _ALLOCATED_HUGEPAGES
+ _ALLOCATED_HUGEPAGES = True
+ return True
else:
_LOGGER.error('Division by 0 will be supported in next release')
@@ -75,8 +75,9 @@ def allocate_hugepages():
def deallocate_hugepages():
"""De-allocate hugepages that were allocated on the fly
"""
- global _allocated_hugepages
- if _allocated_hugepages:
+ # pylint: disable=global-statement
+ global _ALLOCATED_HUGEPAGES
+ if _ALLOCATED_HUGEPAGES:
nr_hugepages = 'vm.nr_hugepages= 0'
try:
tasks.run_task(['sudo', 'sysctl', nr_hugepages],
@@ -84,7 +85,7 @@ def deallocate_hugepages():
except subprocess.CalledProcessError:
_LOGGER.error('Unable to de-allocate hugepages.')
return False
- _allocated_hugepages = False
+ _ALLOCATED_HUGEPAGES = False
return True
@@ -102,22 +103,21 @@ def get_free_hugepages(socket=None):
meminfo_path = '/sys/devices/system/node/node{}/meminfo'.format(
socket)
else:
- _LOGGER.info('No hugepage info found for socket {}'.format(socket))
+ _LOGGER.info('No hugepage info found for socket %s', socket)
return 0
else:
meminfo_path = '/proc/meminfo'
- with open(meminfo_path, 'r') as fh:
- data = fh.readlines()
+ with open(meminfo_path, 'r') as result_file:
+ data = result_file.readlines()
for line in data:
match = hugepage_free_re.search(line)
if match:
_LOGGER.info('Hugepages free: %s %s', match.group('free_hp'),
'on socket {}'.format(socket) if socket else '')
return int(match.group('free_hp'))
- else:
- _LOGGER.info('Could not parse for hugepage size')
- return 0
+ _LOGGER.info('Could not parse for hugepage size')
+ return 0
def is_hugepage_available():
diff --git a/tools/load_gen/dummy/dummy.py b/tools/load_gen/dummy/dummy.py
index 1ad6c3fd..91bef4fa 100644
--- a/tools/load_gen/dummy/dummy.py
+++ b/tools/load_gen/dummy/dummy.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -16,6 +16,7 @@
from tools.load_gen.load_gen import ILoadGenerator
+# pylint: disable=super-init-not-called
class DummyLoadGen(ILoadGenerator):
"""Dummy load generator, which doesn't generate any load"""
def __init__(self, stress_config):
@@ -26,6 +27,6 @@ class DummyLoadGen(ILoadGenerator):
"""Start stress load if it was requested"""
pass
- def kill(self, signal='-15', sleep=2):
+ def kill(self, dummy_signal='-15', dummy_sleep=2):
"""Kill stress load if it is active"""
pass
diff --git a/tools/module_manager.py b/tools/module_manager.py
index 911f7252..dd1d92be 100644
--- a/tools/module_manager.py
+++ b/tools/module_manager.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -143,8 +143,7 @@ class ModuleManager(object):
return None
- @staticmethod
- def get_module_dependecies(module):
+ def get_module_dependecies(self, module):
"""Return list of modules, which must be loaded before module itself
:param module: a name of kernel module
diff --git a/tools/networkcard.py b/tools/networkcard.py
index 945534be..2cd296fb 100644
--- a/tools/networkcard.py
+++ b/tools/networkcard.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Intel Corporation.
+# Copyright 2016-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -263,4 +263,3 @@ def reinit_vfs(pf_pci_handle):
_LOGGER.warning('Error during reinitialization of VF %s', vf_nic)
else:
_LOGGER.warning("Can't detect driver for VF %s", vf_nic)
-
diff --git a/tools/opnfvdashboard/opnfvdashboard.py b/tools/opnfvdashboard/opnfvdashboard.py
index 6f53526d..3f465c04 100644
--- a/tools/opnfvdashboard/opnfvdashboard.py
+++ b/tools/opnfvdashboard/opnfvdashboard.py
@@ -1,7 +1,7 @@
"""
vsperf2dashboard
"""
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,12 +15,10 @@ vsperf2dashboard
# See the License for the specific language governing permissions and
# limitations under the License.
-
import os
import csv
-import requests
-import json
import logging
+import requests
def results2opnfv_dashboard(results_path, int_data):
"""
@@ -66,7 +64,7 @@ def _push_results(reader, int_data):
version_ovs = line.replace(' ', '')
version_ovs = version_ovs.replace('OVS_TAG?=', '')
if "DPDK_TAG" in line:
- if int_data['vanilla'] == False:
+ if int_data['vanilla'] is False:
version_dpdk = line.replace(' ', '')
version_dpdk = version_dpdk.replace('DPDK_TAG?=', '')
else:
@@ -81,8 +79,8 @@ def _push_results(reader, int_data):
"version": version,
"details": details}
- myData = requests.post(url, json=body)
- logging.info("Results for %s sent to opnfv, http response: %s", casename, myData)
+ my_data = requests.post(url, json=body)
+ logging.info("Results for %s sent to opnfv, http response: %s", casename, my_data)
logging.debug("opnfv url: %s", db_url)
logging.debug("the body sent to opnfv")
logging.debug(body)
@@ -111,7 +109,7 @@ def _generate_test_name(testcase, int_data):
for name, name_list in names.items():
if name != testcase:
continue
- if vanilla == True:
+ if vanilla is True:
res_name = name_list[1]
else:
res_name = name_list[0]
diff --git a/tools/pkt_fwd/pkt_fwd.py b/tools/pkt_fwd/pkt_fwd.py
index a080b5a2..b0423b7b 100644
--- a/tools/pkt_fwd/pkt_fwd.py
+++ b/tools/pkt_fwd/pkt_fwd.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Intel Corporation.
+# Copyright 2016-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -56,4 +56,3 @@ class IPktFwd(object):
:returns: None
"""
raise NotImplementedError('Please call an implementation.')
-
diff --git a/tools/pkt_fwd/testpmd.py b/tools/pkt_fwd/testpmd.py
index 30e80386..970259dc 100644
--- a/tools/pkt_fwd/testpmd.py
+++ b/tools/pkt_fwd/testpmd.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Intel Corporation.
+# Copyright 2016-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -41,6 +41,14 @@ class TestPMD(IPktFwd):
def __init__(self, guest=False):
vswitchd_args = settings.getValue('VSWITCHD_DPDK_ARGS')
+
+ # override socket-mem settings
+ for tmp_arg in vswitchd_args:
+ if tmp_arg.startswith('--socket-mem'):
+ vswitchd_args.remove(tmp_arg)
+ vswitchd_args += ['--socket-mem ' +
+ ','.join(settings.getValue('DPDK_SOCKET_MEM'))]
+
if guest:
vswitchd_args += _TESTPMD_PVP_CONST_ARGS
vswitchd_args += _VSWITCHD_CONST_ARGS
@@ -100,5 +108,3 @@ class TestPMD(IPktFwd):
except pexpect.EOF:
pass
dpdk.cleanup()
-
-
diff --git a/tools/pkt_gen/dummy/dummy.py b/tools/pkt_gen/dummy/dummy.py
index 7a4daab6..3dc5448e 100755
--- a/tools/pkt_gen/dummy/dummy.py
+++ b/tools/pkt_gen/dummy/dummy.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -59,7 +59,6 @@ def _get_user_traffic_stat(stat_type):
else:
print('Please respond with \'yes\' or \'no\' ', end='')
-
def get_user_traffic(traffic_type, traffic_conf, flow_conf, traffic_stats):
"""
Request user input for traffic.
@@ -229,15 +228,36 @@ class Dummy(trafficgen.ITrafficGenerator):
traffic_,
('b2b frames', 'b2b frame loss %'))
- framesize = traffic_['l2']['framesize']
-
# builds results by using user-supplied values
# and guessing remainder using available info
result[ResultsConstants.B2B_FRAMES] = float(results[0])
result[ResultsConstants.B2B_FRAME_LOSS_PERCENT] = float(results[1])
return result
+ def start_cont_traffic(self, traffic=None, duration=20):
+ return NotImplementedError('Dummy does not implement start_cont_traffic')
+
+ def stop_cont_traffic(self):
+ return NotImplementedError(
+ 'Dummy does not implement stop_cont_traffic')
+
+ def start_rfc2544_back2back(self, traffic=None, tests=1, duration=20,
+ lossrate=0.0):
+ return NotImplementedError(
+ 'Dummy does not implement start_rfc2544_back2back')
+
+ def wait_rfc2544_back2back(self):
+ return NotImplementedError(
+ 'Dummy does not implement stop_cont_traffic')
+
+ def start_rfc2544_throughput(self, traffic=None, tests=1, duration=20,
+ lossrate=0.0):
+ return NotImplementedError(
+ 'Dummy does not implement start_rfc2544_throughput')
+ def wait_rfc2544_throughput(self):
+ return NotImplementedError(
+ 'Dummy does not implement wait_rfc2544_throughput')
if __name__ == '__main__':
TRAFFIC = {
diff --git a/tools/pkt_gen/ixia/ixia.py b/tools/pkt_gen/ixia/ixia.py
index ed947e70..13c1a9a7 100755
--- a/tools/pkt_gen/ixia/ixia.py
+++ b/tools/pkt_gen/ixia/ixia.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -33,7 +33,6 @@ This requires the following settings in your config file:
If any of these don't exist, the application will raise an exception
(EAFP).
"""
-
import tkinter
import logging
import os
@@ -106,9 +105,7 @@ def _build_set_cmds(values, prefix='dict set'):
for key in values:
value = values[key]
- # Not allowing derived dictionary types for now
- # pylint: disable=unidiomatic-typecheck
- if type(value) == dict:
+ if isinstance(value, dict):
_prefix = ' '.join([prefix, key]).strip()
for subkey in _build_set_cmds(value, _prefix):
yield subkey
@@ -116,7 +113,7 @@ def _build_set_cmds(values, prefix='dict set'):
# tcl doesn't recognise the strings "True" or "False", only "1"
# or "0". Special case to convert them
- if type(value) == bool:
+ if isinstance(value, bool):
value = str(int(value))
else:
value = str(value)
@@ -138,6 +135,29 @@ class Ixia(trafficgen.ITrafficGenerator):
_tclsh = tkinter.Tcl()
_logger = logging.getLogger(__name__)
+ def start_rfc2544_throughput(self, traffic=None, tests=1, duration=20,
+ lossrate=0.0):
+ return NotImplementedError(
+ 'Ixia start throughput traffic not implemented')
+
+ def wait_rfc2544_throughput(self):
+ return NotImplementedError(
+ 'Ixia wait throughput traffic not implemented')
+
+ def start_rfc2544_back2back(self, traffic=None, tests=1, duration=20,
+ lossrate=0.0):
+ return NotImplementedError(
+ 'Ixia start back2back traffic not implemented')
+
+ def send_rfc2544_back2back(self, traffic=None, duration=60,
+ lossrate=0.0, tests=1):
+ return NotImplementedError(
+ 'Ixia send back2back traffic not implemented')
+
+ def wait_rfc2544_back2back(self):
+ return NotImplementedError(
+ 'Ixia wait back2back traffic not implemented')
+
def run_tcl(self, cmd):
"""Run a TCL script using the TCL interpreter found in ``tkinter``.
@@ -228,7 +248,7 @@ class Ixia(trafficgen.ITrafficGenerator):
assert len(result) == 6 # fail-fast if underlying Tcl code changes
- #TODO - implement Burst results setting via TrafficgenResults.
+ #NOTE - implement Burst results setting via TrafficgenResults.
def send_cont_traffic(self, traffic=None, duration=30):
"""See ITrafficGenerator for description
diff --git a/tools/pkt_gen/ixnet/ixnet.py b/tools/pkt_gen/ixnet/ixnet.py
index f84ab668..9a763104 100755
--- a/tools/pkt_gen/ixnet/ixnet.py
+++ b/tools/pkt_gen/ixnet/ixnet.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -78,7 +78,6 @@ does not give any feedback as to the status of tests. As such, it can
be expected that the user have access to the IxNetwork machine should
this trafficgen need to be debugged.
"""
-
import tkinter
import logging
import os
@@ -122,18 +121,15 @@ def _build_set_cmds(values, prefix='dict set'):
for key in values:
value = values[key]
- # Not allowing derived dictionary types for now
- # pylint: disable=unidiomatic-typecheck
- if type(value) == dict:
+ if isinstance(value, dict):
_prefix = ' '.join([prefix, key]).strip()
for subkey in _build_set_cmds(value, _prefix):
yield subkey
continue
- # pylint: disable=unidiomatic-typecheck
# tcl doesn't recognise the strings "True" or "False", only "1"
# or "0". Special case to convert them
- if type(value) == bool:
+ if isinstance(value, bool):
value = str(int(value))
else:
value = str(value)
@@ -511,6 +507,8 @@ class IxNet(trafficgen.ITrafficGenerator):
return parse_ixnet_rfc_results(parse_result_string(output[0]))
+ def send_burst_traffic(self, traffic=None, numpkts=100, duration=20):
+ return NotImplementedError('IxNet does not implement send_burst_traffic')
if __name__ == '__main__':
TRAFFIC = {
diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py
index 8da8ed17..6c30b130 100644
--- a/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py
+++ b/tools/pkt_gen/testcenter/testcenter-rfc2544-rest.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Spirent Communications.
+# Copyright 2016-2017 Spirent Communications.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,7 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+#
+# Invalid name of file, must be used '_' instead '-'
+# pylint: disable=invalid-name
'''
@author Spirent Communications
@@ -22,10 +24,9 @@ TestCenter REST APIs. This test supports Python 3.4
import argparse
import logging
import os
-from conf import settings
-logger = logging.getLogger(__name__)
+_LOGGER = logging.getLogger(__name__)
def create_dir(path):
@@ -33,8 +34,8 @@ def create_dir(path):
if not os.path.exists(path):
try:
os.makedirs(path)
- except OSError as e:
- logger.error("Failed to create directory %s: %s", path, str(e))
+ except OSError as ex:
+ _LOGGER.error("Failed to create directory %s: %s", path, str(ex))
raise
@@ -43,11 +44,11 @@ def write_query_results_to_csv(results_path, csv_results_file_prefix,
""" Write the results of the query to the CSV """
create_dir(results_path)
filec = os.path.join(results_path, csv_results_file_prefix + ".csv")
- with open(filec, "wb") as f:
- f.write(query_results["Columns"].replace(" ", ",") + "\n")
+ with open(filec, "wb") as result_file:
+ result_file.write(query_results["Columns"].replace(" ", ",") + "\n")
for row in (query_results["Output"].replace("} {", ",").
replace("{", "").replace("}", "").split(",")):
- f.write(row.replace(" ", ",") + "\n")
+ result_file.write(row.replace(" ", ",") + "\n")
def positive_int(value):
@@ -67,7 +68,7 @@ def percent_float(value):
"%s not in range [0.0, 100.0]" % pvalue)
return pvalue
-
+# pylint: disable=too-many-branches, too-many-statements
def main():
""" Read the arguments, Invoke Test and Return the results"""
parser = argparse.ArgumentParser()
@@ -142,7 +143,7 @@ def main():
dest="test_user_name")
optional_named.add_argument("--results_dir",
required=False,
- default=settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
+ default="./Results",
help="The directory to copy results to",
dest="results_dir")
optional_named.add_argument("--csv_results_file_prefix",
@@ -278,12 +279,12 @@ def main():
args = parser.parse_args()
if args.verbose:
- logger.debug("Creating results directory")
+ _LOGGER.debug("Creating results directory")
create_dir(args.results_dir)
session_name = args.test_session_name
user_name = args.test_user_name
-
+ # pylint: disable=import-error
try:
# Load Spirent REST Library
from stcrestclient import stchttp
@@ -291,8 +292,8 @@ def main():
stc = stchttp.StcHttp(args.lab_server_addr)
session_id = stc.new_session(user_name, session_name)
stc.join_session(session_id)
- except RuntimeError as e:
- logger.error(e)
+ except RuntimeError as err:
+ _LOGGER.error(err)
raise
# Get STC system info.
@@ -305,43 +306,43 @@ def main():
# Retrieve and display the server information
if args.verbose:
- logger.debug("SpirentTestCenter system version: %s",
- stc.get("system1", "version"))
+ _LOGGER.debug("SpirentTestCenter system version: %s",
+ stc.get("system1", "version"))
try:
device_list = []
port_list = []
if args.verbose:
- logger.debug("Bring up license server")
+ _LOGGER.debug("Bring up license server")
license_mgr = stc.get("system1", "children-licenseservermanager")
if args.verbose:
- logger.debug("license_mgr = %s", license_mgr)
+ _LOGGER.debug("license_mgr = %s", license_mgr)
stc.create("LicenseServer", under=license_mgr, attributes={
- "server": args.license_server_addr})
+ "server": args.license_server_addr})
# Create the root project object
if args.verbose:
- logger.debug("Creating project ...")
+ _LOGGER.debug("Creating project ...")
project = stc.get("System1", "children-Project")
# Configure any custom traffic parameters
if args.traffic_custom == "cont":
if args.verbose:
- logger.debug("Configure Continuous Traffic")
+ _LOGGER.debug("Configure Continuous Traffic")
stc.create("ContinuousTestConfig", under=project)
# Create ports
if args.verbose:
- logger.debug("Creating ports ...")
+ _LOGGER.debug("Creating ports ...")
east_chassis_port = stc.create('port', project)
if args.verbose:
- logger.debug("Configuring TX port ...")
+ _LOGGER.debug("Configuring TX port ...")
stc.config(east_chassis_port, {'location': tx_port_loc})
port_list.append(east_chassis_port)
west_chassis_port = stc.create('port', project)
if args.verbose:
- logger.debug("Configuring RX port ...")
+ _LOGGER.debug("Configuring RX port ...")
stc.config(west_chassis_port, {'location': rx_port_loc})
port_list.append(west_chassis_port)
@@ -387,12 +388,12 @@ def main():
# Append to the device list
device_list.append(device_gen_config['ReturnList'])
if args.verbose:
- logger.debug(device_list)
+ _LOGGER.debug(device_list)
# Create the RFC 2544 'metric test
if args.metric == "throughput":
if args.verbose:
- logger.debug("Set up the RFC2544 throughput test...")
+ _LOGGER.debug("Set up the RFC2544 throughput test...")
stc.perform("Rfc2544SetupThroughputTestCommand",
params={"AcceptableFrameLoss":
args.acceptable_frame_loss_pct,
@@ -463,26 +464,26 @@ def main():
"system1.project", "children-port"), "autoConnect": "TRUE"})
# Apply configuration.
if args.verbose:
- logger.debug("Apply configuration...")
+ _LOGGER.debug("Apply configuration...")
stc.apply()
if args.verbose:
- logger.debug("Starting the sequencer...")
+ _LOGGER.debug("Starting the sequencer...")
stc.perform("SequencerStart")
# Wait for sequencer to finish
- logger.info(
+ _LOGGER.info(
"Starting test... Please wait for the test to complete...")
stc.wait_until_complete()
- logger.info("The test has completed... Saving results...")
+ _LOGGER.info("The test has completed... Saving results...")
# Determine what the results database filename is...
lab_server_resultsdb = stc.get(
"system1.project.TestResultSetting", "CurrentResultFileName")
if args.verbose:
- logger.debug("The lab server results database is %s",
- lab_server_resultsdb)
+ _LOGGER.debug("The lab server results database is %s",
+ lab_server_resultsdb)
stc.perform("CSSynchronizeFiles",
params={"DefaultDownloadDir": args.results_dir})
@@ -492,10 +493,10 @@ def main():
if not os.path.exists(resultsdb):
resultsdb = lab_server_resultsdb
- logger.info("Failed to create the local summary DB File, using"
- " the remote DB file instead.")
+ _LOGGER.info("Failed to create the local summary DB File, using"
+ " the remote DB file instead.")
else:
- logger.info(
+ _LOGGER.info(
"The local summary DB file has been saved to %s", resultsdb)
# The returns the "RFC2544ThroughputTestResultDetailedSummaryView"
@@ -551,26 +552,26 @@ def main():
("RFC2544FrameLossTestResultDetailed"
"SummaryView")}))
if args.verbose:
- logger.debug("resultsdict[\"Columns\"]: %s",
- resultsdict["Columns"])
- logger.debug("resultsdict[\"Output\"]: %s", resultsdict["Output"])
- logger.debug("Result paths: %s",
- stc.perform("GetTestResultSettingPaths"))
+ _LOGGER.debug("resultsdict[\"Columns\"]: %s",
+ resultsdict["Columns"])
+ _LOGGER.debug("resultsdict[\"Output\"]: %s", resultsdict["Output"])
+ _LOGGER.debug("Result paths: %s",
+ stc.perform("GetTestResultSettingPaths"))
# Write results to csv
- logger.debug("Writing CSV file to results directory %s",
- args.results_dir)
+ _LOGGER.debug("Writing CSV file to results directory %s",
+ args.results_dir)
write_query_results_to_csv(
args.results_dir, args.csv_results_file_prefix, resultsdict)
except RuntimeError as e:
- logger.error(e)
+ _LOGGER.error(e)
if args.verbose:
- logger.debug("Destroy session on lab server")
+ _LOGGER.debug("Destroy session on lab server")
stc.end_session()
- logger.info("Test complete!")
+ _LOGGER.info("Test complete!")
if __name__ == "__main__":
main()
diff --git a/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py b/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py
index ddb64562..044fb67d 100644
--- a/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py
+++ b/tools/pkt_gen/testcenter/testcenter-rfc2889-rest.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Spirent Communications.
+# Copyright 2016-2017 Spirent Communications.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -11,11 +11,11 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
-
+# pylint: disable=invalid-name
'''
@author Spirent Communications
-This test automates the RFC2544 tests using the Spirent
+This test automates the RFC2889 tests using the Spirent
TestCenter REST APIs. This test supports Python 3.4
'''
@@ -66,7 +66,7 @@ def percent_float(value):
"%s not in range [0.0, 100.0]" % pvalue)
return pvalue
-
+# pylint: disable=too-many-statements
def main():
""" Read the arguments, Invoke Test and Return the results"""
parser = argparse.ArgumentParser()
@@ -92,9 +92,9 @@ def main():
optional_named.add_argument("--metric",
required=False,
help=("One among - Forwarding,\
- Address Caching and Congestion"),
+ Address Caching and Learning"),
choices=["forwarding", "caching",
- "congestion"],
+ "learning"],
default="forwarding",
dest="metric")
optional_named.add_argument("--test_session_name",
@@ -103,7 +103,6 @@ def main():
help=("The friendly name to identify "
"the Spirent Lab Server test session"),
dest="test_session_name")
-
optional_named.add_argument("--test_user_name",
required=False,
default="Rfc2889Usr",
@@ -147,6 +146,42 @@ def main():
default=[256],
help="A comma-delimited list of frame sizes",
dest="frame_size_list")
+ optional_named.add_argument("--min_learning_rate",
+ type=positive_int,
+ required=False,
+ default=1488,
+ help="Lowest learning rate for test",
+ dest="min_learning_rate")
+ optional_named.add_argument("--max_learning_rate",
+ type=positive_int,
+ required=False,
+ default=14880,
+ help="Highest learning rate for test",
+ dest="max_learning_rate")
+ optional_named.add_argument("--min_num_addrs",
+ type=positive_int,
+ required=False,
+ default=1,
+ help="lowest number of addrs sent to DUT",
+ dest="min_num_addrs")
+ optional_named.add_argument("--max_num_addrs",
+ type=positive_int,
+ required=False,
+ default=1000,
+ help="Highest number of addrs sent to DUT",
+ dest="max_num_addrs")
+ optional_named.add_argument("--ac_learning_rate",
+ type=positive_int,
+ required=False,
+ default=1000,
+ help="Number of learning frames per sec",
+ dest="ac_learning_rate")
+ optional_named.add_argument("--frame_size",
+ type=positive_int,
+ required=False,
+ default=64,
+ help="Frame size for address test",
+ dest="frame_size")
parser.add_argument("-v",
"--verbose",
required=False,
@@ -164,6 +199,7 @@ def main():
session_name = args.test_session_name
user_name = args.test_user_name
+ # pylint: disable=import-error
try:
# Load Spirent REST Library
from stcrestclient import stchttp
@@ -187,7 +223,7 @@ def main():
if args.verbose:
logger.debug("license_mgr = %s", license_mgr)
stc.create("LicenseServer", under=license_mgr, attributes={
- "server": args.license_server_addr})
+ "server": args.license_server_addr})
# Create the root project object
if args.verbose:
@@ -224,12 +260,27 @@ def main():
"GenParams": gen_params})
if args.verbose:
- logger.debug("Set up the RFC2889 Forwarding test...")
- stc.perform("Rfc2889SetupMaxForwardingRateTestCommand",
- params={"Duration": args.trial_duration_sec,
- "FrameSizeList": args.frame_size_list,
- "NumOfTrials": args.num_trials,
- "TrafficPattern": args.traffic_pattern})
+ logger.debug("Set up the RFC2889 test...")
+
+ if args.metric == "learning":
+ stc.perform("Rfc2889SetupAddressLearningRateTestCommand",
+ params={"FrameSize": args.frame_size,
+ "MinLearningRate": args.min_learning_rate,
+ "MaxLearningRate": args.max_learning_rate,
+ "NumOfTrials": args.num_trials})
+ elif args.metric == "caching":
+ stc.perform("Rfc2889SetupAddressCachingCapacityTestCommand",
+ params={"FrameSize": args.frame_size,
+ "MinNumAddrs": args.min_num_addrs,
+ "MaxNumAddrs": args.max_num_addrs,
+ "LearningRate": args.ac_learning_rate,
+ "NumOfTrials": args.num_trials})
+ else:
+ stc.perform("Rfc2889SetupMaxForwardingRateTestCommand",
+ params={"Duration": args.trial_duration_sec,
+ "FrameSizeList": args.frame_size_list,
+ "NumOfTrials": args.num_trials,
+ "TrafficPattern": args.traffic_pattern})
# Save the configuration
stc.perform("SaveToTcc", params={"Filename": "2889.tcc"})
@@ -259,28 +310,34 @@ def main():
logger.debug("The lab server results database is %s",
lab_server_resultsdb)
- stc.perform("CSSynchronizeFiles",
- params={"DefaultDownloadDir": args.results_dir})
-
- resultsdb = args.results_dir + \
- lab_server_resultsdb.split("/Results")[1]
-
- if not os.path.exists(resultsdb):
- resultsdb = lab_server_resultsdb
- logger.info("Failed to create the local summary DB file, using"
- " the remote DB file instead.")
+ if args.metric == "learning":
+ resultsdict = (
+ stc.perform("QueryResult",
+ params={
+ "DatabaseConnectionString":
+ lab_server_resultsdb,
+ "ResultPath":
+ ("RFC2889AddressLearningRateTestResultDetailed"
+ "SummaryView")}))
+ elif args.metric == "caching":
+ resultsdict = (
+ stc.perform("QueryResult",
+ params={
+ "DatabaseConnectionString":
+ lab_server_resultsdb,
+ "ResultPath":
+ ("RFC2889AddressCachingCapacityTestResult"
+ "DetailedSummaryView")}))
else:
- logger.info(
- "The local summary DB file has been saved to %s", resultsdb)
-
- resultsdict = (
- stc.perform("QueryResult",
- params={
- "DatabaseConnectionString":
- resultsdb,
- "ResultPath":
- ("RFC2889MaxForwardingRateTestResultDetailed"
- "SummaryView")}))
+ resultsdict = (
+ stc.perform("QueryResult",
+ params={
+ "DatabaseConnectionString":
+ lab_server_resultsdb,
+ "ResultPath":
+ ("RFC2889MaxForwardingRateTestResultDetailed"
+ "SummaryView")}))
+
if args.verbose:
logger.debug("resultsdict[\"Columns\"]: %s",
resultsdict["Columns"])
diff --git a/tools/pkt_gen/testcenter/testcenter.py b/tools/pkt_gen/testcenter/testcenter.py
index 701d451c..9980ae7c 100644
--- a/tools/pkt_gen/testcenter/testcenter.py
+++ b/tools/pkt_gen/testcenter/testcenter.py
@@ -115,22 +115,52 @@ def get_rfc2544_custom_settings(framesize, custom_tr, tests):
return args
-def get_rfc2889_settings(framesize, tests, duration):
+def get_rfc2889_common_settings(framesize, tests, metric):
+ """
+ Return RFC2889 common Settings
+ """
+ new_metric = metric.replace('rfc2889_', '')
args = [settings.getValue("TRAFFICGEN_STC_PYTHON2_PATH"),
os.path.join(
settings.getValue("TRAFFICGEN_STC_TESTCENTER_PATH"),
settings.getValue(
"TRAFFICGEN_STC_RFC2889_TEST_FILE_NAME")),
- "--lab_server_addr",
- settings.getValue("TRAFFICGEN_STC_LAB_SERVER_ADDR"),
- "--license_server_addr",
- settings.getValue("TRAFFICGEN_STC_LICENSE_SERVER_ADDR"),
- "--location_list",
- settings.getValue("TRAFFICGEN_STC_RFC2889_LOCATIONS"),
- "--frame_size_list",
- str(framesize),
- "--num_trials",
- str(tests)]
+ "--lab_server_addr",
+ settings.getValue("TRAFFICGEN_STC_LAB_SERVER_ADDR"),
+ "--license_server_addr",
+ settings.getValue("TRAFFICGEN_STC_LICENSE_SERVER_ADDR"),
+ "--location_list",
+ settings.getValue("TRAFFICGEN_STC_RFC2889_LOCATIONS"),
+ "--test_session_name",
+ settings.getValue("TRAFFICGEN_STC_TEST_SESSION_NAME"),
+ "--results_dir",
+ settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
+ "--csv_results_file_prefix",
+ settings.getValue("TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX"),
+ "--frame_size_list",
+ str(framesize),
+ "--metric",
+ str(new_metric),
+ "--num_trials",
+ str(tests)]
+
+ return args
+
+
+def get_rfc2889_custom_settings():
+ """
+ Return RFC2889 Custom Settings
+ """
+ args = ["--min_learning_rate",
+ settings.getValue("TRAFFICGEN_STC_RFC2889_MIN_LR"),
+ "--max_learning_rate",
+ settings.getValue("TRAFFICGEN_STC_RFC2889_MAX_LR"),
+ "--min_num_addrs",
+ settings.getValue("TRAFFICGEN_STC_RFC2889_MIN_ADDRS"),
+ "--max_num_addrs",
+ settings.getValue("TRAFFICGEN_STC_RFC2889_MAX_ADDRS"),
+ "--ac_learning_rate",
+ settings.getValue("TRAFFICGEN_STC_RFC2889_AC_LR")]
return args
@@ -158,19 +188,35 @@ class TestCenter(trafficgen.ITrafficGenerator):
"""
return None
- def send_rfc2889_congestion(self, traffic=None, tests=1, duration=20):
+ def get_rfc2889_addr_learning_results(self, filename):
"""
- Do nothing.
+ Reads the CSV file and return the results
"""
- return None
+ result = {}
+ with open(filename, "r") as csvfile:
+ csvreader = csv.DictReader(csvfile)
+ for row in csvreader:
+ self._logger.info("Row: %s", row)
+ learn_rate = float(row["OptimalLearningRate"])
+ result[ResultsConstants.OPTIMAL_LEARNING_RATE_FPS] = learn_rate
+ return result
- def send_rfc2889_caching(self, traffic=None, tests=1, duration=20):
+ def get_rfc2889_addr_caching_results(self, filename):
"""
- Do nothing.
+ Reads the CSV file and return the results
"""
- return None
+ result = {}
+ with open(filename, "r") as csvfile:
+ csvreader = csv.DictReader(csvfile)
+ for row in csvreader:
+ self._logger.info("Row: %s", row)
+ caching_cap = float(row["RxFrameCount"])
+ learn_per = (100.0 - (float(row["PercentFrameLoss(%)"])))
+ result[ResultsConstants.CACHING_CAPACITY_ADDRS] = caching_cap
+ result[ResultsConstants.ADDR_LEARNED_PERCENT] = learn_per
+ return result
- def get_rfc2889_results(self, filename):
+ def get_rfc2889_forwarding_results(self, filename):
"""
Reads the CSV file and return the results
"""
@@ -200,6 +246,91 @@ class TestCenter(trafficgen.ITrafficGenerator):
row["ForwardingRate(fps)"])
return result
+ # pylint: disable=unused-argument
+ def send_rfc2889_forwarding(self, traffic=None, tests=1, duration=20):
+ """
+ Send traffic per RFC2889 Forwarding test specifications.
+ """
+ framesize = settings.getValue("TRAFFICGEN_STC_FRAME_SIZE")
+ if traffic and 'l2' in traffic:
+ if 'framesize' in traffic['l2']:
+ framesize = traffic['l2']['framesize']
+ args = get_rfc2889_common_settings(framesize, tests,
+ traffic['traffic_type'])
+ if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
+ args.append("--verbose")
+ verbose = True
+ self._logger.debug("Arguments used to call test: %s", args)
+ subprocess.check_call(args)
+
+ filec = os.path.join(settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
+ settings.getValue(
+ "TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX") +
+ ".csv")
+
+ if verbose:
+ self._logger.info("file: %s", filec)
+
+ return self.get_rfc2889_forwarding_results(filec)
+
+ def send_rfc2889_caching(self, traffic=None, tests=1, duration=20):
+ """
+ Send as per RFC2889 Addr-Caching test specifications.
+ """
+ framesize = settings.getValue("TRAFFICGEN_STC_FRAME_SIZE")
+ if traffic and 'l2' in traffic:
+ if 'framesize' in traffic['l2']:
+ framesize = traffic['l2']['framesize']
+ common_args = get_rfc2889_common_settings(framesize, tests,
+ traffic['traffic_type'])
+ custom_args = get_rfc2889_custom_settings()
+ args = common_args + custom_args
+
+ if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
+ args.append("--verbose")
+ verbose = True
+ self._logger.debug("Arguments used to call test: %s", args)
+ subprocess.check_call(args)
+
+ filec = os.path.join(settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
+ settings.getValue(
+ "TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX") +
+ ".csv")
+
+ if verbose:
+ self._logger.info("file: %s", filec)
+
+ return self.get_rfc2889_addr_caching_results(filec)
+
+ def send_rfc2889_learning(self, traffic=None, tests=1, duration=20):
+ """
+ Send traffic per RFC2889 Addr-Learning test specifications.
+ """
+ framesize = settings.getValue("TRAFFICGEN_STC_FRAME_SIZE")
+ if traffic and 'l2' in traffic:
+ if 'framesize' in traffic['l2']:
+ framesize = traffic['l2']['framesize']
+ common_args = get_rfc2889_common_settings(framesize, tests,
+ traffic['traffic_type'])
+ custom_args = get_rfc2889_custom_settings()
+ args = common_args + custom_args
+
+ if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
+ args.append("--verbose")
+ verbose = True
+ self._logger.debug("Arguments used to call test: %s", args)
+ subprocess.check_call(args)
+
+ filec = os.path.join(settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
+ settings.getValue(
+ "TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX") +
+ ".csv")
+
+ if verbose:
+ self._logger.info("file: %s", filec)
+
+ return self.get_rfc2889_addr_learning_results(filec)
+
def get_rfc2544_results(self, filename):
"""
Reads the CSV file and return the results
@@ -254,7 +385,7 @@ class TestCenter(trafficgen.ITrafficGenerator):
rfc2544_common_args = get_rfc2544_common_settings()
rfc2544_custom_args = get_rfc2544_custom_settings(framesize,
custom, 1)
- args = stc_common_args + rfc2544_common_args + rfc2544_custom_args
+ args = rfc2544_common_args + stc_common_args + rfc2544_custom_args
if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
args.append("--verbose")
@@ -272,31 +403,6 @@ class TestCenter(trafficgen.ITrafficGenerator):
return self.get_rfc2544_results(filec)
- def send_rfc2889_forwarding(self, traffic=None, tests=1, duration=20):
- """
- Send traffic per RFC2544 throughput test specifications.
- """
- framesize = settings.getValue("TRAFFICGEN_STC_FRAME_SIZE")
- if traffic and 'l2' in traffic:
- if 'framesize' in traffic['l2']:
- framesize = traffic['l2']['framesize']
- args = get_rfc2889_settings(framesize, tests, duration)
- if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
- args.append("--verbose")
- verbose = True
- self._logger.debug("Arguments used to call test: %s", args)
- subprocess.check_call(args)
-
- filec = os.path.join(settings.getValue("TRAFFICGEN_STC_RESULTS_DIR"),
- settings.getValue(
- "TRAFFICGEN_STC_CSV_RESULTS_FILE_PREFIX") +
- ".csv")
-
- if verbose:
- self._logger.debug("file: %s", filec)
-
- return self.get_rfc2889_results(filec)
-
def send_rfc2544_throughput(self, traffic=None, tests=1, duration=20,
lossrate=0.0):
"""
@@ -312,7 +418,7 @@ class TestCenter(trafficgen.ITrafficGenerator):
rfc2544_common_args = get_rfc2544_common_settings()
rfc2544_custom_args = get_rfc2544_custom_settings(framesize, '',
tests)
- args = stc_common_args + rfc2544_common_args + rfc2544_custom_args
+ args = rfc2544_common_args + stc_common_args + rfc2544_custom_args
if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
args.append("--verbose")
@@ -345,7 +451,7 @@ class TestCenter(trafficgen.ITrafficGenerator):
rfc2544_common_args = get_rfc2544_common_settings()
rfc2544_custom_args = get_rfc2544_custom_settings(framesize, '',
tests)
- args = stc_common_args + rfc2544_common_args + rfc2544_custom_args
+ args = rfc2544_common_args + stc_common_args + rfc2544_custom_args
if settings.getValue("TRAFFICGEN_STC_VERBOSE") is "True":
args.append("--verbose")
@@ -362,6 +468,26 @@ class TestCenter(trafficgen.ITrafficGenerator):
return self.get_rfc2544_results(filecs)
+ def start_cont_traffic(self, traffic=None, duration=30):
+ raise NotImplementedError('TestCenter start_cont_traffic not implement.')
+
+ def stop_cont_traffic(self):
+ raise NotImplementedError('TestCenter stop_cont_traffic not implement.')
+
+ def start_rfc2544_back2back(self, traffic=None, tests=1, duration=20,
+ lossrate=0.0):
+ raise NotImplementedError('TestCenter start_rfc2544_back2back not implement.')
+
+ def wait_rfc2544_back2back(self):
+ raise NotImplementedError('TestCenter wait_rfc2544_back2back not implement.')
+
+ def start_rfc2544_throughput(self, traffic=None, tests=1, duration=20,
+ lossrate=0.0):
+ raise NotImplementedError('TestCenter start_rfc2544_throughput not implement.')
+
+ def wait_rfc2544_throughput(self):
+ raise NotImplementedError('TestCenter wait_rfc2544_throughput not implement.')
+
if __name__ == '__main__':
TRAFFIC = {
'l3': {
diff --git a/tools/pkt_gen/xena/XenaDriver.py b/tools/pkt_gen/xena/XenaDriver.py
index e144514f..6e39e47a 100644
--- a/tools/pkt_gen/xena/XenaDriver.py
+++ b/tools/pkt_gen/xena/XenaDriver.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Red Hat Inc & Xena Networks.
+# Copyright 2016-2017 Red Hat Inc & Xena Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ import struct
import sys
import threading
import time
-
+# pylint: disable=too-many-lines
# Xena Socket Commands
CMD_CLEAR_RX_STATS = 'pr_clear'
CMD_CLEAR_TX_STATS = 'pt_clear'
@@ -371,7 +371,7 @@ class XenaManager(object):
"""
return self.driver.ask_verify(make_manager_command(CMD_OWNER, username))
-
+# pylint: disable=too-many-public-methods
class XenaPort(object):
"""
Xena Port emulator class
@@ -537,7 +537,7 @@ class XenaPort(object):
command = make_port_command(CMD_RESET, self)
return self._manager.driver.ask_verify(command)
- def set_port_arp_reply(self, on=True, v6=False):
+ def set_port_arp_reply(self, is_on=True, ipv6=False):
"""
Set the port arpreply value
:param on: Enable or disable the arp reply on the port
@@ -545,11 +545,11 @@ class XenaPort(object):
:return: Boolean True if response OK, False if error
"""
command = make_port_command('{} {}'.format(
- CMD_SET_PORT_ARP_V6_REPLY if v6 else CMD_SET_PORT_ARP_REPLY,
- "on" if on else "off"), self)
+ CMD_SET_PORT_ARP_V6_REPLY if ipv6 else CMD_SET_PORT_ARP_REPLY,
+ "on" if is_on else "off"), self)
return self._manager.driver.ask_verify(command)
- def set_port_ping_reply(self, on=True, v6=False):
+ def set_port_ping_reply(self, is_on=True, ipv6=False):
"""
Set the port ping reply value
:param on: Enable or disable the ping reply on the port
@@ -557,8 +557,8 @@ class XenaPort(object):
:return: Boolean True if response OK, False if error
"""
command = make_port_command('{} {}'.format(
- CMD_SET_PORT_PING_V6_REPLY if v6 else CMD_SET_PORT_PING_REPLY,
- "on" if on else "off"), self)
+ CMD_SET_PORT_PING_V6_REPLY if ipv6 else CMD_SET_PORT_PING_REPLY,
+ "on" if is_on else "off"), self)
return self._manager.driver.ask_verify(command)
def set_port_learning(self, interval):
@@ -885,6 +885,7 @@ class XenaRXStats(object):
"""
return self._time
+ # pylint: disable=too-many-branches
def parse_stats(self):
""" Parse the stats from pr all command
:return: Dictionary of all stats
@@ -1040,7 +1041,7 @@ class XenaTXStats(object):
def aggregate_stats(stat1, stat2):
"""
- Judge whether stat1 and stat2 both have same key, if both have same key,
+ Judge whether stat1 and stat2 both have same key, if both have same key,
call the aggregate fuction, else use the stat1's value
"""
newstat = dict()
diff --git a/tools/pkt_gen/xena/xena.py b/tools/pkt_gen/xena/xena.py
index e251c1d6..c6b26f88 100755
--- a/tools/pkt_gen/xena/xena.py
+++ b/tools/pkt_gen/xena/xena.py
@@ -430,10 +430,10 @@ class Xena(ITrafficGenerator):
(self._params['traffic']['frame_rate'] / 100))
stream.set_packet_limit(packets)
- port.set_port_arp_reply(on=True)
- port.set_port_arp_reply(on=True, v6=True)
- port.set_port_ping_reply(on=True)
- port.set_port_ping_reply(on=True, v6=True)
+ port.set_port_arp_reply(is_on=True)
+ port.set_port_arp_reply(is_on=True, ipv6=True)
+ port.set_port_ping_reply(is_on=True)
+ port.set_port_ping_reply(is_on=True, ipv6=True)
stream.set_rate_fraction(
10000 * self._params['traffic']['frame_rate'])
diff --git a/tools/pkt_gen/xena/xena_json.py b/tools/pkt_gen/xena/xena_json.py
index 1ce7b46f..50d0e2fe 100644
--- a/tools/pkt_gen/xena/xena_json.py
+++ b/tools/pkt_gen/xena/xena_json.py
@@ -1,4 +1,4 @@
-# Copyright 2016 Red Hat Inc & Xena Networks.
+# Copyright 2016-2017 Red Hat Inc & Xena Networks.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -232,10 +232,13 @@ class XenaJSON(object):
"""
self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][
'Enabled'] = 'true'
-
+ # pylint: disable=too-many-arguments
def modify_2544_tput_options(self, initial_value, minimum_value,
maximum_value, value_resolution,
use_pass_threshhold, pass_threshhold):
+ """
+ modify_2544_tput_options
+ """
self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][
'RateIterationOptions']['InitialValue'] = initial_value
self.json_data['TestOptions']['TestTypeOptionMap']['Throughput'][
@@ -638,4 +641,3 @@ if __name__ == "__main__":
write_json_file(JSON.json_data, './testthis.x2544')
JSON = XenaJSON('./testthis.x2544')
print_json_report(JSON.json_data)
-
diff --git a/tools/report/report.jinja b/tools/report/report.jinja
index c9588565..90cd43d7 100644
--- a/tools/report/report.jinja
+++ b/tools/report/report.jinja
@@ -1,3 +1,8 @@
+{#
+This work is licensed under a Creative Commons Attribution 4.0 International License.
+http://creativecommons.org/licenses/by/4.0
+#}
+
# CHARACTERIZE VSWITCH PERFORMANCE FOR TELCO NFV USE CASES LEVEL TEST REPORT
## Table of Contents
diff --git a/tools/report/report.py b/tools/report/report.py
index 1115f052..e2914fdf 100644
--- a/tools/report/report.py
+++ b/tools/report/report.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -131,9 +131,10 @@ def generate(input_file, tc_results, tc_stats, test_type='performance'):
'tests': tests,
}
i = 0
+ # pylint: disable=no-member
for output_file in output_files:
template = template_env.get_template(_TEMPLATE_FILES[i])
- output_text = template.render(template_vars) #pylint: disable=no-member
+ output_text = template.render(template_vars)
with open(output_file, 'w') as file_:
file_.write(output_text)
logging.info('Test report written to "%s"', output_file)
diff --git a/tools/report/report_foot.rst b/tools/report/report_foot.rst
index f0e51876..5045e186 100644
--- a/tools/report/report_foot.rst
+++ b/tools/report/report_foot.rst
@@ -1,3 +1,6 @@
+.. This work is licensed under a Creative Commons Attribution 4.0 International License.
+ http://creativecommons.org/licenses/by/4.0
+
.. _rationale:
Rationale for decisions
diff --git a/tools/report/report_rst.jinja b/tools/report/report_rst.jinja
index 545dd493..e2cb4c83 100644
--- a/tools/report/report_rst.jinja
+++ b/tools/report/report_rst.jinja
@@ -1,3 +1,12 @@
+{#
+ Copyright (c) 2016-2017 Intel corporation.
+
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Apache License, Version 2.0
+ which accompanies this distribution, and is available at
+ http://www.apache.org/licenses/LICENSE-2.0
+#}
+
Test ID: {{ tests[0].ID }}
--------------------------
diff --git a/tools/systeminfo.py b/tools/systeminfo.py
index 1d193159..d515983d 100644
--- a/tools/systeminfo.py
+++ b/tools/systeminfo.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@ import platform
import subprocess
import locale
import re
+import distro
from conf import settings as S
@@ -46,7 +47,7 @@ def get_os():
:returns: Return distro name as a string
"""
- return ' '.join(platform.dist())
+ return ' '.join(distro.linux_distribution())
def get_kernel():
"""Get kernel version.
@@ -212,7 +213,7 @@ def get_git_tag(path):
return None
# This function uses long switch per purpose, so let us suppress pylint warning too-many-branches
-# pylint: disable=R0912
+# pylint: disable=too-many-branches, too-many-statements
def get_version(app_name):
""" Get version of given application and its git tag
diff --git a/tools/tasks.py b/tools/tasks.py
index 9816a336..4179291f 100644
--- a/tools/tasks.py
+++ b/tools/tasks.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2017 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -18,12 +18,12 @@
import select
import subprocess
import logging
-import pexpect
import threading
import sys
import os
import locale
import time
+import pexpect
from conf import settings
from tools import systeminfo
@@ -73,8 +73,8 @@ def run_task(cmd, logger, msg=None, check_error=False):
if msg:
logger.info(msg)
+ # pylint: disable=too-many-nested-blocks
logger.debug('%s%s', CMD_PREFIX, ' '.join(cmd))
-
try:
proc = subprocess.Popen(map(os.path.expanduser, cmd),
stdout=subprocess.PIPE,