Skip to content

Commit 7e1cf96

Browse files
committed
Add vnet name in vlan_sub_interface and add test cases
1 parent ab88fe0 commit 7e1cf96

File tree

9 files changed

+501
-1
lines changed

9 files changed

+501
-1
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,12 @@
2929
"INTERFACE_INVALID_ENABLE_IPV6_LINK_LOCAL": {
3030
"desc": "Enable the ipv6 link-local as true.",
3131
"eStr": "Invalid value \"true\" in \"ipv6_use_link_local_only\" element."
32+
},
33+
"INTERFACE_VALID_VNET_NAME": {
34+
"desc": "Configure valid VNET name for an interface."
35+
},
36+
"INTERFACE_INVALID_VNET_NAME": {
37+
"desc": "Configure non-existent VNET name for an interface.",
38+
"eStrKey": "LeafRef"
3239
}
3340
}

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

+11
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,16 @@
118118
"VLAN_ADD_PORT_THAT_IS_ROUTER_INTERFACE": {
119119
"desc": "Add to Vlan port that is router interface",
120120
"eStr": "Port is a router interface"
121+
},
122+
"VLAN_INTERFACE_WITH_VNET_AND_IP_PREFIXES": {
123+
"desc": "Configure a VLAN interface with VNET and both IPv4 and IPv6 prefixes."
124+
},
125+
"VLAN_INTERFACE_WITH_INVALID_VNET_NAME_REFERENCE": {
126+
"desc": "Configure a VLAN interface with reference to a non-existent VNET.",
127+
"eStrKey": "LeafRef"
128+
},
129+
"VLAN_INTERFACE_WITH_MISSING_VNET_MODULE": {
130+
"desc": "Attempt to reference VNET name without the VNET module being present.",
131+
"eStrKey": "LeafRef"
121132
}
122133
}

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

+14
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,19 @@
5959
"VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_VLAN_CHECK_MUST_CONDITION_FALSE_TEST": {
6060
"desc": "Configure valid short name format vlan sub interface vlan must check condition false.",
6161
"eStrKey": "Must"
62+
},
63+
"VLAN_SUB_INTERFACE_WITH_VALID_VNET_NAME": {
64+
"desc": "Configure VLAN sub interface with valid VNET name reference."
65+
},
66+
"VLAN_SUB_INTERFACE_WITH_INVALID_VNET_NAME": {
67+
"desc": "Configure VLAN sub interface with reference to non-existent VNET.",
68+
"eStrKey": "LeafRef"
69+
},
70+
"VLAN_SUB_INTERFACE_WITH_VNET_PORTCHANNEL": {
71+
"desc": "Configure PortChannel VLAN sub interface with VNET reference."
72+
},
73+
"VLAN_SUB_INTERFACE_WITH_MISSING_VNET_MODULE": {
74+
"desc": "Configure VLAN sub interface with VNET reference but no VNET module.",
75+
"eStrKey": "LeafRef"
6276
}
6377
}

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

+100
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,105 @@
274274
]
275275
}
276276
}
277+
},
278+
"INTERFACE_VALID_VNET_NAME": {
279+
"sonic-vxlan:sonic-vxlan": {
280+
"sonic-vxlan:VXLAN_TUNNEL": {
281+
"VXLAN_TUNNEL_LIST": [
282+
{
283+
"name": "vtep1",
284+
"src_ip": "1.2.3.4"
285+
}
286+
]
287+
}
288+
},
289+
"sonic-vnet:sonic-vnet": {
290+
"sonic-vnet:VNET": {
291+
"VNET_LIST": [
292+
{
293+
"name": "Vnet1",
294+
"vxlan_tunnel": "vtep1",
295+
"vni": "10011"
296+
}
297+
]
298+
}
299+
},
300+
"sonic-interface:sonic-interface": {
301+
"sonic-interface:INTERFACE": {
302+
"INTERFACE_LIST": [
303+
{
304+
"name": "Ethernet8",
305+
"vnet_name": "Vnet1"
306+
}
307+
]
308+
}
309+
},
310+
"sonic-port:sonic-port": {
311+
"sonic-port:PORT": {
312+
"PORT_LIST": [
313+
{
314+
"admin_status": "up",
315+
"alias": "eth8",
316+
"description": "Ethernet8",
317+
"fec": "rs",
318+
"lanes": "65",
319+
"mtu": 9000,
320+
"name": "Ethernet8",
321+
"speed": 25000,
322+
"mode": "trunk"
323+
}
324+
]
325+
}
326+
}
327+
},
328+
"INTERFACE_INVALID_VNET_NAME": {
329+
"sonic-vxlan:sonic-vxlan": {
330+
"sonic-vxlan:VXLAN_TUNNEL": {
331+
"VXLAN_TUNNEL_LIST": [
332+
{
333+
"name": "vtep1",
334+
"src_ip": "1.2.3.4"
335+
}
336+
]
337+
}
338+
},
339+
"sonic-vnet:sonic-vnet": {
340+
"sonic-vnet:VNET": {
341+
"VNET_LIST": [
342+
{
343+
"name": "Vnet1",
344+
"vxlan_tunnel": "vtep1",
345+
"vni": "10011"
346+
}
347+
]
348+
}
349+
},
350+
"sonic-interface:sonic-interface": {
351+
"sonic-interface:INTERFACE": {
352+
"INTERFACE_LIST": [
353+
{
354+
"name": "Ethernet8",
355+
"vnet_name": "NonExistentVnet"
356+
}
357+
]
358+
}
359+
},
360+
"sonic-port:sonic-port": {
361+
"sonic-port:PORT": {
362+
"PORT_LIST": [
363+
{
364+
"admin_status": "up",
365+
"alias": "eth8",
366+
"description": "Ethernet8",
367+
"fec": "rs",
368+
"lanes": "65",
369+
"mtu": 9000,
370+
"name": "Ethernet8",
371+
"speed": 25000,
372+
"mode": "trunk"
373+
}
374+
]
375+
}
376+
}
277377
}
278378
}

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

