-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GCU] Add PFC_WD RDMA validator #2619
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fc7c841
add hwsku validator
isabelmsft 8240d3a
refactor table validating functions
isabelmsft e08a8fe
fix UT
isabelmsft fdb45b3
address PR comments
isabelmsft b73ff9a
revert naming change
isabelmsft 10dd1f5
remove print statement
isabelmsft 77bb424
fix naming convention
isabelmsft 2762e49
address PR comments
isabelmsft f98fc9b
Merge branch 'master' into hwsku_enforcement
isabelmsft 3df33e2
remove print statement
isabelmsft 36761e5
Merge branch 'hwsku_enforcement' of https://github.com/isabelmsft/son…
isabelmsft 633a8fe
refactor based on PR comment
isabelmsft 987eaa7
address PR comment2
isabelmsft 735630c
remove dup method
isabelmsft 0c6c24e
fix typo
isabelmsft 46c4507
address PR comments
isabelmsft c8f9249
add clarifying comment
isabelmsft 9c15a08
fix test
isabelmsft 80bf53f
address comment
isabelmsft 30bd7b2
fix build version in test
isabelmsft 8d17240
change to string comparison
isabelmsft 4e29fe7
remove unused import
isabelmsft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from sonic_py_common import device_info | ||
import re | ||
|
||
def rdma_config_update_validator(): | ||
version_info = device_info.get_sonic_version_info() | ||
build_version = version_info.get('build_version') | ||
asic_type = version_info.get('asic_type') | ||
|
||
if (asic_type != 'mellanox' and asic_type != 'broadcom' and asic_type != 'cisco-8000'): | ||
return False | ||
|
||
version_substrings = build_version.split('.') | ||
branch_version = None | ||
|
||
for substring in version_substrings: | ||
if substring.isdigit() and re.match(r'^\d{8}$', substring): | ||
branch_version = substring | ||
break | ||
|
||
if branch_version is None: | ||
return False | ||
|
||
if asic_type == 'cisco-8000': | ||
return branch_version >= "20201200" | ||
else: | ||
return branch_version >= "20181100" |
20 changes: 20 additions & 0 deletions
20
generic_config_updater/gcu_field_operation_validators.conf.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"README": [ | ||
"field_operation_validators provides, module & method name as ", | ||
" <module name>.<method name>", | ||
"NOTE: module name could have '.'", | ||
" ", | ||
"The last element separated by '.' is considered as ", | ||
"method name", | ||
"", | ||
"e.g. 'show.acl.test_acl'", | ||
"", | ||
"field_operation_validators for a given table defines a list of validators that all must pass for modification to the specified field and table to be allowed", | ||
"" | ||
], | ||
"tables": { | ||
"PFC_WD": { | ||
"field_operation_validators": [ "generic_config_updater.field_operation_validators.rdma_config_update_validator" ] | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is potential risk to run ambiguous code. We can proactively check the module, and method_names. Maybe we can have allowlist or similar?
#Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added code to ensure the module_name is
generic_config_updater.field_operation_validators
and themethod_name
contains the stringvalidator