From 6a042e23f98f52e994e02d0dcaeaa147ea1c6033 Mon Sep 17 00:00:00 2001 From: Dylan Godwin Date: Thu, 29 Aug 2024 14:36:48 -0400 Subject: [PATCH] Fix SNMP QoS MIB only shows queues 1-6 on platform with 8 ucast/4 mcast queues (Fix for https://github.com/sonic-net/sonic-buildimage/issues/20033) Signed-off-by: Dylan Godwin --- .../mibs/vendor/cisco/ciscoSwitchQosMIB.py | 7 +++++++ tests/mock_tables/asic0/state_db.json | 3 +++ tests/mock_tables/asic1/state_db.json | 3 +++ tests/mock_tables/asic2/state_db.json | 3 +++ tests/mock_tables/state_db.json | 17 ++++++++++++----- 5 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py index d0a9fb916..d5a9bd99a 100644 --- a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py +++ b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py @@ -149,6 +149,13 @@ def update_stats(self): if pq_count < max_queues_half: pq_count = max_queues_half + # If there is a max_priority_group param in statedb, use that if it is greater + priority_group_count = int(Namespace.dbs_get_all(self.db_conn, mibs.STATE_DB, + mibs.buffer_max_parm_table(self.oid_name_map[if_index]))['max_priority_groups']) + + if(pq_count < priority_group_count): + pq_count = priority_group_count + for queue in if_queues: # Get queue type and statistics queue_sai_oid = self.port_queues_map[mibs.queue_key(if_index, queue)] diff --git a/tests/mock_tables/asic0/state_db.json b/tests/mock_tables/asic0/state_db.json index 5c281f9f4..897acc753 100644 --- a/tests/mock_tables/asic0/state_db.json +++ b/tests/mock_tables/asic0/state_db.json @@ -35,12 +35,15 @@ "state": "Active" }, "BUFFER_MAX_PARAM_TABLE|Ethernet0": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet4": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet24": { + "max_priority_groups": "8", "max_queues": "16" } } diff --git a/tests/mock_tables/asic1/state_db.json b/tests/mock_tables/asic1/state_db.json index 026d90b49..3d337e49c 100644 --- a/tests/mock_tables/asic1/state_db.json +++ b/tests/mock_tables/asic1/state_db.json @@ -32,12 +32,15 @@ "state": "Established" }, "BUFFER_MAX_PARAM_TABLE|Ethernet8": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet12": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet32": { + "max_priority_groups": "8", "max_queues": "16" } } diff --git a/tests/mock_tables/asic2/state_db.json b/tests/mock_tables/asic2/state_db.json index be6fe9a42..6967b394e 100644 --- a/tests/mock_tables/asic2/state_db.json +++ b/tests/mock_tables/asic2/state_db.json @@ -6,12 +6,15 @@ "state": "Established" }, "BUFFER_MAX_PARAM_TABLE|Ethernet-BP16": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet-BP20": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet40": { + "max_priority_groups": "8", "max_queues": "16" } } diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index 7de231f3d..1f5c680a3 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -197,24 +197,31 @@ "state" : "Deleted" }, "BUFFER_MAX_PARAM_TABLE|Ethernet0": { - "max_queues": "16" + "max_queues": "16", + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet4": { - "max_queues": "16" + "max_queues": "16", + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet8": { - "max_queues": "16" + "max_queues": "16", + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet16": { - "max_queues": "16" + "max_queues": "16", + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet24": { - "max_queues": "16" + "max_queues": "16", + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet32": { + "max_priority_groups": "8", "max_queues": "16" }, "BUFFER_MAX_PARAM_TABLE|Ethernet78": { + "max_priority_groups": "8", "max_queues": "16" } }