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

[orchagent]: Skip installing ACL counter when ACL mirror rule is inactive #3223

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,23 @@ bool AclRuleMirror::validate()
return true;
}

bool AclRuleMirror::createCounter()
{
SWSS_LOG_ENTER();

bool state = false;

m_pMirrorOrch->getSessionStatus(m_sessionName, state);

// If the mirror session is active, create the ACL counter
if(state)
{
return AclRule::createCounter();
}

return true;
}

bool AclRuleMirror::createRule()
{
SWSS_LOG_ENTER();
Expand Down Expand Up @@ -2152,7 +2169,11 @@ void AclRuleMirror::onUpdate(SubjectType type, void *cntx)
if (update->active)
{
SWSS_LOG_INFO("Activating mirroring ACL %s for session %s", m_id.c_str(), m_sessionName.c_str());
activate();
// During mirror session activation, the newly created counter needs to be registered to the FC.
if(activate() && hasCounter())
{
m_pAclOrch->registerFlexCounter(*this);
}
}
else
{
Expand Down
1 change: 1 addition & 0 deletions orchagent/aclorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ class AclRuleMirror: public AclRule
AclRuleMirror(AclOrch *m_pAclOrch, MirrorOrch *m_pMirrorOrch, string rule, string table);
bool validateAddAction(string attr_name, string attr_value);
bool validate();
bool createCounter();
bool createRule();
bool removeRule();
void onUpdate(SubjectType, void *) override;
Expand Down
Loading