Skip to content

Commit 866a3df

Browse files
BYGX-wcrprabhataravind
authored andcommitted
[YANG] Add srv6 yang model and unit tests (sonic-net#21175)
Why I did it To support the addition of two new tables in CONFIG_DB, i.e. SRV6_MY_SIDS and SRV6_MY_LOCATORS, in order to allow configuration for SRv6 in SONiC. Work item tracking Microsoft ADO (number only): 30513277 How I did it I define the YANG model based on SRv6 HLD. How to verify it Run the unit tests and build image.
1 parent 82506a9 commit 866a3df

File tree

4 files changed

+414
-0
lines changed

4 files changed

+414
-0
lines changed

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

+26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SONiC Configuration Database Manual
22

3+
34
**Table of Contents**
45

56
* [Introduction](#introduction)
@@ -92,6 +93,7 @@
9293
* [RADIUS](#radius)
9394
* [Static DNS](#static-dns)
9495
* [ASIC_SENSORS](#asic_sensors)
96+
* [SRv6](#srv6)
9597
* [For Developers](#for-developers)
9698
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
9799
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
@@ -2884,6 +2886,30 @@ The DNS_NAMESERVER table introduces static DNS nameservers configuration.
28842886
}
28852887
```
28862888

2889+
### SRv6
2890+
2891+
The **SRV6_MY_SIDS** and **SRV6_MY_LOCATORS** tables introduce Segment Routing over IPv6 configuration.
2892+
An example is as follows:
2893+
```
2894+
{
2895+
"SRV6_MY_LOCATORS" : {
2896+
"loc1" : {
2897+
"prefix" : "FCBB:BBBB:20::"
2898+
}
2899+
}
2900+
"SRV6_MY_SIDS" : {
2901+
"loc1|FCBB:BBBB:20::" : {
2902+
"action": "uN"
2903+
},
2904+
"loc1|FCBB:BBBB:20:F1::" : {
2905+
"action": "uDT46",
2906+
"decap_vrf": "default",
2907+
"decap_dscp_mode": "pipe"
2908+
}
2909+
}
2910+
}
2911+
```
2912+
28872913
### FIPS
28882914

28892915
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)