From c4dd5060b55168bae0bd6e2a00c52971d91e2a4f Mon Sep 17 00:00:00 2001 From: Prabhat Aravind Date: Thu, 19 Dec 2024 23:36:23 +0000 Subject: [PATCH] Attach neighbor_miss trap to default trap group policed at 600pps Signed-off-by: Prabhat Aravind --- orchagent/copporch.cpp | 9 ++++++--- orchagent/p4orch/tests/next_hop_manager_test.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/orchagent/copporch.cpp b/orchagent/copporch.cpp index 6c6a7157e5..81be0458cc 100644 --- a/orchagent/copporch.cpp +++ b/orchagent/copporch.cpp @@ -89,7 +89,8 @@ static map trap_id_map = { {"dest_nat_miss", SAI_HOSTIF_TRAP_TYPE_DNAT_MISS}, {"ldp", SAI_HOSTIF_TRAP_TYPE_LDP}, {"bfd_micro", SAI_HOSTIF_TRAP_TYPE_BFD_MICRO}, - {"bfdv6_micro", SAI_HOSTIF_TRAP_TYPE_BFDV6_MICRO} + {"bfdv6_micro", SAI_HOSTIF_TRAP_TYPE_BFDV6_MICRO}, + {"neighbor_miss", SAI_HOSTIF_TRAP_TYPE_NEIGHBOR_MISS} }; @@ -120,7 +121,8 @@ static map packet_action_map = { const string default_trap_group = "default"; const vector default_trap_ids = { - SAI_HOSTIF_TRAP_TYPE_TTL_ERROR + SAI_HOSTIF_TRAP_TYPE_TTL_ERROR, + SAI_HOSTIF_TRAP_TYPE_NEIGHBOR_MISS }; const uint HOSTIF_TRAP_COUNTER_POLLING_INTERVAL_MS = 10000; @@ -823,7 +825,8 @@ void CoppOrch::getTrapAddandRemoveList(string trap_group_name, { if ((trap_group_name != default_trap_group) || ((trap_group_name == default_trap_group) && - (it.first != SAI_HOSTIF_TRAP_TYPE_TTL_ERROR))) + ((it.first != SAI_HOSTIF_TRAP_TYPE_TTL_ERROR) || + (it.first != SAI_HOSTIF_TRAP_TYPE_NEIGHBOR_MISS)))) { rem_trap_ids.push_back(it.first); } diff --git a/orchagent/p4orch/tests/next_hop_manager_test.cpp b/orchagent/p4orch/tests/next_hop_manager_test.cpp index e389a944a2..27023daf31 100644 --- a/orchagent/p4orch/tests/next_hop_manager_test.cpp +++ b/orchagent/p4orch/tests/next_hop_manager_test.cpp @@ -237,7 +237,7 @@ class NextHopManagerTest : public ::testing::Test sai_hostif_api->create_hostif_trap = mock_create_hostif_trap; sai_hostif_api->create_hostif_table_entry = mock_create_hostif_table_entry; EXPECT_CALL(mock_sai_hostif_, create_hostif_table_entry(_, _, _, _)).WillRepeatedly(Return(SAI_STATUS_SUCCESS)); - EXPECT_CALL(mock_sai_hostif_, create_hostif_trap(_, _, _, _)).WillOnce(Return(SAI_STATUS_SUCCESS)); + EXPECT_CALL(mock_sai_hostif_, create_hostif_trap(_, _, _, _)).WillRepeatedly(Return(SAI_STATUS_SUCCESS)); EXPECT_CALL(mock_sai_switch_, get_switch_attribute(_, _, _)).WillRepeatedly(Return(SAI_STATUS_SUCCESS)); copp_orch_ = new CoppOrch(gAppDb, APP_COPP_TABLE_NAME); std::vector p4_tables;