Fix pylint part 1 10/14610/3
authorPeter Mikus <pmikus@cisco.com>
Sat, 1 Sep 2018 15:29:37 +0000 (15:29 +0000)
committerPeter Mikus <pmikus@cisco.com>
Tue, 4 Sep 2018 07:29:54 +0000 (07:29 +0000)
- Decrease pylint errors. Part: easy

Change-Id: I452e5b5a11e9b78c03cd173a3848babe21b93c73
Signed-off-by: Peter Mikus <pmikus@cisco.com>
resources/libraries/python/DMM/SingleCliSer.py
resources/libraries/python/DPDK/L3fwdTest.py
resources/libraries/python/InterfaceUtil.py
resources/libraries/python/TrafficGenerator.py
resources/libraries/python/autogen/Regenerator.py
resources/libraries/python/autogen/Testcase.py
resources/libraries/python/honeycomb/DHCP.py
resources/libraries/python/honeycomb/FIB.py
resources/libraries/python/honeycomb/Routing.py

index 504f59c..9bf18bb 100644 (file)
@@ -111,3 +111,4 @@ class SingleCliSer(object):
         else:
             logger.console('....log_install_dmm on node {1}.... {0}'
                            .format(stdout, dut_node['host']))
+
index 8cf63a8..84c623e 100644 (file)
@@ -140,7 +140,8 @@ class L3fwdTest(object):
             '{fwdir}/tests/dpdk/dpdk_scripts/patch_l3fwd.sh {arch} '
             '{fwdir}/tests/dpdk/dpdk_scripts/{patch}'.
             format(fwdir=Constants.REMOTE_FW_DIR, arch=arch, patch=patch),
-                   timeout=600)
+            timeout=600)
 
         if ret_code != 0:
-            raise RuntimeError('Patch of l3fwd failed.')
\ No newline at end of file
+            raise RuntimeError('Patch of l3fwd failed.')
+
index 7286633..94cee5e 100644 (file)
@@ -933,11 +933,11 @@ class InterfaceUtil(object):
             the node.
         """
         hw_addr = '' if mac is None else 'hw-addr {mac}'.format(mac=mac)
-        lb = '' if load_balance is None \
-            else 'lb {lb}'.format(lb=load_balance)
+        ldb = '' if load_balance is None \
+            else 'lb {ldb}'.format(ldb=load_balance)
 
         output = VatExecutor.cmd_from_template(
-            node, 'create_bond_interface.vat', mode=mode, lb=lb, mac=hw_addr)
+            node, 'create_bond_interface.vat', mode=mode, lb=ldb, mac=hw_addr)
 
         if output[0].get('retval') == 0:
             sw_if_idx = output[0].get('sw_if_index')
@@ -945,8 +945,8 @@ class InterfaceUtil(object):
             if_key = Topology.get_interface_by_sw_index(node, sw_if_idx)
             return if_key
         else:
-            raise RuntimeError('Create bond interface failed on node "{n}"'
-                               .format(n=node['host']))
+            raise RuntimeError('Create bond interface failed on "{host}"'
+                               .format(host=node['host']))
 
     @staticmethod
     def add_bond_eth_interface(node, ifc_name=None, sw_if_idx=None):
index 1398072..36a8385 100644 (file)
@@ -107,9 +107,9 @@ class TrafficGenerator(AbstractMeasurer):
     FIXME: Describe API."""
 
     # TODO: Decrease friction between various search and rate provider APIs.
-    # FIXME: Remove "trex" from lines which could work with other TGs.
+    # TODO: Remove "trex" from lines which could work with other TGs.
 
-    # use one instance of TrafficGenerator for all tests in test suite
+    # Use one instance of TrafficGenerator for all tests in test suite
     ROBOT_LIBRARY_SCOPE = 'TEST SUITE'
 
     def __init__(self):
index e7e0370..7a57676 100644 (file)
@@ -16,7 +16,6 @@
 from glob import glob
 from os import getcwd
 
-from .Testcase import Testcase
 from .DefaultTestcase import DefaultTestcase
 
 
@@ -63,6 +62,13 @@ class Regenerator(object):
         }
 
         def get_iface_and_suite_id(filename):
