Skip to content

Commit 48aad69

Browse files
authored
Merge pull request sonic-net#543 from mssonicbld/cherry/msft-202412/21466
[action] [PR:21466] [YANG] SRv6 yang model followup fix
2 parents 0196e0d + b1d6bf9 commit 48aad69

File tree

3 files changed

+22
-61
lines changed

3 files changed

+22
-61
lines changed

src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,17 @@
1515
"desc": "A SID configured with invalid locator identifier",
1616
"eStrKey" : "LeafRef"
1717
},
18-
"SRV6_MY_SID_INVALID_IP_ADDR": {
18+
"SRV6_MY_SID_INVALID_IP_PREFIX": {
1919
"desc": "A SID configured with invalid IPv6 address",
2020
"eStrKey" : "Pattern"
2121
},
22-
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
22+
"SRV6_MY_SID_UNMATCHED_IP_PREFIX": {
2323
"desc": "A SID configured with an IPv6 Address that does not match with the prefix of the locator",
2424
"eStrKey" : "Must"
2525
},
2626
"SRV6_MY_SID_INVALID_ACTION": {
2727
"desc": "A SID configured with invalid action",
2828
"eStrKey" : "InvalidValue",
2929
"eStr": ["action"]
30-
},
31-
"SRV6_MY_SID_DSCP_MODE_WITH_UN": {
32-
"desc": "A SID configured with dscp_mode and uN action",
33-
"eStrKey" : "When",
34-
"eStr": ["action"]
3530
}
3631
}

src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json

+16-43
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"sonic-srv6:SRV6_MY_SIDS": {
1313
"SRV6_MY_SIDS_LIST": [
1414
{
15-
"ip_address": "FCBB:BBBB:20::",
15+
"ip_prefix": "FCBB:BBBB:20::/48",
1616
"locator": "MAIN",
1717
"action": "uN"
1818
},
1919
{
20-
"ip_address": "FCBB:BBBB:20:F1::",
20+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
2121
"locator": "MAIN",
2222
"action": "uDT46"
2323
}
@@ -39,12 +39,12 @@
3939
"sonic-srv6:SRV6_MY_SIDS": {
4040
"SRV6_MY_SIDS_LIST": [
4141
{
42-
"ip_address": "FCBB:BBBB:20::",
42+
"ip_prefix": "FCBB:BBBB:20::/48",
4343
"locator": "MAIN",
4444
"action": "uN"
4545
},
4646
{
47-
"ip_address": "FCBB:BBBB:20:F1::",
47+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
4848
"locator": "MAIN",
4949
"action": "uDT46"
5050
}
@@ -66,12 +66,12 @@
6666
"sonic-srv6:SRV6_MY_SIDS": {
6767
"SRV6_MY_SIDS_LIST": [
6868
{
69-
"ip_address": "FCBB:BBBB:20::",
69+
"ip_prefix": "FCBB:BBBB:20::/48",
7070
"locator": "MAIN",
7171
"action": "uN"
7272
},
7373
{
74-
"ip_address": "FCBB:BBBB:20:F1::",
74+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
7575
"locator": "MAIN",
7676
"action": "uDT46"
7777
}
@@ -92,20 +92,20 @@
9292
"sonic-srv6:SRV6_MY_SIDS": {
9393
"SRV6_MY_SIDS_LIST": [
9494
{
95-
"ip_address": "FCBB:BBBB:20::",
95+
"ip_prefix": "FCBB:BBBB:20::/48",
9696
"locator": "None",
9797
"action": "uN"
9898
},
9999
{
100-
"ip_address": "FCBB:BBBB:20:F1::",
100+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
101101
"locator": "MAIN",
102102
"action": "uDT46"
103103
}
104104
]
105105
}
106106
}
107107
},
108-
"SRV6_MY_SID_INVALID_IP_ADDR": {
108+
"SRV6_MY_SID_INVALID_IP_PREFIX": {
109109
"sonic-srv6:sonic-srv6": {
110110
"sonic-srv6:SRV6_MY_LOCATORS": {
111111
"SRV6_MY_LOCATORS_LIST": [
@@ -118,20 +118,20 @@
118118
"sonic-srv6:SRV6_MY_SIDS": {
119119
"SRV6_MY_SIDS_LIST": [
120120
{
121-
"ip_address": "FCBB:BBBB:200001::",
121+
"ip_prefix": "FCBB:BBBB:21::",
122122
"locator": "MAIN",
123123
"action": "uN"
124124
},
125125
{
126-
"ip_address": "FCBB:BBBB:20:F1::",
126+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
127127
"locator": "MAIN",
128128
"action": "uDT46"
129129
}
130130
]
131131
}
132132
}
133133
},
134-
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
134+
"SRV6_MY_SID_UNMATCHED_IP_PREFIX": {
135135
"sonic-srv6:sonic-srv6": {
136136
"sonic-srv6:SRV6_MY_LOCATORS": {
137137
"SRV6_MY_LOCATORS_LIST": [
@@ -144,12 +144,12 @@
144144
"sonic-srv6:SRV6_MY_SIDS": {
145145
"SRV6_MY_SIDS_LIST": [
146146
{
147-
"ip_address": "FCBB:BBBB:21::",
147+
"ip_prefix": "FCBB:BBBB:21::/48",
148148
"locator": "MAIN",
149149
"action": "uN"
150150
},
151151
{
152-
"ip_address": "FCBB:BBBB:20:F1::",
152+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
153153
"locator": "MAIN",
154154
"action": "uDT46"
155155
}
@@ -170,39 +170,12 @@
170170
"sonic-srv6:SRV6_MY_SIDS": {
171171
"SRV6_MY_SIDS_LIST": [
172172
{
173-
"ip_address": "FCBB:BBBB:20::",
173+
"ip_prefix": "FCBB:BBBB:20::/48",
174174
"locator": "MAIN",
175175
"action": "uA"
176176
},
177177
{
178-
"ip_address": "FCBB:BBBB:20:F1::",
179-
"locator": "MAIN",
180-
"action": "uDT46"
181-
}
182-
]
183-
}
184-
}
185-
},
186-
"SRV6_MY_SID_DSCP_MODE_WITH_UN": {
187-
"sonic-srv6:sonic-srv6": {
188-
"sonic-srv6:SRV6_MY_LOCATORS": {
189-
"SRV6_MY_LOCATORS_LIST": [
190-
{
191-
"locator_name": "MAIN",
192-
"prefix": "FCBB:BBBB:20::"
193-
}
194-
]
195-
},
196-
"sonic-srv6:SRV6_MY_SIDS": {
197-
"SRV6_MY_SIDS_LIST": [
198-
{
199-
"ip_address": "FCBB:BBBB:20::",
200-
"locator": "MAIN",
201-
"action": "uN",
202-
"decap_dscp_mode": "uniform"
203-
},
204-
{
205-
"ip_address": "FCBB:BBBB:20:F1::",
178+
"ip_prefix": "FCBB:BBBB:20:F1::/64",
206179
"locator": "MAIN",
207180
"action": "uDT46"
208181
}

src/sonic-yang-models/yang-models/sonic-srv6.yang

+4-11
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ module sonic-srv6 {
33
prefix srv6;
44
yang-version 1.1;
55

6-
import ietf-yang-types {
7-
prefix yang;
8-
}
9-
106
import ietf-inet-types {
117
prefix inet;
128
}
@@ -87,10 +83,10 @@ module sonic-srv6 {
8783

8884
container SRV6_MY_SIDS {
8985
list SRV6_MY_SIDS_LIST {
90-
key "locator ip_address";
86+
key "locator ip_prefix";
9187

92-
leaf ip_address {
93-
type inet:ipv6-address;
88+
leaf ip_prefix {
89+
type inet:ipv6-prefix;
9490
}
9591

9692
leaf locator {
@@ -125,12 +121,9 @@ module sonic-srv6 {
125121
enum uniform;
126122
enum pipe;
127123
}
128-
when "../action = 'uDT46'";
129-
130-
default "uniform";
131124
}
132125

133-
must 'starts-with(./ip_address,
126+
must 'starts-with(substring-before(./ip_prefix, "::"),
134127
substring-before(/srv6:sonic-srv6/SRV6_MY_LOCATORS/SRV6_MY_LOCATORS_LIST[current()/locator]/prefix, "::"))';
135128
}
136129
}

0 commit comments

Comments
 (0)