Skip to content

Commit

Permalink
Snappi - Fixed get_queue_count to return nested dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
amitpawar12 committed Aug 28, 2024
1 parent 78bb717 commit b5ffaad
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/common/snappi_tests/common_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,12 +1140,15 @@ def get_queue_count_all_prio(duthost, port):
Returns:
queue_dict (dict): key-value with key=dut+port+prio and value=queue count
"""
queue_dict = {}
# Capturing queue counts for all priorities.
# Initializing nested dictionary queue_dict
queue_dict = defaultdict(dict)
queue_dict[duthost.hostname][port] = {}

# Preparing the dictionary for all 7 priority queues.
for priority in range(7):
dut_key = (duthost.hostname+'_'+port+'_prio_'+str(priority)).lower()
total_pkts, _ = get_egress_queue_count(duthost, port, priority)
queue_dict.update({dut_key: total_pkts})
queue_dict[duthost.hostname][port]['prio_' + str(priority)] = total_pkts

return queue_dict


Expand Down

0 comments on commit b5ffaad

Please sign in to comment.