diff options
author | Peter Mikus <pmikus@cisco.com> | 2019-08-07 13:58:59 +0000 |
---|---|---|
committer | Vratko Polak <vrpolak@cisco.com> | 2019-08-07 16:20:35 +0000 |
commit | 6c6b9edc4690f5c4cd86334d706d7c40a81c85cf (patch) | |
tree | 33078dc8f2557a6928a49518e46589ed10b3289f /resources/libraries | |
parent | c8ea6f1fab0b77a0690548fbef825cf902ad4146 (diff) |
FIX: Pylint
- my bad
Signed-off-by: Peter Mikus <pmikus@cisco.com>
Change-Id: I8c1f57f6b648b99338f3f6a6ff9ec943082e9bc4
Diffstat (limited to 'resources/libraries')
-rw-r--r-- | resources/libraries/python/GBP.py | 131 | ||||
-rw-r--r-- | resources/libraries/python/InterfaceUtil.py | 6 | ||||
-rw-r--r-- | resources/libraries/python/PapiExecutor.py | 5 | ||||
-rw-r--r-- | resources/libraries/python/TestConfig.py | 6 | ||||
-rw-r--r-- | resources/libraries/python/topology.py | 3 |
5 files changed, 71 insertions, 80 deletions
diff --git a/resources/libraries/python/GBP.py b/resources/libraries/python/GBP.py index 4dd5486a86..ff0c133934 100644 --- a/resources/libraries/python/GBP.py +++ b/resources/libraries/python/GBP.py @@ -19,7 +19,6 @@ from ipaddress import ip_address from resources.libraries.python.IPUtil import IPUtil from resources.libraries.python.L2Util import L2Util from resources.libraries.python.PapiExecutor import PapiSocketExecutor -from resources.libraries.python.topology import Topology class GBPEndpointFlags(IntEnum): @@ -89,12 +88,12 @@ class GBP(object): .format(node=node['host']) args_in = dict( - rd = dict ( - rd_id = rd_id, - ip4_table_id = ip4_table_id, - ip6_table_id = ip6_table_id, - ip4_uu_sw_if_index = ip4_uu_sw_if_index, - ip6_uu_sw_if_index = ip6_uu_sw_if_index + rd=dict( + rd_id=rd_id, + ip4_table_id=ip4_table_id, + ip6_table_id=ip6_table_id, + ip4_uu_sw_if_index=ip4_uu_sw_if_index, + ip6_uu_sw_if_index=ip6_uu_sw_if_index ) ) @@ -125,14 +124,14 @@ class GBP(object): .format(node=node['host']) args_in = dict( - bd = dict( - flags = getattr(GBPBridgeDomainFlags, - 'GBP_BD_API_FLAG_NONE').value, - bvi_sw_if_index = bvi_sw_if_index, - uu_fwd_sw_if_index = uu_fwd_sw_if_index, - bm_flood_sw_if_index = bm_flood_sw_if_index, - bd_id = bd_id, - rd_id = rd_id + bd=dict( + flags=getattr(GBPBridgeDomainFlags, + 'GBP_BD_API_FLAG_NONE').value, + bvi_sw_if_index=bvi_sw_if_index, + uu_fwd_sw_if_index=uu_fwd_sw_if_index, + bm_flood_sw_if_index=bm_flood_sw_if_index, + bd_id=bd_id, + rd_id=rd_id ) ) @@ -165,14 +164,14 @@ class GBP(object): .format(node=node['host']) args_in = dict( - epg = dict ( - uplink_sw_if_index = uplink_sw_if_index, - bd_id = bd_id, - rd_id = rd_id, - vnid = vnid, - sclass = sclass, - retention = dict ( - remote_ep_timeout = remote_ep_timeout + epg=dict( + uplink_sw_if_index=uplink_sw_if_index, + bd_id=bd_id, + rd_id=rd_id, + vnid=vnid, + sclass=sclass, + retention=dict( + remote_ep_timeout=remote_ep_timeout ) ) ) @@ -208,17 +207,17 @@ class GBP(object): ip_address(unicode('0.0.0.0'))) args_in = dict( - endpoint = dict( - sw_if_index = sw_if_index, - ips = ips, - n_ips = len(ips), - mac = L2Util.mac_to_bin(mac_addr), - sclass = sclass, - flags = getattr(GBPEndpointFlags, - 'GBP_API_ENDPOINT_FLAG_EXTERNAL').value, - tun = dict( - src = tun_src, - dst = tun_dst + endpoint=dict( + sw_if_index=sw_if_index, + ips=ips, + n_ips=len(ips), + mac=L2Util.mac_to_bin(mac_addr), + sclass=sclass, + flags=getattr(GBPEndpointFlags, + 'GBP_API_ENDPOINT_FLAG_EXTERNAL').value, + tun=dict( + src=tun_src, + dst=tun_dst ) ) ) @@ -244,13 +243,13 @@ class GBP(object): .format(node=node['host']) args_in = dict( - is_add = 1, - ext_itf = dict( - sw_if_index = sw_if_index, - bd_id = bd_id, - rd_id = rd_id, - flags = getattr(GBPExtItfFlags, - 'GBP_API_EXT_ITF_F_NONE').value + is_add=1, + ext_itf=dict( + sw_if_index=sw_if_index, + bd_id=bd_id, + rd_id=rd_id, + flags=getattr(GBPExtItfFlags, + 'GBP_API_EXT_ITF_F_NONE').value ) ) @@ -281,18 +280,18 @@ class GBP(object): .format(node=node['host']) args_in = dict( - is_add = 1, - subnet = dict( - type = getattr(GBPSubnetType, - 'GBP_API_SUBNET_L3_OUT').value, - sw_if_index = sw_if_index, - sclass = sclass, - prefix = dict( - address = IPUtil.create_ip_address_object( + is_add=1, + subnet=dict( + type=getattr(GBPSubnetType, + 'GBP_API_SUBNET_L3_OUT').value, + sw_if_index=sw_if_index, + sclass=sclass, + prefix=dict( + address=IPUtil.create_ip_address_object( ip_address(unicode(address))), - len = int(subnet_length) + len=int(subnet_length) ), - rd_id = rd_id + rd_id=rd_id ) ) @@ -317,26 +316,26 @@ class GBP(object): .format(node=node['host']) rule_permit = dict( - action = getattr(GBPRuleAction, - 'GBP_API_RULE_PERMIT').value, - nh_set = dict( - hash_mode = list(), - n_nhs = 8, - nhs = [dict()]*8, + action=getattr(GBPRuleAction, + 'GBP_API_RULE_PERMIT').value, + nh_set=dict( + hash_mode=list(), + n_nhs=8, + nhs=[dict()]*8, ) ) rules = [rule_permit, rule_permit] args_in = dict( - is_add = 1, - contract = dict( - acl_index = acl_index, - sclass = sclass, - dclass = dclass, - n_rules = len(rules), - rules = rules, - n_ether_types = 16, - allowed_ethertypes = [0x800, 0x86dd] + [0]*14 + is_add=1, + contract=dict( + acl_index=acl_index, + sclass=sclass, + dclass=dclass, + n_rules=len(rules), + rules=rules, + n_ether_types=16, + allowed_ethertypes=[0x800, 0x86dd] + [0]*14 ) ) diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py index 7024e85dc8..1f79d7e679 100644 --- a/resources/libraries/python/InterfaceUtil.py +++ b/resources/libraries/python/InterfaceUtil.py @@ -1161,10 +1161,8 @@ class InterfaceUtil(object): for bond in details: data += ('{b}\n'.format(b=bond['interface_name'].rstrip('\x00'))) - data += (' mode: {m}\n'.format(m=LinkBondMode( - bond['mode']).name.lower())) - data += (' load balance: {lb}\n'.format(lb=LinkBondLoadBalance( - bond['lb']).name.lower())) + data += (' mode: {m}\n'.format(m=bond['mode']).lower()) + data += (' load balance: {lb}\n'.format(lb=bond['lb']).lower()) data += (' number of active slaves: {n}\n'.format( n=bond['active_slaves'])) if verbose: diff --git a/resources/libraries/python/PapiExecutor.py b/resources/libraries/python/PapiExecutor.py index d7130ebb61..adafa88fa0 100644 --- a/resources/libraries/python/PapiExecutor.py +++ b/resources/libraries/python/PapiExecutor.py @@ -148,8 +148,7 @@ class PapiSocketExecutor(object): self._ssh_control_socket = None self._local_vpp_socket = None - @property - def crc_checker(self): + def create_crc_checker(self): """Return the cached instance or create new one from directory. It is assumed self.api_json_directory is set, as a class variable. @@ -204,7 +203,7 @@ class PapiSocketExecutor(object): cls.api_json_directory = tmp_dir + "/usr/share/vpp/api" # Perform initial checks before .api.json files are gone, # by accessing the property (which also creates its instance). - self.crc_checker + self.create_crc_checker() # When present locally, we finally can find the installation path. package_path = glob.glob(tmp_dir + installed_papi_glob)[0] # Package path has to be one level above the vpp_papi directory. diff --git a/resources/libraries/python/TestConfig.py b/resources/libraries/python/TestConfig.py index 787f27b161..5887c11a9f 100644 --- a/resources/libraries/python/TestConfig.py +++ b/resources/libraries/python/TestConfig.py @@ -166,8 +166,6 @@ class TestConfig(object): sw_if_index=InterfaceUtil.get_interface_index( node, node_vlan_if), vlan_id=None) - err_msg = 'Failed to create VXLAN and VLAN interfaces on host {host}'.\ - format(host=node['host']) with PapiSocketExecutor(node) as papi_exec: for i in xrange(0, vxlan_count): @@ -256,8 +254,6 @@ class TestConfig(object): args2 = dict( sw_if_index=None, admin_up_down=1) - err_msg = 'Failed to put VXLAN and VLAN interfaces up on host {host}'. \ - format(host=node['host']) with PapiSocketExecutor(node) as papi_exec: for i in xrange(0, vxlan_count): @@ -394,8 +390,6 @@ class TestConfig(object): shg=0, port_type=0, enable=1) - err_msg = 'Failed to put VXLAN and VLAN interfaces to bridge domain ' \ - 'on host {host}'.format(host=node['host']) with PapiSocketExecutor(node) as papi_exec: for i in xrange(0, vxlan_count): diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py index 68045bbb68..698c97b426 100644 --- a/resources/libraries/python/topology.py +++ b/resources/libraries/python/topology.py @@ -403,7 +403,8 @@ class Topology(object): interface index assigned to the interface by vpp for a given node. :param node: The node topology dictionary. - :param sw_if_index: sw_if_index of the link that a interface is connected to. + :param sw_if_index: sw_if_index of the link that a interface is + connected to. :type node: dict :type sw_if_index: int :returns: Interface name of the interface connected to the given link. |