Skip to content
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

Merged
merged 8 commits into from
Oct 28, 2019
Merged

Copp sflow changes #1011

merged 8 commits into from
Oct 28, 2019

Conversation

dgsudharsan
Copy link
Collaborator

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.

orchagent/copporch.cpp Outdated Show resolved Hide resolved
orchagent/copporch.cpp Outdated Show resolved Hide resolved
@lguohan
Copy link
Contributor

lguohan commented Sep 17, 2019

retest this please

orchagent/copporch.h Outdated Show resolved Hide resolved
orchagent/copporch.h Outdated Show resolved Hide resolved
orchagent/copporch.cpp Outdated Show resolved Hide resolved
dgsudharsan added 3 commits October 6, 2019 20:58
undoing revert

indentation

Code review fixes

Addressing code review comments

Latest copp changes based on headers
Addressing code review comments
UT Fixes

Fixing build

Build fix

if (!gPortsOrch->allPortsReady())
{
return;
}

if (table_name == CFG_SFLOW_TABLE_NAME)
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

}
}
}
}
Copy link
Collaborator

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'

Copy link
Collaborator Author

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


if (!genetlink_attribs.empty())
{
if (!createGenetlinkHostifTable(trap_id_list))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if -> If

Copy link
Collaborator Author

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");
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

{
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())
Copy link
Collaborator

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?

Copy link
Collaborator Author

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);
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

@@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if -> If

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

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;
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


for (auto trap_id : trap_id_list)
{
auto hostTbl_entry = m_trapid_hostif_table_map.find(trap_id);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use variable style consistently

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@lguohan
Copy link
Contributor

lguohan commented Oct 14, 2019

retest this please

"genetlink_name":"psample",
"genetlink_mcgrp_name":"packets"
},
"OP": "SET"
Copy link
Contributor

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.

Copy link
Collaborator Author

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

dgsudharsan and others added 2 commits October 16, 2019 13:35
* Change admin_state from enable/disable to up/down to match SONiC YANG.

Signed-off-by: Garrick He <garrick_he@dell.com>
@prsunny
Copy link
Collaborator

prsunny commented Oct 22, 2019

retest this please

@prsunny
Copy link
Collaborator

prsunny commented Oct 22, 2019

retest this please

2 similar comments
@prsunny
Copy link
Collaborator

prsunny commented Oct 23, 2019

retest this please

@dgsudharsan
Copy link
Collaborator Author

retest this please

@prsunny prsunny merged commit b767ca2 into sonic-net:master Oct 28, 2019
EdenGri pushed a commit to EdenGri/sonic-swss that referenced this pull request Feb 28, 2022
)

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 <tamer.ahmed@microsoft.com>
@dgsudharsan dgsudharsan deleted the copp_sflow branch March 9, 2023 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants