[GCU] Add PORT table StateDB Validator#2936
Merged
isabelmsft merged 11 commits intosonic-net:masterfrom Aug 16, 2023
Merged
Conversation
qiluo-msft
reviewed
Aug 11, 2023
qiluo-msft
reviewed
Aug 11, 2023
|
|
||
|
|
||
| def read_statedb_entry(table, field): | ||
| state_db = SonicV2Connector(host="127.0.0.1") |
Contributor
Contributor
Author
There was a problem hiding this comment.
I see.. is Table class recommended over SonicV2Connector use_unix_socket_path? In the future, this function may be extended to include tables other than PORT
Contributor
There was a problem hiding this comment.
As I said, the benefit is no need to concat table name/separator/key. You can create multiple Table from one DBConnector, and they are not heavy.
qiluo-msft
reviewed
Aug 11, 2023
qiluo-msft
reviewed
Aug 11, 2023
qiluo-msft
reviewed
Aug 11, 2023
| if key == "speed": | ||
| supported_speeds_str = read_statedb_entry('{}|{}'.format("PORT_TABLE", port), "supported_speeds") or '' | ||
| supported_speeds = [int(s) for s in supported_speeds_str.split(',') if s] | ||
| if supported_speeds and int(value) not in supported_speeds: |
Contributor
Contributor
Author
There was a problem hiding this comment.
Thank you, I added exception handling
qiluo-msft
reviewed
Aug 11, 2023
qiluo-msft
reviewed
Aug 11, 2023
| patch_element_str = json.dumps(patch_element) | ||
| path = patch_element["path"] | ||
| value = patch_element.get("value") | ||
| keys = ['fec', 'speed'] |
Contributor
qiluo-msft
reviewed
Aug 11, 2023
| } | ||
| } | ||
| }, | ||
| "PORT": { |
Contributor
qiluo-msft
reviewed
Aug 11, 2023
wen587
reviewed
Aug 14, 2023
qiluo-msft
approved these changes
Aug 16, 2023
Contributor
Author
|
Tested on 202305 branch, confirmed no cherry-pick conflicts |
mssonicbld
pushed a commit
to mssonicbld/sonic-utilities
that referenced
this pull request
Dec 21, 2023
Collaborator
|
Cherry-pick PR to 202305: #3096 |
mssonicbld
pushed a commit
that referenced
this pull request
Dec 21, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Feature ADO 24806590
Test Case Bug Fix ADO 26158250
What I did
Add PORT table StateDB Validator
How I did it
Add new validating function for PORT table field and fec fields
How to verify it
Unit tests, updated sonic-mgmt tests: https://github.com/sonic-net/sonic-mgmt/pull/9403/files
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)