Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mclag enhancements as per HLD at Azure/SONIC#596 #25

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 242 additions & 0 deletions models/yang/sonic/sonic-mclag.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
module sonic-mclag {
namespace "http://github.com/Azure/sonic-mclag";
prefix smclag;
yang-version 1.1;

import ietf-yang-types {
prefix yang;
}

import ietf-inet-types {
prefix inet;
}

import sonic-common {
prefix scommon;
}

import sonic-extension {
prefix sonic-ext;
}

import sonic-port {
prefix prt;
}

import sonic-portchannel {
prefix spc;
}

import sonic-vlan {
prefix svlan;
}

import sonic-vlan-interface {
prefix svlan-intf;
}

organization
"SONiC";

contact
"SONiC";

description
"SONIC MCLAG";

revision 2019-10-01 {
description
"Initial revision.";
}

container sonic-mclag {

container MCLAG_DOMAIN {

list MCLAG_DOMAIN_LIST {
key "domain_id";
max-elements 1;

leaf domain_id {
type uint16 {
range "1..4095" {
error-message "MCLAG Domain ID out of range";
}
}
}

leaf source_ip {
type inet:ipv4-address;
}
leaf peer_ip {
type inet:ipv4-address;
}
leaf peer_link {
type union {
type leafref {
path "/prt:sonic-port/prt:PORT/prt:PORT_LIST/prt:ifname";
}
type leafref {
path "/spc:sonic-portchannel/spc:PORTCHANNEL/spc:PORTCHANNEL_LIST/spc:name";
}
}
}
leaf keepalive_interval {
type uint16 {
range "1..60" {
error-message "MCLAG Domain keepalive interval out of range";
error-app-tag keepalive_interval-invalid;
}
}
default 1;
}
leaf session_timeout {
type uint16 {
range "1..3600" {
error-message "MCLAG Domain session timeout out of range";
error-app-tag session_timeout-invalid;
}
}
default 30;
}
must "(keepalive_interval * 3) <= session_timeout" {
error-message "(keepalive interval * 3) <= session_timeout value";
error-app-tag keepalive_interval-invalid;
}
}
}

container MCLAG_INTERFACE {

list MCLAG_INTERFACE_LIST {
key "domain_id if_name";

leaf domain_id {
type leafref {
path "../../../MCLAG_DOMAIN/MCLAG_DOMAIN_LIST/domain_id";
}
}

leaf if_name {
type leafref {
path "/spc:sonic-portchannel/spc:PORTCHANNEL/spc:PORTCHANNEL_LIST/spc:name";
}
}
leaf if_type {
type string;
}
}
}

container MCLAG_UNIQUE_IP {

list MCLAG_UNIQUE_IP_LIST {
key "if_name";

must "count(../../MCLAG_DOMAIN/MCLAG_DOMAIN_LIST/domain_id) != 0" {
error-message "mclag not configured";
error-app-tag mclag-invalid;
}

must "count(/svlan-intf:sonic-vlan-interface/svlan-intf:VLAN_INTERFACE/svlan-intf:VLAN_INTERFACE_IPADDR_LIST[svlan-intf:vlanName=current()/if_name]) = 0" {
error-message "remove configured ip/v6 address and reconfigure after seperate ip configuration";
error-app-tag vlan-intf-ip-invalid;
}

leaf if_name {
type leafref {
path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name";
}
}
leaf unique_ip {
type enumeration {
enum enable;
}
}
}
}

//stateDB MCLAG Table
container MCLAG_TABLE {
sonic-ext:db-name "STATE_DB";
sonic-ext:key-delim "|";

config false;
description "state db mclag domain table";

list MCLAG_TABLE_LIST {
key "domain_id";

leaf domain_id {
type uint16;
}

leaf oper_status {
type scommon:oper-status;
}

leaf role {
type enumeration {
enum active;
enum standby;
}
}

leaf system_mac {
type yang:mac-address;
description
"System MAC Address used for ICCPD";
}
}
}

//state MCLAG Local interface Table
container MCLAG_LOCAL_INTF_TABLE {

sonic-ext:db-name "STATE_DB";
sonic-ext:key-delim "|";

config false;
description "state db LOCAL interface table";

list MCLAG_LOCAL_INTF_TABLE_LIST {
key "if_name";

leaf if_name {
type string;
}

leaf port_isolate_peer_link {
type boolean;
}
}
}


//state MCLAG Remote interface Table
container MCLAG_REMOTE_INTF_TABLE {

sonic-ext:db-name "STATE_DB";
sonic-ext:key-delim "|";

config false;
description "state db remote interface table";

list MCLAG_REMOTE_INTF_TABLE_LIST {
key "domain_id if_name";

leaf domain_id {
type uint16;
}

leaf if_name {
type string;
}

leaf oper_status {
type scommon:oper-status;
}
}
}
}
}
Loading