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 SNMP output having fewer unicast queues than expected #330

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 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
13 changes: 11 additions & 2 deletions src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,20 @@ def update_stats(self):
if_queues = self.port_queue_list_map[if_index]
namespace = self.port_index_namespace[if_index]

# The first half of queue id is for ucast, and second half is for mcast
# Count number of unicast queues
pq_count = 0
for queue in if_queues:
queue_sai_oid = self.port_queues_map[mibs.queue_key(if_index, queue)]
if self.queue_type_map[namespace].get(queue_sai_oid) == 'SAI_QUEUE_TYPE_UNICAST':
pq_count = pq_count + 1

# If there are fewer unicast queues than half of max queues, we use the old assumption of second half mcast
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is best that we don't do this - instead return only unicast queues at all times.

# 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)
max_queues_half = math.ceil(int(port_max_queues) / 2)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can achieve https://github.com/sonic-net/sonic-snmpagent/pull/330/files#r1786870229 by not doing this check and keeping pq_count as the number of actual unicast queues at all times.

if pq_count < max_queues_half:
pq_count = max_queues_half
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a new testcase which could fail the code before your PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new sub-case to an existing test case to check.

Note: If we will commit to returning all queues, or only returning unicast queues (no matter the number), then this test case, along with other test cases will need to be updated.


for queue in if_queues:
# Get queue type and statistics
Expand Down
Loading