aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/DPDK
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2018-04-26 15:15:51 +0200
committerPeter Mikus <pmikus@cisco.com>2018-05-04 09:35:22 +0000
commit5e7be479eacd4d1085cab152c35dcb6433a146ed (patch)
tree0d91e7ae63856c3d3d4588654abfd6ed8fa8a76a /resources/libraries/python/DPDK
parentceb7c2545cda1bc7fe3d4bf35cdf75253efe8c6d (diff)
Fix various pylint 1.5.4 warnings
+ DUTSetup.py:424 Else clause on loop without a break statement + InterfaceUtil.py:400 Else clause on loop without a break statement + QemuUtils.py:564 Wrong continued indentation + SetupDPDKTest.py: Locally enabling broad-except + VatExecutor.py: Catching too general exception Exception + ssh.py:95 No exception type(s) specified. + HTTPRequest.py: Tolerate HTTPCodes.OK + multiple: Drop ":returns: None" from docstrings. There are still several warnings present: - R0902(too-many-instance-attributes) - R0912(too-many-branches) - R0913(too-many-arguments) - R0914(too-many-locals) - R0915(too-many-statements) - R0401(cyclic-import) And there are multiple blocks of similar lines, mainly across various Setup*Test.py files: - R0801(duplicate-code) Change-Id: I582575cb52b85d69d268e6374852f6e74bb71052 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/DPDK')
-rw-r--r--resources/libraries/python/DPDK/DPDKTools.py2
-rw-r--r--resources/libraries/python/DPDK/L2fwdTest.py1
-rw-r--r--resources/libraries/python/DPDK/L3fwdTest.py1
-rw-r--r--resources/libraries/python/DPDK/SetupDPDKTest.py19
4 files changed, 11 insertions, 12 deletions
diff --git a/resources/libraries/python/DPDK/DPDKTools.py b/resources/libraries/python/DPDK/DPDKTools.py
index a256ae5ddc..b0e67b7ab8 100644
--- a/resources/libraries/python/DPDK/DPDKTools.py
+++ b/resources/libraries/python/DPDK/DPDKTools.py
@@ -37,7 +37,6 @@ class DPDKTools(object):
:type dut_node: dict
:type dut_if1: str
:type dut_if2: str
- :returns: none
:raises RuntimeError: If it fails to bind the interfaces to igb_uio.
"""
if dut_node['type'] == NodeType.DUT:
@@ -72,7 +71,6 @@ class DPDKTools(object):
:type dut_node: dict
:type dut_if1: str
:type dut_if2: str
- :returns: none
:raises RuntimeError: If it fails to cleanup the dpdk.
"""
if dut_node['type'] == NodeType.DUT:
diff --git a/resources/libraries/python/DPDK/L2fwdTest.py b/resources/libraries/python/DPDK/L2fwdTest.py
index cfaa39991d..65ad6a53a4 100644
--- a/resources/libraries/python/DPDK/L2fwdTest.py
+++ b/resources/libraries/python/DPDK/L2fwdTest.py
@@ -39,7 +39,6 @@ class L2fwdTest(object):
:type nb_cores: str
:type queue_nums: str
:type jumbo_frames: str
- :returns: none
:raises RuntimeError: If the script "run_l2fwd.sh" fails.
"""
if dut_node['type'] == NodeType.DUT:
diff --git a/resources/libraries/python/DPDK/L3fwdTest.py b/resources/libraries/python/DPDK/L3fwdTest.py
index d7e9305391..15e656af07 100644
--- a/resources/libraries/python/DPDK/L3fwdTest.py
+++ b/resources/libraries/python/DPDK/L3fwdTest.py
@@ -44,7 +44,6 @@ class L3fwdTest(object):
:type lcores_list: str
:type queue_nums: str
:type jumbo_frames: str
- :returns: none
"""
if dut_node['type'] == NodeType.DUT:
adj_mac0, adj_mac1 = L3fwdTest.get_adj_mac(nodes_info, dut_node,
diff --git a/resources/libraries/python/DPDK/SetupDPDKTest.py b/resources/libraries/python/DPDK/SetupDPDKTest.py
index d94a383786..1e88f8d8c1 100644
--- a/resources/libraries/python/DPDK/SetupDPDKTest.py
+++ b/resources/libraries/python/DPDK/SetupDPDKTest.py
@@ -34,7 +34,9 @@ __all__ = ["SetupDPDKTest"]
def pack_framework_dir():
- """Pack the testing WS into temp file, return its name."""
+ """Pack the testing WS into temp file, return its name.
+
+ :raise RuntimeError: If command returns nonzero return code."""
tmpfile = NamedTemporaryFile(suffix=".tgz", prefix="DPDK-testing-")
file_name = tmpfile.name
@@ -50,7 +52,7 @@ def pack_framework_dir():
return_code = proc.wait()
if return_code != 0:
- raise Exception("Could not pack testing framework.")
+ raise RuntimeError("Could not pack testing framework.")
return file_name
@@ -81,6 +83,7 @@ def extract_tarball_at_node(tarball, node):
:type tarball: str
:type node: dict
:returns: nothing
+ :raise RuntimeError: If command returns nonzero return code.
"""
logger.console('Extracting tarball to {0} on {1}'.format(
con.REMOTE_FW_DIR, node['host']))
@@ -92,7 +95,7 @@ def extract_tarball_at_node(tarball, node):
(ret_code, _, stderr) = ssh.exec_command(cmd, timeout=30)
if ret_code != 0:
logger.error('Unpack error: {0}'.format(stderr))
- raise Exception('Failed to unpack {0} at node {1}'.format(
+ raise RuntimeError('Failed to unpack {0} at node {1}'.format(
tarball, node['host']))
@@ -103,6 +106,7 @@ def create_env_directory_at_node(node):
:param node: Dictionary created from topology, will only install in the TG
:type node: dict
:returns: nothing
+ :raise RuntimeError: If command returns nonzero return code.
"""
logger.console('Extracting virtualenv, installing requirements.txt '
'on {0}'.format(node['host']))
@@ -114,7 +118,7 @@ def create_env_directory_at_node(node):
.format(con.REMOTE_FW_DIR), timeout=100)
if ret_code != 0:
logger.error('Virtualenv creation error: {0}'.format(stdout + stderr))
- raise Exception('Virtualenv setup failed')
+ raise RuntimeError('Virtualenv setup failed')
else:
logger.console('Virtualenv created on {0}'.format(node['host']))
@@ -125,6 +129,7 @@ def install_dpdk_test(node):
:param node: Dictionary created from topology
:type node: dict
:returns: nothing
+ :raise RuntimeError: If command returns nonzero return code.
"""
arch = Topology.get_node_arch(node)
logger.console('Install the DPDK on {0} ({1})'.format(node['host'],
@@ -139,11 +144,10 @@ def install_dpdk_test(node):
if ret_code != 0:
logger.error('Install the DPDK error: {0}'.format(stderr))
- raise Exception('Install the DPDK failed')
+ raise RuntimeError('Install the DPDK failed')
else:
logger.console('Install the DPDK on {0} success!'.format(node['host']))
-#pylint: disable=broad-except
def setup_node(args):
"""Run all set-up methods for a node.
@@ -168,13 +172,12 @@ def setup_node(args):
install_dpdk_test(node)
if node['type'] == NodeType.TG:
create_env_directory_at_node(node)
- except Exception as exc:
+ except RuntimeError as exc:
logger.error("Node setup failed, error:'{0}'".format(exc.message))
return False
else:
logger.console('Setup of node {0} done'.format(node['host']))
return True
-#pylint: enable=broad-except
def delete_local_tarball(tarball):
"""Delete local tarball to prevent disk pollution.