module openconfig-local-routing { yang-version "1"; // namespace namespace "http://openconfig.net/yang/local-routing"; prefix "loc-rt"; // import some basic types import ietf-inet-types { prefix inet; } import openconfig-policy-types { prefix pt; } import openconfig-extensions { prefix oc-ext; } // 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 "0.1.3"; revision "2015-10-09" { description "Initial OpenConfig public release"; reference "0.1.3"; } revision "2015-05-01" { description "Initial revision"; reference "Pre-release"; } // extension statements // feature statements // identity statements // typedef statements typedef local-defined-next-hop { type enumeration { enum DROP { description "Discard or black-hole traffic for the corresponding destination"; } } 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 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."; } leaf-list next-hop { type union { type inet:ip-address; type local-defined-next-hop; type string; //TODO: this should be a leafref pointing to a configured //interface, but YANG 1.0 does not support leafrefs in a //union type. It should be updated when YANG 1.1 is //released. } description "Specify a set of next hops. Each entry may be an IP address, interface, or a single pre-defined next-hop can be used, e.g., drop"; } uses local-generic-settings; } grouping local-static-state { description "Operational state data for static routes"; } 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 for the static route"; } 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; } } } } 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; }