Skip to content

Commit 80fb6ed

Browse files
authored
[YANG] Change VXLAN tunnel YANG model to support 2 tunnels + string validation (#23999)
<!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md failure_prs.log skip_prs.log Make sure all your commits include a signature generated with `git commit -s` ** If this is a bug fix, make sure your description includes "fixes #xxxx", or "closes #xxxx" or "resolves #xxxx" Please provide the following information: --> #### Why I did it Change VXLAN tunnel YANG model to support 2 tunnels + string validation. This is to allow for newer validation in production. ##### Work item tracking - Microsoft ADO **(number only)**: 33013419 #### How I did it Modify vxlan tunnel list model and add unit tests #### How to verify it <!-- If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012. --> #### Which release branch to backport (provide reason below if selected) <!-- - Note we only backport fixes to a release branch, *not* features! - Please also provide a reason for the backporting below. - e.g. - [x] 202006 --> - [ ] 202205 - [ ] 202211 - [ ] 202305 - [ ] 202311 - [ ] 202405 - [ ] 202411 - [X] 202505 #### Tested branch (Please provide the tested image version) <!-- - Please provide tested image version - e.g. - [x] 20201231.100 --> - [ ] <!-- image version 1 --> - [ ] <!-- image version 2 --> #### Description for the changelog <!-- Write a short (one line) summary that describes the changes in this pull request for inclusion in the changelog: --> Change VXLAN tunnel YANG model to support 2 tunnels + string validation <!-- Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU. --> #### Link to config_db schema for YANG module changes <!-- Provide a link to config_db schema for the table for which YANG model is defined Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md --> #### A picture of a cute animal (not mandatory but encouraged)
1 parent 3435dda commit 80fb6ed

4 files changed

Lines changed: 103 additions & 26 deletions

File tree

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

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2558,33 +2558,73 @@ VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu
25582558
25592559
### VXLAN
25602560
2561-
VXLAN_TUNNEL holds the VTEP source ip configuration.
2561+
VXLAN_TUNNEL holds the VTEP source ip configuration (maximum 2 tunnels).
25622562
VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration.
25632563
VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels.
25642564
2565+
Single tunnel example:
25652566
```
25662567
{
2567-
"VXLAN_TUNNEL": {
2568+
"VXLAN_TUNNEL": {
25682569
"vtep1": {
25692570
"src_ip": "10.10.10.10",
25702571
"dst_ip": "12.12.12.12"
25712572
}
2572-
}
2573-
"VXLAN_TUNNEL_MAP" : {
2573+
},
2574+
"VXLAN_TUNNEL_MAP": {
25742575
"vtep1|map_1000_Vlan100": {
2575-
"vni": "1000",
2576-
"vlan": "100"
2577-
},
2578-
"vtep1|testmap": {
2579-
"vni": "22000",
2580-
"vlan": "70"
2581-
},
2582-
}
2583-
"VXLAN_EVPN_NVO": {
2576+
"vni": "1000",
2577+
"vlan": "100"
2578+
},
2579+
"vtep1|map_22000_Vlan70": {
2580+
"vni": "22000",
2581+
"vlan": "70"
2582+
}
2583+
},
2584+
"VXLAN_EVPN_NVO": {
25842585
"nvo1": {
25852586
"source_vtep": "vtep1"
25862587
}
2587-
}
2588+
}
2589+
}
2590+
```
2591+
2592+
Dual tunnel example:
2593+
```
2594+
{
2595+
"VXLAN_TUNNEL": {
2596+
"vtep1": {
2597+
"src_ip": "10.10.10.10",
2598+
"dst_ip": "12.12.12.12"
2599+
},
2600+
"vtep2": {
2601+
"src_ip": "10.20.10.10",
2602+
"dst_ip": "20.20.20.20"
2603+
}
2604+
},
2605+
"VXLAN_TUNNEL_MAP": {
2606+
"vtep1|map_1000_Vlan100": {
2607+
"vni": "1000",
2608+
"vlan": "100"
2609+
},
2610+
"vtep1|map_22000_Vlan70": {
2611+
"vni": "22000",
2612+
"vlan": "70"
2613+
},
2614+
"vtep2|map_2000_Vlan200": {
2615+
"vni": "2000",
2616+
"vlan": "200"
2617+
},
2618+
"vtep2|map_3000_Vlan300": {
2619+
"vni": "3000",
2620+
"vlan": "300"
2621+
}
2622+
},
2623+
"VXLAN_EVPN_NVO": {
2624+
"nvo1": {
2625+
"source_vtep": "vtep1"
2626+
}
2627+
}
25882628
}
25892629
```
25902630

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

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,26 @@
2020
"VXLAN_TUNNEL_NAME_VALID_TEST": {
2121
"desc": "Tunnel Name string length 15 is valid"
2222
},
23-
"VXLAN_TUNNEL_NAME_INVALID_LENGTH_TEST": {
24-
"desc": "Tunnel Name string length exceeding 16 is invalid",
25-
"eStr" : "Invalid interface name length, it must not exceed 16 characters."
23+
"VXLAN_TUNNEL_NAME_LONG_VALID_TEST": {
24+
"desc": "Tunnel Name string length exceeding 16 is now valid"
2625
},
27-
"VXLAN_TUNNEL_NAME_INVALID_TEST": {
28-
"desc": "Tunnel Name string length 0 is invalid",
29-
"eStr" : "Invalid interface name length, it must not exceed 16 characters."
26+
"VXLAN_TUNNEL_NAME_EMPTY_VALID_TEST": {
27+
"desc": "Tunnel Name string length 0 is valid"
3028
},
3129
"VXLAN_TUNNEL_NAME_VALID_DST_IPV4_TEST": {
32-
"desc": "Valid IPv4 Destination Address",
33-
"eStr" : "Invalid interface name length, it must not exceed 16 characters."
30+
"desc": "Valid IPv4 Destination Address"
3431
},
3532
"VXLAN_TUNNEL_NAME_VALID_DST_IPV6_TEST": {
3633
"desc": "Valid IPv6 Destination Address"
34+
},
35+
"VXLAN_TUNNEL_MAX_ELEM_VALID_TEST": {
36+
"desc": "Valid config with 2 VXLAN_TUNNEL entries"
37+
},
38+
"VXLAN_TUNNEL_MAX_ELEM_INVALID_TEST": {
39+
"desc": "Invalid config with more than 2 VXLAN_TUNNEL entries",
40+
"eStrKey": "MaxElements"
41+
},
42+
"VXLAN_TUNNEL_NAME_STRING_VALID_TEST": {
43+
"desc": "Tunnel name as arbitrary string is valid"
3744
}
3845
}

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

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@
196196
}
197197
}
198198
},
199-
"VXLAN_TUNNEL_NAME_INVALID_LENGTH_TEST": {
199+
"VXLAN_TUNNEL_NAME_LONG_VALID_TEST": {
200200
"sonic-vlan:sonic-vlan": {
201201
"sonic-vlan:VLAN": {
202202
"VLAN_LIST": [
@@ -227,7 +227,7 @@
227227
}
228228
}
229229
},
230-
"VXLAN_TUNNEL_NAME_INVALID_TEST": {
230+
"VXLAN_TUNNEL_NAME_EMPTY_VALID_TEST": {
231231
"sonic-vlan:sonic-vlan": {
232232
"sonic-vlan:VLAN": {
233233
"VLAN_LIST": [
@@ -321,5 +321,35 @@
321321
]
322322
}
323323
}
324+
},
325+
"VXLAN_TUNNEL_MAX_ELEM_VALID_TEST": {
326+
"sonic-vxlan:sonic-vxlan": {
327+
"sonic-vxlan:VXLAN_TUNNEL": {
328+
"VXLAN_TUNNEL_LIST": [
329+
{ "name": "vtep1", "src_ip": "1.2.3.4" },
330+
{ "name": "vtep2", "src_ip": "2.3.4.5" }
331+
]
332+
}
333+
}
334+
},
335+
"VXLAN_TUNNEL_MAX_ELEM_INVALID_TEST": {
336+
"sonic-vxlan:sonic-vxlan": {
337+
"sonic-vxlan:VXLAN_TUNNEL": {
338+
"VXLAN_TUNNEL_LIST": [
339+
{ "name": "vtep1", "src_ip": "1.2.3.4" },
340+
{ "name": "vtep2", "src_ip": "2.3.4.5" },
341+
{ "name": "vtep3", "src_ip": "3.4.5.6" }
342+
]
343+
}
344+
}
345+
},
346+
"VXLAN_TUNNEL_NAME_STRING_VALID_TEST": {
347+
"sonic-vxlan:sonic-vxlan": {
348+
"sonic-vxlan:VXLAN_TUNNEL": {
349+
"VXLAN_TUNNEL_LIST": [
350+
{ "name": "arbitrary_string", "src_ip": "5.6.7.8" }
351+
]
352+
}
353+
}
324354
}
325355
}

src/sonic-yang-models/yang-models/sonic-vxlan.yang

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ module sonic-vxlan {
4646
list VXLAN_TUNNEL_LIST {
4747

4848
key "name";
49-
max-elements 1;
49+
max-elements 2;
5050

5151
leaf name {
52-
type stypes:interface_name;
52+
type string;
5353
}
5454

5555
leaf src_ip {

0 commit comments

Comments
 (0)