+            """Get interface and suite ID.
+
+            :param filename: Suite file.
+            :type filename: str
+            :returns: Interface ID, Suite ID.
+            :rtype: tuple
+            """
             dash_split = filename.split("-", 1)
             if len(dash_split[0]) <= 4:
                 # It was something like "2n1l", we need one more split.
@@ -70,12 +76,38 @@ class Regenerator(object):
             return dash_split[0], dash_split[1].split(".", 1)[0]
 
         def add_testcase(testcase, iface, file_out, num, **kwargs):
+            """Add testcase to file.
+
+            :param testcase: Testcase class.
+            :param iface: Interface.
+            :param file_out: File to write testcases to.
+            :param num: Testcase number.
+            :param kwargs: Key-value pairs used to construct testcase.
+            :type testcase: Testcase
+            :type iface: str
+            :type file_out: file
+            :type num: int
+            :type kwargs: dict
+            :returns: Next testcase number.
+            :rtype: int
+            """
             # TODO: Is there a better way to disable some combinations?
             if kwargs["framesize"] != 9000 or "vic1227" not in iface:
                 file_out.write(testcase.generate(num=num, **kwargs))
             return num + 1
 
         def add_testcases(testcase, iface, file_out, tc_kwargs_list):
+            """Add testcases to file.
+
+            :param testcase: Testcase class.
+            :param iface: Interface.
+            :param file_out: File to write testcases to.
+            :param tc_kwargs_list: Key-value pairs used to construct testcase.
+            :type testcase: Testcase
+            :type iface: str
+            :type file_out: file
+            :type tc_kwargs_list: dict
+            """
             num = 1
             for tc_kwargs in tc_kwargs_list:
                 num = add_testcase(testcase, iface, file_out, num, **tc_kwargs)
index 4f92e6c..dd58547 100644 (file)
@@ -49,10 +49,10 @@ class Testcase(object):
         :rtype: str
         """
         try:
-            fs = int(framesize)
+            fsize = int(framesize)
             subst_dict = {
-                "frame_num": "${%d}" % fs,
-                "frame_str": "%dB" % fs
+                "frame_num": "${%d}" % fsize,
+                "frame_str": "%dB" % fsize
             }
         except ValueError:  # Assuming an IMIX string.
             subst_dict = {
index f93a8fd..56cfdb2 100644 (file)
@@ -73,7 +73,8 @@ class DHCPRelayKeywords(object):
         :rtype: bytearray
         """
 
-        path = "/relay/vpp-fib-table-management:{0}/{1}".format(ip_version, entry_id)
+        path = "/relay/vpp-fib-table-management:{0}/{1}".format(ip_version,
+                                                                entry_id)
 
         return DHCPRelayKeywords._set_dhcp_relay_properties(node, path, data)
 
index a5e8ba9..bfccf5a 100644 (file)
@@ -85,7 +85,7 @@ class FibKeywords(object):
                 {
                     "table-id": vrf,
                     "address-family": "vpp-fib-table-management:{0}"
-                    .format(ip_version),
+                                      .format(ip_version),
                     "name": "{0}-VRF:{1}".format(ip_version, vrf)
                 }
             ]
index 8d8f7f4..314c3fe 100644 (file)
@@ -115,7 +115,8 @@ class RoutingKeywords(object):
             ]
         }
 
-        path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format(name)
+        path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format(
+            name)
         return RoutingKeywords._set_routing_table_properties(
             node, path, full_data)
 
@@ -131,7 +132,8 @@ class RoutingKeywords(object):
         :rtype: bytearray
         """
 
-        path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format(name)
+        path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format(
+            name)
         return RoutingKeywords._set_routing_table_properties(node, path)
 
     @staticmethod
@@ -149,7 +151,8 @@ class RoutingKeywords(object):
         :raises HoneycombError: If the operation fails.
         """
 
-        path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format(name)
+        path = "/control-plane-protocol/hc2vpp-ietf-routing:static/{0}".format(
+            name)
         status_code, resp = HcUtil.\
             get_honeycomb_data(node, "oper_routing_table", path)
 
@@ -226,7 +229,7 @@ class RoutingKeywords(object):
                 node, 'config_slaac', path)
         else:
             data = {
-                       'ipv6-router-advertisements': slaac_data
+                'ipv6-router-advertisements': slaac_data
             }
 
             status_code, _ = HcUtil.put_honeycomb_data(