Skip to content
Open
Changes from all commits
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
283 changes: 283 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-vrrp.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,283 @@
module sonic-vrrp {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please add unit test and update doc/Configuration.md?

namespace "http://github.com/Azure/sonic-vrrp";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Azure

Azure -> sonic-net

prefix svrrp;
yang-version 1.1;

import ietf-inet-types {
prefix "inet";
}

import sonic-interface {
prefix sint;
}

import sonic-port {
prefix sprt;
}

import sonic-portchannel {
prefix spc;
}

import sonic-vlan-sub-interface {
prefix svlansubint;
}

import sonic-vlan {
prefix svlan;
}

organization
"SONiC";

contact
"SONiC";

description
"SONIC VRRP";

revision 2024-11-01 {
description
"Initial revision.";
}

container sonic-vrrp {

container VRRP {
description
"Configures VRRP version 2 or 3 for IPv4.";

list VRRP_LIST {
max-elements 128;
key "ifname idkey";

leaf ifname {
type union {
type leafref {
path "/sint:sonic-interface/sint:INTERFACE/sint:INTERFACE_LIST/sint:name";
}
type leafref {
path "/spc:sonic-portchannel-interface/spc:PORTCHANNEL_INTERFACE/spc:PORTCHANNEL_INTERFACE_LIST/spc:name";
}
type leafref {
path "/svlan:sonic-vlan/svlan:VLAN_INTERFACE/svlan:VLAN_INTERFACE_LIST/svlan:name";
}
type leafref {
path "/svlansubint:sonic-vlan-sub-interface/svlansubint:VLAN_SUB_INTERFACE/svlansubint:VLAN_SUB_INTERFACE_LIST/svlansubint:name";
}
}
}

leaf idkey {
type uint8 {
range "1..255";
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

should we add description for these leaf entries?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The terms used are simple and look to be self explanatory, hence did not add any description.

}
}

leaf vrid {
type uint8 {
range "1..255";
}
}

leaf version {
type string {
pattern '2|3';
}
}

leaf pre_empt {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a specific reason to name like pre_empt instead of preempt?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Just for better readability.

type string {
pattern 'True|False';
}
}

leaf use_v2_checksum {
type string {
pattern 'True|False';
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

use_v2_checksum is defined in yang model but not supported on cli or in frrcfgd.py. Should this be retained?


leaf priority {
type uint8 {
range "1..254";
}
default 100;
}

leaf adv_interval {
type uint8 {
range "1..254";
}
default 1;
}

leaf-list vip {
max-elements 4;
type inet:ipv4-address;
}
}
}

container VRRP_TRACK {
description
"Configures VRRP track list.";

list VRRP_TRACK_LIST {

key "baseifname idkey trackifname";

leaf baseifname {
type leafref {
path "../../../VRRP/VRRP_LIST/ifname";
}
}

leaf idkey {
type leafref {
path "../../../VRRP/VRRP_LIST/idkey";
}
}

leaf trackifname {
type union {
type leafref {
path "/sprt:sonic-port/sprt:PORT/sprt:PORT_LIST/sprt:name";
}
type leafref {
path "/spc:sonic-portchannel/spc:PORTCHANNEL/spc:PORTCHANNEL_LIST/spc:name";
}
type leafref {
path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

}
type leafref {
path "/svlansubint:sonic-vlan-sub-interface/svlansubint:VLAN_SUB_INTERFACE/svlansubint:VLAN_SUB_INTERFACE_LIST/svlansubint:name";
}
}
}

leaf priority_increment {
type uint8 {
range "1..255";
}
}
}
}

container VRRP6 {
description
"Configures VRRP for IPv6.";

list VRRP6_LIST {
max-elements 128;
key "ifname idkey";

leaf ifname {
type union {
type leafref {
path "/sint:sonic-interface/sint:INTERFACE/sint:INTERFACE_LIST/sint:name";
}
type leafref {
path "/spc:sonic-portchannel-interface/spc:PORTCHANNEL_INTERFACE/spc:PORTCHANNEL_INTERFACE_LIST/spc:name";
}
type leafref {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same back link issue

path "/svlan:sonic-vlan/svlan:VLAN_INTERFACE/svlan:VLAN_INTERFACE_LIST/svlan:name";
}
type leafref {
path "/svlansubint:sonic-vlan-sub-interface/svlansubint:VLAN_SUB_INTERFACE/svlansubint:VLAN_SUB_INTERFACE_LIST/svlansubint:name";
}
}
}

leaf idkey {
type uint8 {
range "1..255";
}
}

leaf vrid {
type uint8 {
range "1..255";
}
}

leaf pre_empt {
type string {
pattern 'True|False';
}
}

leaf use_v2_checksum {
type string {
pattern 'True|False';
}
}

leaf priority {
type uint8 {
range "1..254";
}
default 100;
}

leaf adv_interval {
type uint8 {
range "1..254";
}
default 1;
}

leaf-list vip {
max-elements 4;
type inet:ipv6-address;
}
}
}

container VRRP6_TRACK {
description
"Configures VRRP6 track list.";

list VRRP6_TRACK_LIST {

key "baseifname idkey trackifname";

leaf baseifname {
type leafref {
path "../../../VRRP6/VRRP6_LIST/ifname";
}
}

leaf idkey {
type leafref {
path "../../../VRRP6/VRRP6_LIST/idkey";
}
}

leaf trackifname {
type union {
type leafref {
path "/sprt:sonic-port/sprt:PORT/sprt:PORT_LIST/sprt:name";
}
type leafref {
path "/spc:sonic-portchannel/spc:PORTCHANNEL/spc:PORTCHANNEL_LIST/spc:name";
}
type leafref {
path "/svlan:sonic-vlan/svlan:VLAN/svlan:VLAN_LIST/svlan:name";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same back link issue

}
type leafref {
path "/svlansubint:sonic-vlan-sub-interface/svlansubint:VLAN_SUB_INTERFACE/svlansubint:VLAN_SUB_INTERFACE_LIST/svlansubint:name";
}
}
}

leaf priority_increment {
type uint8 {
range "1..255";
}
}
}
}

}

Loading