blob: 556bbeef8fde0c249b5aff09d0d35f720f85f3f2 [file] [log] [blame]
module openconfig-local-routing {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/local-routing";
prefix "oc-loc-rt";
// import some basic types
import ietf-inet-types { prefix inet; }
import openconfig-policy-types { prefix oc-pt; }
import openconfig-extensions { prefix oc-ext; }
import openconfig-interfaces { prefix oc-if; }
// meta
organization "OpenConfig working group";
contact
"OpenConfig working group
www.openconfig.net";
description
"This module describes configuration and operational state data
for routes that are locally generated, i.e., not created by
dynamic routing protocols. These include static routes, locally
created aggregate routes for reducing the number of constituent
routes that must be advertised, summary routes for IGPs, etc.
This model expresses locally generated routes as generically as
possible, avoiding configuration of protocol-specific attributes
at the time of route creation. This is primarily to avoid
assumptions about how underlying router implementations handle
route attributes in various routing table data structures they
maintain. Hence, the definition of locally generated routes
essentially creates 'bare' routes that do not have any protocol-
specific attributes.
When protocol-specific attributes must be attached to a route
(e.g., communities on a locally defined route meant to be
advertised via BGP), the attributes should be attached via a
protocol-specific policy after importing the route into the
protocol for distribution (again via routing policy).";
oc-ext:openconfig-version "1.0.0";
revision "2016-05-11" {
description
"OpenConfig public release";
reference "1.0.0";
}
// identity statements
identity LOCAL_DEFINED_NEXT_HOP {
description
"A base identity type of local defined next-hops";
}
identity DROP {
base LOCAL_DEFINED_NEXT_HOP;
description
"Discard traffic for the corresponding destination";
}
identity LOCAL_LINK {
base LOCAL_DEFINED_NEXT_HOP;
description
"Treat traffic towards addresses within the specified
next-hop prefix as though they are connected to a local
link. When the LOCAL_LINK next-hop type is specified,
an interface must also be specified such that
the local system can determine which link to trigger
link-layer address discovery against";
}
// typedef statements
typedef local-defined-next-hop {
type identityref {
base LOCAL_DEFINED_NEXT_HOP;
}
description
"Pre-defined next-hop designation for locally generated
routes";
}
// grouping statements
grouping local-generic-settings {
description
"Generic options that can be set on local routes When
they are defined";
leaf set-tag {
type oc-pt:tag-type;
description
"Set a generic tag value on the route. This tag can be
used for filtering routes that are distributed to other
routing protocols.";
}
}
grouping local-static-config {
description
"Configuration data for static routes.";
leaf prefix {
type inet:ip-prefix;
description
"Destination prefix for the static route, either IPv4 or
IPv6.";
}
uses local-generic-settings;
}
grouping local-static-state {
description
"Operational state data for static routes";
}
grouping local-static-nexthop-config {
description
"Configuration parameters related to each next-hop entry
specified for a static route";
leaf index {
type string;
description
"An user-specified identifier utilised to uniquely reference
the next-hop entry in the next-hop list. The value of this
index has no semantic meaning other than for referencing
the entry.";
}
leaf next-hop {
type union {
type inet:ip-address-no-zone;
type local-defined-next-hop;
}
description
"The next-hop that is to be used for the static route
- this may be specified as an IP address, an interface
or a pre-defined next-hop type - for instance, DROP or
LOCAL_LINK. When this leaf is not set, and the interface-ref
value is specified for the next-hop, then the system should
treat the prefix as though it is directly connected to the
interface.";
}
leaf metric {
type uint32;
description
"A metric which is utilised to specify the preference of
the next-hop entry when it is injected into the RIB. The
lower the metric, the more preferable the prefix is. When
this value is not specified the metric is inherited from
the default metric utilised for static routes within the
network instance that the static routes are being
instantiated. When multiple next-hops are specified for a
static route, the metric is utilised to determine which of
the next-hops is to be installed in the RIB. When multiple
next-hops have the same metric (be it specified, or simply
the default) then these next-hops should all be installed
in the RIB";
}
leaf recurse {
type boolean;
default false;
description
"Determines whether the next-hop should be allowed to
be looked up recursively - i.e., via a RIB entry which has
been installed by a routing protocol, or another static route
- rather than needing to be connected directly to an
interface of the local system within the current network
instance. When the interface reference specified within the
next-hop entry is set (i.e., is not null) then forwarding is
restricted to being via the interface specified - and
recursion is hence disabled.";
}
}
grouping local-static-nexthop-state {
description
"Operational state parameters relating to a next-hop entry
for a static route";
}
grouping local-static-top {
description
"Top-level grouping for the list of static route definitions";
container static-routes {
description
"Enclosing container for the list of static routes";
list static {
key prefix;
description
"List of locally configured static routes";
leaf prefix {
type leafref {
path "../config/prefix";
}
description
"Reference to the destination prefix list key.";
}
container config {
description
"Configuration data for static routes";
uses local-static-config;
}
container state {
config false;
description
"Operational state data for static routes";
uses local-static-config;
uses local-static-state;
}
container next-hops {
description
"Configuration and state parameters relating to the
next-hops that are to be utilised for the static
route being specified";
list next-hop {
key index;
description
"A list of next-hops to be utilised for the static
route being specified.";
leaf index {
type leafref {
path "../config/index";
}
description
"A reference to the index of the current next-hop.
The index is intended to be a user-specified value
which can be used to reference the next-hop in
question, without any other semantics being
assigned to it.";
}
container config {
description
"Configuration parameters relating to the next-hop
entry";
uses local-static-nexthop-config;
}
container state {
config false;
description
"Operational state parameters relating to the
next-hop entry";
uses local-static-nexthop-config;
uses local-static-nexthop-state;
}
uses oc-if:interface-ref;
}
}
}
}
}
grouping local-aggregate-config {
description
"Configuration data for aggregate routes";
leaf prefix {
type inet:ip-prefix;
description
"Aggregate prefix to be advertised";
}
leaf discard {
type boolean;
default false;
description
"When true, install the aggregate route with a discard
next-hop -- traffic destined to the aggregate will be
discarded with no ICMP message generated. When false,
traffic destined to an aggregate address when no
constituent routes are present will generate an ICMP
unreachable message.";
}
uses local-generic-settings;
}
grouping local-aggregate-state {
description
"Operational state data for local aggregate advertisement
definitions";
}
grouping local-aggregate-top {
description
"Top-level grouping for local aggregates";
container local-aggregates {
description
"Enclosing container for locally-defined aggregate
routes";
list aggregate {
key prefix;
description
"List of aggregates";
leaf prefix {
type leafref {
path "../config/prefix";
}
description
"Reference to the configured prefix for this aggregate";
}
container config {
description
"Configuration data for aggregate advertisements";
uses local-aggregate-config;
}
container state {
config false;
description
"Operational state data for aggregate
advertisements";
uses local-aggregate-config;
uses local-aggregate-state;
}
}
}
}
grouping local-routes-config {
description
"Configuration data for locally defined routes";
}
grouping local-routes-state {
description
"Operational state data for locally defined routes";
}
grouping local-routes-top {
description
"Top-level grouping for local routes";
container local-routes {
description
"Top-level container for local routes";
container config {
description
"Configuration data for locally defined routes";
uses local-routes-config;
}
container state {
config false;
description
"Operational state data for locally defined routes";
uses local-routes-config;
uses local-routes-state;
}
uses local-static-top;
uses local-aggregate-top;
}
}
uses local-routes-top;
}