-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YANG MODEL] SONiC Yang support for VXLAN (#7294)
Why I did it SONiC Yang support for VXLAN How I did it Added a new sonic-vxlan.yang file. Please refer to EVPN VXLAN HLD for DB details https://github.com/Azure/SONiC/tree/master/doc/vxlan/EVPN How to verify it Added tests for sonic vxlan yang.
- Loading branch information
Showing
7 changed files
with
335 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/sonic-yang-models/tests/yang_model_tests/tests/vxlan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"VXLAN_VALID_TEST": { | ||
"desc": "Valid VXLAN Configuration." | ||
}, | ||
"VXLAN_EVPN_NVO_WITHOUT_VTEP": { | ||
"desc": "Configure EVPN_NVO without VXLAN_TUNNEL entry", | ||
"eStrKey" : "LeafRef" | ||
}, | ||
"VXLAN_MAP_WITHOUT_VTEP": { | ||
"desc": "Configure VXLAN_TUNNEL_MAP without VXLAN_TUNNEL entry", | ||
"eStrKey" : "LeafRef" | ||
}, | ||
"VXLAN_MAP_OOR_VNI": { | ||
"desc": "VNI Out of Range in VXLAN_TUNNEL_MAP TABLE", | ||
"eStrKey": "Range" | ||
} | ||
} |
129 changes: 129 additions & 0 deletions
129
src/sonic-yang-models/tests/yang_model_tests/tests_config/vxlan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
{ | ||
"VXLAN_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": "vtep1", | ||
"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": [ | ||
{ | ||
"name": "vtep1", | ||
"mapname": "map_100_Vlan100", | ||
"vlan": "Vlan100", | ||
"vni": "100" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"VXLAN_EVPN_NVO_WITHOUT_VTEP": { | ||
"sonic-vxlan:sonic-vxlan": { | ||
"sonic-vxlan:VXLAN_EVPN_NVO": { | ||
"VXLAN_EVPN_NVO_LIST": [ | ||
{ | ||
"name": "nvo1", | ||
"source_vtep": "vtep1" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"VXLAN_MAP_WITHOUT_VTEP": { | ||
"sonic-vlan:sonic-vlan": { | ||
"sonic-vlan:VLAN": { | ||
"VLAN_LIST": [ | ||
{ | ||
"name": "Vlan100" | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-vxlan:sonic-vxlan": { | ||
"sonic-vxlan:VXLAN_TUNNEL_MAP": { | ||
"VXLAN_TUNNEL_MAP_LIST": [ | ||
{ | ||
"name": "vtep1", | ||
"mapname": "map_100_Vlan100", | ||
"vlan": "Vlan100", | ||
"vni": "100" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"VXLAN_MAP_WITHOUT_VLAN": { | ||
"sonic-vxlan:sonic-vxlan": { | ||
"sonic-vxlan:VXLAN_TUNNEL": { | ||
"VXLAN_TUNNEL_LIST": [ | ||
{ | ||
"name": "vtep1", | ||
"src_ip": "1.2.3.4" | ||
} | ||
] | ||
}, | ||
"sonic-vxlan:VXLAN_TUNNEL_MAP": { | ||
"VXLAN_TUNNEL_MAP_LIST": [ | ||
{ | ||
"name": "vtep1", | ||
"mapname": "map_100_Vlan100", | ||
"vlan": "Vlan100", | ||
"vni": "100" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"VXLAN_MAP_OOR_VNI": { | ||
"sonic-vlan:sonic-vlan": { | ||
"sonic-vlan:VLAN": { | ||
"VLAN_LIST": [ | ||
{ | ||
"name": "Vlan100" | ||
} | ||
] | ||
} | ||
}, | ||
"sonic-vxlan:sonic-vxlan": { | ||
"sonic-vxlan:VXLAN_TUNNEL": { | ||
"VXLAN_TUNNEL_LIST": [ | ||
{ | ||
"name": "vtep1", | ||
"src_ip": "1.2.3.4" | ||
} | ||
] | ||
}, | ||
"sonic-vxlan:VXLAN_TUNNEL_MAP": { | ||
"VXLAN_TUNNEL_MAP_LIST": [ | ||
{ | ||
"name": "vtep1", | ||
"mapname": "map_100_Vlan100", | ||
"vlan": "Vlan100", | ||
"vni": "16777299" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
module sonic-vxlan { | ||
yang-version 1.1; | ||
namespace "http://github.com/Azure/sonic-vxlan"; | ||
prefix svxlan; | ||
|
||
import ietf-yang-types { | ||
prefix yang; | ||
} | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-extension { | ||
prefix sonic-ext; | ||
} | ||
// Comment sonic-vlan import here until libyang back-links issue is resolved for VLAN leaf reference. | ||
//import sonic-vlan { | ||
// prefix svlan; | ||
//} | ||
import sonic-types { | ||
prefix stypes; | ||
} | ||
|
||
|
||
organization | ||
"SONiC"; | ||
|
||
contact | ||
"SONiC"; | ||
|
||
description | ||
"SONIC VXLAN"; | ||
|
||
revision 2021-04-12 { | ||
description | ||
"First revision."; | ||
} | ||
|
||
container sonic-vxlan { | ||
|
||
container VXLAN_TUNNEL { | ||
|
||
description "config db VXLAN_TUNNEL table"; | ||
|
||
list VXLAN_TUNNEL_LIST { | ||
|
||
key "name"; | ||
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; | ||
} | ||
} | ||
|
||
leaf src_ip { | ||
type inet:ipv4-address; | ||
} | ||
} | ||
} | ||
|
||
container VXLAN_TUNNEL_MAP { | ||
|
||
description "config db VXLAN_TUNNEL_MAP table"; | ||
|
||
list VXLAN_TUNNEL_MAP_LIST { | ||
key "name mapname"; | ||
|
||
leaf name { | ||
type leafref { | ||
path "/svxlan:sonic-vxlan/svxlan:VXLAN_TUNNEL/svxlan:VXLAN_TUNNEL_LIST/svxlan:name"; | ||
} | ||
} | ||
|
||
leaf mapname { | ||
type string; | ||
} | ||
|
||
leaf vlan { | ||
mandatory true; | ||
// Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern | ||
// type leafref { | ||
// path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name"; | ||
//} | ||
type string { | ||
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])'; | ||
} | ||
|
||
} | ||
|
||
leaf vni { | ||
mandatory true; | ||
type stypes:vnid_type; | ||
} | ||
} | ||
} | ||
|
||
container VXLAN_EVPN_NVO { | ||
|
||
description "config db VXLAN_EVPN_NVO table"; | ||
|
||
list VXLAN_EVPN_NVO_LIST { | ||
|
||
key "name"; | ||
max-elements 1; | ||
|
||
leaf name { | ||
type string; | ||
} | ||
|
||
leaf source_vtep { | ||
mandatory true; | ||
type leafref { | ||
path "/svxlan:sonic-vxlan/svxlan:VXLAN_TUNNEL/svxlan:VXLAN_TUNNEL_LIST/svxlan:name"; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters