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 Dec 20, 2019
1 parent 7d75ef8 commit 1f7894b
Showing 1 changed file with 81 additions and 43 deletions.
124 changes: 81 additions & 43 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 Down Expand Up @@ -100,110 +105,143 @@ module frr-nexthop {
* Nexthop object
*/

grouping frr-nexthop {
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 gateway-address;
when "../nh-type = 'ip4' or ../nh-type = 'ip6'";
type frr-nexthop:gateway-address;
description
"The nexthop gateway address.";
}

leaf vrf {
type string {
length "1..36";
container gateway-interface {
when "../nh-type = 'ip4-ifindex' or"
+ "../nh-type = 'ip6-ifindex'";
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 onlink {
type boolean;
default false;
description
"Nexthop is directly connected.";
}
description
"The nexthop vrf name, if different from the route.";
}

leaf interface {
when "../nh-type = 'ifindex'";
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;
leaf duplicate {
type boolean;
default false;
description
"Duplicate nexthop; will be ignored.";
}

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

leaf is-onlink {
type empty;
description
"Nexthop is directly connected.";
}

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

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

leaf mtu {
type uint32;
description
"The nexthop's specific MTU.";
}
}

// End of nexthop
/*
* Nexthop-group container
*/

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

"FRR nexthop.";
list entry {
key "id";
description
"A list of nexthop objects.";
leaf id {
type uint32;
description
"Identifies a nexthop within a nexthop group; the entries
"Identifies a nexthop within a list of nexthops; the entries
are ordered by id value, and the value has no other meaning.";
}
uses frr-nexthop-attributes;
}
}

uses frr-nexthop;
typedef frr-nexthop-ref {
type leafref {
path "/frr-nexthop:frr-nexthop/frr-nexthop:entry/frr-nexthop:id";
}
description
"Reference to a nexthop.";
}

// End of frr-nexthop-group
container frr-nexthop-group {
description
"A nexthop-group, represented as a list of nexthop objects.";

list group-entry {
key "group-id";
description
"A group of nexthops.";
leaf group-id {
type uint32;
description
"Identifies a set of nexthops in a group."
}
leaf name {
type string;
description
"The nexthop-group name.";
}
list group-nexthop {
key "group-sub-id";
leaf group-sub-id {
type frr-nexthop-ref;
description
"A reference to a frr-nexthop.";
}
}
}
}
}

0 comments on commit 1f7894b

Please sign in to comment.