Skip to content

Fix buffer queue cnt test to account for different BUFFER_QUEUE configs#19310

Merged
StormLiangMS merged 4 commits intosonic-net:masterfrom
zbud-msft:fix_buffer_queue_cnt_test
Jul 8, 2025
Merged

Fix buffer queue cnt test to account for different BUFFER_QUEUE configs#19310
StormLiangMS merged 4 commits intosonic-net:masterfrom
zbud-msft:fix_buffer_queue_cnt_test

Conversation

@zbud-msft
Copy link
Contributor

@zbud-msft zbud-msft commented Jul 1, 2025

Description of PR

Summary:
Fixes #19201
MSADO: 33479698

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 

or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc

The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  

When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?

Code change

How did you verify/test it?

Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@developfast developfast left a comment

Choose a reason for hiding this comment

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

as comments

duthost.copy(content=json.dumps(data, indent=4), dest=CFG_DB_PATH)
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True, wait_for_bgp=True)
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True,
wait_for_bgp=True, yang_validate=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

is the yang_validate to False intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, after modifying BUFFER_QUEUE and doing config reload, we will skip yang validation.

"""If all queues for that pool are in the same pool ex Ethernet0|0-9
We will modify to separate the first queue and the remaining such
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9"""
single_key = False
Copy link
Contributor

Choose a reason for hiding this comment

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

The variable name single_key is misleading. It actually indicates whether we have a single queue (not a range). Consider renaming to is_single_queue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed and changed.

