summaryrefslogtreecommitdiffstats
path: root/test/test_tracedump.py
diff options
context:
space:
mode:
authorhsandid <halsandi@cisco.com>2023-12-06 11:14:19 +0100
committerBeno�t Ganne <bganne@cisco.com>2023-12-07 10:04:07 +0000
commite60386b99b3b70e16ed6c3a9f633009cfd508185 (patch)
treedd600d01624fbdc6639f5d0eb171b5836c1f889c /test/test_tracedump.py
parent4cdf30dcece276d6754a71b307da5cef09eac16f (diff)
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 <halsandi@cisco.com>
Diffstat (limited to 'test/test_tracedump.py')
-rw-r--r--test/test_tracedump.py28
1 files changed, 20 insertions, 8 deletions
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,