Skip to content

Commit

Permalink
[Yang][Bugfix] Vxlan tunnel yang model to support dest_ip and name le…
Browse files Browse the repository at this point in the history
…ngth. (sonic-net#18966)

Fixed  the Vxlan tunnel yang model to add support for
1) Tunnel name length restriction has been removed
2) dst_ip field.

#### Why I did it
The yand modle was misisng an element and supported tunnel anme was very small.
#### How to verify it
run yang model tests
  • Loading branch information
siqbal1986 authored and mssonicbld committed Jun 20, 2024
1 parent ace1e5b commit 5594fa0
Show file tree
Hide file tree
Showing 4 changed files with 169 additions and 31 deletions.
3 changes: 2 additions & 1 deletion src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2437,7 +2437,8 @@ VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered
{
"VXLAN_TUNNEL": {
"vtep1": {
"src_ip": "10.10.10.10"
"src_ip": "10.10.10.10",
"dst_ip": "12.12.12.12"
}
}
"VXLAN_TUNNEL_MAP" : {
Expand Down
13 changes: 13 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/vxlan.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,18 @@
"VXLAN_MAP_OOR_VNI": {
"desc": "VNI Out of Range in VXLAN_TUNNEL_MAP TABLE",
"eStrKey": "Range"
},
"VXLAN_TUNNEL_NAME_VALID_TEST": {
"desc": "Tunnel Name string length 30 is valid"
},
"VXLAN_TUNNEL_NAME_INVALID_TEST": {
"desc": "Tunnel Name string length 0 is invalid",
"eStrKey": "Must"
},
"VXLAN_TUNNEL_NAME_VALID_DST_IPV4_TEST": {
"desc": "Valid IPv4 Destination Address"
},
"VXLAN_TUNNEL_NAME_VALID_DST_IPV6_TEST": {
"desc": "Valid IPv6 Destination Address"
}
}
170 changes: 148 additions & 22 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/vxlan.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
]
}
},
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
Expand All @@ -17,15 +17,15 @@
"src_ip": "1.2.3.4"
}
]
},
},
"sonic-vxlan:VXLAN_EVPN_NVO": {
"VXLAN_EVPN_NVO_LIST": [
{
"name": "nvo1",
"source_vtep": "vtep1"
}
]
},
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
Expand All @@ -35,8 +35,8 @@
"vni": "100"
}
]
}
}
}
}
},
"VXLAN_VALID_V6_TUNNEL_TEST": {
"sonic-vlan:sonic-vlan": {
Expand All @@ -47,7 +47,7 @@
}
]
}
},
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
Expand All @@ -56,15 +56,15 @@
"src_ip": "2001::1:2:3:4"
}
]
},
},
"sonic-vxlan:VXLAN_EVPN_NVO": {
"VXLAN_EVPN_NVO_LIST": [
{
"name": "nvo1",
"source_vtep": "vtep1"
}
]
},
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
Expand All @@ -74,8 +74,8 @@
"vni": "100"
}
]
}
}
}
}
},
"VXLAN_EVPN_NVO_WITHOUT_VTEP": {
"sonic-vxlan:sonic-vxlan": {
Expand All @@ -86,8 +86,8 @@
"source_vtep": "vtep1"
}
]
}
}
}
}
},
"VXLAN_MAP_WITHOUT_VTEP": {
"sonic-vlan:sonic-vlan": {
Expand All @@ -98,7 +98,7 @@
}
]
}
},
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
Expand All @@ -109,8 +109,8 @@
"vni": "100"
}
]
}
}
}
}
},
"VXLAN_MAP_WITHOUT_VLAN": {
"sonic-vxlan:sonic-vxlan": {
Expand All @@ -121,7 +121,7 @@
"src_ip": "1.2.3.4"
}
]
},
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
Expand All @@ -131,8 +131,8 @@
"vni": "100"
}
]
}
}
}
}
},
"VXLAN_MAP_OOR_VNI": {
"sonic-vlan:sonic-vlan": {
Expand All @@ -143,7 +143,7 @@
}
]
}
},
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
Expand All @@ -152,7 +152,7 @@
"src_ip": "1.2.3.4"
}
]
},
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
Expand All @@ -162,7 +162,133 @@
"vni": "16777299"
}
]
}
}
}
}
},
"VXLAN_TUNNEL_NAME_VALID_TEST": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan100"
}
]
}
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "30CharachterLongName1234567890",
"src_ip": "1.2.3.4"
}
]
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
"name": "30CharachterLongName1234567890",
"mapname": "map_100_Vlan100",
"vlan": "Vlan100",
"vni": "16777214"
}
]
}
}
},
"VXLAN_TUNNEL_NAME_INVALID_TEST": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan100"
}
]
}
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "",
"src_ip": "1.2.3.4"
}
]
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
"name": "",
"mapname": "map_100_Vlan100",
"vlan": "Vlan100",
"vni": "16777214"
}
]
}
}
},
"VXLAN_TUNNEL_NAME_VALID_DST_IPV4_TEST": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan100"
}
]
}
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "30CharachterLongName1234567890",
"src_ip": "1.2.3.4",
"dst_ip": "1.2.3.4"
}
]
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
"name": "30CharachterLongName1234567890",
"mapname": "map_100_Vlan100",
"vlan": "Vlan100",
"vni": "16777214"
}
]
}
}
},
"VXLAN_TUNNEL_NAME_VALID_DST_IPV6_TEST": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan100"
}
]
}
},
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "tunnel1",
"src_ip": "1.2.3.4",
"dst_ip": "2001::1:2:3:4"
}
]
},
"sonic-vxlan:VXLAN_TUNNEL_MAP": {
"VXLAN_TUNNEL_MAP_LIST": [
{
"name": "tunnel1",
"mapname": "map_100_Vlan100",
"vlan": "Vlan100",
"vni": "16777214"
}
]
}
}
}
}
14 changes: 6 additions & 8 deletions src/sonic-yang-models/yang-models/sonic-vxlan.yang
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@ module sonic-vxlan {
max-elements 1;

leaf name {
/* vni devices are created of the form 'name'-vlanid
The kernel has a max limit of 15 chars for netdevices.
keeping aside 5 chars for hyphen and vlanid the
name should have a max of 10 chars */

type string {
length 1..10;
}
type string;
}
must "string-length(name) != 0";

leaf src_ip {
type inet:ip-address;
}

leaf dst_ip {
type inet:ip-address;
}
}
}

Expand Down

0 comments on commit 5594fa0

Please sign in to comment.