Skip to content

Commit ec22803

Browse files
authored
[YANG] Change VXLAN tunnel YANG model to support 2 tunnels + string validation (#23984)
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 Tested branch (Please provide the tested image version) Description for the changelog Change VXLAN tunnel YANG model to support 2 tunnels + string validation signed-off-by: jianquanye@microsoft.com
1 parent 6074ec5 commit ec22803

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
@@ -2827,33 +2827,73 @@ VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu
28272827

28282828
### VXLAN
28292829

2830-
VXLAN_TUNNEL holds the VTEP source ip configuration.
2830+
VXLAN_TUNNEL holds the VTEP source ip configuration (maximum 2 tunnels).
28312831
VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration.
28322832
VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels.
28332833

2834+
Single tunnel example:
28342835
```
28352836
{
2836-
"VXLAN_TUNNEL": {
2837+
"VXLAN_TUNNEL": {
28372838
"vtep1": {
28382839
"src_ip": "10.10.10.10",
28392840
"dst_ip": "12.12.12.12"
28402841
}
2841-
}
2842-
"VXLAN_TUNNEL_MAP" : {
2842+
},
2843+
"VXLAN_TUNNEL_MAP": {
28432844
"vtep1|map_1000_Vlan100": {
2844-
"vni": "1000",
2845-
"vlan": "100"
2846-
},
2847-
"vtep1|testmap": {
2848-
"vni": "22000",
2849-
"vlan": "70"
2850-
},
2851-
}
2852-
"VXLAN_EVPN_NVO": {
2845+
"vni": "1000",
2846+
"vlan": "100"
2847+
},
2848+
"vtep1|map_22000_Vlan70": {
2849+
"vni": "22000",
2850+
"vlan": "70"
2851+
}
2852+
},
2853+
"VXLAN_EVPN_NVO": {
28532854
"nvo1": {
28542855
"source_vtep": "vtep1"
28552856
}
2856-
}
2857+
}
2858+
}
2859+
```
2860+
2861+
Dual tunnel example:
2862+
```
2863+
{
2864+
"VXLAN_TUNNEL": {
2865+
"vtep1": {
2866+
"src_ip": "10.10.10.10",
2867+
"dst_ip": "12.12.12.12"
2868+
},
2869+
"vtep2": {
2870+
"src_ip": "10.20.10.10",
2871+
"dst_ip": "20.20.20.20"
2872+
}
2873+
},
2874+
"VXLAN_TUNNEL_MAP": {
2875+
"vtep1|map_1000_Vlan100": {
2876+
"vni": "1000",
2877+
"vlan": "100"
2878+
},
2879+
"vtep1|map_22000_Vlan70": {
2880+
"vni": "22000",
2881+
"vlan": "70"
2882+
},
2883+
"vtep2|map_2000_Vlan200": {
2884+
"vni": "2000",
2885+
"vlan": "200"
2886+
},
2887+
"vtep2|map_3000_Vlan300": {
2888+
"vni": "3000",
2889+
"vlan": "300"
2890+
}
2891+
},
2892+
"VXLAN_EVPN_NVO": {
2893+
"nvo1": {
2894+
"source_vtep": "vtep1"
2895+
}
2896+
}
28572897
}
28582898
```
28592899

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)