diff options
author | Klement Sekera <klement.sekera@gmail.com> | 2022-04-26 19:02:15 +0200 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2022-05-10 18:52:08 +0000 |
commit | d9b0c6fbf7aa5bd9af84264105b39c82028a4a29 (patch) | |
tree | 4f786cfd8ebc2443cb11e11b74c8657204068898 /test/vpp_neighbor.py | |
parent | f90348bcb4afd0af2611cefc43b17ef3042b511c (diff) |
tests: replace pycodestyle with black
Drop pycodestyle for code style checking in favor of black. Black is
much faster, stable PEP8 compliant code style checker offering also
automatic formatting. It aims to be very stable and produce smallest
diffs. It's used by many small and big projects.
Running checkstyle with black takes a few seconds with a terse output.
Thus, test-checkstyle-diff is no longer necessary.
Expand scope of checkstyle to all python files in the repo, replacing
test-checkstyle with checkstyle-python.
Also, fixstyle-python is now available for automatic style formatting.
Note: python virtualenv has been consolidated in test/Makefile,
test/requirements*.txt which will eventually be moved to a central
location. This is required to simply the automated generation of
docker executor images in the CI.
Type: improvement
Change-Id: I022a326603485f58585e879ac0f697fceefbc9c8
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'test/vpp_neighbor.py')
-rw-r--r-- | test/vpp_neighbor.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/test/vpp_neighbor.py b/test/vpp_neighbor.py index 9ba87005c46..d7940266605 100644 --- a/test/vpp_neighbor.py +++ b/test/vpp_neighbor.py @@ -7,6 +7,7 @@ from ipaddress import ip_address from vpp_object import VppObject from vpp_papi import mac_pton, VppEnum + try: text_type = unicode except NameError: @@ -16,13 +17,14 @@ except NameError: def find_nbr(test, sw_if_index, nbr_addr, is_static=0, mac=None): ip_addr = ip_address(text_type(nbr_addr)) e = VppEnum.vl_api_ip_neighbor_flags_t - nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index, - af=ip_addr.vapi_af) + nbrs = test.vapi.ip_neighbor_dump(sw_if_index=sw_if_index, af=ip_addr.vapi_af) for n in nbrs: - if sw_if_index == n.neighbor.sw_if_index and \ - ip_addr == n.neighbor.ip_address and \ - is_static == (n.neighbor.flags & e.IP_API_NEIGHBOR_FLAG_STATIC): + if ( + sw_if_index == n.neighbor.sw_if_index + and ip_addr == n.neighbor.ip_address + and is_static == (n.neighbor.flags & e.IP_API_NEIGHBOR_FLAG_STATIC) + ): if mac: if mac == str(n.neighbor.mac_address): return True @@ -36,8 +38,15 @@ class VppNeighbor(VppObject): ARP Entry """ - def __init__(self, test, sw_if_index, mac_addr, nbr_addr, - is_static=False, is_no_fib_entry=False): + def __init__( + self, + test, + sw_if_index, + mac_addr, + nbr_addr, + is_static=False, + is_no_fib_entry=False, + ): self._test = test self.sw_if_index = sw_if_index self.mac_addr = mac_addr @@ -52,35 +61,26 @@ class VppNeighbor(VppObject): def add_vpp_config(self): r = self._test.vapi.ip_neighbor_add_del( - self.sw_if_index, - self.mac_addr, - self.nbr_addr, - is_add=1, - flags=self.flags) + self.sw_if_index, self.mac_addr, self.nbr_addr, is_add=1, flags=self.flags + ) self.stats_index = r.stats_index self._test.registry.register(self, self._test.logger) return self def remove_vpp_config(self): self._test.vapi.ip_neighbor_add_del( - self.sw_if_index, - self.mac_addr, - self.nbr_addr, - is_add=0, - flags=self.flags) + self.sw_if_index, self.mac_addr, self.nbr_addr, is_add=0, flags=self.flags + ) def is_static(self): e = VppEnum.vl_api_ip_neighbor_flags_t - return (self.flags & e.IP_API_NEIGHBOR_FLAG_STATIC) + return self.flags & e.IP_API_NEIGHBOR_FLAG_STATIC def query_vpp_config(self): - return find_nbr(self._test, - self.sw_if_index, - self.nbr_addr, - self.is_static()) + return find_nbr(self._test, self.sw_if_index, self.nbr_addr, self.is_static()) def object_id(self): - return ("%d:%s" % (self.sw_if_index, self.nbr_addr)) + return "%d:%s" % (self.sw_if_index, self.nbr_addr) def get_stats(self): c = self._test.statistics["/net/adjacency"] |