Skip to content

Commit

Permalink
lib: FRR next-hop yang data model.
Browse files Browse the repository at this point in the history
A common nexthop and group nexthop yang data model
for all protocols in FRR.

Co-authored-by: Santosh P K <sapk@vmware.com>
Co-authored-by: Vishaldhingra <vdhingra@vmware.com>
Signed-off-by: Santosh P K <sapk@vmware.com>
  • Loading branch information
Santosh P K and vishaldhingra committed Jan 20, 2020
1 parent d6b14fb commit 1823996
Showing 1 changed file with 59 additions and 63 deletions.
122 changes: 59 additions & 63 deletions yang/frr-nexthop.yang
Expand Up @@ -10,10 +10,15 @@ module frr-nexthop {
import ietf-routing-types {
prefix rt-types;
}

import frr-interface {
prefix frr-interface;
}

import frr-vrf {
prefix "frr-vrf";
}

organization
"Free Range Routing";
contact
Expand All @@ -31,6 +36,9 @@ module frr-nexthop {
type inet:ip-address;
}

/*
* Nexthop types.
*/
typedef nexthop-type {
type enumeration {
enum "ifindex" {
Expand Down Expand Up @@ -68,6 +76,9 @@ module frr-nexthop {
"Nexthop types.";
}

/*
* Blockhole nexthop type.
*/
typedef blackhole-type {
type enumeration {
enum "unspec" {
Expand Down Expand Up @@ -97,113 +108,98 @@ module frr-nexthop {
}

/*
* Nexthop object
* Common nexthop attributes grouping.
*/

grouping frr-nexthop {
grouping frr-nexthop-attributes {
leaf nh-type {
type nexthop-type;
mandatory true;
description
"The nexthop type.";
}

leaf gateway {
type gateway-address;
description
"The nexthop gateway address.";
}

leaf vrf {
type string {
length "1..36";
}
type frr-vrf:vrf-ref;
description
"The nexthop vrf name, if different from the route.";
}

leaf gateway {
type frr-nexthop:gateway-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 flags {
type uint32;
description
"The nexthop's raw flags value.";
}

leaf is-duplicate {
type empty;
description
"Duplicate nexthop; will be ignored.";
}

leaf is-recursive {
type empty;
description
"Nexthop must be resolved through another gateway.";
}

leaf is-onlink {
type empty;
leaf onlink {
when "../nh-type = 'ip4-ifindex' or
../nh-type = 'ip6-ifindex'";
type boolean;
default false;
description
"Nexthop is directly connected.";
}

leaf is-active {
type empty;
description
"Nexthop is active.";
}

uses rt-types:mpls-label-stack {
description
"Nexthop's MPLS label stack.";
}
}

leaf mtu {
type uint32;
/*
* Single nexthop grouping.
*/
grouping frr-nexthop {
container frr-nexthops {
description
"The nexthop's specific MTU.";
"FRR nexthop object.";
list nexthops {
key "nh-type gateway interface";
description
"A list of nexthop objects.";

uses frr-nexthop-attributes;
}
}
}

// End of nexthop

/*
* Nexthop-group container
* Container for FRR nexthop group.
*/

grouping frr-nexthop-group {
container frr-nexthop-group {
description
"A nexthop-group, represented as a list of nexthop objects.";
leaf name {
type string;
description
"The nexthop-group name.";
}

list entry {
key "id";
list nexthop-group {
key "name";
description
"A list of nexthop objects.";
leaf id {
type uint32;
"A group of nexthops.";

leaf name {
type string;
description
"Identifies a nexthop within a nexthop group; the entries
are ordered by id value, and the value has no other meaning.";
"The nexthop-group name.";
}

uses frr-nexthop;
}
}

// End of frr-nexthop-group
/*
* Agument weight attributes to nexthop group.
*/
augment "/frr-nexthop-group/nexthop-group/frr-nexthops/nexthops" {
leaf weight {
type uint8;
description
"Weight to be used by the nexthop for purposes of ECMP";
}
}
}

0 comments on commit 1823996

Please sign in to comment.