Skip to content
Merged
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
26 changes: 20 additions & 6 deletions orchagent/flex_counter/flex_counter_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,28 @@ struct CachedObjects
auto counter_ids = FlexCounterManager::serializeCounterStats(pending_counter_stats);
auto counter_type_it = FlexCounterManager::counter_id_field_lookup.find(pending_counter_type);

auto counter_keys = group_name + ":";
for (const auto& oid: pending_sai_objects)
// Temporary fix for SNMP PFC counter issue: disable bulk init requests for PORT counters
// This forces each port to be processed individually, avoiding capability mismatch
// for different ports in bulk requests
if (pending_counter_type == CounterType::PORT)
{
counter_keys += sai_serialize_object_id(oid) + ",";
for (const auto& oid: pending_sai_objects)
{
auto counter_key = group_name + ":" + sai_serialize_object_id(oid);
startFlexCounterPolling(pending_switch_id, counter_key, counter_ids, counter_type_it->second);
}
}
else
{
auto counter_keys = group_name + ":";
for (const auto& oid: pending_sai_objects)
{
counter_keys += sai_serialize_object_id(oid) + ",";
}
counter_keys.pop_back();

startFlexCounterPolling(pending_switch_id, counter_keys, counter_ids, counter_type_it->second);
}
counter_keys.pop_back();

startFlexCounterPolling(pending_switch_id, counter_keys, counter_ids, counter_type_it->second);

/* Clear the cached stats and objects after flush */
pending_sai_objects.clear();
Expand Down
4 changes: 3 additions & 1 deletion tests/mock_tests/flexcounter_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1064,7 +1064,9 @@ namespace flexcounter_test
port_stat_manager.flush();

/* SAIREDIS channel should have been called thrice, once for port1&port2,port3,port4 */
ASSERT_EQ(mockFlexCounterOperationCallCount, 3);
// ASSERT_EQ(mockFlexCounterOperationCallCount, 3);
// Temporary fix for SNMP PFC counter issue: disabled bulk init requests for PORT counters
ASSERT_EQ(mockFlexCounterOperationCallCount, 4);

ASSERT_TRUE(checkFlexCounter(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP, port1_oid,
{
Expand Down
Loading