-
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.
Signed-off-by: Arthi Sivanantham <[email protected]>
- Loading branch information
Arthi Sivanantham
committed
Apr 23, 2021
1 parent
36aa54d
commit 6662244
Showing
1 changed file
with
191 additions
and
191 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,203 +1,203 @@ | ||
module sonic-vlan { | ||
|
||
yang-version 1.1; | ||
yang-version 1.1; | ||
|
||
namespace "http://github.com/Azure/sonic-vlan"; | ||
prefix vlan; | ||
namespace "http://github.com/Azure/sonic-vlan"; | ||
prefix vlan; | ||
|
||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
import ietf-inet-types { | ||
prefix inet; | ||
} | ||
|
||
import sonic-types { | ||
prefix stypes; | ||
revision-date 2019-07-01; | ||
} | ||
import sonic-types { | ||
prefix stypes; | ||
revision-date 2019-07-01; | ||
} | ||
|
||
import sonic-extension { | ||
prefix ext; | ||
revision-date 2019-07-01; | ||
} | ||
import sonic-extension { | ||
prefix ext; | ||
revision-date 2019-07-01; | ||
} | ||
|
||
import sonic-port { | ||
prefix port; | ||
revision-date 2019-07-01; | ||
} | ||
import sonic-port { | ||
prefix port; | ||
revision-date 2019-07-01; | ||
} | ||
|
||
import sonic-portchannel { | ||
prefix lag; | ||
} | ||
import sonic-portchannel { | ||
prefix lag; | ||
} | ||
|
||
import sonic-vrf { | ||
prefix vrf; | ||
} | ||
|
||
description "VLAN yang Module for SONiC OS"; | ||
import sonic-vrf { | ||
prefix vrf; | ||
} | ||
|
||
description "VLAN yang Module for SONiC OS"; | ||
|
||
revision 2021-04-22 { | ||
description "Modify Vlan Member to include PortChannel along with Port"; | ||
} | ||
|
||
revision 2021-03-30 { | ||
description "Modify the type of vrf name"; | ||
} | ||
|
||
revision 2019-07-01 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-vlan { | ||
|
||
container VLAN_INTERFACE { | ||
|
||
description "VLAN_INTERFACE part of config_db.json"; | ||
|
||
list VLAN_INTERFACE_LIST { | ||
|
||
description "VLAN INTERFACE part of config_db.json with vrf"; | ||
|
||
key "name"; | ||
|
||
leaf name { | ||
type leafref { | ||
path /vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name; | ||
} | ||
} | ||
|
||
leaf vrf_name { | ||
type leafref{ | ||
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name"; | ||
} | ||
} | ||
} | ||
/* end of VLAN_INTERFACE_LIST */ | ||
|
||
list VLAN_INTERFACE_IPPREFIX_LIST { | ||
|
||
key "name ip-prefix"; | ||
|
||
leaf name { | ||
/* This node must be present in VLAN_INTERFACE_LIST */ | ||
must "(current() = ../../VLAN_INTERFACE_LIST[name=current()]/name)" | ||
{ | ||
error-message "Must condition not satisfied, Try adding Vlan<vlanid>: {}, Example: 'Vlan100': {}"; | ||
} | ||
|
||
type leafref { | ||
path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name"; | ||
} | ||
} | ||
|
||
leaf ip-prefix { | ||
type union { | ||
type stypes:sonic-ip4-prefix; | ||
type stypes:sonic-ip6-prefix; | ||
} | ||
} | ||
|
||
leaf scope { | ||
type enumeration { | ||
enum global; | ||
enum local; | ||
} | ||
} | ||
|
||
leaf family { | ||
|
||
/* family leaf needed for backward compatibility | ||
Both ip4 and ip6 address are string in IETF RFC 6021, | ||
so must statement can check based on : or ., family | ||
should be IPv4 or IPv6 according. | ||
*/ | ||
|
||
must "(contains(../ip-prefix, ':') and current()='IPv6') or | ||
(contains(../ip-prefix, '.') and current()='IPv4')"; | ||
type stypes:ip-family; | ||
} | ||
} | ||
/* end of VLAN_INTERFACE_LIST */ | ||
} | ||
/* end of VLAN_INTERFACE container */ | ||
|
||
container VLAN { | ||
|
||
description "VLAN part of config_db.json"; | ||
|
||
list VLAN_LIST { | ||
|
||
key "name"; | ||
leaf 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 vlanid { | ||
type uint16 { | ||
range 1..4094; | ||
} | ||
} | ||
|
||
leaf description { | ||
type string { | ||
length 1..255; | ||
} | ||
} | ||
|
||
leaf-list dhcp_servers { | ||
type inet:ip-address; | ||
} | ||
|
||
leaf mtu { | ||
type uint16 { | ||
range 1..9216; | ||
} | ||
} | ||
|
||
leaf admin_status { | ||
type stypes:admin_status; | ||
} | ||
} | ||
/* end of VLAN_LIST */ | ||
} | ||
/* end of container VLAN */ | ||
|
||
container VLAN_MEMBER { | ||
|
||
description "VLAN_MEMBER part of config_db.json"; | ||
|
||
list VLAN_MEMBER_LIST { | ||
|
||
key "name ifname"; | ||
|
||
leaf name { | ||
type leafref { | ||
path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name"; | ||
} | ||
} | ||
|
||
leaf ifname { | ||
/* key elements are mandatory by default */ | ||
type union { | ||
type leafref { | ||
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
} | ||
type leafref { | ||
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; | ||
} | ||
} | ||
} | ||
|
||
leaf tagging_mode { | ||
mandatory true; | ||
type stypes:vlan_tagging_mode; | ||
} | ||
} | ||
/* end of list VLAN_MEMBER_LIST */ | ||
} | ||
/* end of container VLAN_MEMBER */ | ||
} | ||
/* end of container sonic-vlan */ | ||
revision 2021-04-22 { | ||
description "Modify Vlan Member to include PortChannel along with Port"; | ||
} | ||
|
||
revision 2021-03-30 { | ||
description "Modify the type of vrf name"; | ||
} | ||
|
||
revision 2019-07-01 { | ||
description "First Revision"; | ||
} | ||
|
||
container sonic-vlan { | ||
|
||
container VLAN_INTERFACE { | ||
|
||
description "VLAN_INTERFACE part of config_db.json"; | ||
|
||
list VLAN_INTERFACE_LIST { | ||
|
||
description "VLAN INTERFACE part of config_db.json with vrf"; | ||
|
||
key "name"; | ||
|
||
leaf name { | ||
type leafref { | ||
path /vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name; | ||
} | ||
} | ||
|
||
leaf vrf_name { | ||
type leafref{ | ||
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name"; | ||
} | ||
} | ||
} | ||
/* end of VLAN_INTERFACE_LIST */ | ||
|
||
list VLAN_INTERFACE_IPPREFIX_LIST { | ||
|
||
key "name ip-prefix"; | ||
|
||
leaf name { | ||
/* This node must be present in VLAN_INTERFACE_LIST */ | ||
must "(current() = ../../VLAN_INTERFACE_LIST[name=current()]/name)" | ||
{ | ||
error-message "Must condition not satisfied, Try adding Vlan<vlanid>: {}, Example: 'Vlan100': {}"; | ||
} | ||
|
||
type leafref { | ||
path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name"; | ||
} | ||
} | ||
|
||
leaf ip-prefix { | ||
type union { | ||
type stypes:sonic-ip4-prefix; | ||
type stypes:sonic-ip6-prefix; | ||
} | ||
} | ||
|
||
leaf scope { | ||
type enumeration { | ||
enum global; | ||
enum local; | ||
} | ||
} | ||
|
||
leaf family { | ||
|
||
/* family leaf needed for backward compatibility | ||
Both ip4 and ip6 address are string in IETF RFC 6021, | ||
so must statement can check based on : or ., family | ||
should be IPv4 or IPv6 according. | ||
*/ | ||
|
||
must "(contains(../ip-prefix, ':') and current()='IPv6') or | ||
(contains(../ip-prefix, '.') and current()='IPv4')"; | ||
type stypes:ip-family; | ||
} | ||
} | ||
/* end of VLAN_INTERFACE_LIST */ | ||
} | ||
/* end of VLAN_INTERFACE container */ | ||
|
||
container VLAN { | ||
|
||
description "VLAN part of config_db.json"; | ||
|
||
list VLAN_LIST { | ||
|
||
key "name"; | ||
leaf 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 vlanid { | ||
type uint16 { | ||
range 1..4094; | ||
} | ||
} | ||
|
||
leaf description { | ||
type string { | ||
length 1..255; | ||
} | ||
} | ||
|
||
leaf-list dhcp_servers { | ||
type inet:ip-address; | ||
} | ||
|
||
leaf mtu { | ||
type uint16 { | ||
range 1..9216; | ||
} | ||
} | ||
|
||
leaf admin_status { | ||
type stypes:admin_status; | ||
} | ||
} | ||
/* end of VLAN_LIST */ | ||
} | ||
/* end of container VLAN */ | ||
|
||
container VLAN_MEMBER { | ||
|
||
description "VLAN_MEMBER part of config_db.json"; | ||
|
||
list VLAN_MEMBER_LIST { | ||
|
||
key "name ifname"; | ||
|
||
leaf name { | ||
type leafref { | ||
path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name"; | ||
} | ||
} | ||
|
||
leaf ifname { | ||
/* key elements are mandatory by default */ | ||
type union { | ||
type leafref { | ||
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name"; | ||
} | ||
type leafref { | ||
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name"; | ||
} | ||
} | ||
} | ||
|
||
leaf tagging_mode { | ||
mandatory true; | ||
type stypes:vlan_tagging_mode; | ||
} | ||
} | ||
/* end of list VLAN_MEMBER_LIST */ | ||
} | ||
/* end of container VLAN_MEMBER */ | ||
} | ||
/* end of container sonic-vlan */ | ||
} | ||
/* end of module sonic-vlan */ |