Skip to content

Commit

Permalink
Fix UT - add missing DB values and fix pq_count - should be 16 % 2 = …
Browse files Browse the repository at this point in the history
…8 and not (16 + 1 ) % 2 = 9
  • Loading branch information
DavidZagury committed Dec 18, 2023
1 parent 04c1e36 commit d62f739
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/sonic_ax_impl/mibs/vendor/cisco/ciscoSwitchQosMIB.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def update_stats(self):
# To simulate vendor OID, we wrap queues by max priority groups
port_max_queues = self.statedb.get_all(self.statedb.STATE_DB,
mibs.buffer_max_parm_table(self.oid_name_map[if_index]))['max_queues']
pq_count = math.ceil((port_max_queues + 1) / 2)
pq_count = math.ceil(int(port_max_queues) / 2)

for queue in if_queues:
# Get queue type and statistics
Expand Down
18 changes: 18 additions & 0 deletions tests/mock_tables/global_db/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,23 @@
"TEMPERATURE_INFO|thermal1": {
"temperature": "20.5",
"is_replaceable": "False"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet0": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet4": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet8": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet12": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet-BP16": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet-BP20": {
"max_queues": "16"
}
}
6 changes: 6 additions & 0 deletions tests/mock_tables/state_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,5 +198,11 @@
},
"BUFFER_MAX_PARAM_TABLE|Ethernet0": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet4": {
"max_queues": "16"
},
"BUFFER_MAX_PARAM_TABLE|Ethernet8": {
"max_queues": "16"
}
}

0 comments on commit d62f739

Please sign in to comment.