-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Yang model] Add Yang models for VNET table. (#14873)
Created Yang Modle for VNET table. #14534 ##### Work item tracking - Microsoft ADO **(number only)**: 18215579
- Loading branch information
1 parent
c5d0507
commit c900abb
Showing
6 changed files
with
353 additions
and
0 deletions.
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
28 changes: 28 additions & 0 deletions
28
src/sonic-yang-models/tests/yang_model_tests/tests/vnet.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,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" ] | ||
} | ||
} |
182 changes: 182 additions & 0 deletions
182
src/sonic-yang-models/tests/yang_model_tests/tests_config/vnet.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,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" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
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,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; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|