From 30157c33e22a249fc51c851643b47fcd416935b3 Mon Sep 17 00:00:00 2001 From: raaghavendrakra-arista Date: Mon, 17 Feb 2025 14:02:00 +0530 Subject: [PATCH] Fixed logic to delete the interface from BUFFER_QUEUE (#16687) Description of PR The interface from where the queuestats fetched was different from the interface that was deleted from the BUFFER_QUEUE. Github issue: aristanetworks/sonic-qual.msft#371 This issue is seen after PR: #15688 The issue was that XML dump is below for context buffer_queue_to_del = 'Ethernet112|6' buffer_queues = ['Ethernet112|0-1', 'Ethernet112|2-4', 'Ethernet112|5', 'Ethernet112|6', 'Ethernet112|7', 'Ethernet116|0-1', ...] buffer_queues_removed = 1 interface = 'Ethernet68' When the string 'Ethernet112|6' when split with delimiter "|" the string in 1st index "6" is a substring of "Ethernet68" and it picked as a candidate to delete it from BQ, which is wrong. Summary: Fixes # aristanetworks/sonic-qual.msft#371 --- tests/snmp/test_snmp_queue_counters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/snmp/test_snmp_queue_counters.py b/tests/snmp/test_snmp_queue_counters.py index 3cdd1a6497c..5bbab89680f 100644 --- a/tests/snmp/test_snmp_queue_counters.py +++ b/tests/snmp/test_snmp_queue_counters.py @@ -116,7 +116,7 @@ def test_snmp_queue_counters(duthosts, # Get appropriate buffer queue value to delete buffer_queues = list(data['BUFFER_QUEUE'].keys()) - iface_buffer_queues = [bq for bq in buffer_queues if any(val in interface for val in bq.split('|'))] + iface_buffer_queues = [bq for bq in buffer_queues if bq.split('|')[0] == interface] if iface_buffer_queues: buffer_queue_to_del = iface_buffer_queues[0] else: