Skip to content

Commit 97433f5

Browse files
authored
[202506] [yang] VNET_ROUTE_TUNNEL yang model support for consistent hashing (#24684) (#1900)
Master PR: sonic-net/sonic-buildimage#24684 Why I did it To support consistent ECMP for vxlan tunnels, according to specifications in sonic-net/SONiC#2099 Work item tracking Microsoft ADO (number only): How I did it Added multi-value support for endpoint, mac and vni. Added consistent_hashing_buckets. How to verify it Run the tests added in this PR or build image with these changes and set the new attributes. <!-- Please make sure you've read and understood our contributing guidelines: https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md ** 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 ##### Work item tracking - Microsoft ADO **(number only)**: #### How I did it #### 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 --> - [ ] 201811 - [ ] 201911 - [ ] 202006 - [ ] 202012 - [ ] 202106 - [ ] 202111 - [ ] 202205 - [ ] 202211 #### 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: --> <!-- 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)
2 parents 5800da3 + ae1638c commit 97433f5

File tree

6 files changed

+502
-41
lines changed

6 files changed

+502
-41
lines changed

src/sonic-yang-mgmt/sonic_yang_ext.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
('BUFFER_PORT_INGRESS_PROFILE_LIST', 'profile_list'): ',',
3636
('PORT', 'adv_speeds'): ',',
3737
('PORT', 'adv_interface_types'): ',',
38+
('VNET_ROUTE_TUNNEL', 'endpoint'): ',',
39+
('VNET_ROUTE_TUNNEL', 'mac_address'): ',',
40+
('VNET_ROUTE_TUNNEL', 'vni'): ',',
3841
}
3942

