-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[hash] Add Generic Hash YANG model #13253
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 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
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
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
13 changes: 13 additions & 0 deletions
13
src/sonic-yang-models/tests/yang_model_tests/tests/hash.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "SWITCH_HASH_VALID": { | ||
| "desc": "Configure SWITCH_HASH." | ||
| }, | ||
| "SWITCH_HASH_INVALID_ECMP_HASH": { | ||
| "desc": "Configure invalid ECMP_HASH in SWITCH_HASH.", | ||
| "eStrKey": "InvalidValue" | ||
| }, | ||
| "SWITCH_HASH_INVALID_LAG_HASH": { | ||
| "desc": "Configure invalid LAG_HASH in SWITCH_HASH.", | ||
| "eStrKey": "InvalidValue" | ||
| } | ||
| } |
50 changes: 50 additions & 0 deletions
50
src/sonic-yang-models/tests/yang_model_tests/tests_config/hash.json
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| { | ||
| "SWITCH_HASH_VALID": { | ||
| "sonic-hash:sonic-hash": { | ||
| "sonic-hash:SWITCH_HASH": { | ||
| "sonic-hash:GLOBAL": { | ||
| "ecmp_hash": [ | ||
| "DST_IP", | ||
| "SRC_IP", | ||
| "IP_PROTOCOL", | ||
| "L4_DST_PORT", | ||
| "L4_SRC_PORT", | ||
| "INNER_DST_IP", | ||
| "INNER_SRC_IP" | ||
| ], | ||
| "lag_hash": [ | ||
| "DST_IP", | ||
| "SRC_IP", | ||
| "IP_PROTOCOL", | ||
| "L4_DST_PORT", | ||
| "L4_SRC_PORT", | ||
| "INNER_DST_IP", | ||
| "INNER_SRC_IP" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "SWITCH_HASH_INVALID_ECMP_HASH": { | ||
| "sonic-hash:sonic-hash": { | ||
| "sonic-hash:SWITCH_HASH": { | ||
| "sonic-hash:GLOBAL": { | ||
| "ecmp_hash": [ | ||
| "INVALID_VALUE" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "SWITCH_HASH_INVALID_LAG_HASH": { | ||
| "sonic-hash:sonic-hash": { | ||
| "sonic-hash:SWITCH_HASH": { | ||
| "sonic-hash:GLOBAL": { | ||
| "lag_hash": [ | ||
| "INVALID_VALUE" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| module sonic-hash { | ||
|
|
||
| yang-version 1.1; | ||
|
|
||
| namespace "http://github.com/sonic-net/sonic-hash"; | ||
| prefix hash; | ||
|
|
||
| import sonic-types { | ||
| prefix stypes; | ||
| } | ||
|
|
||
| description "HASH YANG Module for SONiC OS"; | ||
|
|
||
| revision 2022-09-05 { | ||
| description "First Revision"; | ||
| } | ||
|
|
||
| typedef hash-field { | ||
| description "Represents native hash field"; | ||
| type stypes:hash-field { | ||
| enum IN_PORT; | ||
| enum DST_MAC; | ||
| enum SRC_MAC; | ||
| enum ETHERTYPE; | ||
| enum VLAN_ID; | ||
| enum IP_PROTOCOL; | ||
| enum DST_IP; | ||
| enum SRC_IP; | ||
| enum L4_DST_PORT; | ||
| enum L4_SRC_PORT; | ||
| enum INNER_DST_MAC; | ||
| enum INNER_SRC_MAC; | ||
| enum INNER_ETHERTYPE; | ||
| enum INNER_IP_PROTOCOL; | ||
| enum INNER_DST_IP; | ||
| enum INNER_SRC_IP; | ||
| enum INNER_L4_DST_PORT; | ||
| enum INNER_L4_SRC_PORT; | ||
| } | ||
| } | ||
|
|
||
| container sonic-hash { | ||
|
|
||
| container SWITCH_HASH { | ||
|
|
||
| description "SWITCH_HASH part of config_db.json"; | ||
|
|
||
| container GLOBAL { | ||
|
|
||
| leaf-list ecmp_hash { | ||
nazariig marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description "Hash fields for hashing packets going through ECMP"; | ||
| type hash:hash-field; | ||
| } | ||
|
|
||
| leaf-list lag_hash { | ||
nazariig marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| description "Hash fields for hashing packets going through LAG"; | ||
| type hash:hash-field; | ||
| } | ||
|
|
||
| } | ||
| /* end of container GLOBAL */ | ||
| } | ||
| /* end of container SWITCH_HASH */ | ||
| } | ||
| /* end of container sonic-hash */ | ||
| } | ||
| /* end of module sonic-hash */ | ||
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.