Skip to content

Commit b1a082a

Browse files
committed
(1) Insert VNET_ROUTE_TUNNEL table in sonic-vnet.yang file and fix test cases
(2) Fix sample data name constraints
1 parent 3f23c83 commit b1a082a

File tree

9 files changed

+523
-336
lines changed

9 files changed

+523
-336
lines changed

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

+12-11
Original file line numberDiff line numberDiff line change
@@ -2546,23 +2546,24 @@ monitoring sessions for the vnet routes and is optional.
25462546
25472547
### VNET_ROUTE_TUNNEL
25482548
2549-
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 prefix associated with the route tunnel. The table includes the following attributes:
2550-
- ENDPOINT: The IP address of the host VM (mandatory), IPv4 address. It is used to identify the endpoint of the tunnel.
2551-
- MAC_ADDRESS: The inner destination MAC address in the encapsulated packet (optional). It should be a 12-hexadecimal digit value.
2549+
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 prefix associated with the route tunnel. The table includes the following attributes:
2550+
- ENDPOINT: The endpoint/nexthop tunnel IP (mandatory). It is used to identify the endpoint of the tunnel.
2551+
- MAC_ADDRESS: The inner destination MAC address in the encapsulated packet (optional). It should be a 12-hexadeimal digit value.
25522552
- VXLANID: The VNI value in the encapsulated packet (optional). It should be a numeric value.
25532553
25542554
```
25552555
{
25562556
"VNET_ROUTE_TUNNEL": {
2557-
"Vnet1-1:10.0.0.0/24": {
2558-
"endpoint": "192.168.1.1",
2559-
"mac_address": "F9:22:83:99:22:A2",
2560-
"vxlanid": "10011"
2557+
"Vnet_2000|100.100.1.1/32": {
2558+
"name": "Vnet_2000|100.100.1.1/32",
2559+
"endpoint": "192.168.1.1",
2560+
"mac_address": "F9:22:83:99:22:A2"
25612561
},
2562-
"Vnetv4_v4-0:10.0.1.0/24": {
2563-
"endpoint": "192.168.1.2",
2564-
"mac_address": "F8:22:83:99:22:A2",
2565-
"vxlanid": "10012"
2562+
"Vnetv4_v4-0|10.0.1.0/24": {
2563+
"name": "Vnetv4_v4-0|10.0.1.0/24",
2564+
"endpoint": "192.168.1.2",
2565+
"mac_address": "F8:22:83:99:22:A2",
2566+
"vxlanid": "10012"
25662567
}
25672568
}
25682569
}

src/sonic-yang-models/setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ def run(self):
176176
'./yang-models/sonic-versions.yang',
177177
'./yang-models/sonic-vlan.yang',
178178
'./yang-models/sonic-vnet.yang',
179-
'./yang-models/sonic-vnet-route-tunnel-vxlan.yang',
180179
'./yang-models/sonic-voq-inband-interface.yang',
181180
'./yang-models/sonic-vxlan.yang',
182181
'./yang-models/sonic-vrf.yang',

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -2338,7 +2338,8 @@
23382338
}
23392339
},
23402340
"VNET_ROUTE_TUNNEL" : {
2341-
"vnet1:10.0.0.0/24" : {
2341+
"vnet1|10.0.0.0/24" : {
2342+
"name":"vnet1|10.0.0.0/24",
23422343
"endpoint": "192.168.1.2",
23432344
"mac_address": "F9:22:83:99:22:A2",
23442345
"vxlanid": "10011"

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

+51
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,56 @@
2424
"VNET_INVALID_VXLAN_VTEP": {
2525
"desc": "Missing Vxlan_TUNNEL configuration",
2626
"eStr" : [ "points to a non-existing leaf" ]
27+
},
28+
"VNET_ROUTE_TUNNEL_MIN_TEST": {
29+
"desc": "Basic VNET route tunnel configuration with minimal required field - endpoint in VNET_ROUTE_TUNNEL_LIST table."
30+
},
31+
32+
"VNET_ROUTE_TUNNEL_MULTI_TEST": {
33+
"desc": "Multiple VNET route tunnel configurations for different VNETs in VNET_ROUTE_TUNNEL_LIST table."
34+
},
35+
36+
"VNET_ROUTE_TUNNEL_COMPLETE_TEST": {
37+
"desc": "Complete VNET route tunnel configuration with all optional fields (including mac_address and vxlanid)in VNET_ROUTE_TUNNEL_LIST table."
38+
},
39+
40+
"VNET_ROUTE_TUNNEL_TEST_DUPLICATE_NAME": {
41+
"desc": "VNET route tunnel configuration with duplicate name keys in VNET_ROUTE_TUNNEL_LIST table.",
42+
"eStr": "Duplicated instance of \"VNET_ROUTE_TUNNEL_LIST\" list."
43+
},
44+
45+
"VNET_ROUTE_TUNNEL_TEST_INVALID_ENDPOINT": {
46+
"desc": "VNET route tunnel configuration with invalid endpoint IP value (256.256.256.256) in VNET_ROUTE_TUNNEL_LIST table.",
47+
"eStr": "Value \"256.256.256.256\" does not satisfy the constraint"
48+
},
49+
50+
"VNET_ROUTE_TUNNEL_TEST_INVALID_MAC": {
51+
"desc": "VNET route tunnel configuration with invalid MAC address format (non-hexadecimal characters) in VNET_ROUTE_TUNNEL_LIST table.",
52+
"eStr": "Value \"GG:HH:II:JJ:KK:LL\" does not satisfy the constraint \"[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}\""
53+
},
54+
55+
"VNET_ROUTE_TUNNEL_TEST_INVALID_VXLANID": {
56+
"desc": "VNET route tunnel configuration with invalid VXLAN ID (exceeding max value of 16777215) in VNET_ROUTE_TUNNEL_LIST table.",
57+
"eStr": "Value \"16777216\" does not satisfy the constraint \"1..16777215\""
58+
},
59+
60+
"VNET_ROUTE_TUNNEL_TEST_INVALID_NAME_FORMAT": {
61+
"desc": "VNET route tunnel configuration with invalid name format (missing pipe and prefix) in VNET_ROUTE_TUNNEL_LIST table.",
62+
"eStr": "Value \"Vnet1\" does not satisfy the constraint \"[^|]+[|]((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2])))\" (range, length, or pattern)\""
63+
},
64+
65+
"VNET_ROUTE_TUNNEL_TEST_INVALID_PREFIX": {
66+
"desc": "VNET route tunnel configuration with invalid prefix format (300.168.1.0/24) in name field.",
67+
"eStr": "Value \"Vnet1|300.168.1.0/24\" does not satisfy the constraint \"[^|]+[|]((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])/(([0-9])|([1-2][0-9])|(3[0-2])))\" (range, length, or pattern)\""
68+
},
69+
70+
"VNET_ROUTE_TUNNEL_TEST_MISSING_ENDPOINT": {
71+
"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\"."
73+
},
74+
75+
"VNET_ROUTE_TUNNEL_TEST_NONEXISTENT_VNET": {
76+
"desc": "VNET route tunnel configuration referencing a non-existent VNET name, violating the must condition.",
77+
"eStr": "VNET name in the key must reference a valid VNET in the VNET table"
2778
}
2879
}

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

-58
This file was deleted.

0 commit comments

Comments
 (0)