4043
"""

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2740,13 +2740,20 @@ monitoring sessions for the vnet routes and is optional.
27402740
### VNET_ROUTE_TUNNEL
27412741

27422742
VNET_ROUTE_TUNNEL table has vnet_name|prefix as the object key, where vnet_name is the name of the VNet and prefix is the ip4 prefix associated with the route tunnel. The table includes the following attributes:
2743-
- ENDPOINT: The endpoint/nexthop tunnel IP (mandatory). It is used to identify the endpoint of the tunnel.
2744-
- MAC_ADDRESS: The inner destination MAC address in the encapsulated packet (optional). It should be a 12-hexadeimal digit value.
2745-
- VNI: The VNI value in the encapsulated packet (optional). It should be a numeric value.
2743+
- ENDPOINT: Comma-separated endpoint/nexthop tunnel IPs (mandatory). They are used to identify the endpoints of the tunnel.
2744+
- MAC_ADDRESS: Comma-separated inner destination MAC addresses in the encapsulated packet (optional). They should be 12-hexadecimal digit values.
2745+
- VNI: Comma-separated VNI values in the encapsulated packet (optional). They should be numeric values.
2746+
- CONSISTENT_HASHING_BUCKETS: Number of consistent hashing buckets to use, if consistent hashing is desired (optional). It should be a numeric value.
27462747

27472748
```
27482749
{
27492750
"VNET_ROUTE_TUNNEL": {
2751+
"Vnet_1000|100.200.1.1/32": {
2752+
"endpoint": "192.174.1.1,192.174.1.2",
2753+
"mac_address": "f8:25:84:98:22:a1,f8:25:84:98:22:a2",
2754+
"vni": "10010,10011",
2755+
"consistent_hashing_buckets": "10"
2756+
},
27502757
"Vnet_2000|100.100.1.1/32": {
27512758
"endpoint": "192.168.1.1",
27522759
"mac_address": "f9:22:83:99:22:a2"

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,9 +2406,10 @@
24062406
},
24072407
"VNET_ROUTE_TUNNEL" : {
24082408
"vnet1|10.0.0.0/24" : {
2409-
"endpoint": "192.168.1.2",
2410-
"mac_address": "f9:22:83:99:22:a2",
2411-
"vni": "10011"
2409+
"endpoint": "192.168.1.1,192.168.1.2",
2410+
"mac_address": "f9:22:83:99:22:a1,f9:22:83:99:22:a2",
2411+
"vni": "10011,10012",
2412+
"consistent_hashing_buckets": "10"
24122413
}
24132414
},
24142415
"PORT_QOS_MAP": {

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

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,59 @@
6969

7070
"VNET_ROUTE_TUNNEL_TEST_MISSING_ENDPOINT": {
7171
"desc": "VNET route tunnel configuration with missing mandatory attribute (endpoint) in VNET_ROUTE_TUNNEL_LIST table.",
72-
"eStr": "Missing required element \"endpoint\" in \"VNET_ROUTE_TUNNEL_LIST\"."
72+
"eStrKey": "MinElements"
7373
},
7474

7575
"VNET_ROUTE_TUNNEL_TEST_NONEXISTENT_VNET": {
7676
"desc": "VNET route tunnel configuration referencing a non-existent VNET name, violating the must condition.",
77-
"eStr": "Leafref \"/sonic-vnet:sonic-vnet/sonic-vnet:VNET/sonic-vnet:VNET_LIST/sonic-vnet:name\" of value \"NonexistentVnet\" points to a non-existing leaf"
77+
"eStrKey" : "LeafRef"
78+
},
79+
80+
"VNET_ROUTE_TUNNEL_TEST_MULTI_ENDPOINT": {
81+
"desc": "VNET route tunnel configuration with multiple comma-separated endpoint IPs in VNET_ROUTE_TUNNEL_LIST table."
82+
},
83+
84+
"VNET_ROUTE_TUNNEL_TEST_MULTI_MAC": {
85+
"desc": "VNET route tunnel configuration with multiple comma-separated MAC addresses in VNET_ROUTE_TUNNEL_LIST table."
86+
},
87+
88+
"VNET_ROUTE_TUNNEL_TEST_MULTI_VNI": {
89+
"desc": "VNET route tunnel configuration with multiple comma-separated VNI values in VNET_ROUTE_TUNNEL_LIST table."
90+
},
91+
92+
"VNET_ROUTE_TUNNEL_TEST_MULTI_ALL": {
93+
"desc": "VNET route tunnel configuration with multiple comma-separated values for all fields (endpoint, mac_address, vni) in VNET_ROUTE_TUNNEL_LIST table."
94+
},
95+
96+
"VNET_ROUTE_TUNNEL_TEST_INVALID_MULTI_ENDPOINT": {
97+
"desc": "VNET route tunnel configuration with invalid IP in comma-separated endpoint list.",
98+
"eStrKey": "Pattern"
99+
},
100+
101+
"VNET_ROUTE_TUNNEL_TEST_INVALID_MULTI_MAC": {
102+
"desc": "VNET route tunnel configuration with invalid MAC in comma-separated mac_address list.",
103+
"eStrKey": "Pattern"
104+
},
105+
106+
"VNET_ROUTE_TUNNEL_TEST_INVALID_MULTI_VNI": {
107+
"desc": "VNET route tunnel configuration with invalid VNI in comma-separated vni list.",
108+
"eStrKey": "Range"
109+
},
110+
111+
"VNET_ROUTE_TUNNEL_TEST_CONSISTENT_HASHING": {
112+
"desc": "VNET route tunnel configuration with consistent_hashing_buckets field."
113+
},
114+
115+
"VNET_ROUTE_TUNNEL_TEST_CONSISTENT_HASHING_MAX": {
116+
"desc": "VNET route tunnel configuration with consistent_hashing_buckets maximum value (65535)."
117+
},
118+
119+
"VNET_ROUTE_TUNNEL_TEST_CONSISTENT_HASHING_WITH_MULTI": {
120+
"desc": "VNET route tunnel configuration with consistent_hashing_buckets and multiple endpoints."
121+
},
122+
123+
"VNET_ROUTE_TUNNEL_TEST_INVALID_CONSISTENT_HASHING": {
124+
"desc": "VNET route tunnel configuration with invalid consistent_hashing_buckets value (exceeds uint16 max).",
125+
"eStrKey": "InvalidValue"
78126
}
79127
}

0 commit comments

Comments
 (0)