+115-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,6 @@
737737
}
738738
}
739739
},
740-
741740
"VLAN_MEMBERS_WITHOUT_CREATING_VLAN": {
742741
"sonic-port:sonic-port": {
743742
"sonic-port:PORT": {
@@ -979,5 +978,120 @@
979978
]
980979
}
981980
}
981+
},
982+
"VLAN_INTERFACE_WITH_VNET_AND_IP_PREFIXES": {
983+
"sonic-vxlan:sonic-vxlan": {
984+
"sonic-vxlan:VXLAN_TUNNEL": {
985+
"VXLAN_TUNNEL_LIST": [
986+
{
987+
"name": "vtep1",
988+
"src_ip": "1.2.3.4"
989+
}
990+
]
991+
}
992+
},
993+
"sonic-vnet:sonic-vnet": {
994+
"sonic-vnet:VNET": {
995+
"VNET_LIST": [
996+
{
997+
"name": "Vnet1",
998+
"vxlan_tunnel": "vtep1",
999+
"vni": "10011"
1000+
}
1001+
]
1002+
}
1003+
},
1004+
"sonic-vlan:sonic-vlan": {
1005+
"sonic-vlan:VLAN": {
1006+
"VLAN_LIST": [
1007+
{
1008+
"name": "Vlan100"
1009+
}
1010+
]
1011+
},
1012+
"sonic-vlan:VLAN_INTERFACE": {
1013+
"VLAN_INTERFACE_LIST": [
1014+
{
1015+
"name": "Vlan100",
1016+
"vnet_name": "Vnet1"
1017+
}
1018+
],
1019+
"VLAN_INTERFACE_IPPREFIX_LIST": [
1020+
{
1021+
"name": "Vlan100",
1022+
"ip-prefix": "192.168.1.1/24",
1023+
"family": "IPv4",
1024+
"scope": "global"
1025+
},
1026+
{
1027+
"name": "Vlan100",
1028+
"ip-prefix": "2001:db8::1/64",
1029+
"family": "IPv6",
1030+
"scope": "global"
1031+
}
1032+
]
1033+
}
1034+
}
1035+
},
1036+
1037+
"VLAN_INTERFACE_WITH_INVALID_VNET_NAME_REFERENCE": {
1038+
"sonic-vxlan:sonic-vxlan": {
1039+
"sonic-vxlan:VXLAN_TUNNEL": {
1040+
"VXLAN_TUNNEL_LIST": [
1041+
{
1042+
"name": "vtep1",
1043+
"src_ip": "1.2.3.4"
1044+
}
1045+
]
1046+
}
1047+
},
1048+
"sonic-vnet:sonic-vnet": {
1049+
"sonic-vnet:VNET": {
1050+
"VNET_LIST": [
1051+
{
1052+
"name": "Vnet1",
1053+
"vxlan_tunnel": "vtep1",
1054+
"vni": "10011"
1055+
}
1056+
]
1057+
}
1058+
},
1059+
"sonic-vlan:sonic-vlan": {
1060+
"sonic-vlan:VLAN": {
1061+
"VLAN_LIST": [
1062+
{
1063+
"name": "Vlan100"
1064+
}
1065+
]
1066+
},
1067+
"sonic-vlan:VLAN_INTERFACE": {
1068+
"VLAN_INTERFACE_LIST": [
1069+
{
1070+
"name": "Vlan100",
1071+
"vnet_name": "NonExistentVnet"
1072+
}
1073+
]
1074+
}
1075+
}
1076+
},
1077+
1078+
"VLAN_INTERFACE_WITH_MISSING_VNET_MODULE": {
1079+
"sonic-vlan:sonic-vlan": {
1080+
"sonic-vlan:VLAN": {
1081+
"VLAN_LIST": [
1082+
{
1083+
"name": "Vlan100"
1084+
}
1085+
]
1086+
},
1087+
"sonic-vlan:VLAN_INTERFACE": {
1088+
"VLAN_INTERFACE_LIST": [
1089+
{
1090+
"name": "Vlan100",
1091+
"vnet_name": "Vnet1"
1092+
}
1093+
]
1094+
}
1095+
}
9821096
}
9831097
}

0 commit comments

Comments
 (0)