Skip to content

Commit

Permalink
[Flex Counters] Delay flex counters even if tables are present in the…
Browse files Browse the repository at this point in the history
… DB (#1877)

**What I did**
Check if delay indicator flag is exist and 'true', if it does, skip the counter enablement.

**Why I did it**
Currently if flex counters tables are present in config DB the delay mechanism will not take place.
This change is to make sure the delay will take place even if the tables are present in the DB.

**How I verified it**
Observer counters are created after enable_counters script is called.

**Details if related**
  • Loading branch information
shlomibitton committed Sep 2, 2021
1 parent eb79ca4 commit 5643532
Showing 1 changed file with 12 additions and 0 deletions.
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())
{
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

0 comments on commit 5643532

Please sign in to comment.