aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_ping.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_ping.py')
-rw-r--r--test/test_ping.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/test_ping.py b/test/test_ping.py
index c2eb8b75299..2fb36e5d7b6 100644
--- a/test/test_ping.py
+++ b/test/test_ping.py
@@ -179,3 +179,37 @@ class TestPing(VppTestCase):
icmp_seq = icmp_seq + 1
finally:
self.vapi.cli("show error")
+
+ def test_ping_api(self):
+ """ping api"""
+
+ try:
+ self.pg_enable_capture(self.pg_interfaces)
+ self.pg_start()
+
+ ret = self.vapi.want_ping_finished_events(
+ address=self.pg1.remote_ip4,
+ repeat=4,
+ interval=0.2,
+ )
+ self.logger.info(ret)
+ timeout = 1
+
+ ev = self.vapi.wait_for_event(timeout, "ping_finished_event")
+ self.logger.info(ev)
+ self.assertEqual(ev.request_count, 4)
+
+ out = self.pg1.get_capture(4)
+ 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_seq = icmp_seq + 1
+ if icmp_id is None:
+ icmp_id = icmp.id
+ else:
+ self.assertEqual(icmp.id, icmp_id)
+ finally:
+ self.vapi.cli("show error")