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

[Flex Counters] Delay flex counters even if tables are present in the DB #1877

Merged
merged 5 commits into from
Sep 2, 2021
Merged
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
12 changes: 12 additions & 0 deletions orchagent/flexcounterorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ void FlexCounterOrch::doTask(Consumer &consumer)

if (op == SET_COMMAND)
{
auto it = std::find(std::begin(data), std::end(data), FieldValueTuple(FLEX_COUNTER_DELAY_STATUS_FIELD, "true"));

if (it != data.end())
kcudnik marked this conversation as resolved.
Show resolved Hide resolved
{
continue;
}
for (auto valuePair:data)
{
const auto &field = fvField(valuePair);
Expand Down Expand Up @@ -144,6 +150,12 @@ void FlexCounterOrch::doTask(Consumer &consumer)
fieldValues.emplace_back(FLEX_COUNTER_STATUS_FIELD, value);
m_flexCounterGroupTable->set(flexCounterGroupMap[key], fieldValues);
}
else if(field == FLEX_COUNTER_DELAY_STATUS_FIELD)
{
// This field is ignored since it is being used before getting into this loop.
// If it is exist and the value is 'true' we need to skip the iteration in order to delay the counter creation.
// The field will clear out and counter will be created when enable_counters script is called.
}
else
{
SWSS_LOG_NOTICE("Unsupported field %s", field.c_str());
Expand Down