From ff1ac3b0ec38bcb437ed145834c8081131e3638e Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Fri, 11 Oct 2024 16:06:12 +0000 Subject: [PATCH] [FC] process FC after apply view Signed-off-by: Stepan Blyschak --- orchagent/flexcounterorch.cpp | 47 ++--------------------------- tests/mock_tests/flexcounter_ut.cpp | 11 +++++-- 2 files changed, 11 insertions(+), 47 deletions(-) diff --git a/orchagent/flexcounterorch.cpp b/orchagent/flexcounterorch.cpp index 19302face9..570479d5b5 100644 --- a/orchagent/flexcounterorch.cpp +++ b/orchagent/flexcounterorch.cpp @@ -112,14 +112,6 @@ void FlexCounterOrch::doTask(Consumer &consumer) if (op == SET_COMMAND) { - auto itDelay = std::find(std::begin(data), std::end(data), FieldValueTuple(FLEX_COUNTER_DELAY_STATUS_FIELD, "true")); - string poll_interval; - - if (itDelay != data.end()) - { - consumer.m_toSync.erase(it++); - continue; - } for (auto valuePair:data) { const auto &field = fvField(valuePair); @@ -237,12 +229,6 @@ void FlexCounterOrch::doTask(Consumer &consumer) } } } - 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()); @@ -291,39 +277,10 @@ bool FlexCounterOrch::bake() * By default, it should fetch items from the tables the sub agents listen to, * and then push them into m_toSync of each sub agent. * The motivation is to make sub agents handle the saved entries first and then handle the upcoming entries. + * The FCs are not data plane configuration required during reconciling process, hence don't do anything in bake. */ - std::deque entries; - vector keys; - m_flexCounterConfigTable.getKeys(keys); - for (const auto &key: keys) - { - if (!flexCounterGroupMap.count(key)) - { - SWSS_LOG_NOTICE("FlexCounterOrch: Invalid flex counter group intput %s is skipped during reconciling", key.c_str()); - continue; - } - - if (key == BUFFER_POOL_WATERMARK_KEY) - { - SWSS_LOG_NOTICE("FlexCounterOrch: Do not handle any FLEX_COUNTER table for %s update during reconciling", - BUFFER_POOL_WATERMARK_KEY); - continue; - } - - KeyOpFieldsValuesTuple kco; - - kfvKey(kco) = key; - kfvOp(kco) = SET_COMMAND; - - if (!m_flexCounterConfigTable.get(key, kfvFieldsValues(kco))) - { - continue; - } - entries.push_back(kco); - } - Consumer* consumer = dynamic_cast(getExecutor(CFG_FLEX_COUNTER_TABLE_NAME)); - return consumer->addToSync(entries); + return true; } static bool isCreateOnlyConfigDbBuffers(Table& deviceMetadataConfigTable) diff --git a/tests/mock_tests/flexcounter_ut.cpp b/tests/mock_tests/flexcounter_ut.cpp index b99f9cc25d..a17408e342 100644 --- a/tests/mock_tests/flexcounter_ut.cpp +++ b/tests/mock_tests/flexcounter_ut.cpp @@ -536,8 +536,7 @@ namespace flexcounter_test ASSERT_TRUE(gPortsOrch->allPortsReady()); // Enable and check counters - const std::vector values({ {FLEX_COUNTER_DELAY_STATUS_FIELD, "false"}, - {FLEX_COUNTER_STATUS_FIELD, "enable"} }); + const std::vector values({ {FLEX_COUNTER_STATUS_FIELD, "enable"} }); flexCounterCfg.set("PG_WATERMARK", values); flexCounterCfg.set("QUEUE_WATERMARK", values); flexCounterCfg.set("QUEUE", values); @@ -831,6 +830,14 @@ namespace flexcounter_test entries.clear(); static_cast(gBufferOrch)->doTask(); ASSERT_TRUE(checkFlexCounter(BUFFER_POOL_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP, pool_oid)); + + // Warm/fast-boot case - no FC processing done before APPLY_VIEW + std::vector ts; + + gDirectory.get()->bake(); + gDirectory.get()->dumpPendingTasks(ts); + + ASSERT_TRUE(ts.empty()); } INSTANTIATE_TEST_CASE_P(