-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[YANG] Add srv6 yang model and unit tests #21175
Open
BYGX-wcr
wants to merge
13
commits into
sonic-net:master
Choose a base branch
from
BYGX-wcr:srv6-yang
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+406
−0
Open
Changes from 3 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
778d1ac
add srv6 yang model and unit tests
BYGX-wcr 9e7c88b
add vrf back to srv6 yang model and fix syntax error
BYGX-wcr 5d2606f
Merge branch 'master' into srv6-yang
BYGX-wcr 59ff34d
add default val for dscp_mode and change vrf to be union type
BYGX-wcr ac80f3a
fix unintentional invalid ip strings
BYGX-wcr 84f9093
fix messy UT cases
BYGX-wcr 1c8fbbb
remove unncessary error-message
BYGX-wcr dff2bc9
Merge branch 'master' into srv6-yang
BYGX-wcr f8ea98f
Update YANG model to use the new two table schemas and add additional…
BYGX-wcr c27a49b
fix mismatched field name
BYGX-wcr 7e498e1
fix broken test case and fix broken must condition
BYGX-wcr 32157bb
check the impact of ordering must condition
BYGX-wcr 7c811a6
adjust the XPath expression for prefix matching
BYGX-wcr 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
25 changes: 25 additions & 0 deletions
25
src/sonic-yang-models/tests/yang_model_tests/tests/srv6.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,25 @@ | ||
{ | ||
"SRV6_MY_SID_VALID": { | ||
"desc": "Valid config" | ||
}, | ||
"SRV6_MY_SID_INVALID_IP_ADDR": { | ||
"desc": "SID configured with invalid IPv6 address", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["ip_address"] | ||
}, | ||
"SRV6_MY_SID_INVALID_ACTION": { | ||
"desc": "SID configured with invalid action", | ||
"eStrKey" : "InvalidValue", | ||
"eStr": ["action"] | ||
}, | ||
"SRV6_MY_SID_DSCP_MODE_WITH_UN": { | ||
"desc": "SID configured with dscp_mode and uN action", | ||
"eStrKey" : "When", | ||
"eStr": ["action"] | ||
}, | ||
"SRV6_MY_SID_INVALID_FUNC_LEN": { | ||
"desc": "SID configured with invalid func_len", | ||
"eStrKey" : "Must", | ||
"eStr": ["func_len"] | ||
} | ||
} |
89 changes: 89 additions & 0 deletions
89
src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.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,89 @@ | ||
{ | ||
"SRV6_MY_SID_VALID": { | ||
"sonic-srv6:sonic-srv6": { | ||
"sonic-srv6:SRV6_MY_SID_TABLE": { | ||
"SRV6_MY_SID_TABLE_LIST": [ | ||
{ | ||
"ip_address": "FCBB:BBBB:20::", | ||
"action": "uN" | ||
}, | ||
{ | ||
"ip_address": "FCBB:BBBB:20:F1:", | ||
"action": "uDT46" | ||
}, | ||
{ | ||
"ip_address": "FCBB:BBBB:20:F2:", | ||
"action": "uDT6", | ||
"dscp_mode": "pipe" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"SRV6_MY_SID_INVALID_IP_ADDR": { | ||
"sonic-srv6:sonic-srv6": { | ||
"sonic-srv6:SRV6_MY_SID_TABLE": { | ||
"SRV6_MY_SID_TABLE_LIST": [ | ||
{ | ||
"ip_address": "FCBB:BBBB:200001::", | ||
"action": "uN" | ||
}, | ||
{ | ||
"ip_address": "FCBB:BBBB:20:F1:", | ||
"action": "uDT46" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"SRV6_MY_SID_INVALID_ACTION": { | ||
"sonic-srv6:sonic-srv6": { | ||
"sonic-srv6:SRV6_MY_SID_TABLE": { | ||
"SRV6_MY_SID_TABLE_LIST": [ | ||
{ | ||
"ip_address": "FCBB:BBBB:20::", | ||
"action": "End.A" | ||
}, | ||
{ | ||
"ip_address": "FCBB:BBBB:20:F1:", | ||
"action": "uDT46" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"SRV6_MY_SID_DSCP_MODE_WITH_UN": { | ||
"sonic-srv6:sonic-srv6": { | ||
"sonic-srv6:SRV6_MY_SID_TABLE": { | ||
"SRV6_MY_SID_TABLE_LIST": [ | ||
{ | ||
"ip_address": "FCBB:BBBB:20::", | ||
"action": "uN", | ||
"dscp_mode": "uniform" | ||
}, | ||
{ | ||
"ip_address": "FCBB:BBBB:20:F1:", | ||
"action": "uDT46" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"SRV6_MY_SID_INVALID_FUNC_LEN": { | ||
"sonic-srv6:sonic-srv6": { | ||
"sonic-srv6:SRV6_MY_SID_TABLE": { | ||
"SRV6_MY_SID_TABLE_LIST": [ | ||
{ | ||
"ip_address": "FCBB:BBBB:20::", | ||
"func_len": 127, | ||
"action": "uN" | ||
}, | ||
{ | ||
"ip_address": "FCBB:BBBB:20:F1:", | ||
"action": "uDT46" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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,96 @@ | ||
module sonic-srv6 { | ||
namespace "http://github.com/sonic-net/sonic-srv6"; | ||
prefix srv6; | ||
yang-version 1.1; | ||
|
||
import ietf-yang-types { | ||
prefix yang; | ||
} | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-vrf { | ||
prefix vrf; | ||
} | ||
|
||
revision 2024-12-05 { | ||
description | ||
"Initial revision."; | ||
} | ||
|
||
container sonic-srv6 { | ||
|
||
container SRV6_MY_SID_TABLE { | ||
list SRV6_MY_SID_TABLE_LIST { | ||
key "ip_address"; | ||
|
||
leaf ip_address { | ||
type inet:ipv6-address; | ||
} | ||
|
||
leaf block_len { | ||
type uint8 { | ||
range "1..128"; | ||
} | ||
|
||
default 32; | ||
} | ||
|
||
leaf node_len { | ||
type uint8 { | ||
range "1..128"; | ||
} | ||
|
||
default 16; | ||
} | ||
|
||
leaf func_len { | ||
type uint8 { | ||
range "1..128"; | ||
} | ||
|
||
default 16; | ||
} | ||
|
||
leaf arg_len { | ||
type uint8 { | ||
range "0..128"; | ||
} | ||
|
||
default 0; | ||
} | ||
|
||
leaf action { | ||
type enumeration { | ||
enum uN; | ||
enum uDT46; | ||
} | ||
} | ||
|
||
leaf vrf { | ||
type leafref { | ||
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name"; | ||
} | ||
description "VRF name"; | ||
|
||
default "default"; | ||
} | ||
|
||
leaf dscp_mode { | ||
type enumeration { | ||
enum uniform; | ||
enum pipe; | ||
} | ||
when "../action = 'uDT46'"; | ||
} | ||
|
||
must 'block_len + node_len + func_len + arg_len <= 128' { | ||
error-message "The sum of all fields' length must be less than or equal to 128"; | ||
} | ||
} | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.
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.
can we have default define here ?
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.
added