aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_udp_encap.py
diff options
context:
space:
mode:
authorKlement Sekera <klement.sekera@gmail.com>2022-04-26 19:02:15 +0200
committerOle Tr�an <otroan@employees.org>2022-05-10 18:52:08 +0000
commitd9b0c6fbf7aa5bd9af84264105b39c82028a4a29 (patch)
tree4f786cfd8ebc2443cb11e11b74c8657204068898 /test/vpp_udp_encap.py
parentf90348bcb4afd0af2611cefc43b17ef3042b511c (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_udp_encap.py')
-rw-r--r--test/vpp_udp_encap.py30
1 files changed, 11 insertions, 19 deletions
diff --git a/test/vpp_udp_encap.py b/test/vpp_udp_encap.py
index aad87bd5912..b89e9411e6a 100644
--- a/test/vpp_udp_encap.py
+++ b/test/vpp_udp_encap.py
@@ -10,25 +10,20 @@ from socket import inet_pton, inet_ntop, AF_INET, AF_INET6
def find_udp_encap(test, ue):
encaps = test.vapi.udp_encap_dump()
for e in encaps:
- if ue.id == e.udp_encap.id \
- and ue.src_ip == str(e.udp_encap.src_ip) \
- and ue.dst_ip == str(e.udp_encap.dst_ip) \
- and e.udp_encap.dst_port == ue.dst_port \
- and e.udp_encap.src_port == ue.src_port:
+ if (
+ ue.id == e.udp_encap.id
+ and ue.src_ip == str(e.udp_encap.src_ip)
+ and ue.dst_ip == str(e.udp_encap.dst_ip)
+ and e.udp_encap.dst_port == ue.dst_port
+ and e.udp_encap.src_port == ue.src_port
+ ):
return True
return False
class VppUdpEncap(VppObject):
-
- def __init__(self,
- test,
- src_ip,
- dst_ip,
- src_port,
- dst_port,
- table_id=0):
+ def __init__(self, test, src_ip, dst_ip, src_port, dst_port, table_id=0):
self._test = test
self.table_id = table_id
self.src_ip_s = src_ip
@@ -40,11 +35,8 @@ class VppUdpEncap(VppObject):
def add_vpp_config(self):
r = self._test.vapi.udp_encap_add(
- self.src_ip,
- self.dst_ip,
- self.src_port,
- self.dst_port,
- self.table_id)
+ self.src_ip, self.dst_ip, self.src_port, self.dst_port, self.table_id
+ )
self.id = r.id
self._test.registry.register(self, self._test.logger)
@@ -55,7 +47,7 @@ class VppUdpEncap(VppObject):
return find_udp_encap(self._test, self)
def object_id(self):
- return ("udp-encap-%d" % self.id)
+ return "udp-encap-%d" % self.id
def get_stats(self):
c = self._test.statistics.get_counter("/net/udp-encap")