aboutsummaryrefslogtreecommitdiffstats
path: root/resources
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2016-12-15 10:52:33 +0100
committerTibor Frank <tifrank@cisco.com>2016-12-16 08:35:32 +0100
commitcf561a6e3d4c4fbd78ab6c9d0a9aa817bb3300fc (patch)
tree0b4d5d2dbda78223d77d76e237285396d42c868e /resources
parent677ae40a2be6db9f49b19ada3c4299a8904f7784 (diff)
Pylint fixes
- Fix PyLint errors - Fix comments in touched python modules Change-Id: I26db2d292a41969cf38b9b0bdd49c4fb15349102 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources')
-rw-r--r--resources/libraries/python/Classify.py18
-rw-r--r--resources/libraries/python/DUTSetup.py7
-rw-r--r--resources/libraries/python/DpdkUtil.py1
-rw-r--r--resources/libraries/python/IPUtil.py25
-rw-r--r--resources/libraries/python/IPsecUtil.py32
-rw-r--r--resources/libraries/python/IPv4Setup.py27
-rw-r--r--resources/libraries/python/IPv6Setup.py7
-rw-r--r--resources/libraries/python/LispSetup.py10
-rw-r--r--resources/libraries/python/LispUtil.py14
-rw-r--r--resources/libraries/python/Map.py25
-rw-r--r--resources/libraries/python/NodePath.py11
-rw-r--r--resources/libraries/python/PacketVerifier.py22
-rw-r--r--resources/libraries/python/Policer.py5
-rw-r--r--resources/libraries/python/Routing.py1
-rw-r--r--resources/libraries/python/SetupFramework.py12
-rw-r--r--resources/libraries/python/Trace.py14
-rw-r--r--resources/libraries/python/TrafficGenerator.py14
-rw-r--r--resources/libraries/python/VPPUtil.py10
-rw-r--r--resources/libraries/python/VatExecutor.py11
-rw-r--r--resources/libraries/python/VppCounters.py22
-rw-r--r--resources/libraries/python/constants.py4
-rw-r--r--resources/libraries/python/honeycomb/HcAPIKwACL.py7
-rw-r--r--resources/libraries/python/honeycomb/HcAPIKwInterfaces.py4
-rw-r--r--resources/libraries/python/honeycomb/HoneycombUtil.py20
-rw-r--r--resources/libraries/python/honeycomb/Netconf.py15
-rw-r--r--resources/libraries/python/parsers/__init__.py4
-rw-r--r--resources/libraries/python/ssh.py4
-rw-r--r--resources/libraries/python/telemetry/IPFIXUtil.py6
-rw-r--r--resources/libraries/python/telemetry/SPAN.py4
-rw-r--r--resources/libraries/python/telemetry/__init__.py4
-rw-r--r--resources/libraries/python/topology.py8
-rw-r--r--resources/libraries/robot/lisp/l2lisp.robot2
32 files changed, 190 insertions, 180 deletions
diff --git a/resources/libraries/python/Classify.py b/resources/libraries/python/Classify.py
index c781bbbd14..ef140681d8 100644
--- a/resources/libraries/python/Classify.py
+++ b/resources/libraries/python/Classify.py
@@ -18,8 +18,6 @@ from robot.api import logger
from resources.libraries.python.VatExecutor import VatExecutor, VatTerminal
-# pylint: disable=too-many-arguments, invalid-name
-
class Classify(object):
"""Classify utilities."""
@@ -33,7 +31,7 @@ class Classify(object):
:type node: dict
:type ip_version: str
:type direction: str
- :return (table_index, skip_n, match_n)
+ :returns (table_index, skip_n, match_n)
table_index: Classify table index.
skip_n: Number of skip vectors.
match_n: Number of match vectors.
@@ -65,7 +63,7 @@ class Classify(object):
:param direction: Direction of traffic - src/dst.
:type node: dict
:type direction: str
- :return (table_index, skip_n, match_n)
+ :returns (table_index, skip_n, match_n)
table_index: Classify table index.
skip_n: Number of skip vectors.
match_n: Number of match vectors.
@@ -96,7 +94,7 @@ class Classify(object):
:param hex_mask: Classify hex mask.
:type node: dict
:type hex_mask: str
- :return (table_index, skip_n, match_n)
+ :returns (table_index, skip_n, match_n)
table_index: Classify table index.
skip_n: Number of skip vectors.
match_n: Number of match vectors.
@@ -256,7 +254,7 @@ class Classify(object):
:type ip_version: str
:type protocol: str
:type direction: str
- :return: Classify hex mask.
+ :returns: Classify hex mask.
:rtype : str
:raises ValueError: If protocol is not TCP or UDP.
:raises ValueError: If direction is not source or destination or
@@ -286,7 +284,7 @@ class Classify(object):
:type hex_mask: str
:type source_port: str
:type destination_port: str
- :return: Classify hex value.
+ :returns: Classify hex value.
:rtype: str
"""
source_port_hex = Classify._port_convert(source_port)
@@ -300,7 +298,7 @@ class Classify(object):
:param port: TCP/UDP port number.
:type port: str
- :return: TCP/UDP port number in 4-digit hexadecimal format.
+ :returns: TCP/UDP port number in 4-digit hexadecimal format.
:rtype: str
"""
return '{0:04x}'.format(int(port))
@@ -331,7 +329,7 @@ class Classify(object):
:param table_index: Index of a specific classify table.
:type node: dict
:type table_index: int
- :return: Classify table settings.
+ :returns: Classify table settings.
:rtype: dict
"""
with VatTerminal(node) as vat:
@@ -352,7 +350,7 @@ class Classify(object):
:type node: dict
:type table_index: int
:type session_index: int
- :return: List of classify session settings, or a dictionary of settings
+ :returns: List of classify session settings, or a dictionary of settings
for a specific classify session.
:rtype: list or dict
"""
diff --git a/resources/libraries/python/DUTSetup.py b/resources/libraries/python/DUTSetup.py
index 6b2f5edb83..1f87f03cb9 100644
--- a/resources/libraries/python/DUTSetup.py
+++ b/resources/libraries/python/DUTSetup.py
@@ -88,8 +88,9 @@ class DUTSetup(object):
ssh.connect(node)
(ret_code, stdout, stderr) = \
- ssh.exec_command('sudo -Sn bash {0}/{1}/dut_setup.sh'.format(
- Constants.REMOTE_FW_DIR, Constants.RESOURCES_LIB_SH), timeout=120)
+ ssh.exec_command('sudo -Sn bash {0}/{1}/dut_setup.sh'.
+ format(Constants.REMOTE_FW_DIR,
+ Constants.RESOURCES_LIB_SH), timeout=120)
logger.trace(stdout)
logger.trace(stderr)
if int(ret_code) != 0:
@@ -118,7 +119,7 @@ class DUTSetup(object):
if int(ret_code) != 0:
logger.debug('Not possible to get PID of VPP process on node: '
- '"{1}"'.format(node['host'], stdout + stderr))
+ '{0}\n {1}'.format(node['host'], stdout + stderr))
raise RuntimeError('Not possible to get PID of VPP process on node:'
' {}'.format(node['host']))
diff --git a/resources/libraries/python/DpdkUtil.py b/resources/libraries/python/DpdkUtil.py
index a81251c97b..4b00167cee 100644
--- a/resources/libraries/python/DpdkUtil.py
+++ b/resources/libraries/python/DpdkUtil.py
@@ -19,7 +19,6 @@ from resources.libraries.python.ssh import SSH, exec_cmd_no_error
class DpdkUtil(object):
"""Utilities for DPDK."""
- #pylint: disable=too-many-locals
@staticmethod
def dpdk_testpmd_start(node, **args):
"""Start DPDK testpmd app on VM node.
diff --git a/resources/libraries/python/IPUtil.py b/resources/libraries/python/IPUtil.py
index f3c037fdf0..4bd8869cb6 100644
--- a/resources/libraries/python/IPUtil.py
+++ b/resources/libraries/python/IPUtil.py
@@ -75,19 +75,19 @@ class IPUtil(object):
@staticmethod
def setup_network_namespace(node, namespace_name, interface_name,
- ip_address, prefix):
+ ip_addr, prefix):
"""Setup namespace on given node and attach interface and IP to
this namespace. Applicable also on TG node.
:param node: Node to set namespace on.
:param namespace_name: Namespace name.
:param interface_name: Interface name.
- :param ip_address: IP address of namespace's interface.
+ :param ip_addr: IP address of namespace's interface.
:param prefix: IP address prefix length.
:type node: dict
:type namespace_name: str
:type vhost_if: str
- :type ip_address: str
+ :type ip_addr: str
:type prefix: int
"""
cmd = ('ip netns add {0}'.format(namespace_name))
@@ -98,7 +98,7 @@ class IPUtil(object):
exec_cmd_no_error(node, cmd, sudo=True)
cmd = ('ip netns exec {0} ip addr add {1}/{2} dev {3}'.format(
- namespace_name, ip_address, prefix, interface_name))
+ namespace_name, ip_addr, prefix, interface_name))
exec_cmd_no_error(node, cmd, sudo=True)
@staticmethod
@@ -114,28 +114,29 @@ class IPUtil(object):
exec_cmd_no_error(node, cmd, sudo=True)
@staticmethod
- def set_linux_interface_ip(node, interface, ip, prefix, namespace=None):
+ def set_linux_interface_ip(node, interface, ip_addr, prefix,
+ namespace=None):
"""Set IP address to interface in linux.
:param node: Node where to execute command.
:param interface: Interface in namespace.
- :param ip: IP to be set on interface.
+ :param ip_addr: IP to be set on interface.
:param prefix: IP prefix.
:param namespace: Execute command in namespace. Optional
:type node: dict
:type interface: str
- :type ip: str
+ :type ip_addr: str
:type prefix: int
:type namespace: str
:raises RuntimeError: IP could not be set.
"""
if namespace is not None:
cmd = 'ip netns exec {} ip addr add {}/{} dev {}'.format(
- namespace, ip, prefix, interface)
+ namespace, ip_addr, prefix, interface)
else:
- cmd = 'ip addr add {}/{} dev {}'.format(ip, prefix, interface)
- (rc, _, stderr) = exec_cmd(node, cmd, timeout=5, sudo=True)
- if rc != 0:
+ cmd = 'ip addr add {}/{} dev {}'.format(ip_addr, prefix, interface)
+ (ret_code, _, stderr) = exec_cmd(node, cmd, timeout=5, sudo=True)
+ if ret_code != 0:
raise RuntimeError(
'Could not set IP for interface, reason:{}'.format(stderr))
@@ -166,7 +167,7 @@ def convert_ipv4_netmask_prefix(network):
Example: mask 255.255.0.0 -> prefix length 16
:param network: Network mask or network prefix length.
:type network: str or int
- :return: Network mask or network prefix length.
+ :returns: Network mask or network prefix length.
:rtype: str or int
"""
temp_address = "0.0.0.0"
diff --git a/resources/libraries/python/IPsecUtil.py b/resources/libraries/python/IPsecUtil.py
index 70d44e0936..5a4a181fd0 100644
--- a/resources/libraries/python/IPsecUtil.py
+++ b/resources/libraries/python/IPsecUtil.py
@@ -22,7 +22,6 @@ from resources.libraries.python.topology import Topology
from resources.libraries.python.VatJsonUtil import VatJsonUtil
-# pylint: disable=too-few-public-methods
class PolicyAction(Enum):
"""Policy actions."""
BYPASS = 'bypass'
@@ -61,14 +60,11 @@ class IntegAlg(Enum):
class IPsecUtil(object):
"""IPsec utilities."""
- # pylint: disable=too-many-arguments
- # pylint: disable=too-many-locals
-
@staticmethod
def policy_action_bypass():
"""Return policy action bypass.
- :return: PolicyAction enum BYPASS object.
+ :returns: PolicyAction enum BYPASS object.
:rtype: PolicyAction
"""
return PolicyAction.BYPASS
@@ -77,7 +73,7 @@ class IPsecUtil(object):
def policy_action_discard():
"""Return policy action discard.
- :return: PolicyAction enum DISCARD object.
+ :returns: PolicyAction enum DISCARD object.
:rtype: PolicyAction
"""
return PolicyAction.DISCARD
@@ -86,7 +82,7 @@ class IPsecUtil(object):
def policy_action_protect():
"""Return policy action protect.
- :return: PolicyAction enum PROTECT object.
+ :returns: PolicyAction enum PROTECT object.
:rtype: PolicyAction
"""
return PolicyAction.PROTECT
@@ -95,7 +91,7 @@ class IPsecUtil(object):
def crypto_alg_aes_cbc_128():
"""Return encryption algorithm aes-cbc-128.
- :return: CryptoAlg enum AES_CBC_128 object.
+ :returns: CryptoAlg enum AES_CBC_128 object.
:rtype: CryptoAlg
"""
return CryptoAlg.AES_CBC_128
@@ -104,7 +100,7 @@ class IPsecUtil(object):
def crypto_alg_aes_cbc_192():
"""Return encryption algorithm aes-cbc-192.
- :return: CryptoAlg enum AES_CBC_192 objec.
+ :returns: CryptoAlg enum AES_CBC_192 objec.
:rtype: CryptoAlg
"""
return CryptoAlg.AES_CBC_192
@@ -113,7 +109,7 @@ class IPsecUtil(object):
def crypto_alg_aes_cbc_256():
"""Return encryption algorithm aes-cbc-256.
- :return: CryptoAlg enum AES_CBC_256 object.
+ :returns: CryptoAlg enum AES_CBC_256 object.
:rtype: CryptoAlg
"""
return CryptoAlg.AES_CBC_256
@@ -124,7 +120,7 @@ class IPsecUtil(object):
:param crypto_alg: Encryption algorithm.
:type crypto_alg: CryptoAlg
- :return: Key length.
+ :returns: Key length.
:rtype: int
"""
return crypto_alg.key_len
@@ -135,7 +131,7 @@ class IPsecUtil(object):
:param crypto_alg: Encryption algorithm.
:type crypto_alg: CryptoAlg
- :return: Algorithm scapy name.
+ :returns: Algorithm scapy name.
:rtype: str
"""
return crypto_alg.scapy_name
@@ -144,7 +140,7 @@ class IPsecUtil(object):
def integ_alg_sha1_96():
"""Return integrity algorithm SHA1-96.
- :return: IntegAlg enum SHA1_96 object.
+ :returns: IntegAlg enum SHA1_96 object.
:rtype: IntegAlg
"""
return IntegAlg.SHA1_96
@@ -153,7 +149,7 @@ class IPsecUtil(object):
def integ_alg_sha_256_128():
"""Return integrity algorithm SHA-256-128.
- :return: IntegAlg enum SHA_256_128 object.
+ :returns: IntegAlg enum SHA_256_128 object.
:rtype: IntegAlg
"""
return IntegAlg.SHA_256_128
@@ -162,7 +158,7 @@ class IPsecUtil(object):
def integ_alg_sha_384_192():
"""Return integrity algorithm SHA-384-192.
- :return: IntegAlg enum SHA_384_192 object.
+ :returns: IntegAlg enum SHA_384_192 object.
:rtype: IntegAlg
"""
return IntegAlg.SHA_384_192
@@ -171,7 +167,7 @@ class IPsecUtil(object):
def integ_alg_sha_512_256():
"""Return integrity algorithm SHA-512-256.
- :return: IntegAlg enum SHA_512_256 object.
+ :returns: IntegAlg enum SHA_512_256 object.
:rtype: IntegAlg
"""
return IntegAlg.SHA_512_256
@@ -182,7 +178,7 @@ class IPsecUtil(object):
:param integ_alg: Integrity algorithm.
:type integ_alg: IntegAlg
- :return: Key length.
+ :returns: Key length.
:rtype: int
"""
return integ_alg.key_len
@@ -193,7 +189,7 @@ class IPsecUtil(object):
:param integ_alg: Integrity algorithm.
:type integ_alg: IntegAlg
- :return: Algorithm scapy name.
+ :returns: Algorithm scapy name.
:rtype: str
"""
return integ_alg.scapy_name
diff --git a/resources/libraries/python/IPv4Setup.py b/resources/libraries/python/IPv4Setup.py
index 07089025b0..0220139c04 100644
--- a/resources/libraries/python/IPv4Setup.py
+++ b/resources/libraries/python/IPv4Setup.py
@@ -38,8 +38,7 @@ class IPv4Node(object):
:param prefix_length: Length of network prefix.
:type prefix_length: int
-
- :return: Network mask.
+ :returns: Network mask.
:rtype: str
"""
@@ -56,7 +55,7 @@ class IPv4Node(object):
:type interface: str
:type address: str
:type prefix_length: int
- :return: nothing
+ :returns: nothing
"""
pass
@@ -72,7 +71,7 @@ class IPv4Node(object):
:type prefix_length: int
:type gateway: str
:type interface: str
- :return: nothing
+ :returns: nothing
"""
pass
@@ -88,7 +87,7 @@ class IPv4Node(object):
:type prefix_length: int
:type gateway: str
:type interface: str
- :return: nothing
+ :returns: nothing
"""
pass
@@ -110,7 +109,7 @@ class IPv4Node(object):
:param source_interface: Source interface name.
:type destination_address: str
:type source_interface: str
- :return: nothing
+ :returns: nothing
"""
pass
@@ -125,8 +124,7 @@ class Tg(IPv4Node):
:param cmd: Command to be executed.
:type cmd: str
-
- :return: Content of stdout and stderr returned by command.
+ :returns: Content of stdout and stderr returned by command.
:rtype: tuple
"""
return exec_cmd_no_error(self.node_info, cmd)
@@ -136,8 +134,7 @@ class Tg(IPv4Node):
:param cmd: Command to be executed.
:type cmd: str
-
- :return: Content of stdout and stderr returned by command.
+ :returns: Content of stdout and stderr returned by command.
:rtype: tuple
"""
return exec_cmd_no_error(self.node_info, cmd, sudo=True)
@@ -188,7 +185,7 @@ class Dut(IPv4Node):
:param interface: Interface name.
:type interface: str
- :return: sw_if_index of the interface or None.
+ :returns: sw_if_index of the interface or None.
:rtype: int
"""
return Topology().get_interface_sw_index(self.node_info, interface)
@@ -200,7 +197,7 @@ class Dut(IPv4Node):
:param args: Parameters to the script.
:type script: str
:type args: dict
- :return: nothing
+ :returns: nothing
"""
# TODO: check return value
VatExecutor.cmd_from_template(self.node_info, script, **args)
@@ -255,7 +252,7 @@ def get_node(node_info):
:param node_info: Dictionary containing information on nodes in topology.
:type node_info: dict
- :return: Class instance that is derived from Node.
+ :returns: Class instance that is derived from Node.
"""
if node_info['type'] == NodeType.TG:
return Tg(node_info)
@@ -277,7 +274,7 @@ class IPv4Setup(object):
:param nodes_addr: Available nodes IPv4 addresses.
:type nodes: dict
:type nodes_addr: dict
- :return: Affected interfaces as list of (node, interface) tuples.
+ :returns: Affected interfaces as list of (node, interface) tuples.
:rtype: list
"""
interfaces = []
@@ -310,7 +307,7 @@ class IPv4Setup(object):
:type node: dict
:type iface_key: str
:type nodes_addr: dict
- :return: IPv4 address.
+ :returns: IPv4 address.
:rtype: str
"""
interface = Topology.get_interface_name(node, iface_key)
diff --git a/resources/libraries/python/IPv6Setup.py b/resources/libraries/python/IPv6Setup.py
index 25e8c47ec5..60e10a34e4 100644
--- a/resources/libraries/python/IPv6Setup.py
+++ b/resources/libraries/python/IPv6Setup.py
@@ -63,7 +63,7 @@ class IPv6Setup(object):
:param nodes_addr: Available nodes IPv6 addresses.
:type nodes: dict
:type nodes_addr: dict
- :return: Affected interfaces as list of (node, interface) tuples.
+ :returns: Affected interfaces as list of (node, interface) tuples.
:rtype: list
"""
interfaces = []
@@ -169,7 +169,6 @@ class IPv6Setup(object):
:type addr: str
:type prefix: str
"""
- topo = Topology()
sw_if_index = Topology.get_interface_sw_index(node, iface_key)
with VatTerminal(node) as vat:
vat.vat_terminal_exec_cmd_from_template('add_ip_address.vat',
@@ -266,7 +265,7 @@ class IPv6Setup(object):
:param nodes_addr: Available nodes IPv6 addresses.
:type link: str
:type nodes_addr: dict
- :return: Link IPv6 address.
+ :returns: Link IPv6 address.
:rtype: str
"""
net = nodes_addr.get(link)
@@ -282,7 +281,7 @@ class IPv6Setup(object):
:param nodes_addr: Available nodes IPv6 addresses.
:type link: str
:type nodes_addr: dict
- :return: Link IPv6 address prefix.
+ :returns: Link IPv6 address prefix.
:rtype: int
"""
net = nodes_addr.get(link)
diff --git a/resources/libraries/python/LispSetup.py b/resources/libraries/python/LispSetup.py
index 85749955e7..5ef8bc06a9 100644
--- a/resources/libraries/python/LispSetup.py
+++ b/resources/libraries/python/LispSetup.py
@@ -610,21 +610,21 @@ class LispEidTableMap(object):
"""
@staticmethod
- def vpp_lisp_eid_table_mapping(node, vni, bd=None, vrf=None):
+ def vpp_lisp_eid_table_mapping(node, vni, bd_id=None, vrf=None):
"""
Map LISP VNI to either bridge domain ID, or VRF ID.
:param node: VPP node.
:param vni: Lisp VNI.
- :param bd: Bridge domain ID.
+ :param bd_id: Bridge domain ID.
:param vrf: VRF id.
:type node: dict
:type vni: int
- :type bd: int
+ :type bd_id: int
:type vrf: int
"""
- if bd:
- bd_or_vrf = 'bd_index {}'.format(bd)
+ if bd_id:
+ bd_or_vrf = 'bd_index {}'.format(bd_id)
else:
bd_or_vrf = 'vrf {}'.format(vrf)
VatExecutor.cmd_from_template(node,
diff --git a/resources/libraries/python/LispUtil.py b/resources/libraries/python/LispUtil.py
index 556ae1b289..2926d01dfb 100644
--- a/resources/libraries/python/LispUtil.py
+++ b/resources/libraries/python/LispUtil.py
@@ -30,7 +30,7 @@ class LispUtil(object):
:param node: VPP node.
:type node: dict
- :return: Lisp gpe state.
+ :returns: Lisp gpe state.
:rtype: list
"""
@@ -48,7 +48,7 @@ class LispUtil(object):
retrieved - local, remote, empty string = both.
:type node: dict
:type items_filter: str
- :return: Lisp locator_set data as python list.
+ :returns: Lisp locator_set data as python list.
:rtype: list
"""
@@ -66,7 +66,7 @@ class LispUtil(object):
:param node: VPP node.
:type node: dict
- :return: Lisp eid table as python list.
+ :returns: Lisp eid table as python list.
:rtype: list
"""
@@ -80,7 +80,7 @@ class LispUtil(object):
:param node: VPP node.
:type node: dict
- :return: Lisp map resolver as python list.
+ :returns: Lisp map resolver as python list.
:rtype: list
"""
@@ -135,7 +135,7 @@ class LispUtil(object):
:param locator_set_number: Generate n locator_set.
:type node: dict
:type locator_set_number: str
- :return: list of lisp locator_set, list of lisp locator_set expected
+ :returns: list of lisp locator_set, list of lisp locator_set expected
from VAT.
:rtype: tuple
"""
@@ -181,7 +181,7 @@ class LispUtil(object):
:param locator_set_number: Generate n locator_set.
:type node: dict
:type locator_set_number: str
- :return: list of lisp locator_set, list of lisp locator_set expected
+ :returns: list of lisp locator_set, list of lisp locator_set expected
from VAT.
:rtype: tuple
"""
@@ -211,7 +211,7 @@ class LispUtil(object):
locator_set_list.append(locator_set)
locator_set_vat = {"ls_name": l_name,
- "ls_index": num}
+ "ls_index": num}
locator_set_list_vat.append(locator_set_vat)
return locator_set_list, locator_set_list_vat
diff --git a/resources/libraries/python/Map.py b/resources/libraries/python/Map.py
index a1db3a8461..a066567ab2 100644
--- a/resources/libraries/python/Map.py
+++ b/resources/libraries/python/Map.py
@@ -44,7 +44,7 @@ class Map(object):
:type psid_offset: int
:type psid_len: int
:type map_t: bool
- :return: Index of created map domain.
+ :returns: Index of created map domain.
:rtype: int
:raises RuntimeError: If unable to add map domain.
"""
@@ -124,8 +124,7 @@ class Map(object):
:type port: int
:type psid_len: int
:type psid_offset: int
-
- :return: PSID.
+ :returns: PSID.
:rtype: int
"""
ones = 2**16-1
@@ -149,10 +148,10 @@ class Map(object):
:type ea_bit_len: int
:type psid_len: int
:type psid: int
- :return: Number representing EA bit field of destination IPv6 address.
+ :returns: Number representing EA bit field of destination IPv6 address.
:rtype: int
"""
- v4_suffix_len = ipv4_net._max_prefixlen - ipv4_net.prefixlen
+ v4_suffix_len = ipv4_net.max_prefixlen - ipv4_net.prefixlen
v4_suffix = ipv4_net.network_address._ip ^ ipv4_host._ip
if ipv4_net.prefixlen + ea_bit_len <= 32:
@@ -181,12 +180,12 @@ class Map(object):
:type dst_ip: ipaddress.IPv4Address
:type ea_bit_len: int
:type psid: int
- :return: Number representing interface id field of destination IPv6
+ :returns: Number representing interface id field of destination IPv6
address.
:rtype: int
"""
if rule_net.prefixlen + ea_bit_len < 32:
- v4_suffix_len = rule_net._max_prefixlen - rule_net.prefixlen
+ v4_suffix_len = rule_net.max_prefixlen - rule_net.prefixlen
v4_suffix = rule_net.network_address._ip ^ dst_ip._ip
ea_bits = v4_suffix >> (v4_suffix_len - ea_bit_len)
address = rule_net.network_address._ip >> v4_suffix_len
@@ -194,12 +193,8 @@ class Map(object):
address |= ea_bits
address <<= 32 - rule_net.prefixlen - ea_bit_len
address <<= 16
- # psid_field = 0
- # address = address | psid_field
elif rule_net.prefixlen + ea_bit_len == 32:
address = dst_ip._ip << 16
- # psid_field = 0
- # address = address | psid_field
else:
address = dst_ip._ip << 16
address |= psid
@@ -235,22 +230,20 @@ class Map(object):
:type psid_len: int
:type ipv4_dst: str
:type dst_port: int
- :return: Computed IPv6 address.
+ :returns: Computed IPv6 address.
:rtype: str
"""
ipv6_net = ipaddress.ip_network(unicode(ipv6_pfx))
ipv4_net = ipaddress.ip_network(unicode(ipv4_pfx))
ipv4_host = ipaddress.ip_address(unicode(ipv4_dst))
- ipv6_host_len = ipv6_net._max_prefixlen - ipv6_net.prefixlen
- ipv4_host_len = ipv4_net._max_prefixlen - ipv4_net.prefixlen
+ ipv6_host_len = ipv6_net.max_prefixlen - ipv6_net.prefixlen
end_user_v6_pfx_len = ipv6_net.prefixlen + ea_bit_len
psid = Map.get_psid_from_port(dst_port, psid_len, psid_offset)
rule_v6_pfx = ipv6_net.network_address._ip >> ipv6_host_len
ea_bits = Map._make_ea_bits(ipv4_net, ipv4_host, ea_bit_len, psid_len,
psid)
- subnet_id = 0
interface_id = Map._make_interface_id(ipv4_net, ipv4_host, ea_bit_len,
psid)
@@ -276,7 +269,7 @@ class Map(object):
:param ipv4_src: IPv4 source address
:type ipv6_pfx: str
:type ipv4_src: str
- :return: IPv6 address, combination of IPv6 prefix and IPv4 address.
+ :returns: IPv6 address, combination of IPv6 prefix and IPv4 address.
:rtype: str
"""
ipv6_net = ipaddress.ip_network(unicode(ipv6_pfx))
diff --git a/resources/libraries/python/NodePath.py b/resources/libraries/python/NodePath.py
index dfcee4d720..8ee29b234d 100644
--- a/resources/libraries/python/NodePath.py
+++ b/resources/libraries/python/NodePath.py
@@ -101,7 +101,6 @@ class NodePath(object):
.. note:: First add at least two nodes to the topology.
"""
nodes = self._nodes
- nodes_filer = self._nodes_filter
if len(nodes) < 2:
raise RuntimeError('Not enough nodes to compute path')
@@ -144,7 +143,7 @@ class NodePath(object):
def next_interface(self):
"""Path interface iterator.
- :return: Interface and node or None if not next interface.
+ :returns: Interface and node or None if not next interface.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@ -157,7 +156,7 @@ class NodePath(object):
def first_interface(self):
"""Return first interface on the path.
- :return: Interface and node.
+ :returns: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@ -169,7 +168,7 @@ class NodePath(object):
def last_interface(self):
"""Return last interface on the path.
- :return: Interface and node.
+ :returns: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@ -181,7 +180,7 @@ class NodePath(object):
def first_ingress_interface(self):
"""Return first ingress interface on the path.
- :return: Interface and node.
+ :returns: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@ -193,7 +192,7 @@ class NodePath(object):
def last_egress_interface(self):
"""Return last egress interface on the path.
- :return: Interface and node.
+ :returns: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
diff --git a/resources/libraries/python/PacketVerifier.py b/resources/libraries/python/PacketVerifier.py
index bbfdfe8688..793a8feb4b 100644
--- a/resources/libraries/python/PacketVerifier.py
+++ b/resources/libraries/python/PacketVerifier.py
@@ -51,7 +51,7 @@
chksum = 0xa607
src = 11.11.11.11
dst = 11.11.11.10
- \options \
+ options
###[ ICMP ]###
type = echo-reply
code = 0
@@ -74,7 +74,8 @@ from scapy.layers.inet6 import IPv6
__all__ = ['RxQueue', 'TxQueue', 'Interface', 'create_gratuitous_arp_request',
'auto_pad', 'checksum_equal']
-# TODO: http://stackoverflow.com/questions/320232/ensuring-subprocesses-are-dead-on-exiting-python-program
+# TODO: http://stackoverflow.com/questions/320232/
+# ensuring-subprocesses-are-dead-on-exiting-python-program
class PacketVerifier(object):
@@ -97,7 +98,7 @@ def extract_one_packet(buf):
:param buf: String representation of incoming packet buffer.
:type buf: str
- :return: String representation of first packet in buf.
+ :returns: String representation of first packet in buf.
:rtype: str
"""
pkt_len = 0
@@ -105,11 +106,6 @@ def extract_one_packet(buf):
if len(buf) < 60:
return None
- # print
- # print buf.__repr__()
- # print Ether(buf).__repr__()
- # print len(Ether(buf))
- # print
try:
ether_type = Ether(buf[0:14]).type
except AttributeError:
@@ -182,7 +178,7 @@ def packet_reader(interface_name, queue):
:param queue: Queue in which this function will push incoming packets.
:type interface_name: str
:type queue: multiprocessing.Queue
- :return: None
+ :returns: None
"""
sock = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, ETH_P_ALL)
sock.bind((interface_name, ETH_P_ALL))
@@ -218,7 +214,7 @@ class RxQueue(PacketVerifier):
:type ignore: list
:type verbose: bool
- :return: Ether() initialized object from packet data.
+ :returns: Ether() initialized object from packet data.
:rtype: scapy.Ether
"""
(rlist, _, _) = select.select([self._sock], [], [], timeout)
@@ -227,7 +223,7 @@ class RxQueue(PacketVerifier):
pkt = self._sock.recv(0x7fff)
pkt_pad = auto_pad(pkt)
- print 'Received packet on {0} of len {1}'.format(self._ifname, len(pkt))
+ print'Received packet on {0} of len {1}'.format(self._ifname, len(pkt))
if verbose:
Ether(pkt).show2()
print
@@ -299,7 +295,7 @@ class Interface(object):
:param timeout: Timeout value in seconds.
:type timeout: int
- :return: Ether() initialized object from packet data.
+ :returns: Ether() initialized object from packet data.
:rtype: scapy.Ether
"""
return self.rxq.recv(timeout, self.sent_packets)
@@ -332,7 +328,7 @@ def checksum_equal(chksum1, chksum2):
:type chksum1: uint16
:type chksum2: uint16
- :return: True if checksums are equivalent, False otherwise.
+ :returns: True if checksums are equivalent, False otherwise.
:rtype: boolean
"""
if chksum1 == 0xFFFF:
diff --git a/resources/libraries/python/Policer.py b/resources/libraries/python/Policer.py
index 6098ac0402..b95fd739fc 100644
--- a/resources/libraries/python/Policer.py
+++ b/resources/libraries/python/Policer.py
@@ -22,7 +22,6 @@ from resources.libraries.python.VatJsonUtil import VatJsonUtil
from resources.libraries.python.topology import Topology
-# pylint: disable=too-few-public-methods
class PolicerRateType(Enum):
"""Policer rate types."""
KBPS = 'kbps'
@@ -111,7 +110,6 @@ class PolicerClassifyTableType(Enum):
# pylint: disable=too-many-instance-attributes
-# pylint: disable=too-many-public-methods
class Policer(object):
"""Policer utilities."""
@@ -175,7 +173,6 @@ class Policer(object):
exceed_action=exceed_action,
violate_action=violate_action,
color_aware=color_aware)
- # pylint: enable=no-member
VatJsonUtil.verify_vat_retval(
out[0],
@@ -187,7 +184,7 @@ class Policer(object):
# create classify table
direction = 'src' if self._classify_match_is_src else 'dst'
- if 6 == ip_address(unicode(self._classify_match_ip)).version:
+ if ip_address(unicode(self._classify_match_ip)).version == 6:
ip_version = 'ip6'
table_type = PolicerClassifyTableType.IP6_TABLE
else:
diff --git a/resources/libraries/python/Routing.py b/resources/libraries/python/Routing.py
index 73c58e2053..2da7c1ac8d 100644
--- a/resources/libraries/python/Routing.py
+++ b/resources/libraries/python/Routing.py
@@ -21,7 +21,6 @@ from resources.libraries.python.ssh import exec_cmd_no_error
class Routing(object):
"""Routing utilities."""
- # pylint: disable=too-many-arguments
@staticmethod
def vpp_route_add(node, network, prefix_len, gateway=None,
interface=None, use_sw_index=True, resolve_attempts=10,
diff --git a/resources/libraries/python/SetupFramework.py b/resources/libraries/python/SetupFramework.py
index 5d3d59ab56..82c4ae2a65 100644
--- a/resources/libraries/python/SetupFramework.py
+++ b/resources/libraries/python/SetupFramework.py
@@ -71,7 +71,7 @@ def copy_tarball_to_node(tarball, node):
:param node: Dictionary created from topology.
:type tarball: str
:type node: dict
- :return: nothing
+ :returns: nothing
"""
logger.console('Copying tarball to {0}'.format(node['host']))
ssh = SSH()
@@ -89,7 +89,7 @@ def extract_tarball_at_node(tarball, node):
:param node: Dictionary created from topology.
:type tarball: str
:type node: dict
- :return: nothing
+ :returns: nothing
"""
logger.console('Extracting tarball to {0} on {1}'.format(
con.REMOTE_FW_DIR, node['host']))
@@ -133,8 +133,7 @@ def setup_node(args):
:param args: All parameters needed to setup one node.
:type args: tuple
- :return: nothing
- :return: True - success, False - error
+ :returns: True - success, False - error
:rtype: bool
"""
tarball, remote_tarball, node = args
@@ -156,12 +155,12 @@ def delete_local_tarball(tarball):
:param tarball: Path to tarball to upload.
:type tarball: str
- :return: nothing
+ :returns: nothing
"""
call(split('sh -c "rm {0} > /dev/null 2>&1"'.format(tarball)))
-class SetupFramework(object): # pylint: disable=too-few-public-methods
+class SetupFramework(object):
"""Setup suite run on topology nodes.
Many VAT/CLI based tests need the scripts at remote hosts before executing
@@ -199,4 +198,3 @@ class SetupFramework(object): # pylint: disable=too-few-public-methods
logger.trace('Test framework copied to all topology nodes')
delete_local_tarball(tarball)
logger.console('All nodes are ready')
-
diff --git a/resources/libraries/python/Trace.py b/resources/libraries/python/Trace.py
index 49b39cbdfb..c61a8deda4 100644
--- a/resources/libraries/python/Trace.py
+++ b/resources/libraries/python/Trace.py
@@ -11,14 +11,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+"""Packet trace library."""
+
from resources.libraries.python.VatExecutor import VatExecutor
from resources.libraries.python.topology import NodeType
class Trace(object):
+ """This class provides methods to manipulate the VPP packet trace."""
@staticmethod
def show_packet_trace_on_all_duts(nodes):
+ """Show VPP packet trace.
+
+ :param nodes: Nodes from which the packet trace will be displayed.
+ :type nodes: list
+ """
for node in nodes.values():
if node['type'] == NodeType.DUT:
vat = VatExecutor()
@@ -26,8 +34,12 @@ class Trace(object):
@staticmethod
def clear_packet_trace_on_all_duts(nodes):
+ """Clear VPP packet trace.
+
+ :param nodes: Nodes where the packet trace will be cleared.
+ :type nodes: list
+ """
for node in nodes.values():
if node['type'] == NodeType.DUT:
vat = VatExecutor()
vat.execute_script("clear_trace.vat", node, json_out=False)
-
diff --git a/resources/libraries/python/TrafficGenerator.py b/resources/libraries/python/TrafficGenerator.py
index 87437d8284..8d187c92dc 100644
--- a/resources/libraries/python/TrafficGenerator.py
+++ b/resources/libraries/python/TrafficGenerator.py
@@ -56,9 +56,9 @@ class TGDropRateSearchImpl(DropRateSearch):
tg_instance = BuiltIn().get_library_instance(
'resources.libraries.python.TrafficGenerator')
- if tg_instance._node['subtype'] is None:
+ if tg_instance.node['subtype'] is None:
raise RuntimeError('TG subtype not defined')
- elif tg_instance._node['subtype'] == NodeSubTypeTG.TREX:
+ elif tg_instance.node['subtype'] == NodeSubTypeTG.TREX:
unit_rate = str(rate) + self.get_rate_type_str()
tg_instance.trex_stl_start_remote_exec(self.get_duration(),
unit_rate, frame_size,
@@ -88,6 +88,7 @@ class TGDropRateSearchImpl(DropRateSearch):
'resources.libraries.python.TrafficGenerator')
return tg_instance.get_latency_int()
+
class TrafficGenerator(object):
"""Traffic Generator."""
@@ -104,6 +105,15 @@ class TrafficGenerator(object):
# T-REX interface order mapping
self._ifaces_reordered = 0
+ @property
+ def node(self):
+ """Getter.
+
+ :returns: Traffic generator node.
+ :rtype: dict
+ """
+ return self._node
+
def get_loss(self):
"""Return number of lost packets.
diff --git a/resources/libraries/python/VPPUtil.py b/resources/libraries/python/VPPUtil.py
index 32e1bb4e7b..da59d1958d 100644
--- a/resources/libraries/python/VPPUtil.py
+++ b/resources/libraries/python/VPPUtil.py
@@ -26,7 +26,7 @@ class VPPUtil(object):
:param node: VPP node.
:param additional_cmds: Additional commands that the vpp should print
- settings for.
+ settings for.
:type node: dict
:type additional_cmds: tuple
"""
@@ -44,9 +44,5 @@ class VPPUtil(object):
def_setting_tb_displayed['Custom Setting: {}'.format(cmd)] = cmd
ssh = SSH()
ssh.connect(node)
- print("=" * 40)
- for key, value in def_setting_tb_displayed.iteritems():
- (_, stdout, _) = ssh.exec_command_sudo('vppctl sh {}'.format(value))
- print("{} : {} \n".format(key, value))
- print(stdout)
- print("=" * 40)
+ for _, value in def_setting_tb_displayed.items():
+ ssh.exec_command_sudo('vppctl sh {}'.format(value))
diff --git a/resources/libraries/python/VatExecutor.py b/resources/libraries/python/VatExecutor.py
index 03b7321020..bbce83d1ad 100644
--- a/resources/libraries/python/VatExecutor.py
+++ b/resources/libraries/python/VatExecutor.py
@@ -30,7 +30,7 @@ def cleanup_vat_json_output(json_output):
Clean up VAT JSON output from clutter like vat# prompts and such.
:param json_output: Cluttered JSON output.
- :return: Cleaned up output JSON string.
+ :returns: Cleaned up output JSON string.
"""
retval = json_output
@@ -187,9 +187,8 @@ class VatTerminal(object):
"""
logger.debug("Executing command in VAT terminal: {}".format(cmd))
try:
- out = self._ssh.interactive_terminal_exec_command(self._tty,
- cmd,
- self.__VAT_PROMPT)
+ out = self._ssh.interactive_terminal_exec_command(self._tty, cmd,
+ self.__VAT_PROMPT)
except:
self._exec_failure = True
raise
@@ -201,10 +200,10 @@ class VatTerminal(object):
array_start = out.find('[')
array_end = out.rfind(']')
- if -1 == obj_start and -1 == array_start:
+ if obj_start == -1 and array_start == -1:
raise RuntimeError("VAT: no JSON data.")
- if obj_start < array_start or -1 == array_start:
+ if obj_start < array_start or array_start == -1:
start = obj_start
end = obj_end + 1
else:
diff --git a/resources/libraries/python/VppCounters.py b/resources/libraries/python/VppCounters.py
index e755c75673..6b2265db27 100644
--- a/resources/libraries/python/VppCounters.py
+++ b/resources/libraries/python/VppCounters.py
@@ -152,7 +152,7 @@ class VppCounters(object):
:param node: Node to dump stats table on.
:type node: dict
- :return: Stats table.
+ :returns: Stats table.
"""
with VatTerminal(node) as vat:
vat.vat_terminal_exec_cmd('want_stats enable')
@@ -166,9 +166,27 @@ class VppCounters(object):
return None
def vpp_get_ipv4_interface_counter(self, node, interface):
+ """
+
+ :param node: Node to get interface IPv4 counter on.
+ :param interface: Interface name.
+ :type node: dict
+ :type interface: str
+ :returns: Interface IPv4 counter.
+ :rtype: int
+ """
return self.vpp_get_ipv46_interface_counter(node, interface, False)
def vpp_get_ipv6_interface_counter(self, node, interface):
+ """
+
+ :param node: Node to get interface IPv6 counter on.
+ :param interface: Interface name.
+ :type node: dict
+ :type interface: str
+ :returns: Interface IPv6 counter.
+ :rtype: int
+ """
return self.vpp_get_ipv46_interface_counter(node, interface, True)
def vpp_get_ipv46_interface_counter(self, node, interface, is_ipv6=True):
@@ -180,7 +198,7 @@ class VppCounters(object):
:type node: dict
:type interface: str
:type is_ipv6: bool
- :return: Interface IPv4/IPv6 counter.
+ :returns: Interface IPv4/IPv6 counter.
:rtype: int
"""
version = 'ip6' if is_ipv6 else 'ip4'
diff --git a/resources/libraries/python/constants.py b/resources/libraries/python/constants.py
index 2978f46759..a280b51beb 100644
--- a/resources/libraries/python/constants.py
+++ b/resources/libraries/python/constants.py
@@ -11,8 +11,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+"""Constants used in CSIT."""
+
class Constants(object):
+ """Constants used in CSIT."""
+
# OpenVPP testing directory location at topology nodes
REMOTE_FW_DIR = '/tmp/openvpp-testing'
diff --git a/resources/libraries/python/honeycomb/HcAPIKwACL.py b/resources/libraries/python/honeycomb/HcAPIKwACL.py
index 8d1746d0ad..0cde6d4824 100644
--- a/resources/libraries/python/honeycomb/HcAPIKwACL.py
+++ b/resources/libraries/python/honeycomb/HcAPIKwACL.py
@@ -289,8 +289,7 @@ class ACLKeywords(object):
suffix_dict = {"l2": "eth",
"l3_ip4": "ipv4",
"l3_ip6": "ipv6",
- "mixed": "mixed"
- }
+ "mixed": "mixed"}
try:
suffix = suffix_dict[layer]
except KeyError:
@@ -385,8 +384,8 @@ class ACLKeywords(object):
}
except KeyError:
raise ValueError("Unknown network layer {0}. "
- "Valid options are: {1}".format(
- layer, layers.keys()))
+ "Valid options are: {1}".
+ format(layer, layers.keys()))
status_code, resp = HcUtil.put_honeycomb_data(
node, "config_vpp_interfaces", data, path)
diff --git a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
index 01a2eba0ad..5658eea146 100644
--- a/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
+++ b/resources/libraries/python/honeycomb/HcAPIKwInterfaces.py
@@ -27,8 +27,6 @@ from resources.libraries.python.honeycomb.HoneycombUtil \
import HoneycombUtil as HcUtil
-# pylint: disable=too-many-public-methods
-# pylint: disable=too-many-lines
class InterfaceKeywords(object):
"""Keywords for Interface manipulation.
@@ -1291,7 +1289,7 @@ class InterfaceKeywords(object):
node, super_interface, path, address)
@staticmethod
- def remove_all_ipv4_addresses_from_sub_interface(node, super_interface, # pylint: disable=invalid-name
+ def remove_all_ipv4_addresses_from_sub_interface(node, super_interface,
identifier):
"""Remove all ipv4 addresses from the specified sub-interface.
diff --git a/resources/libraries/python/honeycomb/HoneycombUtil.py b/resources/libraries/python/honeycomb/HoneycombUtil.py
index f607c2439a..747c9dae8e 100644
--- a/resources/libraries/python/honeycomb/HoneycombUtil.py
+++ b/resources/libraries/python/honeycomb/HoneycombUtil.py
@@ -126,7 +126,7 @@ class HoneycombUtil(object):
:param url_file: URL file. The argument contains only the name of file
without extension, not the full path.
:type url_file: str
- :return: Requested path.
+ :returns: Requested path.
:rtype: str
"""
@@ -178,7 +178,7 @@ class HoneycombUtil(object):
:param path: Path to data we want to find.
:type data: dict
:type path: tuple
- :return: Data represented by path.
+ :returns: Data represented by path.
:rtype: str, dict, or list
:raises HoneycombError: If the data has not been found.
"""
@@ -205,7 +205,7 @@ class HoneycombUtil(object):
:param path: Path to data we want to remove.
:type data: dict
:type path: tuple
- :return: Original data without removed part.
+ :returns: Original data without removed part.
:rtype: dict
"""
@@ -245,7 +245,7 @@ class HoneycombUtil(object):
:type data: dict
:type path: tuple
:type new_value: str, dict or list
- :return: Original data with the new value.
+ :returns: Original data with the new value.
:rtype: dict
"""
@@ -295,14 +295,14 @@ class HoneycombUtil(object):
:type node: dict
:type url_file: str
:type path: str
- :return: Status code and content of response.
+ :returns: Status code and content of response.
:rtype tuple
"""
base_path = HoneycombUtil.read_path_from_url_file(url_file)
path = base_path + path
status_code, resp = HTTPRequest.get(node, path)
- (status_node, response) = status_code, loads(resp)
+ response = loads(resp)
if status_code != HTTPCodes.OK:
HoneycombUtil.read_log_tail(node)
return status_code, response
@@ -324,7 +324,7 @@ class HoneycombUtil(object):
:type data: dict, str
:type path: str
:type data_representation: DataRepresentation
- :return: Status code and content of response.
+ :returns: Status code and content of response.
:rtype: tuple
:raises HoneycombError: If the given data representation is not defined
in HEADERS.
@@ -368,7 +368,7 @@ class HoneycombUtil(object):
:type data: dict, str
:type data_representation: DataRepresentation
:type timeout: int
- :return: Status code and content of response.
+ :returns: Status code and content of response.
:rtype: tuple
:raises HoneycombError: If the given data representation is not defined
in HEADERS.
@@ -401,7 +401,7 @@ class HoneycombUtil(object):
:type node: dict
:type url_file: str
:type path: str
- :return: Status code and content of response.
+ :returns: Status code and content of response.
:rtype tuple
"""
@@ -422,7 +422,7 @@ class HoneycombUtil(object):
:param lines: Number of lines to read.
:type node: dict
:type lines: int
- :return: Last N log lines.
+ :returns: Last N log lines.
:rtype: str
"""
diff --git a/resources/libraries/python/honeycomb/Netconf.py b/resources/libraries/python/honeycomb/Netconf.py
index 3c98387334..e3cdbe5dce 100644
--- a/resources/libraries/python/honeycomb/Netconf.py
+++ b/resources/libraries/python/honeycomb/Netconf.py
@@ -14,10 +14,10 @@
"""Keywords used to connect to Honeycomb through Netconf, send messages
and receive replies."""
+import socket
from time import time
import paramiko
-import socket
from robot.api import logger
from interruptingcow import timeout
@@ -61,8 +61,7 @@ class Netconf(object):
password=node['honeycomb']['passwd'],
pkey=None,
port=node['honeycomb']['netconf_port'],
- timeout=time_out,
- )
+ timeout=time_out)
logger.trace('Connect took {0} seconds'.format(time() - start))
logger.debug('New ssh: {0}'.format(client))
@@ -102,7 +101,7 @@ class Netconf(object):
:type size:int
:type time_out:int
:type err:str
- :return: Content of response.
+ :returns: Content of response.
:rtype: str
:raises HoneycombError: If the read process times out.
"""
@@ -123,13 +122,11 @@ class Netconf(object):
break
except socket.timeout:
raise HoneycombError("Socket timeout.",
- enable_logging=False
- )
+ enable_logging=False)
except RuntimeError:
raise HoneycombError(err + " Content of buffer: {0}".format(reply),
- enable_logging=False
- )
+ enable_logging=False)
logger.trace(reply)
return reply.replace(self.delimiter, "")
@@ -142,7 +139,7 @@ class Netconf(object):
:param time_out: Timeout value for getting the complete response.
:type size:int
:type time_out:int
- :return: Content of response.
+ :returns: Content of response.
:rtype: str
"""
diff --git a/resources/libraries/python/parsers/__init__.py b/resources/libraries/python/parsers/__init__.py
index 5a0e0e1c5e..1b58a3cf17 100644
--- a/resources/libraries/python/parsers/__init__.py
+++ b/resources/libraries/python/parsers/__init__.py
@@ -10,3 +10,7 @@
# 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.
+
+"""
+__init__ file for resources/libraries/python/parsers
+"""
diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py
index 4b3838bbb7..90ac0be2dc 100644
--- a/resources/libraries/python/ssh.py
+++ b/resources/libraries/python/ssh.py
@@ -301,7 +301,7 @@ def exec_cmd(node, cmd, timeout=600, sudo=False):
ssh = SSH()
try:
ssh.connect(node)
- except Exception as err:
+ except SSHException as err:
logger.error("Failed to connect to node" + str(err))
return None, None, None
@@ -311,7 +311,7 @@ def exec_cmd(node, cmd, timeout=600, sudo=False):
else:
(ret_code, stdout, stderr) = ssh.exec_command_sudo(cmd,
timeout=timeout)
- except Exception as err:
+ except SSHException as err:
logger.error(err)
return None, None, None
diff --git a/resources/libraries/python/telemetry/IPFIXUtil.py b/resources/libraries/python/telemetry/IPFIXUtil.py
index 1b193f8325..2f83760759 100644
--- a/resources/libraries/python/telemetry/IPFIXUtil.py
+++ b/resources/libraries/python/telemetry/IPFIXUtil.py
@@ -86,8 +86,7 @@ class IPFIXHeader(Packet):
IntField("Sequence Number", 0),
IntField("Observation Domain ID", 0),
ShortField("Set_ID", 0),
- ShortField("Set_Length", 0)
- ]
+ ShortField("Set_Length", 0)]
class IPFIXTemplate(Packet):
@@ -96,8 +95,7 @@ class IPFIXTemplate(Packet):
fields_desc = [ShortField("Template_ID", 256),
ShortField("nFields", 2),
FieldListField("Template", [], ShortField("type_len", ""),
- count_from=lambda p: p.nFields*2)
- ]
+ count_from=lambda p: p.nFields*2)]
class IPFIXData(Packet):
diff --git a/resources/libraries/python/telemetry/SPAN.py b/resources/libraries/python/telemetry/SPAN.py
index aff465c0ea..41ff7d34f1 100644
--- a/resources/libraries/python/telemetry/SPAN.py
+++ b/resources/libraries/python/telemetry/SPAN.py
@@ -17,7 +17,6 @@ from resources.libraries.python.topology import Topology
from resources.libraries.python.VatExecutor import VatTerminal
-# pylint: disable=too-few-public-methods
class SPAN(object):
"""Class contains methods for setting up SPAN mirroring on DUTs."""
@@ -43,8 +42,7 @@ class SPAN(object):
with VatTerminal(node, json_param=False) as vat:
vat.vat_terminal_exec_cmd_from_template('span_create.vat',
src_sw_if_index=src_if,
- dst_sw_if_index=dst_if,
- )
+ dst_sw_if_index=dst_if)
@staticmethod
def vpp_get_span_configuration(node):
diff --git a/resources/libraries/python/telemetry/__init__.py b/resources/libraries/python/telemetry/__init__.py
index 5a0e0e1c5e..cc11de329f 100644
--- a/resources/libraries/python/telemetry/__init__.py
+++ b/resources/libraries/python/telemetry/__init__.py
@@ -10,3 +10,7 @@
# 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.
+
+"""
+__init__ file for resources/libraries/python/telemetry
+"""
diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py
index 0214cc9c02..8a591dfd14 100644
--- a/resources/libraries/python/topology.py
+++ b/resources/libraries/python/topology.py
@@ -18,7 +18,7 @@ from collections import Counter
from yaml import load
from robot.api import logger
-from robot.libraries.BuiltIn import BuiltIn
+from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
from robot.api.deco import keyword
__all__ = ["DICT__nodes", 'Topology']
@@ -27,11 +27,11 @@ __all__ = ["DICT__nodes", 'Topology']
def load_topo_from_yaml():
"""Load topology from file defined in "${TOPOLOGY_PATH}" variable.
- :return: Nodes from loaded topology.
+ :returns: Nodes from loaded topology.
"""
try:
topo_path = BuiltIn().get_variable_value("${TOPOLOGY_PATH}")
- except:
+ except RobotNotRunningError:
return ''
with open(topo_path) as work_file:
@@ -312,7 +312,7 @@ class Topology(object):
try:
if isinstance(iface_key, basestring):
return node['interfaces'][iface_key].get('vpp_sw_index')
- #FIXME: use only iface_key, do not use integer
+ # TODO: use only iface_key, do not use integer
else:
return int(iface_key)
except (KeyError, ValueError):
diff --git a/resources/libraries/robot/lisp/l2lisp.robot b/resources/libraries/robot/lisp/l2lisp.robot
index 78bca5487c..c393493fa2 100644
--- a/resources/libraries/robot/lisp/l2lisp.robot
+++ b/resources/libraries/robot/lisp/l2lisp.robot
@@ -53,7 +53,7 @@
| | ... | ${settings['weight']}
| | Vpp Lisp Eid Table Mapping | ${dut_node}
| | ... | ${settings['vni']}
-| | ... | bd=${settings['bd']}
+| | ... | bd_id=${settings['bd']}
| | Vpp Add Lisp Local Eid | ${dut_node}
| | ... | ${settings['locator_name']}
| | ... | ${settings['vni']}