[Yang model] Add Yang models for VNET table. (#14873)

Created Yang Modle for VNET table.
https://github.com/sonic-net/sonic-buildimage/issues/14534

##### Work item tracking
- Microsoft ADO **(number only)**:
18215579
This commit is contained in:
siqbal1986 2023-05-18 14:53:26 -07:00 committed by GitHub
parent c5d0507224
commit c900abbdb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 353 additions and 0 deletions

View File

@ -70,6 +70,7 @@ Table of Contents
* [Versions](#versions) * [Versions](#versions)
* [VLAN](#vlan) * [VLAN](#vlan)
* [VLAN_MEMBER](#vlan_member) * [VLAN_MEMBER](#vlan_member)
* [VNET](#vnet)
* [VOQ Inband Interface](#voq-inband-interface) * [VOQ Inband Interface](#voq-inband-interface)
* [VXLAN](#vxlan) * [VXLAN](#vxlan)
* [Virtual router](#virtual-router) * [Virtual router](#virtual-router)
@ -2067,6 +2068,33 @@ channel name as object key, and tagging mode as attributes.
} }
``` ```
### VNET
VNET table has Vnet name as the object key, and vxlan_tunnel name, scope, vni, peer list, advertised prefix, src mac, and overlay dest mac as attributes.
The vxlan_tunnel name (mandatory) is the tunnel name from the VXLAN table. scope (optional) must "default", vni (mandatory) is the vxlan tunnel vni, peer_list (optional) is for Vnet
peering, advertise_prefix (optional) is used to allow advertisement of this vnet's routes, overlay_dmac (optional) is the mac address which is used for VNET ping
monitoring sessions for the vnet routes and is optional.
```
{
"VNET": {
"Vnet1-1": {
"vxlan_tunnel": "vtep1",
"scope": "default",
"vni": "10011",
"peer_list": "",
"advertise_prefix": "true",
"overlay_dmac": "22:33:44:55:66:77"
},
"Vnetv4_v4-0": {
"vxlan_tunnel": "vtep2",
"scope": "default",
"vni": "10011",
}
}
}
```
### VOQ INBAND INTERFACE ### VOQ INBAND INTERFACE
VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu communication. At this time, only inband_type of "port" is supported VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu communication. At this time, only inband_type of "port" is supported

View File

@ -159,6 +159,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-vnet.yang',
'./yang-models/sonic-voq-inband-interface.yang', './yang-models/sonic-voq-inband-interface.yang',
'./yang-models/sonic-vxlan.yang', './yang-models/sonic-vxlan.yang',
'./yang-models/sonic-vrf.yang', './yang-models/sonic-vrf.yang',

View File

@ -2024,6 +2024,16 @@
"vlan": "Vlan100" "vlan": "Vlan100"
} }
}, },
"VNET": {
"vnet1": {
"vxlan_tunnel": "vtep1",
"scope": "default",
"vni": "100",
"peer_list": "",
"advertise_prefix": "true",
"overlay_dmac": "22:33:44:55:66:77"
}
},
"PORT_QOS_MAP": { "PORT_QOS_MAP": {
"Ethernet0": { "Ethernet0": {
"dot1p_to_tc_map" : "Dot1p_to_tc_map1", "dot1p_to_tc_map" : "Dot1p_to_tc_map1",

View File

@ -0,0 +1,28 @@
{
"VNET_VALID_TEST1": {
"desc": "Valid VNET Configuration."
},
"VNET_VALID_TEST2": {
"desc": "Valid VNET Configuration."
},
"VNET_INVALID_VALUE_TEST1": {
"desc": "Invalid values in parameters.",
"eStr": [ "Invalid VRF name" ]
},
"VNET_INVALID_VALUE_TEST2": {
"desc": "Invalid values in parameters.",
"eStr": [ "Invalid value" ]
},
"VNET_INVALID_VALUE_TEST3": {
"desc": "Invalid values in parameters.",
"eStr": [ "does not satisfy the constraint" ]
},
"VNET_INVALID_VALUE_TEST4": {
"desc": "Invalid values in parameters.",
"eStr": [ "does not satisfy the constraint" ]
},
"VNET_INVALID_VXLAN_VTEP": {
"desc": "Missing Vxlan_TUNNEL configuration",
"eStr" : [ "points to a non-existing leaf" ]
}
}

View File

@ -0,0 +1,182 @@
{
"VNET_VALID_TEST1": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "def",
"vxlan_tunnel": "vtep1",
"vni": "10011"
}
]
}
}
},
"VNET_VALID_TEST2": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "abcd",
"vxlan_tunnel": "vtep1",
"scope": "default",
"vni": "10011",
"peer_list": "",
"advertise_prefix": "true",
"overlay_dmac": "22:33:44:55:66:77"
}
]
}
}
},
"VNET_INVALID_VALUE_TEST1": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "abcd-1",
"vxlan_tunnel": "vtep1",
"scope": "Vrf_blue",
"vni": "10011",
"peer_list": "",
"advertise_prefix": "true",
"overlay_dmac": "22:33:44:55:66:77"
}
]
}
}
},
"VNET_INVALID_VALUE_TEST2": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "abcdfg",
"vxlan_tunnel": "vtep1",
"scope": "default",
"vni": "999999999999",
"advertise_prefix": "unknown",
"overlay_dmac": "22:33:44:55:66:77"
}
]
}
}
},
"VNET_INVALID_VALUE_TEST3": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "abcd",
"vxlan_tunnel": "vtep1",
"scope": "default",
"vni": "20100",
"overlay_dmac": "22::"
}
]
}
}
},
"VNET_INVALID_VALUE_TEST4": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "abcdfd",
"scope": "default",
"overlay_dmac": "22::"
}
]
}
}
},
"VNET_INVALID_VXLAN_VTEP": {
"sonic-vxlan:sonic-vxlan": {
"sonic-vxlan:VXLAN_TUNNEL": {
"VXLAN_TUNNEL_LIST": [
{
"name": "vtep1",
"src_ip": "1.2.3.4"
}
]
}
},
"sonic-vnet:sonic-vnet": {
"sonic-vnet:VNET": {
"VNET_LIST": [
{
"name" : "abcd",
"vxlan_tunnel": "vtepxyz",
"scope": "default",
"vni": "10011",
"peer_list": "",
"advertise_prefix": "true",
"overlay_dmac": "22:33:44:55:66:77"
}
]
}
}
}
}

View File

@ -0,0 +1,104 @@
module sonic-vnet {
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-vnet";
prefix svnet;
import ietf-yang-types {
prefix yang;
}
import ietf-inet-types {
prefix inet;
}
import sonic-types {
prefix stypes;
}
import sonic-vxlan {
prefix svxlan;
}
organization
"SONiC";
contact
"SONiC";
description
"VNET YANG Module for SONiC OS";
revision 2023-04-25 {
description
"First revision.";
}
container sonic-vnet {
container VNET {
description "config db VNET table";
list VNET_LIST {
key "name";
leaf name {
description "An alphanumaric string to represent the name of the unique vnet";
type string;
}
leaf vxlan_tunnel {
mandatory true;
description "A valid and active vxlan tunnel to be used with this vnet for traffic encapsulation.";
type leafref {
path "/svxlan:sonic-vxlan/svxlan:VXLAN_TUNNEL/svxlan:VXLAN_TUNNEL_LIST/svxlan:name";
}
}
leaf vni {
mandatory true;
description "A valid and unique vni which will become part of the encapsulated traffic header.";
type stypes:vnid_type;
}
leaf peer_list {
description "Set of peers";
/* Values in leaf list are UNIQUE */
type string;
}
leaf guid {
description "An optional guid.";
type string {
length 1..255;
}
}
leaf scope {
description "can only be default.";
type string {
pattern "default" {
error-message "Invalid VRF name";
}
}
}
leaf advertise_prefix {
description "Flag to enable advertisement of route prefixes belonging to the Vnet.";
type boolean;
}
leaf overlay_dmac {
description "Overlay Dest MAC address to be used by Vnet ping.";
type yang:mac-address;
}
leaf src_mac {
description "source mac address for the Vnet";
type yang:mac-address;
}
}
}
}
}