aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_pg.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/test_pg.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/test_pg.py')
-rw-r--r--test/test_pg.py42
1 files changed, 25 insertions, 17 deletions
diff --git a/test/test_pg.py b/test/test_pg.py
index 76b7fd7f1d9..f2a23e55f23 100644
--- a/test/test_pg.py
+++ b/test/test_pg.py
@@ -12,7 +12,7 @@ from framework import VppTestCase, VppTestRunner
class TestPgTun(VppTestCase):
- """ PG Test Case """
+ """PG Test Case"""
def setUp(self):
super(TestPgTun, self).setUp()
@@ -41,7 +41,7 @@ class TestPgTun(VppTestCase):
super(TestPgTun, self).tearDown()
def test_pg_tun(self):
- """ IP[46] Tunnel Mode PG """
+ """IP[46] Tunnel Mode PG"""
#
# test that we can send and receive IP encap'd packets on the
@@ -50,9 +50,11 @@ class TestPgTun(VppTestCase):
N_PKTS = 31
# v4 tun to ethernet
- p = (IP(src=self.pg1.remote_ip4, dst=self.pg0.remote_ip4) /
- UDP(sport=1234, dport=1234) /
- Raw('0' * 48))
+ p = (
+ IP(src=self.pg1.remote_ip4, dst=self.pg0.remote_ip4)
+ / UDP(sport=1234, dport=1234)
+ / Raw("0" * 48)
+ )
rxs = self.send_and_expect(self.pg1, p * N_PKTS, self.pg0)
for rx in rxs:
@@ -60,9 +62,11 @@ class TestPgTun(VppTestCase):
self.assertEqual(rx[IP].dst, self.pg0.remote_ip4)
# v6 tun to ethernet
- p = (IPv6(src=self.pg2.remote_ip6, dst=self.pg0.remote_ip6) /
- UDP(sport=1234, dport=1234) /
- Raw('0' * 48))
+ p = (
+ IPv6(src=self.pg2.remote_ip6, dst=self.pg0.remote_ip6)
+ / UDP(sport=1234, dport=1234)
+ / Raw("0" * 48)
+ )
rxs = self.send_and_expect(self.pg2, p * N_PKTS, self.pg0)
for rx in rxs:
@@ -70,10 +74,12 @@ class TestPgTun(VppTestCase):
self.assertEqual(rx[IPv6].dst, self.pg0.remote_ip6)
# eth to v4 tun
- p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
- IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4) /
- UDP(sport=1234, dport=1234) /
- Raw('0' * 48))
+ p = (
+ Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac)
+ / IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4)
+ / UDP(sport=1234, dport=1234)
+ / Raw("0" * 48)
+ )
rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg1)
for rx in rxs:
@@ -82,10 +88,12 @@ class TestPgTun(VppTestCase):
self.assertEqual(rx[IP].dst, self.pg1.remote_ip4)
# eth to v6 tun
- p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
- IPv6(src=self.pg0.remote_ip6, dst=self.pg2.remote_ip6) /
- UDP(sport=1234, dport=1234) /
- Raw('0' * 48))
+ p = (
+ Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac)
+ / IPv6(src=self.pg0.remote_ip6, dst=self.pg2.remote_ip6)
+ / UDP(sport=1234, dport=1234)
+ / Raw("0" * 48)
+ )
rxs = self.send_and_expect(self.pg0, p * N_PKTS, self.pg2)
for rx in rxs:
@@ -94,5 +102,5 @@ class TestPgTun(VppTestCase):
self.assertEqual(rx[IPv6].dst, self.pg2.remote_ip6)
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main(testRunner=VppTestRunner)