Skip to content

Commit

Permalink
orchagent: copp: create trap group only if trap action is copy or trap
Browse files Browse the repository at this point in the history
Signed-off-by: Prabhat Aravind <paravind@microsoft.com>
  • Loading branch information
prabhataravind committed Jun 22, 2023
1 parent a391ed0 commit 7e080ab
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions orchagent/copporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,6 @@ bool CoppOrch::trapGroupProcessTrapIdChange (string trap_group_name,
{
sai_attribute_t attr;
vector<sai_attribute_t> add_trap_attr;
attr.id = SAI_HOSTIF_TRAP_ATTR_TRAP_GROUP;
attr.value.oid = m_trap_group_map[trap_group_name];

add_trap_attr.push_back(attr);

for(auto i: add_trap_ids)
{
Expand All @@ -851,12 +847,26 @@ bool CoppOrch::trapGroupProcessTrapIdChange (string trap_group_name,
}
}

bool associate_trap_group = false;
for (auto it: m_trap_group_trap_id_attrs[trap_group_name])
{
attr.id = it.first;
attr.value = it.second;
add_trap_attr.push_back(attr);
if (attr.id == SAI_HOSTIF_TRAP_ATTR_PACKET_ACTION &&
(attr.value.s32 == SAI_PACKET_ACTION_TRAP || attr.value.s32 == SAI_PACKET_ACTION_COPY))
{
associate_trap_group = true;
}
}

if (associate_trap_group)
{
attr.id = SAI_HOSTIF_TRAP_ATTR_TRAP_GROUP;
attr.value.oid = m_trap_group_map[trap_group_name];
add_trap_attr.push_back(attr);
}

if (!applyAttributesToTrapIds(m_trap_group_map[trap_group_name], add_trap_ids,
add_trap_attr))
{
Expand Down

0 comments on commit 7e080ab

Please sign in to comment.