We will modify to separate the first queue and the remaining such
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9"""
single_key = False
bq_entry = interface_buffer_queues[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a check to ensure interface_buffer_queues is not empty before accessing interface_buffer_queues[0]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

del data['BUFFER_QUEUE'][bq_entry]
bq_entry = single_queue_entry
else:
pytest.skip("Invalid buffer queue range")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: the logic here is pretty useful for other use cases too. Wanna split the logic out into a helper func to make it more readable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can take this effort in some future PR.

= "true"
load_new_cfg(duthost, data)
pytest_assert(wait_until(120, 20, 0, check_buffer_queues_cnt_cmd_output, ptfhost, gnxi_path,
dut_ip, interface_to_check, env.gnmi_port), "Unable to get map data")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you make the failure message more specific?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures the buffer‐queue count test correctly handles configurations where all queues for an interface are defined in a single range (e.g., Ethernet0|0-9) by splitting that range before removal, and adds a parameter to disable YANG validation on reload.

  • Pass yang_validate=False into config_reload to skip YANG validation during test config loads.
  • Before removing a buffer‐queue entry, detect and split grouped queue ranges into a single‐queue entry and a remaining range.
  • Wrap the removal and assertions in a try/finally to restore the original configuration regardless of test outcome.
Comments suppressed due to low confidence (1)

tests/telemetry/test_telemetry.py:34

  • [nitpick] Add a brief inline comment explaining why yang_validate=False is required here (e.g., to bypass YANG schema checks for test changes).
    config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True,

Comment on lines +192 to +194
"""If all queues for that pool are in the same pool ex Ethernet0|0-9
We will modify to separate the first queue and the remaining such
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9"""
Copy link

Copilot AI Jul 2, 2025

Choose a reason for hiding this comment

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

[nitpick] This triple-quoted string is a hanging literal used as a comment. Replace it with standard # comments to avoid leaving unused string literals in the function body.

Suggested change
"""If all queues for that pool are in the same pool ex Ethernet0|0-9
We will modify to separate the first queue and the remaining such
that we get a separate entry for Ethernet0|0 and Ethernet0|1-9"""
# If all queues for that pool are in the same pool, e.g., Ethernet0|0-9,
# we will modify to separate the first queue and the remaining such
# that we get a separate entry for Ethernet0|0 and Ethernet0|1-9.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

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

lol so useless

@zbud-msft zbud-msft requested review from make1980 and qiluo-msft July 2, 2025 23:08
Copy link

@make1980 make1980 left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Contributor

@developfast developfast left a comment

Choose a reason for hiding this comment

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

lgtm

@zbud-msft
Copy link
Contributor Author

Hi @yejianquan can you please help with merge/backport to 202505?

Copy link
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit f9c5825 into sonic-net:master Jul 8, 2025
15 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jul 8, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202411: #19466

mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Jul 10, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202505: #19501

mssonicbld pushed a commit that referenced this pull request Jul 10, 2025
…gs (#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
kperumalbfn pushed a commit that referenced this pull request Jul 15, 2025
…gs (#19310) (#19466)

Fix buffer queue cnt test to account for different BUFFER_QUEUE configs
@liuh-80
Copy link
Contributor

liuh-80 commented Jul 16, 2025

@zbud-msft , the cherry-pick PR #19466 break test_telemetry.py on 202411 branch:

File "/var/src/sonic-mgmt/tests/telemetry/test_telemetry.py", line 34, in load_new_cfg
config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True,
File "/var/src/sonic-mgmt/tests/common/plugins/loganalyzer/utils.py", line 24, in decorated
res = func(*args, **kwargs)
TypeError: config_reload() got an unexpected keyword argument 'yang_validate'

Maybe other branch also broken.

nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
wangxin pushed a commit to wangxin/sonic-mgmt that referenced this pull request Oct 27, 2025
Code sync sonic-net/sonic-mgmt:202411 => 202412

```
*   c3fd4c0 (HEAD -> code-sync-202412, origin/code-sync-202412) r12f 250802:1704 - Merge remote-tracking branch 'base/202411' into code-sync-202412
|\
| * a7a638a (base/202411) nnelluri-cisco 250722:1131 - cherry pick for the PR#17101 (sonic-net#19748)
| * fd4ae21 siva-prasad-cisco 250731:0002 - Ignore log analyzer error message related to source port GID mapping in kernel (sonic-net#19879)
| * f986cfa Xu Chen 250730:2120 - Fix saithrift URL generation for Mellanox on internal-202411 branch sonic-net#19899
| * a07fb04 nnelluri-cisco 250604:1347 - filterd backplane ports while checking 'sudo sfputil show error-status' (sonic-net#17859)
| * d707fcf nnelluri-cisco 250729:1208 - Added DPC role support for SmartSwitch. (sonic-net#18157)
| * 80ea05a dypet 250414:1059 - Fix BFD status check and ipv6 PTF intermittent issue. (sonic-net#17819)
| * fc623da Xu Chen 250725:1036 - support dynamic saithrift URL generation (sonic-net#19528)
| * 0e5fc8a Mai Bui 250724:1807 - [202411] Ignore auditd error in loganalyzer (sonic-net#19767)
| * d03770d Hua Liu 250218:1409 - [TACACS] Increase tacacs server reachability check timeout (sonic-net#16971)
| * e8111ac nnelluri-cisco 250717:1033 - Generate new npu-dpu ports Ethernet224 To Ethernet280 for cisco smartswicth "Cisco-8102-28FH-DPU-O" (sonic-net#19257)
| * e0060fa Zain Budhwani 250716:1109 - Remove yang_validate option from 202411 (sonic-net#19674)
| * 89c4281 AharonMalkin 250715:2042 - Add Nvidia to supported platforms on intf_fec test (sonic-net#19398)
| * f35fc20 mssonicbld 250716:0129 - Fix buffer queue cnt test to account for different BUFFER_QUEUE configs (sonic-net#19310) (sonic-net#19466)
| * 3e0cabd Chuan Wu 250704:0327 - Update vlan ping test to override the affection of secondary vlan ip (sonic-net#18867)
| * ff9d112 Longxiang Lyu 250714:1508 - [dualtor-io] Fix `test_active_link_admin_down_config_reload_link_up_downstream_standby` on Cisco/MLNX (sonic-net#18829) (sonic-net#19511)
| * e870d66 Yawen 250714:1246 - [manual cherry-pick] add topo dualtor-aa-64-breakout to qos_sai_base.py (sonic-net#19543)
| * 8369780 prabhataravind 250711:0929 - Enable skipped BFD and VxLAN tests on smartswitch T1 (sonic-net#19498)
```
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:0\"
}
]
GRPC error
 redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:1\"
}
]
The GetResponse is below
-------------------------

oid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:2\"
}
]
The GetResponse is below
-------------------------

oid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:3\"
}
]
The GetResponse is below
-------------------------

oid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:4\"
}
]
The GetResponse is below
-------------------------

oid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:5\"
}
]
The GetResponse is below
-------------------------

oid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path
 ------------------------- 
 [elem {
  name: \"COUNTERS_QUEUE_NAME_MAP\"
}
elem {
  name: \"Ethernet0:6\"
}
]
The GetResponse is below
-------------------------

oid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Signed-off-by: opcoder0 <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    },
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Signed-off-by: Guy Shemesh <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    },
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    },
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Signed-off-by: Guy Shemesh <[email protected]>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    }, 
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },      
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },      
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },  
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    },
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Signed-off-by: Guy Shemesh <[email protected]>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
…gs (sonic-net#19310)

Approach
What is the motivation for this PR?
Currently this test does not account for BUFFER_QUEUE configs to have only entry for an interface.

In some SKU's and config

BUFFER_QUEUE may have config such as

"BUFFER_QUEUE": {
    "Ethernet0|0-2": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|3-4": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|5-7": {
        "profile": "egress_lossy_profile"
    },
or even

"BUFFER_QUEUE": {
    "Ethernet0|0": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet0|1": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet0|2": {
        "profile": "egress_lossy_profile"
    },  ... etc
The test works fine for the above configs.

However if the BUFFER_QUEUE was configured such as

"BUFFER_QUEUE": {
    "Ethernet0|0-9": {
        "profile": "egress_lossy_profile"
    },
    "Ethernet100|0-9": {
        "profile": "egress_lossless_profile"
    },
    "Ethernet200|0-9": {
        "profile": "egress_lossy_profile"
    },
When we delete Ethernet0|0-9 as part of del data['BUFFER_QUEUE'][ interface_buffer_queues[0] ] we end up deleting all queues for that interface from COUNTERS_QUEUE_NAME_MAP which causes check_buffer_queues_cnt_cmd_output to always return false.

This test checks for such edge case and we split the BUFFER_QUEUE config such that we can delete an entry without deleting all entries in the map.

How did you do it?
Code change

How did you verify/test it?
Test on 20241110

01/07/2025 19:00:48 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"failed": true, "changed": true, "end": "2025-07-01 19:00:48.806079", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:0\"\n}\n]\nGRPC error\n redis: nil", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "delta": "0:00:00.199525", "stderr": "", "rc": 1, "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:0             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "start": "2025-07-01 19:00:48.606554", "msg": "non-zero return code", "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:0\"", "}", "]", "GRPC error", " redis: nil"], "stderr_lines": [], "_ansible_no_log": false}
01/07/2025 19:00:48 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.227872", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:1\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x15000000000679", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:48.981566", "stderr": "", "delta": "0:00:00.246306", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:1             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:1\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x15000000000679"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:49 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.614484", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:2\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067a", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.411463", "stderr": "", "delta": "0:00:00.203021", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:2             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:2\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067a"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:49 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:49.997748", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:3\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067b", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:49.798159", "stderr": "", "delta": "0:00:00.199589", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:3             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:3\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067b"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.381489", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:4\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067c", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.177327", "stderr": "", "delta": "0:00:00.204162", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:4             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:4\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067c"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:50 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:50.771962", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:5\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067d", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.566323", "stderr": "", "delta": "0:00:00.205639", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:5             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "chdir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:5\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067d"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}
01/07/2025 19:00:50 base._run                                L0071 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell, args=["python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             "], kwargs={"module_ignore_errors": true}                                                                                                                                                                                                                                                                                                                          01/07/2025 19:00:51 base._run                                L0108 DEBUG  | /var/src/sonic-mgmt-int/tests/telemetry/test_telemetry.py::get_buffer_queues_cnt#47: [xxxxx-x] AnsibleModule::shell Result => {"changed": true, "end": "2025-07-01 19:00:51.236571", "stdout": "Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path\n ------------------------- \n [elem {\n  name: \"COUNTERS_QUEUE_NAME_MAP\"\n}\nelem {\n  name: \"Ethernet0:6\"\n}\n]\nThe GetResponse is below\n-------------------------\n\noid:0x1500000000067e", "cmd": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "rc": 0, "start": "2025-07-01 19:00:50.951268", "stderr": "", "delta": "0:00:00.285303", "invocation": {"module_args": {"creates": null, "executable": null, "_uses_shell": true, "strip_empty_ends": true, "_raw_params": "python /root/gnxi/gnmi_cli_py/py_gnmicli.py -g -t xx.xx.xxx.xxx             -p 50051 -m get -x COUNTERS_QUEUE_NAME_MAP/Ethernet0:6             -xt COUNTERS_DB -o \"xxxxxxxxx\"             ", "removes": null, "argv": null, "warn": true, "choir": null, "stdin_add_newline": true, "stdin": null}}, "stdout_lines": ["Performing GetRequest, encoding=JSON_IETF to xx.xx.xxx.xxx  with the following gNMI Path", " ------------------------- ", " [elem {", "  name: \"COUNTERS_QUEUE_NAME_MAP\"", "}", "elem {", "  name: \"Ethernet0:6\"", "}", "]", "The GetResponse is below", "-------------------------", "", "oid:0x1500000000067e"], "stderr_lines": [], "_ansible_no_log": false, "failed": false}

Signed-off-by: Yael Tzur <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: test_telemetry_queue_buffer_cnt test does not account for a single BUFFER_QUEUE entry for an interface

8 participants