-
Notifications
You must be signed in to change notification settings - Fork 670
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[GCU] Add PFC_WD RDMA validator (#2619)
- Loading branch information
1 parent
c7aa841
commit 2ef5b31
Showing
7 changed files
with
102 additions
and
10 deletions.
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