From e60386b99b3b70e16ed6c3a9f633009cfd508185 Mon Sep 17 00:00:00 2001 From: hsandid Date: Wed, 6 Dec 2023 11:14:19 +0100 Subject: tests: tracedump test replace hardcoded value Type: fix Fetch 'pg-input' node index instead of using a hardcoded value Change-Id: I1ca27ddb54806530b546085d83e83b880acc4573 Signed-off-by: hsandid --- test/test_tracedump.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'test') diff --git a/test/test_tracedump.py b/test/test_tracedump.py index b2346d71f47..d58d15a2c34 100644 --- a/test/test_tracedump.py +++ b/test/test_tracedump.py @@ -50,10 +50,17 @@ class TestTracedump(VppTestCase): self.vapi.trace_clear_cache() self.vapi.trace_clear_capture() - # pg-input node = 425 - self.vapi.trace_set_filters(flag=1, node_index=425, count=5) + # get pg-input node index + reply = self.vapi.graph_node_get( + cursor=0xFFFFFFFF, + index=0xFFFFFFFF, + name="pg-input", + ) + self.assertTrue(reply[1][0].name == "pg-input") + pg_input_index = reply[1][0].index + self.vapi.trace_set_filters(flag=1, node_index=pg_input_index, count=5) self.vapi.trace_capture_packets( - node_index=425, + node_index=pg_input_index, max_packets=5, use_filter=True, verbose=True, @@ -66,10 +73,8 @@ class TestTracedump(VppTestCase): self.assertIn("af-packet-input", reply) self.pg_start() - reply = self.vapi.graph_node_get(cursor=ctypes.c_uint32(~0).value, index=425) - self.assertTrue(reply[1][0].name == "pg-input") reply = self.vapi.trace_v2_dump( - thread_id=ctypes.c_uint32(~0).value, position=0, clear_cache=False + thread_id=0xFFFFFFFF, position=0, clear_cache=False ) self.assertTrue(reply) reply = self.vapi.trace_filter_function_dump() @@ -84,9 +89,16 @@ class TestTracedump(VppTestCase): self.pg0.add_stream(packets) # exclude node - self.vapi.trace_set_filters(flag=2, node_index=425, count=5) + reply = self.vapi.graph_node_get( + cursor=0xFFFFFFFF, + index=0xFFFFFFFF, + name="pg-input", + ) + self.assertTrue(reply[1][0].name == "pg-input") + pg_input_index = reply[1][0].index + self.vapi.trace_set_filters(flag=2, node_index=pg_input_index, count=5) self.vapi.trace_capture_packets( - node_index=425, + node_index=pg_input_index, max_packets=5, use_filter=True, verbose=True, -- cgit 1.2.3-korg