Skip to content

Commit

Permalink
Addressing code review comments
Browse files Browse the repository at this point in the history
Addressing code review comments
  • Loading branch information
dgsudharsan committed Sep 16, 2019
1 parent 2da20c6 commit 0d774ab
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 28 deletions.
30 changes: 18 additions & 12 deletions orchagent/copporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,23 +221,29 @@ bool CoppOrch::applyAttributesToTrapIds(sai_object_id_t trap_group_id,
if (hostif_map != m_trap_group_hostif_map.end())
{
sai_object_id_t hostif_table_entry = SAI_NULL_OBJECT_ID;
sai_attribute_t sai_host_table_attr[4];
sai_attribute_t attr;
vector<sai_attribute_t> sai_host_table_attr;

sai_host_table_attr[0].id = SAI_HOSTIF_TABLE_ENTRY_ATTR_TYPE;
sai_host_table_attr[0].value.s32 = SAI_HOSTIF_TABLE_ENTRY_TYPE_TRAP_ID;
attr.id = SAI_HOSTIF_TABLE_ENTRY_ATTR_TYPE;
attr.value.s32 = SAI_HOSTIF_TABLE_ENTRY_TYPE_TRAP_ID;
sai_host_table_attr.push_back(attr);

sai_host_table_attr[1].id = SAI_HOSTIF_TABLE_ENTRY_ATTR_TRAP_ID;
sai_host_table_attr[1].value.oid = hostif_trap_id;
attr.id = SAI_HOSTIF_TABLE_ENTRY_ATTR_TRAP_ID;
attr.value.oid = hostif_trap_id;
sai_host_table_attr.push_back(attr);

sai_host_table_attr[2].id = SAI_HOSTIF_TABLE_ENTRY_ATTR_CHANNEL_TYPE;
sai_host_table_attr[2].value.s32 = SAI_HOSTIF_TABLE_ENTRY_CHANNEL_TYPE_GENETLINK;
attr.id = SAI_HOSTIF_TABLE_ENTRY_ATTR_CHANNEL_TYPE;
attr.value.s32 = SAI_HOSTIF_TABLE_ENTRY_CHANNEL_TYPE_GENETLINK;
sai_host_table_attr.push_back(attr);

sai_host_table_attr[3].id = SAI_HOSTIF_TABLE_ENTRY_ATTR_HOST_IF;
sai_host_table_attr[3].value.oid = hostif_map->second;
attr.id = SAI_HOSTIF_TABLE_ENTRY_ATTR_HOST_IF;
attr.value.oid = hostif_map->second;
sai_host_table_attr.push_back(attr);

sai_status_t status = sai_hostif_api->create_hostif_table_entry(&hostif_table_entry,
gSwitchId, 4,
sai_host_table_attr);
gSwitchId,
(uint32_t)sai_host_table_attr.size(),
sai_host_table_attr.data());

if (status != SAI_STATUS_SUCCESS)
{
Expand Down Expand Up @@ -615,7 +621,7 @@ task_process_status CoppOrch::processCoppRule(Consumer& consumer)
trap group %s, error:%d", idx, hostif_attr.id,
trap_group_name.c_str(), sai_status);

return task_process_status::task_failed;
return task_process_status::task_ignore;
}
}
}
Expand Down
16 changes: 0 additions & 16 deletions swssconfig/sample/00-copp.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,5 @@
"red_action":"drop"
},
"OP": "SET"
},
{
"COPP_TABLE:trap.group.sflow": {
"trap_ids": "sample_packet",
"trap_action":"trap",
"trap_priority":"1",
"queue": "2",
"meter_type":"packets",
"mode":"sr_tcm",
"cir":"1000",
"cbs":"1000",
"red_action":"drop",
"genetlink_name":"psample",
"genetlink_mcgrp_name":"packets"
},
"OP": "SET"
}
]

0 comments on commit 0d774ab

Please sign in to comment.