[drop counters] Fix configuration for counters with lowercase names #1103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Danny Allen daall@microsoft.com
- What I did
I fixed in a bug in the drop counters CLI where counters that weren't provided in uppercase were not being installed properly into Config DB.
Fixes sonic-net/sonic-buildimage#5303
- How I did it
I figured out that
swssdk
normalizes all table names to uppercase. Since I was providing the drop counter name as part of the table name instead of part of the key, the drop counter name was being set to all uppercase. This is problematic because the counter was being installed into config DB in whatever case the user provided since for that table it is treated as a key.So, I updated the parts of the code that touch the
DROP_REASONS
table to include the counter name as part of the key rather than as part of the table name.- How to verify it
I've updated the unit tests to include a
lowercase_counter
to check for this behavior. I also validated that all fourconfig
functions work properly on a physical DUT.- Previous command output (if the output of a command-line utility has changed)
- New command output (if the output of a command-line utility has changed)