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

Fix for delay flex counters flow #1739

Closed
wants to merge 2 commits into from
Closed
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
4 changes: 4 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4714,6 +4714,10 @@ void PortsOrch::generatePortCounterMap()
auto port_counter_stats = generateCounterStats(PORT_STAT_COUNTER_FLEX_COUNTER_GROUP);
for (const auto& it: m_portList)
{
if (it.first == "CPU")
{
continue;
}
port_stat_manager.setCounterIdList(it.second.m_port_id, CounterType::PORT, port_counter_stats);
}

Expand Down
8 changes: 8 additions & 0 deletions tests/test_flex_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
PG_WATERMARK_MAP = "COUNTERS_PG_NAME_MAP"

NUMBER_OF_RETRIES = 10
CPU_PORT_OID = "0x0"

counter_type_dict = {"port_counter":[PORT_KEY, PORT_STAT, PORT_MAP],
"queue_counter":[QUEUE_KEY, QUEUE_STAT, QUEUE_MAP],
Expand Down Expand Up @@ -72,6 +73,10 @@ def verify_flex_counters_populated(self, map, stat):
oid = counter_entry[1]
self.wait_for_id_list(stat, name, oid)

def verify_cpu_interface_not_in_db(self, stat):
cpu = self.flex_db.db_connection.hgetall("FLEX_COUNTER_TABLE:" + stat + ":" + CPU_PORT_OID)
assert cpu.size() == 0, "FLEX_COUNTER_TABLE:" + stat + ":" + CPU_PORT_OID + " - CPU port exist in DB"

def enable_flex_counter_group(self, group, map):
group_stats_entry = {"FLEX_COUNTER_STATUS": "enable"}
self.config_db.create_entry("FLEX_COUNTER_TABLE", group, group_stats_entry)
Expand All @@ -98,5 +103,8 @@ def test_flex_counters(self, dvs, counter_type):
self.enable_flex_counter_group(counter_key, counter_map)
self.verify_flex_counters_populated(counter_map, counter_stat)

if counter_type == "port_counter":
self.verify_cpu_interface_not_in_db(counter_stat)

if counter_type == "rif_counter":
self.config_db.db_connection.hdel('INTERFACE|Ethernet0|192.168.0.1/24', "NULL")