Skip to content

Commit

Permalink
[test_snmp_queue_counters.py]: queuestat command output change fix fo…
Browse files Browse the repository at this point in the history
…r multi-asic
  • Loading branch information
harjotsinghpawra committed Dec 13, 2024
1 parent 2c28912 commit 98da2b3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/snmp/test_snmp_queue_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ def get_queue_ctrs(duthost, cmd):
return len(duthost.shell(cmd)["stdout_lines"])


def get_queuestat_ctrs(duthost, cmd):
cmd_output = duthost.shell(cmd)["stdout_lines"]
queue_cnt = 0
for line in cmd_output:
if "UC" in line or "MC" in line:
queue_cnt = queue_cnt + 1
return queue_cnt


def check_snmp_cmd_output(duthost, cmd):
out_len = len(duthost.shell(cmd)["stdout_lines"])
if out_len > 1:
Expand Down Expand Up @@ -124,7 +133,7 @@ def test_snmp_queue_counters(duthosts,
data['DEVICE_METADATA']["localhost"]["create_only_config_db_buffers"] \
= "true"
load_new_cfg(duthost, data)
stat_queue_counters_cnt_pre = (get_queue_ctrs(duthost, get_queue_stat_cmd) - 2) * UNICAST_CTRS
stat_queue_counters_cnt_pre = get_queuestat_ctrs(duthost, get_queue_stat_cmd) * UNICAST_CTRS
wait_until(60, 20, 0, check_snmp_cmd_output, duthost, get_bfr_queue_cntrs_cmd)
queue_counters_cnt_pre = get_queue_ctrs(duthost, get_bfr_queue_cntrs_cmd)

Expand All @@ -136,7 +145,7 @@ def test_snmp_queue_counters(duthosts,
# Remove buffer queue and reload and get number of queue counters of selected interface
del data['BUFFER_QUEUE'][buffer_queue_to_del]
load_new_cfg(duthost, data)
stat_queue_counters_cnt_post = (get_queue_ctrs(duthost, get_queue_stat_cmd) - 2) * UNICAST_CTRS
stat_queue_counters_cnt_post = get_queuestat_ctrs(duthost, get_queue_stat_cmd) * UNICAST_CTRS
wait_until(60, 20, 0, check_snmp_cmd_output, duthost, get_bfr_queue_cntrs_cmd)
queue_counters_cnt_post = get_queue_ctrs(duthost, get_bfr_queue_cntrs_cmd)
pytest_assert((queue_counters_cnt_post == stat_queue_counters_cnt_post),
Expand Down

0 comments on commit 98da2b3

Please sign in to comment.