-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copp sflow changes #1011
Copp sflow changes #1011
Conversation
a50e717
to
c98babb
Compare
c98babb
to
0d774ab
Compare
retest this please |
undoing revert indentation Code review fixes Addressing code review comments Latest copp changes based on headers
Addressing code review comments
43c91a0
to
59d93d9
Compare
UT Fixes Fixing build Build fix
59d93d9
to
42a289f
Compare
orchagent/copporch.cpp
Outdated
|
||
if (!gPortsOrch->allPortsReady()) | ||
{ | ||
return; | ||
} | ||
|
||
if (table_name == CFG_SFLOW_TABLE_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be done irrespective of allPortsReady
. It can avoid the wait.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an else case
and log NOTICE stating 'not implemented'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will add comment, since a log will be misleading
orchagent/copporch.cpp
Outdated
|
||
if (!genetlink_attribs.empty()) | ||
{ | ||
if (!createGenetlinkHostifTable(trap_id_list)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if -> If
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@@ -344,6 +465,14 @@ task_process_status CoppOrch::processCoppRule(Consumer& consumer) | |||
if (fvField(*i) == copp_trap_id_list) | |||
{ | |||
trap_id_list = tokenize(fvValue(*i), list_item_delimiter); | |||
auto it = std::find(trap_id_list.begin(), trap_id_list.end(), "sample_packet"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this have other traps in list that must installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Only sflow can be supported in this trap group
orchagent/copporch.cpp
Outdated
{ | ||
auto hostif_map = m_trap_group_hostif_map.find(m_trap_group_map[trap_group_name]); | ||
|
||
if (hostif_map != m_trap_group_hostif_map.end()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a use-case for setting Genetlink host if attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Will remove this code
{ | ||
trap_ids_to_reset.push_back(it.first); | ||
} | ||
sai_status = sai_hostif_api->remove_hostif_trap(it.second.trap_obj); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this new code? I mean it looks generic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is added to clean up hostif trap during delete case, which was missing in the existing logic
orchagent/copporch.cpp
Outdated
@@ -189,6 +191,60 @@ void CoppOrch::getTrapIdList(vector<string> &trap_id_name_list, vector<sai_hosti | |||
} | |||
} | |||
|
|||
bool CoppOrch::createGenetlinkHostifTable(vector<string> &trap_id_name_list) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if -> If
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
orchagent/copporch.cpp
Outdated
for (auto trap_id : trap_id_list) | ||
{ | ||
auto hostTbl_entry = m_trapid_hostif_table_map.find(trap_id); | ||
sai_object_id_t trap_group_id = m_syncdTrapIds[trap_id].trap_group_obj; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be inside the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
orchagent/copporch.cpp
Outdated
|
||
for (auto trap_id : trap_id_list) | ||
{ | ||
auto hostTbl_entry = m_trapid_hostif_table_map.find(trap_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use variable style consistently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
retest this please |
"genetlink_name":"psample", | ||
"genetlink_mcgrp_name":"packets" | ||
}, | ||
"OP": "SET" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to remove this configuration, so that we can merge other parts of the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Guohan,
Now the changes are made in such a way that only when "config sflow enable" is issued in platform, these configurations would be played. Hence in platforms which doesn't support sflow, these configurations would not be played at all
* Change admin_state from enable/disable to up/down to match SONiC YANG. Signed-off-by: Garrick He <[email protected]>
retest this please |
retest this please |
2 similar comments
retest this please |
retest this please |
) Create environment files for SONiC immutable attribute. The file will reside in the incoming image dir under sonic-config dir. Incoming image will then move the file to /etc/sonic. The file will be used to avoid calls into cfggen for those attributes. signed-off-by: Tamer Ahmed <[email protected]>
What I did
Copp orch changes for programming genetlink attributes defined in opencomputeproject/SAI#936 and also defining trap group for SFLOW
Why I did it
As part of SFLOW changes in host interface are required to support genetlink.
How I verified it
Details if related
PLEASE DO NOT MERGE UNTIL SAI Support is added.