Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@
"desc": "A SID configured with invalid locator identifier",
"eStrKey" : "LeafRef"
},
"SRV6_MY_SID_INVALID_IP_ADDR": {
"SRV6_MY_SID_INVALID_IP_PREFIX": {
"desc": "A SID configured with invalid IPv6 address",
"eStrKey" : "Pattern"
},
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
"SRV6_MY_SID_UNMATCHED_IP_PREFIX": {
"desc": "A SID configured with an IPv6 Address that does not match with the prefix of the locator",
"eStrKey" : "Must"
},
"SRV6_MY_SID_INVALID_ACTION": {
"desc": "A SID configured with invalid action",
"eStrKey" : "InvalidValue",
"eStr": ["action"]
},
"SRV6_MY_SID_DSCP_MODE_WITH_UN": {
"desc": "A SID configured with dscp_mode and uN action",
"eStrKey" : "When",
"eStr": ["action"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"ip_prefix": "FCBB:BBBB:20::/48",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
Expand All @@ -39,12 +39,12 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"ip_prefix": "FCBB:BBBB:20::/48",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
Expand All @@ -66,12 +66,12 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"ip_prefix": "FCBB:BBBB:20::/48",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
Expand All @@ -92,20 +92,20 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"ip_prefix": "FCBB:BBBB:20::/48",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

locator is "MAIN" not "None"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these configurations are set to be erotic to test whether the YANG model can correctly identify the errors.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

"locator": "None",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_INVALID_IP_ADDR": {
"SRV6_MY_SID_INVALID_IP_PREFIX": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
Expand All @@ -118,20 +118,20 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:200001::",
"ip_prefix": "FCBB:BBBB:21::",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the prefix len "/48"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
"SRV6_MY_SID_UNMATCHED_IP_PREFIX": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
Expand All @@ -144,12 +144,12 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:21::",
"ip_prefix": "FCBB:BBBB:21::/48",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
Expand All @@ -170,39 +170,12 @@
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"ip_prefix": "FCBB:BBBB:20::/48",
"locator": "MAIN",
"action": "uA"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

action is "uN"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_DSCP_MODE_WITH_UN": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "MAIN",
"action": "uN",
"decap_dscp_mode": "uniform"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"ip_prefix": "FCBB:BBBB:20:F1::/64",
"locator": "MAIN",
"action": "uDT46"
}
Expand Down
15 changes: 4 additions & 11 deletions src/sonic-yang-models/yang-models/sonic-srv6.yang
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ module sonic-srv6 {
prefix srv6;
yang-version 1.1;

import ietf-yang-types {
prefix yang;
}

import ietf-inet-types {
prefix inet;
}
Expand Down Expand Up @@ -87,10 +83,10 @@ module sonic-srv6 {

container SRV6_MY_SIDS {
list SRV6_MY_SIDS_LIST {
key "locator ip_address";
key "locator ip_prefix";

leaf ip_address {
type inet:ipv6-address;
leaf ip_prefix {
type inet:ipv6-prefix;
}

leaf locator {
Expand Down Expand Up @@ -125,12 +121,9 @@ module sonic-srv6 {
enum uniform;
enum pipe;
}
when "../action = 'uDT46'";

default "uniform";
}

must 'starts-with(./ip_address,
must 'starts-with(substring-before(./ip_prefix, "::"),
substring-before(/srv6:sonic-srv6/SRV6_MY_LOCATORS/SRV6_MY_LOCATORS_LIST[current()/locator]/prefix, "::"))';
}
}
Expand Down