From eb9538a4b6d450927eecbee2cc2de58f4c06125e 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 | 5 ++--- tests/mock_tables/asic0/state_db.json | 6 +++--- tests/mock_tables/asic1/state_db.json | 6 +++--- tests/mock_tables/asic2/state_db.json | 6 +++--- tests/mock_tables/state_db.json | 12 ++++++------ 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py index 31df647d0..0534b6106 100644 --- a/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py +++ b/src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py @@ -136,9 +136,8 @@ def update_stats(self): # The first half of queue id is for ucast, and second half is for mcast # To simulate vendor OID, we wrap queues by max priority groups - port_max_queues = Namespace.dbs_get_all(self.db_conn, mibs.STATE_DB, - mibs.buffer_max_parm_table(self.oid_name_map[if_index]))['max_queues'] - pq_count = math.ceil(int(port_max_queues) / 2) + pq_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']) for queue in if_queues: # Get queue type and statistics diff --git a/tests/mock_tables/asic0/state_db.json b/tests/mock_tables/asic0/state_db.json index 5c281f9f4..df83f5716 100644 --- a/tests/mock_tables/asic0/state_db.json +++ b/tests/mock_tables/asic0/state_db.json @@ -35,12 +35,12 @@ "state": "Active" }, "BUFFER_MAX_PARAM_TABLE|Ethernet0": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet4": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet24": { - "max_queues": "16" + "max_priority_groups": "8" } } diff --git a/tests/mock_tables/asic1/state_db.json b/tests/mock_tables/asic1/state_db.json index 026d90b49..ddacc46f6 100644 --- a/tests/mock_tables/asic1/state_db.json +++ b/tests/mock_tables/asic1/state_db.json @@ -32,12 +32,12 @@ "state": "Established" }, "BUFFER_MAX_PARAM_TABLE|Ethernet8": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet12": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet32": { - "max_queues": "16" + "max_priority_groups": "8" } } diff --git a/tests/mock_tables/asic2/state_db.json b/tests/mock_tables/asic2/state_db.json index be6fe9a42..8168025e8 100644 --- a/tests/mock_tables/asic2/state_db.json +++ b/tests/mock_tables/asic2/state_db.json @@ -6,12 +6,12 @@ "state": "Established" }, "BUFFER_MAX_PARAM_TABLE|Ethernet-BP16": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet-BP20": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet40": { - "max_queues": "16" + "max_priority_groups": "8" } } diff --git a/tests/mock_tables/state_db.json b/tests/mock_tables/state_db.json index ad4cd5eca..81b72b09e 100644 --- a/tests/mock_tables/state_db.json +++ b/tests/mock_tables/state_db.json @@ -197,21 +197,21 @@ "state" : "Deleted" }, "BUFFER_MAX_PARAM_TABLE|Ethernet0": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet4": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet8": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet16": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet24": { - "max_queues": "16" + "max_priority_groups": "8" }, "BUFFER_MAX_PARAM_TABLE|Ethernet32": { - "max_queues": "16" + "max_priority_groups": "8" } }