From db12638055952e3573eee76c9bd9bd1f5045965d Mon Sep 17 00:00:00 2001 From: "Jain, Komal" Date: Tue, 2 Jan 2024 05:45:54 -0800 Subject: [PATCH] Fix actionparams type field in introspection.json --- backends/tc/introspection.cpp | 3 ++- .../p4tc_samples_outputs/default_action_example.json | 4 ++-- .../p4tc_samples_outputs/drop_packet_example.json | 2 +- testdata/p4tc_samples_outputs/matchtype.json | 8 ++++---- .../p4tc_samples_outputs/mix_matchtype_example.json | 8 ++++---- .../multiple_tables_example_01.json | 12 ++++++------ .../multiple_tables_example_02.json | 6 +++--- .../name_annotation_example.json | 4 ++-- .../p4tc_samples_outputs/noaction_example_01.json | 4 ++-- .../p4tc_samples_outputs/noaction_example_02.json | 2 +- .../p4tc_samples_outputs/send_to_port_example.json | 2 +- .../p4tc_samples_outputs/size_param_example.json | 4 ++-- testdata/p4tc_samples_outputs/test_ipv6_example.json | 2 +- 13 files changed, 31 insertions(+), 30 deletions(-) diff --git a/backends/tc/introspection.cpp b/backends/tc/introspection.cpp index 7db69d9dbc6..90c95c14d51 100644 --- a/backends/tc/introspection.cpp +++ b/backends/tc/introspection.cpp @@ -183,7 +183,8 @@ Util::JsonObject *IntrospectionGenerator::genActionInfo(struct ActionAttributes paramJson->emplace("name", param->name); switch (param->dataType) { case TC::BIT_TYPE: { - paramJson->emplace("type", "bit"); + auto paramtype = "bit" + Util::toString(param->bitwidth); + paramJson->emplace("type", paramtype); break; } case TC::DEV_TYPE: { diff --git a/testdata/p4tc_samples_outputs/default_action_example.json b/testdata/p4tc_samples_outputs/default_action_example.json index a5dfe5f0922..c3a84a31d63 100644 --- a/testdata/p4tc_samples_outputs/default_action_example.json +++ b/testdata/p4tc_samples_outputs/default_action_example.json @@ -35,7 +35,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -92,7 +92,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/drop_packet_example.json b/testdata/p4tc_samples_outputs/drop_packet_example.json index 7aa96cb1cb1..a5eeab7077b 100644 --- a/testdata/p4tc_samples_outputs/drop_packet_example.json +++ b/testdata/p4tc_samples_outputs/drop_packet_example.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/matchtype.json b/testdata/p4tc_samples_outputs/matchtype.json index d94e7f6e012..3d15bee551c 100644 --- a/testdata/p4tc_samples_outputs/matchtype.json +++ b/testdata/p4tc_samples_outputs/matchtype.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -128,7 +128,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -185,7 +185,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/mix_matchtype_example.json b/testdata/p4tc_samples_outputs/mix_matchtype_example.json index 42550549cd2..00241acde20 100644 --- a/testdata/p4tc_samples_outputs/mix_matchtype_example.json +++ b/testdata/p4tc_samples_outputs/mix_matchtype_example.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -135,7 +135,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -192,7 +192,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_01.json b/testdata/p4tc_samples_outputs/multiple_tables_example_01.json index d816c2b9578..a0991e2596e 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_01.json +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_01.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -142,7 +142,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -199,7 +199,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -324,7 +324,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -376,7 +376,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/multiple_tables_example_02.json b/testdata/p4tc_samples_outputs/multiple_tables_example_02.json index e6700607404..8a55ffcd7ba 100644 --- a/testdata/p4tc_samples_outputs/multiple_tables_example_02.json +++ b/testdata/p4tc_samples_outputs/multiple_tables_example_02.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -310,7 +310,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/name_annotation_example.json b/testdata/p4tc_samples_outputs/name_annotation_example.json index 057cd04c22c..c7e0de8fcd7 100644 --- a/testdata/p4tc_samples_outputs/name_annotation_example.json +++ b/testdata/p4tc_samples_outputs/name_annotation_example.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/noaction_example_01.json b/testdata/p4tc_samples_outputs/noaction_example_01.json index 6aedf438601..24eef3aa2c6 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_01.json +++ b/testdata/p4tc_samples_outputs/noaction_example_01.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/noaction_example_02.json b/testdata/p4tc_samples_outputs/noaction_example_02.json index 649db8935e0..ccdd118d66f 100644 --- a/testdata/p4tc_samples_outputs/noaction_example_02.json +++ b/testdata/p4tc_samples_outputs/noaction_example_02.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/send_to_port_example.json b/testdata/p4tc_samples_outputs/send_to_port_example.json index 90fa54fd54d..cbb7ab45b7d 100644 --- a/testdata/p4tc_samples_outputs/send_to_port_example.json +++ b/testdata/p4tc_samples_outputs/send_to_port_example.json @@ -42,7 +42,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/size_param_example.json b/testdata/p4tc_samples_outputs/size_param_example.json index 57472c2d3aa..c71a89ce935 100644 --- a/testdata/p4tc_samples_outputs/size_param_example.json +++ b/testdata/p4tc_samples_outputs/size_param_example.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], @@ -85,7 +85,7 @@ { "id" : 1, "name" : "vport", - "type" : "bit", + "type" : "bit32", "bitwidth" : 32 } ], diff --git a/testdata/p4tc_samples_outputs/test_ipv6_example.json b/testdata/p4tc_samples_outputs/test_ipv6_example.json index a831ec986af..2b48f30708a 100644 --- a/testdata/p4tc_samples_outputs/test_ipv6_example.json +++ b/testdata/p4tc_samples_outputs/test_ipv6_example.json @@ -28,7 +28,7 @@ { "id" : 1, "name" : "addr6", - "type" : "bit", + "type" : "bit128", "bitwidth" : 128 } ],