e6fa396aaa
This is backport of #14757 SONiC Yang model support for IPv6 link local What I did Created SONiC Yang model for IPv6 link local How I did it Defined Yang models for IPv6 link local based on https://github.com/sonic-net/SONiC/blob/master/doc/ipv6/ipv6_link_local.md How to verify it Added enable test case. Signed-off-by: Akhilesh Samineni akhilesh.samineni@broadcom.com
261 lines
5.0 KiB
YANG
261 lines
5.0 KiB
YANG
module sonic-vlan {
|
|
|
|
yang-version 1.1;
|
|
|
|
namespace "http://github.com/sonic-net/sonic-vlan";
|
|
prefix vlan;
|
|
|
|
import ietf-inet-types {
|
|
prefix inet;
|
|
}
|
|
|
|
import ietf-yang-types {
|
|
prefix yang;
|
|
}
|
|
|
|
import sonic-types {
|
|
prefix stypes;
|
|
}
|
|
|
|
import sonic-extension {
|
|
prefix ext;
|
|
}
|
|
|
|
import sonic-port {
|
|
prefix port;
|
|
revision-date 2019-07-01;
|
|
}
|
|
|
|
import sonic-portchannel {
|
|
prefix lag;
|
|
}
|
|
|
|
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";
|
|
}
|
|
}
|
|
|
|
leaf nat_zone {
|
|
description "NAT Zone for the vlan interface";
|
|
type uint8 {
|
|
range "0..3" {
|
|
error-message "Invalid nat zone for the vlan interface.";
|
|
error-app-tag nat-zone-invalid;
|
|
}
|
|
}
|
|
default "0";
|
|
}
|
|
leaf mpls {
|
|
description "Enable/disable MPLS routing for the vlan interface";
|
|
type enumeration {
|
|
enum enable;
|
|
enum disable;
|
|
}
|
|
}
|
|
|
|
leaf grat_arp {
|
|
type string {
|
|
pattern "enabled|disabled";
|
|
}
|
|
}
|
|
|
|
leaf proxy_arp {
|
|
type string {
|
|
pattern "enabled|disabled";
|
|
}
|
|
}
|
|
|
|
leaf ipv6_use_link_local_only {
|
|
description "Enable/Disable IPv6 link local address on vlan interface";
|
|
type stypes:mode-status;
|
|
default disable;
|
|
}
|
|
|
|
leaf loopback_action {
|
|
description "Packet action when a packet ingress and gets routed on the same IP interface";
|
|
type stypes:loopback_action;
|
|
}
|
|
}
|
|
/* 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 alias {
|
|
type string;
|
|
}
|
|
|
|
leaf description {
|
|
type string {
|
|
length 1..255;
|
|
}
|
|
}
|
|
|
|
leaf-list dhcp_servers {
|
|
description "Configure the dhcp v4 servers";
|
|
type inet:ip-address;
|
|
}
|
|
|
|
leaf-list dhcpv6_servers {
|
|
description "Configure the dhcp v6 servers";
|
|
type inet:ipv6-address;
|
|
}
|
|
|
|
leaf mtu {
|
|
type uint16 {
|
|
range 1..9216;
|
|
}
|
|
}
|
|
|
|
leaf admin_status {
|
|
type stypes:admin_status;
|
|
}
|
|
|
|
leaf mac {
|
|
type yang:mac-address;
|
|
}
|
|
}
|
|
/* 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 port";
|
|
|
|
leaf name {
|
|
type leafref {
|
|
path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name";
|
|
}
|
|
}
|
|
|
|
leaf port {
|
|
/* 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 */
|