mirror_frr/yang/frr-nexthop.yang
Chirag Shah d9d6232fb6 yang: add weight in nexthop operational model
add weight field to operational model.
add leafref to nexthopgroup.
format according to yanglint.

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
2020-04-16 08:51:41 -07:00

261 lines
5.0 KiB
YANG

module frr-nexthop {
yang-version 1.1;
namespace "http://frrouting.org/yang/nexthop";
prefix frr-nexthop;
import ietf-inet-types {
prefix inet;
}
import ietf-routing-types {
prefix rt-types;
}
import frr-interface {
prefix frr-interface;
}
import frr-vrf {
prefix frr-vrf;
}
organization
"FRRouting";
contact
"FRR Users List: <mailto:frog@lists.frrouting.org>
FRR Development List: <mailto:dev@lists.frrouting.org>";
description
"This module defines a model for managing FRR nexthop information.";
revision 2019-08-15 {
description
"Initial revision.";
}
typedef optional-ip-address {
type union {
type inet:ip-address;
type string {
pattern '';
}
}
}
/*
* Nexthop types.
*/
typedef nexthop-type {
type enumeration {
enum "ifindex" {
value 1;
description
"Specific interface.";
}
enum "ip4" {
value 2;
description
"IPv4 address.";
}
enum "ip4-ifindex" {
value 3;
description
"IPv4 address and interface.";
}
enum "ip6" {
value 4;
description
"IPv6 address.";
}
enum "ip6-ifindex" {
value 5;
description
"IPv6 address and interface.";
}
enum "blackhole" {
value 6;
description
"Unreachable or prohibited.";
}
}
description
"Nexthop types.";
}
/*
* Blockhole nexthop type.
*/
typedef blackhole-type {
type enumeration {
enum "unspec" {
value 0;
description
"Generic unreachable.";
}
enum "null" {
value 1;
description
"Null type.";
}
enum "reject" {
value 2;
description
"ICMP unreachable.";
}
enum "prohibited" {
value 3;
description
"ICMP admin-prohibited.";
}
}
default "null";
description
"Nexthop blackhole types.";
}
/*
* Common nexthop attributes grouping.
*/
grouping frr-nexthop-attributes {
leaf nh-type {
type nexthop-type;
mandatory true;
description
"The nexthop type.";
}
leaf vrf {
type frr-vrf:vrf-ref;
description
"The nexthop vrf name, if different from the route.";
}
leaf gateway {
type frr-nexthop:optional-ip-address;
description
"The nexthop gateway address.";
}
leaf interface {
type frr-interface:interface-ref;
description
"The nexthop egress interface.";
}
leaf bh-type {
when "../nh-type = 'blackhole'";
type blackhole-type;
description
"A blackhole sub-type, if the nexthop is a blackhole type.";
}
leaf onlink {
when "../nh-type = 'ip4-ifindex' or
../nh-type = 'ip6-ifindex'";
type boolean;
default "false";
description
"Nexthop is directly connected.";
}
uses rt-types:mpls-label-stack {
description
"Nexthop's MPLS label stack.";
}
}
/*
* operational common attributes for nexthop
*/
grouping frr-nexthop-operational {
leaf duplicate {
type empty;
config false;
description
"Duplicate nexthop";
}
leaf recursive {
type empty;
config false;
description
"Nexthop resolved through another gateway.";
}
leaf active {
type empty;
config false;
description
"Nexthop is active.";
}
leaf fib {
type empty;
config false;
description
"Nexthop is installed in fib.";
}
leaf weight {
type uint8;
config false;
description
"Weight to be used by the nexthop for purposes of ECMP";
}
}
/*
* Single nexthop grouping.
*/
grouping frr-nexthop {
container frr-nexthops {
description
"FRR nexthop object.";
list nexthop {
key "nh-type gateway interface";
description
"A list of nexthop objects.";
uses frr-nexthop-attributes;
}
}
}
/*
* Container for FRR nexthop group.
*/
grouping frr-nexthop-grouping {
list nexthop-group {
key "name";
description
"A group of nexthops.";
leaf name {
type string;
description
"The nexthop-group name.";
}
uses frr-nexthop;
}
}
container frr-nexthop-group {
description
"A nexthop-group, represented as a list of nexthop objects.";
uses frr-nexthop-grouping;
}
typedef nexthop-group-ref {
type leafref {
require-instance false;
path "/frr-nexthop:frr-nexthop-group/frr-nexthop:nexthop-group/frr-nexthop:name";
}
}
/*
* Augment weight attributes to nexthop group.
*/
augment "/frr-nexthop-group/nexthop-group/frr-nexthops/nexthop" {
leaf weight {
type uint8;
description
"Weight to be used by the nexthop for purposes of ECMP";
}
}
}