draft-ietf-idr-bgp-model-01.txt   draft-ietf-idr-bgp-model-02.txt 
Interdomain Routing A. Shaikh, Ed. Interdomain Routing A. Shaikh, Ed.
Internet-Draft Google Internet-Draft Google
Intended status: Standards Track R. Shakir, Ed. Intended status: Standards Track R. Shakir, Ed.
Expires: July 10, 2016 Jive Communications Expires: January 19, 2017 Jive Communications
K. Patel, Ed. K. Patel, Ed.
Cisco Cisco
S. Hares, Ed. S. Hares, Ed.
Huawei Huawei
K. D'Souza K. D'Souza
AT&T AT&T
D. Bansal D. Bansal
Microsoft Microsoft
A. Clemm A. Clemm
A. Zhdankin A. Zhdankin
Cisco Cisco
M. Jethanandani M. Jethanandani
Ciena Cisco Systems, Inc
X. Liu X. Liu
Ericsson Ericsson
January 7, 2016 July 18, 2016
BGP Model for Service Provider Networks BGP Model for Service Provider Networks
draft-ietf-idr-bgp-model-01 draft-ietf-idr-bgp-model-02
Abstract Abstract
This document defines a YANG data model for configuring and managing This document defines a YANG data model for configuring and managing
BGP, including protocol, policy, and operational aspects based on BGP, including protocol, policy, and operational aspects based on
data center, carrier and content provider operational requirements. data center, carrier and content provider operational requirements.
Status of This Memo Status of This Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
skipping to change at page 1, line 48 skipping to change at page 1, line 48
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on July 10, 2016. This Internet-Draft will expire on January 19, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the Copyright (c) 2016 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 27 skipping to change at page 2, line 27
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Goals and approach . . . . . . . . . . . . . . . . . . . 3 1.1. Goals and approach . . . . . . . . . . . . . . . . . . . 3
2. Model overview . . . . . . . . . . . . . . . . . . . . . . . 4 2. Model overview . . . . . . . . . . . . . . . . . . . . . . . 4
2.1. BGP protocol configuration . . . . . . . . . . . . . . . 5 2.1. BGP protocol configuration . . . . . . . . . . . . . . . 5
2.2. Policy configuration overview . . . . . . . . . . . . . . 6 2.2. Policy configuration overview . . . . . . . . . . . . . . 6
2.3. Operational data overview . . . . . . . . . . . . . . . . 7 2.3. Operational state overview . . . . . . . . . . . . . . . 7
3. Relation to other YANG data models . . . . . . . . . . . . . 8 3. Relation to other YANG data models . . . . . . . . . . . . . 8
4. Security Considerations . . . . . . . . . . . . . . . . . . . 8 4. Security Considerations . . . . . . . . . . . . . . . . . . . 8
5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8
6. YANG modules . . . . . . . . . . . . . . . . . . . . . . . . 9 6. YANG modules . . . . . . . . . . . . . . . . . . . . . . . . 9
6.1. BGP base items . . . . . . . . . . . . . . . . . . . . . 9 7. BGP main module and submodule for base items . . . . . . . . 9
6.2. BGP base types . . . . . . . . . . . . . . . . . . . . . 28 8. BGP types . . . . . . . . . . . . . . . . . . . . . . . . . . 60
6.3. BGP policy items . . . . . . . . . . . . . . . . . . . . 34 9. BGP policy data . . . . . . . . . . . . . . . . . . . . . . . 69
6.4. BGP multiprotocol items . . . . . . . . . . . . . . . . . 44 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 93
6.5. BGP operational data items . . . . . . . . . . . . . . . 56 10.1. Normative references . . . . . . . . . . . . . . . . . . 93
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 63 10.2. Informative references . . . . . . . . . . . . . . . . . 95
7.1. Normative references . . . . . . . . . . . . . . . . . . 63 Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 95
7.2. Informative references . . . . . . . . . . . . . . . . . 64 Appendix B. Change summary . . . . . . . . . . . . . . . . . . . 96
Appendix A. Acknowledgements . . . . . . . . . . . . . . . . . . 65 B.1. Changes between revisions -01 and -02 . . . . . . . . . . 96
Appendix B. Change summary . . . . . . . . . . . . . . . . . . . 65 B.2. Changes between revisions -00 and -01 . . . . . . . . . . 96
B.1. Changes between revisions -00 and -01 . . . . . . . . . . 65 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 96
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 65
1. Introduction 1. Introduction
YANG [RFC6020] is a data modeling language that was introduced to YANG [RFC6020] is a data modeling language that was introduced to
define the contents of a conceptual data store that allows networked define data for managing networked devices using NETCONF [RFC6241].
devices to be managed using NETCONF [RFC6241]. YANG is proving YANG is proving relevant beyond its initial confines, as bindings to
relevant beyond its initial confines, as bindings to other interfaces other interfaces (e.g. ReST) and encodings other than XML (e.g.
(e.g. ReST) and encodings other than XML (e.g. JSON) are being JSON) are being defined. Furthermore, YANG data models can be used
defined. Furthermore, YANG data models can be used as the basis of as the basis of implementation for a number of interfaces, such as
implementation for a number of interfaces, such as CLIs and CLIs and programmatic APIs (e.g., see
programmatic APIs. [I-D.talwar-rtgwg-grpc-use-cases]).
This document describes a YANG data model for the BGP [RFC4271] This document describes a YANG data model for the BGP [RFC4271]
protocol, including various protocol extensions, policy protocol, including various protocol extensions, policy
configuration, as well as defining key operational state data. The configuration, as well as defining key operational state data. The
model is intended to be vendor-neutral, in order to allow operators model is intended to be vendor-neutral, in order to allow operators
to manage BGP configuration in heterogeneous environments with to manage BGP configuration in heterogeneous environments with
routers supplied by multiple vendors. The model is also intended to routers supplied by multiple vendors. The model is also intended to
be readily mapped to existing implementations to facilitate support be readily mapped to existing implementations to facilitate support
from as large a set of routing hardware and software vendors as from as large a set of routing hardware and software vendors as
possible. possible.
skipping to change at page 3, line 29 skipping to change at page 3, line 29
The model covers the base BGP features that are deployed across major The model covers the base BGP features that are deployed across major
implementations and the common BGP configurations in use across a implementations and the common BGP configurations in use across a
number of operator network deployments. In particular, this model number of operator network deployments. In particular, this model
attempts to cover BGP features defined in [RFC4271], [RFC1997], attempts to cover BGP features defined in [RFC4271], [RFC1997],
[RFC4456], [RFC4760], [RFC3065], [RFC2439], [RFC4724], and [RFC6811]. [RFC4456], [RFC4760], [RFC3065], [RFC2439], [RFC4724], and [RFC6811].
Along with configuration of base BGP features, this model also Along with configuration of base BGP features, this model also
addresses policy configuration, by providing "hooks" for applying addresses policy configuration, by providing "hooks" for applying
policies, and also defining BGP-specific policy features. The BGP policies, and also defining BGP-specific policy features. The BGP
policy features are intended to be used with the general routing policy features are intended to be used with the general routing
policy model defined in [I-D.shaikh-rtgwg-policy-model]. The model policy model defined in [I-D.ietf-rtgwg-policy-model]. The model
also supports operational state data to enable a common model for also supports operational state data to provide a common model for
reading BGP-related state from a BGP speaker. reading BGP-related state from a BGP speaker.
For the base BGP features, the focus of the model described in this For the base BGP features, the focus of the model described in this
document is on providing configuration and operational state document is on providing configuration and operational state
information relating to: information relating to:
o The global BGP instance, and neighbors whose configuration is o The global BGP instance, and neighbors whose configuration is
specified individually, or templated with the use of peer-groups. specified individually, or templated with the use of peer-groups.
o The address families that are supported by peers, and the global o The address families that are supported by peers, and the global
skipping to change at page 4, line 4 skipping to change at page 4, line 4
o The policy configuration "hooks" and BGP-specific policy features o The policy configuration "hooks" and BGP-specific policy features
that relate to a neighbor - controlling the import and export of that relate to a neighbor - controlling the import and export of
NLRIs. NLRIs.
As mentioned earlier, any configuration items that are deemed to be As mentioned earlier, any configuration items that are deemed to be
widely available in existing major BGP implementations are included widely available in existing major BGP implementations are included
in the model. Additional, more esoteric, configuration items that in the model. Additional, more esoteric, configuration items that
are not commonly used, or only available from a single are not commonly used, or only available from a single
implementation, are omitted from the model with an expectation that implementation, are omitted from the model with an expectation that
they will be available in companion modules that augment the current they will be available in companion modules that augment or extend
model. This allows clarity in identifying data that is part of the the current model. This allows clarity in identifying data that is
vendor-neutral base model. part of the vendor-neutral base model.
Where possible, naming in the model follows conventions used in Where possible, naming in the model follows conventions used in
available standards documents, and otherwise tries to be self- available standards documents, and otherwise tries to be self-
explanatory with sufficient descriptions of the intended behavior. explanatory with sufficient descriptions of the intended behavior.
Similarly, configuration data value constraints and default values, Similarly, configuration data value constraints and default values,
where used, are based on recommendations in current standards where used, are based on recommendations in current standards
documentation. Since implementations vary widely in this respect, documentation, or those commonly used in multiple implementations.
this version of the model specifies only a limited set of defaults Since implementations can vary widely in this respect, this version
and ranges with the expectation of being more prescriptive in future of the model specifies only a limited set of defaults and ranges with
versions based on actual operator use. the expectation of being more prescriptive in future versions based
on actual operator use.
2. Model overview 2. Model overview
The BGP model is defined across several YANG modules but at a high The BGP model is defined across several YANG modules and submodules,
level is organized into Six elements: but at a high level is organized into six elements:
o base protocol configuration -- configuration affecting BGP o base protocol configuration -- configuration affecting BGP
protocol-related operations, defined at various levels of protocol-related operations, defined at various levels of
hierarchy. hierarchy.
o multiprotocol configuration -- configuration affecting individual o multiprotocol configuration -- configuration affecting individual
address-families within BGP [RFC4760]. address-families within BGP [RFC4760].
o neighbor configuration -- configuration affecting an individual o neighbor configuration -- configuration affecting an individual
neighbor within BGP. neighbor within BGP.
o neighbor multiprotocol configuration -- configuration affecting o neighbor multiprotocol configuration -- configuration affecting
individual address-families for a neighbor within BGP. individual address-families for a neighbor within BGP.
o policy configuration -- hooks for application of the policies o policy configuration -- hooks for application of the policies
defined in [I-D.shaikh-rtgwg-policy-model] that act on routes sent defined in [I-D.ietf-rtgwg-policy-model] that act on routes sent
(received) to (from) peers or other routing protocols and BGP- (received) to (from) peers or other routing protocols and BGP-
specific policy features. specific policy features.
o operational state -- variables used for monitoring, management, o operational state -- variables used for monitoring and management
etc. of BGP operations. of BGP operations.
These modules also make use of standard Internet types, such as IP These modules also make use of standard Internet types, such as IP
addresses and prefixes, autonomous system numbers, etc., defined in addresses and prefixes, autonomous system numbers, etc., defined in
RFC 6991 [RFC6991]. RFC 6991 [RFC6991].
Throughout the model, the approach described in Throughout the model, the approach described in
[I-D.openconfig-netmod-opstate] is used to represent configuration [I-D.openconfig-netmod-opstate] is used to represent configuration
(intended state), operational and derived state data. That is to (intended state), operational and derived state data. That is to
say, that each container holds a "config" and "state" sub-container - say, that each container holds a "config" and "state" sub-container -
with the config container being used for configurable parameters, and with the config container being used for configurable parameters, and
the state container container holding representing both the the state container container holding both the operational state of
operational state of configurable leaves, and derived counters and configurable leaves, and derived counters and statistical
statistical information. information.
2.1. BGP protocol configuration 2.1. BGP protocol configuration
The BGP protocol configuration model is organized hierarchically, The BGP protocol configuration model is organized hierarchically,
much like the majority of router implementations. That is, much like the majority of router implementations. That is,
configuration items can be specified at multiple levels, as shown configuration items can be specified at multiple levels, as shown
below. below.
+--rw bgp! +--rw bgp!
+--rw global +--rw global
skipping to change at page 6, line 49 skipping to change at page 6, line 50
+--rw l3vpn-ipv6-multicast +--rw l3vpn-ipv6-multicast
| ... | ...
+--rw l2vpn-vpls +--rw l2vpn-vpls
| ... | ...
+--rw l2vpn-evpn +--rw l2vpn-evpn
| ... | ...
2.2. Policy configuration overview 2.2. Policy configuration overview
The BGP policy configuration model references the generic YANG The BGP policy configuration model references the generic YANG
routing policy model described in [I-D.shaikh-rtgwg-policy-model], routing policy model described in [I-D.ietf-rtgwg-policy-model],
which represents a condition-action policy framework for routing. which represents a condition-action policy framework for routing.
This model adds BGP-specific conditions (e.g., matching on the This model adds BGP-specific conditions (e.g., matching on the
community attribute), and actions (e.g., setting local preference) to community attribute), and actions (e.g., setting local preference) to
the generic policy framework. the generic policy framework.
Policies that are defined in the routing-policy model are referenced Policies that are defined in the routing-policy model are referenced
in multiple places within the model: in multiple places within the model:
o within the global instance, where a policy applies to all address- o within the global instance, where a policy applies to all address-
families for all peers. families for all peers.
skipping to change at page 7, line 17 skipping to change at page 7, line 19
Policies that are defined in the routing-policy model are referenced Policies that are defined in the routing-policy model are referenced
in multiple places within the model: in multiple places within the model:
o within the global instance, where a policy applies to all address- o within the global instance, where a policy applies to all address-
families for all peers. families for all peers.
o on a global AFI-SAFI basis, where policies apply to all peers for o on a global AFI-SAFI basis, where policies apply to all peers for
a particular address-family. a particular address-family.
o on a per-peer-group or per-neighbor basis - where the policy o on a per-peer-group or per-neighbor basis - where the policy
applies to all address-families for the particular parent entity. applies to all address-families for the particular group or
neighbor.
o on a per-afi-safi basis within a neighbor or peer-group context, o on a per-afi-safi basis within a neighbor or peer-group context,
where the policy is specific to the AFI-SAFI for a a specific where the policy is specific to the AFI-SAFI for a a specific
neighbor or group. neighbor or group.
+--rw bgp +--rw bgp
+--rw global +--rw global
| +--rw afi-safi | +--rw afi-safi
| | +--rw afi-safi* [afi-safi-name] | | +--rw afi-safi* [afi-safi-name]
| | +--rw apply-policy | | +--rw apply-policy
skipping to change at page 7, line 42 skipping to change at page 7, line 45
| | +--rw afi-safi* [afi-safi-name] | | +--rw afi-safi* [afi-safi-name]
| | +--rw apply-policy | | +--rw apply-policy
| +--rw apply-policy | +--rw apply-policy
+--rw peer-groups +--rw peer-groups
+--rw peer-group* [peer-group-name] +--rw peer-group* [peer-group-name]
+--rw afi-safi +--rw afi-safi
| +--rw afi-safi* [afi-safi-name] | +--rw afi-safi* [afi-safi-name]
| +--rw apply-policy | +--rw apply-policy
+--rw apply-policy +--rw apply-policy
2.3. Operational data overview 2.3. Operational state overview
The BGP operational model contains a set of parameters which relate The BGP operational model contains data which relates to the
to the operational state of the various elements of the BGP router. operational state of the various elements of the BGP router. As
As noted in Section 2 - the approach described in noted in Section 2 - the approach described in
[I-D.openconfig-netmod-opstate] is utilized for the inclusion of [I-D.openconfig-netmod-opstate] is utilized for the inclusion of
operational and statistical data. To this end, the "_state" operational and statistical data. To this end, the "-state"
groupings (those that contain derived operational parameters) are groupings (those that contain derived operational parameters) are
contained within the BGP operational model - and included within the contained within the BGP operational model - and included within the
relevant "state" containers throughout the core BGP model. In some relevant "state" containers throughout the core BGP model. In some
cases, operational information may be relevant to one instance of a cases, operational information may be relevant to one instance of a
common grouping, but not another - for example, the number of common grouping, but not another - for example, the number of
received, advertised, and installed prefixes is relevant on a per- received, advertised, and installed prefixes is relevant on a per-
neighbor-basis, but is not required (or meaningful) in the peer-group neighbor-basis, but is not required (or meaningful) in the peer-group
context. To enable state to be added to particular contexts, the context. Groupings are defined with the appropriate operational
tree is augmented through the base BGP module to add these variables, state data accordingly.
without requiring separate groupings.
3. Relation to other YANG data models 3. Relation to other YANG data models
The BGP model is intended to work within a larger framework model, The BGP model is intended to work within a larger framework model,
such as the Routing Management model [I-D.ietf-netmod-routing-cfg] or such as the Network Instance model
the Network Device Organizational Model [I-D.openconfig-rtgwg-network-instance] which provides a
[I-D.rtgyangdt-rtgwg-device-model], both of which define the notion comprehensive model for defining VRFs, associated routing protocols,
of routing instances, or VRFs. multiple protocol instances, and inter-protocol and inter-instance
routing policies. The current version of the model imports and
For example, for integration with the Routing Management model, the instantiates the BGP model in its tree at /network-instances/network-
following additions to the BGP model could be made: instance/protocols/protocol/bgp/...
o a new identity type for BGP that is derived from rt:routing-
protocol
o augmentation of the "/rt:routing/rt:routing-instance/rt:routing-
protocols/routing-protocol" container with BGP-specific parameters
o possible addition of BGP-specific route attributes in
"/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" and
"/rt:active-route/rt:output/rt:route"
Future updates of the BGP model and this document will further It is also possible to integrate the BGP model with the Routing
develop the integration with other framework models related to Management model [I-D.ietf-netmod-routing-cfg] or the Network Device
routing protocols. Organizational Model [I-D.rtgyangdt-rtgwg-device-model], both of
which define the notion of routing instances, or VRFs.
4. Security Considerations 4. Security Considerations
BGP configuration has a significant impact on network operations, and BGP configuration has a significant impact on network operations, and
as such any related protocol or model carries potential security as such any related protocol or model carries potential security
risks. risks.
YANG data models are generally designed to be used with the NETCONF YANG data models are generally designed to be used with the NETCONF
protocol over an SSH transport. This provides an authenticated and protocol over an SSH transport. This provides an authenticated and
secure channel over which to transfer BGP configuration and secure channel over which to transfer BGP configuration and
skipping to change at page 9, line 18 skipping to change at page 9, line 8
5. IANA Considerations 5. IANA Considerations
An appropriate namespace URI will be registered in the IETF XML An appropriate namespace URI will be registered in the IETF XML
Registry" [RFC3688]. The BGP YANG modules will be registered in the Registry" [RFC3688]. The BGP YANG modules will be registered in the
"YANG Module Names" registry [RFC6020]. "YANG Module Names" registry [RFC6020].
6. YANG modules 6. YANG modules
The modules comprising the BGP configuration and operational model The modules comprising the BGP configuration and operational model
are described by the YANG modules in the sections below. The base are described by the YANG modules and submodules in the sections
module imports the other modules to create the overall model. below.
6.1. BGP base items The main module, openconfig-bgp.yang, includes the following
submodules:
<CODE BEGINS> file "ietf-bgp.yang" o openconfig-bgp-common - defines the groupings that are common
module ietf-bgp { across more than one context (where contexts are neighbor, group,
yang-version "1"; global)
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp"; o openconfig-bgp-common-multiprotocol - defines the groupings that
prefix "bgp"; are common across more than one context, and relate to
// import some basic inet types multiprotocol BGP
import ietf-inet-types { prefix inet; }
import ietf-bgp-multiprotocol { prefix bgp-mp; } o openconfig-bgp-common-structure - defines groupings that are
shared by multiple contexts, but are used only to create
structural elements, i.e., containers (leaf nodes are defined in
separate groupings)
o openconfig-bgp-global - groupings with data specific to the global
context
o openconfig-bgp-peer-group - groupings with data specific to the
peer group context
o openconfig-bgp-neighbor - groupings with data specific to the
neighbor context
Additional modules include:
o openconfig-bgp-types - common type and identity definitions for
BGP, including BGP policy
o openconfig-bgp-policy - BGP-specific policy data definitions for
use with [I-D.ietf-rtgwg-policy-model] (described in more detail
Section 2.2)
7. BGP main module and submodule for base items
<CODE BEGINS> file "ietf-bgp.yang"
module ietf-bgp {
yang-version "1";
// namespace
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp";
prefix "bgp";
// import some basic inet types
import openconfig-extensions { prefix oc-ext; }
import ietf-routing-policy { prefix rpol; }
// Include the OpenConfig BGP submodules
// Common: defines the groupings that are common across more than
// one context (where contexts are neighbor, group, global)
include ietf-bgp-common;
// Multiprotocol: defines the groupings that are common across more
// than one context, and relate to Multiprotocol
include ietf-bgp-common-multiprotocol;
// Structure: defines groupings that are shared but are solely used for
// structural reasons.
include ietf-bgp-common-structure;
// Include peer-group/neighbor/global - these define the groupings
// that are specific to one context
include ietf-bgp-peer-group;
include ietf-bgp-neighbor;
include ietf-bgp-global;
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This module describes a YANG model for BGP protocol
configuration.It is a limited subset of all of the configuration
parameters available in the variety of vendor implementations,
hence it is expected that it would be augmented with vendor-
specific configuration data as needed. Additional modules or
submodules to handle other aspects of BGP configuration,
including policy, VRFs, VPNs, and additional address families
are also expected.
This model supports the following BGP configuration level
hierarchy:
BGP
|
+-> [ global BGP configuration ]
+-> AFI / SAFI global
+-> peer group
+-> [ peer group config ]
+-> AFI / SAFI [ per-AFI overrides ]
+-> neighbor
+-> [ neighbor config ]
+-> [ optional pointer to peer-group ]
+-> AFI / SAFI [ per-AFI overrides ]";
oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description
"OpenConfig BGP refactor";
reference "2.1.1";
}
revision "2016-06-06" {
description
"OpenConfig public release";
reference "2.1.0";
}
revision "2016-03-31" {
description
"OpenConfig public release";
reference "2.0.1";
}
grouping bgp-top {
description
"Top-level grouping for the BGP model data";
container bgp {
description
"Top-level configuration and state for the BGP router";
container global {
description
"Global configuration for the BGP router";
uses bgp-global-base;
uses rpol:apply-policy-group;
}
container neighbors {
description
"Configuration for BGP neighbors";
uses bgp-neighbor-list;
}
container peer-groups {
description
"Configuration for BGP peer-groups";
uses bgp-peer-group-list;
}
}
}
uses bgp-top;
}
<CODE ENDS>
<CODE BEGINS> file "ietf-bgp-common.yang"
submodule ietf-bgp-common {
belongs-to ietf-bgp {
prefix "bgp";
}
import openconfig-extensions { prefix oc-ext; }
import ietf-bgp-types { prefix oc-bgp-types; }
import ietf-routing-policy { prefix rpol; } import ietf-routing-policy { prefix rpol; }
import ietf-bgp-types { prefix bgp-types; } import ietf-inet-types { prefix inet; }
import ietf-bgp-operational { prefix bgp-op; }
// meta // meta
organization organization
"OpenConfig working group"; "OpenConfig working group";
contact contact
"OpenConfig working group "OpenConfig working group
netopenconfig@googlegroups.com"; netopenconfig@googlegroups.com";
description description
"This module describes a YANG model for BGP protocol "This sub-module contains common groupings that are common across
configuration.It is a limited subset of all of the configuration multiple contexts within the BGP module. That is to say that they
parameters available in the variety of vendor implementations, may be application to a subset of global, peer-group or neighbor
hence it is expected that it would be augmented with vendor- contexts.";
specific configuration data as needed. Additional modules or
submodules to handle other aspects of BGP configuration, oc-ext:openconfig-version "2.1.1";
including policy, VRFs, VPNs, and additional address families
are also expected. revision "2016-06-21" {
This model supports the following BGP configuration level
hierarchy:
BGP
|
+-> [ global BGP configuration ]
+-> AFI / SAFI global
+-> peer group
+-> [ peer group config ]
+-> AFI / SAFI [ per-AFI overrides ]
+-> neighbor
+-> [ neighbor config ]
+-> [ optional pointer to peer-group ]
+-> AFI / SAFI [ per-AFI overrides ]";
revision "2016-01-06" {
description
"Updated filename and namespace";
reference "TBD";
}
grouping bgp-global_config {
description description
"Global configuration options for the BGP router."; "OpenConfig BGP refactor";
leaf as { reference "2.1.1";
type inet:as-number;
mandatory "true";
description
"Local autonomous system number of the router. Uses
the 32-bit as-number type from the model in RFC 6991.";
}
leaf router-id {
type inet:ipv4-address;
description
"Router id of the router, expressed as an
32-bit value, IPv4 address.";
}
} }
grouping bgp-default-route-distance_config {
grouping bgp-common-neighbor-group-timers-config {
description description
"Configuration options relating to the administrative distance "Config parameters related to timers associated with the BGP
(or preference) assigned to routes received from different peer";
sources (external, internal, and local).";
leaf external-route-distance { leaf connect-retry {
type uint8 { type decimal64 {
range "1..255"; fraction-digits 2;
} }
default 30;
description description
"Administrative distance for routes learned from external "Time interval in seconds between attempts to establish a
BGP (eBGP)."; session with the peer.";
} }
leaf internal-route-distance {
type uint8 {
range "1..255";
leaf hold-time {
type decimal64 {
fraction-digits 2;
} }
default 90;
description description
"Administrative distance for routes learned from internal "Time interval in seconds that a BGP session will be
BGP (iBGP)."; considered active in the absence of keepalive or other
} messages from the peer. The hold-time is typically
} set to 3x the keepalive-interval.";
grouping bgp-confederation_config { reference
description "RFC 4271 - A Border Gateway Protocol 4, Sec. 10";
"Configuration options specifying parameters when the local
router is within an autonomous system which is part of a BGP
confederation.";
leaf enabled {
type boolean;
description
"When this leaf is set to true it indicates that
the local-AS is part of a BGP confederation";
} }
leaf identifier {
type inet:as-number; leaf keepalive-interval {
type decimal64 {
fraction-digits 2;
}
default 30;
description description
"Confederation identifier for the autonomous system."; "Time interval in seconds between transmission of keepalive
messages to the neighbor. Typically set to 1/3 the
hold-time.";
} }
leaf-list member-as {
type inet:as-number; leaf minimum-advertisement-interval {
type decimal64 {
fraction-digits 2;
}
default 30;
description description
"Remote autonomous systems that are to be treated "Minimum time which must elapse between subsequent UPDATE
as part of the local confederation."; messages relating to a common set of NLRI being transmitted
to a peer. This timer is referred to as
MinRouteAdvertisementIntervalTimer by RFC 4721 and serves to
reduce the number of UPDATE messages transmitted when a
particular set of NLRI exhibit instability.";
reference
"RFC 4271 - A Border Gateway Protocol 4, Sec 9.2.1.1";
} }
} }
grouping bgp-neighbor_config {
grouping bgp-common-neighbor-group-config {
description description
"Neighbor level configuration items."; "Neighbor level configuration items.";
leaf peer-as { leaf peer-as {
type inet:as-number; type inet:as-number;
description description
"AS number of the peer."; "AS number of the peer.";
} }
leaf local-as { leaf local-as {
type inet:as-number; type inet:as-number;
description description
"The local autonomous system number that is to be used "The local autonomous system number that is to be used
when establishing sessions with the remote peer or peer when establishing sessions with the remote peer or peer
group, if this differs from the global BGP router group, if this differs from the global BGP router
autonomous system number."; autonomous system number.";
} }
leaf peer-type { leaf peer-type {
type bgp-types:peer-type; type oc-bgp-types:peer-type;
description description
"Explicitly designate the peer or peer group as internal "Explicitly designate the peer or peer group as internal
(iBGP) or external (eBGP)."; (iBGP) or external (eBGP).";
} }
leaf auth-password { leaf auth-password {
type string; type string;
description description
"Configures an MD5 authentication password for use with "Configures an MD5 authentication password for use with
neighboring devices."; neighboring devices.";
} }
leaf remove-private-as { leaf remove-private-as {
// could also make this a container with a flag to enable // could also make this a container with a flag to enable
// remove-private and separate option. here, option implies // remove-private and separate option. here, option implies
// remove-private is enabled. // remove-private is enabled.
type bgp-types:remove-private-as-option; type oc-bgp-types:remove-private-as-option;
description description
"Remove private AS numbers from updates sent to peers."; "Remove private AS numbers from updates sent to peers - when
this leaf is not specified, the AS_PATH attribute should be
sent to the peer unchanged";
} }
leaf route-flap-damping { leaf route-flap-damping {
type boolean; type boolean;
default false; default false;
description description
"Enable route flap damping."; "Enable route flap damping.";
} }
leaf send-community { leaf send-community {
type bgp-types:community-type; type oc-bgp-types:community-type;
default "NONE"; default "NONE";
description description
"Specify which types of community should be sent to the "Specify which types of community should be sent to the
neighbor or group. The default is to not send the neighbor or group. The default is to not send the
community attribute"; community attribute";
} }
leaf description { leaf description {
type string; type string;
description description
"An optional textual description (intended primarily for use "An optional textual description (intended primarily for use
with a peer or group"; with a peer or group";
} }
} }
grouping bgp-neighbor-timers_config {
description grouping bgp-common-neighbor-group-transport-config {
"Config parameters related to timers associated with the BGP
peer";
leaf connect-retry {
type decimal64 {
fraction-digits 2;
}
default 30;
description
"Time interval in seconds between attempts to establish a
session with the peer.";
}
leaf hold-time {
type decimal64 {
fraction-digits 2;
}
default 90;
description
"Time interval in seconds that a BGP session will be
considered active in the absence of keepalive or other
messages from the peer. The hold-time is typically
set to 3x the keepalive-interval.";
reference
"RFC 4271 - A Border Gateway Protocol 4, Sec. 10";
}
leaf keepalive-interval {
type decimal64 {
fraction-digits 2;
}
default 30;
description
"Time interval in seconds between transmission of keepalive
messages to the neighbor. Typically set to 1/3 the
hold-time.";
}
leaf minimum-advertisement-interval {
type decimal64 {
fraction-digits 2;
}
default 30;
description
"Minimum time which must elapse between subsequent UPDATE
messages relating to a common set of NLRI being transmitted
to a peer. This timer is referred to as
MinRouteAdvertisementIntervalTimer by RFC 4721 and serves to
reduce the number of UPDATE messages transmitted when a
particular set of NLRI exhibit instability.";
reference
"RFC 4271 - A Border Gateway Protocol 4, Sec 9.2.1.1";
}
}
grouping bgp-neighbor-transport_config {
description description
"Configuration parameters relating to the transport protocol "Configuration parameters relating to the transport protocol
used by the BGP session to the peer"; used by the BGP session to the peer";
leaf tcp-mss { leaf tcp-mss {
type uint16; type uint16;
description description
"Sets the max segment size for BGP TCP sessions."; "Sets the max segment size for BGP TCP sessions.";
} }
leaf mtu-discovery { leaf mtu-discovery {
type boolean; type boolean;
default false; default false;
description description
"Turns path mtu discovery for BGP TCP sessions on (true) "Turns path mtu discovery for BGP TCP sessions on (true)
or off (false)"; or off (false)";
} }
leaf passive-mode { leaf passive-mode {
type boolean; type boolean;
default false; default false;
description description
"Wait for peers to issue requests to open a BGP session, "Wait for peers to issue requests to open a BGP session,
rather than initiating sessions from the local router."; rather than initiating sessions from the local router.";
} }
leaf local-address { leaf local-address {
type union { type union {
type inet:ip-address; type inet:ip-address;
type string; type string;
} }
//TODO: the string should be converted to a leafref type //TODO: the string should be converted to a leafref type
//to point to an interface when YANG 1.1 is available with //to point to an interface when YANG 1.1 is available with
//leafrefs in union types. //leafrefs in union types.
description description
"Set the local IP (either IPv4 or IPv6) address to use "Set the local IP (either IPv4 or IPv6) address to use
skipping to change at page 14, line 36 skipping to change at page 16, line 32
//TODO: the string should be converted to a leafref type //TODO: the string should be converted to a leafref type
//to point to an interface when YANG 1.1 is available with //to point to an interface when YANG 1.1 is available with
//leafrefs in union types. //leafrefs in union types.
description description
"Set the local IP (either IPv4 or IPv6) address to use "Set the local IP (either IPv4 or IPv6) address to use
for the session when sending BGP update messages. This for the session when sending BGP update messages. This
may be expressed as either an IP address or reference may be expressed as either an IP address or reference
to the name of an interface."; to the name of an interface.";
} }
} }
grouping bgp-neighbor-error-handling_config {
grouping bgp-common-neighbor-group-error-handling-config {
description description
"Configuration parameters relating to enhanced error handling "Configuration parameters relating to enhanced error handling
behaviours for BGP"; behaviours for BGP";
leaf treat-as-withdraw { leaf treat-as-withdraw {
type boolean; type boolean;
default "false"; default "false";
description description
"Specify whether erroneous UPDATE messages for which the "Specify whether erroneous UPDATE messages for which the
NLRI can be extracted are reated as though the NLRI is NLRI can be extracted are reated as though the NLRI is
withdrawn - avoiding session reset"; withdrawn - avoiding session reset";
reference "draft-ietf-idr-error-handling-16"; reference "draft-ietf-idr-error-handling-16";
} }
} }
skipping to change at page 14, line 50 skipping to change at page 16, line 48
leaf treat-as-withdraw { leaf treat-as-withdraw {
type boolean; type boolean;
default "false"; default "false";
description description
"Specify whether erroneous UPDATE messages for which the "Specify whether erroneous UPDATE messages for which the
NLRI can be extracted are reated as though the NLRI is NLRI can be extracted are reated as though the NLRI is
withdrawn - avoiding session reset"; withdrawn - avoiding session reset";
reference "draft-ietf-idr-error-handling-16"; reference "draft-ietf-idr-error-handling-16";
} }
} }
grouping bgp-neighbor-logging-options_config {
grouping bgp-common-neighbor-group-logging-options-config {
description description
"Configuration parameters specifying the logging behaviour for "Configuration parameters specifying the logging behaviour for
BGP sessions to the peer"; BGP sessions to the peer";
leaf log-neighbor-state-changes { leaf log-neighbor-state-changes {
type boolean; type boolean;
default "true"; default "true";
description description
"Configure logging of peer state changes. Default is "Configure logging of peer state changes. Default is
to enable logging of peer state changes."; to enable logging of peer state changes.";
} }
} }
grouping bgp-neighbor-multihop_config {
grouping bgp-common-neighbor-group-multihop-config {
description description
"Configuration parameters specifying the multihop behaviour for "Configuration parameters specifying the multihop behaviour for
BGP sessions to the peer"; BGP sessions to the peer";
leaf enabled { leaf enabled {
type boolean; type boolean;
default "false"; default "false";
description description
"When enabled the referenced group or neighbors are permitted "When enabled the referenced group or neighbors are permitted
to be indirectly connected - including cases where the TTL to be indirectly connected - including cases where the TTL
can be decremented between the BGP peers"; can be decremented between the BGP peers";
} }
leaf multihop-ttl { leaf multihop-ttl {
type uint8; type uint8;
description description
"Time-to-live value to use when packets are sent to the "Time-to-live value to use when packets are sent to the
referenced group or neighbors and ebgp-multihop is enabled"; referenced group or neighbors and ebgp-multihop is enabled";
} }
} }
grouping bgp-neighbor-route-reflector_config {
grouping bgp-common-neighbor-group-route-reflector-config {
description description
"Configuration parameters determining whether the behaviour of "Configuration parameters determining whether the behaviour of
the local system when acting as a route-reflector"; the local system when acting as a route-reflector";
leaf route-reflector-cluster-id { leaf route-reflector-cluster-id {
type bgp-types:rr-cluster-id-type; type oc-bgp-types:rr-cluster-id-type;
description description
"route-reflector cluster id to use when local router is "route-reflector cluster id to use when local router is
configured as a route reflector. Commonly set at the group configured as a route reflector. Commonly set at the group
level, but allows a different cluster level, but allows a different cluster
id to be set for each neighbor."; id to be set for each neighbor.";
} }
leaf route-reflector-client { leaf route-reflector-client {
type boolean; type boolean;
default "false"; default "false";
description description
"Configure the neighbor as a route reflector client."; "Configure the neighbor as a route reflector client.";
} }
} }
grouping bgp-neighbor-as-path-options_config {
grouping bgp-common-neighbor-group-as-path-options-config {
description description
"Configuration parameters allowing manipulation of the AS_PATH "Configuration parameters allowing manipulation of the AS_PATH
attribute"; attribute";
leaf allow-own-as { leaf allow-own-as {
type uint8; type uint8;
default 0; default 0;
description description
"Specify the number of occurrences of the local BGP speaker's "Specify the number of occurrences of the local BGP speaker's
AS that can occur within the AS_PATH before it is rejected."; AS that can occur within the AS_PATH before it is rejected.";
} }
leaf replace-peer-as { leaf replace-peer-as {
type boolean; type boolean;
default "false"; default "false";
description description
"Replace occurrences of the peer's AS in the AS_PATH "Replace occurrences of the peer's AS in the AS_PATH
with the local autonomous system number"; with the local autonomous system number";
} }
} }
grouping bgp-neighbor-add-paths_config {
grouping bgp-common-neighbor-group-add-paths-config {
description description
"Configuration parameters specfying whether the local system "Configuration parameters specfying whether the local system
will send or receive multiple paths using ADD_PATHS"; will send or receive multiple paths using ADD_PATHS";
leaf receive { leaf receive {
type boolean; type boolean;
default false; default false;
description description
"Enable ability to receive multiple path advertisements "Enable ability to receive multiple path advertisements
for an NLRI from the neighbor or group"; for an NLRI from the neighbor or group";
} }
leaf send-max { leaf send-max {
type uint8; type uint8;
description description
"The maximum number of paths to advertise to neighbors "The maximum number of paths to advertise to neighbors
for a single NLRI"; for a single NLRI";
} }
} leaf eligible-prefix-policy {
grouping bgp-neighbor-peer-group_config {
description
"Configuration parameters indicating whether the specified peer
is to be considered as part of a peer-group - and therefore
inherit its configuration";
leaf peer-group {
type leafref { type leafref {
// we are at /bgp/neighbors/neighbor/ path "/rpol:routing-policy/rpol:policy-definitions/" +
path "/bgp/peer-groups/peer-group/peer-group-name"; "rpol:policy-definition/rpol:name";
require-instance true;
} }
description description
"The peer-group with which this neighbor is associated"; "A reference to a routing policy which can be used to
} restrict the prefixes for which add-paths is enabled";
}
grouping bgp-graceful-restart {
description
"Configures BGP graceful restart, which is a negotiated
option that indicates that a BGP speaker is able to retain
forwarding state when a BGP session restarts";
reference "RFC 4724: Graceful Restart Mechanism for BGP";
container graceful-restart {
description
"Parameters relating the graceful restart mechanism for BGP";
container config {
description
"Configuration parameters relating to graceful-restart";
uses bgp-neighbor-graceful-restart_config;
}
container state {
config false;
description
"State information associated with graceful-restart";
uses bgp-neighbor-graceful-restart_config;
}
} }
} }
grouping bgp-neighbor-graceful-restart_config {
grouping bgp-common-graceful-restart-config {
description description
"Configuration parameters relating to BGP graceful restart."; "Configuration parameters relating to BGP graceful restart.";
leaf enabled { leaf enabled {
type boolean; type boolean;
description description
"Enable or disable the graceful-restart capability."; "Enable or disable the graceful-restart capability.";
} }
leaf restart-time { leaf restart-time {
type uint16 { type uint16 {
range 0..4096; range 0..4096;
} }
description description
"Estimated time (in seconds) for the local BGP speaker to "Estimated time (in seconds) for the local BGP speaker to
restart a session. This value is advertise in the graceful restart a session. This value is advertise in the graceful
restart BGP capability. This is a 12-bit value, referred to restart BGP capability. This is a 12-bit value, referred to
as Restart Time in RFC4724. Per RFC4724, the suggested as Restart Time in RFC4724. Per RFC4724, the suggested
default value is <= the hold-time value."; default value is <= the hold-time value.";
skipping to change at page 18, line 15 skipping to change at page 19, line 50
} }
description description
"An upper-bound on the time thate stale routes will be "An upper-bound on the time thate stale routes will be
retained by a router after a session is restarted. If an retained by a router after a session is restarted. If an
End-of-RIB (EOR) marker is received prior to this timer End-of-RIB (EOR) marker is received prior to this timer
expiring stale-routes will be flushed upon its receipt - if expiring stale-routes will be flushed upon its receipt - if
no EOR is received, then when this timer expires stale paths no EOR is received, then when this timer expires stale paths
will be purged. This timer is referred to as the will be purged. This timer is referred to as the
Selection_Deferral_Timer in RFC4724"; Selection_Deferral_Timer in RFC4724";
} }
leaf helper-only { leaf helper-only {
type boolean; type boolean;
description description
"Enable graceful-restart in helper mode only. When this "Enable graceful-restart in helper mode only. When this
leaf is set, the local system does not retain forwarding leaf is set, the local system does not retain forwarding
its own state during a restart, but supports procedures its own state during a restart, but supports procedures
for the receiving speaker, as defined in RFC4724."; for the receiving speaker, as defined in RFC4724.";
} }
} }
// ************************************************************
// * configuration context containers *
// ************************************************************
grouping bgp-global-base {
description
"Global configuration parameters for the BGP router";
container config {
description
"Configuration parameters relating to the global BGP router";
uses bgp-global_config;
}
container state {
config false;
description
"State information relating to the global BGP router";
uses bgp-global_config;
uses bgp-op:bgp-global_state;
}
uses bgp-mp:bgp-route-selection-options;
container default-route-distance {
description
"Administrative distance (or preference) assigned to
routes received from different sources
(external, internal, and local).";
container config {
description
"Configuration parameters relating to the default route
distance";
uses bgp-default-route-distance_config;
} grouping bgp-common-use-multiple-paths-config {
container state {
config false;
description
"State information relating to the default route distance";
uses bgp-default-route-distance_config;
}
}
container confederation {
description
"Parameters indicating whether the local system acts as part
of a BGP confederation";
container config {
description
"Configuration parameters relating to BGP confederations";
uses bgp-confederation_config;
}
container state {
config false;
description
"State information relating to the BGP confederations";
uses bgp-confederation_config;
}
}
uses bgp-mp:bgp-use-multiple-paths;
uses bgp-graceful-restart;
container afi-safis {
description
"Address family specific configuration";
uses bgp-mp:bgp-common-afi-safi-list;
}
}
grouping bgp-neighbors {
description description
"BGP neighbors configured on the local system"; "Generic configuration options relating to use of multiple
list neighbor { paths for a referenced AFI-SAFI, group or neighbor";
key "neighbor-address";
leaf enabled {
type boolean;
default false;
description description
"List of BGP neighbors configured on the local system, "Whether the use of multiple paths for the same NLRI is
uniquely identified by peer IPv[46] address"; enabled for the neighbor. This value is overridden by
leaf neighbor-address { any more specific configuration value.";
type leafref {
path "../config/neighbor-address";
}
description
"Reference to the address of the BGP neighbor used as
a key in the neighbor list";
}
uses bgp-neighbor-group;
} }
} }
grouping bgp-peer-group {
grouping bgp-common-use-multiple-paths-ebgp-as-options-config {
description description
"BGP peer-groups configured on the local system"; "Configuration parameters specific to eBGP multipath applicable
list peer-group { to all contexts";
key "peer-group-name";
description leaf allow-multiple-as {
"List of BGP peer-groups configured on the local system - type boolean;
uniquely identified by peer-group name"; default "false";
leaf peer-group-name { description
type leafref { "Allow multipath to use paths from different neighbouring
path "../config/peer-group-name"; ASes. The default is to only consider multiple paths from
} the same neighbouring AS.";
description
"Reference to the name of the BGP peer-group used as a
key in the peer-group list";
}
uses bgp-neighbor-group;
} }
} }
grouping bgp-neighbor-group {
grouping bgp-common-global-group-use-multiple-paths {
description description
"Parameters related to a BGP neighbor or group"; "Common grouping used for both global and groups which provides
container config { configuration and state parameters relating to use of multiple
description paths";
"Configuration parameters relating to the BGP neighbor or
group"; container use-multiple-paths {
uses bgp-neighbor_config;
}
container state {
config false;
description
"State information relating to the BGP neighbor or group";
uses bgp-neighbor_config;
}
container timers {
description
"Timers related to a BGP neighbor or group";
container config {
description
"Configuration parameters relating to timers used for the
BGP neighbor or group";
uses bgp-neighbor-timers_config;
}
container state {
config false;
description
"State information relating to the timers used for the BGP
neighbor or group";
uses bgp-neighbor-timers_config;
}
}
container transport {
description
"Transport session parameters for the BGP neighbor or group";
container config {
description
"Configuration parameters relating to the transport
session(s) used for the BGP neighbor or group";
uses bgp-neighbor-transport_config;
}
container state {
config false;
description
"State information relating to the transport session(s)
used for the BGP neighbor or group";
uses bgp-neighbor-transport_config;
}
}
container error-handling {
description
"Error handling parameters used for the BGP neighbor or
group";
container config {
description
"Configuration parameters enabling or modifying the
behavior or enhanced error handling mechanisms for the BGP
neighbor or group";
uses bgp-neighbor-error-handling_config;
}
container state {
config false;
description
"State information relating to enhanced error handling
mechanisms for the BGP neighbor or group";
uses bgp-neighbor-error-handling_config;
}
}
container logging-options {
description
"Logging options for events related to the BGP neighbor or
group";
container config {
description
"Configuration parameters enabling or modifying logging
for events relating to the BGP neighbor or group";
uses bgp-neighbor-logging-options_config;
}
container state {
config false;
description
"State information relating to logging for the BGP neighbor
or group";
uses bgp-neighbor-logging-options_config;
}
}
container ebgp-multihop {
description
"eBGP multi-hop parameters for the BGP neighbor or group";
container config {
description
"Configuration parameters relating to eBGP multihop for the
BGP neighbor or group";
uses bgp-neighbor-multihop_config;
}
container state {
config false;
description
"State information for eBGP multihop, for the BGP neighbor
or group";
uses bgp-neighbor-multihop_config;
}
}
container route-reflector {
description
"Route reflector parameters for the BGP neighbor or group";
container config {
description
"Configuraton parameters relating to route reflection
for the BGP neighbor or group";
uses bgp-neighbor-route-reflector_config;
}
container state {
config false;
description
"State information relating to route reflection for the
BGP neighbor or group";
uses bgp-neighbor-route-reflector_config;
}
}
container as-path-options {
description description
"AS_PATH manipulation parameters for the BGP neighbor or "Parameters related to the use of multiple paths for the
group"; same NLRI";
container config { container config {
description description
"Configuration parameters relating to AS_PATH manipulation "Configuration parameters relating to multipath";
for the BGP peer or group"; uses bgp-common-use-multiple-paths-config;
uses bgp-neighbor-as-path-options_config;
} }
container state { container state {
config false; config false;
description description
"State information relating to the AS_PATH manipulation "State parameters relating to multipath";
mechanisms for the BGP peer or group"; uses bgp-common-use-multiple-paths-config;
uses bgp-neighbor-as-path-options_config;
} }
}
container add-paths { container ebgp {
description
"Parameters relating to the advertisement and receipt of
multiple paths for a single NLRI (add-paths)";
container config {
description description
"Configuration parameters relating to ADD_PATHS"; "Multipath parameters for eBGP";
uses bgp-neighbor-add-paths_config; container config {
description
"Configuration parameters relating to eBGP multipath";
uses bgp-common-use-multiple-paths-ebgp-config;
}
container state {
config false;
description
"State information relating to eBGP multipath";
uses bgp-common-use-multiple-paths-ebgp-config;
}
} }
container state {
config false; container ibgp {
description description
"State information associated with ADD_PATHS"; "Multipath parameters for iBGP";
uses bgp-neighbor-add-paths_config; container config {
description
"Configuration parameters relating to iBGP multipath";
uses bgp-common-use-multiple-paths-ibgp-config;
}
container state {
config false;
description
"State information relating to iBGP multipath";
uses bgp-common-use-multiple-paths-ibgp-config;
}
} }
} }
container afi-safis {
description
"Per-address-family configuration parameters associated with
the neighbor or group";
uses bgp-mp:bgp-common-afi-safi-list;
}
uses bgp-graceful-restart;
uses rpol:apply-policy-group;
} }
grouping bgp-neighbor-neighbor-address_config { grouping bgp-common-use-multiple-paths-ebgp-config {
description description
"Configuration options relating to the BGP neighbor address"; "Configuration parameters relating to multipath for eBGP";
leaf neighbor-address {
type inet:ip-address; leaf allow-multiple-as {
description type boolean;
"Address of the BGP peer, either in IPv4 or IPv6"; default "false";
description
"Allow multipath to use paths from different neighbouring
ASes. The default is to only consider multiple paths from
the same neighbouring AS.";
}
leaf maximum-paths {
type uint32;
default 1;
description
"Maximum number of parallel paths to consider when using
BGP multipath. The default is use a single path.";
} }
} }
grouping bgp-peer-group-peer-group-name_config {
grouping bgp-common-use-multiple-paths-ibgp-config {
description description
"Configuration options relating to the BGP peer-group name"; "Configuration parmaeters relating to multipath for iBGP";
leaf peer-group-name {
type string; leaf maximum-paths {
type uint32;
default 1;
description description
"Name of the BGP peer-group"; "Maximum number of parallel paths to consider when using
iBGP multipath. The default is to use a single path";
} }
} }
// add peer-group pointer only for the neighbor list
augment /bgp/neighbors/neighbor/config { grouping bgp-common-route-selection-options-config {
description
"Augmentation to allow association of a neighbor with a
peer-group";
uses bgp-neighbor-peer-group_config;
}
augment /bgp/neighbors/neighbor/state {
description
"Augmentation to reflect the association of a neighbor with a
peer-group";
uses bgp-neighbor-peer-group_config;
}
augment /bgp/peer-groups/peer-group {
description
"Augmentation to add multipath configuration to a peer-group";
uses bgp-mp:bgp-use-multiple-paths;
}
augment /bgp/neighbors/neighbor {
description
"Augmentation to add the multipath configuration to a
neighbor";
uses bgp-mp:bgp-use-multiple-paths-neighbor;
}
augment /bgp/peer-groups/peer-group/afi-safis/afi-safi {
description
"Augmentation to add multipath configuration to a peer-group
on a per-AFI-SAFI basis";
uses bgp-mp:bgp-use-multiple-paths;
}
augment /bgp/neighbors/neighbor/afi-safis/afi-safi {
description
"Augmentation to add multipath configuration to a neighbor
on a per-AFI-SAFI basis";
uses bgp-mp:bgp-use-multiple-paths-neighbor;
}
augment /bgp/global/afi-safis/afi-safi {
description
"Augmentation to add global instance specific AFI-SAFI
configuration information";
uses bgp-mp:bgp-global-afi-safi;
uses bgp-mp:bgp-use-multiple-paths;
}
augment /bgp/peer-groups/peer-group/afi-safis/afi-safi {
description
"Augmentation that adds peer-group instance specific
AFI-SAFI configuration information";
uses bgp-mp:bgp-group-afi-safi;
}
augment /bgp/neighbors/neighbor/config {
description
"Augmentation adding the neighbor address to the
neighbor configuration container";
uses bgp-neighbor-neighbor-address_config;
}
augment /bgp/neighbors/neighbor/state {
description
"Augmentation adding the neighbor address to the
neighbor state container";
uses bgp-neighbor-neighbor-address_config;
}
augment /bgp/peer-groups/peer-group/config {
description
"Augmentation adding the peer-group name to the
peer-group configuration container";
uses bgp-peer-group-peer-group-name_config;
}
augment /bgp/peer-groups/peer-group/state {
description
"Augmentation adding the peer-group name to the
peer-group state container";
uses bgp-peer-group-peer-group-name_config;
}
// ************************************************************
// * Augmentations to add state *
// * (rjs: cleaner to have these in the base module to avoid *
// needing to specify which module - e.g. augment of *
// /bgp:bgp/bgp:neighbors/bgp:neighbor...) *
// ************************************************************
augment /bgp/neighbors/neighbor/state {
description
"Augmentation to add operational state related to a particular
BGP neighbor";
uses bgp-op:bgp-neighbor_state;
}
augment /bgp/neighbors/bgp:neighbor/state {
description description
"Augmentation to add operational state related to a particular "Set of configuration options that govern best
BGP neighbor"; path selection.";
container messages {
leaf always-compare-med {
type boolean;
default "false";
description description
"Counters for BGP messages sent and received from the "Compare multi-exit discriminator (MED) value from
neighbor"; different ASes when selecting the best route. The
container sent { default behavior is to only compare MEDs for paths
description received from the same AS.";
"Counters relating to BGP messages sent to the neighbor";
uses bgp-op:bgp-neighbor-message-counters-sent_state;
}
container received {
description
"Counters for BGP messages received from the neighbor";
uses bgp-op:bgp-neighbor-message-counters-received_state;
}
} }
container queues {
leaf ignore-as-path-length {
type boolean;
default "false";
description description
"Counters related to queued messages associated with the "Ignore the AS path length when selecting the best path.
BGP neighbor"; The default is to use the AS path length and prefer paths
uses bgp-op:bgp-neighbor-queue-counters_state; with shorter length.";
} }
}
augment /bgp:bgp/bgp:neighbors/neighbor/timers/state {
description
"Augmentation to add the operational state of timers associated
with the BGP neighbor";
uses bgp-op:bgp-neighbor-timers_state;
}
augment /bgp/neighbors/neighbor/transport/state {
description
"Augmentation to add the operational state of the transport
session associated with the BGP neighbor";
uses bgp-op:bgp-neighbor-transport_state;
}
augment /bgp/neighbors/neighbor/error-handling/state {
description
"Augmentation to add the operational state of the error
handling associated with the BGP neighbor";
uses bgp-op:bgp-neighbor-error-handling_state;
}
augment /bgp/neighbors/neighbor/graceful-restart/state {
description
"Augmentation to add the operational state of graceful-restart
associated with a BGP neighbor";
uses bgp-op:bgp-afi-safi-graceful-restart_state; leaf external-compare-router-id {
} type boolean;
augment /bgp/peer-groups/peer-group/state { default "true";
description
"Augmentation to add the operational state and counters
relating to a BGP peer-group";
uses bgp-op:bgp-peer-group_state;
}
augment /bgp/global/afi-safis/afi-safi/state {
description
"Augmentation to add operational state and counters
on a per-AFI-SAFI basis to the global BGP router";
uses bgp-op:bgp-global-afi-safi_state;
}
augment /bgp/neighbors/neighbor/afi-safis/afi-safi/state {
description
"Augmentation to add per-AFI-SAFI operational state
and counters to the BGP neighbor";
uses bgp-op:bgp-neighbor-afi-safi_state;
}
augment "/bgp/neighbors/neighbor/afi-safis/afi-safi/" +
"graceful-restart/state" {
description
"Augmentation to add per-AFI-SAFI operational state for BGP
graceful-restart";
uses bgp-op:bgp-neighbor-afi-safi-graceful-restart_state;
}
// ************************************************************
// * module structure containers *
// ************************************************************
container bgp {
presence "Container for BGP protocol hierarchy";
description
"Top-level configuration and state for the BGP router";
container global {
description description
"Global configuration for the BGP router"; "When comparing similar routes received from external
uses bgp-global-base; BGP peers, use the router-id as a criterion to select
uses rpol:apply-policy-group; the active path.";
} }
container neighbors {
leaf advertise-inactive-routes {
type boolean;
default "false";
description description
"Configuration for BGP neighbors"; "Advertise inactive routes to external peers. The
uses bgp-neighbors; default is to only advertise active routes.";
} }
container peer-groups {
leaf enable-aigp {
type boolean;
default false;
description description
"Configuration for BGP peer-groups"; "Flag to enable sending / receiving accumulated IGP
attribute in routing updates";
}
uses bgp-peer-group; leaf ignore-next-hop-igp-metric {
type boolean;
default "false";
description
"Ignore the IGP metric to the next-hop when calculating
BGP best-path. The default is to select the route for
which the metric to the next-hop is lowest";
} }
} }
}
<CODE ENDS>
6.2. BGP base types grouping bgp-common-route-selection-options {
<CODE BEGINS> file "ietf-bgp-types.yang"
module ietf-bgp-types {
yang-version "1";
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-types";
prefix "bgp-types";
import ietf-inet-types { prefix inet; }
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This module contains general data definitions for use in BGP
policy. It can be imported by modules that make use of BGP
attributes";
revision "2016-01-06" {
description
"Updated filename and namespace";
reference "TBD";
}
identity bgp-capability {
description "Base identity for a BGP capability";
}
identity MPBGP {
base "bgp-capability";
description
"Multi-protocol extensions to BGP";
reference "RFC2858";
}
identity ROUTE-REFRESH {
base "bgp-capability";
description
"The BGP route-refresh functionality";
reference "RFC2918";
}
identity ASN32 {
base "bgp-capability";
description
"4-byte (32-bit) AS number functionality";
reference "RFC6793";
}
identity GRACEFUL-RESTART {
base "bgp-capability";
description
"Graceful restart functionality";
reference "RFC4724";
}
identity ADD-PATHS {
base "bgp-capability";
description
"BGP add-paths";
reference "draft-ietf-idr-add-paths";
}
identity afi-safi-type {
description
"Base identity type for AFI,SAFI tuples for BGP-4";
reference "RFC4760 - multiprotocol extensions for BGP-4";
}
identity ipv4-unicast {
base afi-safi-type;
description
"IPv4 unicast (AFI,SAFI = 1,1)";
reference "RFC4760";
}
identity ipv6-unicast {
base afi-safi-type;
description
"IPv6 unicast (AFI,SAFI = 2,1)";
reference "RFC4760";
}
identity ipv4-labelled-unicast {
base afi-safi-type;
description
"Labelled IPv4 unicast (AFI,SAFI = 1,4)";
reference "RFC3107";
}
identity ipv6-labelled-unicast {
base afi-safi-type;
description
"Labelled IPv6 unicast (AFI,SAFI = 2,4)";
reference "RFC3107";
}
identity l3vpn-ipv4-unicast {
base afi-safi-type;
description description
"Unicast IPv4 MPLS L3VPN (AFI,SAFI = 1,128)"; "Configuration and state relating to route selection options";
reference "RFC4364"; container route-selection-options {
} description
identity l3vpn-ipv6-unicast { "Parameters relating to options for route selection";
base afi-safi-type; container config {
description
"Unicast IPv6 MPLS L3VPN (AFI,SAFI = 2,128)";
reference "RFC4659";
}
identity l3vpn-ipv4-multicast {
base afi-safi-type;
description
"Multicast IPv4 MPLS L3VPN (AFI,SAFI = 1,129)";
reference "RFC6514";
}
identity l3vpn-ipv6-multicast {
base afi-safi-type;
description
"Multicast IPv6 MPLS L3VPN (AFI,SAFI = 2,129)";
reference "RFC6514";
}
identity l2vpn-vpls {
base afi-safi-type;
description
"BGP-signalled VPLS (AFI,SAFI = 25,65)";
reference "RFC4761";
}
identity l2vpn-evpn {
base afi-safi-type;
description
"BGP MPLS Based Ethernet VPN (AFI,SAFI = 25,70)";
}
identity bgp-well-known-std-community {
description
"Reserved communities within the standard community space
defined by RFC1997. These communities must fall within the
range 0x00000000 to 0xFFFFFFFF";
reference "RFC1997";
}
identity NO_EXPORT {
base bgp-well-known-std-community;
description
"Do not export NLRI received carrying this community outside
the bounds of this autonomous system, or this confederation if
the local autonomous system is a confederation member AS. This
community has a value of 0xFFFFFF01.";
reference "RFC1997";
}
identity NO_ADVERTISE {
base bgp-well-known-std-community;
description
"All NLRI received carrying this community must not be
advertised to other BGP peers. This community has a value of
0xFFFFFF02.";
reference "RFC1997";
}
identity NO_EXPORT_SUBCONFED {
base bgp-well-known-std-community;
description
"All NLRI received carrying this community must not be
advertised to external BGP peers - including over confederation
sub-AS boundaries. This community has a value of 0xFFFFFF03.";
reference "RFC1997";
}
identity NOPEER {
base bgp-well-known-std-community;
description
"An autonomous system receiving NLRI tagged with this community
is advised not to readvertise the NLRI to external bi-lateral
peer autonomous systems. An AS may also filter received NLRI
from bilateral peer sessions when they are tagged with this
community value";
reference "RFC3765";
}
identity INTERNET {
base bgp-well-known-std-community;
description
"A community used by some implementations with the value 0:0
which represents all possible community values.";
}
typedef bgp-session-direction {
type enumeration {
enum INBOUND {
description description
"Refers to all NLRI received from the BGP peer"; "Configuration parameters relating to route selection
options";
uses bgp-common-route-selection-options-config;
} }
enum OUTBOUND { container state {
config false;
description description
"Refers to all NLRI advertised to the BGP peer"; "State information for the route selection options";
uses bgp-common-route-selection-options-config;
} }
} }
description
"Type to describe the direction of NLRI transmission";
} }
typedef bgp-well-known-community-type {
type identityref {
base bgp-well-known-std-community;
} grouping bgp-common-state {
description
"Type definition for well-known IETF community attribute
values";
reference
"IANA Border Gateway Protocol (BGP) Well Known Communities";
}
typedef bgp-std-community-type {
// TODO: further refine restrictions and allowed patterns
// 4-octet value:
// <as number> 2 octets
// <community value> 2 octets
type union {
type uint32 {
// per RFC 1997, 0x00000000 - 0x0000FFFF and 0xFFFF0000 -
// 0xFFFFFFFF are reserved
range "65536..4294901759"; // 0x00010000..0xFFFEFFFF
}
type string {
pattern '([0-9]+:[0-9]+)';
}
}
description
"Type definition for standard commmunity attributes";
reference "RFC 1997 - BGP Communities Attribute";
}
typedef bgp-ext-community-type {
// TODO: needs more work to make this more precise given the
// variability of extended community attribute specifications
// 8-octet value:
// <type> 2 octects
// <value> 6 octets
type string {
pattern '([0-9\.]+(:[0-9]+)?:[0-9]+)';
}
description
"Type definition for extended community attributes";
reference "RFC 4360 - BGP Extended Communities Attribute";
}
typedef bgp-community-regexp-type {
// TODO: needs more work to decide what format these regexps can
// take.
type string;
description
"Type definition for communities specified as regular
expression patterns";
}
typedef bgp-origin-attr-type {
type enumeration {
enum IGP {
description "Origin of the NLRI is internal";
}
enum EGP {
description "Origin of the NLRI is EGP";
}
enum INCOMPLETE {
description "Origin of the NLRI is neither IGP or EGP";
}
}
description
"Type definition for standard BGP origin attribute";
reference "RFC 4271 - A Border Gateway Protocol 4 (BGP-4),
Sec 4.3";
}
typedef peer-type {
type enumeration {
enum INTERNAL {
description "internal (iBGP) peer";
}
enum EXTERNAL {
description "external (eBGP) peer";
}
}
description
"labels a peer or peer group as explicitly internal or
external";
}
typedef remove-private-as-option {
type enumeration {
enum ALL {
description "remove all private ASes in the path";
}
enum REPLACE {
description "replace private ASes with local AS";
}
}
description
"set of options for configuring how private AS path numbers
are removed from advertisements";
}
typedef percentage {
type uint8 {
range "0..100";
}
description description
"Integer indicating a percentage value"; "Grouping containing common counters relating to prefixes and
paths";
} leaf total-paths {
typedef rr-cluster-id-type {
type union {
type uint32; type uint32;
type inet:ipv4-address; description
"Total number of BGP paths within the context";
} }
description
"union type for route reflector cluster ids: leaf total-prefixes {
option 1: 4-byte number type uint32;
option 2: IP address"; description
} "Total number of BGP prefixes received within the context";
typedef community-type {
type enumeration {
enum STANDARD {
description "send only standard communities";
}
enum EXTENDED {
description "send only extended communities";
}
enum BOTH {
description "send both standard and extended communities";
}
enum NONE {
description "do not send any community attribute";
}
} }
description
"type describing variations of community attributes:
STANDARD: standard BGP community [rfc1997]
EXTENDED: extended BGP community [rfc4360]
BOTH: both standard and extended community";
} }
} }
<CODE ENDS> <CODE ENDS>
6.3. BGP policy items <CODE BEGINS> file "ietf-bgp-common-multiprotocol.yang"
submodule ietf-bgp-common-multiprotocol {
belongs-to ietf-bgp {
prefix "bgp";
}
import openconfig-extensions { prefix oc-ext; }
import ietf-bgp-types { prefix oc-bgp-types; }
import ietf-routing-policy { prefix rpol; }
import openconfig-types { prefix oc-types; }
include ietf-bgp-common;
<CODE BEGINS> file "ietf-bgp-policy.yang"
module ietf-bgp-policy {
yang-version "1";
// namespace
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-policy";
prefix "bgp-pol";
// import some basic types
import ietf-inet-types { prefix inet; }
import ietf-routing-policy {prefix rpol; }
import ietf-policy-types { prefix pt; }
import ietf-bgp-types { prefix bgp-types; }
// meta // meta
organization organization
"OpenConfig working group"; "OpenConfig working group";
contact contact
"OpenConfig working group "OpenConfig working group
netopenconfig@googlegroups.com"; netopenconfig@googlegroups.com";
description description
"This module contains data definitions for BGP routing policy. "This sub-module contains groupings that are related to support
It augments the base routing-policy module with BGP-specific for multiple protocols in BGP. The groupings are common across
options for conditions and actions."; multiple contexts.";
revision "2016-01-06" {
description oc-ext:openconfig-version "2.1.1";
"Updated filename and namespace";
reference "TBD"; revision "2016-06-21" {
}
// extension statements
// feature statements
// identity statements
// typedef statements
typedef bgp-as-path-prepend-repeat {
type uint8;
description
"Option for the BGP as-prepend policy action. Prepends the
local AS number repeated n times";
}
typedef bgp-set-community-option-type {
type enumeration {
enum ADD {
description
"add the specified communities to the existing
community attribute";
}
enum REMOVE {
description
"remove the specified communities from the
existing community attribute";
}
enum REPLACE {
description
"replace the existing community attribute with
the specified communities. If an empty set is
specified, this removes the community attribute
from the route.";
}
}
description
"Type definition for options when setting the community
attribute in a policy action";
}
typedef bgp-next-hop-type {
type union {
type inet:ip-address;
type enumeration {
enum SELF {
description "special designation for local router's own
address, i.e., next-hop-self";
}
}
}
description
"type definition for specifying next-hop in policy actions";
}
typedef bgp-set-med-type {
type union {
type uint32;
type string {
pattern "^[+-][0-9]+";
}
type enumeration {
enum IGP {
description "set the MED value to the IGP cost toward the
next hop for the route";
}
}
}
description description
"Type definition for specifying how the BGP MED can "OpenConfig BGP refactor";
be set in BGP policy actions. The three choices are to set reference "2.1.1";
the MED directly, increment/decrement using +/- notation,
and setting it to the IGP cost (predefined value).";
} }
// grouping statements
grouping bgp-match-conditions { grouping bgp-common-mp-afi-safi-graceful-restart-config {
description description
"Condition statement definitions for checking membership in a "BGP graceful restart parameters that apply on a per-AFI-SAFI
defined set"; basis";
container match-community-set {
presence leaf enabled {
"The presence of this container indicates that the routes type boolean;
should match the referenced community-set"; default false;
description
"Match a referenced community-set according to the logic
defined in the match-set-options leaf";
leaf community-set {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"bgp-pol:bgp-defined-sets/bgp-pol:community-sets/" +
"bgp-pol:community-set/bgp-pol:community-set-name";
require-instance true;
}
description
"References a defined community set";
}
uses rpol:match-set-options-group;
}
container match-ext-community-set {
presence
"The presence of this container indicates that the routes
should match the referenced extended community set";
description
"Match a referenced extended community-set according to the
logic defined in the match-set-options leaf";
leaf ext-community-set {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"bgp-pol:bgp-defined-sets/bgp-pol:ext-community-sets/" +
"bgp-pol:ext-community-set/" +
"bgp-pol:ext-community-set-name";
require-instance true;
}
description "References a defined extended community set";
}
uses rpol:match-set-options-group;
}
container match-as-path-set {
presence
"The presence of this container indicates that the route
should match the referenced as-path set";
description description
"Match a referenced as-path set according to the logic "This leaf indicates whether graceful-restart is enabled for
defined in the match-set-options leaf"; this AFI-SAFI";
leaf as-path-set {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"bgp-pol:bgp-defined-sets/bgp-pol:as-path-sets/" +
"bgp-pol:as-path-set/bgp-pol:as-path-set-name";
require-instance true;
}
description "References a defined AS path set";
}
uses rpol:match-set-options-group;
} }
} }
grouping bgp-attribute-conditions {
grouping bgp-common-mp-afi-safi-config {
description description
"Condition statement definitions for comparing a BGP route "Configuration parameters used for all BGP AFI-SAFIs";
attribute to a specified value";
leaf med-eq { leaf afi-safi-name {
type uint32; type identityref {
description base oc-bgp-types:AFI_SAFI_TYPE;
"Condition to check if the received MED value is equal to
the specified value";
}
leaf origin-eq {
type bgp-types:bgp-origin-attr-type;
description
"Condition to check if the route origin is equal to the
specified value";
}
leaf-list next-hop-in {
type inet:ip-address;
description
"List of next hop addresses to check for in the route
update";
}
leaf local-pref-eq {
type uint32;
// TODO: add support for other comparisons if needed
description
"Condition to check if the local pref attribute is equal to
the specified value";
}
container community-count {
presence "node is present in the config data to indicate a
community-count condition";
description
"Value and comparison operations for conditions based on the
number of communities in the route update";
uses pt:attribute-compare-operators;
}
container as-path-length {
presence "node is present in the config data to indicate a
as-path-length condition";
description
"Value and comparison operations for conditions based on the
length of the AS path in the route update";
uses pt:attribute-compare-operators;
}
leaf route-type {
// TODO: verify extent of vendor support for this comparison
type enumeration {
enum INTERNAL {
description "route type is internal";
}
enum EXTERNAL {
description "route type is external";
}
} }
description description "AFI,SAFI";
"Condition to check the route type in the route update";
} }
}
// augment statements leaf enabled {
augment "/rpol:routing-policy/rpol:defined-sets" { type boolean;
description "adds BGP defined sets container to routing policy default false;
model";
container bgp-defined-sets {
description description
"BGP-related set definitions for policy match conditions"; "This leaf indicates whether the IPv4 Unicast AFI,SAFI is
container community-sets { enabled for the neighbour or group";
description
"Enclosing container for community sets";
list community-set {
key community-set-name;
description
"Definitions for community sets";
leaf community-set-name {
type string;
mandatory true;
description
"name / label of the community set -- this is used to
reference the set in match conditions";
}
leaf-list community-member {
type union {
type bgp-types:bgp-std-community-type;
type bgp-types:bgp-community-regexp-type;
type bgp-types:bgp-well-known-community-type;
}
description
"members of the community set";
}
}
}
container ext-community-sets {
description
"Enclosing container for extended community sets";
list ext-community-set {
key ext-community-set-name;
description
"Definitions for extended community sets";
leaf ext-community-set-name {
type string;
description
"name / label of the extended community set -- this is
used to reference the set in match conditions";
}
leaf-list ext-community-member {
type union {
type bgp-types:bgp-ext-community-type;
// TODO: is regexp support needed for extended
// communities?
type bgp-types:bgp-community-regexp-type;
}
description
"members of the extended community set";
}
}
}
container as-path-sets {
description
"Enclosing container for AS path sets";
list as-path-set {
key as-path-set-name;
description
"Definitions for AS path sets";
leaf as-path-set-name {
type string;
description
"name of the AS path set -- this is used to reference
the set in match conditions";
}
leaf-list as-path-set-member {
// TODO: need to refine typedef for AS path expressions
type string;
description
"AS path expression -- list of ASes in the set";
}
}
}
}
}
augment "/rpol:routing-policy/rpol:policy-definitions/" +
"rpol:policy-definition/rpol:statements/rpol:statement/" +
"rpol:conditions" {
description "BGP policy conditions added to routing policy
module";
container bgp-conditions {
description "Policy conditions for matching
BGP-specific defined sets or comparing BGP-specific
attributes";
uses bgp-match-conditions;
uses bgp-attribute-conditions;
} }
} }
augment "/rpol:routing-policy/rpol:policy-definitions/" +
"rpol:policy-definition/rpol:statements/rpol:statement/" +
"rpol:actions" {
description "BGP policy actions added to routing policy
module";
container bgp-actions {
description
"Definitions for policy action statements that
change BGP-specific attributes of the route";
container set-as-path-prepend {
presence "node is present in the config data to use the AS
prepend action";
description
"action to prepend local AS number to the AS-path a
specified number of times";
leaf repeat-n {
type uint8;
description "number of times to prepend the local AS
number";
}
}
container set-community {
presence "node is present in the config data when
set-community action is used";
description
"action to set the community attributes of the route, along
with options to modify how the community is modified";
choice set-community-method {
description
"Option to set communities using an inline list or
reference to an existing defined set.";
case inline {
leaf-list communities {
type union {
type bgp-types:bgp-std-community-type;
type bgp-types:bgp-well-known-community-type;
}
description
"Set the community values for the update inline with
a list.";
} grouping bgp-common-mp-all-afi-safi-list-contents {
} description
case reference { "A common grouping used for contents of the list that is used
leaf community-set-ref { for AFI-SAFI entries";
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"bgp-pol:bgp-defined-sets/" +
"bgp-pol:community-sets/bgp-pol:community-set/" +
"bgp-pol:community-set-name";
require-instance true;
}
description
"References a defined community set by name";
}
}
}
leaf options {
type bgp-set-community-option-type;
description
"Options for modifying the community attribute with
the specified values. These options apply to both
methods of setting the community attribute.";
}
}
container set-ext-community {
presence "node is present in the config data when
set-community action is used";
description
"Action to set the extended community attributes of the
route, along with options to modify how the community is
modified";
choice set-ext-community-method {
description
"Option to set communities using an inline list or
reference to an existing defined set.";
case inline {
leaf-list communities {
type union {
type bgp-types:bgp-ext-community-type;
type bgp-types:bgp-well-known-community-type;
}
description
"Set the community values for the update inline with
a list.";
}
}
case reference {
leaf ext-community-set-ref {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"bgp-pol:bgp-defined-sets/" +
"bgp-pol:ext-community-sets/" +
"bgp-pol:ext-community-set/" +
"bgp-pol:ext-community-set-name";
require-instance true;
}
description
"References a defined extended community set by
name";
}
}
}
leaf options {
type bgp-set-community-option-type;
description
"options for modifying the extended community
attribute with the specified values. These options
apply to both methods of setting the community
attribute.";
}
}
leaf set-route-origin {
type bgp-types:bgp-origin-attr-type;
description "set the origin attribute to the specified
value";
}
leaf set-local-pref {
type uint32;
description "set the local pref attribute on the route
update";
}
leaf set-next-hop {
type bgp-next-hop-type;
description "set the next-hop attribute in the route update";
}
leaf set-med {
type bgp-set-med-type;
description "set the med metric attribute in the route
update";
}
}
}
// rpc statements
// notification statements
}
<CODE ENDS>
6.4. BGP multiprotocol items // import and export policy included for the afi/safi
uses rpol:apply-policy-group;
<CODE BEGINS> file "ietf-bgp-multiprotocol.yang" uses bgp-common-mp-ipv4-unicast-group;
module ietf-bgp-multiprotocol { uses bgp-common-mp-ipv6-unicast-group;
yang-version "1"; uses bgp-common-mp-ipv4-labeled-unicast-group;
// namespace uses bgp-common-mp-ipv6-labeled-unicast-group;
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-multiprotocol"; uses bgp-common-mp-l3vpn-ipv4-unicast-group;
prefix "bgp-mp"; uses bgp-common-mp-l3vpn-ipv6-unicast-group;
// import some basic inet types uses bgp-common-mp-l3vpn-ipv4-multicast-group;
import ietf-routing-policy { prefix rpol; } uses bgp-common-mp-l3vpn-ipv6-multicast-group;
import ietf-bgp-types { prefix bgp-types; } uses bgp-common-mp-l2vpn-vpls-group;
import ietf-bgp-operational { prefix bgp-op; } uses bgp-common-mp-l2vpn-evpn-group;
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This module is part of a YANG model for BGP protocol
configuration, focusing on configuration of multiprotocol
BGP, in particular various relevant address families (AFI) and
sub-address families (SAFI).
Identities (rather than enumerated types) are used to identify
each AFI / SAFI type to make it easier for users to extend to
pre-standard or custom AFI/SAFI types. This module is only
intended to capture the most";
revision "2016-01-06" {
description
"Updated filename and namespace";
reference "TBD";
} }
grouping ipv4-unicast-group {
// Groupings relating to each address family
grouping bgp-common-mp-ipv4-unicast-group {
description description
"Group for IPv4 Unicast configuration options"; "Group for IPv4 Unicast configuration options";
container ipv4-unicast { container ipv4-unicast {
when "../afi-safi-name = 'bgp-mp:ipv4-unicast'" { when "../afi-safi-name = 'oc-bgp-types:IPV4_UNICAST'" {
description description
"Include this container for IPv4 Unicast specific "Include this container for IPv4 Unicast specific
configuration"; configuration";
} }
description "IPv4 unicast configuration options"; description "IPv4 unicast configuration options";
// include common IPv[46] unicast options // include common IPv[46] unicast options
uses ipv4-ipv6-unicast-common; uses bgp-common-mp-ipv4-ipv6-unicast-common;
// placeholder for IPv4 unicast specific configuration // placeholder for IPv4 unicast specific configuration
} }
} }
grouping ipv6-unicast-group {
grouping bgp-common-mp-ipv6-unicast-group {
description description
"Group for IPv6 Unicast configuration options"; "Group for IPv6 Unicast configuration options";
container ipv6-unicast { container ipv6-unicast {
when "../afi-safi-name = 'bgp-mp:ipv6-unicast'" { when "../afi-safi-name = 'oc-bgp-types:IPV6_UNICAST'" {
description description
"Include this container for IPv6 Unicast specific "Include this container for IPv6 Unicast specific
configuration"; configuration";
} }
description "IPv6 unicast configuration options"; description "IPv6 unicast configuration options";
// include common IPv[46] unicast options // include common IPv[46] unicast options
uses ipv4-ipv6-unicast-common; uses bgp-common-mp-ipv4-ipv6-unicast-common;
// placeholder for IPv6 unicast specific configuration // placeholder for IPv6 unicast specific configuration
// options // options
} }
} }
grouping ipv4-labelled-unicast-group {
grouping bgp-common-mp-ipv4-labeled-unicast-group {
description description
"Group for IPv4 Labelled Unicast configuration options"; "Group for IPv4 Labeled Unicast configuration options";
container ipv4-labelled-unicast {
when "../afi-safi-name = 'bgp-mp:ipv4-labelled-unicast'" { container ipv4-labeled-unicast {
when "../afi-safi-name = 'oc-bgp-types:IPV4_LABELED_UNICAST'" {
description description
"Include this container for IPv4 Labelled Unicast specific "Include this container for IPv4 Labeled Unicast specific
configuration"; configuration";
} }
description "IPv4 Labelled Unicast configuration options";
uses all-afi-safi-common; description "IPv4 Labeled Unicast configuration options";
// placeholder for IPv4 Labelled Unicast specific config
uses bgp-common-mp-all-afi-safi-common;
// placeholder for IPv4 Labeled Unicast specific config
// options // options
} }
} }
grouping ipv6-labelled-unicast-group {
grouping bgp-common-mp-ipv6-labeled-unicast-group {
description description
"Group for IPv6 Labelled Unicast configuration options"; "Group for IPv6 Labeled Unicast configuration options";
container ipv6-labelled-unicast {
when "../afi-safi-name = 'bgp-mp:ipv6-labelled-unicast'" { container ipv6-labeled-unicast {
when "../afi-safi-name = 'oc-bgp-types:IPV6_LABELED_UNICAST'" {
description description
"Include this container for IPv6 Labelled Unicast specific "Include this container for IPv6 Labeled Unicast specific
configuration"; configuration";
} }
description "IPv6 Labelled Unicast configuration options";
uses all-afi-safi-common; description "IPv6 Labeled Unicast configuration options";
// placeholder for IPv6 Labelled Unicast specific config
uses bgp-common-mp-all-afi-safi-common;
// placeholder for IPv6 Labeled Unicast specific config
// options. // options.
} }
} }
grouping l3vpn-ipv4-unicast-group {
grouping bgp-common-mp-l3vpn-ipv4-unicast-group {
description description
"Group for IPv4 Unicast L3VPN configuration options"; "Group for IPv4 Unicast L3VPN configuration options";
container l3vpn-ipv4-unicast { container l3vpn-ipv4-unicast {
when "../afi-safi-name = 'bgp-mp:l3vpn-ipv4-unicast'" { when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV4_UNICAST'" {
description description
"Include this container for IPv4 Unicast L3VPN specific "Include this container for IPv4 Unicast L3VPN specific
configuration"; configuration";
} }
description "Unicast IPv4 L3VPN configuration options"; description "Unicast IPv4 L3VPN configuration options";
// include common L3VPN configuration options // include common L3VPN configuration options
uses l3vpn-ipv4-ipv6-unicast-common; uses bgp-common-mp-l3vpn-ipv4-ipv6-unicast-common;
// placeholder for IPv4 Unicast L3VPN specific config options. // placeholder for IPv4 Unicast L3VPN specific config options.
} }
} }
grouping l3vpn-ipv6-unicast-group {
grouping bgp-common-mp-l3vpn-ipv6-unicast-group {
description description
"Group for IPv6 Unicast L3VPN configuration options"; "Group for IPv6 Unicast L3VPN configuration options";
container l3vpn-ipv6-unicast { container l3vpn-ipv6-unicast {
when "../afi-safi-name = 'bgp-mp:l3vpn-ipv6-unicast'" { when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV6_UNICAST'" {
description description
"Include this container for unicast IPv6 L3VPN specific "Include this container for unicast IPv6 L3VPN specific
configuration"; configuration";
} }
description "Unicast IPv6 L3VPN configuration options"; description "Unicast IPv6 L3VPN configuration options";
// include common L3VPN configuration options // include common L3VPN configuration options
uses l3vpn-ipv4-ipv6-unicast-common; uses bgp-common-mp-l3vpn-ipv4-ipv6-unicast-common;
// placeholder for IPv6 Unicast L3VPN specific configuration // placeholder for IPv6 Unicast L3VPN specific configuration
// options // options
} }
} }
grouping l3vpn-ipv4-multicast-group {
grouping bgp-common-mp-l3vpn-ipv4-multicast-group {
description description
"Group for IPv4 L3VPN multicast configuration options"; "Group for IPv4 L3VPN multicast configuration options";
container l3vpn-ipv4-multicast { container l3vpn-ipv4-multicast {
when "../afi-safi-name = 'bgp-mp:l3vpn-ipv4-multicast'" { when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV4_MULTICAST'" {
description description
"Include this container for multicast IPv6 L3VPN specific "Include this container for multicast IPv6 L3VPN specific
configuration"; configuration";
} }
description "Multicast IPv4 L3VPN configuration options"; description "Multicast IPv4 L3VPN configuration options";
// include common L3VPN multicast options // include common L3VPN multicast options
uses l3vpn-ipv4-ipv6-multicast-common; uses bgp-common-mp-l3vpn-ipv4-ipv6-multicast-common;
// placeholder for IPv4 Multicast L3VPN specific configuration // placeholder for IPv4 Multicast L3VPN specific configuration
// options // options
} }
} }
grouping l3vpn-ipv6-multicast-group {
grouping bgp-common-mp-l3vpn-ipv6-multicast-group {
description description
"Group for IPv6 L3VPN multicast configuration options"; "Group for IPv6 L3VPN multicast configuration options";
container l3vpn-ipv6-multicast { container l3vpn-ipv6-multicast {
when "../afi-safi-name = 'bgp-mp:l3vpn-ipv6-multicast'" { when "../afi-safi-name = 'oc-bgp-types:L3VPN_IPV6_MULTICAST'" {
description description
"Include this container for multicast IPv6 L3VPN specific "Include this container for multicast IPv6 L3VPN specific
configuration"; configuration";
} }
description "Multicast IPv6 L3VPN configuration options"; description "Multicast IPv6 L3VPN configuration options";
// include common L3VPN multicast options // include common L3VPN multicast options
uses l3vpn-ipv4-ipv6-multicast-common; uses bgp-common-mp-l3vpn-ipv4-ipv6-multicast-common;
// placeholder for IPv6 Multicast L3VPN specific configuration // placeholder for IPv6 Multicast L3VPN specific configuration
// options // options
} }
} }
grouping l2vpn-vpls-group {
grouping bgp-common-mp-l2vpn-vpls-group {
description description
"Group for BGP-signalled VPLS configuration options"; "Group for BGP-signalled VPLS configuration options";
container l2vpn-vpls { container l2vpn-vpls {
when "../afi-safi-name = 'bgp-mp:l2vpn-vpls'" { when "../afi-safi-name = 'oc-bgp-types:L2VPN_VPLS'" {
description description
"Include this container for BGP-signalled VPLS specific "Include this container for BGP-signalled VPLS specific
configuration"; configuration";
} }
description "BGP-signalled VPLS configuration options"; description "BGP-signalled VPLS configuration options";
// include common L2VPN options // include common L2VPN options
uses l2vpn-common; uses bgp-common-mp-l2vpn-common;
// placeholder for BGP-signalled VPLS specific configuration // placeholder for BGP-signalled VPLS specific configuration
// options // options
} }
} }
grouping l2vpn-evpn-group {
grouping bgp-common-mp-l2vpn-evpn-group {
description description
"Group for BGP EVPN configuration options"; "Group for BGP EVPN configuration options";
container l2vpn-evpn { container l2vpn-evpn {
when "../afi-safi-name = 'bgp-mp:l2vpn-evpn'" { when "../afi-safi-name = 'oc-bgp-types:L2VPN_EVPN'" {
description description
"Include this container for BGP EVPN specific "Include this container for BGP EVPN specific
configuration"; configuration";
} }
description "BGP EVPN configuration options"; description "BGP EVPN configuration options";
// include common L2VPN options // include common L2VPN options
uses l2vpn-common; uses bgp-common-mp-l2vpn-common;
// placeholder for BGP EVPN specific configuration options // placeholder for BGP EVPN specific configuration options
}
}
grouping bgp-route-selection-options_config {
description
"Set of configuration options that govern best
path selection.";
leaf always-compare-med {
type boolean;
default "false";
description
"Compare multi-exit discriminator (MED) value from
different ASes when selecting the best route. The
default behavior is to only compare MEDs for paths
received from the same AS.";
}
leaf ignore-as-path-length {
type boolean;
default "false";
description
"Ignore the AS path length when selecting the best path.
The default is to use the AS path length and prefer paths
with shorter length.";
}
leaf external-compare-router-id {
type boolean;
default "true";
description
"When comparing similar routes received from external
BGP peers, use the router-id as a criterion to select
the active path.";
}
leaf advertise-inactive-routes {
type boolean;
default "false";
description
"Advertise inactive routes to external peers. The
default is to only advertise active routes.";
}
leaf enable-aigp {
type boolean;
default false;
description
"Flag to enable sending / receiving accumulated IGP
attribute in routing updates";
}
leaf ignore-next-hop-igp-metric {
type boolean;
default "false";
description
"Ignore the IGP metric to the next-hop when calculating
BGP best-path. The default is to select the route for
which the metric to the next-hop is lowest";
}
}
grouping bgp-use-multiple-paths-ebgp-as-options_config {
description
"Configuration parameters specific to eBGP multipath applicable
to all contexts";
leaf allow-multiple-as {
type boolean;
default "false";
description
"Allow multipath to use paths from different neighbouring
ASes. The default is to only consider multiple paths from
the same neighbouring AS.";
}
}
grouping bgp-use-multiple-paths-ebgp_config {
description
"Configuration parameters relating to multipath for eBGP";
uses bgp-use-multiple-paths-ebgp-as-options_config;
leaf maximum-paths {
type uint32;
default 1;
description
"Maximum number of parallel paths to consider when using
BGP multipath. The default is use a single path.";
}
}
grouping bgp-use-multiple-paths-ibgp_config {
description
"Configuration parmaeters relating to multipath for iBGP";
leaf maximum-paths {
type uint32;
default 1;
description
"Maximum number of parallel paths to consider when using
iBGP multipath. The default is to use a single path";
}
}
grouping bgp-use-multiple-paths {
description
"Configuration parameters relating to multipath for BGP - both
iBGP and eBGP";
container use-multiple-paths {
description
"Parameters related to the use of multiple paths for the
same NLRI";
container config {
description
"Configuration parameters relating to multipath";
uses bgp-use-multiple-paths_config;
}
container state {
description
"State parameters relating to multipath";
uses bgp-use-multiple-paths_config;
}
container ebgp {
description
"Multipath parameters for eBGP";
container config {
description
"Configuration parameters relating to eBGP multipath";
uses bgp-use-multiple-paths-ebgp_config;
}
container state {
config false;
description
"State information relating to eBGP multipath";
uses bgp-use-multiple-paths-ebgp_config;
}
}
container ibgp {
description
"Multipath parameters for iBGP";
container config {
description
"Configuration parameters relating to iBGP multipath";
uses bgp-use-multiple-paths-ibgp_config;
}
container state {
config false;
description
"State information relating to iBGP multipath";
uses bgp-use-multiple-paths-ibgp_config;
}
}
}
}
grouping bgp-use-multiple-paths-neighbor {
description
"Per-neighbor configuration for multipath for BGP";
container use-multiple-paths {
description
"Parameters related to the use of multiple-paths for the same
NLRI when they are received only from this neighbor";
container config {
description
"Configuration parameters relating to multipath";
uses bgp-use-multiple-paths_config;
}
container state {
description
"State parameters relating to multipath";
uses bgp-use-multiple-paths_config;
}
container ebgp {
description
"Multipath configuration for eBGP";
container config {
description
"Configuration parameters relating to eBGP multipath";
uses bgp-use-multiple-paths-ebgp-as-options_config;
}
container state {
config false;
description
"State information relating to eBGP multipath";
uses bgp-use-multiple-paths-ebgp-as-options_config;
}
}
}
}
grouping bgp-use-multiple-paths_config {
description
"Generic configuration options relating to use of multiple
paths for a referenced AFI-SAFI, group or neighbor";
leaf enabled {
type boolean;
default false;
description
"Whether the use of multiple paths for the same NLRI is
enabled for the neighbor. This value is overridden by
any more specific configuration value.";
}
}
grouping bgp-afi-safi-graceful-restart_config {
description
"BGP graceful restart parameters that apply on a per-AFI-SAFI
basis";
leaf enabled {
type boolean;
default false;
description
"This leaf indicates whether graceful-restart is enabled for
this AFI-SAFI";
}
}
grouping bgp-afi-safi_config {
description
"Configuration parameters used for all BGP AFI-SAFIs";
leaf afi-safi-name {
type identityref {
base bgp-types:afi-safi-type;
}
description "AFI,SAFI";
}
leaf enabled {
type boolean;
default false;
description
"This leaf indicates whether the IPv4 Unicast AFI,SAFI is
enabled for the neighbour or group";
}
}
grouping all-afi-safi-common-prefix-limit_config {
description
"Configuration parameters relating to prefix-limits for an
AFI-SAFI";
leaf max-prefixes {
type uint32;
description
"Maximum number of prefixes that will be accepted
from the neighbour";
}
leaf shutdown-threshold-pct {
type bgp-types:percentage;
description
"Threshold on number of prefixes that can be received
from a neighbour before generation of warning messages
or log entries. Expressed as a percentage of
max-prefixes";
}
leaf restart-timer {
type decimal64 {
fraction-digits 2;
}
units "seconds";
description
"Time interval in seconds after which the BGP session
is re-established after being torn down due to exceeding
the max-prefix limit.";
}
}
grouping ipv4-ipv6-unicast-common_config {
description
"Common configuration parameters for IPv4 and IPv6 Unicast
address families";
leaf send-default-route {
type boolean;
default "false";
description
"If set to true, send the default-route to the neighbour(s)";
} }
} }
grouping all-afi-safi-common {
// Common groupings across multiple AFI,SAFIs
grouping bgp-common-mp-all-afi-safi-common {
description description
"Grouping for configuration common to all AFI,SAFI"; "Grouping for configuration common to all AFI,SAFI";
container prefix-limit { container prefix-limit {
description description
"Configure the maximum number of prefixes that will be "Configure the maximum number of prefixes that will be
accepted from a peer"; accepted from a peer";
container config { container config {
description description
"Configuration parameters relating to the prefix "Configuration parameters relating to the prefix
limit for the AFI-SAFI"; limit for the AFI-SAFI";
uses all-afi-safi-common-prefix-limit_config; uses bgp-common-mp-all-afi-safi-common-prefix-limit-config;
} }
container state { container state {
config false; config false;
description description
"State information relating to the prefix-limit for the "State information relating to the prefix-limit for the
AFI-SAFI"; AFI-SAFI";
uses all-afi-safi-common-prefix-limit_config; uses bgp-common-mp-all-afi-safi-common-prefix-limit-config;
} }
} }
} }
grouping ipv4-ipv6-unicast-common {
grouping bgp-common-mp-ipv4-ipv6-unicast-common {
description description
"Common configuration that is applicable for IPv4 and IPv6 "Common configuration that is applicable for IPv4 and IPv6
unicast"; unicast";
// include common afi-safi options. // include common afi-safi options.
uses all-afi-safi-common; uses bgp-common-mp-all-afi-safi-common;
// configuration options that are specific to IPv[46] unicast // configuration options that are specific to IPv[46] unicast
container config { container config {
description description
"Configuration parameters for common IPv4 and IPv6 unicast "Configuration parameters for common IPv4 and IPv6 unicast
AFI-SAFI options"; AFI-SAFI options";
uses ipv4-ipv6-unicast-common_config; uses bgp-common-mp-ipv4-ipv6-unicast-common-config;
} }
container state { container state {
config false; config false;
description description
"State information for common IPv4 and IPv6 unicast "State information for common IPv4 and IPv6 unicast
parameters"; parameters";
uses ipv4-ipv6-unicast-common_config; uses bgp-common-mp-ipv4-ipv6-unicast-common-config;
} }
} }
grouping l3vpn-ipv4-ipv6-unicast-common {
grouping bgp-common-mp-l3vpn-ipv4-ipv6-unicast-common {
description description
"Common configuration applied across L3VPN for IPv4 "Common configuration applied across L3VPN for IPv4
and IPv6"; and IPv6";
// placeholder -- specific configuration options that are generic // placeholder -- specific configuration options that are generic
// across IPv[46] unicast address families. // across IPv[46] unicast address families.
uses all-afi-safi-common; uses bgp-common-mp-all-afi-safi-common;
} }
grouping l3vpn-ipv4-ipv6-multicast-common {
grouping bgp-common-mp-l3vpn-ipv4-ipv6-multicast-common {
description description
"Common configuration applied across L3VPN for IPv4 "Common configuration applied across L3VPN for IPv4
and IPv6"; and IPv6";
// placeholder -- specific configuration options that are // placeholder -- specific configuration options that are
// generic across IPv[46] multicast address families. // generic across IPv[46] multicast address families.
uses all-afi-safi-common; uses bgp-common-mp-all-afi-safi-common;
} }
grouping l2vpn-common {
grouping bgp-common-mp-l2vpn-common {
description description
"Common configuration applied across L2VPN address "Common configuration applied across L2VPN address
families"; families";
// placeholder -- specific configuration options that are // placeholder -- specific configuration options that are
// generic across L2VPN address families // generic across L2VPN address families
uses all-afi-safi-common; uses bgp-common-mp-all-afi-safi-common;
} }
grouping bgp-route-selection-options {
// Config groupings for common groups
grouping bgp-common-mp-all-afi-safi-common-prefix-limit-config {
description description
"Parameters relating to the BGP route selection process"; "Configuration parameters relating to prefix-limits for an
container route-selection-options { AFI-SAFI";
leaf max-prefixes {
type uint32;
description description
"Parameters relating to options for route selection"; "Maximum number of prefixes that will be accepted
container config { from the neighbour";
description }
"Configuration parameters relating to route selection leaf shutdown-threshold-pct {
options"; type oc-types:percentage;
uses bgp-route-selection-options_config; description
} "Threshold on number of prefixes that can be received
container state { from a neighbour before generation of warning messages
config false; or log entries. Expressed as a percentage of
description max-prefixes";
"State information for the route selection options"; }
uses bgp-route-selection-options_config;
leaf restart-timer {
type decimal64 {
fraction-digits 2;
} }
units "seconds";
description
"Time interval in seconds after which the BGP session
is re-established after being torn down due to exceeding
the max-prefix limit.";
} }
} }
// *********** STRUCTURE GROUPINGS **********************
grouping bgp-global-afi-safi { grouping bgp-common-mp-ipv4-ipv6-unicast-common-config {
description
"Parameters and route selection options for MP-BGP
specific to the Global AFI-SAFI";
uses bgp-route-selection-options;
}
grouping bgp-group-afi-safi {
description
"Parameters and route selection options for MP-BGP
specific to peer groups";
uses bgp-route-selection-options;
}
grouping bgp-common-afi-safi-list {
description description
"List of address-families associated with the BGP instance, "Common configuration parameters for IPv4 and IPv6 Unicast
a peer-group or neighbor"; address families";
list afi-safi {
key "afi-safi-name";
description
"AFI,SAFI configuration available for the
neighbour or group";
leaf afi-safi-name {
type leafref {
path "../config/afi-safi-name";
}
description
"Reference to the AFI-SAFI name used as a key
for the AFI-SAFI list";
}
container graceful-restart {
description
"Parameters relating to BGP graceful-restart";
container config {
description
"Configuration options for BGP graceful-restart";
uses bgp-afi-safi-graceful-restart_config;
}
container state {
config false;
description
"State information for BGP graceful-restart";
uses bgp-afi-safi-graceful-restart_config;
}
}
container config {
description
"Configuration parameters for the AFI-SAFI";
uses bgp-afi-safi_config; leaf send-default-route {
} type boolean;
container state { default "false";
config false; description
description "If set to true, send the default-route to the neighbour(s)";
"State information relating to the AFI-SAFI";
uses bgp-afi-safi_config;
uses bgp-op:bgp-afi-safi_state;
}
// import and export policy included for the afi/safi
uses rpol:apply-policy-group;
uses ipv4-unicast-group;
uses ipv6-unicast-group;
uses ipv4-labelled-unicast-group;
uses ipv6-labelled-unicast-group;
uses l3vpn-ipv4-unicast-group;
uses l3vpn-ipv6-unicast-group;
uses l3vpn-ipv4-multicast-group;
uses l3vpn-ipv6-multicast-group;
uses l2vpn-vpls-group;
uses l2vpn-evpn-group;
} }
} }
} }
<CODE ENDS> <CODE ENDS>
6.5. BGP operational data items <CODE BEGINS> file "ietf-bgp-common-structure.yang"
<CODE BEGINS> file "ietf-bgp-operational.yang" submodule ietf-bgp-common-structure {
module ietf-bgp-operational {
yang-version "1";
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-operational"; belongs-to ietf-bgp {
prefix "bgp-op"; prefix "bgp";
// import some basic inet types }
import openconfig-extensions { prefix oc-ext; }
include ietf-bgp-common-multiprotocol;
include ietf-bgp-common;
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This sub-module contains groupings that are common across multiple BGP
contexts and provide structure around other primitive groupings.";
oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description
"OpenConfig BGP refactor";
reference "2.1.1";
}
grouping bgp-common-structure-neighbor-group-logging-options {
description
"Structural grouping used to include error handling configuration and
state for both BGP neighbors and groups";
container logging-options {
description
"Logging options for events related to the BGP neighbor or
group";
container config {
description
"Configuration parameters enabling or modifying logging
for events relating to the BGPgroup";
uses bgp-common-neighbor-group-logging-options-config;
}
container state {
config false;
description
"State information relating to logging for the BGP neighbor
or group";
uses bgp-common-neighbor-group-logging-options-config;
}
}
}
grouping bgp-common-structure-neighbor-group-ebgp-multihop {
description
"Structural grouping used to include eBGP multihop configuration and
state for both BGP neighbors and peer groups";
container ebgp-multihop {
description
"eBGP multi-hop parameters for the BGPgroup";
container config {
description
"Configuration parameters relating to eBGP multihop for the
BGP group";
uses bgp-common-neighbor-group-multihop-config;
}
container state {
config false;
description
"State information for eBGP multihop, for the BGP neighbor
or group";
uses bgp-common-neighbor-group-multihop-config;
}
}
}
grouping bgp-common-structure-neighbor-group-route-reflector {
description
"Structural grouping used to include route reflector configuration and
state for both BGP neighbors and peer groups";
container route-reflector {
description
"Route reflector parameters for the BGPgroup";
container config {
description
"Configuraton parameters relating to route reflection
for the BGPgroup";
uses bgp-common-neighbor-group-route-reflector-config;
}
container state {
config false;
description
"State information relating to route reflection for the
BGPgroup";
uses bgp-common-neighbor-group-route-reflector-config;
}
}
}
grouping bgp-common-structure-neighbor-group-as-path-options {
description
"Structural grouping used to include AS_PATH manipulation configuration
and state for both BGP neighbors and peer groups";
container as-path-options {
description
"AS_PATH manipulation parameters for the BGP neighbor or
group";
container config {
description
"Configuration parameters relating to AS_PATH manipulation
for the BGP peer or group";
uses bgp-common-neighbor-group-as-path-options-config;
}
container state {
config false;
description
"State information relating to the AS_PATH manipulation
mechanisms for the BGP peer or group";
uses bgp-common-neighbor-group-as-path-options-config;
}
}
}
grouping bgp-common-structure-neighbor-group-add-paths {
description
"Structural grouping used to include ADD-PATHs configuration and state
for both BGP neighbors and peer groups";
container add-paths {
description
"Parameters relating to the advertisement and receipt of
multiple paths for a single NLRI (add-paths)";
container config {
description
"Configuration parameters relating to ADD_PATHS";
uses bgp-common-neighbor-group-add-paths-config;
}
container state {
config false;
description
"State information associated with ADD_PATHS";
uses bgp-common-neighbor-group-add-paths-config;
}
}
}
}
<CODE ENDS>
<CODE BEGINS> file "ietf-bgp-peer-group.yang"
submodule ietf-bgp-peer-group {
belongs-to ietf-bgp {
prefix "bgp";
}
import openconfig-extensions { prefix oc-ext; }
import ietf-routing-policy { prefix rpol; }
// Include the common submodule
include ietf-bgp-common;
include ietf-bgp-common-multiprotocol;
include ietf-bgp-common-structure;
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This sub-module contains groupings that are specific to the
peer-group context of the OpenConfig BGP module.";
oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description
"OpenConfig BGP refactor";
reference "2.1.1";
}
grouping bgp-peer-group-config {
description
"Configuration parameters relating to a base BGP peer group that
are not also applicable to any other context (e.g., neighbor)";
leaf peer-group-name {
type string;
description
"Name of the BGP peer-group";
}
}
grouping bgp-peer-group-afi-safi-list {
description
"List of address-families associated with the BGP peer-group";
list afi-safi {
key "afi-safi-name";
description
"AFI,SAFI configuration available for the
neighbour or group";
leaf afi-safi-name {
type leafref {
path "../config/afi-safi-name";
}
description
"Reference to the AFI-SAFI name used as a key
for the AFI-SAFI list";
}
container config {
description
"Configuration parameters for the AFI-SAFI";
uses bgp-common-mp-afi-safi-config;
}
container state {
config false;
description
"State information relating to the AFI-SAFI";
uses bgp-common-mp-afi-safi-config;
}
container graceful-restart {
description
"Parameters relating to BGP graceful-restart";
container config {
description
"Configuration options for BGP graceful-restart";
uses bgp-common-mp-afi-safi-graceful-restart-config;
}
container state {
config false;
description
"State information for BGP graceful-restart";
uses bgp-common-mp-afi-safi-graceful-restart-config;
}
}
uses bgp-common-route-selection-options;
uses bgp-common-global-group-use-multiple-paths;
uses bgp-common-mp-all-afi-safi-list-contents;
}
}
grouping bgp-peer-group-base {
description
"Parameters related to a BGP group";
container config {
description
"Configuration parameters relating to the BGP neighbor or
group";
uses bgp-peer-group-config;
uses bgp-common-neighbor-group-config;
}
container state {
config false;
description
"State information relating to the BGP peer-group";
uses bgp-peer-group-config;
uses bgp-common-neighbor-group-config;
uses bgp-common-state;
}
container timers {
description
"Timers related to a BGP peer-group";
container config {
description
"Configuration parameters relating to timers used for the
BGP neighbor or peer group";
uses bgp-common-neighbor-group-timers-config;
}
container state {
config false;
description
"State information relating to the timers used for the BGP
group";
uses bgp-common-neighbor-group-timers-config;
}
}
container transport {
description
"Transport session parameters for the BGP peer-group";
container config {
description
"Configuration parameters relating to the transport
session(s) used for the BGP neighbor or group";
uses bgp-common-neighbor-group-transport-config;
}
container state {
config false;
description
"State information relating to the transport session(s)
used for the BGP neighbor or group";
uses bgp-common-neighbor-group-transport-config;
}
}
container error-handling {
description
"Error handling parameters used for the BGP peer-group";
container config {
description
"Configuration parameters enabling or modifying the
behavior or enhanced error handling mechanisms for the BGP
group";
uses bgp-common-neighbor-group-error-handling-config;
}
container state {
config false;
description
"State information relating to enhanced error handling
mechanisms for the BGP group";
uses bgp-common-neighbor-group-error-handling-config;
}
}
container graceful-restart {
description
"Parameters relating the graceful restart mechanism for BGP";
container config {
description
"Configuration parameters relating to graceful-restart";
uses bgp-common-graceful-restart-config;
}
container state {
config false;
description
"State information associated with graceful-restart";
uses bgp-common-graceful-restart-config;
}
}
uses bgp-common-structure-neighbor-group-logging-options;
uses bgp-common-structure-neighbor-group-ebgp-multihop;
uses bgp-common-structure-neighbor-group-route-reflector;
uses bgp-common-structure-neighbor-group-as-path-options;
uses bgp-common-structure-neighbor-group-add-paths;
uses bgp-common-global-group-use-multiple-paths;
uses rpol:apply-policy-group;
container afi-safis {
description
"Per-address-family configuration parameters associated with
thegroup";
uses bgp-peer-group-afi-safi-list;
}
}
grouping bgp-peer-group-list {
description
"The list of BGP peer groups";
list peer-group {
key "peer-group-name";
description
"List of BGP peer-groups configured on the local system -
uniquely identified by peer-group name";
leaf peer-group-name {
type leafref {
path "../config/peer-group-name";
}
description
"Reference to the name of the BGP peer-group used as a
key in the peer-group list";
}
uses bgp-peer-group-base;
}
}
}
<CODE ENDS>
<CODE BEGINS> file "ietf-bgp-neighbor.yang"
submodule ietf-bgp-neighbor {
belongs-to ietf-bgp {
prefix "bgp";
}
import openconfig-extensions { prefix oc-ext; }
import ietf-routing-policy { prefix rpol; }
import openconfig-types { prefix oc-types; }
import ietf-bgp-types { prefix oc-bgp-types; }
import ietf-inet-types { prefix inet; } import ietf-inet-types { prefix inet; }
import ietf-yang-types { prefix yang; } import ietf-yang-types { prefix yang; }
import ietf-bgp-types { prefix bgp-types; }
// Include the common submodule
include ietf-bgp-common;
include ietf-bgp-common-multiprotocol;
include ietf-bgp-peer-group;
include ietf-bgp-common-structure;
// meta // meta
organization organization
"OpenConfig working group"; "OpenConfig working group";
contact contact
"OpenConfig working group "OpenConfig working group
netopenconfig@googlegroups.com"; netopenconfig@googlegroups.com";
description description
"This module is part of a YANG model for BGP protocol "This sub-module contains groupings that are specific to the
configuration, focusing on operational data (i.e., state neighbor context of the OpenConfig BGP module.";
variables) related to BGP operations";
revision "2016-01-06" { oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description description
"Updated filename and namespace"; "OpenConfig BGP refactor";
reference "TBD"; reference "2.1.1";
} }
// extension statements
// feature statements grouping bgp-neighbor-config {
// identity statements
// typedef statements
// grouping statements
grouping bgp-counters-message-types_common {
description description
"Grouping of BGP message types, included for re-use "Configuration parameters relating to a base BGP neighbor that
across counters"; are not also applicable to any other context
leaf UPDATE { (e.g., peer group)";
type uint64;
leaf peer-group {
type leafref {
path "../../../../peer-groups/peer-group/peer-group-name";
}
description description
"Number of BGP UPDATE messages announcing, withdrawing "The peer-group with which this neighbor is associated";
or modifying paths exchanged.";
} }
leaf NOTIFICATION {
type uint64; leaf neighbor-address {
description type inet:ip-address;
"Number of BGP NOTIFICATION messages indicating an description
error condition has occurred exchanged."; "Address of the BGP peer, either in IPv4 or IPv6";
}
leaf enabled {
type boolean;
default true;
description
"Whether the BGP peer is enabled. In cases where the
enabled leaf is set to false, the local system should not
initiate connections to the neighbor, and should not
respond to TCP connections attempts from the neighbor. If
the state of the BGP session is ESTABLISHED at the time
that this leaf is set to false, the BGP session should be
ceased.";
} }
} }
grouping bgp-context-pfx-path-counters_common {
grouping bgp-neighbor-use-multiple-paths {
description description
"Grouping containing common counters relating to prefixes and "Multipath configuration and state applicable to a BGP
paths"; neighbor";
leaf total-paths {
type uint32; container use-multiple-paths {
description
"Total number of BGP paths within the context";
}
leaf total-prefixes {
type uint32;
description description
""; "Parameters related to the use of multiple-paths for the same
NLRI when they are received only from this neighbor";
container config {
description
"Configuration parameters relating to multipath";
uses bgp-common-use-multiple-paths-config;
}
container state {
config false;
description
"State parameters relating to multipath";
uses bgp-common-use-multiple-paths-config;
}
container ebgp {
description
"Multipath configuration for eBGP";
container config {
description
"Configuration parameters relating to eBGP multipath";
uses bgp-common-use-multiple-paths-ebgp-as-options-config;
}
container state {
config false;
description
"State information relating to eBGP multipath";
uses bgp-common-use-multiple-paths-ebgp-as-options-config;
}
}
} }
} }
grouping bgp-global_state {
description
"Grouping containing operational parameters relating to the
global BGP instance";
uses bgp-context-pfx-path-counters_common;
} grouping bgp-neighbor-state {
grouping bgp-global-afi-safi_state {
description
"Grouping containing operational parameters relating to each
AFI-SAFI within the BGP global instance";
uses bgp-context-pfx-path-counters_common;
}
grouping bgp-peer-group_state {
description
"Grouping containing operational parameters relating to a BGP
peer group";
uses bgp-context-pfx-path-counters_common;
}
grouping bgp-neighbor_state {
description description
"Grouping containing operational state variables relating to a "Operational state parameters relating only to a BGP neighbor";
BGP neighbor";
leaf session-state { leaf session-state {
type enumeration { type enumeration {
enum IDLE { enum IDLE {
description description
"neighbor is down, and in the Idle state of the "neighbor is down, and in the Idle state of the
FSM"; FSM";
} }
enum CONNECT { enum CONNECT {
description description
"neighbor is down, and the session is waiting for "neighbor is down, and the session is waiting for
skipping to change at page 59, line 10 skipping to change at page 45, line 22
} }
enum ESTABLISHED { enum ESTABLISHED {
description description
"neighbor is up - the BGP session with the peer is "neighbor is up - the BGP session with the peer is
established"; established";
} }
} }
description description
"Operational state of the BGP peer"; "Operational state of the BGP peer";
} }
leaf last-established {
type oc-types:timeticks64;
description
"This timestamp indicates the time that the
BGP session last transitioned in or out of the Established
state. The value is the timestamp in seconds relative to
the Unix Epoch (Jan 1, 1970 00:00:00 UTC).
The BGP session uptime can be computed by clients as the
difference between this value and the current time in UTC
(assuming the session is in the ESTABLISHED state, per the
session-state leaf).";
}
leaf established-transitions {
type yang:counter64;
description
"Number of transitions to the Established state for
the neighbor session. This value is analogous to the
bgpPeerFsmEstablishedTransitions object from the standard
BGP-4 MIB";
reference
"RFC 4273 - Definitions of Managed Objects for BGP-4";
}
leaf-list supported-capabilities { leaf-list supported-capabilities {
type identityref { type identityref {
base bgp-types:bgp-capability; base oc-bgp-types:BGP_CAPABILITY;
} }
description description
"BGP capabilities negotiated as supported with the peer"; "BGP capabilities negotiated as supported with the peer";
} }
}
grouping bgp-neighbor-afi-safi_state { container messages {
description
"Operational state on a per-AFI-SAFI basis for a BGP
neighbor";
leaf active {
type boolean;
description description
"This value indicates whether a particular AFI-SAFI has "Counters for BGP messages sent and received from the
been succesfully negotiated with the peer. An AFI-SAFI neighbor";
may be enabled in the current running configuration, but a container sent {
session restart may be required in order to negotiate the new
capability.";
}
uses bgp-neighbor-prefix-counters_state;
}
grouping bgp-neighbor-prefix-counters_state {
description
"Counters for BGP neighbor sessions";
container prefixes {
description "Prefix counters for the BGP session";
leaf received {
type uint32;
description
"The number of prefixes received from the neighbor";
}
leaf sent {
type uint32;
description description
"The number of prefixes advertised to the neighbor"; "Counters relating to BGP messages sent to the neighbor";
} uses bgp-neighbor-counters-message-types-state;
leaf installed { }
type uint32;
container received {
description description
"The number of advertised prefixes installed in the "Counters for BGP messages received from the neighbor";
Loc-RIB"; uses bgp-neighbor-counters-message-types-state;
} }
} }
container queues {
description
"Counters related to queued messages associated with the
BGP neighbor";
uses bgp-neighbor-queue-counters-state;
}
} }
grouping bgp-neighbor-message-counters-sent_state {
description grouping bgp-neighbor-counters-message-types-state {
"Counters relating to messages sent to a BGP neighbor";
uses bgp-counters-message-types_common;
}
grouping bgp-neighbor-message-counters-received_state {
description description
"Counters relating to the mesages received from a BGP "Grouping of BGP message types, included for re-use
neighbor"; across counters";
uses bgp-counters-message-types_common;
leaf UPDATE {
type uint64;
description
"Number of BGP UPDATE messages announcing, withdrawing
or modifying paths exchanged.";
}
leaf NOTIFICATION {
type uint64;
description
"Number of BGP NOTIFICATION messages indicating an
error condition has occurred exchanged.";
}
} }
grouping bgp-neighbor-queue-counters_state { grouping bgp-neighbor-queue-counters-state {
description description
"Counters relating to the message queues associated with the "Counters relating to the message queues associated with the
BGP peer"; BGP peer";
leaf input { leaf input {
type uint32; type uint32;
description description
"The number of messages received from the peer currently "The number of messages received from the peer currently
queued"; queued";
} }
leaf output { leaf output {
type uint32; type uint32;
description description
"The number of messages queued to be sent to the peer"; "The number of messages queued to be sent to the peer";
} }
} }
grouping bgp-neighbor-transport_state {
grouping bgp-neighbor-transport-state {
description description
"Operational state parameters relating to the transport session "Operational state parameters relating to the transport session
used for the BGP session"; used for the BGP session";
leaf local-port { leaf local-port {
type inet:port-number; type inet:port-number;
description description
"Local TCP port being used for the TCP session supporting "Local TCP port being used for the TCP session supporting
the BGP session"; the BGP session";
} }
leaf remote-address { leaf remote-address {
type inet:ip-address; type inet:ip-address;
description description
"Remote port being used by the peer for the TCP session "Remote address to which the BGP session has been
supporting the BGP session"; established";
} }
leaf remote-port { leaf remote-port {
type inet:port-number; type inet:port-number;
description description
"Remote address to which the BGP session has been "Remote port being used by the peer for the TCP session
established"; supporting the BGP session";
} }
} }
grouping bgp-neighbor-error-handling_state {
grouping bgp-neighbor-error-handling-state {
description description
"Operational state parameters relating to enhanced error "Operational state parameters relating to enhanced error
error handling for BGP"; error handling for BGP";
leaf erroneous-update-messages { leaf erroneous-update-messages {
type uint32; type uint32;
description description
"The number of BGP UPDATE messages for which the "The number of BGP UPDATE messages for which the
treat-as-withdraw mechanism has been applied based treat-as-withdraw mechanism has been applied based
on erroneous message contents"; on erroneous message contents";
} }
} }
grouping bgp-neighbor-timers_state {
grouping bgp-neighbor-timers-state {
description description
"Operational state parameters relating to BGP timers associated "Operational state parameters relating to BGP timers associated
with the BGP session"; with the BGP session";
leaf uptime {
type yang:timeticks;
description
"This timer determines the amount of time since the
BGP last transitioned in or out of the Established
state";
}
leaf negotiated-hold-time { leaf negotiated-hold-time {
type decimal64 { type decimal64 {
fraction-digits 2; fraction-digits 2;
} }
description description
"The negotiated hold-time for the BGP session"; "The negotiated hold-time for the BGP session";
} }
} }
grouping bgp-afi-safi_state {
grouping bgp-neighbor-afi-safi-graceful-restart-state {
description description
"Operational state information relevant to all address "Operational state variables relating to the graceful-restart
families that may be carried by the BGP session"; mechanism on a per-AFI-SAFI basis";
// placeholder - options in this container are
// valid in both the global and per-neighbor leaf received {
// paths type boolean;
description
"This leaf indicates whether the neighbor advertised the
ability to support graceful-restart for this AFI-SAFI";
}
leaf advertised {
type boolean;
description
"This leaf indicates whether the ability to support
graceful-restart has been advertised to the peer";
}
} }
grouping bgp-afi-safi-graceful-restart_state {
grouping bgp-neighbor-graceful-restart-state {
description description
"Operational state information relevant to graceful restart "Operational state information relevant to graceful restart
for BGP"; for BGP";
leaf peer-restart-time { leaf peer-restart-time {
type uint16 { type uint16 {
range 0..4096; range 0..4096;
} }
description description
"The period of time (advertised by the peer) that "The period of time (advertised by the peer) that
the peer expects a restart of a BGP session to the peer expects a restart of a BGP session to
take"; take";
} }
leaf peer-restarting { leaf peer-restarting {
type boolean; type boolean;
description description
"This flag indicates whether the remote neighbor is currently "This flag indicates whether the remote neighbor is currently
in the process of restarting, and hence received routes are in the process of restarting, and hence received routes are
currently stale"; currently stale";
} }
leaf local-restarting { leaf local-restarting {
type boolean; type boolean;
description description
"This flag indicates whether the local neighbor is currently "This flag indicates whether the local neighbor is currently
restarting. The flag is unset after all NLRI have been restarting. The flag is unset after all NLRI have been
advertised to the peer, and the End-of-RIB (EOR) marker has advertised to the peer, and the End-of-RIB (EOR) marker has
been unset"; been unset";
} }
leaf mode { leaf mode {
type enumeration { type enumeration {
enum HELPER-ONLY { enum HELPER_ONLY {
description description
"The local router is operating in helper-only mode, and "The local router is operating in helper-only mode, and
hence will not retain forwarding state during a local hence will not retain forwarding state during a local
session restart, but will do so during a restart of the session restart, but will do so during a restart of the
remote peer"; remote peer";
} }
enum BILATERAL { enum BILATERAL {
description description
"The local router is operating in both helper mode, and "The local router is operating in both helper mode, and
hence retains forwarding state during a remote restart, hence retains forwarding state during a remote restart,
and also maintains forwarding state during local session and also maintains forwarding state during local session
restart"; restart";
} }
enum REMOTE-HELPER { enum REMOTE_HELPER {
description description
"The local system is able to retain routes during restart "The local system is able to retain routes during restart
but the remote system is only able to act as a helper"; but the remote system is only able to act as a helper";
} }
} }
description description
"Ths leaf indicates the mode of operation of BGP graceful "Ths leaf indicates the mode of operation of BGP graceful
restart with the peer"; restart with the peer";
} }
} }
grouping bgp-neighbor-afi-safi-graceful-restart_state {
grouping bgp-neighbor-afi-safi-state {
description description
"Operational state variables relating to the graceful-restart "Operational state parameters relating to an individual AFI,
mechanism on a per-AFI-SAFI basis"; SAFI for a neighbor";
leaf received {
leaf active {
type boolean; type boolean;
description description
"This leaf indicates whether the neighbor advertised the "This value indicates whether a particular AFI-SAFI has
ability to support graceful-restart for this AFI-SAFI"; been succesfully negotiated with the peer. An AFI-SAFI
may be enabled in the current running configuration, but a
session restart may be required in order to negotiate the new
capability.";
} }
leaf advertised {
container prefixes {
description "Prefix counters for the BGP session";
leaf received {
type uint32;
description
"The number of prefixes received from the neighbor";
}
leaf sent {
type uint32;
description
"The number of prefixes advertised to the neighbor";
}
leaf installed {
type uint32;
description
"The number of advertised prefixes installed in the
Loc-RIB";
}
}
}
grouping bgp-neighbor-afi-safi-list {
description
"List of address-families associated with the BGP neighbor";
list afi-safi {
key "afi-safi-name";
description
"AFI,SAFI configuration available for the
neighbour or group";
leaf afi-safi-name {
type leafref {
path "../config/afi-safi-name";
}
description
"Reference to the AFI-SAFI name used as a key
for the AFI-SAFI list";
}
container config {
description
"Configuration parameters for the AFI-SAFI";
uses bgp-common-mp-afi-safi-config;
}
container state {
config false;
description
"State information relating to the AFI-SAFI";
uses bgp-common-mp-afi-safi-config;
uses bgp-neighbor-afi-safi-state;
}
container graceful-restart {
description
"Parameters relating to BGP graceful-restart";
container config {
description
"Configuration options for BGP graceful-restart";
uses bgp-common-mp-afi-safi-graceful-restart-config;
}
container state {
config false;
description
"State information for BGP graceful-restart";
uses bgp-common-mp-afi-safi-graceful-restart-config;
uses bgp-neighbor-afi-safi-graceful-restart-state;
}
}
uses bgp-common-mp-all-afi-safi-list-contents;
uses bgp-neighbor-use-multiple-paths;
}
}
grouping bgp-neighbor-base {
description
"Parameters related to a BGP neighbor";
container config {
description
"Configuration parameters relating to the BGP neighbor or
group";
uses bgp-neighbor-config;
uses bgp-common-neighbor-group-config;
}
container state {
config false;
description
"State information relating to the BGP neighbor";
uses bgp-neighbor-config;
uses bgp-common-neighbor-group-config;
uses bgp-neighbor-state;
}
container timers {
description
"Timers related to a BGP neighbor";
container config {
description
"Configuration parameters relating to timers used for the
BGP neighbor";
uses bgp-common-neighbor-group-timers-config;
}
container state {
config false;
description
"State information relating to the timers used for the BGP
neighbor";
uses bgp-common-neighbor-group-timers-config;
uses bgp-neighbor-timers-state;
}
}
container transport {
description
"Transport session parameters for the BGP neighbor";
container config {
description
"Configuration parameters relating to the transport
session(s) used for the BGP neighbor";
uses bgp-common-neighbor-group-transport-config;
}
container state {
config false;
description
"State information relating to the transport session(s)
used for the BGP neighbor";
uses bgp-common-neighbor-group-transport-config;
uses bgp-neighbor-transport-state;
}
}
container error-handling {
description
"Error handling parameters used for the BGP neighbor or
group";
container config {
description
"Configuration parameters enabling or modifying the
behavior or enhanced error handling mechanisms for the BGP
neighbor";
uses bgp-common-neighbor-group-error-handling-config;
}
container state {
config false;
description
"State information relating to enhanced error handling
mechanisms for the BGP neighbor";
uses bgp-common-neighbor-group-error-handling-config;
uses bgp-neighbor-error-handling-state;
}
}
container graceful-restart {
description
"Parameters relating the graceful restart mechanism for BGP";
container config {
description
"Configuration parameters relating to graceful-restart";
uses bgp-common-graceful-restart-config;
}
container state {
config false;
description
"State information associated with graceful-restart";
uses bgp-common-graceful-restart-config;
uses bgp-neighbor-graceful-restart-state;
}
}
uses bgp-common-structure-neighbor-group-logging-options;
uses bgp-common-structure-neighbor-group-ebgp-multihop;
uses bgp-common-structure-neighbor-group-route-reflector;
uses bgp-common-structure-neighbor-group-as-path-options;
uses bgp-common-structure-neighbor-group-add-paths;
uses bgp-neighbor-use-multiple-paths;
uses rpol:apply-policy-group;
container afi-safis {
description
"Per-address-family configuration parameters associated with
the neighbor";
uses bgp-neighbor-afi-safi-list;
}
}
grouping bgp-neighbor-list {
description
"The list of BGP neighbors";
list neighbor {
key "neighbor-address";
description
"List of BGP neighbors configured on the local system,
uniquely identified by peer IPv[46] address";
leaf neighbor-address {
type leafref {
path "../config/neighbor-address";
}
description
"Reference to the address of the BGP neighbor used as
a key in the neighbor list";
}
uses bgp-neighbor-base;
}
}
}
<CODE ENDS>
<CODE BEGINS> file "ietf-bgp-global.yang"
submodule ietf-bgp-global {
belongs-to ietf-bgp {
prefix "bgp";
}
import openconfig-extensions { prefix oc-ext; }
import ietf-inet-types { prefix inet; }
import ietf-yang-types { prefix yang; }
// Include common submodule
include ietf-bgp-common;
include ietf-bgp-common-multiprotocol;
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This sub-module contains groupings that are specific to the
global context of the OpenConfig BGP module";
oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description
"OpenConfig BGP refactor";
reference "2.1.1";
}
grouping bgp-global-config {
description
"Global configuration options for the BGP router.";
leaf as {
type inet:as-number;
mandatory true;
description
"Local autonomous system number of the router. Uses
the 32-bit as-number type from the model in RFC 6991.";
}
leaf router-id {
type yang:dotted-quad;
description
"Router id of the router - an unsigned 32-bit integer
expressed in dotted quad notation.";
reference
"RFC4271 - A Border Gateway Protocol 4 (BGP-4),
Section 4.2";
}
}
grouping bgp-global-state {
description
"Operational state parameters for the BGP neighbor";
uses bgp-common-state;
}
grouping bgp-global-default-route-distance-config {
description
"Configuration options relating to the administrative distance
(or preference) assigned to routes received from different
sources (external, internal, and local).";
leaf external-route-distance {
type uint8 {
range "1..255";
}
description
"Administrative distance for routes learned from external
BGP (eBGP).";
}
leaf internal-route-distance {
type uint8 {
range "1..255";
}
description
"Administrative distance for routes learned from internal
BGP (iBGP).";
}
}
grouping bgp-global-confederation-config {
description
"Configuration options specifying parameters when the local
router is within an autonomous system which is part of a BGP
confederation.";
leaf enabled {
type boolean; type boolean;
description description
"This leaf indicates whether the ability to support "When this leaf is set to true it indicates that
graceful-restart has been advertised to the peer"; the local-AS is part of a BGP confederation";
}
leaf identifier {
type inet:as-number;
description
"Confederation identifier for the autonomous system.";
}
leaf-list member-as {
type inet:as-number;
description
"Remote autonomous systems that are to be treated
as part of the local confederation.";
}
}
grouping bgp-global-afi-safi-list {
description
"List of address-families associated with the BGP instance";
list afi-safi {
key "afi-safi-name";
description
"AFI,SAFI configuration available for the
neighbour or group";
leaf afi-safi-name {
type leafref {
path "../config/afi-safi-name";
}
description
"Reference to the AFI-SAFI name used as a key
for the AFI-SAFI list";
}
container config {
description
"Configuration parameters for the AFI-SAFI";
uses bgp-common-mp-afi-safi-config;
}
container state {
config false;
description
"State information relating to the AFI-SAFI";
uses bgp-common-mp-afi-safi-config;
uses bgp-common-state;
}
container graceful-restart {
description
"Parameters relating to BGP graceful-restart";
container config {
description
"Configuration options for BGP graceful-restart";
uses bgp-common-mp-afi-safi-graceful-restart-config;
}
container state {
config false;
description
"State information for BGP graceful-restart";
uses bgp-common-mp-afi-safi-graceful-restart-config;
}
}
uses bgp-common-route-selection-options;
uses bgp-common-global-group-use-multiple-paths;
uses bgp-common-mp-all-afi-safi-list-contents;
}
}
// Structural groupings
grouping bgp-global-base {
description
"Global configuration parameters for the BGP router";
container config {
description
"Configuration parameters relating to the global BGP router";
uses bgp-global-config;
}
container state {
config false;
description
"State information relating to the global BGP router";
uses bgp-global-config;
uses bgp-global-state;
}
container default-route-distance {
description
"Administrative distance (or preference) assigned to
routes received from different sources
(external, internal, and local).";
container config {
description
"Configuration parameters relating to the default route
distance";
uses bgp-global-default-route-distance-config;
}
container state {
config false;
description
"State information relating to the default route distance";
uses bgp-global-default-route-distance-config;
}
}
container confederation {
description
"Parameters indicating whether the local system acts as part
of a BGP confederation";
container config {
description
"Configuration parameters relating to BGP confederations";
uses bgp-global-confederation-config;
}
container state {
config false;
description
"State information relating to the BGP confederations";
uses bgp-global-confederation-config;
}
}
container graceful-restart {
description
"Parameters relating the graceful restart mechanism for BGP";
container config {
description
"Configuration parameters relating to graceful-restart";
uses bgp-common-graceful-restart-config;
}
container state {
config false;
description
"State information associated with graceful-restart";
uses bgp-common-graceful-restart-config;
}
}
uses bgp-common-global-group-use-multiple-paths;
uses bgp-common-route-selection-options;
container afi-safis {
description
"Address family specific configuration";
uses bgp-global-afi-safi-list;
} }
} }
} }
<CODE ENDS> <CODE ENDS>
7. References 8. BGP types
7.1. Normative references <CODE BEGINS> file "ietf-bgp-types.yang"
module ietf-bgp-types {
yang-version "1";
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-types";
prefix "oc-bgp-types";
import ietf-inet-types { prefix inet; }
import openconfig-types { prefix oc-types; }
import openconfig-extensions { prefix oc-ext; }
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This module contains general data definitions for use in BGP
policy. It can be imported by modules that make use of BGP
attributes";
oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description
"OpenConfig BGP refactor";
reference "2.1.1";
}
identity BGP_CAPABILITY {
description "Base identity for a BGP capability";
}
identity MPBGP {
base BGP_CAPABILITY;
description
"Multi-protocol extensions to BGP";
reference "RFC2858";
}
identity ROUTE_REFRESH {
base BGP_CAPABILITY;
description
"The BGP route-refresh functionality";
reference "RFC2918";
}
identity ASN32 {
base BGP_CAPABILITY;
description
"4-byte (32-bit) AS number functionality";
reference "RFC6793";
}
identity GRACEFUL_RESTART {
base BGP_CAPABILITY;
description
"Graceful restart functionality";
reference "RFC4724";
}
identity ADD_PATHS {
base BGP_CAPABILITY;
description
"BGP add-paths";
reference "draft-ietf-idr-add-paths";
}
identity AFI_SAFI_TYPE {
description
"Base identity type for AFI,SAFI tuples for BGP-4";
reference "RFC4760 - multiprotocol extensions for BGP-4";
}
identity IPV4_UNICAST {
base AFI_SAFI_TYPE;
description
"IPv4 unicast (AFI,SAFI = 1,1)";
reference "RFC4760";
}
identity IPV6_UNICAST {
base AFI_SAFI_TYPE;
description
"IPv6 unicast (AFI,SAFI = 2,1)";
reference "RFC4760";
}
identity IPV4_LABELED_UNICAST {
base AFI_SAFI_TYPE;
description
"Labeled IPv4 unicast (AFI,SAFI = 1,4)";
reference "RFC3107";
}
identity IPV6_LABELED_UNICAST {
base AFI_SAFI_TYPE;
description
"Labeled IPv6 unicast (AFI,SAFI = 2,4)";
reference "RFC3107";
}
identity L3VPN_IPV4_UNICAST {
base AFI_SAFI_TYPE;
description
"Unicast IPv4 MPLS L3VPN (AFI,SAFI = 1,128)";
reference "RFC4364";
}
identity L3VPN_IPV6_UNICAST {
base AFI_SAFI_TYPE;
description
"Unicast IPv6 MPLS L3VPN (AFI,SAFI = 2,128)";
reference "RFC4659";
}
identity L3VPN_IPV4_MULTICAST {
base AFI_SAFI_TYPE;
description
"Multicast IPv4 MPLS L3VPN (AFI,SAFI = 1,129)";
reference "RFC6514";
}
identity L3VPN_IPV6_MULTICAST {
base AFI_SAFI_TYPE;
description
"Multicast IPv6 MPLS L3VPN (AFI,SAFI = 2,129)";
reference "RFC6514";
}
identity L2VPN_VPLS {
base AFI_SAFI_TYPE;
description
"BGP-signalled VPLS (AFI,SAFI = 25,65)";
reference "RFC4761";
}
identity L2VPN_EVPN {
base AFI_SAFI_TYPE;
description
"BGP MPLS Based Ethernet VPN (AFI,SAFI = 25,70)";
}
identity BGP_WELL_KNOWN_STD_COMMUNITY {
description
"Reserved communities within the standard community space
defined by RFC1997. These communities must fall within the
range 0x00000000 to 0xFFFFFFFF";
reference "RFC1997";
}
identity NO_EXPORT {
base BGP_WELL_KNOWN_STD_COMMUNITY;
description
"Do not export NLRI received carrying this community outside
the bounds of this autonomous system, or this confederation if
the local autonomous system is a confederation member AS. This
community has a value of 0xFFFFFF01.";
reference "RFC1997";
}
identity NO_ADVERTISE {
base BGP_WELL_KNOWN_STD_COMMUNITY;
description
"All NLRI received carrying this community must not be
advertised to other BGP peers. This community has a value of
0xFFFFFF02.";
reference "RFC1997";
}
identity NO_EXPORT_SUBCONFED {
base BGP_WELL_KNOWN_STD_COMMUNITY;
description
"All NLRI received carrying this community must not be
advertised to external BGP peers - including over confederation
sub-AS boundaries. This community has a value of 0xFFFFFF03.";
reference "RFC1997";
}
identity NOPEER {
base BGP_WELL_KNOWN_STD_COMMUNITY;
description
"An autonomous system receiving NLRI tagged with this community
is advised not to readvertise the NLRI to external bi-lateral
peer autonomous systems. An AS may also filter received NLRI
from bilateral peer sessions when they are tagged with this
community value";
reference "RFC3765";
}
typedef bgp-session-direction {
type enumeration {
enum INBOUND {
description
"Refers to all NLRI received from the BGP peer";
}
enum OUTBOUND {
description
"Refers to all NLRI advertised to the BGP peer";
}
}
description
"Type to describe the direction of NLRI transmission";
}
typedef bgp-well-known-community-type {
type identityref {
base BGP_WELL_KNOWN_STD_COMMUNITY;
}
description
"Type definition for well-known IETF community attribute
values";
reference
"IANA Border Gateway Protocol (BGP) Well Known Communities";
}
typedef bgp-std-community-type {
// TODO: further refine restrictions and allowed patterns
// 4-octet value:
// <as number> 2 octets
// <community value> 2 octets
type union {
type uint32 {
// per RFC 1997, 0x00000000 - 0x0000FFFF and 0xFFFF0000 -
// 0xFFFFFFFF are reserved
range "65536..4294901759"; // 0x00010000..0xFFFEFFFF
}
type string {
pattern '([0-9]+:[0-9]+)';
}
}
description
"Type definition for standard commmunity attributes";
reference "RFC 1997 - BGP Communities Attribute";
}
typedef bgp-ext-community-type {
// TODO: needs more work to make this more precise given the
// variability of extended community attribute specifications
// 8-octet value:
// <type> 2 octects
// <value> 6 octets
type union {
type string {
// Type 1: 2-octet global and 4-octet local
// (AS number) (Integer)
pattern '(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' +
'[1-9][0-9]{1,4}|[0-9]):' +
'(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' +
'[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])';
}
type string {
// Type 2: 4-octet global and 2-octet local
// (ipv4-address) (integer)
pattern '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
'25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' +
'2[0-4][0-9]|25[0-5]):' +
'(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' +
'[1-9][0-9]{1,4}|[0-9])';
}
type string {
// route-target with Type 1
// route-target:(ASN):(local-part)
pattern 'route\-target:(6[0-5][0-5][0-3][0-5]|' +
'[1-5][0-9]{4}|[1-9][0-9]{1,4}|[0-9]):' +
'(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' +
'[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])';
}
type string {
// route-target with Type 2
// route-target:(IPv4):(local-part)
pattern 'route\-target:' +
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
'25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' +
'2[0-4][0-9]|25[0-5]):' +
'(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' +
'[1-9][0-9]{1,4}|[0-9])';
}
type string {
// route-origin with Type 1
pattern 'route\-origin:(6[0-5][0-5][0-3][0-5]|' +
'[1-5][0-9]{4}|[1-9][0-9]{1,4}|[0-9]):' +
'(4[0-2][0-9][0-4][0-9][0-6][0-7][0-2][0-9][0-6]|' +
'[1-3][0-9]{9}|[1-9]([0-9]{1,7})?[0-9]|[1-9])';
}
type string {
// route-origin with Type 2
pattern 'route\-origin:' +
'(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
'25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|' +
'2[0-4][0-9]|25[0-5]):' +
'(6[0-5][0-5][0-3][0-5]|[1-5][0-9]{4}|' +
'[1-9][0-9]{1,4}|[0-9])';
}
}
description
"Type definition for extended community attributes";
reference "RFC 4360 - BGP Extended Communities Attribute";
}
typedef bgp-community-regexp-type {
// TODO: needs more work to decide what format these regexps can
// take.
type oc-types:std-regexp;
description
"Type definition for communities specified as regular
expression patterns";
}
typedef bgp-origin-attr-type {
type enumeration {
enum IGP {
description "Origin of the NLRI is internal";
}
enum EGP {
description "Origin of the NLRI is EGP";
}
enum INCOMPLETE {
description "Origin of the NLRI is neither IGP or EGP";
}
}
description
"Type definition for standard BGP origin attribute";
reference "RFC 4271 - A Border Gateway Protocol 4 (BGP-4),
Sec 4.3";
}
typedef peer-type {
type enumeration {
enum INTERNAL {
description "internal (iBGP) peer";
}
enum EXTERNAL {
description "external (eBGP) peer";
}
}
description
"labels a peer or peer group as explicitly internal or
external";
}
identity REMOVE_PRIVATE_AS_OPTION {
description
"Base identity for options for removing private autonomous
system numbers from the AS_PATH attribute";
}
identity PRIVATE_AS_REMOVE_ALL {
base REMOVE_PRIVATE_AS_OPTION;
description
"Strip all private autonmous system numbers from the AS_PATH.
This action is performed regardless of the other content of the
AS_PATH attribute, and for all instances of private AS numbers
within that attribute.";
}
identity PRIVATE_AS_REPLACE_ALL {
base REMOVE_PRIVATE_AS_OPTION;
description
"Replace all instances of private autonomous system numbers in
the AS_PATH with the local BGP speaker's autonomous system
number. This action is performed regardless of the other
content of the AS_PATH attribute, and for all instances of
private AS number within that attribute.";
}
typedef remove-private-as-option {
type identityref {
base REMOVE_PRIVATE_AS_OPTION;
}
description
"set of options for configuring how private AS path numbers
are removed from advertisements";
}
typedef percentage {
type uint8 {
range "0..100";
}
description
"Integer indicating a percentage value";
}
typedef rr-cluster-id-type {
type union {
type uint32;
type inet:ipv4-address;
}
description
"union type for route reflector cluster ids:
option 1: 4-byte number
option 2: IP address";
}
typedef community-type {
type enumeration {
enum STANDARD {
description "send only standard communities";
}
enum EXTENDED {
description "send only extended communities";
}
enum BOTH {
description "send both standard and extended communities";
}
enum NONE {
description "do not send any community attribute";
}
}
description
"type describing variations of community attributes:
STANDARD: standard BGP community [rfc1997]
EXTENDED: extended BGP community [rfc4360]
BOTH: both standard and extended community";
}
}
<CODE ENDS>
9. BGP policy data
<CODE BEGINS> file "ietf-bgp-policy.yang"
module ietf-bgp-policy {
yang-version "1";
// namespace
namespace "urn:ietf:params:xml:ns:yang:ietf-bgp-policy";
prefix "oc-bgp-pol";
// import some basic types
import ietf-inet-types { prefix inet; }
import ietf-routing-policy {prefix rpol; }
import openconfig-policy-types { prefix pol-types; }
import ietf-bgp-types { prefix oc-bgp-types; }
import openconfig-extensions { prefix oc-ext; }
// meta
organization
"OpenConfig working group";
contact
"OpenConfig working group
netopenconfig@googlegroups.com";
description
"This module contains data definitions for BGP routing policy.
It augments the base routing-policy module with BGP-specific
options for conditions and actions.";
oc-ext:openconfig-version "2.1.1";
revision "2016-06-21" {
description
"OpenConfig BGP refactor";
reference "2.1.1";
}
// typedef statements
typedef bgp-set-community-option-type {
type enumeration {
enum ADD {
description
"add the specified communities to the existing
community attribute";
}
enum REMOVE {
description
"remove the specified communities from the
existing community attribute";
}
enum REPLACE {
description
"replace the existing community attribute with
the specified communities. If an empty set is
specified, this removes the community attribute
from the route.";
}
}
description
"Type definition for options when setting the community
attribute in a policy action";
}
typedef bgp-next-hop-type {
type union {
type inet:ip-address-no-zone;
type enumeration {
enum SELF {
description "special designation for local router's own
address, i.e., next-hop-self";
}
}
}
description
"type definition for specifying next-hop in policy actions";
}
typedef bgp-set-med-type {
type union {
type uint32;
type string {
pattern "^[+-][0-9]+";
}
type enumeration {
enum IGP {
description "set the MED value to the IGP cost toward the
next hop for the route";
}
}
}
description
"Type definition for specifying how the BGP MED can
be set in BGP policy actions. The three choices are to set
the MED directly, increment/decrement using +/- notation,
and setting it to the IGP cost (predefined value).";
}
// grouping statements
grouping match-community-config {
description
"Configuration data for match conditions on communities";
leaf community-set {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"oc-bgp-pol:bgp-defined-sets/oc-bgp-pol:community-sets/" +
"oc-bgp-pol:community-set/oc-bgp-pol:community-set-name";
}
description
"References a defined community set";
}
uses rpol:match-set-options-group;
}
grouping match-community-state {
description
"Operational state data for match conditions on communities";
}
grouping match-community-top {
description
"Top-level grouping for match conditions on communities";
container match-community-set {
description
"Top-level container for match conditions on communities.
Match a referenced community-set according to the logic
defined in the match-set-options leaf";
container config {
description
"Configuration data for match conditions on communities";
uses match-community-config;
}
container state {
config false;
description
"Operational state data ";
uses match-community-config;
uses match-community-state;
}
}
}
grouping match-ext-community-config {
description
"Configuration data for match conditions on extended
communities";
leaf ext-community-set {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"oc-bgp-pol:bgp-defined-sets/oc-bgp-pol:ext-community-sets/" +
"oc-bgp-pol:ext-community-set/" +
"oc-bgp-pol:ext-community-set-name";
}
description "References a defined extended community set";
}
uses rpol:match-set-options-group;
}
grouping match-ext-community-state {
description
"Operational state data for match conditions on extended
communities";
}
grouping match-ext-community-top {
description
"Top-level grouping for match conditions on extended
communities";
container match-ext-community-set {
description
"Match a referenced extended community-set according to the
logic defined in the match-set-options leaf";
container config {
description
"Configuration data for match conditions on extended
communities";
uses match-ext-community-config;
}
container state {
config false;
description
"Operational state data for match conditions on extended
communities";
uses match-ext-community-config;
uses match-ext-community-state;
}
}
}
grouping match-as-path-config {
description
"Configuration data for match conditions on AS path set";
leaf as-path-set {
type leafref {
path "/rpol:routing-policy/rpol:defined-sets/" +
"oc-bgp-pol:bgp-defined-sets/oc-bgp-pol:as-path-sets/" +
"oc-bgp-pol:as-path-set/oc-bgp-pol:as-path-set-name";
}
description "References a defined AS path set";
}
uses rpol:match-set-options-group;
}
grouping match-as-path-state {
description
"Operational state data for match conditions on AS path set";
}
grouping match-as-path-top {
description
"Top-level grouping for match conditions on AS path set";
container match-as-path-set {
description
"Match a referenced as-path set according to the logic
defined in the match-set-options leaf";
container config {
description
"Configuration data for match conditions on AS path set";
uses match-as-path-config;
}
container state {
config false;
description
"Operational state data for match conditions on AS
path set";
uses match-as-path-config;
uses match-as-path-state;
}
}
}
grouping bgp-match-set-conditions {
description
"Condition statement definitions for checking membership in a
defined set";
uses match-community-top;
uses match-ext-community-top;
uses match-as-path-top;
}
grouping community-count-config {
description
"Configuration data for community count condition";
uses pol-types:attribute-compare-operators;
}
grouping community-count-state {
description
"Operational state data for community count condition";
}
grouping community-count-top {
description
"Top-level grouping for community count condition";
container community-count {
description
"Value and comparison operations for conditions based on the
number of communities in the route update";
container config {
description
"Configuration data for community count condition";
uses community-count-config;
}
container state {
config false;
description
"Operational state data for community count condition";
uses community-count-config;
uses community-count-state;
}
}
}
grouping as-path-length-config {
description
"Configuration data for AS path length condition";
uses pol-types:attribute-compare-operators;
}
grouping as-path-length-state {
description
"Operational state data for AS path length condition";
}
grouping as-path-length-top {
description
"Top-level grouping for AS path length condition";
container as-path-length {
description
"Value and comparison operations for conditions based on the
length of the AS path in the route update";
container config {
description
"Configuration data for AS path length condition";
uses as-path-length-config;
}
container state {
config false;
description
"Operational state data for AS path length condition";
uses as-path-length-config;
uses as-path-length-state;
}
}
}
grouping bgp-conditions-config {
description
"Configuration data for BGP-specific policy conditions";
leaf med-eq {
type uint32;
description
"Condition to check if the received MED value is equal to
the specified value";
}
leaf origin-eq {
type oc-bgp-types:bgp-origin-attr-type;
description
"Condition to check if the route origin is equal to the
specified value";
}
leaf-list next-hop-in {
type inet:ip-address-no-zone;
description
"List of next hop addresses to check for in the route
update";
}
leaf-list afi-safi-in {
type identityref {
base oc-bgp-types:AFI_SAFI_TYPE;
}
description
"List of address families which the NLRI may be
within";
}
leaf local-pref-eq {
type uint32;
// TODO: add support for other comparisons if needed
description
"Condition to check if the local pref attribute is equal to
the specified value";
}
leaf route-type {
// TODO: verify extent of vendor support for this comparison
type enumeration {
enum INTERNAL {
description "route type is internal";
}
enum EXTERNAL {
description "route type is external";
}
}
description
"Condition to check the route type in the route update";
}
}
grouping bgp-conditions-state {
description
"Operational state data for BGP-specific policy conditions";
}
grouping bgp-conditions-top {
description
"Top-level grouping for BGP-specific policy conditions";
container bgp-conditions {
description
"Top-level container ";
container config {
description
"Configuration data for BGP-specific policy conditions";
uses bgp-conditions-config;
}
container state {
config false;
description
"Operational state data for BGP-specific policy
conditions";
uses bgp-conditions-config;
uses bgp-conditions-state;
}
uses community-count-top;
uses as-path-length-top;
uses bgp-match-set-conditions;
}
}
grouping community-set-config {
description
"Configuration data for BGP community sets";
leaf community-set-name {
type string;
mandatory true;
description
"name / label of the community set -- this is used to
reference the set in match conditions";
}
leaf-list community-member {
type union {
type oc-bgp-types:bgp-std-community-type;
type oc-bgp-types:bgp-community-regexp-type;
type oc-bgp-types:bgp-well-known-community-type;
}
description
"members of the community set";
}
}
grouping community-set-state {
description
"Operational state data for BGP community sets";
}
grouping community-set-top {
description
"Top-level grouping for BGP community sets";
container community-sets {
description
"Enclosing container for list of defined BGP community sets";
list community-set {
key "community-set-name";
description
"List of defined BGP community sets";
leaf community-set-name {
type leafref {
path "../config/community-set-name";
}
description
"Reference to list key";
}
container config {
description
"Configuration data for BGP community sets";
uses community-set-config;
}
container state {
config false;
description
"Operational state data for BGP community sets";
uses community-set-config;
uses community-set-state;
}
}
}
}
grouping ext-community-set-config {
description
"Configuration data for extended BGP community sets";
leaf ext-community-set-name {
type string;
description
"name / label of the extended community set -- this is
used to reference the set in match conditions";
}
leaf-list ext-community-member {
type union {
type oc-bgp-types:bgp-ext-community-type;
type oc-bgp-types:bgp-community-regexp-type;
}
description
"members of the extended community set";
}
}
grouping ext-community-set-state {
description
"Operational state data for extended BGP community sets";
}
grouping ext-community-set-top {
description
"Top-level grouping for extended BGP community sets";
container ext-community-sets {
description
"Enclosing container for list of extended BGP community
sets";
list ext-community-set {
key "ext-community-set-name";
description
"List of defined extended BGP community sets";
leaf ext-community-set-name {
type leafref {
path "../config/ext-community-set-name";
}
description
"Reference to list key";
}
container config {
description
"Configuration data for extended BGP community sets";
uses ext-community-set-config;
}
container state {
config false;
description
"Operational state data for extended BGP community sets";
uses ext-community-set-config;
uses ext-community-set-state;
}
}
}
}
grouping as-path-set-config {
description
"Configuration data for AS path sets";
leaf as-path-set-name {
type string;
description
"name of the AS path set -- this is used to reference
the set in match conditions";
}
leaf-list as-path-set-member {
// TODO: need to refine typedef for AS path expressions
type string;
description
"AS path expression -- list of ASes in the set";
}
}
grouping as-path-set-state {
description
"Operational state data for AS path sets";
}
grouping as-path-set-top {
description
"Top-level grouping for AS path sets";
container as-path-sets {
description
"Enclosing container for list of define AS path sets";
list as-path-set {
key "as-path-set-name";
description
"List of defined AS path sets";
leaf as-path-set-name {
type leafref {
path "../config/as-path-set-name";
}
description
"Reference to list key";
}
container config {
description
"Configuration data for AS path sets";
uses as-path-set-config;
}
container state {
config false;
description
"Operational state data for AS path sets";
uses as-path-set-config;
uses as-path-set-state;
}
}
}
}
// augment statements
augment "/rpol:routing-policy/rpol:defined-sets" {
description "adds BGP defined sets container to routing policy
model";
container bgp-defined-sets {
description
"BGP-related set definitions for policy match conditions";
uses community-set-top;
uses ext-community-set-top;
uses as-path-set-top;
}
}
grouping as-path-prepend-config {
description
"Configuration data for the AS path prepend action";
leaf repeat-n {
type uint8 {
range 1..max;
}
description
"Number of times to prepend the local AS number to the AS
path. The value should be between 1 and the maximum
supported by the implementation.";
}
}
grouping as-path-prepend-state {
description
"Operational state data for the AS path prepend action";
}
grouping as-path-prepend-top {
description
"Top-level grouping for the AS path prepend action";