From d3ecb9d44ec47c12abda5d8738a01ef9b112d944 Mon Sep 17 00:00:00 2001 From: dygodwin Date: Wed, 4 Dec 2024 10:17:19 -0500 Subject: [PATCH] Fix missing queues in SNMP MIB when create_only_db_buffers=true This will fix current failure in test_snmp_queue_counters.py on platforms which have a different number of unicast and multicast queue (example Tomahawk4 with 8 unicast and 4 multicast queues configured) What I did: Added some additional logic on top of changes made in https://github.com/sonic-net/sonic-snmpagent/pull/330 to also check for "max_priority_groups" in buffer_parms, and use it to loop through queues if it is greater than max_queues/2 (only 6 on TH4 platform which is what was fixed in #330) and greater than the count of UNICAST queues in the DB. How I verified: Logic should not break other platforms. Verified on Nokia H4-64D. Reran all SNMP tests in mgmt and they pass including test_snmp_queue_counters.py --- .../mibs/vendor/cisco/ciscoSwitchQosMIB.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py index d0a9fb916..bfe8c7e4c 100644 --- a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py +++ b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py @@ -149,6 +149,16 @@ def update_stats(self): if pq_count < max_queues_half: pq_count = max_queues_half + # Check number of priority groups (We may use this value if create_db_buffers_only removes intermediary queues eg. Ethernet0[3-4]) + pg_max = 0; + buffer_parms = Namespace.dbs_get_all(self.db_conn, mibs.STATE_DB, + mibs.buffer_max_parm_table(self.oid_name_map[if_index])) + if 'max_priority_groups' in buffer_parms: + pg_max = int(buffer_parms['max_priority_groups']) + + if(pq_count < pg_max): + pq_count = pg_max + for queue in if_queues: # Get queue type and statistics queue_sai_oid = self.port_queues_map[mibs.queue_key(if_index, queue)]