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

added mclag sonic yang #7622

Merged
merged 59 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
97bbc74
added mclag sonic yang
gitsabari May 17, 2021
a6ba02b
updated sonic mclag
gitsabari Jun 1, 2021
8b6f45e
updated sonic mclag yang
gitsabari Jun 1, 2021
076ceb6
fixed mclag sonic yang dependencies issues
gitsabari Jun 1, 2021
aa47903
fixed sonic mclag errors
gitsabari Jun 1, 2021
0162309
updated sonic mclag yang
gitsabari Jun 15, 2021
16a59ed
addressed review comments, added some mclag ut cases
gitsabari Jul 28, 2021
e640464
Merge branch 'master' into mclag_enhacements
gitsabari Jul 28, 2021
7f87932
corrected mclag test json format issues
gitsabari Jul 28, 2021
0527da5
updated sample mclag config file
gitsabari Jul 28, 2021
41d7622
fixed error with mclag test json files
gitsabari Jul 28, 2021
f8c4ad0
fixed mclag build issue
gitsabari Jul 28, 2021
a86adf3
removed state db related yang changes which has dependency on sonic-e…
gitsabari Jul 29, 2021
91402ad
fixed mclag samle config
gitsabari Jul 29, 2021
60503c4
fixed mclag test config file
gitsabari Jul 29, 2021
b44248d
fixed mclag test case file
gitsabari Jul 29, 2021
0cbfaac
updated mclag test case
gitsabari Jul 29, 2021
87089c0
fix mclag case
gitsabari Jul 29, 2021
c6a2cbd
updated mclag test cases
gitsabari Jul 29, 2021
f5a9ac0
fixed mclag test case issue
gitsabari Jul 29, 2021
6253252
fixed mclag test case
gitsabari Jul 29, 2021
c36e6c8
updated mclag test case
gitsabari Jul 29, 2021
e44f31e
updated mclag test case
gitsabari Jul 29, 2021
32f1871
fixed mclag test load failure
gitsabari Jul 29, 2021
58bc90d
fixed mclag test case
gitsabari Jul 29, 2021
a3c7753
updated mclag test cases
gitsabari Jul 29, 2021
1271c86
fixed mclag test case
gitsabari Jul 29, 2021
bac56a9
fixed mclag test case
gitsabari Jul 29, 2021
c1373f8
corrected mclag test case failure
gitsabari Jul 29, 2021
a990d63
updated mclag test case
gitsabari Jul 29, 2021
3df4433
addressed review comments and fixed test cases
gitsabari Oct 1, 2021
1fb1e33
Merge branch 'master' into mclag_enhacements
gitsabari Oct 1, 2021
46fb2d3
corrected test cases
gitsabari Oct 4, 2021
88b774e
addressed review comments
gitsabari Oct 12, 2021
39955fb
addressed review comments
gitsabari Oct 22, 2021
be18bed
fixed test run errors
gitsabari Oct 22, 2021
30d380b
fixed test failures
gitsabari Oct 23, 2021
4dd6a95
fixed test case failure
gitsabari Oct 25, 2021
962d51a
fixed test case
gitsabari Oct 25, 2021
8a50409
fixed test case
gitsabari Oct 25, 2021
7cb15e4
fixed test case
gitsabari Oct 25, 2021
d94b084
fixed test case
gitsabari Oct 25, 2021
766b2fd
fixed test case
gitsabari Oct 25, 2021
668b04b
fixed test case
gitsabari Oct 26, 2021
d1e47a4
fixed test case
gitsabari Oct 26, 2021
99f593b
fixed test case
gitsabari Oct 26, 2021
2c266d9
fixed test case
gitsabari Oct 26, 2021
3c09a40
fixed test case
gitsabari Oct 29, 2021
5058465
fixed test case
gitsabari Nov 10, 2021
0a7a3ca
Merge branch 'master' into mclag_enhacements
gitsabari Nov 18, 2021
c419b58
resolving issue with sample config json
gitsabari Nov 18, 2021
e58e143
Merge branch 'master' into mclag_enhacements
gitsabari Dec 8, 2021
5aecb78
addressed review comments
gitsabari Dec 16, 2021
b6df637
addressed review comment
gitsabari Dec 16, 2021
a549a9c
Merge branch 'master' into mclag_enhacements
gitsabari Jan 13, 2022
d2fe61e
commenting sonic vlan import and reference until libyang back-links i…
gitsabari Jan 25, 2022
cc6bb1e
commenting libyang back-links reference issue#9312 related test cases…
gitsabari Jan 25, 2022
f39124d
commenting libyang back-links reference issue#9312 related test cases…
gitsabari Jan 25, 2022
01e664a
removed back-links reference issue#9312 related test cases until the
gitsabari Jan 25, 2022
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
240 changes: 240 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-mclag.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
module sonic-mclag {
namespace "http://github.com/Azure/sonic-mclag";
prefix smclag;
yang-version 1.1;


import ietf-yang-types {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
prefix yang;
}

import ietf-inet-types {
prefix inet;
}

import sonic-types {
prefix stypes;
}

import sonic-extension {
prefix sonic-ext;
}

import sonic-port {
prefix prt;
}

import sonic-portchannel {
prefix spc;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"lag" prefix is used in earlier Yang files, can we please stick to that.

}

import sonic-vlan {
prefix svlan;
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
}

organization
"SONiC";

contact
"SONiC";

description
"SONIC MCLAG";

revision 2019-10-01 {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
description
"Initial revision.";
}

container sonic-mclag {

container MCLAG_DOMAIN {

list MCLAG_DOMAIN_LIST {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
key "domain_id";
max-elements 1;
gitsabari marked this conversation as resolved.
Show resolved Hide resolved

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

leaf source_ip {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
type inet:ipv4-address;
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
}
leaf peer_ip {
type inet:ipv4-address;
}
leaf peer_link {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add mandatory fields.

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 {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
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;
}
}
}
gitsabari marked this conversation as resolved.
Show resolved Hide resolved

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 {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
type string;
}
}
}

container MCLAG_UNIQUE_IP {

list MCLAG_UNIQUE_IP_LIST {
key "if_name";

must "count(../../MCLAG_DOMAIN/MCLAG_DOMAIN_LIST/domain_id) != 0" {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
error-message "mclag not configured";
error-app-tag mclag-invalid;
}

must
"count(/svlan:sonic-vlan/svlan:VLAN_INTERFACE/svlan:VLAN_INTERFACE_IPPREFIX_LIST[svlan:name=current()/if_name]) = 0" {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
error-message "remove configured ip/v6 address and reconfigure after separate 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;
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
}

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

gitsabari marked this conversation as resolved.
Show resolved Hide resolved
config false;
description "state db mclag domain table";

list MCLAG_TABLE_LIST {
key "domain_id";

leaf domain_id {
type uint16;
}

leaf oper_status {
type stypes: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 stypes:oper-status;
}
}
}
}
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
}
7 changes: 7 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-types.yang
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ module sonic-types {
}
}

typedef oper_status {
gitsabari marked this conversation as resolved.
Show resolved Hide resolved
type enumeration {
enum up;
enum down;
}
}

typedef packet_action{
type enumeration {
enum DROP;
Expand Down