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>
This commit is contained in:
@ -50,10 +50,17 @@ class TestTracedump(VppTestCase):
|
|||||||
|
|
||||||
self.vapi.trace_clear_cache()
|
self.vapi.trace_clear_cache()
|
||||||
self.vapi.trace_clear_capture()
|
self.vapi.trace_clear_capture()
|
||||||
# pg-input node = 425
|
# get pg-input node index
|
||||||
self.vapi.trace_set_filters(flag=1, 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=1, node_index=pg_input_index, count=5)
|
||||||
self.vapi.trace_capture_packets(
|
self.vapi.trace_capture_packets(
|
||||||
node_index=425,
|
node_index=pg_input_index,
|
||||||
max_packets=5,
|
max_packets=5,
|
||||||
use_filter=True,
|
use_filter=True,
|
||||||
verbose=True,
|
verbose=True,
|
||||||
@ -66,10 +73,8 @@ class TestTracedump(VppTestCase):
|
|||||||
self.assertIn("af-packet-input", reply)
|
self.assertIn("af-packet-input", reply)
|
||||||
|
|
||||||
self.pg_start()
|
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(
|
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)
|
self.assertTrue(reply)
|
||||||
reply = self.vapi.trace_filter_function_dump()
|
reply = self.vapi.trace_filter_function_dump()
|
||||||
@ -84,9 +89,16 @@ class TestTracedump(VppTestCase):
|
|||||||
self.pg0.add_stream(packets)
|
self.pg0.add_stream(packets)
|
||||||
|
|
||||||
# exclude node
|
# 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(
|
self.vapi.trace_capture_packets(
|
||||||
node_index=425,
|
node_index=pg_input_index,
|
||||||
max_packets=5,
|
max_packets=5,
|
||||||
use_filter=True,
|
use_filter=True,
|
||||||
verbose=True,
|
verbose=True,
|
||||||
|
Reference in New Issue
Block a user