Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
module openconfig-routing-policy {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/routing-policy";
prefix "rpol";
// 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
[email protected]";
description
"This module describes a YANG model for routing policy
configuration. It is a limited subset of all of the policy
configuration parameters available in the variety of vendor
implementations, but supports widely used constructs for managing
how routes are imported, exported, and modified across different
routing protocols. This module is intended to be used in
conjunction with routing protocol configuration models (e.g.,
BGP) defined in other modules.
Route policy expression:
Policies are expressed as a set of top-level policy definitions,
each of which consists of a sequence of policy statements. Policy
statements consist of simple condition-action tuples. Conditions
may include mutiple match or comparison operations, and similarly
actions may be multitude of changes to route attributes or a
final disposition of accepting or rejecting the route.
Route policy evaluation:
Policy definitions are referenced in routing protocol
configurations using import and export configuration statements.
The arguments are members of an ordered list of named policy
definitions which comprise a policy chain, and optionally, an
explicit default policy action (i.e., reject or accept).
Evaluation of each policy definition proceeds by evaluating its
corresponding individual policy statements in order. When a
condition statement in a policy statement is satisfied, the
corresponding action statement is executed. If the action
statement has either accept-route or reject-route actions, policy
evaluation of the current policy definition stops, and no further
policy definitions in the chain are evaluated.
If the condition is not satisfied, then evaluation proceeds to
the next policy statement. If none of the policy statement
conditions are satisfied, then evaluation of the current policy
definition stops, and the next policy definition in the chain is
evaluated. When the end of the policy chain is reached, the
default route disposition action is performed (i.e., reject-route
unless an an alternate default action is specified for the
chain).
Policy 'subroutines' (or nested policies) are supported by
allowing policy statement conditions to reference another policy
definition which applies conditions and actions from the
referenced policy before returning to the calling policy
statement and resuming evaluation. If the called policy
results in an accept-route (either explicit or by default), then
the subroutine returns an effective true value to the calling
policy. Similarly, a reject-route action returns false. If the
subroutine returns true, the calling policy continues to evaluate
the remaining conditions (using a modified route if the
subroutine performed any changes to the route).";
oc-ext:openconfig-version "1.1.0";
revision "2015-10-09" {
description
"Initial OpenConfig public release";
reference "1.1.0";
}
revision "2015-05-15" {
description
"Initial revision";
reference "Pre-release";
}
// typedef statements
typedef default-policy-type {
type enumeration {
enum ACCEPT-ROUTE {
description "default policy to accept the route";
}
enum REJECT-ROUTE {
description "default policy to reject the route";
}
}
description "type used to specify default route disposition in
a policy chain";
}
// grouping statements
grouping prefix-set {
description
"Data definition for a list of IPv4 or IPv6 prefixes which
are matched as part of a policy";
list prefix-set {
key prefix-set-name;
description
"List of the defined prefix sets";
leaf prefix-set-name {
type string;
description
"name / label of the prefix set -- this is used to
reference the set in match conditions";
}
list prefix {
key "ip-prefix masklength-range";
description
"List of prefix expressions that are part of the set";
leaf ip-prefix {
type inet:ip-prefix;
mandatory true;
description
"The prefix member in CIDR notation -- while the
prefix may be either IPv4 or IPv6, most
implementations require all members of the prefix set
to be the same address family. Mixing address types in
the same prefix set is likely to cause an error.";
}
leaf masklength-range {
type string {
pattern '([0-9]+\.\.[0-9]+)|exact';
}
description
"Defines a range for the masklength, or 'exact' if
the prefix has an exact length.
Example: 10.3.192.0/21 through 10.3.192.0/24 would be
expressed as prefix: 10.3.192.0/21,
masklength-range: 21..24.
Example: 10.3.192.0/21 would be expressed as
prefix: 10.3.192.0/21,
masklength-range: exact";
}
}
}
}
grouping neighbor-set {
description
"Data definition for a list of IPv4 or IPv6 neighbors which can
be matched in a routing policy";
list neighbor-set {
key neighbor-set-name;
description
"Definitions for neighbor sets";
leaf neighbor-set-name {
type string;
description
"name / label of the neighbor set -- this is used to
reference the set in match conditions";
}
list neighbor {
key "address";
description
"list of addresses that are part of the neighbor set";
leaf address {
type inet:ip-address;
description
"IP address of the neighbor set member";
}
}
}
}
grouping tag-set {
description
"Data definitions for a list of tags which can be matched
in policies";
list tag-set {
key tag-set-name;
description
"Definitions for tag sets";
leaf tag-set-name {
type string;
description
"name / label of the tag set -- this is used to reference
the set in match conditions";
}
list tag {
key "value";
description
"list of tags that are part of the tag set";
leaf value {
type pt:tag-type;
description
"Value of the tag set member";
}
}
}
}
grouping generic-defined-sets {
description
"Data definitions for pre-defined sets of attributes used in
policy match conditions. These sets are generic and can
be used in matching conditions in different routing
protocols.";
container prefix-sets {
description
"Enclosing container for defined prefix sets for matching";
uses prefix-set;
}
container neighbor-sets {
description
"Enclosing container for defined neighbor sets for matching";
uses neighbor-set;
}
container tag-sets {
description
"Enclosing container for defined tag sets for matching";
uses tag-set;
}
}
grouping local-generic-conditions {
description
"Condition statement definitions for consideration of a local
characteristic of a route";
leaf install-protocol-eq {
type identityref {
base pt:install-protocol-type;
}
description
"Condition to check the protocol / method used to install
which installed the route into the local routing table";
}
}
grouping match-set-options-group {
description
"Grouping containing options relating to how a particular set
should be matched";
leaf match-set-options {
type pt:match-set-options-type;
description
"Optional parameter that governs the behaviour of the
match operation";
}
}
grouping match-set-options-restricted-group {
description
"Grouping for a restricted set of match operation modifiers";
leaf match-set-options {
type pt:match-set-options-restricted-type;
description
"Optional parameter that governs the behaviour of the
match operation. This leaf only supports matching on ANY
member of the set or inverting the match. Matching on ALL is
not supported)";
}
}
grouping generic-conditions {
description "Condition statement definitions for checking
membership in a generic defined set";
container match-prefix-set {
presence
"The presence of this container indicates that the routes
should match the prefix-set referenced.";
description
"Match a referenced prefix-set according to the logic
defined in the match-set-options leaf";
leaf prefix-set {
type leafref {
path "/routing-policy/defined-sets/prefix-sets/" +
"prefix-set/prefix-set-name";
//TODO: require-instance should be added when it's
//supported in YANG 1.1
//require-instance true;
}
description "References a defined prefix set";
}
uses match-set-options-restricted-group;
}
container match-neighbor-set {
presence
"The presence of this container indicates that the routes
should match the neighbour set referenced";
description
"Match a referenced neighbor set according to the logic
defined in the match-set-options-leaf";
leaf neighbor-set {
type leafref {
path "/routing-policy/defined-sets/neighbor-sets/" +
"neighbor-set/neighbor-set-name";
//TODO: require-instance should be added when it's
//supported in YANG 1.1
//require-instance true;
}
description "References a defined neighbor set";
}
uses match-set-options-restricted-group;
}
container match-tag-set {
presence
"The presence of this container indicates that the routes
should match the tag-set referenced";
description
"Match a referenced tag set according to the logic defined
in the match-options-set leaf";
leaf tag-set {
type leafref {
path "/routing-policy/defined-sets/tag-sets/tag-set" +
"/tag-set-name";
//TODO: require-instance should be added when it's
//supported in YANG 1.1
//require-instance true;
}
description "References a defined tag set";
}
uses match-set-options-restricted-group;
}
uses local-generic-conditions;
}
grouping igp-generic-conditions {
description "grouping for IGP policy conditions";
}
grouping igp-conditions {
description "grouping for IGP-specific policy conditions";
container igp-conditions {
description "Policy conditions for IGP attributes";
uses igp-generic-conditions;
}
}
grouping generic-actions {
description
"Definitions for common set of policy action statements that
manage the disposition or control flow of the policy";
choice route-disposition {
description
"Select the final disposition for the route, either
accept or reject.";
leaf accept-route {
type empty;
description "accepts the route into the routing table";
}
leaf reject-route {
type empty;
description "rejects the route";
}
}
}
grouping igp-actions {
description "grouping for IGP-specific policy actions";
container igp-actions {
description "Actions to set IGP route attributes; these actions
apply to multiple IGPs";
leaf set-tag {
type pt:tag-type;
description
"Set the tag value for OSPF or IS-IS routes.";
}
}
}
grouping routing-policy-top {
description
"Top level container for OpenConfig routing policy";
container routing-policy {
description
"top-level container for all routing policy configuration";
container defined-sets {
description
"Predefined sets of attributes used in policy match
statements";
uses generic-defined-sets;
// uses bgp-defined-sets;
// don't see a need for IGP-specific defined sets at this
// point e.g., for OSPF, IS-IS, etc.
}
container policy-definitions {
description
"Enclosing container for the list of top-level policy
definitions";
list policy-definition {
key name;
description
"List of top-level policy definitions, keyed by unique
name. These policy definitions are expected to be
referenced (by name) in policy chains specified in import
or export configuration statements.";
leaf name {
type string;
description
"Name of the top-level policy definition -- this name
is used in references to the current policy";
}
container statements {
description
"Enclosing container for policy statements";
list statement {
key name;
// TODO: names of policy statements within a policy
// definition should be optional, however, YANG
// requires a unique id for lists; not sure that a
// compound key works either -- need to investigate
// further.
ordered-by user;
description
"Policy statements group conditions and actions
within a policy definition. They are evaluated in
the order specified (see the description of policy
evaluation at the top of this module.";
leaf name {
type string;
description "name of the policy statement";
}
container conditions {
description "Condition statements for this
policy statement";
leaf call-policy {
type leafref {
path "/rpol:routing-policy/" +
"rpol:policy-definitions/" +
"rpol:policy-definition/rpol:name";
//TODO: require-instance should be added when
//it is supported in YANG 1.1
//require-instance true;
}
description
"Applies the statements from the specified policy
definition and then returns control the current
policy statement. Note that the called policy may
itself call other policies (subject to
implementation limitations). This is intended to
provide a policy 'subroutine' capability. The
called policy should contain an explicit or a
default route disposition that returns an
effective true (accept-route) or false
(reject-route), otherwise the behavior may be
ambiguous and implementation dependent";
}
uses generic-conditions;
uses igp-conditions;
}
container actions {
description "Action statements for this policy
statement";
uses generic-actions;
uses igp-actions;
}
}
}
}
}
}
}
grouping apply-policy-config {
description
"Configuration data for routing policies";
leaf-list import-policy {
type leafref {
path "/rpol:routing-policy/rpol:policy-definitions/" +
"rpol:policy-definition/rpol:name";
//TODO: require-instance should be added when it's
//supported in YANG 1.1
//require-instance true;
}
ordered-by user;
description
"list of policy names in sequence to be applied on
receiving a routing update in the current context, e.g.,
for the current peer group, neighbor, address family,
etc.";
}
leaf default-import-policy {
type default-policy-type;
default REJECT-ROUTE;
description
"explicitly set a default policy if no policy definition
in the import policy chain is satisfied.";
}
leaf-list export-policy {
type leafref {
path "/rpol:routing-policy/rpol:policy-definitions/" +
"rpol:policy-definition/rpol:name";
//TODO: require-instance should be added when it's
//supported in YANG 1.1
//require-instance true;
}
ordered-by user;
description
"list of policy names in sequence to be applied on
sending a routing update in the current context, e.g.,
for the current peer group, neighbor, address family,
etc.";
}
leaf default-export-policy {
type default-policy-type;
default REJECT-ROUTE;
description
"explicitly set a default policy if no policy definition
in the export policy chain is satisfied.";
}
}
grouping apply-policy-state {
description
"Operational state associated with routing policy";
//TODO: identify additional state data beyond the intended
//policy configuration.
}
grouping apply-policy-group {
description
"Top level container for routing policy applications. This
grouping is intended to be used in routing models where
needed.";
container apply-policy {
description
"Anchor point for routing policies in the model.
Import and export policies are with respect to the local
routing table, i.e., export (send) and import (receive),
depending on the context.";
container config {
description
"Policy configuration data.";
uses apply-policy-config;
}
container state {
config false;
description
"Operational state for routing policy";
uses apply-policy-config;
uses apply-policy-state;
}
}
}
uses routing-policy-top;
}