summaryrefslogtreecommitdiffstats
path: root/test/test_ping.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_ping.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_ping.py')
-rw-r--r--test/test_ping.py45
1 files changed, 25 insertions, 20 deletions
diff --git a/test/test_ping.py b/test/test_ping.py
index 8c5c087b0c5..c2eb8b75299 100644
--- a/test/test_ping.py
+++ b/test/test_ping.py
@@ -18,7 +18,7 @@ Basic test for sanity check of the ping.
class TestPing(VppTestCase):
- """ Ping Test Case """
+ """Ping Test Case"""
@classmethod
def setUpClass(cls):
@@ -64,7 +64,7 @@ class TestPing(VppTestCase):
return icmp
def test_ping_basic(self):
- """ basic ping test """
+ """basic ping test"""
try:
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
@@ -79,8 +79,9 @@ class TestPing(VppTestCase):
icmp_id = None
icmp_seq = 1
for p in out:
- icmp = self.verify_ping_request(p, self.pg1.local_ip4,
- self.pg1.remote_ip4, icmp_seq)
+ icmp = self.verify_ping_request(
+ p, self.pg1.local_ip4, self.pg1.remote_ip4, icmp_seq
+ )
icmp_seq = icmp_seq + 1
if icmp_id is None:
icmp_id = icmp.id
@@ -90,7 +91,7 @@ class TestPing(VppTestCase):
self.vapi.cli("show error")
def test_ping_burst(self):
- """ burst ping test """
+ """burst ping test"""
try:
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
@@ -100,13 +101,14 @@ class TestPing(VppTestCase):
ping_cmd = "ping " + remote_ip4 + " interval 0.01 burst 3"
ret = self.vapi.cli(ping_cmd)
self.logger.info(ret)
- out = self.pg1.get_capture(3*5)
+ out = self.pg1.get_capture(3 * 5)
icmp_id = None
icmp_seq = 1
count = 0
for p in out:
- icmp = self.verify_ping_request(p, self.pg1.local_ip4,
- self.pg1.remote_ip4, icmp_seq)
+ icmp = self.verify_ping_request(
+ p, self.pg1.local_ip4, self.pg1.remote_ip4, icmp_seq
+ )
count = count + 1
if count >= 3:
icmp_seq = icmp_seq + 1
@@ -119,7 +121,7 @@ class TestPing(VppTestCase):
self.vapi.cli("show error")
def test_ping_src(self):
- """ ping with source address set """
+ """ping with source address set"""
self.pg_enable_capture(self.pg_interfaces)
self.pg_start()
@@ -128,17 +130,18 @@ class TestPing(VppTestCase):
nbr_addr = "10.0.0.2"
VppIpInterfaceAddress(self, self.pg1, "10.0.0.1", 24).add_vpp_config()
- VppNeighbor(self, self.pg1.sw_if_index,
- "00:11:22:33:44:55",
- nbr_addr).add_vpp_config()
+ VppNeighbor(
+ self, self.pg1.sw_if_index, "00:11:22:33:44:55", nbr_addr
+ ).add_vpp_config()
ping_cmd = "ping %s interval 0.01 repeat 3" % self.pg1.remote_ip4
ret = self.vapi.cli(ping_cmd)
out = self.pg1.get_capture(3)
icmp_seq = 1
for p in out:
- icmp = self.verify_ping_request(p, self.pg1.local_ip4,
- self.pg1.remote_ip4, icmp_seq)
+ icmp = self.verify_ping_request(
+ p, self.pg1.local_ip4, self.pg1.remote_ip4, icmp_seq
+ )
icmp_seq = icmp_seq + 1
self.pg_enable_capture(self.pg_interfaces)
@@ -152,7 +155,7 @@ class TestPing(VppTestCase):
icmp_seq = icmp_seq + 1
def test_ping_fib_routed_dst(self):
- """ ping destination routed according to FIB table """
+ """ping destination routed according to FIB table"""
try:
self.pg1.generate_remote_hosts(1)
@@ -160,17 +163,19 @@ class TestPing(VppTestCase):
self.pg_start()
routed_dst = "10.0.2.0"
self.logger.info(self.vapi.cli("show ip4 neighbors"))
- VppIpRoute(self, routed_dst, 24,
- [VppRoutePath(self.pg1.remote_hosts[0].ip4,
- self.pg1.sw_if_index)]).add_vpp_config()
+ VppIpRoute(
+ self,
+ routed_dst,
+ 24,
+ [VppRoutePath(self.pg1.remote_hosts[0].ip4, self.pg1.sw_if_index)],
+ ).add_vpp_config()
ping_cmd = "ping %s interval 0.01 repeat 3" % routed_dst
ret = self.vapi.cli(ping_cmd)
self.logger.info(ret)
out = self.pg1.get_capture(3)
icmp_seq = 1
for p in out:
- self.verify_ping_request(p, self.pg1.local_ip4, routed_dst,
- icmp_seq)
+ self.verify_ping_request(p, self.pg1.local_ip4, routed_dst, icmp_seq)
icmp_seq = icmp_seq + 1
finally:
self.vapi.cli("show error")