diff options
author | NikitaSkrynnik <nikita.skrynnik@xored.com> | 2023-09-14 16:00:38 +0700 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2023-09-26 20:45:28 +0000 |
commit | bb1cde678e3b7639490cbbd68fe312af171c0a41 (patch) | |
tree | a59e173a65168360b37071253ffa929717f8bc85 /test/test_ping.py | |
parent | 40242b88e9d4548c4e76a69b00c87c0151218d03 (diff) |
ping: Simple binary API for running ping based on events
Type: improvement
Change-Id: I02846a2420637470cb0f9472c86471b6a3421a75
Signed-off-by: NikitaSkrynnik <nikita.skrynnik@xored.com>
Diffstat (limited to 'test/test_ping.py')
-rw-r--r-- | test/test_ping.py | 34 |
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") |