diff options
Diffstat (limited to 'resources/libraries/python/DPDK')
-rw-r--r-- | resources/libraries/python/DPDK/DPDKTools.py | 2 | ||||
-rw-r--r-- | resources/libraries/python/DPDK/L2fwdTest.py | 1 | ||||
-rw-r--r-- | resources/libraries/python/DPDK/L3fwdTest.py | 1 | ||||
-rw-r--r-- | resources/libraries/python/DPDK/SetupDPDKTest.py | 19 |
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. |