Skip to content

Commit

Permalink
[aclorch]: Revise ACL rule creation/removal logs (#1042)
Browse files Browse the repository at this point in the history
Adding the table name in the log when creating/removing
the ACL rules.

Signed-off-by: Shu0T1an ChenG <shuche@microsoft.com>
  • Loading branch information
stcheng authored and lguohan committed Aug 30, 2019
1 parent c461911 commit 39fe568
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1498,19 +1498,22 @@ bool AclTable::add(shared_ptr<AclRule> newRule)
if (ruleIter->second->remove())
{
rules.erase(ruleIter);
SWSS_LOG_NOTICE("Successfully deleted ACL rule: %s", rule_id.c_str());
SWSS_LOG_NOTICE("Successfully deleted ACL rule %s in table %s",
rule_id.c_str(), id.c_str());
}
}

if (newRule->create())
{
rules[rule_id] = newRule;
SWSS_LOG_NOTICE("Successfully created ACL rule %s in table %s", rule_id.c_str(), id.c_str());
SWSS_LOG_NOTICE("Successfully created ACL rule %s in table %s",
rule_id.c_str(), id.c_str());
return true;
}
else
{
SWSS_LOG_ERROR("Failed to create rule in table %s", id.c_str());
SWSS_LOG_ERROR("Failed to create ACL rule %s in table %s",
rule_id.c_str(), id.c_str());
return false;
}
}
Expand All @@ -1525,18 +1528,21 @@ bool AclTable::remove(string rule_id)
if (ruleIter->second->remove())
{
rules.erase(ruleIter);
SWSS_LOG_NOTICE("Successfully deleted ACL rule %s", rule_id.c_str());
SWSS_LOG_NOTICE("Successfully deleted ACL rule %s in table %s",
rule_id.c_str(), id.c_str());
return true;
}
else
{
SWSS_LOG_ERROR("Failed to delete ACL rule: %s", rule_id.c_str());
SWSS_LOG_ERROR("Failed to delete ACL rule %s in table %s",
rule_id.c_str(), id.c_str());
return false;
}
}
else
{
SWSS_LOG_WARN("Skip deleting ACL rule. Unknown rule %s", rule_id.c_str());
SWSS_LOG_WARN("Skip deleting unknown ACL rule %s in table %s",
rule_id.c_str(), id.c_str());
return true;
}
}
Expand All @@ -1551,7 +1557,8 @@ bool AclTable::clear()
bool suc = rule.remove();
if (!suc)
{
SWSS_LOG_ERROR("Failed to delete existing ACL rule %s when removing the ACL table %s", rule.getId().c_str(), id.c_str());
SWSS_LOG_ERROR("Failed to delete ACL rule %s when removing the ACL table %s",
rule.getId().c_str(), id.c_str());
return false;
}
}
Expand Down

0 comments on commit 39fe568

Please sign in to comment.