[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.
This commit is contained in:
parent
f78807230f
commit
3ba5cdcaa0
@ -49,6 +49,7 @@ Table of Contents
|
|||||||
* [Versions](#versions)
|
* [Versions](#versions)
|
||||||
* [VLAN](#vlan)
|
* [VLAN](#vlan)
|
||||||
* [VLAN_MEMBER](#vlan_member)
|
* [VLAN_MEMBER](#vlan_member)
|
||||||
|
* [VXLAN](#vxlan)
|
||||||
* [Virtual router](#virtual-router)
|
* [Virtual router](#virtual-router)
|
||||||
* [WRED_PROFILE](#wred_profile)
|
* [WRED_PROFILE](#wred_profile)
|
||||||
* [PASSWORD_HARDENING](#password_hardening)
|
* [PASSWORD_HARDENING](#password_hardening)
|
||||||
@ -1460,6 +1461,37 @@ channel name as object key, and tagging mode as attributes.
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### VXLAN
|
||||||
|
|
||||||
|
VXLAN_TUNNEL holds the VTEP source ip configuration.
|
||||||
|
VXLAN_TUNNEL_MAP holds the vlan to vni and vni to vlan mapping configuration.
|
||||||
|
VXLAN_EVPN_NVO holds the VXLAN_TUNNEL object to be used for BGP-EVPN discovered tunnels.
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"VXLAN_TUNNEL": {
|
||||||
|
"vtep1": {
|
||||||
|
"src_ip": "10.10.10.10"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"VXLAN_TUNNEL_MAP" : {
|
||||||
|
"vtep1|map_1000_Vlan100": {
|
||||||
|
"vni": "1000",
|
||||||
|
"vlan": "100"
|
||||||
|
},
|
||||||
|
"vtep1|testmap": {
|
||||||
|
"vni": "22000",
|
||||||
|
"vlan": "70"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
"VXLAN_EVPN_NVO": {
|
||||||
|
"nvo1": {
|
||||||
|
"source_vtep": "vtep1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
### Virtual router
|
### Virtual router
|
||||||
|
|
||||||
The virtual router table allows to insert or update a new virtual router
|
The virtual router table allows to insert or update a new virtual router
|
||||||
|
@ -134,6 +134,7 @@ setup(
|
|||||||
'./yang-models/sonic-types.yang',
|
'./yang-models/sonic-types.yang',
|
||||||
'./yang-models/sonic-versions.yang',
|
'./yang-models/sonic-versions.yang',
|
||||||
'./yang-models/sonic-vlan.yang',
|
'./yang-models/sonic-vlan.yang',
|
||||||
|
'./yang-models/sonic-vxlan.yang',
|
||||||
'./yang-models/sonic-vrf.yang',
|
'./yang-models/sonic-vrf.yang',
|
||||||
'./yang-models/sonic-mclag.yang',
|
'./yang-models/sonic-mclag.yang',
|
||||||
'./yang-models/sonic-vlan-sub-interface.yang',
|
'./yang-models/sonic-vlan-sub-interface.yang',
|
||||||
|
@ -332,6 +332,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"VLAN": {
|
"VLAN": {
|
||||||
|
"Vlan100": {
|
||||||
|
"description": "vxlan",
|
||||||
|
"vlanid": "100",
|
||||||
|
"mtu": "9216",
|
||||||
|
"admin_status": "up"
|
||||||
|
},
|
||||||
"Vlan111": {
|
"Vlan111": {
|
||||||
"description": "svlan",
|
"description": "svlan",
|
||||||
"dhcp_servers": [
|
"dhcp_servers": [
|
||||||
@ -1703,7 +1709,22 @@
|
|||||||
"4": "4"
|
"4": "4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"VXLAN_TUNNEL": {
|
||||||
|
"vtep1": {
|
||||||
|
"src_ip": "1.2.3.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"VXLAN_EVPN_NVO": {
|
||||||
|
"nvo1": {
|
||||||
|
"source_vtep": "vtep1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"VXLAN_TUNNEL_MAP": {
|
||||||
|
"vtep1|map_100_Vlan100": {
|
||||||
|
"vni" : "100",
|
||||||
|
"vlan": "Vlan100"
|
||||||
|
}
|
||||||
|
},
|
||||||
"PORT_QOS_MAP": {
|
"PORT_QOS_MAP": {
|
||||||
"Ethernet0": {
|
"Ethernet0": {
|
||||||
"dot1p_to_tc_map" : "Dot1p_to_tc_map1",
|
"dot1p_to_tc_map" : "Dot1p_to_tc_map1",
|
||||||
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
@ -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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
126
src/sonic-yang-models/yang-models/sonic-vxlan.yang
Normal file
126
src/sonic-yang-models/yang-models/sonic-vxlan.yang
Normal file
@ -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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -262,6 +262,14 @@ module sonic-types {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef vnid_type {
|
||||||
|
type uint32 {
|
||||||
|
range "1..16777215";
|
||||||
|
}
|
||||||
|
description
|
||||||
|
"VXLAN Network Identifier";
|
||||||
|
}
|
||||||
|
|
||||||
{% if yang_model_type == "cvl" %}
|
{% if yang_model_type == "cvl" %}
|
||||||
/* Required for CVL */
|
/* Required for CVL */
|
||||||
container operation {
|
container operation {
|
||||||
|
Reference in New Issue
Block a user