Skip to content

Commit 3493340

Browse files
authored
Merge pull request sonic-net#519 from BYGX-wcr/srv6-yang-202412
[YANG] Add srv6 yang model and unit tests
2 parents a37bfae + ddbb8f0 commit 3493340

File tree

4 files changed

+413
-0
lines changed

4 files changed

+413
-0
lines changed

src/sonic-yang-models/doc/Configuration.md

+25
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Table of Contents
9494
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
9595
* [RADIUS](#radius)
9696
* [Static DNS](#static-dns)
97+
* [SRv6](#srv6)
9798
* [For Developers](#for-developers)
9899
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
99100
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
@@ -2873,6 +2874,30 @@ The DNS_NAMESERVER table introduces static DNS nameservers configuration.
28732874
}
28742875
```
28752876

2877+
### SRv6
2878+
2879+
The **SRV6_MY_SIDS** and **SRV6_MY_LOCATORS** tables introduce Segment Routing over IPv6 configuration.
2880+
An example is as follows:
2881+
```
2882+
{
2883+
"SRV6_MY_LOCATORS" : {
2884+
"loc1" : {
2885+
"prefix" : "FCBB:BBBB:20::"
2886+
}
2887+
}
2888+
"SRV6_MY_SIDS" : {
2889+
"loc1|FCBB:BBBB:20::" : {
2890+
"action": "uN"
2891+
},
2892+
"loc1|FCBB:BBBB:20:F1::" : {
2893+
"action": "uDT46",
2894+
"decap_vrf": "default",
2895+
"decap_dscp_mode": "pipe"
2896+
}
2897+
}
2898+
}
2899+
```
2900+
28762901
### FIPS
28772902

28782903
The FIPS table introduces FIPS configuration.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"SRV6_VALID": {
3+
"desc": "Valid config"
4+
},
5+
"SRV6_MY_LOCATOR_INVALID_FUNC_LEN": {
6+
"desc": "A locator configured with invalid func_len",
7+
"eStrKey" : "Must"
8+
},
9+
"SRV6_MY_LOCATOR_INVALID_VRF": {
10+
"desc": "A locator configured with an invalid VRF name",
11+
"eStrKey" : "InvalidValue",
12+
"eStr": ["vrf"]
13+
},
14+
"SRV6_MY_SID_INVALID_LOCATOR": {
15+
"desc": "A SID configured with invalid locator identifier",
16+
"eStrKey" : "LeafRef"
17+
},
18+
"SRV6_MY_SID_INVALID_IP_ADDR": {
19+
"desc": "A SID configured with invalid IPv6 address",
20+
"eStrKey" : "Pattern"
21+
},
22+
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
23+
"desc": "A SID configured with an IPv6 Address that does not match with the prefix of the locator",
24+
"eStrKey" : "Must"
25+
},
26+
"SRV6_MY_SID_INVALID_ACTION": {
27+
"desc": "A SID configured with invalid action",
28+
"eStrKey" : "InvalidValue",
29+
"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"]
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
{
2+
"SRV6_VALID": {
3+
"sonic-srv6:sonic-srv6": {
4+
"sonic-srv6:SRV6_MY_LOCATORS": {
5+
"SRV6_MY_LOCATORS_LIST": [
6+
{
7+
"locator_name": "MAIN",
8+
"prefix": "FCBB:BBBB:20::"
9+
}
10+
]
11+
},
12+
"sonic-srv6:SRV6_MY_SIDS": {
13+
"SRV6_MY_SIDS_LIST": [
14+
{
15+
"ip_address": "FCBB:BBBB:20::",
16+
"locator": "MAIN",
17+
"action": "uN"
18+
},
19+
{
20+
"ip_address": "FCBB:BBBB:20:F1::",
21+
"locator": "MAIN",
22+
"action": "uDT46"
23+
}
24+
]
25+
}
26+
}
27+
},
28+
"SRV6_MY_LOCATOR_INVALID_FUNC_LEN": {
29+
"sonic-srv6:sonic-srv6": {
30+
"sonic-srv6:SRV6_MY_LOCATORS": {
31+
"SRV6_MY_LOCATORS_LIST": [
32+
{
33+
"locator_name": "MAIN",
34+
"prefix": "FCBB:BBBB:20::",
35+
"func_len": 127
36+
}
37+
]
38+
},
39+
"sonic-srv6:SRV6_MY_SIDS": {
40+
"SRV6_MY_SIDS_LIST": [
41+
{
42+
"ip_address": "FCBB:BBBB:20::",
43+
"locator": "MAIN",
44+
"action": "uN"
45+
},
46+
{
47+
"ip_address": "FCBB:BBBB:20:F1::",
48+
"locator": "MAIN",
49+
"action": "uDT46"
50+
}
51+
]
52+
}
53+
}
54+
},
55+
"SRV6_MY_LOCATOR_INVALID_VRF": {
56+
"sonic-srv6:sonic-srv6": {
57+
"sonic-srv6:SRV6_MY_LOCATORS": {
58+
"SRV6_MY_LOCATORS_LIST": [
59+
{
60+
"locator_name": "MAIN",
61+
"prefix": "FCBB:BBBB:20::",
62+
"vrf": "Vrf1"
63+
}
64+
]
65+
},
66+
"sonic-srv6:SRV6_MY_SIDS": {
67+
"SRV6_MY_SIDS_LIST": [
68+
{
69+
"ip_address": "FCBB:BBBB:20::",
70+
"locator": "MAIN",
71+
"action": "uN"
72+
},
73+
{
74+
"ip_address": "FCBB:BBBB:20:F1::",
75+
"locator": "MAIN",
76+
"action": "uDT46"
77+
}
78+
]
79+
}
80+
}
81+
},
82+
"SRV6_MY_SID_INVALID_LOCATOR": {
83+
"sonic-srv6:sonic-srv6": {
84+
"sonic-srv6:SRV6_MY_LOCATORS": {
85+
"SRV6_MY_LOCATORS_LIST": [
86+
{
87+
"locator_name": "MAIN",
88+
"prefix": "FCBB:BBBB:20::"
89+
}
90+
]
91+
},
92+
"sonic-srv6:SRV6_MY_SIDS": {
93+
"SRV6_MY_SIDS_LIST": [
94+
{
95+
"ip_address": "FCBB:BBBB:20::",
96+
"locator": "None",
97+
"action": "uN"
98+
},
99+
{
100+
"ip_address": "FCBB:BBBB:20:F1::",
101+
"locator": "MAIN",
102+
"action": "uDT46"
103+
}
104+
]
105+
}
106+
}
107+
},
108+
"SRV6_MY_SID_INVALID_IP_ADDR": {
109+
"sonic-srv6:sonic-srv6": {
110+
"sonic-srv6:SRV6_MY_LOCATORS": {
111+
"SRV6_MY_LOCATORS_LIST": [
112+
{
113+
"locator_name": "MAIN",
114+
"prefix": "FCBB:BBBB:20::"
115+
}
116+
]
117+
},
118+
"sonic-srv6:SRV6_MY_SIDS": {
119+
"SRV6_MY_SIDS_LIST": [
120+
{
121+
"ip_address": "FCBB:BBBB:200001::",
122+
"locator": "MAIN",
123+
"action": "uN"
124+
},
125+
{
126+
"ip_address": "FCBB:BBBB:20:F1::",
127+
"locator": "MAIN",
128+
"action": "uDT46"
129+
}
130+
]
131+
}
132+
}
133+
},
134+
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
135+
"sonic-srv6:sonic-srv6": {
136+
"sonic-srv6:SRV6_MY_LOCATORS": {
137+
"SRV6_MY_LOCATORS_LIST": [
138+
{
139+
"locator_name": "MAIN",
140+
"prefix": "FCBB:BBBB:20::"
141+
}
142+
]
143+
},
144+
"sonic-srv6:SRV6_MY_SIDS": {
145+
"SRV6_MY_SIDS_LIST": [
146+
{
147+
"ip_address": "FCBB:BBBB:21::",
148+
"locator": "MAIN",
149+
"action": "uN"
150+
},
151+
{
152+
"ip_address": "FCBB:BBBB:20:F1::",
153+
"locator": "MAIN",
154+
"action": "uDT46"
155+
}
156+
]
157+
}
158+
}
159+
},
160+
"SRV6_MY_SID_INVALID_ACTION": {
161+
"sonic-srv6:sonic-srv6": {
162+
"sonic-srv6:SRV6_MY_LOCATORS": {
163+
"SRV6_MY_LOCATORS_LIST": [
164+
{
165+
"locator_name": "MAIN",
166+
"prefix": "FCBB:BBBB:20::"
167+
}
168+
]
169+
},
170+
"sonic-srv6:SRV6_MY_SIDS": {
171+
"SRV6_MY_SIDS_LIST": [
172+
{
173+
"ip_address": "FCBB:BBBB:20::",
174+
"locator": "MAIN",
175+
"action": "uA"
176+
},
177+
{
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::",
206+
"locator": "MAIN",
207+
"action": "uDT46"
208+
}
209+
]
210+
}
211+
}
212+
}
213+
}

0 commit comments

Comments
 (0)